I'm using the exam class and have the problem with the parts
enviroment in combination with the solutionorbox
enviroment. The part
and the corresponding solutionorbox
should be on the same page. Here is an example that demonstrate the problem:
\documentclass{exam}
\usepackage{blindtext}
\begin{document}
\begin{questions}
\titledquestion{Farben}
\begin{parts}
\part[4] Question 1 \blindtext
\begin{solutionorbox}[16cm]
\blindtext
\end{solutionorbox}
\part[4] Question 2 \blindtext
\begin{solutionorbox}[10cm]
\blindtext
\end{solutionorbox}
\end{parts}
\end{questions}
\end{document}
I have tried to modify the \part
command by using etoolbox
package but it does not work with:
\preto{\part}{\par\nobreak\vfil\penalty 9999\vfilneg\vtop\bgroup}
This is the part
definition in the exam.cls:
\def\part{%
\@bonusfalse
\process@part
}%
How can I add a \newpage
if needed that the question and the space for a solution is on the same page without adding the \newpage
?