[Tex/LaTex] Multiple labels warning for exam class with parts

cross-referencingexamwarnings

I am writing a document in the exam class. For question with multiple parts (a), (b),… you are supposed to use the parts environment. Using it works fine, until I add a solution to the question that also contains a parts environment.

The document compiles to the correct result, but I see LaTeX Warnings in the log (which is annoying because vim will show them to me every time!):

LaTeX Warning: Label `part@2@1' multiply defined.
LaTeX Warning: Label `part@2@2' multiply defined.
.....
LaTeX Warning: There were multiply-defined labels.

I remember that this used to work. Am I doing something wrong here?

A minimal working example would be:

\documentclass[letterpaper, 12pt, answers]{exam}
\begin{document}
\begin{questions}
\question The exam document class defines labels for parts.
\begin{parts}
\part Are these labels unique for you?
\part Why are they not unique for me?
\end{parts}

\begin{solution}
\begin{parts}
\part Maybe, I don't know.
\part That's my questions.
\end{parts}
\end{solution}
\end{questions}
\end{document}

Best Answer

Oops; this is a bug in exam.cls, which is fixed in the betatest version 2.407beta, available from my web page at

http://www-math.mit.edu/~psh/#ExamCls

Either put this version into the directory with your latex file, or else just replace the older version with this one.

This is a bug that was reported to me just a couple of months ago, which is why it's corrected in the betatest version. I hadn't anticipated that people would use a parts environment inside a solution environment (silly me!), and so the labels that are generated by the second parts environment are duplicates of the ones from the first parts environment. This new betatest version doesn't generated those labels when the parts environment is inside of a solution environment.

These labels didn't exist in much older versions of exam.cls, which is why you didn't see this problem earlier.

So: My apologies for the problem, but it's fixed in the betatest version.