General ⇒ \ref gives section number instead of figure or table number
\ref gives section number instead of figure or table number
Does anybody know why sometimes it happens that a \ref command produces a reference to the section number even if the corresponding \label is inserted in a table or figure environment?
This happens especially when I'm using the hyperref package, but I'm not sure if there's a connection. I'm using Miktex 2.4.1461.
Thank you,
Giangiacomo
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
- pumpkinegan
- Posts: 91
- Joined: Thu May 03, 2007 10:29 pm
\ref gives section number instead of figure or table number
\label
in the right part of the environment (whether it is equation, figure, or table).You have to ensure that
\label
comes last. For example:Code: Select all
\begin{table}
\centering
\begin{tabular}
\end{tabular}
\caption{Table caption.}
\label{tab:xxxx}
\end{table}
Code: Select all
\begin{figure}
\centering
\includegraphics{}
\caption{Figure caption.}
\label{fig:xxxx}
\end{figure}
- countbela666
- Posts: 64
- Joined: Thu Apr 26, 2007 2:44 pm
\ref gives section number instead of figure or table number
Regards
Marcel
a thousand worlds for you to see here, take my hand and follow me...