2

I have used \label{rt} command 7 times in my manuscript for seven figures. It is showing a warning message of "LaTeX warning: Label '{rt}' multiply defined". How to remove the warning?

  • 8
    You should not use the same label for many figures. It will confuse latex when you refer. Use different labels. Let labels be intuitive so that you will know which label is for which figure. Something like \label{fig:laser-schematic}. – user11232 Aug 1 '13 at 4:58
  • Welcome. You may wish to have a look at meta.tex.stackexchange.com/q/1436 to familiarize yourself further with our format. – user11232 Aug 1 '13 at 5:31
3

\labels are meant to provide identifiers, that can be then referred to via commands such as \ref. After compilation (usually twice), latex replaces the \ref by a printed representation of the value of the counter captured by \label. As \ref can be used anywhere within the document, each identifier should be unique. Latex thus warns if the same identifier is defined twice.

A good scheme for generating identifiers is to use some abbreviation for the type of thing being labelled followed some memorable word or two that will remind you of what you are labelling. E.g. as Harish Kumar suggests above you might use

 \label{fig:laser-schematic}

for a label on a figure providing a schematic representation of a laser. You would then refer to this via \ref{fig:laser-schematic}.

Sample output

\documentclass{article}

\begin{document}

\begin{figure}[htp]
  \centering
  \rule{2cm}{2cm}
  \caption{Schematic view of laser}
  \label{fig:laser-schematic}
\end{figure}

Some text.

In Figure~\ref{fig:laser-schematic} we see a schematic representation
of the laser.

Some text.
\end{document}
  • Andrew Swann gives a nice clear description, but I'd like to add a bit. Make your labels descriptive. label{fig:laser-schematic} is much more meaningful when you come back to the document later than e.g. \label{ls} or even \label{f_ls}. And don't even think about (I've seen this in the wild) using \label{fig1}, \label{fig2}... It leads to utter nonsense when you rearrange. – Chris H Aug 2 '13 at 13:11

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.