Latex中,插入多张图片,作为一张图片的子图时,需要添加{subsection}包,即
\usepackage{subcaption}
不过,这样的子图时带括号,而引用子图时,不带括号。
示例:
\usepackage{subcaption}
\begin{document}
Reference the sub-figure in full form: \ref{sf1}.
Referencing just the sub-figure parts: \subref{sf1} and \subref{sf2}.
\begin{figure}
\begin{subfigure}{.48\textwidth}
\centering
Contents of the sub-figure
%\includegraphics[width=5cm]{cherry_blossom}
\caption{Subfig 1}
\label{sf1}
\end{subfigure}
\begin{subfigure}{.48\textwidth}
\centering
Contents of the sub-figure
%\includegraphics[width=5cm]{cherry_blossom}
\caption{Subfig 2}
\label{sf2}
\end{subfigure}
\caption{A figure}
\label{fig}
\end{figure}
\end{document}
示例结果: