两个子图之间的垂直空间被拉伸

两个子图之间的垂直空间被拉伸

我想在两个子图之间添加垂直空间,以便上图与页面顶部对齐,并且该图标题的最后一行与页面底部对齐。我的方法如下,但没有成功:

  \begin{figure}[p]
  %
  \centering
  \subfloat[]{\includegraphics[width=5cm]{Lenna.png}}\\
  \vfill
  \subfloat[]{\includegraphics[width=5cm]{Lenna.png}}
  %
  \caption{Vertical filling space (between the two subfigures) should
    be added so that the upper figure is aligned with the top of the
    page and the last line of this figure caption is aligned with the
    bottom of the page.} 
  %
\end{figure}

在此处输入图片描述

答案1

下面我提出两种可能性;第一种,该物体被视为浮动物体;第二种,该物体是静态的。

一个选项是minipagefigure环境中使用 ;minipage具有固定高度等于\textheight;该对象被视为浮点数:

\documentclass{article}
\usepackage{showframe}
\usepackage{subfig}
\usepackage[demo]{graphicx}

\begin{document}

\begin{figure}[p]
\begin{minipage}[c][\textheight][c]{\textwidth}
  \centering
  \subfloat[]{\includegraphics[width=5cm]{Lenna.png}}

  \vfill

  \subfloat[]{\includegraphics[width=5cm]{Lenna.png}}

  \caption{Vertical filling space (between the two subfigures) should
    be added so that the upper figure is aligned with the top of the
    page and the last line of this figure caption is aligned with the
    bottom of the page.}
\end{minipage}     
\end{figure}

\end{document}

在此处输入图片描述

一种选择是使用minipage\captionofminipage具有固定高度等于\textheight;对象是静态的:

\documentclass{article}
\usepackage{showframe}
\usepackage{subfig}
\usepackage[demo]{graphicx}
\captionsetup[subfigure]{labelformat=parens,font=footnotesize}
\captionsetup[figure]{labelformat=simple,font=normalsize}

\begin{document}

\noindent\begin{minipage}[c][\textheight][c]{\textwidth}
  \centering
  \includegraphics[width=5cm]{Lenna.png}
  \captionof{subfigure}{}

  \vfill

  \includegraphics[width=5cm]{Lenna.png}
  \captionof{subfigure}{}

  \captionof{figure}{Vertical filling space (between the two subfigures) should
    be added so that the upper figure is aligned with the top of the
    page and the last line of this figure caption is aligned with the
    bottom of the page.} 
\end{minipage}

\end{document}

在此处输入图片描述

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

相关内容