[Tex/LaTex] Latexmk and fontspec

fontspeclatexmk

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.
&c.

What did I not understand?

Best Answer

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…