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:
<strong>"entry name" "</strong>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.
Good luck:-)
aalderinkg
I think the glossary style isn’t part of the standard TeTeX distribution (At least not on the distribution I’ve running on my Solaris machine).
This might discourage people to use it.
If other people are in need of the package, you can find it on the CTAN repositories under tex-archive/macros/latex/contrib/glossary
There is a manual included, explaining exactly how to get everything set up
Geri
I can not thank you enough. Very simple and helpful 🙂
Tony Ludlow
Very helpful, and brilliant timing to anticipate my problems. It worked the first time like a dream, but when I tried the second time it says (when running my new makeindex.bat) that it cannot parse output. Should I delete one or more of the files? Which?
tom
Hi Tony,
If your glossary entries have changed you may want to restart the procedure again. I would suggest, you remove all the glossary-related files first.
Tom
annmucc
Hi all,
I am trying to generate a glossray with the above insturctions. However, the .gls and .glg files are not being created. I am using LEd as an interface, if that may be the clue to my problems
Thanks
Ann
tom
Hi Ann,
I tried it with both, Latex and PDFLatex before using “makeindex” in the command line and it worked? Make sure you have the .glo- and .ist-files. Next you have to change directory in the command line to your document directory. Does “makeindex…” produce any error in the command line?
Alternatively to the command line procedure, you can define your own command in LEd. Go to the LEd install directory and open the “Batches”-directory. Inside you will find a file “user1.bat”, which you drag-and-drop into LEd. You simply have to replace the line saying: “@echo off” by “makeindex document.glo -s document.ist -t document.glg -o document.gls”, where document has to be replaced by the filename of your tex-file. After saving, you can execute the user command 1 (U1) in the top right corner, if you have the standard LEd layout. If you cannot see it, make sure you have the “Latex Compile – additional”-toolbar. OK?
Cheers,
Tom
annmucc
Hi Tom
Thanks for the tips. I managed to get the glossary 🙂 However, I am also getting the page number written at the end of the glossray enry (as it shows in the default). Does anyone know how this can be removed in an easy way?
Thanks
Ann
annmucc
Hey Ok – just figured out how to do it with some help from google and brother (THis is my first time using Latex, and my IT skills are nothing special, but I am enjoying it)
You have to write [number=none] between \usepackage and {glossary}
Martoni
Thanks for your usefull howto, but in my distribution (ubuntu) the makeindex command doesn’t work. Arguments order must be changed:
zzzzz
Nice package… shame there’s not an emacs shortcut for compiling the glossary 🙁
Victor
A tip for Kile users:
Go to “Configure Kile” in settings, under Tools, select Build, “New Tool”
Name: Glossary (or as you want)
Command: makeindex
Options: %S.glo -s %S.ist -t %S.glg -o %S.gls
Then you can add this in the QuickBuild configuration so that the glossary is automatically generated at each build
Cheers
Victor
Owen
Thank you! Very helpful,
Owen
josh
thank you very much, it’s unbelievable how you can explain 55 pages instructions into less than one page.
anonym
very cool thx!
Kionar
The glossaries package has replaced the now obsolete glossary package
Rashed
Thanks a lot for the help/
Logava
try also glossaries package
glosName
Hi,
i can’t find how to rename glossary. I want it says somthing else then glossary on top of the list.
Thank you
tom
Hi,
You can rename the glossary name using the following command:
Make sure you add the command before
\printglossary
, but inside the document.Tom.
glosName
Thank you for helping. It works 😉
John
I am a relatively new user to LaTeX and am trying to help one of my students format a masters thesis. We have everything formatted but the glossary and the running header. I believe I’ve followed the instructions for making a glossary, but I don’t understand how to access the .glo file. The sample.tex and the other files seem to work, and I get a sample.glo file. However, when I click on that file is asks me to “choose application”. When I open in it TeXshop, I can see the makeindex pulldown menu, but can’t typeset. This would be easiest if someone did a screencast of the entire process, from downloading the glossary zip file to the entire installation and run. There are so many LaTeX help sites, but I’ve tried about eight so far and can’t seem to get an glossary to show up. Thoughts?
tom
Hi John,
In order to create the glossary, once you see the *.glo file in your folder, you will need to open a terminal-window and navigate to that folder. In there, type the makeindex-command given above, while replacing “document” with your own document name. In the output you should then see something like:
Scanning input file document.glo....done (4 entries accepted, 0 rejected).
. Go back to TeXShop after that and re-typeset (LaTeX) your document to include the glossary in your document.This version of glossary will perfectly do. However, I should mention that there is a newer version called “glossaries“. You can find an introduction here.
Also, I’m not sure when and how to use the MakeIndex command in TeXShop, but it will definitely not work with “glossary”, at least the way I describe it above.
Hope this clarifies some of your questions. If not, don’t hesitate to post another comment.
Thanks, Tom.
Rianda
Is it possible to put figures in the glossary? For instance, I would explain a notion using a figure.
Rianda
O well, I did not look very good, it is as easy as I thougt. 🙂
Dalal
Hi Tom,
I have a problem while making my glossary, I follow what you say but I stopped when you say “Next you type the following command in the command-line:
makeindex document.glo -s document.ist -t document.glg -o document.gls”
I didn’t know where should I write that command!
Note that I’m using TeXworks
Thanks,
tom
Hi Dalal,
I wrote that post a while ago. Basically, you would have to use a command-line tool (terminal/console). Luckily, TeXworks has a simpler solution built-in. Select “Typeset -> MakeIndex” and press typeset. You will probably have to typeset the following sequence to get the document (including glossary) right:
1. LaTeX (or pdfLaTeX)
2. MakeIndex
3. LaTeX (or pdfLaTeX)
4. LaTeX (or pdfLaTeX)
Let me know if something is unclear. Best, Tom.
Pogas
Perfecto! Awesome post – worked like a dream. You have saved me hours of trying to figure out how to
tom
Thanks for your comment. I’m glad you found my post useful. Best, Tom.
suren
Apparently I am the only person, who cannot get this installed. Well, I am running an ancient suse (9.3) on a virtual machine (due to a specific reason). I created a file /usr/share/texmf/tex/latex/glossary directory and moved the glossary.sty into it. However, I do not have a LaTeX2HTML directory. I can create one, but the question is where? Thanks for any help
tom
Hi,
I’m not sure whether you need a LaTeX2HTML. However, you’ll need to update the package index using the command
texhash
.Since the
glossary
package is obsolete, I suggest to update to the latest version of tex (Tex Live 2012) and useglossaries
which comes with the distribution. Here is the documentation and a starting guide.Best, Tom.
aline
Thank you!!!
I spent 2 hours messing around with this trying to get the nomenclature package to work, and website after website failed to help me figure out what I was doing wrong.
Turns out I was missing the “-t document.glg” in <>. (Not stated in any manuals that I came across!) As soon as I added that, it finally compiled correctly.
Much appreciated advice.
-AK
tom
Hi AK. Thanks for the feedback! Best, Tom.
Onezimo
Just find to do this “makeindex document.glo -s document.ist -t document.glg -o document.gls” here!!! thank you a lot!!!!!
tom
Great! Thanks for the feedback. Tom.
pengcheng
This is cool, and I just had a quick question, how can I remove the word
“Glossary” on the top left for every glossary page. I searched around, haven’t found any useful simple command can do this.
tom
Hi there!
I suggest you move to either the glossaries package or the nomencl package, which I introduced in this article. Using the latter, you can easily remove the title through:
Cheers, Tom.
kjellski
Just to let you know, for the toc, you could also use
at definition time 🙂
tom
Cool, thanks for your comment. Cheers, Tom.
ariblogger
Hi! I’m kind of new to LaTex, and not much of a techno-geek (obviously, I’m saying this in a positive way, haha), so I’m stuck here!
I want to make a glossary, and I’m using TexMaker for Windows, so I can’t figure it out where should I put the “\glossary{name={entry name}, description={entry description}}” lines. Where are they supposed to go? In another file?
Thanks and sorry for the dumb question!
tom
Sorry for the late reply.
Everything goes into the main tex file. The only non-standard thing you’ll have to do is run
makeindex
. There is probably a way to do that from within TeXMaker.HTH,
Tom
hale
Hi Tom, thank you very much for this post, it is very useful. However I have a little problem in the output. Glossary entries are placed in the center whereas I would like them to be left-aligned. Could I fix it?
Also, another problem is that there are some inhomogeneous spaces between some of the entries. Any idea why? ( I use the same format and placing for each entry.)
It is kind of urgent…
Thanks!!
tom
Hi Hale,
Please send a minimal working example to illustrate your problem and I will see what I can do.
Thanks, Tom
Michael
Hi,
nice article, but it would be useful to mention the it has been replaced by “glossaries”:
“The package [glossaries] supersedes the author‘s glossary package (which is now obsolete), and a conversion tool is provided.”
tom
Hi Michael,
Thanks for bringing this issue up. I have been thinking about updating the post, but haven’t found the time to do so yet. Will do my best to update the old text or add another post on glossaries…
Thanks again,
Tom