I want to suppress numbering in some figures. In single figures, the use of \caption*
works fine – see first two pictures in MWE below. However, when I have two subfigures in a figure-environment (set with \subcaptionbox
), the use of \caption*
and \subcaptionbox*
does suppress the figure numbering, yet the figure counter is updated, resulting in a 'missing' figure number. In the MWE below I would expect the last figure to be number two – as it is the second numbered figure, but it is numbered as three. Can anyone help me solve this issue?
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\begin{document}
\begin{figure}[h] %first figure - nonnumbered
\centering
\includegraphics[width=4cm]{chick}
\caption*{Non-numbered single chick}
\end{figure}
\begin{figure}[h] %second figure, but first numbered figure - counter should be 1
\centering
\includegraphics[width=4cm]{chick}
\caption{Numbered single chick}
\end{figure}
\begin{figure}[h] %third figure, nonnumbered
\centering
\subcaptionbox*{chick}[4cm]{\includegraphics{chick}}\hspace{1cm}
\subcaptionbox*{chick}[4cm]{\includegraphics{chick}}
\caption*{Two non-numbered chicks}
\end{figure}
\begin{figure}[h] %fourth figure, numbered, counter should be 2, but is 3
\centering
\subcaptionbox{chick}[4cm]{\includegraphics{chick}}\hspace{1cm}
\subcaptionbox{chick}[4cm]{\includegraphics{chick}}
\caption{Two numbered chicks}
\end{figure}
\end{document}
Best Answer
The
\subcaption*
command unconditionally increases the parent counter. As John Kormylo suggests, a work around is to addjust before the
\caption*
:Correcting this in the
subcaption
package does not seem to be easy.