I'm having a weird problem with glossaries (TeXLive 2011, glossaries v3.01), illustrated by the following example:
% compile this with
% pdflatex example.tex
% makeindex -s "example.ist" -t "example.alg" -o "example.acr" "example.acn"
% pdflatex example.tex
\documentclass{scrartcl}
\usepackage{amsmath}
\usepackage{bm}
\usepackage[acronym,nomain]{glossaries}
\newglossary[slg]{symbolslist}{syi}{syg}{Symbole}
\makeglossaries
\newcommand{\vect}[1]{\bm{#1}}
%\newcommand{\cvect}[1]{\overline{\vect{#1}}}
\newcommand{\cvect}[1]{\underline{\vect{#1}}}
\newglossaryentry{sym:sc}{name={\ensuremath{\cvect{s}}},description={some complex vector},type=symbolslist}
\begin{document}
\gls{sym:sc}
\ensuremath{\underline{\bm{s}}}
\printglossary[type=symbolslist]
\end{document}
In my document, I need to typeset complex-valued vectors in boldfaced, italic letters with a line below, see the \cvect
definition. This works as expected, except if I'm trying to use it for a symbol definition along with the glossaries
package. Then, the pdflatex
run is interrupted with a missing $
error.
The weird thing about this is: if I use \overline
instead of \underline
in the definition of \cvect
, everything works as expected (see the commented version of \cvect
).
My first idea was that this could be a problem with \ensuremath
, however, when using it without \newglossaryentry
(i.e., just in the document body), it works as expected.
Best Answer
\underline
is not robust. Try something like this: