我使用以下代码生成两页,每页两个图。
% get on left side of a 2-page spread
\clearpage
\ifodd\value{page}\mbox{}\clearpage\fi
% two images on this page
\includegraphics{f1}
\vspace{...}
\includegraphics{f2}
\clearpage
% two more images on this page
\includegraphics{f3}
\vspace{...}
\includegraphics{f4}
% caption
\vspace{...}
\captionof{figure}{........}
\clearpage
但论文看起来会像这样:
第 A 段...
很多空白....
两页四个数字
第 B 段...
我怎样才能让段落 B 跟随段落 A 并去掉空白区域?
答案1
您需要创建浮动元素,以便获得所需的文本和图形放置行为。这是一个最小工作示例,它创建了 2 个浮动元素,每个浮动元素包含 2 个图形。如果图形足够大,它们将分成 2 页:
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{mwe}
\begin{document}
Paragraph A
\begin{figure}[p]
\centering
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.9\linewidth]{example-image-a}
\caption{A subfigure}
\label{fig:sub1}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.9\linewidth]{example-image-a}
\caption{A subfigure}
\label{fig:sub2}
\end{subfigure}
\end{figure}
\begin{figure}[p]
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.9\linewidth]{example-image-a}
\caption{A subfigure}
\label{fig:sub21}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.9\linewidth]{example-image-a}
\caption{A subfigure}
\label{fig:sub22}
\end{subfigure}
\caption{A figure with two subfigures}
\label{fig:test2}
\end{figure}
Paragraph B
\end{document}