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
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...
Using
\setcounter{question}{0}
after\section
did restart the numbering but gaveLaTeX 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.