Como continuar as linhas na próxima página na aula de exame \fillwithlines

Como continuar as linhas na próxima página na aula de exame \fillwithlines

Eu uso a classe de exame para compor meus exames. Normalmente deixo espaço para respostas \fillwithlines{3in}porque prefiro fixar a quantidade de espaço. Porém, quando uma pergunta está no final de uma página e o espaço exigido por \fillwithlines{3in}ela o ultrapassa, as linhas não continuam na página seguinte. Em vez disso, a pergunta inteira é movida para a próxima página enquanto a página atual é um espaço em branco. Existe uma maneira de mudar esse comportamento e fazer com que as linhas comecem em uma página e continuem na próxima.

\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}

Responder1

Só tive que substituir \cleaderspor um loop. O \spacepermite quebras de linha.

\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}

informação relacionada