# How to get more subfigures than 26? [duplicate]

Code where having 6 subfigure environment causes the error but not less because I run out of labels of subfigures: a), b), ..., n), but I need more

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\usepackage{pgffor}

\begin{document}

\begin{figure}
\foreach \ii in {1,...,5}{
\centering% not \center!
\begin{subfigure}{0.19\textwidth}
\centering
\includegraphics[scale=0.11, page=\ii]{{Rplots.bland.male.5}.pdf}
\caption{\#\ii, ite. 1.}
\end{subfigure}
\begin{subfigure}{0.19\textwidth}
\centering
\includegraphics[scale=0.11, page=\ii]{{Rplots.blandmale.6}.pdf}
\caption{\#\ii, ite. 2.}
\end{subfigure}
\begin{subfigure}{0.19\textwidth}
\centering
\includegraphics[scale=0.11, page=\ii]{{Rplots.bland.male.7}.pdf}
\caption{\#\ii, ite. 3.}
\end{subfigure}
\begin{subfigure}{0.19\textwidth}
\centering
\includegraphics[scale=0.11, page=\ii]{{Rplots.bland.8}.pdf}
\caption{\#\ii, ite. 4.}
\end{subfigure}
\begin{subfigure}{0.19\textwidth}
\centering
\includegraphics[scale=0.11, page=\ii]{{Rplots.bland.9}.pdf}
\caption{\#\ii, ite. 5.}
\end{subfigure}
\begin{subfigure}{0.19\textwidth}
\centering
\includegraphics[scale=0.11, page=\ii]{{Rplots.bland.10}.pdf}
\caption{\#\ii, ite. 6.}
\end{subfigure}
}
\end{figure}
\end{document}


Error

! LaTeX Error: Counter too large.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.1492 }

?


TeXLive: 2016
OS: Debian 8.5

• Does the error message also state which counter is too large? – Mico Nov 17 '16 at 15:49
• Do you have 5 pages in all the pdfs? Also, you need \end{figure} but I don't think that is the problem. – StefanH Nov 17 '16 at 15:55
• surely you could have provided a proper example? – David Carlisle Nov 17 '16 at 16:12
• Your subfigs are numbered a, b, c, ... After 26 pictures you run out of letters. That's what the error message tells you. – Pieter van Oostrum Nov 17 '16 at 16:15

Package alphalph provides some ways to continue numbering with letters, if the number of letters is exhausted, e.g.:

\usepackage{alphalph}
\renewcommand*{\thesubfigure}{\alphalph{\value{subfigure}}}


Full example:

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{pgffor}

\usepackage{alphalph}
\renewcommand*{\thesubfigure}{\alphalph{\value{subfigure}}}

\begin{document}

\newcommand*{\img}{%
\includegraphics[
width=\linewidth,
height=20pt,
keepaspectratio=false,
]{example-image-a}%
}

\begin{figure}
\foreach \ii in {1,...,5}{%
\centering
\begin{subfigure}{0.19\textwidth}
\centering
\img
\caption{\#\ii, ite. 1.}
\end{subfigure}
\begin{subfigure}{0.19\textwidth}
\centering
\img
\caption{\#\ii, ite. 2.}
\end{subfigure}
\begin{subfigure}{0.19\textwidth}
\centering
\img
\caption{\#\ii, ite. 3.}
\end{subfigure}
\begin{subfigure}{0.19\textwidth}
\centering
\img
\caption{\#\ii, ite. 4.}
\end{subfigure}
\begin{subfigure}{0.19\textwidth}
\centering
\img
\caption{\#\ii, ite. 5.}
\end{subfigure}
\begin{subfigure}{0.19\textwidth}
\centering
\img
\caption{\#\ii, ite. 6.}
\end{subfigure}
}%
\lastlinefit=1000 % same inter-image spaces in last line as in previous lines
\end{figure}

\end{document}


That error is given if you use \alph or \Alph and have a value more than 26.

If you need values bigger than that you need a different display function.

• How can you have more labels in subfigure? - The 26 is too few for me. Now it is like a), b), .., n) but I really need more those subfigures. – Léo Léopold Hertz 준영 Nov 17 '16 at 16:23
• @masi there are packages such as alpalph that give longer alphabetic sequences or you can use roman numerals or some other scheme – David Carlisle Nov 17 '16 at 16:26
• why the downvote? This does pinpoint the problem doesn't it? – David Carlisle Nov 17 '16 at 17:31