Skip to content

subfig bug

The recent releases of the LaTeX caption package seem to have caused a bug with the subfig package and subtable numbering.

Caption from TeXLive 2019 numbers the subtables as 1a and 1b, whereas caption 3.5 numbers them as 2a and 2b irregardless of the position setting.

(Note that for testing purposes the positions of the subtable \label macros are intentionally different between each subtable. One has the \label in the optional argument, and the other in the mandatory argument. Each appears to work the same as the other.)

\documentclass{article}

\usepackage{subfig}

\captionsetup[subtable]{position=top}

\begin{document}

\listoftables

\begin{table}
\caption{Enclosing Table}
\label{tab:enclosing}
\begin{center}
\subfloat[First subtable]{
    \label{tab-subtablefirst}
    \begin{tabular}{c}
    abc \\
    def \\
    \end{tabular}
}
\qquad
\subfloat[Second subtable\label{tab-subtable_second}]{
    \begin{tabular}{c}
    ghi \\
    jkl \\
    \end{tabular}
}
\end{center}
\end{table}

The enclosing table is \ref{tab:enclosing}.

The subtables are \ref{tab-subtablefirst} and \ref{tab-subtable_second}.

\end{document}