Tuesday, October 6, 2009

Glossaries package in Texnic Center on Windows

Okay, yesterday I posted about how to set up and use the glossaries package with TexShop on a Mac. Here is the Windows version using TexnicCenter. This is basically a condensed version of Nicole Talbot's (creator of the glossaries package) post on the same matter:

If your TexnicCenter frontend is using the MikTex tex distribution, you can use the MikTix package browser to install packages (very easy to do, and the recommended method.) Otherwise you can install them manually from CTAN.

Using your preferred method, install the following packages:


* ifthen
* xkeyval at least version 2.5f (2006/11/18)
* xfor
* amsgen (part of amstex)


Make sure you have the following in your preamble:



\usepackage[acronym]{glossaries}%makes a separate acronym list

\makeglossaries


If you want your terms in your text to be hyperlinked to their definition (way cool), add the following BEFORE \usepackage{glossaries}:


\usepackage[colorlinks]{hyperref}


Now, as mentioned in the yesterday's post, you can either define terms and acronyms in your preamble, or have them as separate tex files and use the \include{} command.

When you get to the location in your main document (after the \begin{document}) where you want your glossary to be, simply add the command:


\printglossaries


Now, here is where it can get a bit tricky. You need to build the glossary file first, and there really isn't an easy way to simply add an engine to TexnicCenter (at least not that I found). Glossaries uses a Perl script to build, so I found the easiest way to do this is to make sure I have Perl installed on my machine (recommend Active Perl, they have windows installers). There are other ways to build the file using makeindex or xindy commands (see Nicola's post, but you have to run them 3 times for every type of glossary file, and the Perl way is just easier and faster.



Once you are good to go with Perl installed, open a command prompt (start->run->cmd) and navigate to the directory with your Tex files.

Type the following at the command prompt (you do not need to include a filename extension):


makeglossaries filename


You should see a bunch of stuff fly by on the screen indicating your glossary file was created. Now simply go back to TexnicCenter and build the file as you normally would, and Viola!, you should have a document with a glossary file.

4 comments:

  1. You are a genius! Thank you so much

    ReplyDelete
  2. This really helped my Thesis a lot!

    With kind regard from the Netherlands

    ReplyDelete