\label position for figures and tables

I learned this after wasting few minutes on why auto-numbering in hyperlinks to figures and tables happened incorrectly.

The \label{} MUST always come after \caption{} of a table/figure.

The reason is that the \label command points to an entity like \caption or \section or \subsection or something similar preceding it.

So if \section{Section A} is before \label{fig:A} and \caption{Figure A} is after the \label command, using \ref{fig:A} will point to the location of \label but will show the section number associated with \section{Section A}.

On the other hand, if \caption{Figure A} is before \label{fig:A}, using \ref{fig:A} will point to the location of \label and show the figure number associated with the figure with \caption{Figure A}.

INCORRECT:

\begin{figure}[h!]
\centering
\includegraphics[width=1.0\textwidth]{phy/lplpf}
\label{fig:phy:lplpf}
\caption{LP low-pass filter I/O}
\end{figure}

CORRECT:

\begin{figure}[h!]
\centering
\includegraphics[width=1.0\textwidth]{phy/lplpf}
\caption{LP low-pass filter I/O}
\label{fig:phy:lplpf}
\end{figure}

There are no comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.