Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!jarthur!sif.claremont.edu From: dhosek@sif.claremont.edu (Hosek, Donald A.) Newsgroups: comp.text.tex Subject: Re: listoffigures question/problem Summary: \underline causes a jump out of mathmode for some reason Keywords: latex listoffigures math mode Message-ID: <7914@jarthur.Claremont.EDU> Date: 24 Jul 90 17:18:23 GMT Sender: news@jarthur.Claremont.EDU Reply-To: dhosek@sif.claremont.edu Distribution: na Organization: Quixote Lines: 55 In article <26AB19EC.17589@maccs.dcss.mcmaster.ca>, art@maccs.dcss.mcmaster.ca (Art Mulder) writes... >Hello all, > I trying to get \listoffigures to work and am having some difficulty. >I have some simple macro's: >| \newcommand{\un}{\underline} >| \newcommand{\pth}[1]{\un{path} \; #1 \; \un{end}} >used in a caption of a figure as follows: >| \caption{Labelled sm net intuitively corresponding to $\pth{a;a}$ >| \label{fig:227}} >which puts the following into my .lof file: >[originally this was all one line, I have inserted line breaks] >| \contentsline {figure}{\numberline {2.30}{\ignorespaces Labelled >| sm net intuitively corresponding to $\relax $\@@underline {\hbox >| {path}}$\relax \mskip \thickmuskip a;a \mskip \thickmuskip \relax >| $\@@underline {\hbox {end}}$\relax $ }}{81} p. 51 of the LaTeX book: The \underline command is fragile Hmm... let's look up fragile in the index. pp. 151-2: Certain command arguments are called moving arguments. A fragile command that appears in a moving argument must be preceded by a \protect command... The following are all the commands and environments with moving arguments: o Commands with an argument that may be put into a table of contents, list of figures, or list of tables: \addcontentslne, \addtocontents, \caption, and the sectioning commands. Hmm, that means \underline is fragile, \caption has a moving argument, and we need to put \protect before \underline. Changing the definition of \un to: \newcommand{\un}{\protect\underline} will do the trick. Homework: What happens if \protect is used outside of a moving argument? Cite the LaTeX manual to back up your assertion. -dh --- Don Hosek TeX, LaTeX, and Metafont Consulting and dhosek@ymir.claremont.edu production work. Free Estimates. dhosek@ymir.bitnet uunet!jarthur!ymir Phone: 714-625-0147