Thursday, December 17, 2009

Glossary in Latex

A glossary is a nice thing to have in a report and usually very helpful. As you probably can imaging, it is very easy to create in Latex. Nevertheless, there are a few things to be done, especially generating the glossary-files.

First you have to tell Latex to use the glossary package and to create the glo-file containing all the glossar-entries in your document:

\usepackage{glossary}
\makeglossary

Next you have to add glossary entries to your document. They are of the following form:

\glossary{name={entry name}, description={entry description}}

Note: Usually, the glossary-entry should be added to keywords where they first appear.

A glossary-entry produces by default the following format:

“entry name” “entry description (on multiple lines if necessary)”, “page number”

And finally you have to tell Latex where to place you glossary inside the document which is done by the following command at the location you want to produce the glossary:

\printglossary

Optinally, you can reference to the glossary in the index (toc-file) by adding the following command after “\printglossary”:

\addcontentsline{toc}{chapter}{Glossary}

What you do first is generate your PDF once. An ist-file as well as a glossary file (*.glo) are generated. The glossary-file contains all the glossary entries found in the document in plain text. Next you type the following command in the command-line:

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

generating the two files with the extensions *.gls and *.glg. If entries are ignored or rejected, which can be seen either in the glg-file or directly in the output of the makeindex-command, you have to check your glossary entries. The important of the two files is the *.gls-file, as it is used by Latex for the actual glossary. You now need to re-generate the PDF and if everything works fine, your glossary should appear where you wanted it.

Reference: http://texblog.wordpress.com

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

 
Free counter and web stats