subfigure counters not resetting

My subfigure counter isn't working properly for 2 figures. In the first figure there is an a) and then b) -which is fine, (that I both mark with a begin and end command) but for the second figure, that I also mark with a begin and end command, the subfigure counter doesn't reset back to a), b), c) and d); but it rather jumps to c), d) , e) and f).

What is a possible workaround for this problem? I noticed that I used a tabular inside the second figure to insert some figure's, and maybe that messed up the subfigure counter. Any other ideas? Here is the code:

*Preamble:

\documentclass[runningheads]{llncs}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{amsmath,amssymb} % define this before the line numbering.
\usepackage{ruler}
\usepackage{color}
\usepackage[width=122mm,left=12mm,paperwidth=146mm,height=193mm,top=12mm,paperheight=217mm]{geometry}

\usepackage{verbatim}
\usepackage{color}
%\usepackage{epsfigure}
\usepackage{multirow}
\usepackage[font={small}]{caption}

\usepackage{xspace}
\newcommand*{\eg}{e.g.\@\xspace}
\newcommand*{\ie}{i.e.\@\xspace}
\newcommand{\etal}{\mbox{\emph{et al.\ }}}

\newenvironment{packed_enumerate}{
\begin{enumerate}
\setlength{\itemsep}{0pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
\vspace{-4pt}
}{\end{enumerate}}

\begin{figure}[!t]
\centering
\subfigure[caption1]{

\includegraphics[scale=0.15,clip=true,draft=false,]{title1.pdf}

%\vspace{-10pt}
\label{fig:relative_graph}
%\vspace{-10pt}
}
\subfigure[Caption2]{
\begin{tabular}{cc|c|c|}
\centering
\cline{2-3}
& \multicolumn{1}{ |c| }{column1} & \multicolumn{1}{ |c| }{column2} \\ \cline{1-3}
\multicolumn{1}{ |c| }{AA} & $65.16\%$ & $66.64\%$  \\ \cline{1-3}
\multicolumn{1}{ |c| }{BB} & $68.60\%$  & $65.56\%$  \\ \cline{1-3}
\multicolumn{1}{ |c| }{CC} & $\mathbf{52.24\%}$ & $65.00\%$ \\ \cline{1-3}
\end{tabular}
\label{table:mambo}
\vspace{-30pt}
}

\vspace{-10pt}
\end{figure}

\begin{figure}[!t]
\setlength{\abovecaptionskip}{-5pt}
\setlength{\belowcaptionskip}{-5pt}
\addtolength{\subfigcapskip}{3pt}

\centering
\begin{tabular}{ccc}
\subfigure[caption1]{\includegraphics[scale=0.17]{img1.jpg}
\label{fig:img_pair_1}} &%&
%\subfigure[B]{\includegraphics{logo.png}} &
\multirow{-4}[2.5]{*}{\subfigure[caption2]{\includegraphics[scale=0.136]{img2.jpg}    \label{fig:img_complete_1}}} &
\multirow{-4}[2.5]{*}{\subfigure[caption3]{\includegraphics[scale=0.136]{img3.jpg}\label{fig:img_complete_2}}} \\
%\subfigure[E]{\includegraphics{logo.png}}% &
\subfigure[caption4]{\includegraphics[scale=0.17]{img4.jpg}
\label{fig:img_pair_2}}\\
\end{tabular}
\vspace{10pt}
\caption[]{
Comments
}
\label{fig:affinity}
\vspace{-10pt}
\end{figure}

• Which package do you use? subcaption or subfig? Kindly add full code including the preamble. – user11232 Feb 9 '14 at 0:18
• I am using subfigure, the weird thing is that for other figures, this "repeating" doesn't happen and it resets itself automatically. – Arturo Feb 9 '14 at 0:19
• subfigure is deprecated. Use subcaption or subfig. – user11232 Feb 9 '14 at 0:21

1 Answer

This is one of the problems of the obsolete package subfigure. Switch to subfig or subcaption. Here's part of your code rewritten using subfig's syntax (I made some changes; in particular, I suppressed the \centering just before \cline which was producing an error):

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subfig}
\usepackage{multirow}

\begin{document}

\begin{figure}[!t]
\centering
\subfloat[caption1\label{fig:relative_graph}]{%
\includegraphics[scale=0.15,clip=true,draft=false,]{title1.pdf}%
}\quad
\subfloat[Caption2\label{table:mambo}]{%
\begin{tabular}[b]{cc|c|c|}
\cline{2-3}
& \multicolumn{1}{ |c| }{column1} & \multicolumn{1}{ |c| }{column2} \\ \cline{1-3}
\multicolumn{1}{ |c| }{AA} & $65.16\%$ & $66.64\%$  \\ \cline{1-3}
\multicolumn{1}{ |c| }{BB} & $68.60\%$  & $65.56\%$  \\ \cline{1-3}
\multicolumn{1}{ |c| }{CC} & $\mathbf{52.24\%}$ & $65.00\%$ \\ \cline{1-3}
\end{tabular}%
}
\end{figure}

\begin{figure}[!t]
\centering
\begin{tabular}{ccc}
\subfloat[caption1\label{fig:img_pair_1}]{%
\includegraphics[scale=0.17]{img1.jpg}%
} &
\multirow{-4}[2.5]{*}{\subfloat[caption2\label{fig:img_complete_1}]{\includegraphics[scale=0.136]{img2.jpg}}} &
\multirow{-4}[2.5]{*}{\subfloat[caption3\label{fig:img_complete_2}]{\includegraphics[scale=0.136]{img3.jpg}}} \\
\subfloat[caption4\label{fig:img_pair_2}]{\includegraphics[scale=0.17]{img4.jpg}}\\
\end{tabular}
\caption[]{Comments}
\label{fig:affinity}
\end{figure}

\end{document}


To customize caption settings, use the caption package.

Notice that I used [b] as the alignment option for the tabular so the image and the table are properly aligned. I would also suggest you not to control the size of your images using scale; usually a better control is achieved controlling the width and/or height.

Here's a variation of your code, with some improvements. booktabs was used to produce the table and \raisebox was used instead of \multirow to place the images.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subfig}
\usepackage{booktabs}

\begin{document}

\begin{figure}
\centering
\subfloat[caption1\label{fig:relative_graph}]{%
\includegraphics[width=4cm]{title1.pdf}%
}\quad
\subfloat[Caption2\label{table:mambo}]{%
\begin{tabular}[b]{cccc}
\cmidrule[\heavyrulewidth]{2-3}
& column1 & column2 \\ \midrule
AA & $65.16\,\%$ & $66.64\,\%$  \\
BB & $68.60\,\%$  & $65.56\,\%$  \\
CC & $\mathbf{52.24\,\%}$ & $65.00\,\%$ \\ \bottomrule
\end{tabular}%
}
\end{figure}

\begin{figure}
\centering
\begin{tabular}{@{}ccc@{}}
\subfloat[caption1\label{fig:img_pair_1}]{%
\includegraphics[width=3cm]{img1.jpg}%
} &
\raisebox{-70pt}[0pt][0pt]{\subfloat[caption2\label{fig:img_complete_1}]{\includegraphics[width=3cm]{img2.jpg}}} &
\raisebox{-70pt}[0pt][0pt]{\subfloat[caption3\label{fig:img_complete_2}]{\includegraphics[width=3cm]{img3.jpg}}} \\
\subfloat[caption4\label{fig:img_pair_2}]{\includegraphics[width=3cm]{img4.jpg}} & & \\
\end{tabular}
\caption[]{Comments}
\label{fig:affinity}
\end{figure}

\end{document}


The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document.

• @Arturo You're welcome! I've updated my answer with some modifications (just suggestions, of course) that might be of interest for you. – Gonzalo Medina Feb 9 '14 at 0:51