1

so I have multiple graphics in my Latex document, and have wrapped them in figure enviornments for easy positioning. How can I have one of my figures not count towards the overall figure counter in this chapter? So I have figure A, it contains three subcaptions. I give them each a \subcaption* (so the one without the label), and then I have figure B and want to give it a caption, and want it to be called Figure 1.1 (instead of Figure 1.2)

Here is an example of what I mean:

\documentclass{report}
\usepackage{tikz}
\usepackage{caption, subcaption}

\begin{document}

\section{A Section}
This is Figure A
\begin{figure}[h] % Figure A (should be excluded from the count)
    \centering
    \begin{subfigure}{.3\textwidth}\centering\begin{tikzpicture}
        \draw (0,0) rectangle (1,1);   
    \end{tikzpicture}\subcaption*{(i)}
    \end{subfigure}%
    \begin{subfigure}{.3\textwidth}\centering\begin{tikzpicture}
        \draw (0,0) rectangle (1,1);
    \end{tikzpicture}\subcaption*{(ii)}
    \end{subfigure}%
    \begin{subfigure}{.3\textwidth}\centering\begin{tikzpicture}
        \draw (0,0) rectangle (1,1);
    \end{tikzpicture}\subcaption*{(iii)}
    \end{subfigure}
\end{figure} \par\noindent
This is Figure B:
\begin{figure}[h]\centering\begin{tikzpicture}  % Figure B (should be included into the count and here be % Fig. 1.1.
    \draw (0,0) circle (20pt);
\end{tikzpicture}\caption{B}\end{figure}

\end{document}

Here is the output:

output

2 Answers2

0

You could add \caption{A} into the closing line of your first figure. \caption{A}\end{figure} \par\noindent

But similar to Sigurs comment, you would get 2 separate figures, listed as 1 and 2 and no subfigures. As far as i know, there is no deeper nesting to subsubfigures.

6equj5
  • 1
  • 2
  • sorry, you didn't get what I was looking for. I want to seperate figures, but the first one should not increase the counter of figures. It should be invisible to the counter. So the figure counter before it would be at Fig 1.x and the figure counter after it should be Fig. 1.(x+1) NOT 1.(x+2) as it is normally. – Joseph Holten Apr 08 '20 at 15:15
  • Maybe this article helps article you. – 6equj5 Apr 08 '20 at 15:25
0

The subcaption package needs to increase the figure (or table) counter in order to affix the right number to the subfigure number even when the main caption is at the bottom.

When it finds the \caption command (which will step up the counter), it steps the counter down so the final results agree. In your case the counter is never stepped down.

Solution: step down the counter manually. I suggest defining a \nocaption declaration to this effect.

\documentclass{report}
\usepackage{tikz}
\usepackage{caption, subcaption}

\makeatletter \newcommand{\nocaption}{\addtocounter{@captype}{-1}} \makeatother

\begin{document}

\section{A Section}

This is Figure A

\begin{figure}[htp] % Figure A (should be excluded from the count) \centering

\begin{subfigure}{.3\textwidth}\centering\begin{tikzpicture}
    \draw (0,0) rectangle (1,1);   
\end{tikzpicture}\subcaption*{(i)}
\end{subfigure}%
\begin{subfigure}{.3\textwidth}\centering\begin{tikzpicture}
    \draw (0,0) rectangle (1,1);
\end{tikzpicture}\subcaption*{(ii)}
\end{subfigure}%
\begin{subfigure}{.3\textwidth}\centering\begin{tikzpicture}
    \draw (0,0) rectangle (1,1);
\end{tikzpicture}\subcaption*{(iii)}
\end{subfigure}

\nocaption

\end{figure}

This is Figure B:

\begin{figure}[htp] \centering

\begin{tikzpicture}
\draw (0,0) circle (20pt);
\end{tikzpicture}

\caption{B}

\end{figure}

\end{document}

enter image description here

egreg
  • 1,121,712