hucka@engin.umich.edu (Michael Hucka) (01/09/91)
Is it possible to put a \cite command in a \caption? LaTeX is giving me an error when I try it, and I cannot seem to find an answer in either the LaTeX manual or the list of frequently asked questions posted monthly to this group. Basically I need to put a bibliographic reference in a figure's caption, say like this: \begin{Figure}{htb} \centerline{\epsfbox{fig_cpu_flow.ps}} \caption{From \cite{Hayes88}, the typical cycle for a serial CPU.} but LaTeX seems to complain about the extra braces: ! 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.459 ...e typical cycle for a single serial CPU.} Pardon me if this has an elementary solution. Mike -- Mike Hucka | Internet: hucka@caen.engin.umich.edu University of Michigan AI Lab | 1101 Beal Ave., Ann Arbor, MI 48109
wilson@coulomb.cerc.utexas.edu (Linda Wilson) (01/09/91)
To use a \cite in a \caption, try putting \protect in front of \cite. I ran into similar problems when I tried to use \ref in a \chapter heading. The following finally worked: \chapter{A Proof of Theorem \protect{\ref{mytheorem}}} In general, \protect often helps when using one command inside another one. I hope this helps. Linda Wilson wilson@cerc.utexas.edu
eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) (01/10/91)
hucka@engin.umich.edu (Michael Hucka) writes: > \caption{From \cite{Hayes88}, the typical cycle for a serial CPU.} >Pardon me if this has an elementary solution. You're pardonned, therefore (?) there is an elementary solution: \protect. Insert that before \cite. If (and when) you read the LaTeX book you'll find a lot of confusing remarks about fragile commands and \protect-ing them. This in completely ununderstandable if you don't know a lot more about the inside of TeX. Just remember that insrting \protect occasionally helps. Victor.
marcel@cs.caltech.edu (Marcel van der Goot) (01/10/91)
In <HUCKA.91Jan9014636@harrier.engin.umich.edu> Michael Hucka (hucka@engin.umich.edu) writes: > Is it possible to put a \cite command in a \caption? LaTeX is giving me an > error when I try it, and I cannot seem to find an answer in either the LaTeX > manual or the list of frequently asked questions posted monthly to this > group. Amazing. Let's see. I take my office-mate's LaTeX manual (I never use LaTeX myself), and look up ``\caption'' in the index: p. 59, ... Ok, p. 59: The caption on a figure or table is made with a \caption command having the caption's text as its arguments. This is a moving argument, so fragile commands must be \protect'ed (see Section 2.2.3). Now let's look up \cite: p. 73, 188 p. 73: looks complicated, let's try the other first. p. 188: \cite[text]{key_list} The key_list argument ... ... If present, text is added as a remark to the citation. Fragile. I know, this newsgroup is for beginning as well as for experienced users, and the TeX and LaTeX manuals are not the most readable books around (by necessity), but one could still make at least the most elementary attempt to figure things out oneself --- we've had postings about Reading The Fine Manual before. Marcel van der Goot marcel@vlsi.cs.caltech.edu