I'm using the exam
document class, and I'd like to print the letter of the correct answer. Something like:
\documentclass{exam}
\begin{document}
\begin{questions}
\question This is a multiple choice question
\begin{choices}
\choice this is a choice
\choice this is another choice
\CorrectChoice this is the correct choice
\choice this is another choice
\end{choices}
The answer is /theCorrectChoice
\end{questions}
\end{document}
I've seen similar issues online but I haven't been able to find a good way to directly reference "the correct choice" the way you can reference /thequestion, for example. Does anyone know how to solve this?
Best Answer
You could update
\CorrectChoice
to insert an incremental\label
. However, this would mean that only the most recent\CorrectChoice
would be returned through a\theCorrectChoice
call:exam
provides a hook into thechoices
environment via\choiceshook
. Updating this to redefine\CorrectChoice
is one (clean) way of inserting the appropriate code to obtain a\label
you can\ref
erence.oneparchoices
does not provide this hook, so a different method altogether is employed in order to redefine\CorrectChoice
.More work is required for this solution to work correctly with
hyperref
.