我想了解如何强制对超出页面的所有内容进行分页。假设我有一个文档,其中包含多个图像、段落、与段落相关的图形和列表。只要列表/段落超过两页,我就想自动强制分页(无需手动添加分页符)。
我目前正在研究以下 MWE。
\documentclass[12pt,a4paper]{exam}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{lipsum}
\begin{document}
\lipsum[2-5]
\begin{enumerate}[label=\textbf{\arabic*}\hspace{4mm}]
\item
This is a dummy text. It belong to part 1. This should be forced to start on a new page. \\~\\\includegraphics[width=5cm]{example-image-a}\qquad \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm
\end{enumerate}
\lipsum[1-4]
\begin{enumerate}[label=\textbf{\arabic*}\hspace{4mm}]
\item
This item should also start on a new page but the last paragraph should also start a new page. \\~\\ \includegraphics[width=3cm]{example-image-golden}\qquad \begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}\vskip 9mm
\end{enumerate}
\lipsum[1-6]
\end{document}
澄清一下:
我希望这是有道理的。
答案1
我认为你正在寻找这个
\documentclass[12pt,a4paper]{exam}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{lipsum}
\interlinepenalty=10000
\begin{document}
\lipsum[2-5]
\begin{enumerate}[label=\textbf{\arabic*}\hspace{4mm}]
\item\begin{minipage}[t]{\linewidth}
This is a dummy text. It belong to part 1. This should be forced to start on a new page.
%NO!!!!! \\~\\
\begin{flushleft}
\includegraphics[width=5cm]{example-image-a}
\end{flushleft}
%????\qquad
\begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}
% not really latex, vspace or better specify the spacing for the list above
% \vskip 9mm
\end{minipage}
\end{enumerate}
\lipsum[1-4]
\begin{enumerate}[label=\textbf{\arabic*}\hspace{4mm}]
\item\begin{minipage}[t]{\linewidth}
This item should also start on a new page but the last paragraph should also start a new page.4
% No!! \\~\\
\begin{flushleft}
\includegraphics[width=3cm]{example-image-golden}
\end{flushleft}
%??????\qquad
\begin{enumerate}[label=(\Alph*),leftmargin=0.85cm,itemsep=2ex] \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \item BLAH BLAH BLAH \end{enumerate}
% as above\vskip 9mm
\end{minipage}
\end{enumerate}
\lipsum[1-6]
\end{document}
答案2
哪些单位是连在一起的?不是每个项目或每个段落,而且也没有章节。更不用说“一切”了。
一旦确定了地点,就放在\filbreak
那里。
(这不像\pagebreak
您所要求的,而是像\newpage
,这可能就是您想要的。)