Package glossaries: Create a glossary, a list of symbols, acronyms and abbreviations

With the help of the package glossaries one can easily create a glossary and/or lists of symbols, acronyms and abbreviations. The package utilizies the makeindex command that is already included in any latex environment. The glossaries package is the successor to the package glossary from the same author. If you need to translate any name to a different language, you can load the translator package.

LaTeX file

\documentclass{article}
\usepackage[utf8]{inputenc} %File encoding
\usepackage[T1]{fontenc} % Use EC fonts
\usepackage{ae} % Fonts for PDF files
\usepackage{textcomp} % Text-Companion-Symbols (e. g. \texteuro)
\usepackage[english]{babel} % Language selection
\usepackage{lmodern} % Latin Modern

\usepackage[english]{translator}
%Load the package
\usepackage[
nonumberlist, %do not show page numbers
acronym,      %generate acronym listing
toc,          %show listings as entries in table of contents
section]      %use section level for toc entries
{glossaries}


\usepackage{hyperref}

%Generate a list of symboles
\newglossary[slg]{symbolslist}{syi}{syg}{List of symbols}

%Remove the dot at the end of glossary descriptions
\renewcommand*{\glspostdescription}{}

%Activate glossary commands
\makeglossaries

%These commands sort the lists
%makeindex -s filename.ist -t filename.alg -o filename.acr filename.acn
%makeindex -s filename.ist -t filename.glg -o filename.gls filename.glo
%makeindex -s filename.ist -t filename.slg -o filename.syi filename.syg

%Some entries for the list of symbols
\newglossaryentry{symb:Pi}{
name=$\pi$,
description={A mathematical constant whose value is the ratio of any circle's circumference to its diameter.},
sort=symbolpi, type=symbolslist
}
\newglossaryentry{symb:Phi}{
name=$\varphi$,
description={An angle.},
sort=symbolphi, type=symbolslist
}
\newglossaryentry{symb:Lambda}{
name=$\lambda$,
description={Lambda indictes an eigenvalue in the mathematics  of linear algebra.},
sort=symbollambda, type=symbolslist
}

%Some acronyms
\newacronym{MS}{MS}{Microsoft}
\newacronym{CD}{CD}{Compact Disc}
%An acronym with a glossary entry
\newacronym{AD}{AD}{Active Directory\protect\glsadd{glos:AD}}

%Some glossary terms
\newglossaryentry{glos:AD}{
name=Active Directory,
description={Active Directory is the directory service for 
Windows based networks, that allows central organization and 
administration of any network resource.
It allows a single-sign-on concept independent from network 
topologies or network protocols. As a prerequisite you need 
a Windows Server acting as Domain Controller. This computer 
stores all necessary data, e.\,g.~usernames and corresponding 
passwords.}
}
\newglossaryentry{glos:RespF}{name={response file}, description={A file 
that allows unattended software installation.}}


\begin{document}
\tableofcontents{}

\section{General information}
Our network uses \gls{AD}. By using \gls{AD} with \gls{MS} bases clients that
have been installed using a \gls{glos:RespF} from \gls{CD}, we can expect a 
high level of standardization.

\section{Some Greek symbols}
If you calculate with \gls{symb:Pi} you always get an irrational result, because 
\gls{symb:Pi} itself is irrational. As a matter of fact, there are \gls{symb:Phi} 
and \gls{symb:Lambda}, too.

\cleardoublepage{}

%Print the glossary
\printglossary[style=altlist,title=Glossary]

%Print list of acronyms
%\deftranslation[to=German]{Acronyms}{Abkürzungsverzeichnis}
\printglossary[type=\acronymtype,style=long]

%Print list of symbols
\printglossary[type=symbolslist,style=long]

\end{document}

Process the file

pdflatex filename
makeindex -s filename.ist -t filename.alg -o filename.acr filename.acn
makeindex -s filename.ist -t filename.glg -o filename.gls filename.glo
makeindex -s filename.ist -t filename.slg -o filename.syi filename.syg
pdflatex filename

The result can be found here: example_glossaries.pdf

Remarks:

  • It is advisable to use separate files for glossary entries and acronyms.
  • All entries for the list of symbols should have a sort key, all sort keys should start with the same letter to avoid spacing between letter groups.
With the help of the package glossaries one can easily create a glossary and/or lists of symbols, acronyms and abbreviations. The package utilizies the makeindex command that is already included in any latex environment.
AttachmentSize
example_glossaries.pdf87.82 KB
filename.tex3.06 KB
Your rating: None Average: 3.5 (4 votes)

Texmaker Solution with Batch File

I found out that  the setting

makeindex -s %.ist -t %.glg -o %.gls %.glo

didn't work for me, since some files could not have been generated. But I figured out the following solution:

- Create a new text file named xyz.bat (e.g. mkIdx.bat) in the same directory as your main .tex-file

- open xyz.bat with a Text-Editor and copy the following lines into it

-------copy this to xyz.bat --------------------\/

REM Abkuerzungsverzeichnis
makeindex -s Masterarbeit.ist -t Masterarbeit.alg -o Masterarbeit.acr Masterarbeit.acn

REM Glossar
makeindex -s Masterarbeit.ist -t Masterarbeit.glg -o Masterarbeit.gls Masterarbeit.glo

REM Symbolverzeichnis
makeindex -s Masterarbeit.ist -t Masterarbeit.slg -o Masterarbeit.syi Masterarbeit.syg

-------copy this to xyz.bat --------------------/\

- go to the Texmaker configuration and in the "makeindex" settings line select the xyz.bat file

- F6

- F12

- F6

And everything should be fine. (To get the Glossary, list of symbols and list of abbreviations listed in the TOC, do F11 and again F6)

Took me quite a long time to get this running conveniently. Hope it helps some more people ;)

PS: don't use the "xindy" option for the glossaries package - made quite a mess in my case (must have something to do with makeindex)

Glossary doesn't show

Thank you for this example. I tried it in a file I'm working on currently, and the glossary words in the 'main' text are coloured (so they are indeed linked to something somehow).

However, the glossary itself does not show. Not just in my own file, but also if I run your syntax. It only shows the first page (complete with everything that should be there), and an empty second page.

 

Do you know why it may not work?

Re: Glossary doesn't show

Hi Lena, did you run the makeindex commands?

I certainly tried to run

I certainly tried to run them, but everytime I do, my file does not want to produce an output anymore. Or, what also happens, is that the only output I get is the text of 'make index .....'

So, I must do something wrong with those index. I have tried with an \ in front of the command, without the \ in front. I have tried a substitution for 'filename'.  

 

Don't you use any other packages or settings maybe? that could affect the file from not working?

 

Re

I had the similar problem

1. you have to change the filename to your document name.

2.  I commented the following code line:

%\cleardoublepage{}

and added

\clearpage

instead.

and then the example worked for me :)

doesn't work in

doesn't work in TexMaker... 

I've already done this with original source code:

a) change % for \ in three makeindex commands

b) change filename to my document name

c) %\cleardoublepage{} and added \clearpage 

d) add Makeindex process to Quick Build

this error pops up:

 

! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.

Type H <return> for immediate help.

...

l.22 \makeindex -

s skuska.ist -t skuska.alg -o skuska.acr skuska.acn

You're in trouble here. Try typing <return> to proceed.

If that doesn't work, type X <return> to quit.

 

What am I doing wrong?

 

ou yeah, adding makeindex

ou yeah, adding makeindex commands into compilation process helps :D