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:
Why does an environment's label have to appear after the caption?

Hello i am using a tikz with it's externalize library. I create figures with the following coding style:

  code code code..
\caption{Blah blah blah text.}

when i use \ref{fig:label} it does not display the correct number. Another notable and bizare havaviour is that the number is in the format e.g 5.2.1 and not 5.2 has anyone encountered this?

Also by trying to create a MWE i could not make the thing to even appear.. I am not trying to do complex stuff, just to say "in the figure x.x ..." anyways here is the not working ME:

\usepackage{tikz} %pgf-tikz pakcage




\draw[fill = blue,fill opacity = 0.3](0,2) rectangle (1.5,3.5);
\draw[fill = yellow,fill opacity = 0.3](0.5,2.5) rectangle (1,3);

\draw[->] (0.75,0.75) -- (0.75,2.75);

Hello \ref{fig:stuff} world
share|improve this question

marked as duplicate by lockstep, Torbjørn T., Gonzalo Medina, cmhughes, Stephan Lehmke Aug 31 '12 at 21:44

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.

Put \label after \caption. –  lockstep Aug 31 '12 at 21:20
That's it. I switched positions and it worked like a charm. Thanks a lot. –  msmechanized Aug 31 '12 at 21:36

1 Answer 1

up vote 3 down vote accepted

you should put figure label after caption

share|improve this answer

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