Many subfigures in one figure

I would like to put 81 subfigures in one figure with one caption and each subfigure labelled by a number. Each subfigure is the same size (so probably I do not need tabularx for this). I would like 4 subfigures in one row, as follows,

SUBFIG1 & SUBFIG2 & SUBFIG3 & SUBFIG4

..

SUBFIG77 & SUBFIG78 & SUBFIG79 & SUBFIG80

SUBFIG81

CAPTION: XXX

Below each subfigure I would like a bracketed number, e.g. below SUBFIG1 I would like (1) etc..

What is the best way to do this within latex? I have tried the tabular environment

\documentclass{report}
\usepackage{subcaption}
\begin{figure}
\begin{tabular}{cccc}
\subfloat[(1)]{\includegraphics[width=2cm]{SUBFIG1.eps}}
& \subfloat[(2)]{\includegraphics[width=2cm]{SUBFIG2.eps}}
&  \subfloat[(3)]{\includegraphics[width=2cm]{SUBFIG3.eps}}
& \subfloat[(4)]{\includegraphics[width=2cm]{SUBFIG4.eps}} \\
\subfloat[(5)]{\includegraphics[width=2cm]{SUBFIG5.eps}}
& \subfloat[(6)]{\includegraphics[width=2cm]{SUBFIG6.eps}}
...
\end{tabular}
\caption{XXX}
\label{xxx}
\end{figure}


but here the subfloat has a-z as the counting delimiter and as soon as I hit 24 subfigures it goes off the page (i.e. does not start subfigure 25 on a new page). Thanks!

• Please fill in some blanks in your formatting objectives. E.g., Which document class do you employ? Do you use the subfig, subfigure or subcaption package? How big is the page, and how wide are the margins? Do all 81 graphs and their associated (sub)captions fit on a single page? If not, how many rows of subfigures should be placed per page? How do you want to see the subfigures numbered? The default method for subfigure numbering is lowercase-alphabetic, but that limits you to 26 items. Do you want arabic or roman numbering, or maybe something else? – Mico Sep 22 at 9:16
• @Mico Thanks for your reply. I have updated my question. As soon as I hit 24 graphs, the next line of four are basically off the page so I think I would like 24 graphs per page (so 6 rows of four graphs per page). The subfigure captions should only contain their labelling, that is, labelled as (1),(2),(3) etc.. If its easier to have this as (I), (II), (III) etc... then that is fine too. – CAF Sep 22 at 9:45

Since all images have the same width, there's no need for a tabular-type approach. Just use \subfloat directives to place them, four per row.

Since you load the subcaption caption (and hence also the caption package), you can use \ContinuedFloat directives at the top of each consecutive figure environment.

The following screenshot shows the last of the figure environments produced by code below.

\documentclass{report}
\usepackage[margin=2.5cm]{geometry} % set page parameters suitably
\usepackage[demo]{graphicx} % remove 'demo' option in real document

\usepackage{subcaption}
\renewcommand\thesubfigure{\arabic{subfigure}} % arabic numerals
\captionsetup[figure]{skip=0.5\baselineskip}
\captionsetup[subfigure]{skip=0.25\baselineskip,position=below}

\begin{document}

\begin{figure}[p]
\setkeys{Gin}{width=0.22\textwidth,height=0.125\textheight,keepaspectratio}
\caption{XXX}\label{fig:xxx}

\subfloat[]{\includegraphics{SUBFIG01}}\hfill
\subfloat[]{\includegraphics{SUBFIG02}}\hfill
\subfloat[]{\includegraphics{SUBFIG03}}\hfill
\subfloat[]{\includegraphics{SUBFIG04}}

\medskip
\subfloat[]{\includegraphics{SUBFIG05}}\hfill
\subfloat[]{\includegraphics{SUBFIG06}}\hfill
\subfloat[]{\includegraphics{SUBFIG07}}\hfill
\subfloat[]{\includegraphics{SUBFIG08}}

\medskip
\subfloat[]{\includegraphics{SUBFIG09}}\hfill
\subfloat[]{\includegraphics{SUBFIG10}}\hfill
\subfloat[]{\includegraphics{SUBFIG11}}\hfill
\subfloat[]{\includegraphics{SUBFIG12}}

\medskip
\subfloat[]{\includegraphics{SUBFIG13}}\hfill
\subfloat[]{\includegraphics{SUBFIG14}}\hfill
\subfloat[]{\includegraphics{SUBFIG15}}\hfill
\subfloat[]{\includegraphics{SUBFIG16}}

\medskip
\subfloat[]{\includegraphics{SUBFIG17}}\hfill
\subfloat[]{\includegraphics{SUBFIG18}}\hfill
\subfloat[]{\includegraphics{SUBFIG19}}\hfill
\subfloat[]{\includegraphics{SUBFIG20}}

\medskip
\subfloat[]{\includegraphics{SUBFIG21}}\hfill
\subfloat[]{\includegraphics{SUBFIG22}}\hfill
\subfloat[]{\includegraphics{SUBFIG23}}\hfill
\subfloat[]{\includegraphics{SUBFIG24}}

\end{figure}

\begin{figure}[p]
\setkeys{Gin}{width=0.22\textwidth,height=0.125\textheight,keepaspectratio}
\ContinuedFloat
\caption{XXX, continued}

\subfloat[]{\includegraphics{SUBFIG25}}\hfill
\subfloat[]{\includegraphics{SUBFIG26}}\hfill
\subfloat[]{\includegraphics{SUBFIG27}}\hfill
\subfloat[]{\includegraphics{SUBFIG28}}

\medskip
\subfloat[]{\includegraphics{SUBFIG29}}\hfill
\subfloat[]{\includegraphics{SUBFIG30}}\hfill
\subfloat[]{\includegraphics{SUBFIG31}}\hfill
\subfloat[]{\includegraphics{SUBFIG32}}

\medskip
\subfloat[]{\includegraphics{SUBFIG33}}\hfill
\subfloat[]{\includegraphics{SUBFIG34}}\hfill
\subfloat[]{\includegraphics{SUBFIG35}}\hfill
\subfloat[]{\includegraphics{SUBFIG36}}

\medskip
\subfloat[]{\includegraphics{SUBFIG37}}\hfill
\subfloat[]{\includegraphics{SUBFIG38}}\hfill
\subfloat[]{\includegraphics{SUBFIG39}}\hfill
\subfloat[]{\includegraphics{SUBFIG40}}

\medskip
\subfloat[]{\includegraphics{SUBFIG41}}\hfill
\subfloat[]{\includegraphics{SUBFIG42}}\hfill
\subfloat[]{\includegraphics{SUBFIG43}}\hfill
\subfloat[]{\includegraphics{SUBFIG44}}

\medskip
\subfloat[]{\includegraphics{SUBFIG45}}\hfill
\subfloat[]{\includegraphics{SUBFIG46}}\hfill
\subfloat[]{\includegraphics{SUBFIG47}}\hfill
\subfloat[]{\includegraphics{SUBFIG48}}

\end{figure}

\begin{figure}[p]
\setkeys{Gin}{width=0.22\textwidth,height=0.125\textheight,keepaspectratio}
\ContinuedFloat
\caption{XXX, continued}

\subfloat[]{\includegraphics{SUBFIG49}}\hfill
\subfloat[]{\includegraphics{SUBFIG50}}\hfill
\subfloat[]{\includegraphics{SUBFIG51}}\hfill
\subfloat[]{\includegraphics{SUBFIG52}}

\medskip
\subfloat[]{\includegraphics{SUBFIG53}}\hfill
\subfloat[]{\includegraphics{SUBFIG54}}\hfill
\subfloat[]{\includegraphics{SUBFIG55}}\hfill
\subfloat[]{\includegraphics{SUBFIG56}}

\medskip
\subfloat[]{\includegraphics{SUBFIG57}}\hfill
\subfloat[]{\includegraphics{SUBFIG58}}\hfill
\subfloat[]{\includegraphics{SUBFIG59}}\hfill
\subfloat[]{\includegraphics{SUBFIG60}}

\medskip
\subfloat[]{\includegraphics{SUBFIG61}}\hfill
\subfloat[]{\includegraphics{SUBFIG62}}\hfill
\subfloat[]{\includegraphics{SUBFIG63}}\hfill
\subfloat[]{\includegraphics{SUBFIG64}}

\medskip
\subfloat[]{\includegraphics{SUBFIG65}}\hfill
\subfloat[]{\includegraphics{SUBFIG66}}\hfill
\subfloat[]{\includegraphics{SUBFIG67}}\hfill
\subfloat[]{\includegraphics{SUBFIG68}}

\medskip
\subfloat[]{\includegraphics{SUBFIG69}}\hfill
\subfloat[]{\includegraphics{SUBFIG70}}\hfill
\subfloat[]{\includegraphics{SUBFIG71}}\hfill
\subfloat[]{\includegraphics{SUBFIG72}}

\end{figure}

\begin{figure}[ht!]
\setkeys{Gin}{width=0.22\textwidth,height=0.125\textheight,keepaspectratio}
\ContinuedFloat
\caption{XXX, continued}

\subfloat[]{\includegraphics{SUBFIG73}}\hfill
\subfloat[]{\includegraphics{SUBFIG74}}\hfill
\subfloat[]{\includegraphics{SUBFIG75}}\hfill
\subfloat[]{\includegraphics{SUBFIG76}}

\medskip
\subfloat[]{\includegraphics{SUBFIG77}}\hfill
\subfloat[]{\includegraphics{SUBFIG78}}\hfill
\subfloat[]{\includegraphics{SUBFIG79}}\hfill
\subfloat[]{\includegraphics{SUBFIG80}}

\medskip
\subfloat[]{\includegraphics{SUBFIG81}}\hfill

\end{figure}

\end{document}

• Thank you very much! By the way, irrelevant for this question but the insertion of a caption in each figure environment generates a new entry each time for this figure in my 'List of Figures' list at the beginning of my document. Would you know easily how to make sure I only label the figure (that is the whole set of 81 diagrams) once in List of Figures' but still have captions in each figure environment ? – CAF Sep 22 at 15:17
• @CAF - Just change all three instances of \caption{XXX, continued} to \caption[]{XXX, continued}. The empty optional argument, [], of \caption means that nothing related to this caption will be written to the List of Figures. – Mico Sep 22 at 15:29

Maybe, if you put the figures in a table and then split the accross the pages using a \ContinuedFloat. Although, in this approach, you'd have to split the figure manually, which of course is not very elegant.

\documentclass{scrreprt}
\usepackage{graphicx}
\usepackage{subcaption}

\DeclareCaptionSubType*{figure}\renewcommand\thesubfigure{\arabic{subfigure}}
\newcommand{\sub}[1]{\begin{minipage}{.2\linewidth}\includegraphics[width=\linewidth]{#1}\subcaption{}\end{minipage}}
\newcommand{\tabfig}[4]{\sub{#1} & \sub{#2} & \sub{#3} & \sub{#4}\\}

\begin{document}
\begin{figure}[ht]
\begin{tabular}{cccc}
\tabfig{example}{example}{example}{example}
\tabfig{example}{example}{example}{example}
\tabfig{example}{example}{example}{example}
\tabfig{example}{example}{example}{example}
\tabfig{example}{example}{example}{example}
\end{tabular}
\end{figure}
\begin{figure}[ht]\ContinuedFloat
\begin{tabular}{cccc}
\tabfig{example}{example}{example}{example}
\tabfig{example}{example}{example}{example}
\tabfig{example}{example}{example}{example}
\tabfig{example}{example}{example}{example}
\tabfig{example}{example}{example}{example}
\end{tabular}
\end{figure}
\end{document}
`
• Thank you very much! – CAF Sep 22 at 15:49