「グラフィックスを含める」を 2 ページに分割しますが、図の番号は同じままにします

「グラフィックスを含める」を 2 ページに分割しますが、図の番号は同じままにします

以下の私の MWE では、当初は図が 1 ページに収まっていましたが、テキストを追加していくうちに、図を 2 ページに分割する必要があることがわかりました。両方の図に同じ図番号を付けたいと考えていました (図 1)。 コマンドを使用するのがベスト プラクティスでしょうか\renewcommand{\thefigure}{1}? その後、ドキュメント内でパート A とパート B の図を参照しようとすると、問題が発生しますか? ご協力ありがとうございます。

これが私のコードです:

\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

captionこのような場合のパッケージはマクロを定義します\ContinuedFloat。前のマクロの続きである float には、 の後にこのマクロを追加するだけです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}

関連情報