[Tex/LaTex] float and subfig package interference: subfigures with exact placement

captionsfloatssubfloats

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?

Best Answer

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.