2

Any idea why my glossaries are not showing?

%--- Long usepackage list, it got included to check for possible conflicts ----
\documentclass[11pt,a4paper,oneside,openright]{report}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage[dvips]{graphicx}
\usepackage{tabularx}
\usepackage{subfigure}
\usepackage{afterpage}
\usepackage{amsmath,amssymb}            
\usepackage{rotating}  
\usepackage{fancyhdr}  
\usepackage[scriptsize]{caption}
\usepackage[toc,section=chapter,acronym,automake]{glossaries}
\usepackage{color}
\usepackage{cancel}
\usepackage{lipsum}
\usepackage{enumitem}
\usepackage{url}
\usepackage{pdfpages}
\usepackage{makecell}
\usepackage{romannum}

\makeglossaries
\glstoctrue
\loadglsentries{glossario}

\begin{document} 
\pagenumbering{arabic}
\tableofcontents
\listoffigures
\listoftables
%---- List of chapters to include ----
\printglossaries
% ---- Bibliography ----
\appendix
% ---- Appendices includes ----
\end{document}

They were showing just fine, I worked on the document for a few days and I must have not realized they weren't showing anymore. The \gls{} and \acr{} are working but no glossary page get printed. I'm using Texmaker, my settings are:

  • Quick compile: PdfLaTeX + Bib(la)tex + PdfLaTeX (x2) + Display Pdf
  • Commands: PdfLaTeX: LateX_folder\miktex\bin\pdflatex -synctex=1 -interaction=nonstopmode %.tex

I tried every suggestion I could find, now I'm afraid some package is conflicting with the glossaries.

6
  • Your quick compile list is missing the makeglossaries call. (Not sure why it's showing as part of the pdflatex command, but I'm not familiar with texmaker.) Feb 6, 2018 at 16:32
  • Related: Using Texmaker with glossaries on Windows Feb 6, 2018 at 16:36
  • The makeglossaries call is concatenated in the PdfLaTeX command Feb 6, 2018 at 16:38
  • 1
    You also have automake which should run makeindex from the shell escape (in which case the makeglossaries call is redundant). Check if there's a .glg or .alg file present, and if so check them for errors. It's better if you trim down your MWE so that it doesn't have all the included files. Feb 6, 2018 at 17:28
  • I trimmed down my MWE and remove the makeglossaries command, any guess why my glossaries are not showing? Feb 7, 2018 at 8:35

2 Answers 2

2

First check your document build is correct with a simple document:

\documentclass{report}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[toc,acronym]{glossaries}

\makeglossaries

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

\begin{document}
\tableofcontents

\chapter{Sample Chapter}
\gls{sample}, \gls{ex}.

\printglossaries

\appendix
\chapter{Sample Appendix}

\gls{sample}, \gls{ex}.
\end{document}

If the file is called myDoc.tex then the document build is:

pdflatex myDoc
makeglossaries myDoc
pdflatex myDoc
pdflatex myDoc
  • The first LaTeX call doesn't display the glossaries but writes the files needed to generate them.

  • The makeglossaries call uses the makeglossaries Perl script which runs makeindex or xindy on the appropriate files. In this case it runs makeindex twice because there are two glossaries (the default main glossary, which is always created unless nomain is used, and the acronym glossary, which is created by the acronym package option).

  • The second LaTeX call reads the files created by makeindex which contain the code to typeset the glossaries.

  • The third LaTeX call ensures that the table of contents is up to date.

You have some unnecessary code in your example:

\glstoctrue

This is automatically implemented by the toc package option. The glossaries don't show in the table of contents until the third LaTeX call.

section=chapter

This isn't needed as it's the default with any class file that defines \chapter (which is the case with report).

automake

This option tells the glossaries package to use TeX's shell escape to run makeindex or xindy. TeX can be run with the shell escape completely disabled (in which case automake won't work), with the shell escape in restricted mode (automake will only work for trusted applications, so it works for makeindex but not for xindy) or with the shell escape fully enabled (a security risk, but allows automake to work with xindy).

If you have a build process that runs makeglossaries (or makeglossaries-lite, or explicitly makeindex/xindy) then you don't need automake.

It's best to load glossaries last (unless another required package indicates otherwise). It's one of the few exceptions to the general rule that hyperref should be loaded last. Your example doesn't use hyperref so it may not be so much of a problem if other packages are loaded after glossaries.

\usepackage[dvips]{graphicx}

Unrelated to glossaries, but you've informed graphicx that you're using the DVI format but you've stated that your build process uses pdfLaTeX. With modern TeX distributions you shouldn't need to tell packages which LaTeX format you're using but, where you do, it should actually match whereas this conflicts.

If the above example works fine for you, then your build process is working correctly, which means the problem is somewhere in the document code. The next step is to add the other packages to see if they cause a conflict:

\documentclass{report}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[italian]{babel}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{subfigure}
\usepackage{afterpage}
\usepackage{amsmath,amssymb}
\usepackage{rotating}
\usepackage{fancyhdr}
\usepackage[scriptsize]{caption}
\usepackage{color}
\usepackage{cancel}
\usepackage{lipsum}
\usepackage{enumitem}
\usepackage{url}
\usepackage{pdfpages}
\usepackage{makecell}
\usepackage{romannum}

\usepackage[toc,acronym]{glossaries}

\makeglossaries

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

\begin{document}
\tableofcontents

\chapter{Sample Chapter}
\gls{sample}, \gls{ex}.

\printglossaries

\appendix
\chapter{Sample Appendix}

\gls{sample}, \gls{ex}.
\end{document}

This document compiles fine for me. If it doesn't work for you then add

\listfiles

at the start which will show the version numbers of all the loaded packages at the end of the .log file. Compare these with the latest version on CTAN. It's possible that you might have a old version that's causing a problem.

If this second example works fine for you, then it's possible there's a problem with one or more of the entry definitions in your glossario.tex file. So the next step is to check the transcript files created by makeindex. These have the extensions .glg (for the main glossary) and .alg (for the acronym glossary). Are there any error messages in these files?

My example document was called test.tex, so the first transcript file is test.glg and contains:

This is makeindex, version 2.15 [TeX Live 2017] (kpathsea + Thai support).
Scanning style file ./test.ist.............................done (29 attributes redefined, 0 ignored).
Scanning input file test.glo....done (2 entries accepted, 0 rejected).
Sorting entries....done (2 comparisons).
Generating output file test.gls....done (7 lines written, 0 warnings).
Output written in test.gls.
Transcript written in test.glg.

The second transcript file is test.alg and contains:

This is makeindex, version 2.15 [TeX Live 2017] (kpathsea + Thai support).
Scanning style file ./test.ist.............................done (29 attributes redefined, 0 ignored).
Scanning input file test.glo....done (2 entries accepted, 0 rejected).
Sorting entries....done (2 comparisons).
Generating output file test.gls....done (7 lines written, 0 warnings).
Output written in test.gls.
Transcript written in test.glg.

The key line in both case is the one that contains (2 entries accepted, 0 rejected). If any entries have been rejected, then you have a problem with your glossario.tex file, in which case change the above example document so that the \newglossaryentry and \newacronym definitions are replaced with one of the \newglossaryentry and \newacronym definitions from your glossario.tex file, and replace the corresponding \gls{sample} and \gls{ex}.

Here are some possible things that might be wrong (but this is just guesswork without knowing what's actually in that file):

  • One or more of the labels may contain special characters or other content that can't be expanded to a simple label. This includes UTF-8 characters when you have \usepackage[utf8]{inputenc} (but not a problem with XeLaTeX/LuaLaTeX).
  • Something in the sort field (which is obtained from name if omitted) contains code that's interfering with the mechanism used to escape makeindex's special characters.

The first is the most common problem of the two.

If the example document still works with this modification, try each term defined in glossario.tex until you find one that fails. If none of them fail, then the problem may lie in the way you are referencing the terms. Since you haven't provided an example of how you're using \gls (or similar commands), this is again just guesswork. You have to hack down to pinpoint the problem.

Possible problems:

  • You haven't used \gls (or similar commands) anywhere in your document. (The transcript file will show 0 entries accepted, 0 rejected.)
  • \gls (or similar) has been used in some context that's interfering with the indexing.

The first is the most commonly encountered cause.

1

Apparently moving the appendices before the glossaries fixed the problem, the glossaries are printed correctly. LaTeX is powerful and I barely scratched the surface of the possibilites that it offers but sometimes it's just stupid.

2
  • 1
    Then there's something wrong with your code that you haven't told us about. It shouldn't make any difference where the glossaries are relative to the appendices (given your document preamble). Feb 7, 2018 at 13:31
  • I don't know what to say, the only parts I didn't post are the chapters, just plain latex. I didn't hide anything. Feb 8, 2018 at 10:38

You must log in to answer this question.

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