1

I often write exams of the form:

\documentclass[a4paper,11pt,leqno,nocancelspace]{exam}
\begin{document}
  \begin{center}\begin{framed}
  {\bfseries \large EXAMINATION}
\end{framed}\end{center}
\pagebreak
\cfoot{\ifincomplete{\textit{Question continues on next page.}}{}}

\begin{questions}
\include{question_catalogue/first_topic_qn}
\pagebreak
\include{question_catalogue/second_topic_qn}
\end{questions}
\cfoot{}\newpage
\ \vfill
\cfoot{\textit{This page is intentionally left blank.}}\newpage
\ \vfill 
\newpage
\ \vfill 
\newpage\ 
\ \vfill
\end{document}

And then each of the questions are in separate files, and are of the form:

\titledquestion{First topic}
This is a question on the first topic.
\begin{parts}
\part Answer this
\begin{solutionorbox}[\stretch{1}]
\end{solutionorbox}
\part Answer that
\begin{solutionorbox}[\stretch{1}]
\end{solutionorbox}
\pagebreak
\part Answer something else
\begin{solutionorbox}[\stretch{1}]
\end{solutionorbox}
\end{parts}

I have just noticed that the footer on the last page of the final question incorrectly says "Question continues on next page." Having played around with things it appears that the problem is the use of \include. When I switch the \include of the last question to \input the footer looks correct. While I'm happy I can write exams this way, it's a little unsatisfactory/hacky that I can't use a standard LaTeX command like \include. Are there any other ways around this problem?

  • 1
    \include should only be used at the top level not inside an environment, you want \input here. then use \clearpage before and after each \input – David Carlisle May 11 '17 at 6:48
  • @DavidCarlisle Sounds like that's my problem (though presumably the document environment is an exception...) – beldaz May 11 '17 at 6:52
  • the document environment isn't really an environment at all (it's a syntactic trick) that is things inside every environment except document are in a tex group. – David Carlisle May 11 '17 at 6:54
2

\include is designed for top level constructs such as \chapters (specifically things where you need to save the document state so that units can be skipped with \includeonly). So you should use \input here. Changing the page header mid-document is most reliable at a forced page break \include uses \clearpage before and after the \included text so perhaps that is what you want here.

\clearpage\input{zzzzz}\clearpage
0

If you put the command \nomorequestions immediately following the last question, all should be well.

  • Thanks. This does appear to work if I put \nomorequestions at the end of the file of the final question, but not if I put it in the top-level document. That's an improvement, but limits my ability to re-order the questions. – beldaz May 11 '17 at 6:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.