0

I have an exam class document containing only questions (about 500 or so questions) using

\begin{questions}
\question[5] Question 1 text
\question[10] Question 2 txt
\question[10] Question 3 txt
...
\question[10] Question 500 txt
\end{questions}

I don't intend to generate solutions for any question. Currently all questions appear one after the other in the document.

Now I want each question to appear on a new page. What is the easiest/fastest way to do this without adding solutions environment to each question manually?

I did NOT add the following code after each \question environment to leave all the remaining space on the page blank (as advised in the manual).

\vspace*{\stretch{1}}
\newpage

Thanks in advance!

Edit: Is there a way to modify:

\renewcommand{\questionshook}{\setlength{\itemsep}{1in}}

As given in the exam class manual, this command inserts additional one inch of blank space between questions.

5
  • 1
    Why not just \newpage without the vspace* ? Feb 5, 2022 at 20:51
  • Even then, that would require to add /newpage after each question. The solution demands for simple command to get new question on each page. Feb 5, 2022 at 21:13
  • @DilpreetKaur: Strictly speaking, adding \newpage before each question, as suggested by Peter Wilson, would be an easy search-and-replace job for a text editor, so it does count as a solution in my eyes. – Still, your desired approach would be much cleaner. Have you tried sth like \newcommand{\pagequestion}{\newpage\question} and \pagequestion[10]? It works for me.
    – marquinho
    Feb 6, 2022 at 9:07
  • Thanks but I don't wish to use the editor find-replace-all. I would like a latex based solution. Your given command does not work. Feb 6, 2022 at 11:24
  • For the sake of accuracy and for reference: That command does work (with the desired output) in a properly constructed, minimal document (\documentclass{exam}) I made for testing purposes. You didn't give us a MWE to work with: that's all I could do. – To the point: I agree with your requiring a clean solution (setting one parameter > find-replace-all). It's surprisingly difficult, though.\question resists to many of the direct approaches (renewcommand, patch, appto, \let\oldquestion\question etc.). It might be worth contacting the maintainer about this.
    – marquinho
    Feb 7, 2022 at 10:10

1 Answer 1

1

The following solution involves defining a new command \pagequestion that places a page break immediately before a \question. (1) OP was looking to insert a page break after the question not before. Arguably, this has the same effect ("I want each question to appear on a new page").

(2) I couldn't find a way to \let LaTeX process \question as \pagequestion though. Thus, the present solution requires using \pagequestion instead of \question (or substituting it via search-and-replace). More proficient users may suggest a way to do this.

For reason (2), my solution is messier than the one envisioned by OP. It doesn't meet their explicitly stated criteria, unfortunately. However, as it might be still useful for others encountering the same problem, here's an answer for future reference, with the following MWE:

\documentclass{exam}

\newcommand{\pagequestion}{\newpage\question}

\begin{document}
\begin{questions}
\pagequestion[5] Question 1 text
\pagequestion[10] Question 2 txt
\pagequestion[10] Question 3 txt
...
\pagequestion[10] Question 500 txt
\end{questions}
\end{document}

each question on a new page

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .