How do I ref a figure in LaTeX before it occurs?

Adam picture Adam · Oct 12, 2010 · Viewed 47.9k times · Source

I always like my figures to be placed in between text as opposed to the top or bottom of the page. I also like to talk about the figure before it is shown. So I am trying to have something like this:

By looking at Figure~\ref{fig:VCO} you can see that blah blah blah.

\begin{figure}[h]
\caption{VCO test circuit}\label{fig:VCO}
\begin{center}
\includegraphics[width=0.9\columnwidth]{figures/VCO_circuit.eps}
\end{center}
\end{figure}

This doesn't seem to work because it I guess it is referencing something that hasn't occurred yet? Does anyone have some simple solution? I am still very new to LaTeX.

Answer

John Smith picture John Smith · Oct 12, 2010

Generally LaTeX needs at least two passes to resolve all its references, the first time to write them to an auxiliary file and the second time to put them into the final ps/pdf/dvi file. So it does not matter where the reference is.

A third pass will be needed, for example, if your document has a long table-of-contents which will screw up page numbers.