LaTeX/Teacher's Corner

From Wikibooks, the open-content textbooks collection

< LaTeX
Jump to: navigation, search

Contents

[edit] Intro

LaTeX has specific features for teachers. We present the exam class[1] which is useful for designing exams and exercise with solutions. Interested people could also have a look at the probsoln package[2] or the mathexm document class[3].

[edit] The exam class

We present the exam class. The exam class is well suited to design exams with solutions. You just have to specify in the preamble if you want the solutions to be printed or not. You can also count the number of points.

[edit] Preamble

In the preamble you can specify the following lines :

\documentclass[a4paper,11pt]{exam}
% If you want to print answers
\printanswers
% if you want to count the points
\addpoints
% Specifies the way question are displayed
\qformat{\textbf{Question\thequestion}\quad(\thepoints)\hfill}
% defines the style of the solution environment
\shadedsolutions
% defines a new color
\usepackage{color}
\definecolor{SolutionColor}{rgb}{0.8,0.9,1}
% Defines the title of the solution environment
\renewcommand{\solutiontitle}{\noindent\textbf{Solution:}\par\noindent}

You can replace the 3 first lines with the following :

\documentclass[a4paper,11pt,answers,addpoints]{exam}

[edit] Document

  • The exam is included in the questions environment.
  • The command \question introduces a new question.
  • The number of points is specified in squarred brackets.
  • The solution is given in the solution environment. It appears only if \printanswers or answers as an option of the \documentclass are specified in the preamble.

Here is an example :

\begin{questions} % Begins the questions environment
\question[2] What is the solution ? % Introduces a new questions which gives 2 points
\begin{solution} 
Here is the solution 
\end{solution}
\question[5] What is your opinion ?
\begin{solution}
This is my opinion
\end{solution}
\end{questions}

[edit] Introduction

The macro \numquestions gives the total number of questions. The macro \numpoints gives the total number of points.

\begin{minipage}{.8\textwidth}
This exam includes \numquestions\ questions. The total number of points is \numpoints\.
\end{minipage}

The backslash after the macros force LaTeX to include a space between the value of the macro and the next character.

[edit] References

  1. examdoc Using the exam document class
  2. Probsoln creating problem sheets optionally with solutions
  3. http://mat140.bham.ac.uk/~richard/programming/tex/exams/msexdoc.pdf