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?

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

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

This question came from our site for professional and enthusiast programmers.

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 1

up vote 12 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 works, 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.