It is not hard to change the default compilation engine in TeXstudio from PDFLaTeX to LuaLaTeX (or any other engine for that matter). But if I only want to use LuaLaTeX for a single document, it gets tedious to go into the menus and find the LuaLaTeX option all the time. And the command line approach is also more time-consuming.

Is there some clever way to tell TeXstudio to always compile this (and only this) document using LuaLaTeX?

  • 2
    you can define a shortcut for example (F10 if you don't use glossary)
    – touhami
    Commented Apr 4, 2015 at 9:02

2 Answers 2


Just insert the “magic comment”

% !TeX program = lualatex

at the beginning of your .tex file.

  • 1
    And this works regardless of what editor I use?
    – Gaussler
    Commented Apr 4, 2015 at 8:43
  • 1
    It may work with some other editors, but not all. It doesn't work for my own preferred editor, for example: TeXShop (on Mac OS X). The magic comment for TeXShop would have been % !TEX TS-program = LuaLaTeX Commented Apr 4, 2015 at 8:47
  • 2
    To elaborate on my previous comment, the magic command syntax for TeXStudio seems to work also for TeXworks: texdev.net/2011/03/24/texworks-magic-comments. I've just tried it with TeXmaker, unsuccessffuly. Commented Apr 4, 2015 at 8:56
  • @fpast TeXmaker doesn't appear to support the directives, see our LaTeX IDE list.
    – yo'
    Commented Apr 4, 2015 at 9:23
  • 3
    For more details what can configure with "magic comments" in TeXstudio see the manual: texstudio.sourceforge.net/manual/current/… Commented Apr 5, 2015 at 16:04
  • You click on options
  • You go got "Build" side tab
  • And change "Default Compiler" to LuaLaTeX

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .