一般而言图片的题注会加在图片下方。如果想要使题注位于图片上方,只需要 \caption{caption-content} 置于命令 \includegraphics[options]{picture-file} 之前即可。下面是一个例子。
\begin{figure}[h!]
\caption{A picture of a gull.}
\centering
\includegraphics[width=0.5\textwidth]{atom_in_cavity.jpg}
\end{figure}
\begin{figure}[h!]
\centering
\reflectbox{%
\includegraphics[width=0.5\textwidth]{atom_in_cavity.jpg}}
\caption{A picture of the same gull
looking the other way!}
\end{figure}
有的时候我们还可能希望题注出现在图片的右面。这可以通过两种方法实现。
第一,在figure环境中嵌套小页(minipage)环境来实现。
第二,使用sidecap宏包中的SCfigure环境。下面例子中我们分别使用了这两种方法实现了题注的侧置。
\begin{figure}
\begin{minipage}{0.5\textwidth}
\includegraphics[width=\textwidth]{atoms_in_cavity.jpg}
\end{minipage}%
\begin{minipage}{0.5\textwidth}
\caption{A picture of a gull.}
\end{minipage}
\end{figure}
\begin{SCfigure}
\centering
\includegraphics[width=0.5\textwidth]{atoms_in_cavity.jpg}
\caption{A picture of a gull}
\end{SCfigure}
下面是一个例子:
\begin{figure}[htpb]
\centering
\noindent\makebox[\textwidth][c] {
% 因为两个0.55\texwidth的图片横向宽度 大于 \texwidth,所以要看做一个整体
\begin{minipage}{0.55\textwidth}
\includegraphics[width=\textwidth]{figure/spinPic/mtxPic/spin1D_ee_Matrix.png}
%图片的宽度实际为:0.55*1\texwidth
\end{minipage}
\begin{minipage}{0.55\textwidth}
\includegraphics[width=\textwidth]{figure/spinPic/mtxPic/spin1D_mm_Matrix.png}
\end{minipage}
}
\noindent\makebox[\textwidth][c] {
\begin{minipage}{0.55\textwidth}
\includegraphics[width=\textwidth]{figure/spinPic/mtxPic/spin1D_em_Matrix.png}
\end{minipage}
\begin{minipage}{0.55\textwidth}
\caption{Response matrices from the SM MC sample for different channels ($\ee$, $\mumu$ and $\emu$).}
\label{fig:smMatrix} % label要放在caption 之后,否则在引用过程中会出现引用错误。
\end{minipage}
}
\end{figure}