Latest news 2024-10-15: New blog post: Tales for Our Times Book Launch.

glossaries package FAQ

Do I have to use makeglossaries? 🔗

No, you can use makeindex or xindy directly, but you will need to remember to use it for each glossary that has been defined, and you will need to remember all the relevant switches. If you want to use xindy, you must remember to use the xindy option when loading the glossaries package. See Generating the associated glossary files for further details.

Note that makeglossaries doesn’t simply run makeindex or xindy, it also analyses the transcript messages (which can be quite cryptic) and provides additional information when something goes wrong. When used with makeindex (which doesn’t allow the same location to have multiple formats), makeglossaries will detect the multiple encap warning and attempt to fix it.

Consider the following document:

\documentclass{article}
\usepackage[xindy]{glossaries}

\makeglossaries

\newglossaryentry{alpha}{name={\ensuremath{\alpha}},description={...}}

\begin{document}
\gls{alpha}

\printglossaries
\end{document}

This will cause xindy to fail with the message:

ERROR: CHAR: index 0 should be less than the length of the string

This is one of the error messages that makeglossaries looks for and it provides more information (the document is in the file test.tex):

Possible cause of problem: Sort key required for entries only containing command names. Attempting to determine which entries have problem sort keys. Parsing 'test.glo' 1 problematic entry found: Label: 'alpha'. Sort value : '\\ensuremath {\\alpha }' (Try adding sort={alpha} to the definition.)

Note that this identifies the label of the problematic entry (alpha) and suggests a remedy (add sort={alpha} to the entry’s definition). See also What does the xindy error “CHAR: index 0 should be less than the length of the string” mean?.

Now consider the document:

\documentclass{article}
\usepackage{glossaries}

\makeglossaries

\newglossaryentry{sample}{name={sample},description={...}}

\begin{document}
\gls{sample}
\gls[format=hyperbf]{sample}

\printglossaries
\end{document}

In this case makeindex will generate a warning (the document is in the file test.tex):

## Warning (input = test.glo, line = 2; output = test.gls, line = 5): -- Conflicting entries: multiple encaps for the same page under same key.

The location list will have page 1 appearing twice, first in the normal font and then in bold. If you use makeglossaries it will show the above warning and then the message:

Multiple encaps detected. Attempting to remedy. Reading test.glo... Writing test.glo... Retrying

The location list will now just contain the bold page 1.

So to recap: no, you don’t have to use makeglossaries. You can simple run makeindex or xindy explicitly or you can write your own script that simply runs makeindex or xindy with your preferred switches, but makeglossaries knows what switches are required (from the .aux file) and can help you when things go wrong.

If you don’t want to use makeglossaries because you don’t have Perl installed (and you don’t want to or can’t install it), then you can use makeglossaries-lite instead, which is a Lua script, but it doesn’t have any diagnostics. (Note that in this case, you also won’t be able to use xindy either as that is also a Perl script.) Alternatively, you can use the MakeGlossariesGUI Java application, which has a graphical interface that provides more detailed diagnostics. It can also be run from the command line, but there are no diagnostics available in that mode.

If you don’t want to install Perl (and therefore can’t use xindy) but you require non-Latin or extended Latin support for sorting alphabetically then your only remaining option is to use bib2gls (a Java application) with glossaries-extra.

See also Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build.

2020-07-01 14:17:53


Permalink: https://www.dickimaw-books.com/faq.php?id=67
Alternative link: https://www.dickimaw-books.com/faq.php?itemlabel=nomakeglossaries

Category: glossaries package
Topic: Sorting and Collating Entries