6

Purpose: I need to create a document that contains multiple individual exams. I have already applied heavy customisations to the exam class so I wish to continue using it rather than having to start all over again!

Problem: For each individual exam, I need the question number to restart at one and for individual grade point tables to be produced. If I use two separate question environments, then there will be label errors and the grade tables will BOTH show the grades for the questions in section section. If I use one question environment, then the questions numbering will not reset to zero at each section. I cannot use a fake counter because my customisations heavily depend on \thequestion.

\documentclass[a4paper,addpoints]{exam}
\begin{document}
\partialpointtable{1}[h][questions]
\partialpointtable{2}[h][questions]

\fullwidth{\section{ONE}}
\fullwidth{\subsection{one}}
\partialpointtable{1}[h][questions]

\begin{questions}
\begingradingrange{1}
\question[10] This is the first question
\question[20] This the second question
\begin{parts}
    \part[10] This is a part worth 10 marks
\end{parts}
\endgradingrange{1}
%\end{questions} %--- If you uncomment this, errors will start happening...

\fullwidth{\section{TWO}}
\fullwidth{\subsection{one}}
\partialpointtable{2}[h][questions]
%\begin{questions} %--- If you uncomment this, errors will start happening...
\begingradingrange{2}
\question[3] This is the first question
\question[4] This the second question
\begin{parts}
    \part[1] This is a part worth 1 mark
\end{parts}
\endgradingrange{2}
\end{questions}

\end{document}

Attempted solutions

  1. Fix the label problems using: How to reset the question number for different sections in exam class without getting multiply defined labels. This didn't work for me as the grade tables began throwing errors...

  2. Using \setcounter{question}{0} after \section did restart the numbering but gave LaTeX Warning: Label multiply defined. warnings everywhere. Both the grade tables also showed the marks for the questions in Section 2 only.

Any help would be very appreciated!! I'm open to all suggestions including changing the exam.cls file, combining separate exam files, etc etc.

4
  • 1
    try this trick
    – touhami
    Jun 29, 2016 at 6:14
  • huh, that's actually quite a neat trick! I would rather not have to move everything down a level (e.g parts become subparts) but if there are no other suggestions then I will just restructure everything. Thanks again!
    – Alwin
    Jun 29, 2016 at 10:34
  • 1
    This is brilliant \setcounter{question} {0} it works perfectly for me!
    – Jon
    Jul 31, 2022 at 18:06
  • @jon As long as you don't need to do cross-references amongst the questions. (LaTeX complains about multiply defined labels)
    – Olivier
    Nov 15 at 3:04

0

You must log in to answer this question.

Browse other questions tagged .