[tex-eplain] Warnings about redefinition of xref labels
Dan Luecking
luecking at uark.edu
Thu Mar 2 18:56:04 CET 2006
At 04:21 AM 3/1/2006, you wrote:
>On Tue, Feb 28, 2006 at 03:59:36PM -0600, Karl Berry wrote:
> > so all the page number shift by one. Won't you get 100
> > warnings? That's what my comment was trying to say.
>
>I see what you meant. But after some experimenting and
>reflecting, it turned out there are no warnings in the case
>of \xrdef. The trick is that the labels are only checked at
>the time the .aux file is read, when no labels have been
>defined yet except those which come earlier in the .aux
>file.
This is the way latex does it: \label writes a \newlabel command into
the .aux file and \newlabel checks for a previous definition. It's
message doesn't give any detail, it just says "Label "A" multiply
defined". Also, \end{document} reminds you: "There were multiply
defined labels"
>I am not sure that making equations work like the other
>labels, i.e., not defining the labels directly but only
>through the .aux file, is acceptable. Most importantly, the
>trick with \eqdef{} (empty label) will no longer work,
>breaking many existing documents (and that trick is really
>nice sometimes). Also, it seems nice to require only a
>single pass for texts which don't use references other than
>equation refs.
One probably shouldn't have the direct portion of \eqdef worry
about multiple definitions. Since one may want to have a forward
reference to a later equation, there has to be a write to the .aux
file and that can catch it. Or a scheme for reading the .aux file
at the end of the document can catch it and issue one message. Also,
\eqdef{} could be treated specially: just place a number and don't
define a cross reference label in that case.
> > Maybe it's worth the warnings to get the diagnostics in the more usual
> > case.
>
>Yes, I agree that it's worth. Getting warnings after
>shifting equation numbers is reasonable (although not
>necessary -- the document comes out right anyway, because
>"direct" definitions of equation labels override definitions
>in the .aux file). On the other hand, warnings about
>redefined labels can help prevent some really nasty bugs.
I don't know if a change to one equation producing a warning on all
others IS worth it. I would suggest not checking the value, but only
the label to see if it was duplicated. If it is duplicated, only warn
if it is not empty.
Dan
Daniel H. Luecking
Department of Mathematical Sciences
University of Arkansas
"Be kind. Every person you meet is fighting a hard battle." - Anon.
More information about the tex-eplain
mailing list