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 Answer 1

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
  • Thank you! It works!
    – JCV
    Mar 19, 2021 at 14:01

You must log in to answer this question.

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