I've started using the make-glossaries package, and am creating more than one glossary. Unfortunately, my latexmk calls seem to skip calling makeglossaries, so my build doesn't conclude. I'm using a non-main
-type glossary, with:
\newglossary[nlg]{notation}{not}{ntn}{Notation and Abbreviations}
and the command-line I'm running to build my document is:
latexmk -pdf -outdir=aux/ -auxdir=aux/ -pdflatex="xelatex -shell-escape %O %S" my_doc
if I invoke this, the end of latexmk's console output is:
Output written on aux/my_doc.pdf (37 pages).
Transcript written on aux/my_doc.log.
Latexmk: Examining 'aux/my_doc.log'
=== TeX engine is 'XeTeX'
Latexmk: Found input bbl file 'aux/pubinfo.bbl'
Latexmk: Missing input file: 'my_doc.not' from line
'No file my_doc.not.'
Latexmk: Found input bbl file 'aux/my_doc.bbl'
Latexmk: Found input bbl file 'aux/pubinfo.bbl'
Latexmk: Log file says output to 'aux/my_doc.pdf'
Latexmk: Found bibliography file(s) [front/pubinfo.bib]
Latexmk: Found bibliography file(s) [back/general.bib]
Latexmk: All targets (aux/my_doc.pdf) are up-to-date
Now, I have read:
How to make Latexmk use makeglossaries?
but the .latexmkrc
file suggested there is not what I need:
add_cus_dep('glo', 'gls', 0, 'makeglo2gls');
sub makeglo2gls {
system("makeindex -s '$_[0]'.ist -t '$_[0]'.glg -o '$_[0]'.gls '$_[0]'.glo");
}
it uses makeindex
rather than makeglossaries
; and needs a dependency for each glossary file type. Can I replace it with something more appropriate, which actually does cause makeglossaries to work? Also, is it adapted to the use the aux/
subdir?
If not, what can I do to trigger the execution of makeglossaries?
Note:
To complete processing "semi-manually", I add the following commands after the first latexmk call:
makeglossaries -d aux/ my_doc
rm aux/my_doc.pdf
latexmk -pdf -outdir=aux/ -auxdir=aux/ -pdflatex="xelatex -shell-escape %O %S" my_doc
… and then everything proceeds fine. But without removing the .pdf, it still doesn't work (!)
Best Answer
The suggestion you mention for the
.latexmkrc
file is out-of-date. See the fileglossary_latexmkrc
in theexample_rcfiles
for the current recommendation. From what's in that file, the code for you to put in a.latexmkrc
file isThere's no simple way of persuading
latexmk
to know the extensions of the files for your notation glossary, so you have to add the appropriate custom dependency. But you don't need a new subroutine for it.The above code also works when you use an aux dir. That's done by the trick with
pushd
andpopd
.I've also added a line to specify that the glossary files are to be deleted when you do a clean-up.