# What can interfere with glossaries to prevent printing?

I have the strange experience that from the combination

    \glossarystyle{altlisthypergroup}
\clearpage
Printing acronyms
\printglossary[type=acronym]


only the debug message is printed, the glossaries not. Even, the \printglossary leads to hanging. At the same time, in the text commands like \gls{} work as expected. Any advice, what other package can interfere with glossaries? (It is part of a bigger project, the MWE works as expected.)

................

I changed to command line version from TexStudio. I receive the output

makeglossaries DSc2
makeglossaries version 2.12 (2014-01-20)
makeindex  -s "DSc2.ist" -t "DSc2.alg" -o "DSc2.acr" "DSc2.acn"
This is makeindex, version 2.15 [TeX Live 2013] (kpathsea + Thai support).
Scanning style file ./DSc2.ist.............................done (29 attributes redefined, 0 ignored).
Scanning input file DSc2.acn....done (9 entries accepted, 0 rejected).
Sorting entries....done (36 comparisons).
Generating output file DSc2.acr....done (15 lines written, 0 warnings).
Output written in DSc2.acr.
Transcript written in DSc2.alg.
Warning: File 'DSc2.glo' is empty.
Have you used any entries defined in glossary 'main'?
Remember to use package option 'nomain' if you
don't want to use the main glossary.


What I do not understand, that if there are entries accepted, and sorted, why do I receive the warning about empty .glo file? And also, why the pdflatex hangs if I try to continue with using pdflatex again?

• Do you really think we can answer this with this fragment only? – user31729 May 12 '16 at 13:58
• Can you clarify what you mean by the debug message? – Nicola Talbot May 12 '16 at 14:56
• @Nicola Talbot I mean the message above \printglossary. It is printed, but the glossary not – katang May 12 '16 at 17:59
• @Christian Hupfer I did hope. The fragment is only illustrating what I want to do. I do have a rather complex macro package, with a lot of packages and expected functions. Experimenting blindly is hopeless, because of the cross-talks. I hoped someone did see similar issue (the rest of the functionality is OK, except printing) and can give a hint at least to suspect some other package. – katang May 12 '16 at 18:06
• It's going to be very difficult to help without a MWE, but here are some things to check: (1) search the log file for messages starting with ! Package glossaries, (2) check that the glossary labelled acronym has been defined, (3) check if makeglossaries (makeindex/xindy) has any warning or error messages. One other thing you could try is to change \usepackage{glossaries} to \usepackage{glosaries-extra} and replace \setacronymstyle with \setabbreviationstyle[acronym]. This provides more diagnostic warnings and errors, so it might flag up something that glossaries misses. – Nicola Talbot May 13 '16 at 8:26

I realise that you've managed to create a MWE and posted that as a separate question, but I thought it might help to answer your question "What can interfere with glossaries to prevent printing?" in a more general way that might be useful to others.

There's a Java GUI diagnostic tool called makeglossariesgui that can be used to analyse a document that uses the glossaries package to determine possible problems. (It also has a batch mode that can be used instead of makeglossaries but the GUI mode has more extensive diagnostic messages.) Once it's identified the problem and you've fixed it, you can switch back to makeglossaries.

Although makeglossaries parses makeindex/xindy warning and error messages, makeglossariesgui additionally analyses the LaTeX messages in the .log file and can pick up problems that makeglossaries doesn't detect. There are some examples below.

# Example 1

Let's suppose I have a file called test.tex:

\documentclass{article}

\usepackage[acronym]{glossaries}

\makeglossaries

\newacronym{sa}{SA}{Sample Acronym}

\begin{document}
\gls{sa}.

\printglossary[type=acronym]
\end{document}


If I do the usual

pdflatex test
makeglossaries test
pdflatex test


then makeglossaries issues the warning you observed:

Warning: File 'test.glo' is empty.
Have you used any entries defined in glossary 'main'?
Remember to use package option 'nomain' if you
don't want to use the main glossary.


This is a warning rather than an error in this case, but it may mask something more problematic (as in Example 3, below).

With makeglossariesgui, if I load test.aux I get the error message:

No entries were found for glossaries 'main'

The diagnostics tab provides more details:

There were no entries listed for the main glossary. Remember that you must index entries for them to appear in the glossary using the commands provided by the glossaries package. Entries that have been defined but not indexed won't be listed. If you don't want to use this glossary, add the nomain package option to your document. Check the following:

• Have you used commands like \gls or \glsadd in the document? (If you haven't, you need to add them.)
• If you have used commands like \glsadd or \glsaddall in the preamble, have you remembered to put them after \makeglossaries
• If you have at least version 4.24 of the glossaries package, have you used the debug option? (That might provide some more information for me to analyse.)

If I switch to the "General Information" tab, I can see that my document has defined two glossaries: main and acronym, but there are no entries in the main glossary:

This is why the test.glo file is empty and is the reason for the warning produced by makeglossaries. The main glossary is created by default, but my document hasn't defined or used any entries in that glossary. If I don't require the main glossary, then I need to follow the recommendation and use the nomain package option:

\usepackage[nomain,acronym]{glossaries}


# Example 2

This problem is more subtle:

\documentclass{article}

\usepackage{glossaries}

\makeglossaries

\newacronym{sa}{SA}{Sample Acronym}

\begin{document}
\gls{sa}.

\printglossary[type=acronym]
\end{document}


In this case, if I do

pdflatex test
makeglossaries test
pdflatex test


then makeglossaries doesn't make any complaint, but the test.pdf file doesn't contain the glossary. makeindex is quite happy with the test.glo file and generates the test.gls file without a problem. If I switch to glossaries-extra, I get an error message, but with just the base glossaries package the message in the .log file is rather cryptic. However, makeglossariesgui can detect the problem:

No glossary 'acronym'

It looks as though you might have done something like \printglossary[type={acronym}], but there's no acronym glossary.

# Example 3

This is another instance where glossaries doesn't generate an error message:

% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
\documentclass{article}

\usepackage{glossaries}

\newglossaryentry{sample}{name={sample},description={an example}}

\makeglossaries
\begin{document}
Test.

\printglossary
\end{document}


In this case makeglossaries doesn't provide much help:

Warning: File 'test.glo' is empty.
Have you used any entries defined in glossary 'main'?
Remember to use package option 'nomain' if you
don't want to use the main glossary.


I'm getting the same error message as in my first example, but I've used \glsaddall so what's the problem? The answer is in the check list shown in makeglossariesgui's diagnostic panel, which is the same as earlier, but the pertinent item here is:

• If you have used commands like \glsadd or \glsaddall in the preamble, have you remembered to put them after \makeglossaries

If I add the debug package option:

\usepackage[debug]{glossaries}


It seems you have tried to index an entry in the main glossary on line 10, but the associated file hasn't been opened. Remember to use \makeglossaries before commands like \glsadd and \glsaddall. Details of lost indexing code:
\glossaryentry{sample?\glossentry{sample}|setentrycounter[]{page}\glsnumberformat}{1}

So the problem is that I've put \makeglossaries in the wrong place. It needs to go before \glsaddall. (This is similar to \index and \makeindex.) The glossaries package doesn't complain about using \glsaddall before \makeglossaries as it's perfectly reasonable to comment out \makeglossaries if you're working on a draft and don't want the overhead of repeatedly rebuilding the glossary whilst you're editing a complicated section of the document.
So the answer to "What can interfere with glossaries to prevent printing?" is: potentially a lot of things, but makeglossariesgui might be able to diagnose the cause.