[Tex/LaTex] How to keep multiple figure together

captionsfloatspositioningsubfloats

I have 6 graphs that I have to keep together while showing. I have to make them almost same width as text width, otherwise the graphs will not be properly seen. So I cannot add them side by side but I have to keep them vertically one after another spanning over maybe two pages. Now my question is how can I do that?

I have tried to use them in subfloat or subfigure and also tried putting them together inside a single figure environment. But then the figure is coming in only one page and only two or three (height that is matching with the height of the page) graphs are visible.

If I force them to float to exactly the place I am putting the figure (giving [H] option in figure environment) it is keeping a lots of space in starting pages and if I omit the [H] option then the figures are not coming together. Is there some good way to put them together?

It would be better if I could make a single caption for all six figure that is all six figures will come under a single caption spreading over more than one page.

Best Answer

The trick is to use \ContinuedFloat from the subfig package. As you can see in page 5 of package documentation,

It sometimes occurs, especially when using sub-floats, that a single figure needs to be continued across pages. The \ContinuedFloat command is placed at the beginning of the floating environment or after changing \@captype inside the floating environment to make the next figure, table or other floating \caption a continuation of the last float \caption of the same type. It does this by saving the sub-float numbering internally and keeping the float numbering from advancing.

So, the MWE for the situation you described becomes something like this,

\documentclass{article}

\usepackage{subfig}

\usepackage{pgf}

\usepackage[a4paper,top=10.0mm,bottom=15.0mm]{geometry}

\begin{document}
\listoffigures

\def\mygraphcaption{Here are my graphs.}
\newlength{\mygraphwidth}\setlength{\mygraphwidth}{0.9\textwidth}

\begin{figure}[!tbp]
  \centering
  \subfloat[First Graph]{\pgfimage[width=\mygraphwidth]{mygraph1}}

  \subfloat[Second Graph]{\pgfimage[width=\mygraphwidth]{mygraph2}}

  \subfloat[Third Graph]{\pgfimage[width=\mygraphwidth]{mygraph3}}
  \caption{\mygraphcaption}%
  \label{fig:firstthree}%
\end{figure}

\begin{figure}[!tbp]
  \ContinuedFloat
  \centering
  \subfloat[Fourth Graph]{\pgfimage[width=\mygraphwidth]{mygraph4}}

  \subfloat[Fifth Graph]{\pgfimage[width=\mygraphwidth]{mygraph5}}

  \subfloat[Sixth Graph]{\pgfimage[width=\mygraphwidth]{mygraph6}}
  \caption{{\itshape(continued)} \mygraphcaption}%
  \label{fig:lastthree}%
\end{figure}


\end{document}

And here are the output pages,

enter image description hereenter image description hereenter image description here

Since you indicated that graphs will be almost same width as text width, and you want to use a single caption, I have used length and macros to take care these issues. But as you definitely know, you can tweak them or use your own dimensions or more customized texts for the scenario.

The only downside of the solution as I can see is that you have to decide manually where to break the group. You need to go through some trial-and-error and put some in one page, the remainder in the next page, and so on. But I assume that you do not have many instances of these group of graphs and you can live with the manual tweaking. Please remember to keep the figure environments closely placed in the source file.

Also, please note that the ! before tbp is important, that will help keeping your subgroup of graphs together.


Use of captcont package will be another option.

Related Question