Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
Do you get the desired output with \usepackage[tight]{subfigure} \subfiguretopcaptrue in the preamble? –  Qrrbrbirlbel Dec 19 '12 at 2:49
    
Thanks! That is the trick. –  Gitano Dec 19 '12 at 3:29
    
@Qrrbrbirlbel please either post an answer, or vote to close TL –  cmhughes Dec 19 '12 at 4:24
add comment

2 Answers

up vote 4 down vote accepted

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

share|improve this answer
    
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 3: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
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.