# Problems with glossaries package and complex symbols

The glossaries package doesn't work with complex symbols as the example shows below. Is there a workaround available?

\documentclass{scrartcl}
\usepackage{amsmath}
\usepackage{glossaries}
\makeglossaries

\newglossaryentry{symb}
{
name={\ensuremath{\overset{\rightarrow}{A}}},
description={Description},
}

\begin{document}
works: $\overset{\rightarrow}{A}$\\
doesn't work: \gls{symb}

\printglossary[type=main]
\end{document}

• I see an error message only for the command \overset, so the most logical thing to do is switch to \vec{A}, that works correctly. On an alternative, add \protect before the command overset. – alandella Oct 14 '13 at 13:31

Here are two possible solutions:

## Convert \overset to \vec

Substituting the first command to the standard vector notation gives a different, non-customizable arrow format; so the given arrow notation can be used in your document to indicate vectors (at your discrection even user-defined parameter conventions).

Here is the MWE:

\documentclass{scrartcl}
%
\usepackage{amsmath}
\usepackage{glossaries}
%
\makeglossaries
\newglossaryentry{symb}{%
name={\ensuremath{\vec{A}}},
description={Description}%
}
%
\begin{document}
%
Works: $\vec{A}$ \\
Now even this one works: \gls{symb}
\printglossary[type=main]
%
\end{document}


Output:

## Protect the command \overset

If you want more customization inside the overset arguments, simply protect this command inside the definition of \ensuremath{} by adding \protect before the considered lines of code only inside the name field.

Here is the MWE:

\documentclass{scrartcl}
%
\usepackage{amsmath}
\usepackage{glossaries}
%
\makeglossaries
\newglossaryentry{symb}{%
name={\ensuremath{\protect\overset{\rightarrow}{A}}}, % this is now protected
description={Description}%
}
%
\begin{document}
%
Works: $\overset{\rightarrow}{A}$\\
Now even this one works: \gls{symb}
\printglossary[type=main]
%
\end{document}


And here is the desired output:

• Thank you! As I have other "complex" symbols, the \protect command does the trick. – user4811 Oct 14 '13 at 14:08
• @user4811 You're welcome, it's always a pleasure to help ;-). – alandella Oct 14 '13 at 14:10