Compile XeLaTeX tex file with latexmk

$ latexmk -v
Latexmk, John Collins, 27 July 2010. Version 4.18

I run with the command:

latexmk -pdf -e '$pdflatex=q/xelatex %O %S/' foo.tex

which is basically the same as the answers from andre-r and Kay, but only from the command-line.


That's my quick fix, so that latexmk works with XeLaTeX:
Add

`elsif (/^-xelatex$/) { $pdf_mode = 1; $pdflatex = 'xelatex %O %S'; $pdf_previewer =
'start evince %O %S';}`

above (or near) the line

`elsif (/^-pdf$/) { $pdf_mode = 1; }`

.

Then you can call latexmk -xelatex file.tex. Works, but I didn't test it extensively. Should work similarly with lualatex.


latexmk -v
Latexmk, John Collins, 16 January 2010. Version 4.13a

I put

$pdflatex = 'xelatex --shell-escape %O %S';

in my .latexmkrc file. This is a workaround, of course. But it works for me when I call

latexmk -pvc -pdf MyXetexFile

latexmk --xelatex job.tex Now the argument is passable in this simple form.