我有 4 个子图,希望将它们显示在两页上,每页 2 个。(每组两个子图足够大,可以占据整个页面)。我遵循了以下建议:将子图拆分到多个页面 我查看了评论,但没有解决方案。
但是,无论我怎么尝试,LaTeX 总是在第一组两个子图和最后一组(即文本和表格)之间插入内容。有没有办法强制子图一个接一个地显示?
我的代码:
\begin{figure}[!b]
\centering
\begin{subfigure}{0.85\textwidth}
\includegraphics[width=\linewidth]{path}
\subcaption{}
\label{fig:label}
\end{subfigure}
\medskip
\begin{subfigure}{0.85\textwidth}
\includegraphics[width=\linewidth]{path}
\subcaption{}
\label{fig:label2}
\end{subfigure}
\end{figure}%
% Add a page break here
%\clearpage
\begin{figure}[ht]\ContinuedFloat
\centering
\begin{subfigure}{0.85\textwidth}
\includegraphics[width=\linewidth]{path}
\subcaption{}
\label{fig:label3}
\end{subfigure}
\medskip
\begin{subfigure}{0.85\textwidth}
\includegraphics[width=\linewidth]{path}
\subcaption{}
\label{fig:label4}
\end{subfigure}
\caption[]{Caption text }
\label{fig:figlabel}
\end{figure}
谢谢 :)
编辑:
在图之后,我有一个新的小节,然后是一个表定义(该表显示在子图之间:
\renewcommand{\arraystretch}{2}
\begin{longtable}[htp]{ >{\centering\arraybackslash}m{0.15\textwidth} >{
\arraybackslash}m{0.325\textwidth} >{\arraybackslash}m{0.325\textwidth} }
\caption{caption } \\
\label{tab:label}
\textbf{Text} & \textbf{Text} & \textbf{Text}\\ \midrule
\endfirsthead
\textbf{Text} & \textbf{Text} & \textbf{Text}\\ \midrule
\endhead
Text & Text & Text\\
\midrule
Text & Text & Text\\
\midrule
Text & Text & Text\\
\midrule
Text & Text & Text \\
\midrule
Text & Text & Text\\
\midrule
Text & Text & Text\\
\midrule
Text & Text & Text\\
\midrule
Text & Text & Text\\
\midrule
Text & Text & Text\\
\midrule
Text & Text & Text\\
\bottomrule
\end{longtable}
文字内容繁多。
答案1
\begin{figure}[ht]
用替换 就足够了\begin{figure}[t!]
。
顺便说一句,没有必要\subcaption
在subfigure
环境中写入;\caption
就可以了。
\documentclass[demo]{article} % remove 'demo' option in real document
\usepackage{subcaption,graphicx,lipsum}
\begin{document}
\lipsum[1] % a paragraph of filler text
\begin{figure}[!b]
\centering
\begin{subfigure}{0.85\textwidth}
\includegraphics[width=\linewidth]{patha}
\caption{abcdef}
\label{fig:labela}
\end{subfigure}
\medskip
\begin{subfigure}{0.85\textwidth}
\includegraphics[width=\linewidth]{pathb}
\caption{ghijkl}
\label{fig:labelb}
\end{subfigure}
\caption{Stuff}
\label{fig:label}
\end{figure}
\begin{figure}[t!]
\ContinuedFloat
\centering
\begin{subfigure}{0.85\textwidth}
\includegraphics[width=\linewidth]{pathc}
\caption{mnopqr}
\label{fig:labelc}
\end{subfigure}
\medskip
\begin{subfigure}{0.85\textwidth}
\includegraphics[width=\linewidth]{pathd}
\caption{stuvwx}
\label{fig:labeld}
\end{subfigure}
\caption{Stuff, continued}
\end{figure}
\lipsum[2-5] % four more paragraphs of filler text
\end{document}
答案2
这是我用来复制问题的完整 MWE。
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{longtable}
\usepackage{array}
\usepackage{booktabs}
\usepackage{lipsum}
\usepackage{duckuments}% don't ask
\begin{document}
\begin{figure}[!b]
\begin{subfigure}{\textwidth}
\centering
\includegraphics{example-image-duck}
\caption{}
\label{fig:label}
\end{subfigure}
\medskip
\begin{subfigure}{\textwidth}
\centering
\includegraphics{example-image-duck}
\caption{}
\label{fig:label2}
\end{subfigure}
\end{figure}%
\begin{figure}[t!]\ContinuedFloat
\begin{subfigure}{\textwidth}
\centering
\includegraphics{example-image-duck}
\caption{}
\label{fig:label3}
\end{subfigure}
\medskip
\begin{subfigure}{\textwidth}
\centering
\includegraphics{example-image-duck}
\caption{}
\label{fig:label4}
\end{subfigure}
\caption[]{Caption text }
\label{fig:figlabel}
\end{figure}
\lipsum[1]
%\newpage
\renewcommand{\arraystretch}{2}
\begin{longtable}[htp]{ >{\centering\arraybackslash}m{0.15\textwidth} >{
\arraybackslash}m{0.325\textwidth} >{\arraybackslash}m{0.325\textwidth} }
\caption{caption } \\
\label{tab:label}
\textbf{Text} & \textbf{Text} & \textbf{Text}\\ \midrule
\endfirsthead
\textbf{Text} & \textbf{Text} & \textbf{Text}\\ \midrule
\endhead
Text & Text & Text\\
\midrule
Text & Text & Text\\
\midrule
Text & Text & Text\\
\midrule
Text & Text & Text \\
\midrule
Text & Text & Text\\
\midrule
Text & Text & Text\\
\midrule
Text & Text & Text\\
\midrule
Text & Text & Text\\
\midrule
Text & Text & Text\\
\midrule
Text & Text & Text\\
\bottomrule
\end{longtable}
\end{document}