Resources‎ > ‎LaTeX‎ > ‎

Using \label and \ref

You can use LaTeX to create references within your document.
Define a label for a figure like so:

\begin{figure}[h]
\includegraphics[width=1.0\linewidth]{figures/foo.png}
\label{fig:foo}
\end{figure}

The label name can be arbitrary chosen, a convention used here prefixes with fig: (for tables use tbl:),  this can be helpful for larger documents.
Referencing this figure can be done before or after its placement, use \ref{fig:foo} in the text you wish to reference from.  The label/ref system is neat because you can add more figures without having to adjust or re-define their reference numbers (or even count them).

Important note

Note that it is very important that the \label follows \caption, otherwise you won't obtain the correct result and you may wonder why your feedback wasn't as positive from that last paper thesis you wrote.

You can do the following to make sure that \label follows \caption: