6

In my MWE below, I originally had the figures on one page, but then as I added more text, it became apparent that I had to split the figures across two pages. I wanted to keep the same Figure number for both figures (Figure 1). Is the best practice to use the \renewcommand{\thefigure}{1} command? Will I have a problem if I then try to reference part A and part B Figures in the document? Thanks for your help.

Here is my code:

\documentclass[11 pt]{book}
\usepackage[draft]{pgf}
\usepackage{lipsum}
\usepackage{float}

\begin{document}
\lipsum[1-2]
\begin{figure}[H]
\centering
\begin{pgfpicture}
    \pgftext{\pgfimage[width=13cm,height=7cm]{scratch.png}}
\end{pgfpicture}
\label{fig1_ptA}
\caption{This is the first figure.}
\end{figure}
\renewcommand{\thefigure}{1}
\begin{figure}[H]
\centering
\begin{pgfpicture}
    \pgftext{\pgfimage[width=13cm,height=7cm]{scratch.png}}
\end{pgfpicture}
\label{fig1_ptB}
\caption{This is the first figure (continued).}
\end{figure}

\end{document}
  • 1
  • 2
    \addtocounter{figure}{-1} between the two figures, perhaps? But that's not really robust enough, in case even more text results in the two parts of the figure ending up on the same page. I think personally, I'd be tempted to reach for the subfigure package and make figure 1a and 1b. It seems the least hacky solution. – Harald Hanche-Olsen Feb 5 '16 at 23:32
  • 1
    do as Harald says. If you use `\renewcommand\thefigure{1} then it will be hard to regain the normal numbering afterwards – David Carlisle Feb 5 '16 at 23:36
  • 1
    With the caption package, the use of \caption[full toc caption]{caption part A} and \caption*{caption part B} might achieve what you desire. – Steven B. Segletes Feb 5 '16 at 23:42
7

Package caption for such cases define macro \ContinuedFloat. To the float, which is continuation of the previous one, you only need add this macro after begin{figure}:

\documentclass[11 pt]{book}
\usepackage[draft]{pgf}
\usepackage{lipsum}
%\usepackage{float} % <-- not used
\usepackage{caption}% <-- added

\begin{document}
\lipsum[1-2]
    \begin{figure}[!b]
\centering
\begin{pgfpicture}
    \pgftext{\pgfimage[width=\linewidth,height=7cm]{scratch.png}}
\end{pgfpicture}
\caption{This is the first figure.} 
\label{fig1_ptA}    % <-- had to be after caption
\end{figure}
%
\begin{figure}[!t]
\ContinuedFloat     % <--- added
\centering
\begin{pgfpicture}
    \pgftext{\pgfimage[width=\linewidth,height=7cm]{scratch.png}}
\end{pgfpicture}
\caption{This is the first figure (continued).}
\label{fig1_ptB}    % <-- had to be after caption
    \end{figure}
\lipsum[3]

See Fig.~\ref{fig1_ptA} on page \pageref{fig1_ptA} and Fig.~\ref{fig1_ptB}  on page \pageref{fig1_ptB} \dots

\end{document}

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.