题
我目前使用斯芬克斯来生成其使用Pdftex提供变成为PDF书本式输出乳胶输出
目前,我有通知,警告,和其他“告诫”呈现出界盒内起来,在那看起来有点像这样的风格:
-----------------------------------
| Warning: lorem ipsum foozle |
| fuzzle fuzz buzz |
|----------------------------------
这产生这样这样的盒子看起来乳胶:
\begin{notice}{warning}{Warning:}
The \code{repoze.bfg} documentation is offered under the
Creative Commons Attribution-Nonconmmercial-Share Alike 3.0 United
States License.
\end{notice}
有在胶乳.sty文件提供所框的一系列命令 行为:
% Notices / Admonitions
%
\newlength{\py@noticelength}
\newcommand{\py@heavybox}{
\setlength{\fboxrule}{1pt}
\setlength{\fboxsep}{7pt}
\setlength{\py@noticelength}{\linewidth}
\addtolength{\py@noticelength}{-2\fboxsep}
\addtolength{\py@noticelength}{-2\fboxrule}
\setlength{\shadowsize}{3pt}
\Sbox
\minipage{\py@noticelength}
}
\newcommand{\py@endheavybox}{
\endminipage
\endSbox
\fbox{\TheSbox}
}
% Some are quite plain:
\newcommand{\py@noticestart@note}{}
\newcommand{\py@noticeend@note}{}
\newcommand{\py@noticestart@hint}{}
\newcommand{\py@noticeend@hint}{}
\newcommand{\py@noticestart@important}{}
\newcommand{\py@noticeend@important}{}
\newcommand{\py@noticestart@tip}{}
\newcommand{\py@noticeend@tip}{}
% Others gets more visible distinction:
\newcommand{\py@noticestart@warning}{\py@heavybox}
\newcommand{\py@noticeend@warning}{\py@endheavybox}
\newcommand{\py@noticestart@caution}{\py@heavybox}
\newcommand{\py@noticeend@caution}{\py@endheavybox}
\newcommand{\py@noticestart@attention}{\py@heavybox}
\newcommand{\py@noticeend@attention}{\py@endheavybox}
\newcommand{\py@noticestart@danger}{\py@heavybox}
\newcommand{\py@noticeend@danger}{\py@endheavybox}
\newcommand{\py@noticestart@error}{\py@heavybox}
\newcommand{\py@noticeend@error}{\py@endheavybox}
\newenvironment{notice}[2]{
\def\py@noticetype{#1}
\csname py@noticestart@#1\endcsname
\par\strong{#2}
}{\csname py@noticeend@\py@noticetype\endcsname}
,而不是仅仅具有围绕该通知的箱和具有字表示箱内通知的类型,我想保留围绕admonitition的框,但与图像替换盒单词“警告” ,像这样:
-------------------------------------------
| --- |
| / \ |
| \ / |
| --- Fuzzle foo buz lorem ipsum |
-------------------------------------------
我不能改变的\开始{}通知... \由狮身人面像渲染结束{}通知乳胶文字(好吧,我可以,但它是在屁股真正的痛苦)。我宁愿只是把逻辑在新\ newenvironment {}通知宏。谁能推荐一个战略?到目前为止,我已经试过一切都在泪水已经结束。
解决方案
尝试以下(这需要ifthen
或xifthen
包为\ifthenelse
命令):
% Keep a copy of the original notice environment
\let\origbeginnotice\notice
\let\origendnotice\endnotice
% Redefine the notice environment so we can add our own code to it
\renewenvironment{notice}[2]{%
\origbeginnotice{#1}{#2}% equivalent to original \begin{notice}{#1}{#2}
% load graphics
\ifthenelse{\equal{#1}{warning}}{\includegraphics{warning}}{}
\ifthenelse{\equal{#1}{notice}}{\includegraphics{notice}}{}
% etc.
}{%
\origendnotice% equivalent to original \end{notice}
}
您必须找到一种方式来获得此代码插入到文档的序言。
不隶属于 StackOverflow