Graphics, Figures & Tables ⇒ figure label not correct
-
- Posts: 32
- Joined: Sun Mar 01, 2009 8:29 am
figure label not correct
I use \numberwithin{figure}{section} at the header. But later when I label and refer a figure (using \label{} and \ref{}). The number does not show up correctly.
For example, all figures in section 3 show up as 3 in the reference. What is the problem? Thank you.
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
figure label not correct
-
- Posts: 32
- Joined: Sun Mar 01, 2009 8:29 am
Re: figure label not correct
\documentclass[12pt]{amsart}
\usepackage{graphicx}
\numberwithin{figure}{section}
\begin{document}
\section{introduction}
\section{example}
Problem is here Fig.~\ref{fig:3}. But It should be 2.1
\begin{figure}[hbt]\label{fig:3}
\includegraphics[scale=0.5]{triTri}
\caption{$p$ is a vertex of $\O$.}
\end{figure}
\end{document}
figure label not correct
in float environments such as figure and table, the \label command should always go after the \caption command. Example:
Code: Select all
\documentclass[12pt]{amsart}
\numberwithin{figure}{section}
\begin{document}
\section{introduction}
\section{example}
Problem solved. Fig.~\ref{fig:3} produces the expected value.
\begin{figure}[!hbt]
\centering
\rule{5cm}{3cm}% just to simulate an actual figure
\caption{$p$ is a vertex of $\O$.}
\label{fig:3}
\end{figure}
\end{document}
-
- Posts: 32
- Joined: Sun Mar 01, 2009 8:29 am