problem with referring to the figure

  • Follow


Hello,

I do not know why but I am having a problem in referring to the figure in my 
article. Below is my code for the figure I include in the article. I labeled 
the figure as "screenshot". Then in the text, I refer to the figure by 
writing \ref{screenshot} . However, when I compile the file, a reference 
number like "1" does not appear but instead "??" appears. I also have tables 
in the article and their references work just fine.

What might be the problem?





\begin{figure}[p]\footnotesize
\label{fig:screenshot}
\caption{\footnotesize{Scenarios}}
\scalebox{0.85}{\includegraphics[angle=0]{screenshot.pdf}}
\end{figure}

0
Reply minimus 1/20/2011 8:50:36 PM

"minimus" <minimus@live.co.uk> wrote:

> I do not know why but I am having a problem in referring to the figure in my 
> article. Below is my code for the figure I include in the article. I labeled 
> the figure as "screenshot". Then in the text, I refer to the figure by 
> writing \ref{screenshot} . However, when I compile the file, a reference 
> number like "1" does not appear but instead "??" appears. I also have tables 
> in the article and their references work just fine.
> 
> What might be the problem?

> \begin{figure}[p]\footnotesize
> \label{fig:screenshot}
> \caption{\footnotesize{Scenarios}}

Use \label *after* or inside \caption (see LaTeX book, ...):

> \scalebox{0.85}{\includegraphics[angle=0]{screenshot.pdf}}

% simplified (see grfguide.pdf):
\includegraphics[scale=.85]{screenshot.pdf}

-- 
Heiko Oberdiek
0
Reply Heiko 1/20/2011 8:11:35 PM


On Jan 20, 8:50=A0pm, "minimus" <mini...@live.co.uk> wrote:
> Hello,
>
> I do not know why but I am having a problem in referring to the figure in=
 my
> article. Below is my code for the figure I include in the article. I labe=
led
> the figure as "screenshot". Then in the text, I refer to the figure by
> writing \ref{screenshot} . However, when I compile the file, a reference
> number like "1" does not appear but instead "??" appears. I also have tab=
les
> in the article and their references work just fine.
>
> What might be the problem?

It is not clear because your example doesn't show everything:-) First,
you need to compile twice before you get the reference in the output.
Second, could it be that you have to write \ref{fig:screenshot}?

> \begin{figure}[p]\footnotesize
> \label{fig:screenshot}
> \caption{\footnotesize{Scenarios}}
> \scalebox{0.85}{\includegraphics[angle=3D0]{screenshot.pdf}}
> \end{figure}

Regards,


Marc van Dongen
0
Reply Marc 1/20/2011 9:02:35 PM

Am 20.01.2011 21:50, schrieb minimus:
> 
> I do not know why but I am having a problem in referring to the figure
> in my article. Below is my code for the figure I include in the article.
> I labeled the figure as "screenshot". Then in the text, I refer to the
> figure by writing \ref{screenshot} . However, when I compile the file, a
> reference number like "1" does not appear but instead "??" appears. I
> also have tables in the article and their references work just fine.
> 
> What might be the problem?
> 
> \begin{figure}[p]\footnotesize
> \label{fig:screenshot}
> \caption{\footnotesize{Scenarios}}
> \scalebox{0.85}{\includegraphics[angle=0]{screenshot.pdf}}
> \end{figure}

put the \label _after_ the \caption command and run at least pdflatex twice.

Herbert
0
Reply Herbert 1/20/2011 9:07:10 PM

"Heiko Oberdiek"  wrote in message 
news:iha8h1$fep$1@news.eternal-september.org...

"minimus" <minimus@live.co.uk> wrote:

> I do not know why but I am having a problem in referring to the figure in 
> my
> article. Below is my code for the figure I include in the article. I 
> labeled
> the figure as "screenshot". Then in the text, I refer to the figure by
> writing \ref{screenshot} . However, when I compile the file, a reference
> number like "1" does not appear but instead "??" appears. I also have 
> tables
> in the article and their references work just fine.
>
> What might be the problem?

> \begin{figure}[p]\footnotesize
> \label{fig:screenshot}
> \caption{\footnotesize{Scenarios}}

Use \label *after* or inside \caption (see LaTeX book, ...):

> \scalebox{0.85}{\includegraphics[angle=0]{screenshot.pdf}}

% simplified (see grfguide.pdf):
\includegraphics[scale=.85]{screenshot.pdf}

-- 
Heiko Oberdiek

I have put the label after the caption command. Worked! Thanks a lot. It was 
my mistake. I don�t know how I could manage Latex if this group did not 
exist. Thank you so much.

0
Reply minimus 1/20/2011 10:47:31 PM

On Jan 20, 8:11=A0pm, Heiko Oberdiek <heiko.oberd...@googlemail.com>
wrote:
> "minimus" <mini...@live.co.uk> wrote:
> > \scalebox{0.85}{\includegraphics[angle=3D0]{screenshot.pdf}}
>
> % simplified (see grfguide.pdf):
> \includegraphics[scale=3D.85]{screenshot.pdf}
Because you mentioned that:

I recently discovered that:
\includegraphics[width=3DW,height=3DH]{image}

results in a TeX box with the exact dimension W x H, but:

\resizebox{W}{H}{\includegraphics{image}}

results in a TeX box with
width =3D (W / W_image) * W_image =3D ~W (i.e. W with rounding errors)
height =3D (H / H_image) * H_image  =3D ~H (i.e. H with rounding errors)
This is because it uses \scalebox internally, but \includegraphics
only simply set the box and lets the scaling be done by the output
driver.

The error tends to be quite below 0.5pt, but I wonder why \resizebox
does not enforce the correct dimensions.

Martin
0
Reply Martin 1/21/2011 1:46:43 PM

5 Replies
562 Views

(page loaded in 0.044 seconds)

Similiar Articles:













7/24/2012 1:59:07 AM


Reply: