Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Ok so I'm trying to reference a couple of images from my document. The code is:

\begin{figure}[htp]
\centering
\includegraphics[scale=0.70]{grafico2.jpg}
\caption{Aceleramiento con las 4 primeras imágenes}
\label{grafico2}
\end{figure}

\begin{figure}[htp]
\centering
\includegraphics[scale=0.75]{grafico1.jpg}
\caption{Aceleramiento real del método}
\label{grafico1}
\end{figure}

In the text I'm referencing the images like this

\ref{figure:grafico2}
\ref{figure:grafico1}

But all I get is this ??. I tried putting the label after the caption and even inside the caption. I also tried recompiling the document several times with the Gummi compile option and even cleaning up build files before compiling but it doesn't work. The strange thing is that I'm referencing some tables before and they are working but not my figures. Any idea why?

share|improve this question
7  
Use \ref{grafico1}; the string used in the argument of \ref has to be the exact string used in \label, so if you say \label{grafico1} you have to use \ref{grafico1}. –  Gonzalo Medina Jul 12 '13 at 1:23
    
Off course this has nothing to do with the editor ! How can we convince users to try to compile on the command line to discriminate between a latex wrong coding like here and an editor problem? –  Jhor Jul 12 '13 at 8:58
1  
@Jhor: you don’t. if i want my wife to self-help on her widnoze machine using a command line, she simply can’t ... and she's quite a sophisticated user of windows. i would say there's essentially no chance of getting other “ordinary” users to drop down to the command line, so we need to find a way of wording answers in that context (says he, who almost never writes answers since every answerer here is cleverer than me...). –  wasteofspace Jul 12 '13 at 10:46
    
@wasteofspace: I tiotaly agree. My (former) wife is clearly like yours... –  Jhor Jul 12 '13 at 16:56

1 Answer 1

up vote 4 down vote accepted

You need to use \ref{grafico1}; the string used in the argument of \ref has to be the exact same string used in \label, so if you say \label{grafico1} you have to use \ref{grafico1}. Process the document twice to get the cross-reference number.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.