[texhax] problem with \ref

Steve Schwartz s.schwartz at imperial.ac.uk
Mon Jan 22 22:31:48 CET 2007


>From http://www.tex.ac.uk/cgi-bin/texfaq2html?label=crossref and any
decent latex manual:

"Sometimes, however many times you run LaTeX, the cross-references are
just wrong. Remember that the \label command must come after the
\caption command, or be part of it."

It's the \caption that increments the figure number. I suppose if you
really didn't want the figure to have a caption you could manually
increment the figure counter. But without a caption your cross-reference
to a figure by number is pretty meaningless.

Or have I missed something? Perhaps you've been partaking too personally
in the subject of your text?!



On Mon, 2007-01-22 at 15:56 -0500, Peter Flom wrote:
> This has got to have a simple solution.....but
> I have
> <<<<<
> To aid in the interpretation, figures \ref{F:predval} and
> \ref{F:logpredval} show predicted values from several models for
> various representative people: Ages 23, 29, and 39 (the 25th, 50th,
> and 75th percentiles), male and female, and at the three levels of
> drug use. In the first figure, we see that by far the highest
> predicted risk is for female IDUs.  We also see that age makes
> little difference, but appears to be slightly higher in the middle
> of the age range.
> \begin{figure} \label{F:predval}
>  \includegraphics{predval.pdf}
> \end{figure}
> Figure \ref{F:logpredval} shows some different aspects of the
> predicted values.  Here, it is easy to see that, for people who use
> either marijuana or no drugs, sex makes very little difference in
> number of partners; for users of other non-injected drugs it makes a
> moderate difference, and for drug injectors it makes a very large
> difference.
> \begin{figure} \label{F:logpredval}
>  \includegraphics{logpredval.pdf}
> \end{figure}
> >>>>>
> The two figures print with the same label, i.e.
> it prints out 
> To aid in the interpretation, figures 2 and 2.....
> (there is one earlier figure)
> the two figures print as they should.....that is, they are different
> figures.
> Has me baffled......
> TIA as always
> Peter
> Peter L. Flom, PhD
> Assistant Director, Statistics and Data Analysis Core
> Center for Drug Use and HIV Research
> National Development and Research Institutes
> 71 W. 23rd St
> http://cduhr.ndri.org
> www.peterflom.com
> New York, NY 10010
> (212) 845-4485 (voice)
> (917) 438-0894 (fax)
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org
Professor Steven J Schwartz      Phone: +44-(0)20-7594-7660
Space and Atmospheric Physics    Fax:   +44-(0)20-7594-7772
The Blackett Laboratory          E-mail: s.schwartz at imperial.ac.uk
Imperial College London          Office: Huxley 6M70 
London SW7 2BW, U.K.             Web: http://www.sp.ph.ic.ac.uk/~sjs

More information about the texhax mailing list