4

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} 
1
  • 1
    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.
    – TheVal
    Oct 14, 2013 at 13:31

1 Answer 1

7

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:

enter image description here

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:

enter image description here

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .