2

I'm trying to introduce some entries in the glossary with \usepackage{glossaries} and I don't know how to introduce symbols with arrows, like vector fields. If I don't use name=$\overrightarrow{E}$, works fine but I need to put the right symbol.

this is my entry:

\newglossaryentry{symb:efield}{
name=$\overrightarrow{E}$,
description={Electric Field},
sort=symbolefield, type=symbolslist
}

and I have at least 4 error related to that:

  • Illegal parameter number in definition of \glo@symb:efield@text.
  • Illegal parameter number in definition of \glo@symb:efield@plural.
  • Illegal parameter number in definition of \glo@symb:efield@first.
  • Illegal parameter number in definition of \glo@symb:efield@firstpl.

Why is that?

1

Try this code.

\documentclass{article}

\usepackage{glossaries}

\newglossary*{symbolslist}{Symbols list}

\newcommand{\field}[1]{\protect\overrightarrow{#1}}  % use \protect 

\newglossaryentry{symb:efield}{%
    type=symbolslist,
    name={\ensuremath{\field{E}}},
    description={Electric Field},
    sort=symbolefield, 
}
    
\makeglossaries

\begin{document}    

overrightarrow: $\field{AB}$

\medskip

 \gls{symb:efield}   
  
\printglossary[type=symbolslist]
    
\end{document}

A

Related: https://tex.stackexchange.com/a/387939/161015

Must use use \protect because overrightarrow is not robust.

Or use \DeclareRobustCommand{\field}[1]{\overrightarrow{#1}} as alternative.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.