3

My Latex document suddenly stopped compiling and raising the "! LaTeX Error: Counter too large." error for no apparent reason. It compiled before, with the same amount of figures and subfigures, but even by erasing the things I added since the last time it compiled, it just doesn't work anymore.

I know what generally causes this error => when captioning more than 26 subfigures, it runs out of letter to label the subfigures and throws this error. This is not my case. My largest figure only has 8 subfigures so I don't know why it doesn't work.

Here's part of my code (more figures come before this):

\documentclass[11pt, oneside]{Thesis} % The default font size and one-sided printing (no margin offsets)

\graphicspath{{./Pictures/}} % Specifies the directory where pictures are stored

\usepackage[T1]{fontenc}
\usepackage{mathtools}  % loads »amsmath«
\usepackage{amsmath}
\usepackage{physics}
\usepackage{float}

\usepackage{tabularx}
\usepackage{adjustbox}
\usepackage[english]{babel}
\usepackage[table]{xcolor}
\usepackage{tabularx}
%\usepackage{showframe} % for demo
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{ragged2e}
\usepackage{lua-visual-debug}

\usepackage{placeins}
\usepackage{multirow}
\usepackage{graphicx} 
\usepackage{caption} 
\usepackage{subcaption}
\usepackage[square, numbers, comma, sort&compress]{natbib} 

\usepackage{booktabs}
%\usepackage[table,xcdraw]{xcolor}

\hypersetup{urlcolor=blue, colorlinks=true} % Colors hyperlinks in blue - change to black if annoying
\title{\ttitle} % Defines the thesis title - don't touch this

\begin{document}

\FloatBarrier
\section{Influence of solid exits}
%compare 5wg and 6wg. REG and SIDE sections, velocity vectors, turbulence, velocity contours?, ... Explain "vortex air-wall" in both, and why it's a clear advantage in 6wg.

\begin{table}[h]
\centering
\hspace*{-2cm}\makebox[\linewidth][c]{%
\begin{tabularx}{1.4\textwidth}{c*{2}{>{\centering\arraybackslash}X}@{}}
&   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{SE_5wg_REG_VV}
        \caption{In-plane velocity vectors [m/s] - 5-wheels geometry}
        \medskip
    \end{subfigure}
&   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{SE_6wg_REG_VV}
        \caption{In-plane velocity vectors [m/s]] - 6-wheels geometry}
        \medskip
    \end{subfigure}     \\
&   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{SE_5wg_REG_VVz}
        \caption{In-plane velocity vectors [m/s] - 5-wheels geometry close-up}
        \medskip
    \end{subfigure}
&   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{SE_6wg_REG_VVz}
        \caption{In-plane velocity vectors [m/s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
&   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{SE_5wg_REG_TANz}
        \caption{Tangential velocity contours [m/s] - 5-wheels geometry close-up}
        \medskip
    \end{subfigure}
&   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{SE_6wg_REG_TANz}
        \caption{Tangential velocity contours [m/s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
    &   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{SE_5wg_REG_TURBz}
        \caption{Subgrid turbulent viscosity ratio [kg/m.s] - 5-wheels geometry close-up}
        \medskip
    \end{subfigure}
&   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{SE_6wg_REG_TURBz}
        \caption{Subgrid turbulent viscosity ratio [kg/m.s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
\end{tabularx}}
\caption{Influence of the solid exits: 5-wheels geometry (left) and 6-wheels geometry (right)}
\label{solid_exits}
\end{table}


\FloatBarrier
\section{Influence of chimneys}
%Chimneys as turbulence creators?
%Chimney diameter? => central reflux! show in both 5wg and 6wg!
%Possible solution => conic chimneys, show with 6wg.

\begin{table}[h]
\centering
\hspace*{-2cm}\makebox[\linewidth][c]{%
\begin{tabularx}{1.4\textwidth}{c*{2}{>{\centering\arraybackslash}X}@{}}
&   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{CH_5wg_REG_VV}
        \caption{In-plane velocity vectors [m/s] - 5-wheels geometry}
        \medskip
    \end{subfigure}
&   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{CH_6wg_REG_VV}
        \caption{In-plane velocity vectors [m/s]] - 6-wheels geometry}
        \medskip
    \end{subfigure}     \\
&   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{CH_5wg_REG_VVz2}
        \caption{In-plane velocity vectors [m/s] - 5-wheels geometry close-up}
        \medskip
    \end{subfigure}
&   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{CH_6wg_REG_VVz2}
        \caption{In-plane velocity vectors [m/s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
&   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{CH_5wg_REG_AXIz}
        \caption{Axial velocity contours [m/s] - 5-wheels geometry close-up}
        \medskip
    \end{subfigure}
&   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{CH_6wg_REG_AXIz}
        \caption{Axial velocity contours [m/s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
    &   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{CH_5wg_REG_TURBz2}
        \caption{Subgrid turbulent viscosity ratio [kg/m.s] - 5-wheels geometry close-up}
        \medskip
    \end{subfigure}
&   \begin{subfigure}{\hsize} 
        \includegraphics[width=\hsize]{CH_6wg_REG_TURBz2}
        \caption{Subgrid turbulent viscosity ratio [kg/m.s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
\end{tabularx}}
\caption{Influence of the chimneys: 5-wheels geometry (left) and 6-wheels geometry (right)}
\label{chimneys}
\end{table}

\end{document}

I know I didn't used the most straightforward method to create my tables, and I could have used a minipage for my subfigures instead. But if possible I would like to keep those "tables with subfigures" as they are (with minor changes if necessary to fix the problem ofc).

8
  • Welcome to TeX.SX! Can I suggest that you try to selectively comment out lines of code so you can cut what you have down to a minimal working example . Almost certainly most of your code is not relevant to your problem so you should try to distill the example down to what is actually important. This will help us help you - and you might even solve the problem by yourself in the process!
    – user30471
    Aug 12, 2015 at 15:28
  • I adopt your MWE in form., which I can compile (your image replace with example-image from graphicx package and instead of Thesis I use book) and remove doubled packages. I don't get any error your, but caption numbering system doesn't work and counting of subimages is not reset in new figures.
    – Zarko
    Aug 12, 2015 at 16:26
  • What's the purpose of tabularx?
    – egreg
    Aug 12, 2015 at 16:36
  • @egreg: Not sure if it's necessary here, but I copied the table structure from somewhere else in my thesis which used tabularx. Since it worked I didn't change it.
    – Romain
    Aug 12, 2015 at 17:01
  • @Zarko: Yes that's what I found since then, the subfigures counter doesn't reset :/. I tried to solve it with \setcounter{table}{0} or \setcounter{subfigure}{0}, but for whatever reason that doesn't work.
    – Romain
    Aug 12, 2015 at 17:02

2 Answers 2

1

I get no error and also the reset of subfigure numbering if I remove tabularx, that's probably the cause for the issue.

You simply don't need it just for setting multiple subfigures.

I also changed Thesis to book, as it's impossible to know what class you're loading.

\PassOptionsToPackage{demo}{graphicx} % just for this example
\documentclass[11pt, oneside]{book} % The default font size and one-sided printing (no margin offsets)

\usepackage[T1]{fontenc}
\usepackage{mathtools}  % loads »amsmath«
\usepackage{amsmath}
\usepackage{physics}
\usepackage{float}

\usepackage{adjustbox}
\usepackage[english]{babel}
\usepackage[table]{xcolor}
%\usepackage{showframe} % for demo
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{ragged2e}
\usepackage{lua-visual-debug}

\usepackage{placeins}
\usepackage{multirow}
\usepackage{graphicx} 
\usepackage{caption} 
\usepackage{subcaption}
\usepackage[square, numbers, comma, sort&compress]{natbib} 

\usepackage{booktabs}
%\usepackage[table,xcdraw]{xcolor}
\usepackage{hyperref}

\hypersetup{urlcolor=blue, colorlinks=true} % Colors hyperlinks in blue - change to black if annoying

\graphicspath{{./Pictures/}} % Specifies the directory where pictures are stored

\title{\ttitle} % Defines the thesis title - don't touch this

\begin{document}

\FloatBarrier
\section{Influence of solid exits}
%compare 5wg and 6wg. REG and SIDE sections, velocity vectors, turbulence, velocity contours?, ... Explain "vortex air-wall" in both, and why it's a clear advantage in 6wg.

\begin{table}[htp]
\centering
\makebox[\columnwidth][c]{%
  \begin{minipage}{1.4\linewidth}
  \centering
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{SE_5wg_REG_VV}
        \caption{In-plane velocity vectors [m/s] - 5-wheels geometry}
        \medskip
    \end{subfigure}\hfill
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{SE_6wg_REG_VV}
        \caption{In-plane velocity vectors [m/s]] - 6-wheels geometry}
        \medskip
    \end{subfigure}     \\
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{SE_5wg_REG_VVz}
        \caption{In-plane velocity vectors [m/s] - 5-wheels geometry close-up}
        \medskip
    \end{subfigure}\hfill
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{SE_6wg_REG_VVz}
        \caption{In-plane velocity vectors [m/s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{SE_5wg_REG_TANz}
        \caption{Tangential velocity contours [m/s] - 5-wheels geometry close-up}
        \medskip
    \end{subfigure}\hfill
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{SE_6wg_REG_TANz}
        \caption{Tangential velocity contours [m/s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{SE_5wg_REG_TURBz}
        \caption{Subgrid turbulent viscosity ratio [kg/m.s] - 5-wheels geometry close-up}
        \medskip
    \end{subfigure}\hfill
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{SE_6wg_REG_TURBz}
        \caption{Subgrid turbulent viscosity ratio [kg/m.s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
  \end{minipage}}
\caption{Influence of the solid exits: 5-wheels geometry (left) and 6-wheels geometry (right)}
\label{solid_exits}
\end{table}


\FloatBarrier\clearpage
\section{Influence of chimneys}
%Chimneys as turbulence creators?
%Chimney diameter? => central reflux! show in both 5wg and 6wg!
%Possible solution => conic chimneys, show with 6wg.

\begin{table}[htp]
\centering
\makebox[\textwidth][c]{%
  \begin{minipage}{1.4\textwidth}
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{CH_5wg_REG_VV}
        \caption{In-plane velocity vectors [m/s] - 5-wheels geometry}
        \medskip
    \end{subfigure}
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{CH_6wg_REG_VV}
        \caption{In-plane velocity vectors [m/s]] - 6-wheels geometry}
        \medskip
    \end{subfigure}     \\
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{CH_5wg_REG_VVz2}
        \caption{In-plane velocity vectors [m/s] - 5-wheels geometry close-up}
        \medskip
    \end{subfigure}
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{CH_6wg_REG_VVz2}
        \caption{In-plane velocity vectors [m/s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{CH_5wg_REG_AXIz}
        \caption{Axial velocity contours [m/s] - 5-wheels geometry close-up}
        \medskip
    \end{subfigure}
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{CH_6wg_REG_AXIz}
        \caption{Axial velocity contours [m/s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{CH_5wg_REG_TURBz2}
        \caption{Subgrid turbulent viscosity ratio [kg/m.s] - 5-wheels geometry close-up}
        \medskip
    \end{subfigure}
    \begin{subfigure}[t]{.49\textwidth} 
        \includegraphics[width=\textwidth,height=2cm]{CH_6wg_REG_TURBz2}
        \caption{Subgrid turbulent viscosity ratio [kg/m.s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
  \end{minipage}}
\caption{Influence of the chimneys: 5-wheels geometry (left) and 6-wheels geometry (right)}
\label{chimneys}
\end{table}

\end{document}

In the example, I used height=2cm in order not to get too large floats.

enter image description here

4
  • That's strange, why wouldn't it reset with tabularx?
    – Romain
    Aug 12, 2015 at 17:05
  • @Romain That's what happens.
    – egreg
    Aug 12, 2015 at 17:15
  • 1
    @Romain probably one of the packages uses primitive counter arithmetic rather than latex counter commands (in which case they may not get reset during tabularx trials) but as egreg says, tabularx is no use at all for this layout in any case. Aug 12, 2015 at 17:20
  • Ok I redid my tables without tabularx and now it works :D. Thx!
    – Romain
    Aug 12, 2015 at 17:36
0

As discover @egreg, source of problem is tabularx If you use tabular instead it, all works as expected. See code below.

To have figures wider as it is text width, I suggest you to use changepage package. I include this option into my MWE:

\documentclass[11pt,oneside]{book}%{Thesis} % The default font size and one-sided printing
%\usepackage{showframe} % for demo

%\graphicspath{{./Pictures/}} % Specifies the directory where pictures are stored
    \usepackage{lmodern}
    \usepackage[T1]{fontenc}
    \usepackage{microtype}
    \usepackage[square, numbers, comma, sort&compress]{natbib}
    \usepackage[english]{babel}

    \usepackage[strict]{changepage}
    \usepackage{lipsum}

    \usepackage{mathtools}  % loads »amsmath«
    \usepackage{amsmath}
%\usepackage{physics}

    \usepackage{tabularx}
    \usepackage{multirow}
    \usepackage{booktabs}
    \usepackage[table]{xcolor}
%    \usepackage{adjustbox}

    \usepackage{ragged2e}
%    \usepackage{lua-visual-debug}

    \usepackage{float}
    \usepackage{placeins}
    \usepackage{graphicx}
    \usepackage{caption}
    \usepackage{subcaption}

    \usepackage{hyperref}
\hypersetup{urlcolor=blue,colorlinks=true} % Colors hyperlinks in blue - change to black if annoying
%\title{\ttitle} % Defines the thesis title - don't touch this

\begin{document}

\FloatBarrier
\section{Influence of solid exits}
%compare 5wg and 6wg. REG and SIDE sections, velocity vectors, turbulence, velocity contours?, ... Explain "vortex air-wall" in both, and why it's a clear advantage in 6wg.

\begin{table}[hbt]
\begin{adjustwidth*}{-21mm}{}
\begin{tabular}{@{}>{\raggedright\arraybackslash}p{0.49\linewidth}
                   >{\raggedleft \arraybackslash}p{0.49\linewidth}@{}}   
   \begin{subfigure}{\hsize}
    \includegraphics[width=\hsize,height=17mm]{example-image}
    \caption{In-plane velocity vectors [m/s] - 5-wheels geometry}
    \medskip
\end{subfigure}
&      \begin{subfigure}{\hsize}
        \includegraphics[width=\hsize,height=17mm]{example-image}
        \caption{In-plane velocity vectors [m/s]] - 6-wheels geometry}
        \medskip
    \end{subfigure}     \\
   \begin{subfigure}{\hsize}
        \includegraphics[width=\hsize,height=17mm]{example-image}
        \caption{In-plane velocity vectors [m/s] - 5-wheels geometry close-up}
        \medskip
    \end{subfigure}
&   \begin{subfigure}{\hsize}
        \includegraphics[width=\hsize,height=17mm]{example-image}
        \caption{In-plane velocity vectors [m/s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
   \begin{subfigure}{\hsize}
        \includegraphics[width=\hsize,height=17mm]{example-image}
        \caption{Tangential velocity contours [m/s] - 5-wheels geometry close-up}
        \medskip
    \end{subfigure}
&   \begin{subfigure}{\hsize}
        \includegraphics[width=\hsize,height=17mm]{example-image}
        \caption{Tangential velocity contours [m/s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
   \begin{subfigure}{\hsize}
        \includegraphics[width=\hsize,height=17mm]{example-image}
        \caption{Subgrid turbulent viscosity ratio [kg/m.s] - 5-wheels geometry close-up}
        \medskip
    \end{subfigure}
&   \begin{subfigure}{\hsize}
        \includegraphics[width=\hsize,height=17mm]{example-image}
        \caption{Subgrid turbulent viscosity ratio [kg/m.s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  
\end{tabular}
\end{adjustwidth*}
\caption{Influence of the solid exits: 5-wheels geometry (left) and 6-wheels geometry (right)}
\label{solid_exits}
\end{table}

    \lipsum[1]

\FloatBarrier
\section{Influence of chimneys}
%Chimneys as turbulence creators?
%Chimney diameter? => central reflux! show in both 5wg and 6wg!
%Possible solution => conic chimneys, show with 6wg.

\begin{table}[h]
\begin{adjustwidth*}{-21mm}{}
\begin{tabular}{@{}>{\raggedright\arraybackslash}p{0.49\linewidth}
                   >{\raggedleft \arraybackslash}p{0.49\linewidth}@{}}
        \begin{subfigure}{\hsize}
            \includegraphics[width=\hsize,height=17mm]{example-image}
            \caption{In-plane velocity vectors [m/s] - 5-wheels geometry}
            \medskip
        \end{subfigure}
&   \begin{subfigure}{\hsize}
        \includegraphics[width=\hsize,height=17mm]{example-image}
        \caption{In-plane velocity vectors [m/s]] - 6-wheels geometry}
        \medskip
    \end{subfigure}     \\
\begin{subfigure}{\hsize}
    \includegraphics[width=\hsize,height=17mm]{example-image}
    \caption{In-plane velocity vectors [m/s] - 5-wheels geometry close-up}
    \medskip
\end{subfigure}
&   \begin{subfigure}{\hsize}
        \includegraphics[width=\hsize,height=17mm]{example-image}
        \caption{In-plane velocity vectors [m/s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
\begin{subfigure}{\hsize}
    \includegraphics[width=\hsize,height=17mm]{example-image}
    \caption{Axial velocity contours [m/s] - 5-wheels geometry close-up}
    \medskip
\end{subfigure}
&   \begin{subfigure}{\hsize}
        \includegraphics[width=\hsize,height=17mm]{example-image}
        \caption{Axial velocity contours [m/s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}  \\
   \begin{subfigure}{\hsize}
    \includegraphics[width=\hsize,height=17mm]{example-image}
    \caption{Subgrid turbulent viscosity ratio [kg/m.s] - 5-wheels geometry close-up}
    \medskip
\end{subfigure}
&   \begin{subfigure}{\hsize}
        \includegraphics[width=\hsize,height=17mm]{example-image}
        \caption{Subgrid turbulent viscosity ratio [kg/m.s] - 6-wheels geometry close-up}
        \medskip
    \end{subfigure}
\end{tabular}
\caption{Influence of the chimneys: 5-wheels geometry (left) and 6-wheels geometry (right)}
\label{chimneys}
\end{adjustwidth*}
\end{table}
    \end{document}

Instead of Thesis I use book. I'm pretty sure that use of Thesis will change figure below.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .