10

I'm trying to compile this book https://forja.rediris.es/projects/guia-wxmaxima/ I'm using MiKTeX, TeXstudio, and in the build options I have the default compiler pdfLaTeX. So my question is, why there are a lot of errors that say Label '...' multiply defined?

  • 2
    That are warnings and no errors and refer to the environments in which the labels are defined. Some environments read their contents twice, the reason why you get a multiplied defined warning. However, have a look into the log file it prints the names of such labels. You can have a look if the are really multiply defined or not. – user2478 May 31 '14 at 13:14
10

Because the author hasn't been paying attention to the labels he has used, or to the compile warnings.

The warning means that the same label has been used several times in the same document. For example, he has \label{chap:aritmetica} in three separate chapters, algebra.tex, aritmetica.tex and calculo.tex. This can potentially lead to wrong cross references.

There are two things to do to fix the problem:

  1. Find out which labels are used several times (read the log), and modify all but one of them, so all labels are unique.

  2. Find where those labels are used, and make sure the cross references point to the correct chapter (or whatever it is). To avoid reading the whole thing, use the fact that TeXstudio lets you search in all open documents. Open all the chapter-files in TeXstudio at the same time, go to Edit --> Searching --> Find dialog, and choose Open documents instead of Current document. Then search for the label in questions, for example chap:aritmetica, and see where it has been used in a \ref (or similar command).

(I got a lot of other errors, and the document wouldn't compile at all, but you asked only about the labels.)

| improve this answer | |
  • 1
    To anyone reading this. It can also be caused by \input being used more than once on a tex file, which contains a \label. I spent time looking for a duplicate \label, when in fact I should have been looking for a duplicate \input – tommy.carstensen Dec 8 '17 at 0:51
  • Is there any automatic way to rename labels? – skan Aug 23 '19 at 12:32
  • @skan Don't know, you could always ask a new question about it. Could of course be that someone has written a script to do that. – Torbjørn T. Aug 23 '19 at 12:36
3

An additional note to @Torbjørn T.'s answer is it may be the case of multiple \includes of a .tex file which contains the label in question, not multiple \labels per se.

I was getting the same error even when using a very eccentric label for the sake of debugging the issue, which was really strange. Even searching for the label across the .tex files in my project didn't find any other re-usages of the same label.

At the end, the problem turned out to be multiple \input statements of the same .tex file that has the label defined therein. In my case, it could be solved easily by omitting the other inclusion of the same file, but if one wants to reuse the same .tex file in many places for some reason, it would be trickier to solve.

I hope this helps someone out there.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.