I often switch between compiling "classic" LaTeX and XeTeX documents.
Sublime Text 2 has a package called LaTeXTools that allows you to build LaTeX documents via a simple CmdB. Neat.
The build file LaTeX.sublime-build obviously exists in the standard package folder, and you can copy it to your User folder to customize it. Here, it allows you to change the arguments given to latexmk, namely to switch from pdflatex to xelatex, for example like this:
"cmd": ["latexmk", "-cd",
//"-e", "\\$pdflatex = 'pdflatex %O -interaction=nonstopmode -synctex=1 %S'",
"-e", "\\$pdflatex = 'xelatex %O -interaction=nonstopmode -synctex=1 %S'",
//"-silent",
"-f", "-pdf"],
Now, it's very tedious having to do that every time I open up another document – open my build preferences, comment out the one line, save, etc.
Ideally, I'd like to be able to switch the engine
… automatically – TextMate for example somehow does that, and I can compile both LaTeX documents and XeTeX documents with a simple CmdR, although the TextMate configuration is set to
pdflatex. Maybe it's somelatexmk.pl-fu, I don't know.… with a simple keyboard shortcut or setting – Maybe pressing CmdL, CmdX or similar. This would then toggle between
pdflatexandxelatexbuilding.
How could I set that up?
