I am a big fan of latexmk and lately I have been looking a bit towards LuaTeX. However I am yet to find a way to get the functionality of latexmk (mainly recompilation on changes and automatic rerun an appropriate number of times to resolve cross references and such) for LuaTex. Is there something similar and if not how do you LuaTeX people survive without it? :)

3 Answers 3


You can use Lua(La)TeX with latexmk by setting the -pdflatex parameter:

-pdflatex=<program> - set program used for pdflatex.
(replace '<program>' by the program name)

So latexmk should call lualatex instead of pdflatex if you invoke it like this:

latexmk -pdflatex=lualatex -pdf <texfile>

or with newer versions of latexmk there is direct Lua(La)TeX/XeLaTeX support:

Use lualatex. That is, use lualatex to process the source file(s) to pdf (in place of pdflatex).
This option is exactly equivalent to specifying the following sequence of options:
-pdflatex="lualatex %O %S" -pdf -dvi- -ps-

  • 2
    How can one pass --shell-escape?
    – koppor
    Mar 8, 2018 at 20:52

Instead of adding the -lualatex flag to each application of latexmk, you could place the following

$pdflatex = 'lualatex -file-line-error %O %S';
$pdf_mode = 1;

in an '.latexmkrc' file. This file should reside in your home folder, if you use lualatex in all your jobs, or in the folder(s) where your lualatex jobs are.

More generally, you will find a host of examples and boilerlate code for .latexmkrc in the respective CTAN repository


Since version 4.51 of latexmk, you can use the following .latexmkrc:

$pdf_mode = 4;
$postscript_mode = $dvi_mode = 0;
  • 1
    For the second line $postscript_mode = $dvi_mode = 0;, I think both default to false/0 anyway.
    – Alex Povel
    Mar 23, 2019 at 22:17
  • For more info latexmk man page: "$pdf_mode [0] ... If equal to 4, generate a pdf version of the document using lualatex".
    – eugenhu
    Oct 2, 2021 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.