在使用双面版式排版时,页面左右的边空因奇偶页而取不同的值,
且使用宽图形时常常希望图形延伸到装订的那一边(奇数页的左边, 偶数页的右边)。在这种情形下,需要使用 ifthen 宏包提供的
\ifthenelse 命令来根据图形出现在奇数页或偶数页而使用不同的命令。
例如:
\usepackage{ifthen}
...
\newlength{\marginwidth}
\setlength{\marginwidth}{\marginparwidth}
\addtolength{\marginwidth}{\marginparsep}
\begin{figure}
\ifthenelse{\isodd{\pageref{fig:wide}}}%
{% BEGIN ODD-PAGE FIGURE
\begin{narrow}{0in}{-\marginwidth}
\includegraphics[width=\linewidth]{wide.eps}
\caption{Figure Caption}
\label{fig:wide}
\end{narrow}
}% END ODD-PAGE FIGURE
{% BEGIN EVEN-PAGE FIGURE
\begin{narrow}{-\marginwidth}{0in}
\includegraphics[width=\linewidth]{wide.eps}
\caption{Figure Caption}
\label{fig:wide}
\end{narrow}
}% END EVEN-PAGE FIGURE
\end{figure}
结果如图 22.1。由于 \ifthenelse 使用命令 \pageref
作为输入,所以需要 LATEX 运行足够的次数后才能正确地排出。
注:如果使用 hyperref 宏包,
上例中的 \pageref 应替换为 \hypergetpageref。
|
|
|
|