float and subfig package interference: subfigures with exact placement

I'm using the subfig package for subfigures and the float package for forced float placement (H). Using both these packages results in the subcaption not getting reset. The following example shows six figures from (a) to (f), whereas I'd expect them to be from (a) to (c), twice.

\documentclass[a4paper]{scrartcl}

\usepackage{graphicx}
\usepackage{float}
\usepackage{subfig}

\begin{document}

\begin{figure}[H] \centering
\subfloat[first subfig]{\includegraphics{img}}
\subfloat[second subfig]{\includegraphics{img}}
\subfloat[third subfig]{\includegraphics{img}}
\end{figure}

\begin{figure}[H] \centering
\subfloat[first subfig]{\includegraphics{img}}
\subfloat[second subfig]{\includegraphics{img}}
\subfloat[third subfig]{\includegraphics{img}}
\end{figure}

\end{document}


What I'm trying to achieve is subfigures exactly where I want them to be. Is there a way to solve this interference, or is there a better solution?

-

It's the \caption command that resets the subfigure numbers and you don't provide one.

Actually, \caption performs \stepcounter{figure} and it's this command that does the business. So, if you really don't want to have a global caption, issue

\stepcounter{figure}\addtocounter{figure}{-1}


before \end{figure}. This will reset the subfloat counter but won't affect the figure counter, as the net change is 0.

-

The \subfloat command is designed to work with \caption only. If you don't want a \caption inside your figures, use \phantomcaption instead. This will both increase the figure counter and give proper hyperlinks when the hyperref package will be used. (\phantomcaption needs caption v3.2 or newer)

-

Put

\setcounter{subfigure}{0}


in between the two figures.

-