I use the exam
class to write my exercise sheets. Sometimes the solutions are printed and sometimes there are not.
When the solutions are not required I need the exercises to be printed one after one without a page break.
But when the solutions are printed I want each exercise to start on its own page.
My question is : how to modify the TheSolution
environment in such a way that a page break is automatically inserted at its end?
MME:
\documentclass[a4paper,answers]{exam}
\usepackage{lipsum}
\begin{document}
\begin{questions}
\question
\lipsum[1]
\begin{solution}
\lipsum[2]
\end{solution}
\newpage % I need this to be automatically inserted at the end of each solution
\question
\lipsum[3]
\begin{solution}
\lipsum[4]
\end{solution}
\newpage
\question
\lipsum[5]
\begin{solution}
\lipsum[6]
\end{solution}
\newpage
\end{questions}
\end{document}