LaTeX: referencing figures within enumerate environment

1. Jun 3, 2008

arboretum

I've not been able to find any sort of answer to this using google, but perhaps it's because the searches I've used have not been specific enough, so I apologize for bringing it up if this is answered on every LaTeX-oriented website. In any case, here's my setup:

Code (Text):
\begin{enumerate}
\item (first item---blah blah blah)

\item (second item---blah blah blah)
...
...
...
\item (tenth item---blah blah blah)
% this is the first figure in the file
\begin{figure}[!h]
\includegraphics{yourmomlookslikeacow.eps}
\label{fig:momcow}
\end{figure}

\item (eleventh item---blah blah blah)

\item (twelfth item) As we can see in Figure~\ref{fig:momcow}, your
mother looks like a cow.
\end{enumerate}
What will happen is that yourmomlookslikeacow.eps will be the first figure in the file and will have a caption that says "Figure 1: Your mother resembles a bovine" as it should, but when I reference the figure in item #12, it will say "As we can see in Figure 10, your mother looks like a cow." For some reason, the label seems to associate itself with the value of the enumi counter at item #10 instead of the figure counter at figure #1. Even if I wanted to have something like "See Figure 10.1" by using \numberwithin{figure}{enumi}, all that would happen is that my caption would be modified properly, but my reference would still say "Figure 10."

I think one way of fixing this would be to end the enumerate environment, place in the code for the figure, then restart the enumerate environment at the appropriate number, but that seems clunkier and less good-programmingly good than simply writing "Figure~1" in my code when I want Figure 1. I'd really appreciate your help, and I want to point out that I don't have any beef with your mother, I just don't feel like using foo and bar.

2. Jun 4, 2008

alphysicist

Hi arboretum,

Put the label inside the caption argument:

Code (Text):

\begin{enumerate}
\item (first item---blah blah blah)

\item (second item---blah blah blah)
...
...
...
\item (tenth item---blah blah blah)
% this is the first figure in the file
\begin{figure}[!h]
\includegraphics{yourmomlookslikeacow.eps}
\caption{\label{fig:momcow} Your mother resembles a bovine}
\end{figure}

\item (eleventh item---blah blah blah)

\item (twelfth item) As we can see in Figure~\ref{fig:momcow}, your
mother looks like a cow.
\end{enumerate}