![将“包含图形”拆分到两页,但保留相同的图形编号](https://linux22.com/image/327710/%E5%B0%86%E2%80%9C%E5%8C%85%E5%90%AB%E5%9B%BE%E5%BD%A2%E2%80%9D%E6%8B%86%E5%88%86%E5%88%B0%E4%B8%A4%E9%A1%B5%EF%BC%8C%E4%BD%86%E4%BF%9D%E7%95%99%E7%9B%B8%E5%90%8C%E7%9A%84%E5%9B%BE%E5%BD%A2%E7%BC%96%E5%8F%B7.png)
在下面的 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
。对于浮点数,也就是上一个的延续,只需要在 之后添加这个宏即可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}