Below is some source code for a short/brief document. When I compile the short document document only once, the source code \ref{figure:FORMULA:anatomy} becomes ?? in the pdf. If I run PDFLaTeX a second time, the .aux files etc... get updated and the figure reference becomes 1.1.
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\section{Yellow}
\subsection{Submarines}
blah blah \ref{figure:FORMULA:anatomy}.
\begin{figure}[htpb] \label{figure:FORMULA:anatomy}
\centering
\fbox{
\begin{minipage}{\linewidth}
\includegraphics[width=\linewidth]{FORMULA_anatomy}
\caption{I'm a caption}
\end{minipage}
}% end fbox
\end{figure}
\clearpage
\end{document}
I have a different document which after running through PDFLaTeX a dozen times still has the figure references showing as ??. How can I get the figure references to render properly? Its very long document, so I will provide a link to the source code rather than pasting in the body of this question.
\labelafter the\caption. – Phelype Oleinik Jan 30 '19 at 17:45