Graphics, Figures & TablesFigure references all wrong

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
theo moore
Posts: 72
Joined: Thu Jan 15, 2009 3:16 pm

Figure references all wrong

Post by theo moore »

Can anybody figure out what's going on? Typically, you would create a figure like so,

Code: Select all

Code, edit and compile here:
\begin{figure}
\label{blah}
\end{figure}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Then call it afterwards, like,

Code: Select all

See \ref{blah}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
That's fine. I've never had a problem with that. Until now, that is. In my current (set of) documents, whenever I reference a figure label, instead of printing out the correct label, it's printing out the section number for which the figure is in!

I can't figure out what's wrong. Everything compiles well. The references to sections, subsections and equations work fine!

Any help?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
Keta
Posts: 63
Joined: Tue Nov 25, 2008 1:00 pm

Figure references all wrong

Post by Keta »

The problem there is that you must put the label after a caption, so the label can reference to the figure (it references to the caption, actually). See also here: http://www.latex-community.org/forum/vi ... php?t=3659

See if the following works:

Code: Select all

Code, edit and compile here:
\begin{figure}
Text, images\dots inside the figure
\caption{the caption}
\label{blah}
\end{figure}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
theo moore
Posts: 72
Joined: Thu Jan 15, 2009 3:16 pm

Figure references all wrong

Post by theo moore »

Keta wrote:The problem there is that you must put the label after a caption, so the label can reference to the figure (it references to the caption, actually).
I've been using LaTeX for something like 5 years now, but never knew that. That simply blows my mind. I always thought it was arbitrary -- how I ever avoided the problem until now is a mystery.
moameen
Posts: 2
Joined: Fri Jul 13, 2012 8:17 pm

Re: Figure references all wrong

Post by moameen »

I had the same problem and would have never figured that out!!!
thanh1985
Posts: 1
Joined: Sun Jan 20, 2013 4:22 am

Figure references all wrong

Post by thanh1985 »

I have some problem when I'm writing my thesis and paper. I try to arrange \label{} right after \caption{}, that means they are in a sequence. It worked for me. Try!
Last edited by cgnieder on Sun Jan 20, 2013 3:01 pm, edited 1 time in total.
sreenulatex
Posts: 1
Joined: Wed Sep 04, 2013 7:47 am

Re: Figure references all wrong

Post by sreenulatex »

I also faced the same problem. The label should be after the caption. After putting this, my problem is solved.
Post Reply