# Exam class: How to compute the height of the solutionbox if printed

I'm using the exam class in school and I would like to compute the height of the solution boxes if they are printed, so I can have the same space, if they are not printed.

something like:

\begin{solutionorbox}[\solutionheightifprinted]
\end{solutionorbox}


I searched the answers, but found only fixed height solutions, nothing automatic.

• The boxes will take up the same space whether printed or not. The real question is how large they have to be to fit the solution. That information is computed by exam (\ht\exam@box), but not saved globally. One could either modify/replace the solutionbox environment to save the box height globally, or repeat the computation outside. – John Kormylo Jul 9 '18 at 14:23
• In either case, a full MWE would be useful. – John Kormylo Jul 9 '18 at 14:27