# How fix latexmk configuration to use index style file?

My index .ist style file is being ignored when I run latexmk with the following script...

#!/bin/bash
export TSBIN="$HOME/Library/TeXShop/bin/tslatexmk" export LTMKBIN="$HOME/Library/TeXShop/bin/tslatexmk"
export LTMKEDIT="$HOME/Library/TeXShop/bin" # make sure latexmkrcedit exists in bin if [ ! -e "${LTMKEDIT}/latexmkrcedit" ] ; then
cp "${TSBIN}/latexmkrcDONTedit" "${LTMKEDIT}/latexmkrcedit"
fi
# Use local rc file platexmkrc if it exists. p = project
export localrc=""
if [ -e ./platexmkrc ] ; then
export localrc="-r ./platexmkrc"
fi
"${LTMKBIN}"/latexmk -pdf -r "${LTMKEDIT}/latexmkrcedit" -r "${TSBIN}/pdflatexmkrc"${localrc} "$1"  ... where the referenced file platexmkrc in the source directory is: add_cus_dep('idx', 'ind', 0, 'makeidx2ind'); sub makidx2ind { system("makeindex —s '$_[0]'.ist -o '$_[0]'.ind '$_[0]'.idx");
};


The file latexmkrcedit referenced in the latexmk script consists mainly of commented sample configuration and uncommented add_cus_dep sections to handle glossaries and non-default-name indexes, but no other mention of makeindex.

The source file styledindex.tex is:

\documentclass{book}

\usepackage{makeidx}
\makeindex

\begin{document}

Some text here.
\index{apple}\index{apricot}
\index{banana}\index{blackberry}\index{blueberry}
\index{currant}\index{cherry}

\printindex

\end{document}


And the index style file styledindex.ist is:

headings_flag 1


Although the index is produced and printed, it does not have the A, B, C letter heads of each alphabetic group in the index.

On the other hand, if I just run latex, then

makeindex -s styledindex.ist styledindex


and finally latex again, the expected styling is applied to the index.

Why is the latexmk configuration not working here?

The latexmk script is an "engine" actually being run from within TeXShop. However, the same result -- ignoring the .ist file -- happens if I directly run that script latexmk from within the source directory (with no direct use of TeXShop).

• Away from pc, but have you tried just echoing the last line to see exactly what it outputs. Also I do not really understand the complexity of this, is all this really needed? Why are you doing a sys call for makeindex instead of just redefining $makeindex? – daleif Aug 5 '16 at 17:23 • @daleif: which "last line" do you suggest I echo? – murray Aug 5 '16 at 17:35 • @daleif: the "complexity" is to indicate how the local config file platexmkrc comes into play. – murray Aug 5 '16 at 17:36 • The bash script – daleif Aug 5 '16 at 17:43 • Herb Schulz has provided a solution: in the platexmkrc file, rather than add a add_cus_dep dependency — which cannot work because the call to makeindex is built in to TeXShop in another way — instead use in platexmkrc the command: $makeindex = "makeindex -s %R.ist %O -o %D %S"; – murray Aug 5 '16 at 22:08