我想将 10 个子图拆分为两页(6 个在一页底部,4 个在下一页顶部)。我为此使用了 \ContinuedFloat。为了设置两个块的位置,我分别为每个块写入 [!b] 和 [ht]。
但是,我在两块图之间得到了整整一页的文本。如果我写 [H] 而不是 [ht],那么第二个图块(图 7-10)就会位于第一个图块(图 1-6)上方。
有人知道如何解决这个问题吗?提前谢谢您。
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\begin{document}
\begin{figure}[!b]
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig1}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig2}
\end{subfigure}
\newline
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig3}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig4}
\end{subfigure}
\newline
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig5}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig6}
\end{subfigure}
\end{figure}
\begin{figure}[ht]\ContinuedFloat
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig7}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig8}
\end{subfigure}
\newline
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig9}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig10}
\end{subfigure}
\caption{Description }
\label{fig:labelfig}
\end{figure}
\end{document}```
答案1
试试这个代码。我用的测试图像替换了 xxx.eps width=0.5\linewidth
,并在第六个数字后添加了一个clearpage
以清除浮动。
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{kantlipsum} %dummy text
\begin{document}
\kant[1]
\begin{figure}[!b]
\begin{subfigure}{.5\textwidth}
\centering
% \includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\includegraphics[ width=0.5\linewidth]{example-image-A}
\caption{fig1}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
% \includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\includegraphics[ width=0.5\linewidth]{example-image}
\caption{fig2}
\end{subfigure}
\newline
\begin{subfigure}{.5\textwidth}
\centering
% \includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\includegraphics[ width=0.5\linewidth]{example-image}
\caption{fig3}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
% \includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\includegraphics[ width=0.5\linewidth]{example-image}
\caption{fig4}
\end{subfigure}
\newline
\begin{subfigure}{.5\textwidth}
\centering
% \includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\includegraphics[ width=0.5\linewidth]{example-image}
\caption{fig5}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
% \includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\includegraphics[ width=0.5\linewidth]{example-image-B}
\caption{fig6}
\end{subfigure}
\end{figure}
\clearpage % added
\begin{figure}[ht]
\addtocounter{figure}{-1} % added
\begin{subfigure}{.5\textwidth}
\addtocounter{subfigure}{6} % added
\centering
% \includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\includegraphics[ width=0.5\linewidth]{example-image-C}
\caption{fig7}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
% \includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\includegraphics[ width=0.5\linewidth]{example-image}
\caption{fig8}
\end{subfigure}
\newline
\begin{subfigure}{.5\textwidth}
\centering
% \includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\includegraphics[ width=0.5\linewidth]{example-image}
\caption{fig9}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
% \includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\includegraphics[ width=0.5\linewidth]{example-image}
\caption{fig10}
\end{subfigure}
\caption{Description }
\label{fig:labelfig}
\end{figure}
\kant[2]
\end{document}
由于您使用的是两个图形环境,因此您需要设置/重置图形和子图形计数器,或者\ContinuedFloat
在启动第二个图形后使用。
答案2
该解决方案基于将图片放在下一页底部或顶部. 它允许人们在任何一组子图之间进行中断。
\documentclass{article}
\usepackage[demo]{graphicx}% missing files
\usepackage{caption}
\usepackage{subcaption}
\makeatletter
\AddToHook{shipout/background}{%
\def\reset#1{\ifnum\count#1=52 \global\count#1=54% [b]
\else \ifnum\count#1=36 \global\count#1=54\fi% [b!]
\fi}% convert [b] of [b!] to [bt]
\let\@elt=\reset
\@deferlist}
\makeatother
\usepackage{lipsum}% MWE only
\usepackage{showframe}% MWE only
\begin{document}
\lipsum[1]
\begin{figure}[b]
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig1}
\end{subfigure}\hfil
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig2}
\end{subfigure}
\end{figure}
%
\begin{figure}[b!]\ContinuedFloat
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig3}
\end{subfigure}\hfil
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig4}
\end{subfigure}
\end{figure}
%
\begin{figure}[b!]\ContinuedFloat
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig5}
\end{subfigure}\hfil
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig6}
\end{subfigure}
\end{figure}
%
\begin{figure}[b!]\ContinuedFloat
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig7}
\end{subfigure}\hfil
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig8}
\end{subfigure}
\end{figure}
%
\begin{figure}[b!]\ContinuedFloat
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig9}
\end{subfigure}\hfil
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[trim=0 0 430 0,clip, width=1.0\linewidth]{xxx.eps}
\caption{fig10}
\end{subfigure}
\caption{Description }
\label{fig:labelfig}
\end{figure}
\lipsum[2]
\end{document}