I like latexmk but I use a variety of engines on files in the same folder. I'm trying to write a latexmkrc file that will look in the first few lines of the tex file for something like
% !TEX TS-program=xelatex
and then decide which tex engine to run for that file.
I know that the configuration variable $pdf_mode can determine which engine to use, but I'd like to do it dynamically for each target tex file. It seems like overriding the right subroutine could work. I tried reading the latexmk.pl source code, but it is several thousand lines long and I'm having trouble finding the right place.
.latexmkrc; 2) processes the command line arguments; 3) parses input files given in the command line. To have.latexmkrcparse the input file I think you would need it to do 2, 3, and then 1, otherwise.latexmkrcdoesn't yet know about input files... – Phelype Oleinik Oct 20 '19 at 12:46~/Library/TeXShop/Engines/inactive/Latexmk. You can open~/Library/TeXShopwith the menu item in the TeXShop menu. – Herb Schulz Oct 20 '19 at 17:16:-)I think thatTS-programis somewhat of a standard syntax, based on this answer. It lists several IDEs that respect the directive, despite the "namespacing" prefix. – Matthew Leingang Oct 21 '19 at 13:50