
В моем MWE ниже изначально рисунки были на одной странице, но затем, когда я добавил больше текста, стало очевидно, что мне нужно разбить рисунки на две страницы. Я хотел сохранить один и тот же номер рисунка для обоих рисунков (рисунок 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}