I want to learn how to create a command such that I can easily toggle between having dotted lines or solution or even blank space (no space) under my questions.
I know exam class has the answer
argument that allows you to display your solution under the question but that only does half the job as it also displays the dotted lines above.
My MWE:
\documentclass[a4paper,answers,12pt]{exam}
\begin{document}
\begin{questions}
\question[1] $1+1$?
\begin{choices} \choice 1\correctchoice 2\choice 3\choice 4\end{choices}
\question[1]
What is $1+1$?
\fillwithdottedlines{2cm}
\begin{solution}
$2$
\end{solution}
\question Answer the following questions.
\begin{parts}
\part[1] What is $1-1$?
\fillwithdottedlines{2cm}
\begin{solution}
$2$
\end{solution}
\end{parts}
\end{questions}
\end{document}
Ideally, I want to learn how to create a command that can easily toggle between these three states.