# How to keep multiple figure together

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.

• A tabular can be used to fit multiple images into a pattern (vertically and or horizontally). I'm not sure what happens over multiple pages. Do you have to use a float? – John Kormylo Oct 28 '13 at 13:59

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,

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.

• \ContinuedFloat is provided by caption rather than subfig (which by default loads caption). Perhaps the combination caption+subcaption is better. The manual of TikZ/PGF says that \includegraphics is preferable to \pgfimage. – egreg Oct 28 '13 at 16:58
• @egreg I was originally an avid graphicx user. I switched to pgf several years back when I failed to solve a problem of image inclusion in beamer. I do not remember exactly what was the problem. At that time I was not familiar with TeX.SE. From today, I will switch back to graphicx. (I have already gone through this enlightening question). And if and when the problem arises again, I have this excellent community to ask for help. – Masroor Oct 30 '13 at 0:29