10

This is the minimal working example:

\documentclass[a4paper,11pt]{exam}
\begin{document}

\section{ONE}
\begin{questions}  
\question First question
\question Second questoion
\end{questions}

\section{TWO}
\begin{questions}  
\question First question
\question Second questoion
\end{questions}


\end{document}

The problem I have with this is that there is a warning for multiply defined labels. Which in a very big document sometimes makes the compilation hang.

Is there a fix for that?

lockstep
  • 250,273
piptin
  • 389
  • Looks to me that the question counter is reset at new sections?! The problem seems to be that the value of the question counter is used for some internal references of the type question@\arabic{question} which causes multiple labels because the counter is reset... – cgnieder Aug 08 '14 at 15:33
  • I guess I didn't phrase the question properly.

    But, yes, the counter is reset, but I get the mulptiply defined label warning because the counter is reset each time.

    And this is a real problem as the document gets bigger because of all the mulptiply defined labels warning and the compiler hangs.

    – piptin Aug 08 '14 at 15:35
  • Then why is your question »How to reset the question number for different sections«? – cgnieder Aug 08 '14 at 15:36
  • sorry I was just trying to keep the question short, they do reset but not without errors/warnings – piptin Aug 08 '14 at 15:45

1 Answers1

2

I'm not sure if this is the right way to do this but I found a way to fix this recently, any other ideas and comments on what I did are very welcome.

I changed two lines in the exam.cls which are

line2566

\edef\@queslabel{question@\arabic{question}}%

to

\edef\@queslabel{question@\arabic{section}@\arabic{subsection}@\arabic{question}}%

and

line2893

\edef\@partlabel{part@\arabic{question}@\arabic{partno}}%

to

\edef\@partlabel{part@\arabic{section}@\arabic{subsection}@\arabic{question}@\arabic{partno}}%

I only changed this two since they were the ones giving me the warnings and I don't use subparts or subsubparts. I guess if needed, those should be changed too.

piptin
  • 389