# Problem with subfigure numbering using ContinuedFloat

I am using the subfig package for including subfigures into my thesis. That alone has been going without problem.

However, as soon as I use the \ContinuedFloat command in order to split a figure over a single page, the following figure, which also uses the \ContinuedFloat command, just carries on with the subfigure numbering (e.g. Figure 2c, 2d instead of 2a, 2b).

If a figure without the \ContinuedFloat command is inserted it also continues the numbering (e.g. 3f) and only the next figure without this command starts with the normal labelling (e.g. 4a).

This is a minimal working example.

\documentclass[12pt,twoside,a4paper]{report}

\usepackage{setspace}
\usepackage[inner=3cm, outer=3cm, top=1.0in, bottom=1.0in]{geometry} %
\geometry{bindingoffset=0.5cm}

\usepackage{graphicx}
\usepackage[]{subfig}
\usepackage{float}
\usepackage[font=small,labelfont=bf]{caption}

\begin{document}

\begin{figure}[H]
\centering
\subfloat[]{\includegraphics[width=14cm]{...figue code...}}
\caption[]{figure1}\label{figure1}
\end{figure}

\begin{figure}[H]
\ContinuedFloat
\centering
\subfloat[]{\includegraphics[width=12cm]{...figue code...}}
\caption[figure1]{figure1}
\end{figure}

\begin{figure}[H]
\centering
\subfloat[]{\includegraphics[width=14cm]{...figue code...}}\    \subfloat[]{\includegraphics[width=10cm]{...figue code...}}\    \caption{[]figure2}\label{figure2}
\end{figure}

\begin{figure}[H]
\ContinuedFloat
\centering
\subfloat[]{\includegraphics[width=10cm]{...figue code...}}
\caption[figure3]{figure3} \label{figure3}
\end{figure}

\begin{figure}[H]
\centering
\subfloat[]{\includegraphics[width=10cm]{...figue code...}}
\caption[figure3]{figure3}
\end{figure}

\begin{figure}[H]
\centering
\subfloat[]{\includegraphics[width=10cm]{...figue code...}}
\caption[figure4]{figure4}\label{figure4}
\end{figure}

\end{document}

-
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces or enclose words in backticks , they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it). – egreg Apr 9 '12 at 14:06
Thank you! I'm obviously new to this, so I had no idea. Every day is a school day... – Eva Apr 9 '12 at 14:17

## 4 Answers

This question has been cross-posted to LaTeX-Community.org and there's a possible solution.

The effect is caused by using the float package and the H option. Removing H and using !htbp instead (or less) fixed it for me.

-

The problem seems to go away if you don't use the [H] position specifier (you should also load caption before subfig). If you really must use [H], you can put this in your preamble and use \resetsubfigs after \begin{figure} to reset the subfigure labels.

\makeatletter
\newcommand\resetsubfigs{\setcounter{sub\@captype}{0}}
\makeatother


A fully automated solution may require a lot of hacking.

-
Thanks for this! You were right! – Eva Apr 9 '12 at 15:13

Try to add \setcounter{subfigure}{0} in place where you want to reset the counter of subfig. In your case:

\documentclass[12pt,twoside,a4paper]{report}

(...)

\begin{figure}[H]
\ContinuedFloat
\centering
\subfloat[]{\includegraphics[width=12cm]{...figue code...}}
\caption[figure1]{figure1}
\end{figure}

\begin{figure}[H]
\centering
\setcounter{subfigure}{0}
\subfloat[]{\includegraphics[width=14cm]{...figue code...}}\\
\subfloat[]{\includegraphics[width=10cm]{...figue code...}}\\
\caption{[]figure2}\label{figure2}
\end{figure}

(...)

\end{document}

-

I have used \setcounter{subfigure}{number_initial} or \setcounter{figure}{number_initial}` and I have solved my problems. The new problem in this case is that you need to know the number or your figure/subfigure, but if you edit the text where your figures are located, this is a good option.

-