带有上方和下方标题的子图

带有上方和下方标题的子图

我在用着

\usepackage{subfig}
\captionsetup[subfigure]{labelformat=empty} 

这可能吗?

答案1

标题有点含糊;您是想要一个带有两个标题的子图,一个在上面,另一个在下面,还是想要两个子图,一个子图的标题在下面,另一个子图的标题在上面?

无论如何,我为这两种情况提出了一个可能的解决方案。对于第一种情况,想法是使用没有高度但宽度与实际子图相同的“假”子图(我使用了\rules);这些假子图的标题将是真实子图的上述标题。

第二种情况稍微复杂一些,需要使用强大的floatrow包裹。

代码(根据您的实际数字,您可能需要调整我在示例中使用的长度):

\documentclass{article}
\usepackage[a6paper]{geometry}% just for the example
\usepackage[demo]{graphicx}
\usepackage{subfig}
\usepackage{floatrow}
\captionsetup[subfigure]{labelformat=empty,justification=raggedright} 

\begin{document}

\begin{figure}
\subfloat[A subfigure with a caption above]{\rule{3cm}{0pt}}\quad
\subfloat[Another subfigure with a caption above]{\rule{3cm}{0pt}}\\[0.6ex]
\subfloat[A subfigure with a caption below]{\includegraphics[width=3cm,height=2cm]{image1}}\quad
\subfloat[Another subfigure with a caption below]{\includegraphics[width=3cm,height=2cm]{image2}}
\caption{A figure with two subfigures}
\label{fig:test1}
\end{figure}

\begin{figure}
\ffigbox[\FBwidth]
{\begin{subfloatrow}
\ffigbox[\FBwidth]
  {\caption{A subfigure with a caption below}}
  {\includegraphics[width=3cm,height=2cm]{image1}}
\floatsetup[subfigure]{capposition=TOP}
\raisebox{1.3\height}{%
\ffigbox[\FBwidth]
  {\caption{A subfigure with a caption above}}  
  {\includegraphics[width=3cm,height=2cm]{image1}}
}%
\end{subfloatrow}}
{\caption{Another figure with two subfigures\label{fig:test2}}}
\end{figure}

\end{document}

在此处输入图片描述

选项demo只是graphicx用黑色矩形替换实际图形;不是在实际文档中使用该选项。

相关内容