## 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: \documentclass{article} \usepackage[english]{babel} \usepackage{hyperref} %Glossaries \usepackage{glossaries} % after hyperref % meaning of extensions: l[og], i[n], o[ut] \newglossary[col]{constant}{coi}{coo}{Constant} \makeglossaries % Entries \newglossaryentry{x}{name={$X$}, description={Unknown value}} \newglossaryentry{pi}{type=constant, name={$\pi$}, description={$3.14\$}} \begin{document} \glsaddall \printglossaries \end{document}

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).

Glossary
$X$   Unknown value. 1

Constant
$\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.