Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
Where to put the \label on a figure environment?

My question is rather simple. I have noticed that when I use \label like this

\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{Leslie_Lamport}
\label{fig:LL}
\caption{Leslie Lamport}
\end{figure}

and then refer to this label it refers rather to the section number than to the figure (I've seen it been refered as section.figurenumber but that was due to a package I believe - possibly hyperref). But when using it after the caption

\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{Leslie_Lamport}
\caption{Leslie Lamport}
\label{fig:LL}
\end{figure}

it really refers to the figure number.

Can someone explain the mechanic behind \label to me?

share|improve this question
add comment

marked as duplicate by David Carlisle, qubyte, tohecz, Ian Thompson, Philipp Mar 22 '12 at 11:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 1 down vote accepted

Use the \label{fig:LL} inside the \caption{} tag.

\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{Leslie_Lamport}
\caption{Leslie Lamport\label{fig:LL}}
\end{figure}
share|improve this answer
    
Why, just place it after \caption –  daleif Mar 22 '12 at 12:10
add comment

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