2

How do I stack say three floats on top of each other vertically such that the height of each plot is approximately the third of the text height of the page? (i.e. so they all fit including captions and subcaptions). I don't care about float width as long as the scale to fit the linewidth.

I'd prefer to use the subcaption package.

Appreciate any support,

2
  • Please provide a bit more information about your document setup and the structure of the float in question. E.g., are there three subfigure environments inside a common figure? Are the subfloats of roughly comparable size?
    – Mico
    Commented Oct 31, 2013 at 8:56
  • 1
    Floats/subfloats doesn't really have anything to do with the scaling of their content. Are the plots images included with \includegraphics? Commented Oct 31, 2013 at 9:03

2 Answers 2

4
\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage{subcaption}

\begin{document}
\begin{figure}[htbp]
\centering
\subcaptionbox{some caption}[\textwidth]{\includegraphics[height=.3\textheight]{example-image-a}}
\subcaptionbox{some caption}[\textwidth]{\includegraphics[height=.3\textheight]{example-image-b}}
\subcaptionbox{some caption}[\textwidth]{\includegraphics[height=.3\textheight]{example-image-c}}
\caption{This is the main caption}
\end{figure}

\end{document}

enter image description here

2
  • Note that you get LaTeX Warning: Float too large for page by 15.20547pt on input line 22, so the images should be somewhat smaller. Commented Oct 31, 2013 at 10:39
  • Since the odds that this float is going to be typeset on a page all by itself are rather high, you may want to specify \begin{figure}[p!] instead of \begin{figure}[htbp].
    – Mico
    Commented Oct 31, 2013 at 10:39
1

With this stackengine approach, you can control the gap from the bottom of the image to the top of the subcaption (currently 1.1\baselineskip) as well as the gap from the bottom of the caption to the top of the image below (currently 8pt).

\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\setstackgap{S}{8pt}
\setstackgap{L}{1.1\baselineskip}
\usepackage{graphicx}
\begin{document}
\begin{figure}[p]
\centering\Shortstack
{
\def\stacktype{L}
\stackunder{\includegraphics[height=.27\textheight]{example-image-a}}
           {(a) This is subcaption A}
\\
\def\stacktype{L}
\stackunder{\includegraphics[height=.27\textheight]{example-image-a}}
           {(b) This is subcaption B}
\\
\def\stacktype{L}
\stackunder{\includegraphics[height=.27\textheight]{example-image-a}}
           {(c) This is subcaption C}
}
\caption{This is the figure caption}
\end{figure}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .