1

I had a problem in referencing figures, which now I solved, thanks to an old answer by Werner.

To be precise, in my case the reference was working properly (the hyperlink was pointing to the correct figure), but I couldn't manage to substitute the double question mark with the correct figure number.

Why does the relative placement of \label and \caption matter, shouldn't the double compilation of the LaTeX code suffice? Is there a technical reason for this behaviour?
I noticed that it occurs only when compiling with pdfLaTeX, not with LaTeX.

Thanks in advance!

  • 2
    The behaviour is same in latex and pdflatex. \label labels "the current referencable value" and that is set typically by headings and captions. If you use \label before \caption it is not an error, it is just that at that point the current referencable value is typically the section counter – David Carlisle Oct 30 '13 at 11:47
  • 1
    Think of it like a stack of referencable pointers and every \chapter, \caption, etc. commands pushes new pointer and every \end{<float>} rejects all \caption pointers. The \label command then reads and stores value of pointer that is, at this time, on top of this stack no matter what happens afterwards. – Crowley Oct 30 '13 at 12:38
  • Thanks for your comments and sorry for the duplicate question! (Incidentally, I was already using the Search function: that's how I found the question I linked above!) – Andrea Orta Oct 31 '13 at 09:11

0 Answers0