我使用考试类来排版我的考试。我通常会为答案留出空间,\fillwithlines{3in}
因为我喜欢固定空间量。但是,当问题位于页面末尾并且所需的空间\fillwithlines{3in}
超出该范围时,行不会在下一页继续。相反,整个问题会移动到下一页,而当前页面为空白。有没有办法改变这种行为,让行从一页开始,然后继续到下一页?
\documentclass{exam}
\begin{document}
\begin{questions}
\question This question should appear on page 1. It should be followed by lines which continue on page 2.
\fillwithlines{20in}
\end{questions}
\end{document}
答案1
只需\cleaders
用循环替换即可。\space
允许换行。
\documentclass{exam}
%\usepackage{showframe}% mwe only
\makeatletter
\def\fillwithlines#1{%
\begingroup
\ifhmode
\par
\fi
\hrule height \z@
\nobreak
\setbox0=\hbox to \hsize{\hskip \@totalleftmargin
\vrule height \linefillheight depth \z@ width \z@
\linefill}%
% We use \cleaders (rather than \leaders) so that a given
% vertical space will always produce the same number of lines
% no matter where on the page it happens to start:
\dimen0=\ht0
\loop\ifdim\dimen0<#1\relax
\advance\dimen0 by \ht0
\copy0\space
\repeat
\endgroup
}
\makeatother
\begin{document}
\begin{questions}
\question This question should appear on page 1. It should be followed by lines which continue on page 2.
\fillwithlines{20in}
\end{questions}
\end{document}