\
caption
command, the \
label
command must appear
after the \
caption
command, or be part of it. For example:
\begin{figure} <the illustration itself> \caption{My figure} \label{myfig} \end{figure}
is correct, as is
\begin{figure} <the illustration itself> \caption{My figure% \label{myfig}} \end{figure}
whereas, in
\begin{figure} <the illustration itself> \label{myfig} \caption{My figure} \end{figure}
the label will report the previous figure’s number, etc.
You can, with the same malign effect, shield the\
caption
command
from its associated \
label
command, by enclosing the caption in an
environment of its own. This effect will be seen with:
\begin{figure} <the illustration itself> \caption{A Figure} \end{figure} \label{myfig}
where the \
label
definitely is after the \
caption
,
but because the figure
environment closed early, the
\
label
can’t ‘see’ the \
caption
.
\
label
must be after the command that
defines it (e.g., \
caption
), and if the \
caption
is inside
an environment, the \
label
must be in there too.
This answer last edited: 2011-03-09
This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=crossref