시험 클래스 \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}

관련 정보