Hello,
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.
Graphics, Figures & Tables ⇒ figure label not correct
NEW: TikZ book now 40% off at Amazon.com for a short time.
figure label not correct
1,1,2,3,5,8,13,21,34,55,89,144,233,...
-
- Posts: 32
- Joined: Sun Mar 01, 2009 8:29 am
Re: figure label not correct
Minimal example:
\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}
\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
Hi,
in float environments such as figure and table, the \label command should always go after the \caption command. Example:
Please notice that I used a black rectangle to simulate an actual figure and make the example compilable for everyone.
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}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
-
- Posts: 32
- Joined: Sun Mar 01, 2009 8:29 am
Re: figure label not correct
Just as gmedi's post.