Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have 2 subfigures vertically arranged using the subcaption package. I can set the vertical space between the 2 to something specific (using \bigskip or \vspace), but I would like to put as much space as possible between the 2 instead, so that the first subfigure is at the top of the page, and the second one at the bottom (with the caption for the whole figure beneath it) - something like \vfill.

Minimal working example:

\documentclass[10pt,a4paper]{article}
\usepackage{graphicx}
\usepackage{subcaption}

\begin{document}
\begin{figure}
    \begin{subfigure}{\textwidth}
        \centering \rule{4cm}{4cm} % 1st subfigure: \includegraphics{fig}...
    \end{subfigure}
    \par\bigskip % maximise vertical space here instead
    \begin{subfigure}{\textwidth}
        \centering \rule{4cm}{4cm} % 2nd subfigure: \includegraphics{fig}...
    \end{subfigure}
\caption{Some caption}
\end{figure}
\end{document}
share|improve this question
    
Welcome to TeX.SE! Have you tried \vspace*{\fill} as the "filler" instruction? –  Mico Nov 28 '13 at 19:48
    
I just tried it, it doesn't insert any space at all. –  tave Nov 28 '13 at 19:58
    
What package provides subfigure environment? –  Sigur Nov 28 '13 at 22:59
    
@Sigur subcaption :-) –  Harish Kumar Nov 28 '13 at 23:01
    
@HarishKumar, strange! I'm getting the error Environment subfigure undefined. –  Sigur Nov 28 '13 at 23:03
show 2 more comments

2 Answers

I don't know why \vspace{\fill} is not working in between. Hence this is a work-around using a parbox:

\documentclass[10pt,a4paper]{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{showframe}   %% just for demo

\begin{document}
\begin{figure}
    \begin{subfigure}{\textwidth}
       \parbox[t][.48\textheight]{\linewidth}{%  .48 because you have caption below
        \centering \rule{4cm}{4cm}}% 
    \end{subfigure}%
    \par
    \begin{subfigure}{\textwidth}
        \parbox[b][.48\textheight]{\linewidth}{%   %  .48 because you have caption below
        \centering \rule{4cm}{4cm}} 
    \end{subfigure}
\caption{Some caption}
\end{figure}
\end{document}

enter image description here

You can get rid of subfigure and use \parboxes or minipages directly where you can specify the height and width both.

share|improve this answer
    
Thanks for this workaround. It's working, however it still requires some manual tweaking to adjust the size of the \parbox depending on the length of the figure's caption - which I would have preferred to avoid. (NB: I'm keeping the subfigure to label / reference the subfigures) –  tave Nov 29 '13 at 12:26
add comment

I put a \vspace*{...} inside the subfigure block, just before \end{subfigure}. It applied the specified amount of spacing between my three subfigures. I did not try it using \fill, but I expect it would have a similar result. I've included a vague snippet of my code below. Hooray for simplicity!

\begin{figure*}[htb]
    \begin{subfigure}[t]{\linewidth}
        \label{}
        \centering\includegraphics[]{image1.eps}
        \caption{}
        \vspace*{2mm}
    \end{subfigure}
    \begin{subfigure}[c]{\linewidth}
        \label{}
        \centering\includegraphics[]{image2.eps}
        \caption{}
        \vspace*{2mm}
    \end{subfigure}
    \begin{subfigure}[b]{\linewidth}
        \label{}
        \centering\includegraphics[]{image3.eps}
        \caption{}
    \end{subfigure}
\end{figure*}
share|improve this answer
1  
Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. –  Adam Liter Feb 19 at 19:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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