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.

I have an article with the following figure (there are 2 small charts near each other, horizontally):

\begin{figure}[h]
  \centering
  \includegraphics{left-graph}
  \includegraphics{right-graph}
  \caption{My caption}\label{mylabel}
\end{figure}

I reference the figure with:

Figure~\ref{fig:result} shows bla-bla-bla.

The rendered PDF shows ?? instead of the figure number. I tried with the reference occurring both before and after the figure (in the LaTeX source), but it didn't make a difference.

The relevant packages I'm using are below (those removed are for titling).

\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage[letterpaper]{geometry}
\geometry{top=1.0in, bottom=1.0in, left=1.5in, right=1.0in}
\usepackage{flafter} % make sure figures do not appear before their text
\usepackage{sidecap} % use side captions for floats
\usepackage{subfig} % subfloats

I'm not sure what's wrong here, advice is appreciated. I'm using MiKTeX 2.8.

Thank you!

share|improve this question
3  
Allowing only [h] is not much. I would add some options resulting in [htp] for instance. See texblog.net/help/latex/figure.html for reference. –  Stefan Kottwitz Aug 17 '10 at 14:18

2 Answers 2

up vote 12 down vote accepted

Your labels don't match. Change the reference to \ref{mylabel} or the label to label{fig:result}

share|improve this answer
    
Thanks, I had misinterpreted the meaning of the reference expression (I thought it was "show the current figure counter result"). –  wishihadabettername Aug 17 '10 at 14:32

Besides the mistake noted by Lev Bishop (assuming that you just did some incomplete editing for this post, and in reality the labels match), it is possible that you did not run latex enough times. For the labels to work out you need to run it at least twice.

share|improve this answer
    
The labels were not matching (see my comment to Lev's answer), but you get a vote for reminding me about running twice. –  wishihadabettername Aug 17 '10 at 19:11

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.