2

I have a document to which I'd like to add a list of variables with short description. Therefore I'd like to use the glossaries package. It works in case the glossary contains only normal text, but since I need sub- and superscripts, I always get the error

Undefined control sequence. }

I just want a glossary with the math variable and a short description next to it in some aligned (tabular like) form.

Any help apprechiated, thanks! Here's a minimal example:

\documentclass{report}
\usepackage{amsmath,amssymb,amsthm,makeidx,amsxtra,amscd}
\usepackage[toc,nonumberlist,nopostdot]{glossaries}
\usepackage{glossary-mcols}
\setglossarystyle{long}

\makeglossaries

\newglossaryentry{firstvar}
{
    name={$\iRab$},
    description={Description 1}
}

\newglossaryentry{secondvar}
{
    name=bw,
    description={Description 2}
}

\newcommand{\iRab}{{}^{}_{I}R^{}_{ab}}

\begin{document}
    \glsaddall
    \printglossary[title=Symbols and Notation]
    \iRab
\end{document}

Relevant .log part :

 (./document.gls [1

\openout3 = `document.ist'.

{/usr/local/texlive/2019/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
LaTeX Font Info:    Try loading font information for U+msa on input line 5.

(/usr/local/texlive/2019/texmf-dist/tex/latex/amsfonts/umsa.fd
File: umsa.fd 2013/01/14 v3.01 AMS symbols A
)
LaTeX Font Info:    Try loading font information for U+msb on input line 5.

(/usr/local/texlive/2019/texmf-dist/tex/latex/amsfonts/umsb.fd
File: umsb.fd 2013/01/14 v3.01 AMS symbols B
))
! Missing $ inserted.
<inserted text> 
                $
l.26    \iRab

I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Missing $ inserted.
<inserted text> 
                $
l.27 \end{document}

I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

[2

] (./document.aux) ) 
2

The problem is not with the glossaries, rather with the new command. You need to fix two things:

  1. you need to ensure it's in math mode with \ensuremath
  2. You need the new command to appear before the first time it is used.

MWE

\documentclass{report}
\usepackage{amsmath,amssymb,amsthm,makeidx,amsxtra,amscd}
\usepackage[toc,nonumberlist,nopostdot]{glossaries}
\usepackage{glossary-mcols}
\setglossarystyle{long}

\makeglossaries
\newcommand{\iRab}{\ensuremath{{}^{}_{I}R^{}_{ab}}}
\newglossaryentry{firstvar}
{
    name={$\iRab$},
    description={Description 1}
}

\newglossaryentry{secondvar}
{
    name=bw,
    description={Description 2}
}



\begin{document}
    \glsaddall
    \printglossary[title=Symbols and Notation]
    \iRab
\end{document}
|improve this answer|||||
  • 1
    I have beat me for 18 sec :-) – Sebastiano Oct 29 '19 at 21:57
  • 2
    @Sebastiano: Thank you both! Due to the description, I accepted this one ;-) – avermaet Oct 29 '19 at 22:05
2

With this code you have not any errors with the compilation.

\documentclass{report}
\usepackage{amsmath,amssymb,amsthm,makeidx,amsxtra,amscd}
\usepackage[toc,nonumberlist,nopostdot]{glossaries}
\usepackage{glossary-mcols}
\setglossarystyle{long}
\newcommand{\iRab}{${}^{}_{I}R^{}_{ab}$}
\makeglossaries
\newglossaryentry{firstvar}
{
    name={\ensuremath{\iRab}},
    description={Description 1}
}
\newglossaryentry{secondvar}
{
    name=bw,
    description={Description 2}
}
\begin{document}
    \glsaddall
    \printglossary[title=Symbols and Notation]
    \iRab
\end{document}
|improve this answer|||||

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.