After adding the varioref package (to generate text like "Figure XX on page YY" from TeX input like \vref{fig:example}
), I started seeing warnings like
LaTeX Warning: Label `1@xvr' multiply defined.
LaTeX Warning: Label `1@vr' multiply defined.
My document has chapters stored in separate files: chapter1.tex
, chapter2.tex
, etc., which are referenced from the master document using
\include{Chapter1/chapter1}
\include{Chapter2/chapter2}
...
I traced the problem to the fact that varioref
generates its own xvr
and vr
labels by concatenating a counter with @xvr
and with @vr
. It seems that this counter is reset for each file. For example, in my document, chapter5.aux
contains
\newlabel{1@xvr}{{}{181}{Review of ...}{subsection.5.3.2}{}}
\newlabel{1@vr}{{}{181}{Review of ...}{subsection.5.3.2}{}}
and chapter6.aux
contains
\newlabel{1@xvr}{{}{198}{Introduction to ...}{section.6.1}{}}
\newlabel{1@vr}{{}{198}{Introduction to ...}{section.6.1}{}}
Clearly, the labels generated by varioref
are duplicates across chapters, though they are unique within a chapter. I wish to fix the problem because I do not have confidence that, when referencing a label in a different chapter (say, \vref{sec:Introduction to ...}
from chapter5.tex
in the example above), the page reference will be correct in all cases.
Thanks in advance for any help you can provide!
Update: It seems that that varioref
does not always work well with forked versions of CUED thesis template. YMMV!
varioref
has nothing to do with the problem.varioref
generates its own labels according to the algorithm above. These auto-generated labels are the only labels that LaTeX claims are not unique in the document. I was hoping there might be some way to influence howvarioref
generates its labels.\label
commands?chapter5.tex
the example is\label{subsec:Review of ...}
which LaTeX converts to\newlabel{subsec:Review of ...}{{5.3.2}{181}{Review of ...}{subsection.5.3.2}{}}
in chapter5.aux. Compare with the first block of\newlabel
statements generated byvarioref
in the question above.