# Figure labels in text changing as figure caption changes [duplicate]

I have a question regarding referencing figures in the text. Say I have a figure in text with the caption Figure 1: Blah Blah. Then in my main text i refer to this figure saying something like "As you can see from Figure 1 etc...".

Then I realise I've forgotten to add a figure prior to this one and I insert a new figure earlier in the section which becomes figure 1, thus causing the old figure 1 to become figure 2. I'm assuming my in text reference earlier of "As you can see from figure 1 etc..." will not have changed to "As you can see from figure 2 etc...". Am i right in assuming this?

Is there a way of working around this? I have a lot of figures in my document in a number of sections and at present my in text references just say "Figure XXXXXXXX" serving as a reminder to go fill them in at the end. However it would be good if I could do this sooner. Is there a way to ensure these change or do I just have to do it manually if I add figures in earlier sections of the text?

• Do you have ever heard of \ref{mysophisticatedfigurelabel} at all? ;-) An example would help – user31729 Sep 4 '14 at 10:17
• Look for \label and \ref macros in any guide for beginners. They work pretty well ;) – Claudio Fiandrino Sep 4 '14 at 10:19

Place a \label{...} with a unique label name after each caption and refer to this figure with \ref{...}, using the same label name:

# Example

\caption{Bla bla}\label{myblablafigure}

In figure \ref{myblablafigure} you will see...


\documentclass[paper=a4,12pt]{scrbook}

\usepackage{blindtext}%
\usepackage[demo]{graphicx}
\begin{document}

\chapter{First}

In \ref{myfigure::dummy} you can see

whereas in \ref{myfigure::otherone} you will see that...

\section{First}

\begin{figure}
\begin{center}
\includegraphics{somefig}
\caption{Dummy figure}\label{myfigure::dummy}
\end{center}
\end{figure}

\blindtext

\begin{figure}
\begin{center}
\includegraphics{otherfig}

\caption{Other Dummy figure}\label{myfigure::otherone}
\end{center}
\end{figure}

\end{document}