Acronyms in LaTeX Glossaries

Implementing a list of acronyms in a LaTeX can be very complicated. As I had some problems with this task I will explain how I managed to do it.

First we need to reference the glossaries package, including the following options:

  • xindy indicates that we want to use xindy as indexing processor rather than makeindex
  • toc means that our acronyms should be listed in the table of contents
  • acronym indicates that a spearate acronym glossary should be created
  • nomain suppresses the creation of the main glossary, since we only need acronyms

The whole line reads:

1
\usepackage[xindy,toc,acronym,nomain]{glossaries}

Next, we need to get LaTeX to create various files needed by xindy. This is achieved through the simple instruction

1
\makeglossaries

Normally, xindy should automatically be invoked if you have Perl installed, but this did not work for me. Instead, I had to execute the following command manually when new acronyms were added (in the directory where your .tex, .xdy and .acn files are located, assuming your doucment is named thesis.tex):

1
makeglossaries thesis

When using TeXlipse, the LaTeX plugin for Eclipse, the build process is mostly executed in the tmp folder, and therefore you need to execute makeglossaries in there. Before and after the process, input and output files have to be moved to their proper location. I solved this by writing the following script:

1
2
3
4
5
6
cd tmp
cp ../thesis.xdy .
cp ../thesis.acn .
makeglossaries thesis
cp thesis.acr ..
cp thesis.alg ..

Finally, another thing I stubled across is that acronyms are only listed if they are referenced somewhere in the document. That means defining an acronym, e.g.

1
\newacronym{API}{API}{Application Programming Interface}

is not enough. It has to be referenced with \gls{API} or similar instructions in order to be taken into account for glossary creation.

Ah and if you don’t like the dots after your terms in the acronym list, you can remove them by issuing

1
\renewcommand*{\glspostdescription}{}

That’s it. I hope that this is useful for someone else 🙂