How to compile glossaries with arara without Perl?
Following Nicola Talbot's comment, and the output from arara
, we know that the makeglossaries
rule is really just a short cut for:
makeindex -s myfile.ist -t myfile.glg -o myfile.gls myfile.glo
As such, we can make an arara
do this for us by using @{getBasename(file)}
.
makeglossariesNP.yaml
!config
# Make glossaries *without perl* rule for arara
# author: Chris Hughes
# last edited by: cmh, March 3rd 2014
# https://tex.stackexchange.com/questions/163474/how-to-compile-glossaries-with-arara-without-perl
# requires arara 3.0+
#
# Sample usage
#
# % arara: makeglossariesNP
#
identifier: makeglossariesNP
name: makeglossariesNP
commands:
- <arara> makeindex -s @{getBasename(file)}.ist -t @{getBasename(file)}.glg -o @{getBasename(file)}.gls @{getBasename(file)}.glo
arguments: []
myfile.tex
% arara: pdflatex
% !arara: makeglossaries
% arara: makeglossariesNP
% arara: pdflatex
\documentclass{article}
\usepackage{glossaries}
\newglossaryentry{equation}{name=equation,description={an equation usually involves at least one variable, and
has two sides; typically we will try and solve an equation for one of the unknown variables}}
\newglossaryentry{expression}{name=expression,description={an expression usually involves at least one variable--
in contrast to an equation, an expression does not have two sides, and will often need to be simplified (not solved)
in some way}}
\makeglossaries
\begin{document}
\glsaddall
\printglossary
\end{document}
cmhughes's answer is best for general purposes, but you can also just use the makeindex
directive however you need to explicitly write the file names. If your LaTeX file is called myDoc.tex
then the following will work:
% arara: makeindex: {style: myDoc.ist, options: "-t myDoc.glg -o myDoc.gls myDoc.glo"}
(Avoid spaces in the file names.) That will just create the main
glossary. If you've used the acronyms
option you will need to have a similar line for the list of acronyms:
% arara: makeindex: {style: myDoc.ist, options: "-t myDoc.alg -o myDoc.acr myDoc.acn"}
Similarly if you have additional glossaries (either created explicitly via \newglossary
or via other package options such as index
).
If you want to sort by letter order instead of word order you need to add -l
to the options list.
(The advantage of the makeglossaries
script is that it reads the .aux
file to find out which glossaries the document has defined, what their corresponding file extensions are, and whether to use makeindex
or xindy
. TeX Live comes with its own Perl interpreter. The only inconvenience is for MiKTeX users, but MiKTeX and Perl Scripts (and one Python script) provides instructions for MiKTeX.)
Edit: arara
v4.0 has a makeglossarieslite
rule which can be used to invoke makeglossaries-lite.lua
, the Lua alternative to makeglossaries
. Since LuaTeX requires a Lua interpreter, one should already be available with modern TeX systems.
Although makeglossaries-lite.lua
doesn't have the full set of functions that makeglossaries
has, it still has the advantage of being able to pick up the glossary information from the .aux
file that an explicit call to makeindex
can't do and so will work with any number of custom glossaries defined within the document.