LaTeX warning "Label `sec:intro' multiply defined": cause and fix
Two \label commands use the same name. A \ref to that name gets the number of the last one in the document, so some references point to the wrong place. The warning appears from the second run on, when LaTeX reads the labels from the .aux file.
Why it happens
- A section, figure, table or equation was copied together with its
\label, and the copy kept the name. - Two files of the project use the same name, for example
\label{sec:intro}in two chapters. - A
\labelstands inside a command of your own that is used more than once. - Two
\bibitementries of a hand-written bibliography have the same key. LaTeX reports this with the same warning.
How to fix it
- Search all files of the project for the name in the message and rename one of the two labels.
- Then check every
\refto that name: each one has to use the name of the place you mean. - Put the chapter into the name, as in
sec:method-introandsec:results-intro.
A document that produces the message
\documentclass{article}
\begin{document}
\section{Introduction}\label{sec:intro}
Text.
\section{Method}\label{sec:intro}
See Section~\ref{sec:intro}.
\end{document}Tools run in this order: pdflatex → pdflatex.
The corrected document
\documentclass{article}
\begin{document}
\section{Introduction}\label{sec:intro}
Text.
\section{Method}\label{sec:method}
See Section~\ref{sec:intro}.
\end{document}Both documents were compiled with pdfLaTeX from TeX Live 2023. The first produces the message, the second compiles without an error.
Finding the line in the editor
The editor lists every error and warning of a compile run with file and line. Select an entry and the cursor jumps to that line. See Error list with jump to the line.