2

Currently I am using the acronym package to generate a glossary of acronyms, but I would like to also have a glossary of mathematical symbols. Therefore, I am looking to move to the glossaries package. I am having issues (detailed below) that the glossary section is not generated and so would like to know what is the simplest way to do this?

Below is a simple WORKING use case with acronym, from which I can generate a pdf, on mac os X, in texmaker (4.4.1) running the quick build option;

PdfLaTex + Bib(la)tex + PdfLaTex(x2) + View Pdf

main.tex:

\documentclass{article}
\usepackage{acronym}
\usepackage[backend=bibtex,bibencoding=ascii]{biblatex}

\addbibresource{example_bib.bib}

\begin{document}

\section{Body}

Try printing \ac{aa} and citing something.\cite{a_reference}

\section{Acronyms} 
\begin{acronym}[AAAAAAA]
\acro{aa}[AA]{An Acronym}
\end{acronym}

\printbibliography

\end{document}

example_bib.bib:

  @ARTICLE{a_reference,
  author = {A, Name},
  title = {A Title},
  volume = {1},
  pages = {1--2},
  abstract = {an abstarct},
  date = {2013-06},
  doi = {10.1016/j.commatsci.2013.03.013},
  issn = {0927-0256},
  journaltitle = {Computational Materials Science},
  keywords = {Keyword},
  shortjournal = {Computational Materials Science},
  url = {http://www.sciencedirect.com},
  urldate = {2015-10-28}}

If I try adapting the main.tex file to:

\documentclass{article}
\usepackage[acronym]{glossaries}
\usepackage[backend=bibtex,bibencoding=ascii]{biblatex}

\makeglossaries
\newacronym{aa}{AA}{An Acronym} 

\addbibresource{example_bib.bib}

\begin{document}

\section{Body}

Try printing \gls{aa} and citing something.\cite{a_reference}

\printacronyms

\printbibliography

\end{document}

It runs, but there is NO glossary section output to the pdf! (the acronym is inserted in the body text)

This is also the case if I try using glossary terms:

\documentclass{article}
\usepackage{glossaries}
\usepackage[backend=bibtex,bibencoding=ascii]{biblatex}

\makeglossaries
\newglossaryentry{aa}{name=aa,description={A description of AA}}

\addbibresource{example_bib.bib}

\begin{document}

\section{Body}

Try printing \gls{aa} and citing something.\cite{a_reference}

\printglossaries

\printbibliography

\end{document}

I have looked at a number of questions on here related to this issue, but none seem to provide an adequate answer.

11
  • You have the wrong type of brackets in \newacronym{aa}[AA]{An Acronym} They should all be curly brackets {} not square []. So it should be \newacronym{aa}{AA}{An Acronym} Commented Jun 10, 2016 at 13:10
  • Thanks Nicola! What a schoolboy error lol. I still have the issue that the glossary section doesn't show up on the pdf though? Commented Jun 10, 2016 at 13:27
  • I have edited the question to focus on this problem Commented Jun 10, 2016 at 13:33
  • You need to run makeglossaries after pdflatex. You mentioned your build option is PdfLaTex + Bib(la)tex + PdfLaTex(x2) + View Pdf. I don't use TeXMaker, but there needs to be a MakeGlossaries in there (either before or after Bib(la)tex). Alternatively, add the package option automake: \usepackage[automake]{glossaries} Commented Jun 10, 2016 at 14:15
  • Yes automake did the trick, thank you very much! This seems an easier option than messing with the build? Also, is there any other top tips you could give me for using glossaries that might not come up in the basic howto's? Commented Jun 10, 2016 at 14:28

1 Answer 1

1

The quick and easy method is to just add the automake option:

\documentclass{article}

\usepackage{filecontents}
\usepackage[acronym,automake]{glossaries}
\usepackage[backend=bibtex,bibencoding=ascii]{biblatex}

\begin{filecontents*}{example_bib.bib}
@ARTICLE{a_reference,
  author = {A, Name},
  title = {A Title},
  volume = {1},
  pages = {1--2},
  abstract = {an abstarct},
  date = {2013-06},
  doi = {10.1016/j.commatsci.2013.03.013},
  issn = {0927-0256},
  journaltitle = {Computational Materials Science},
  keywords = {Keyword},
  shortjournal = {Computational Materials Science},
  url = {http://www.sciencedirect.com},
  urldate = {2015-10-28}}
\end{filecontents*}

\makeglossaries
\newacronym{aa}{AA}{An Acronym} 

\addbibresource{example_bib.bib}

\begin{document}

\section{Body}

Try printing \gls{aa} and citing something.\cite{a_reference}

\printacronyms

\printbibliography

\end{document}

This requires two pdflatex invocations, but you've got that already with your PdfLaTex + Bib(la)tex + PdfLaTex(x2) + View Pdf build. This method makes use of TeX's shell escape mechanism. This is commonly set to restricted mode, which only allows trusted applications to run. Luckily, makeindex is a trusted application.

The makeglossaries Perl script supplied with the glossaries package runs makeindex (or xindy), but it also provides some diagnostic information. (Some of xindy's messages are a bit cryptic.) egreg's answer to another question shows how to integrate makeglossaries with texmaker.

Personally, I prefer to use arara. With this method I just need to put some special comments in my source code:

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

\usepackage{filecontents}
\usepackage[acronym]{glossaries}
\usepackage[backend=bibtex,bibencoding=ascii]{biblatex}

\begin{filecontents*}{example_bib.bib}
@ARTICLE{a_reference,
  author = {A, Name},
  title = {A Title},
  volume = {1},
  pages = {1--2},
  abstract = {an abstarct},
  date = {2013-06},
  doi = {10.1016/j.commatsci.2013.03.013},
  issn = {0927-0256},
  journaltitle = {Computational Materials Science},
  keywords = {Keyword},
  shortjournal = {Computational Materials Science},
  url = {http://www.sciencedirect.com},
  urldate = {2015-10-28}}
\end{filecontents*}

\makeglossaries
\newacronym{aa}{AA}{An Acronym} 

\addbibresource{example_bib.bib}

\begin{document}

\section{Body}

Try printing \gls{aa} and citing something.\cite{a_reference}

\printacronyms

\printbibliography

\end{document}

(There's a question on integrating texmaker with arara.)

You asked for some top tips in the comments. Here are the ones that I can think of off the top of my head:

  • Define your entries (\newglossaryentry, \newacronym etc) in the preamble or put them in a separate file and load them in the preamble using \input or \loadglsentries.
  • Avoid using special characters in the entry labels. This includes extended Latin or non-Latin characters, unless you're using XeLaTeX or LuaLaTeX.
  • Avoid using commands like \gls in section/chapter/captions etc. If you really need them, use the commands like \glsfmttext{label}, \glsfmtshort{label} or \glsfmtlong{label} provided by the glossaries-extra package.
  • If your terms contain commands or special characters, provide the sort key. For example:

    \newglossaryentry{alpha}{name={$\alpha$},text={\alpha},sort={alpha},
       description={...}}
    \newacronym[sort={chi2}]{chisq}{$\chi^2$}{$\chi^2$-squared}
    
  • If you want to use commands like \Gls that convert the first letter to upper case, be careful of the restrictions imposed by \makefirstuc (provided by mfirstuc). So the above examples should really be:

    \newglossaryentry{alpha}{name={{}$\alpha$},text={{}\alpha},sort={alpha},
       description={...}}
    \newacronym[sort={chi2}]{chisq}{{}$\chi^2$}{{}$\chi^2$-squared}
    

    (These types of entry shouldn't have any case-changing applied even if they do occur at the start of a sentence. The empty brace at the start of the value discards the attempt to change case, which would otherwise cause problems.)

  • If things go wrong, for example, your glossary doesn't appear or has entries missing, try the makeglossariesgui application to see if it can detect the problem.

Related resources:

You must log in to answer this question.

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