I'm trying to use latexmk with XeLaTeX. When I type:

latexmk.pl -xelatex -pvc -cd -auxdir=TeXAux myfile.tex

it all works fine. However I would like to use switches with XeLaTeX, such as synctex=1, and when I type:

latexmk.pl -pdflatex="xelatex --synctex=1 %O %S" -pvc -cd -auxdir=TeXAux myfile.tex

I have the following message from fontspec:

Fatal fontspec error: "cannot-use-pdftex"
The fontspecpackage requires either XeTeX or LuaTeX to function.

What did I not understand?

  • I get no error of this kind. What version of latexmk do you have?
    – egreg
    Nov 7 '13 at 17:16
  • Last MiKTeX's version: 4.37 (2 July 2013).
    – Bernard
    Nov 7 '13 at 23:16

OK. It works simply typesetting:

latexmk.pl -xelatex -synctex=1 -pvc -cd -auxdir=TeXAux myfile.tex

as I found with the help of

latexmk.pl -showextraoptions

However, I don't understand what was wrong with the previous command line…

  • I have the same version 4.37 (on Mac OS X), but, as I said, the other command line works too.
    – egreg
    Nov 7 '13 at 23:18
  • 1
    To diagnose what happened with the previous command line, you should look very carefully at the resulting output from latexmk. It should say exactly what command line was used, and so you should see whether, for example, xelatex was actually invoked. But the new command line (with the -xelatex and -synctex=1 options) is usually a better way to go. Nov 8 '13 at 18:51

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.