I'm using the exam
package for creating exercise questions of a class and trying to leave empty spaces dynamically according to the length of the solution, instead of setting a static value.
The exam package provides an option to print the solutions or leave an empty space for students to answer when solutions not printed. This option is set by the following commands:
\printanswers
or
\noprintanswers
A question and a solution is formatted as follows:
\begin{questions}
\question This is a question text
\begin{solution}[2in]
\begin{itemize}
\item First answer
\item Second answer
\item A hundred answers maybe
\end{itemize}
\end{solution}
\end{questions}
Here the solution space is defined in this line:
\begin{solution}[2in]
What I'm currently doing is to set a variable called \solspace
and use it for each solution across the document. I can manually set a proper value for the solution space depending on the length of the solution as well, but that's not the best way.
What I want to do is to (ideally) calculate how much space the solution would take (when \printanswers
) and use this value in \solution[2in]
instead of the static value of 2in
. It could also be possible to somehow estimate the length of the solution and use a proper length for the space. Note that solutions are not limited to items or text, could be formulas or images.
Any ideas on how to approach this problem?
Example:
vphantom
around the whole solution?itemize
env or other envs, the structure of the solutions varies from images to formulas