collberg@dna.lth.se (Christian S. Collberg) (03/25/91)
The following document (capttest.tex): --------------------------------------------------------- \documentstyle{article} \begin{document} \section{First Section} \label{SectLab} \begin{figure} askjdfhaslkjf asdkfaskjd jsadfhlkj \caption{Blah blah in section \ref{SectLab} blah blah.} \end{figure} \end{document} --------------------------------------------------------- produces the following response when processed with LaTeX: ---------------------------------------------------------------------------- > latex capttest.tex This is TeX, C Version 3.0 (capttest.tex LaTeX Version 2.09 <7 Dec 1989> (/usr/local/lib/tex/inputs/article.sty Document Style `article' <16 Mar 88>. (/usr/local/lib/tex/inputs/art10.sty)) No file capttest.aux. LaTeX Warning: Reference `SectLab' on page 1 undefined. [1] (capttest.aux) LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. ) Output written on capttest.dvi (1 page, 444 bytes). Transcript written on capttest.log. > latex capttest.tex This is TeX, C Version 3.0 (capttest.tex LaTeX Version 2.09 <7 Dec 1989> (/usr/local/lib/tex/inputs/article.sty Document Style `article' <16 Mar 88>. (/usr/local/lib/tex/inputs/art10.sty)) (capttest.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.13 ... blah in section \ref{SectLab} blah blah.} ------------------------------------------------------------------------------- Can anyone explain this? I apologize in advance if the answer is obvious, has been answered a zillion times before, can be found on page xxx of the LaTeX manual, or is on the FAQ... Chris-- -------------------------------------------------------------------- Christian.Collberg@dna.lu.se
rekers@cwi.nl (Jan Rekers) (03/27/91)
Always put a \protect in front of a \ref in a \caption Jan Rekers (rekers@cwi.nl) Centrum voor Wiskunde en Informatica (CWI) P.O. Box 4079, 1009 AB Amsterdam, The Netherlands