3

I have several large figures which I have split over several pages using the \subfloat command. I would like each page in the figure to display the Figure number, but the full caption should only be displayed on the last page. Only the full caption should appear in the list of figures. The following code shows a minimal (not) working example:

\documentclass[a4paper,11pt,oneside,openany]{book}

\usepackage{graphicx}
\usepackage{float}
\usepackage{subfloat}
\usepackage{subfig}
\usepackage[hidelinks]{hyperref}


\begin{document}
\listoffigures
\begin{figure}
\caption{}
\end{figure}

\begin{figure}[!htpb]
    \centering
        \subfloat[]{%
            \includegraphics[scale=1]{}
        }\\
        \subfloat[]{%
            \includegraphics[scale=1]{}
        }\\
        \caption{}
\end{figure}

\begin{figure}
    \centering
    \ContinuedFloat
    \subfloat[]{%
            \includegraphics[scale=1]{}
        }\\
        \subfloat[]{%
            \includegraphics[scale=1]{}
        }\\
        \caption{}
\end{figure}

\begin{figure}
    \centering
    \ContinuedFloat
        \subfloat[]{%
            \includegraphics[scale=1]{}
        }\\
\caption{}
\label{fig:intensitystructureplots}
\end{figure}

\end{document}

However, with the hyperref package included the figure numbering for the figure containing subfloats goes: Figure 2 for the first figure of the group (correct), then Figure 1, then Figure 0. All three floats also have an entry in the list of tables. Turning off hyperref solves the problem of decrementing numbers, all are now labelled Figure 2, however the three Figures linked by the \ContinuedFloat command all have an entry in the List of Figures table, when only the last should be listed as they are all part of the same figure. Using the \phantomcaption command removes the entry from the List of Figures, but also removes the label from the Figure.

  • 1
    Why are you using 3 \captions for the same figure? This is the source of the problem. If you remove \ContinuedFloat in fact the problem goes away. – karlkoeller Aug 23 '13 at 17:29
  • The reason is that these figures are split over several pages; hence I think the individual pages should show the Figure number, otherwise it just appears as page with a picture on and the reader has no idea which figure it is or why there isn't a caption. – 218 Aug 23 '13 at 17:32
  • Yes, but why are you using both \caption and \ContinuedFloat in the same figure? The latter is to be used for the same figure. – karlkoeller Aug 23 '13 at 17:40
  • If I remove \caption, then the pages have no Figure number. If I remove \ContinuedFloat the Figure number increments. – 218 Aug 23 '13 at 17:42
  • 1
    Just to solve your problem with hyperref load subfig with the option caption=false, i.e. \usepackage[caption=false]{subfig}. But I don't know how to remove multiple entries in LOF. – karlkoeller Aug 23 '13 at 19:09
4

Unfortunately the hyperref support within subfig is broken. See also:

subcaption vs. subfig: Best package for referencing a subfigure

Problem with hyperref and subfloats

...

The only solution I'm aware of is switching to the/my subcaption package [1]:

\documentclass[a4paper,11pt,oneside,openany]{book}

\usepackage[demo]{graphicx}
\usepackage{subcaption}
\usepackage[hidelinks]{hyperref}

\begin{document}
\listoffigures
\begin{figure}
\caption{}
\end{figure}

\begin{figure}[!htpb]
    \centering
        \subcaptionbox{}{%
            \includegraphics[scale=1]{}
        }\\
        \subcaptionbox{}{%
            \includegraphics[scale=1]{}
        }\\
        \caption[]{}
\end{figure}

\begin{figure}
    \centering
    \ContinuedFloat
    \subcaptionbox{}{%
            \includegraphics[scale=1]{}
        }\\
        \subcaptionbox{}{%
            \includegraphics[scale=1]{}
        }\\
        \caption[]{}
\end{figure}

\begin{figure}
    \centering
    \ContinuedFloat
        \subcaptionbox{}{%
            \includegraphics[scale=1]{}
        }\\caption{}
\label{fig:intensitystructureplots}
\end{figure}

\end{document}

(LOF entries could be suppressed by using \caption[]{...}.)

[1] Sorry for the shameless self-advertising, but the broken hyperref support in subfig was one of the main reasons why I have written subcaption.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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