Script for LaTeX’ glossaries (for Mac)

Package glossaries.sty allows to create a default glossary (titled ‘Glossary’), but it’s also possible to create other ones. First, we’re going to need a script to modify the appearance of TeXShop with an extra option, mkglo in the drop down menu next to button Typeset (in the window of the *.tex file). That’s the main point of this post. Second, we’ll show the Tex file. Third, the steps to typeset it with the resulting output. Fourth, some remarks.

1. Script

In order to process a *.tex file that defines a new glossary  the manual specifies two ways. One is to use package mainindex. The other is to use a script that comes with the glossaries package makeglossaries. The latter takes care of the overhead, but it’s not obvious where to find it. So we do:

$ sudo find / -name "makeglossaries"

and put the result on the RHS of EXEC in the following script we save as mkglo:

EXEC = "/usr/local/texlive/2011/texmf-dist/scripts/glossaries/makeglossaries"
bfname=$(dirname "$1")/"`basename "$1" .tex`"
$EXEC $bfname

To integrate this scrip into TeXShop, copy it to ~/Library/TeXShop/Engine and from there, do

$ chmod a+x mkglo

Option mkglo should appear in the drop down list next to the button Typeset inside any *.tex window of TeXShop.

2. *.tex file

Let’s say we write an article that contains variables that we describe in the default glossary, ‘Glossary’, and create a custom glossary, ‘Constant’, for constants:

\usepackage{glossaries} % after hyperref
% meaning of extensions: l[og], i[n], o[ut]
% Entries
\newglossaryentry{x}{name={$X$}, description={Unknown value}}
\newglossaryentry{pi}{type=constant, name={$\pi$}, description={$3.14$}}

3. Run

From the window of the *.tex file just created, successively select Latex, mkglo and Latex in the drop down list, clicking on the button Typeset after each selection. That should display the following output in a pdf file (or dvi, depending on the settings).

X   Unknown value. 1

\pi   3.14. 1

4. Remarks

  • To create the categories Variable and Constant consider using, instead, the package’s sub-entries feature (it’s not quite the same, though)
  • Acknowledgment: the blog post Creating glossaries in TeXShop in Mac.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s