Exames em LaTeX

The exam class in LaTeX is very helpful for preparing tests. First, this class makes it very easy to have an answer key (and omit it when necessary). There are environments for questions and solutions, and the document adds up the points in each question for you. I’ll go over the code below.

Elaborar provas em LaTeX pode ser uma ótima ideia, principalmente com a classe exam. Basicamente, essa classe facilita todo o processo de criação de perguntas e respostas. Principalmente, o próprio documento soma os pontos de cada questão.

No código abaixo, crio um exame-exemplo com duas questões. Cada questão pode ter um número de pontos, que será somado ao fim (ver código). Uma das características mais interessantes do pacote é que ele permite que você inclua as respostas, que serão mostradas apenas se você adicionar “answers” como argumento extra na classe do documento.

\documentclass[letterpaper, 10pt, addpoints]{exam}
% Any packages you might want to use
%\usepackage{needspace}

\title{This is an exam}
\author{Prof X}
\date{Any date here}

\begin{document}

\maketitle


\vspace{0.5cm} % You'll probably want to add some space

% The following line will have lines for students' names and IDs.

\noindent\textsc{Name:} \underline{\hspace{8cm}} \textsc{ID:}\enspace{\hrulefill}

\vspace{0.5cm}

\subsection*{Instructions} % Assuming you want to provide some instructions

Some instruction.

\vspace{0.5cm}

% Now, we create the 'questions' environment, which will include the whole exam
\begin{questions}

% This is a sample question. It's worth 10 points.

% FIRST QUESTION:

\question[10] What's the capital of Russia?

% This will add some dotted lines for students to write their answers
\fillwithdottedlines{1in} 

% Now, we enter the solution (so that graders will have access to it).

\begin{solution}

Moscow.

\end{solution} 

% SECOND QUESTION:

\question[5] What's your favourite colour?

\begin{itemize}

\item[a.] Blue
\item[b.] Black
\item[c.] White

% You can play around with the enumitem package as well, of course.

\end{itemize}

\begin{solution}

Open answer.

\end{solution}

\end{questions}

\clearpage % New page

% Let's say you want to have a typical grade table at the end

\begin{center}
\gradetable % This will print the table with all points (and add them up).
\end{center}

\end{document}

Click here to see the output. If you want to print a copy of the exam with answers, simply add ‘answers’ as an argument of document class:

\documentclass[letterpaper, 10pt, addpoints, answers]{exam}

Click here to see the output with answers.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s