While using the exam class, is there a way of compiling all the questions and putting them together at the beginning of the document? I would want the end result to look something like the result of the following code. First all the questions and then each question with a solution box.
\documentclass[answers]{exam}
\begin{document}
\begin{questions}
\question First Question
\question Second Question
\end{questions}
\newpage
\begin{questions}
\question First question
\begin{EnvFullwidth}
\begin{solutionbox}{2in}
This looks good,
\end{solutionbox}
\end{EnvFullwidth}
\question Second question
\begin{EnvFullwidth}
\begin{solutionbox}{2in}
Not so good.
\end{solutionbox}
\end{EnvFullwidth}
\end{questions}
\end{document}
Is there a way to automate this, so I only have the questions typed in one place and on compilation, it will extract them and create the first part? Ideally, something that looks like:
\documentclass[answers]{exam}
\begin{document}
\printallquestions
\newpage
\begin{questions}
\question First question
\begin{EnvFullwidth}
\begin{solutionbox}{2in}
This looks good,
\end{solutionbox}
\end{EnvFullwidth}
\question Second question
\begin{EnvFullwidth}
\begin{solutionbox}{2in}
Not so good.
\end{solutionbox}
\end{EnvFullwidth}
\end{questions}
\end{document}
\printallquestions
to appear - with space for answers or not?