The exam.cls makes this task easy. But make sure you are using the latest version of it or you will not have the handy ``ifprintanswer'' function.
Here is an sample to show how to use the exam.cls with the ifprintanswer function:
\documentclass{exam} % Set ``exam'' as the document class
\begin{document}
\newcommand{\ans}[1]{\ifprintanswers{#1}\fi} % define a new command to simplify
% the following usage
\printanswers % Add this line to print the answers.
% If no answers printing is wanted, just comment this line out.
\begin{questions}
\question
\ans{The answer} The question's description
\begin{choices}
\choice The choice A
\choice The choice B
\choice The choice C
\choice The choice D
\end{choices}
\end{questions}
\end{document}
---
Ref:
Using the LaTeX exam class
No comments:
Post a Comment