Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

LaTeX: Reference Figure or Table

📅 2009-Nov-10 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

One of the cool features of LaTeX is that you could refer to figures or tables by their number automatically. If the original figure number changes, it is automatically updated in all locations it is referred to. To do this:

Label the figure or table:

\begin{figure}[ht]
\centering
\includegraphics[scale=1.0]{www.png}
\caption{The world wide web.}
\label{<strong>sec:www</strong>}
\end{figure}

Refer to the label:

The world wide web (as shown in Fig \ref{sec:www}) is a series of tubes.

If the original figure was numbered by LaTeX as Fig 2.1, then the above text will appear as:

The world wide web (as shown in Fig 2.1) is a series of tubes.