5

I'm using the glossaries package to create a glossary of mathematical symbols, but I can't get it to work with upright text in the symbols. I have tried using both \mathrm and \textup. It only seems to cause problems if there are two or more definitions that use upright text. Here is a MWE to illustrate the problem:

\documentclass{book}
\usepackage{glossaries}
\makenoidxglossaries


\newglossaryentry{x}
{
name={$\mathrm{x}$},
description={description},
}

\newglossaryentry{y}
{
name={$\mathrm{y}$},
description={description},
}



\begin{document}

\chapter{Example}
\gls{x}
\gls{y}


\printnoidxglossary
\end{document}

The result is a whole heap of Undefined control sequence errors, as well as one Too many }'s error. It works fine if I remove one of the definitions (and its reference), or if I remove at least one of the \mathrm commands.

Is there a way to get math-mode, upright text to work nicely with glossaries?

4

It works fine if you use \makeglossaries and \printglossaries rather than the noidx versions:

glossaries with upright maths

In this case, you must use either makeglossaries or makeglossaries-lite to generate the glossary list. The latter is more limited but does not require Perl and seems to work fine here.

Complete code:

\documentclass{book}
\usepackage{glossaries}
\makeglossaries
\newglossaryentry{x}
{
  name={$\mathrm{x}$},
  description={description},
}
\newglossaryentry{y}
{
  name={$\mathrm{y}$},
  description={description},
}
\begin{document}

\chapter{Example}
\gls{x}
\gls{y}

\printglossary
\end{document}
  • Okay. I can't get either of them to work. I've installed Perl and set TexnicCenter to run makeindex.bat in the output profile, but the above mwe Still doesn't work; no errors and no warnings, but no glossary produced either. I've also tried setting the ouput profile to run makeglossaries-lite.lua, and that has the same result. Any thoughts? Thanks :) – BZ1 Oct 9 '15 at 6:20
  • I've got it working now by running makeindex.exe with the arguments -s "%bm".ist -t "%bm".glg -o "%bm".gls "%bm".glo. Not sure why that works, but it does. – BZ1 Oct 9 '15 at 7:47
  • makeindex alone won't work. makeglossaries should work. makeglossaries-lite should work. See the glossaries documentation. makeglossaries-lite doesn't need Perl. – cfr Oct 9 '15 at 13:04
  • I just realised I typed makeindex.bat in my first comment when I meant makeglossaries.bat. Neither makeglossaries, nor makeglossaries-lite seem to work for me if I add them to the output profile, but makeindex.exe works fine. If there's something that's not working properly using only makeindex.exe, I can't see it. – BZ1 Oct 10 '15 at 0:30
  • @BZ1 You can look at the documentation for details. On its own, makeindex will produce an index rather than a glossary. With those arguments, it produces a glossary. Some functionality is missing, I think, but if you are not using that functionality, you have no reason to care about it ;). – cfr Oct 10 '15 at 0:38
1

As a supplement to @cfr's answer, if you still want to use the "noidx" version, you have to set the sort key. (In fact, you ought to do that even if you use the other answer, or makeindex will view $\mathrm{x}$ as the sequence of characters $ \ m a t h r m { x } $ which will throw the alphabetical sorting.)

Modified MWE:

\documentclass{book}
\usepackage{glossaries}
\makenoidxglossaries


\newglossaryentry{x}
{
name={$\mathrm{x}$},
sort={x},
description={description},
}

\newglossaryentry{y}
{
name={$\mathrm{y}$},
sort={y},
description={description},
}



\begin{document}

\chapter{Example}
\gls{x}
\gls{y}


\printnoidxglossary
\end{document}

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.