3

I get a wrong numbering of subfigures in the List of Figures with the following MWE.

If I remove the FIGTOPCAP option or if I put the \caption on the top, the problem is solved, but I'd like keep them. Any idea?

\documentclass{book}
\usepackage[tight,FIGTOPCAP]{subfigure}
\setcounter{lofdepth}{2}

\begin{document}
\listoffigures

\begin{figure}
    \frame{
        \begin{minipage}[t]{0.4\textwidth}
            PIC 1
        \end{minipage}
    }
    \caption[Short Caption]{Long Caption}
\end{figure}

\begin{figure}
    \subfigure[Sub-caption A]{\label{LabelA}%
        \frame{
            \begin{minipage}[t]{0.4\textwidth}
                PIC 2A
            \end{minipage}
        }%
    }
    \hfill
    \subfigure[Sub-caption B]{\label{labelB}%
        \frame{
            \begin{minipage}[t]{0.4\textwidth}
                PIC 2B
            \end{minipage}
        }%
    }%
    \caption[General Short Caption]{General Long Caption\label{GenLabel}}
\end{figure}
\end{document}
Vivi
  • 26,953
  • 31
  • 77
  • 79
Gitano
  • 1,389

2 Answers2

4

The subfigure package has long be declared obsolete. You get correct output with the successor package subfig (notice that you must use \subfloat instead of \subfigure and \subtable); the \captionsetup is drawn from the documentation to emulate the old options.

\documentclass{book}

\usepackage{subfig}
\captionsetup[subfloat]{position=top,
  farskip=10pt,topadjust=0pt,captionskip=10pt,
  nearskip=10pt,margin=10pt}

\setcounter{lofdepth}{2}

\begin{document}
\listoffigures

\begin{figure}
\framebox[0.4\textwidth]{PIC 1}
\caption[Short Caption]{Long Caption}
\end{figure}

\begin{figure}
\subfloat[Sub-caption A]{\label{LabelA}%
  \framebox[0.4\textwidth]{PIC 2A}%
}%
\hfill
\subfloat[Sub-caption B]{\label{labelB}%
  \framebox[0.4\textwidth]{PIC 2A}%
}

\caption[General Short Caption]{General Long Caption\label{GenLabel}}
\end{figure}
\end{document}

Here is the "List of figures"

enter image description here

and here's the part with the subfloats

enter image description here

egreg
  • 1,121,712
  • Thanks! I didn't know I was working with an obsolete package. Definitely I am goning to use this code. – Gitano Dec 20 '12 at 03:56
  • There is one small mistake I can't resolve. When you add 'hyperref' package and '\chapter{Chap. 1}' after '\listoffigures' entry, you get a bad numbering in LOF, actually there are two warning about that. Do you know how resolve it? I appreciate any idea... – Gitano Dec 21 '12 at 14:40
  • @Gitano I'm afraid that subfig is no longer compatible with hyperref and switching to subcaption is the best thing you can do. See here and here – egreg Dec 21 '12 at 15:11
3

The options FIGTOPCAP (and FIGBOTCAP) controls the settings for the normal caption as well as the subfigure’s caption. In your example, the subfigure’s caption were allocated to the first figure because they appeared after the first and before the second \caption.

The subfigure package offers three so called “flags” (→ subfigure manual, 4.5 “Aligning Captions Above the Figure”, pp. 23f.):

  • \subfiguretopcaptrue
  • \subfiguretopcapfalse
  • \figuretopcaptrue

Admittedly, I can’t fully follow the explanations and examples from the manual; the solution is to drop the FIGTOPCAP option and use \subfiguretopcaptrue (preferably in the preamble), as it does exactly what it says on the tin.

Code

\documentclass{book}
\usepackage[tight]{subfigure}
\subfiguretopcaptrue
\setcounter{lofdepth}{2}

\begin{document}
\listoffigures

\begin{figure}
    \frame{
        \begin{minipage}[t]{0.4\textwidth}
            PIC 1
        \end{minipage}
    }
    \caption[Short Caption]{Long Caption}
\end{figure}

\begin{figure}
    \subfigure[Sub-caption A]{\label{LabelA}%
        \frame{
            \begin{minipage}[t]{0.4\textwidth}
                PIC 2A
            \end{minipage}
        }%
    }
    \hfill
    \subfigure[Sub-caption B]{\label{labelB}%
        \frame{
            \begin{minipage}[t]{0.4\textwidth}
                PIC 2B
            \end{minipage}
        }%
    }%
    \caption[General Short Caption]{General Long Caption\label{GenLabel}}
\end{figure}
\end{document}

Output

enter image description here

Qrrbrbirlbel
  • 119,821