我在一篇单栏文章中有下图:
\documentclass[12pt,a4paper]{article}
\usepackage{graphicx}
\usepackage{showframe}
\begin{document}
\begin{figure}[htbp]
\centering
\begin{minipage}{0.325\textwidth}
\centering
\includegraphics[width=\textwidth,height=9cm]{example-image-a}
\end{minipage}
\begin{minipage}{0.325\textwidth}
\centering
\includegraphics[width=\textwidth,height=9cm]{example-image-a}
\end{minipage}
\begin{minipage}{0.325\textwidth}
\centering
\includegraphics[width=\textwidth,height=9cm]{example-image-a}
\end{minipage}
% insert some space that fills the page vertically
% and creates a gap between the first and second row of pictures
\begin{minipage}{0.325\textwidth}
\centering
\includegraphics[width=\textwidth,height=9cm]{example-image-a}
\end{minipage}
\begin{minipage}{0.325\textwidth}
\centering
\includegraphics[width=\textwidth,height=9cm]{example-image-a}
\end{minipage}
\begin{minipage}{0.325\textwidth}
\centering
\includegraphics[width=\textwidth,height=9cm]{example-image-a}
\end{minipage}
\caption{A caption that describes all six images.}
\end{figure}
\end{document}
这将创建两行,每行 3 张图片。所有图片大小相同。由于图形几乎垂直填满整个页面,我想用空格将两行分开,以便更容易区分一行结束和另一行开始的位置。因为我仍在设计我的文档,所以我不想将空格设为固定大小,而是调整它,以便间隙占据页面上剩余的任何垂直空间。例如,我可以在两行之间包含一张全白的图片,但随后我必须决定固定高度:
\documentclass[12pt,a4paper]{article}
\usepackage{graphicx}
\usepackage{showframe}
\begin{document}
\begin{figure}[htbp]
\centering
\begin{minipage}{0.325\textwidth}
\centering
\includegraphics[width=\textwidth,height=9cm]{example-image-a}
\end{minipage}
\begin{minipage}{0.325\textwidth}
\centering
\includegraphics[width=\textwidth,height=9cm]{example-image-a}
\end{minipage}
\begin{minipage}{0.325\textwidth}
\centering
\includegraphics[width=\textwidth,height=9cm]{example-image-a}
\end{minipage}
\begin{minipage}{\textwidth}
\centering
% "B" could be an all white picture
% but how heigh should it be?
\includegraphics[width=\textwidth,height=2cm]{example-image-b}
\end{minipage}
\begin{minipage}{0.325\textwidth}
\centering
\includegraphics[width=\textwidth,height=9cm]{example-image-a}
\end{minipage}
\begin{minipage}{0.325\textwidth}
\centering
\includegraphics[width=\textwidth,height=9cm]{example-image-a}
\end{minipage}
\begin{minipage}{0.325\textwidth}
\centering
\includegraphics[width=\textwidth,height=9cm]{example-image-a}
\end{minipage}
\caption{A caption that describes all six images.}
\end{figure}
\end{document}
答案1
看看下面的解决方案是否满足你的期望:
对于上图,我使用\rule{0pt}{<height>}
规则高度计算考虑\textheight
,包含图像的两行的高度,标题中文本的高度以及估计的有助于行分离的垂直距离tabularx
,\abovecaptionskip
和\belowcaptionskip
(总共〜3\baselineskip
)。
标题高度是使用保存框测量的,\captbox
其中图形标签的宽度是在 上估计的11ex
。这需要将标题文本保存在 中\savebox
,但是只有在标题样式为 的情况下才能在标题中使用此文本hang
。否则,需要在标题环境中再次输入标题文本。
如果一行内图形之间的距离过大,可以减少\setlength\tabcolsep{<width}
,默认值为6pt。
\documentclass[12pt]{article}
\usepackage{caption,graphicx}
\usepackage{tabularx}
\usepackage{calc}
\usepackage[a4paper,
showframe
]{geometry}
\newsavebox{\captbox}
\begin{document}
\begin{figure}[p]
\savebox{\captbox}{\begin{minipage}{\textwidth}\hspace{11ex}
A caption that describes all six images.
A caption that describes all six images. A caption that describes all six images. A caption that describes all six images.
\end{minipage}
}
\begin{tabularx}{\textwidth}{@{}*{3}{>{\centering\arraybackslash}X}@{}}
\includegraphics[width=\linewidth,height=9cm]{example-image-a}
& \includegraphics[width=\linewidth,height=9cm]{example-image-b}
& \includegraphics[width=\linewidth,height=9cm]{example-image-c}
\\
\rule{0pt}{\textheight-180mm-\ht\captbox-3\baselineskip}
% 3\baselineskip is estimation of all not considered vertical spaces
& & \\
\includegraphics[width=\linewidth,height=9cm]{example-image-a}
& \includegraphics[width=\linewidth,height=9cm]{example-image-b}
& \includegraphics[width=\linewidth,height=9cm]{example-image-c}
\\
\end{tabularx}
\caption{A caption that describes all six images.
A caption that describes all six images. A caption that describes all six images. A caption that describes all six images.
}
\label{fig:mycomplicatedimageset}
\end{figure}
\end{document}