I am using the subfig
package to make many subfloats in a figure
environment. It works well, as long as you realize that it tracks the whitespaces within the float
environment.
It also has an option to split figures over multiple pages using a \ContinuedFloat
command. This means that once a number of subfigures fill up a page, then you end the figure and in a new page start a figure with this \ContinuedFloat
command -- and it resumes laying out the subfigures (preserving the counts, etc.)
Note that the usepackage command should be as described, and the caption
and captcont
package should not be loaded, as it causes undesired redefinitions and incompatibilities.
\usepackage[caption=false]{subfig} % don't load caption or captcont
\begin{figure}
\subfloat[First]{\includegraphic{first} } \,
\subfloat[Second]{\includegraphic{second} } \,
\subfloat[Third]{\includegraphic{third} } \,
\end{figure}
Then to continue subfigures later (presumably, on a new page)
\begin{figure}
\ContinuedFloat
\subfloat[Fourth]{\includegraphic{fourth} } \,
\subfloat[Fifth]{\includegraphic{fifth} } \,
\subfloat[Sixth]{\includegraphic{sixth} } \,
\caption{All of my six subfigures}
\end{figure}
Nifty! But for this you have to know how big your subfigures are, or how many of them you have. I have potentially 30 or 40 or 100 subfigures that I would like to lay out in an array on a page, continuing over into the next page. Also based on the dataset, the aspect ratio of the images maybe different and some will have 5 images per row, and others maybe only 3. These are basically the results from data analysis of some images, and I am producing the tex file programmatically.
Main question: Is there a way to detect that after N subfigures the page is full, and to continue the remaining subfigures in a new page?
Or any other suggestions on how to deal with this issue are also welcome!
:)
code
\includegraphic[width=0.3\textwidth,height=0.2\textheight,keepaspectratio=true]{graphic.png}code
would basically create a virtual grid of 3x5 rows & cols in which the images would be placed. When the page fills up, my program inserts acode
\end{figure}\begin{figure}\ContinuedFloatcode
and continues writing out the subfloats. However, this isn't a true multi-page self-breaking figure env, is it?`
to mark your inline code as I did in my edit.