3

I want to add vertical space between two subfigures so that 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. My approach is the following one, but without success:

  \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}

enter image description here

  • Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Apr 14 '14 at 7:21
1

Below I present two possibilities; in the first one, the object is treated as a floating object; in the second one, the object is static.

One option using a minipage inside the figure environment; the minipage has fixed height equal to \textheight; the object is treated as a float:

\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}

enter image description here

One option using a minipage and \captionof; the minipage has fixed height equal to \textheight; the object is static:

\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}

enter image description here

The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.