Tell me more ×
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?

I'm having a problem with referencing figures in LaTeX. I have the following text:

\begin{figure}[H]
\center
\label{fig:enn1015}
\includegraphics[scale=0.40]{imagens/outputs/ENN_10_15.eps}
\caption{ENN unbalanced 10\%}
\end{figure}

The figure \ref{fig:enn1015} (...)

For some reason, the figure caption is:

Figure 3.5 Enn unbalanced 10%

But the text is:

The figure 3.2.1 (...)

Instead of:

The figure 3.5

It is printing the chapter.section.subsection the figure is in, and not the figure. Can anybody help me?

share|improve this question
Welcome to TeX.sx Dayvid! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. – Werner Dec 7 '11 at 15:17

migrated from stackoverflow.com Dec 7 '11 at 15:08

marked as duplicate by Werner, Torbjørn T., lockstep, Joseph Wright Dec 9 '11 at 10:08

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 7 down vote accepted

Try putting your \label{} statement immediately after your \caption{} statement.

Edit: I'm not a total expert on how the \label command words, but I think it assigns a label to the last-seen "labelable" thing, so you want it right after your caption, which is "labelable" (my terminology). Currently, it is labeling whatever the last labelable thing was before your figure, probably a section heading or something (hence the 3.2.1).

2nd Edit: In other words, and maybe this is kind of counter-intuitive, you can't label figures; you must label captions.

share|improve this answer
It works, thank u! – Dayvid Victor Dec 7 '11 at 14:58

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