porphano@hobbes.sfc.lehigh.edu (Paul A. Orphanos) (11/01/90)
I have a user at our site who is trying to reference an equation as part of a figure caption. The equation is tagged normally, but when it is referred to in the caption, LaTeX gives an error message saying that there's a missing } in the \caption, along with a flurry of messages following. Any of you out there who have written theses or papers probably has used a reference in a figure caption, and might have seen this before. Below is a little sample file that does'nt work on either our Sparc, or Vax version of LaTeX. \documentstyle[12pt]{article} \begin{document} \section{The Extraction Technique}{\ } \begin{equation} id=id \label{idovergm} \end{equation} \begin{figure}[h] \caption{Equation~\ref{idovergm} } \label{idgmvsvgvth} \end{figure} \end{document} It's really simple, and should work. But it does'nt. Any help is greatly appreciated. Thanks Alot, Paul Orphanos ------------------------------------------------------------------------------ Paul A. Orphanos Internet: porphano@hobbes.sfc.lehigh.edu Microelectronics Laboratory Bitnet: pao0@lehigh.bitnet Lehigh University Bethlehem, Pa. -- ------------------------------------------------------------------------------ Paul A. Orphanos Internet: porphano@hobbes.sfc.lehigh.edu Microelectronics Laboratory Bitnet: pao0@lehigh.bitnet Lehigh University
schmidt@cantor.informatik.uni-dortmund.de (Martin Schmidt) (11/04/90)
You should protect the \ref-command as follows: \documentstyle[12pt]{article} \begin{document} \section{The Extraction Technique}{\ } \begin{equation} id=id \label{idovergm} \end{equation} \begin{figure}[h] \caption{Equation~\protect{\ref{idovergm}}} <<< This line changed \label{idgmvsvgvth} \end{figure} \end{document} Martin Schmidt
gampell@hpcc01.HP.COM (David J. Gampell) (11/05/90)
The \ref command must be \protect'ed since it is fragile. See pages 59 and 187 of the LaTeX book. Dave Gampell dave@hpoclpa.hp.com
eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) (11/05/90)
porphano@hobbes.sfc.lehigh.edu (Paul A. Orphanos) writes: >I have a user at our site who is trying to reference an equation as >part of a figure caption. The equation is tagged normally, but when it >is referred to in the caption, LaTeX gives an error message saying >\begin{figure}[h] >\caption{Equation~\ref{idovergm} } >\label{idgmvsvgvth} >\end{figure} Should I say RTFM? On page 59 of the LaTeX book it says about the argument of a \caption command: ``This is a moving argument, so fragile commands must be \protect-ed'' And just what is the fragile command here? On page 72 it says: ``The \ref and \pageref commands are fragile'' I mean, there is a good book about LateX, so if the combination of two commands goes wrong, you look both of them up in it, right? You're welcome... Victor.
clement@opus.cs.mcgill.ca (Clement Pellerin) (11/06/90)
In article <1990Nov4.203542.18675@csrd.uiuc.edu> (Victor Eijkhout) writes: >Should I say RTFM? On page 59 of the LaTeX book it says about >the argument of a \caption command: >``This is a moving argument, so fragile commands must be \protect-ed'' >And just what is the fragile command here? On page 72 it says: >``The \ref and \pageref commands are fragile'' >I mean, there is a good book about LateX, so if the combination >of two commands goes wrong, you look both of them up in it, right? If people put as much energy in fixing \protect as they put in explaining it, we would have got rid of it ages ago. Even if you RTFM, you cannot understand what are fragile commands in moving arguments until you know quite a lot of TeX internal workings. Fortunately, the implementors of latex 2.10 are trying to remove it. -- news <clement Clement Pellerin, McGill University, Montreal, Canada clement@cs.mcgill.ca
eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) (11/06/90)
clement@opus.cs.mcgill.ca (Clement Pellerin) writes: >If people put as much energy in fixing \protect as they put >in explaining it, we would have got rid of it ages ago. >Even if you RTFM, you cannot understand what are fragile >commands in moving arguments until you know quite a lot >of TeX internal workings. >Fortunately, the implementors of latex 2.10 are trying to remove it. With the emphasis on trying! No definite solution has been reached yet. There are a number of ways of going about the problem, but none of them is easy, and it is not even certain if any is failsafe. LL was not taking an easy way out when he added \protect to LaTeX. V.
grabiner@zariski.harvard.edu (David Grabiner) (11/08/90)
In article <2419@opus.cs.mcgill.ca> clement@opus.cs.mcgill.ca (Clement Pellerin) writes: >If people put as much energy in fixing \protect as they put >in explaining it, we would have got rid of it ages ago. >Even if you RTFM, you cannot understand what are fragile >commands in moving arguments until you know quite a lot >of TeX internal workings. The LaTeX manual itself doesn't seem to have things completely straight. Page 27: \\ is fragile. Page 62: The argument of the letter environment is a moving argument. Page 63: uses un-\protected \\ in the sample letter, without any comment. I haven't had any problems with un-\protected \\ in my letters, but I don't know whether I will have problems in some situation that hasn't happened yet. -- David Grabiner, grabiner@zariski.harvard.edu "We are sorry, but the number you have dialed is imaginary." "Please rotate your phone 90 degrees and try again." Disclaimer: I speak for no one and no one speaks for me...