如何在考試課程的下一頁繼續行 \fillwithlines

如何在考試課程的下一頁繼續行 \fillwithlines

我使用考試課程來排版我的考試。我通常會為答案留出空間,\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}

相關內容