LaTeX gets cross-references wrong

Sometimes, however many times you run LaTeX, the cross-references are just wrong. Remember that the \label command must come after the \caption command, or be part of it. For example,

\begin{figure}          \begin{figure}
\caption{A Figure}  or  \caption{A Figure%
\label{fig}                   \label{fig}}
\end{figure}            \end{figure}