Making a texindy Engine
Here's what your texindy.engine should look like.
#! /bin/bash
PATH=/Library/TeX/texbin:/usr/local/bin:${PATH}
bfname=${1%\.*}
texindy -g "$bfname".idx
Make sure you set the executable bit on the file. In the Terminal type:
chmod +x ~/Library/TeXShop/Engines/texindy.engine
Making a texindy rule for arara
An alternative way to do this (although the two approaches are not incompatible) is to make an arara rule to run texindy. We can do this modelled after the makeindex rule given in the arara manual.
First, move the arara.engine from the Inactive folder to the Engines folder in ~/Library/TeXShop if you haven't already.
Then, you need to make a local configuration file for arara to tell it where to find your custom rules. This should be saved as ~/araraconfig.yaml (i.e., in your home folder.)
Make a directory for your local rules somewhere in your home folder. For example if you make a folder arara in your home folder you would put the following, but the folder can be anywhere (for example, mine is in my Dropbox folder so that all my Macs can find it.) You just need to specify the place in this file.
!config
paths:
- /Users/andy/arara
Now in the arara folder you've created, we can add the following rule called texindy.yaml
!config
identifier: texindy
name: texindy
command: texindy @{style} "@{ getBasename(file) }.idx"
arguments:
- identifier: german
flag: <arara> @{ isTrue( parameters.german, "-g" ) }
This is an arara rule that will allow you to call texindy with arara. I've set up the rule to be able to pass the -g option; if you need other options you will need to add them similarly to the rule.
Now in your source document you can put the following, which should do all the necessary runs for you automatically. (You may need to adjust the order.)
%!TEX TS-program = arara
% arara: pdflatex
% arara: bibtex
% arara: pdflatex
% arara: texindy: { style: german }
% arara: pdflatex
\documentclass{book}
...
\begin{document}
...
\end{document}
~/Library/TeXShop? Use the Go menu from the Finder or the terminal to get there. – Alan Munn Jun 24 '17 at 21:42.latexmkrcfile to allow thelatexmkengines to runtexindyinstead ofmakeindex. See Why latexmk does ignore my (index) custom dependency and subroutine? for details. For how to make an engine in TeXShop see Do we need to manually invoke pythontex? TeXShop Engine: PythonTeX with XeLaTeX. – Alan Munn Jun 24 '17 at 21:48arara, in which case you would use theararaengine, but need to write your owntexindyrule forarara. See Using arara with texcount for an example. – Alan Munn Jun 24 '17 at 22:05~/Libraryin MacOS in Finder, click theGomenu and then hold down theoptionkey. "Library" will magically appear. – Teepeemm Feb 07 '23 at 15:06