Saturday, June 18, 2011

Latex tip: Incorrect Figure Numbering

This might help reduce the amount of frustration when dealing with latex. Whenever you use figures, always put \caption before the \label.

\begin{figure}[htp]
  \centering
  \includegraphics{importante_figure.eps}
  \caption{This is the caption}
  \label{fig:imp-fig}
\end{figure}

If you reverse \label and \caption, there will be referencing problems. For example, depending on the section/subsection of the document the figure reference could say Fig. 2.4.1 instead of Fig. 2.3 since it will pick up the section numbers wrong!

No comments:

Post a Comment