## From: http://www.terminally-incoherent.com/blog/2007/04/14/latex-fixing-wrong-figure-numbers/

ONE SENTENCE: PUT THE LABEL COMMAND AFTER CAPTION COMMAND FOR FIGURES.

## What I tell you right now may save you hours of extensive debugging, cursing under your breath, commenting out custom code dealing with figure layout and much frustration. Whenever you use figures, always (and I mean ALWAYS EVER FOREVER ALWAYS) put \caption first, and \labelsecond like this:

 \begin{figure}[htp] \centering \includegraphics{image.eps} \caption{Some Image} \label{fig:some-image} \end{figure}

If you put the \label above \caption you will run into trouble when referencing figures inside subsections. In my case, the caption underneath the figure would say Fig. 4.2 but the output of \ref would be 4.3.10 because somehow it was picking up the section numbers wrong. The whole damn chapter 4 had the caption/label pairs flipped – but the rest of the document was fine. I have no clue what possessed me to write it this way.