🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.tex
Article #10072

LaTeX question: \ref in \caption

#10072
From: Marcus Clemente
Date: Mon, 03 Jun 1991 15:03
86 lines
3136 bytes
Hello,

I want to refer to a figure in the caption of another figure. LaTeX runs fine
on the first run, but crashes the second run. Is there any LaTeX specialist
being able to tell me how to do it?

Following is a sample code as well as the output of TeX:

%%%%%%%%%%%%  try.tex %%%%%%%%%%%

\documentstyle{article}
\begin{document}

Here is the first figure

\begin{figure}[htp]
an example
\caption{example}
\label{example}
\end{figure}

and this is the second figure with the reference

\begin{figure}[htp]
another example
\caption{another example of figure \ref{example}}
\label{another}
\end{figure}

\end{document}


%%%%%%%%%%% TeX run %%%%%%%%%%%

europa1( ~/tmp ) 8 -> latex try.tex
This is TeX, C Version 2.95 (no format preloaded)
(try.tex
LaTeX Version 2.09 <4 Aug 1988>
(/usr/local/lib/tex/inputs/article.sty
Document Style `article' <16 Mar 88>.
(/usr/local/lib/tex/inputs/art10.sty))
No file try.aux.
LaTeX Warning: Reference `example' on page 1 undefined.
[1] (try.aux)
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
Output written on try.dvi (1 page, 496 bytes).
Transcript written on try.log.
europa1( ~/tmp ) 9 -> latex try.tex
This is TeX, C Version 2.95 (no format preloaded)
(try.tex
LaTeX Version 2.09 <4 Aug 1988>
(/usr/local/lib/tex/inputs/article.sty
Document Style `article' <16 Mar 88>.
(/usr/local/lib/tex/inputs/art10.sty)) (try.aux)
! Argument of \@caption has an extra }.
<inserted text>
                \par
<to be read again>
                   }
\addcontentsline ...\protect \contentsline {#2}{#3
                                                  }{\the \@temptokena }}}}\@...

\@caption ... the#1\endcsname }{\ignorespaces #2}}
                                                  \begingroup \@parboxrestor...
l.19 ...n{another example of figure \ref{example}}

? h
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

?

--
Marcus Clemente                          Internet: marcus@ecrc.de
ECRC GmbH     
Arabella Str. 17
D 8000 Munich 81                         Tel.:  +49/089/92699-109
Germany 

------------------------------------------------------------------
The difference between practice and theory in practice is always
greater than the difference between practice and theory in theory.
Technical Details
Message-ID: <1991Jun3.150330.21344@ecrc.de>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!caen!ox.com!math.fu-berlin.de!unido!ecrc!ecrc!marcus
References: <22457@paperboy.OSF.ORG>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!caen!ox.com!math.fu-berlin.de!unido!ecrc!ecrc!marcus
From: marcus@ecrc.de (Marcus Clemente)
Newsgroups: comp.text.tex
Subject: LaTeX question: \ref in \caption
Keywords: figure caption reference
Message-ID: <1991Jun3.150330.21344@ecrc.de>
Date: 3 Jun 91 15:03:30 GMT
References: <22457@paperboy.OSF.ORG>
Sender: news@ecrc.de
Reply-To: marcus@ecrc.de (Marcus Clemente)
Organization: ecrc
Lines: 86