具有 6 个子图环境的代码会导致错误,但不会减少,因为我用完了子图的标签:a)、b)、...、n),但我需要更多
\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}
错误
! LaTeX Error: Counter too large.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1492 }
?
TeXLive:2016年
操作系统:Debian 8.5
答案1
alphalph
如果字母数量用尽,包提供了一些继续用字母编号的方法,例如:
\usepackage{alphalph}
\renewcommand*{\thesubfigure}{\alphalph{\value{subfigure}}}
完整示例:
\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}
答案2
如果使用\alph
或\Alph
并且值超过 26,就会出现该错误。
如果需要更大的值,则需要不同的显示功能。