LaTeX: referencing figures within enumerate environment

  • LaTeX
  • Thread starter arboretum
  • Start date
  • Tags
    Latex
Put the label inside the caption argument:\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)\f
  • #1
3
0
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:
\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}
    \caption{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}

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
Hi arboretum,

Put the label inside the caption argument:

Code:
\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}
 

Suggested for: LaTeX: referencing figures within enumerate environment

Replies
4
Views
491
Replies
1
Views
64
Replies
7
Views
726
Replies
1
Views
577
Replies
2
Views
332
Replies
8
Views
801
Replies
1
Views
1K
Replies
3
Views
586
Replies
10
Views
1K
Replies
4
Views
511
Back
Top