Tuesday, March 30, 2010

[QnA] Use the latest version of exam.cls for preparing exam papers

When preparing an exam paper, we might want to have two versions of this exam paper: one with answers for teachers and the other has only questions for students.

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