答案1
这是一个使用 的解决方案subcaption
。我认为使用 也可以获得类似的结果subfloat
。
只需给出\caption{}
不带任何参数,这样它就会只打印标签((一),(二)...)不是标题文字。然后可以为主图提供标题,其中子图可以“子”引用。示例输出:
通过修改代码制作相应的 MWE另一个问题。
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\captionsetup{subrefformat=parens}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[b]{0.3\linewidth}
\includegraphics[width=\linewidth]{example-image-a}
\caption{}
\label{fig:a}
\end{subfigure}
\begin{subfigure}[b]{0.3\linewidth}
\includegraphics[width=\linewidth]{example-image-b}
\caption{}
\label{fig:b}
\end{subfigure}
\begin{subfigure}[b]{0.3\linewidth}
\includegraphics[width=\linewidth]{example-image-c}
\caption{}
\label{fig:c}
\end{subfigure}
\caption{
\subref{fig:a} first figure.
\subref{fig:b} second figure.
\subref{fig:c} third figure.
}
\label{fig:main}
\end{figure}
Figure~\ref{fig:main} has three Subfigures--- \ref{fig:a}, \ref{fig:b} and \ref{fig:c}.
\end{document}
编辑
可以手动将标题放在左侧,然后使用\phantomsubcaption
来隐藏自动标题。示例输出:
对应代码:
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\captionsetup{subrefformat=parens}
\begin{document}
\begin{figure}
\centering
{(a)~\includegraphics[width=0.25\linewidth]{example-image-a}
\phantomsubcaption\label{fig:a}}
{(b)~\includegraphics[width=0.25\linewidth]{example-image-b}
\phantomsubcaption\label{fig:b}}
{(c)~\includegraphics[width=0.25\linewidth]{example-image-c}
\phantomsubcaption\label{fig:c}}
\caption{
\subref{fig:a} first figure.
\subref{fig:b} second figure.
\subref{fig:c} third figure.
}
\label{fig:main}
\end{figure}
Figure~\ref{fig:main} has three Subfigures--- \ref{fig:a}, \ref{fig:b} and \ref{fig:c}.
\end{document}
答案2
作为替代方案nidhin 的回答,也可以使用 subfig 包:
\documentclass{article}
\usepackage{subfig}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
% [] Needed for the caption label (a), (b) to be typeset.
\subfloat[\label{fig:mytopic-blabla}]{
\includegraphics[height=5cm]{images/graph-mytopic-blabla.png}
}
\subfloat[]{
% Label can be either in caption or body.
\label{fig:mytopic-yadayada}
\includegraphics[height=5cm]{images/graph-mytopic-yadayada.png}
}
\caption{
% Must \protect the subref command inside floats/captions.
\protect\subref{fig:mytopic-blabla}
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
\protect\subref{fig:mytopic-yadayada}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.
}
\end{figure}
\end{document}