Как продолжить строки на следующей странице в экзаменационном классе \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}

Связанный контент