# exam class with exercises and points in range

I use the exam class for writing my exam ctan exam

The problem regards the counting of points when you have several exercises (so several question environments)

Normally you have solutions in the exam class but I may use this options in a wrong way.

You can find below a basic example which didn't work... exercices have same points and gradingtable.

\documentclass[a4paper,11pt]{exam}
%\printanswers % pour imprimer les réponses (corrigé)
\noprintanswers % Pour ne pas imprimer les réponses (énoncé)
\addpoints % Pour compter les points
\pointsinrightmargin % Pour avoir les points dans la marge à droite
\usepackage{lmodern}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}

\begin{document}

\textbf{Exercice 1 : \pointsinrange{ex1} pts}

\begin{questions}
\question[1] question1
\question[2] question2
\question
\begin{parts}
\part[1] question3a
\part[2] question3.b
\end{parts}
\end{questions}

\textbf{Exercice 2 : \pointsinrange{ex2} pts}

\begin{questions}
\question[2] question1
\question[1] question2
\question
\begin{parts}
\part[2] question3a
\part[3] question3.b
\end{parts}
\end{questions}

\end{document}


The problem is that each exercise has the same points attributed to it and grading table whereas there are different affectations for questions...

(I have just merge my 2 accounts)

The grading table for exercise 1 should be :

Benoit

• If you look the first grading table it is the points of exercice two normally with affectation the first grading table should be : Question 1 2 3 Total Points 1 2 3 6 Oct 28 '14 at 16:41
• This has also been posted at LaTeX-community. Oct 28 '14 at 16:56
• @Johannes_B do I have to delete from LaTeX-community ? Oct 28 '14 at 17:04
• I'm not sure you should have multiple question environments in one document with exam class - it does not seem to support more than one. Could you put each exercise in a separate document? Or perhaps just have a single question environment so that the question numbers continue across each "exercise". Oct 28 '14 at 17:08
• No, of course not. Oct 28 '14 at 17:13

This is similar to the answer provided by the OP, but allows for multiple questions to appear in each \partialgradetable. The problem was having multiple question environments. The tables are correct if you have multiple grading ranges between one set of \begin{questions} and \end{questions}.

\documentclass[a4paper,11pt]{exam}
%\printanswers % pour imprimer les réponses (corrigé)
\noprintanswers % Pour ne pas imprimer les réponses (énoncé)
\addpoints % Pour compter les points
\pointsinrightmargin % Pour avoir les points dans la marge à droite
\usepackage{lmodern}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}

\begin{document}
\begin{questions}
\uplevel{\textbf{Exercise 1 : \pointsinrange{ex1} pts}}
\question[1] question1
\question[2] question2
\question
\begin{parts}
\part[1] question3a
\part[2] question3.b
\end{parts}

\uplevel{\textbf{Exercise 2 : \pointsinrange{ex2} pts}}
\question[2] question1
\question[1] question2
\question
\begin{parts}
\part[2] question3a
\part[3] question3.b
\end{parts}
\end{questions}

\end{document}

• I have just compiled your version and the gradingtable are the same for both exercises... Oct 30 '14 at 21:00
• @BenoitLandrieu Restarting the question numbering with \setcounter{question}{0} caused both grading tables to be the same. I've removed that command from my answer, and it should compile correctly now.
– erik
Oct 31 '14 at 18:39
    \documentclass[a4paper,11pt]{exam}
%\printanswers % pour imprimer les réponses (corrigé)
\noprintanswers % Pour ne pas imprimer les réponses (énoncé)
\addpoints % Pour compter les points
\pointsinrightmargin % Pour avoir les points dans la marge à droite
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage[francais]{babel}
%-----------------------------------------------
\renewcommand{\thesubpart}{\alph{subpart}}
\renewcommand{\thepartno}{\arabic{partno}}
\renewcommand{\questionlabel}{\textbf{Exercice \thequestion:}}
\renewcommand{\partlabel}{\thepartno.}
\renewcommand{\subpartlabel}{(\thesubpart)}
%-----------------------------------------------

\begin{document}

\begin{questions}
\question \pointsinrange{ex1} pts
\begin{parts}
\part[1] question1
\part[2] question2
\part
\begin{subparts}
\subpart[1] question3a
\subpart[2] question3.b
\end{subparts}
\end{parts}

\question \pointsinrange{ex2} pts
\begin{parts}
\part[2] question1
\part[2] question2
\part
\begin{subparts}
\subpart[2] question3a
\subpart[1] question3.b
\subpart[2] question3.c
\end{subparts}
\end{parts}

• I found a very similar method, but it allows you to have more than one entry in the \partialgradetable. Also, you don't have to change the appearance of all the parts and subparts. Please see my answer for details.