LaTeX forum ⇒ Graphics, Figures & TablesFigure references all wrong Topic is solved

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

Figure references all wrong

Postby theo moore » Mon Jan 26, 2009 2:55 pm

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

  1. \begin{figure}
  2. \label{blah}
  3. \end{figure}


Then call it afterwards, like,

  1. See \ref{blah}


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?

Tags:

Keta
Posts: 63
Joined: Tue Nov 25, 2008 1:00 pm

Postby Keta » Mon Jan 26, 2009 4:25 pm

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/viewtopic.php?t=3659

See if the following works:
  1. \begin{figure}
  2. Text, images\dots inside the figure
  3. \caption{the caption}
  4. \label{blah}
  5. \end{figure}

theo moore
Posts: 72
Joined: Thu Jan 15, 2009 3:16 pm

Postby theo moore » Mon Jan 26, 2009 4:34 pm

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

Postby moameen » Thu Aug 02, 2012 8:52 am

I had the same problem and would have never figured that out!!!

thanh1985
Posts: 1
Joined: Sun Jan 20, 2013 4:22 am

Postby thanh1985 » Sun Jan 20, 2013 4:27 am

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.
Reason: added inline code markup

sreenulatex
Posts: 1
Joined: Wed Sep 04, 2013 7:47 am

Postby sreenulatex » Wed Sep 04, 2013 7:50 am

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


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 9 guests