Graphics, Figures & TablesWeird figure numbering

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
episanty
Posts: 26
Joined: Tue Mar 24, 2009 2:24 am

Weird figure numbering

Post by episanty »

Hi!

Does anyone know of any reason why the following:

Code: Select all

\begin{figure}[htbp]
	\centering
		\includegraphics[width=1.00\textwidth]{p32.jpg}
	\caption{Arreglo experimental para el caso de objeto e imagen reales}
	\label{orir}
\end{figure}
and

Code: Select all

\begin{figure}[htbp]
	\centering
		\includegraphics[width=1.00\textwidth]{p32.jpg}
	\label{orir}\caption{Arreglo experimental para el caso de objeto e imagen reales}
\end{figure}
should give different results? the order of \label and \caption seems to mess with Latex's inner workings. When called by \ref{orir}, the first one says Figure 3 like I need it to, but the second one gives Figure 4.2.2 (the section it's in).

Does anyone know what's going on here? thanks...

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Weird figure numbering

Post by gmedina »

Hi,

inside the figure and table environments, the \caption command generates the reference string to be used with the \label command. To prevent undesired results, always use the \label command after the \caption command; otherwise, \label might pick the wrong reference string (typically, that of the current section).
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply