上节图 24.1 中将标题放在图形的左侧,而对于双面版式
的文档,常常会希望将标题置于图形的内侧。这时可用 ifthen 宏包 的 \ifthenelse 命令来指定对奇数页和偶数页所使用的不同代码。例如:
\usepackage{ifthen}
...
\begin{figure}
\centering
\ifthenelse{\isodd{\pageref{fig:side:caption}}}
{% BEGIN ODD-PAGE FIGURE
\begin{minipage}[c]{.45\textwidth}
\centering
\caption{Caption on the Side}
\label{fig:side:caption}
\end{minipage}%
\hspace{0.05\textwidth}%
\begin{minipage}[c]{.45\textwidth}
\includegraphics[width=\textwidth]{graphic.eps}
\end{minipage}%
}% END ODD-PAGE FIGURE
{% BEGIN EVEN-PAGE FIGURE
\begin{minipage}[c]{.45\textwidth}
\includegraphics[width=\textwidth]{graphic.eps}
\end{minipage}%
\hspace{0.05\textwidth}%
\begin{minipage}[c]{.45\textwidth}
\centering
\caption{Caption on the Side}
\label{fig:side:caption}
\end{minipage}%
}% END EVEN-PAGE FIGURE
\end{figure}
生成的图形其标题总在图形的内侧。 |