Showing posts with label figures. Show all posts
Showing posts with label figures. Show all posts

Tuesday, February 26, 2008

LaTex: Fixing Wrong Figure Numbers

LaTex: Fixing Wrong Figure Numbers

The post is copied from: Terminally Incoherent


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 \label second 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.

I had to submit the document today n all chapters except chapter 1 had \label above \caption n i was so *&^*&%^&$%* but i found on google search a blog Terminally Incoherent. It helped me n i m really thankful to the owner of the blog.

Blogged with Flock