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:

\caption{ENN unbalanced 10\%}

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?


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.

  • 3
    If I want to label a figure, but I don't want to include a caption, how can I create an empty caption that takes no space to use with a label? Nov 9 '20 at 3:28

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