How can I find out which TeX engine my AUCTeX uses? How can I change the TeX engine my AUCTeX uses (specifically, (a) to LuaTeX, (b) to XeTeX)? Following this post, I tried to inspect the value of the variable TeX-engine, however this variable isn't defined in my environment, even though AUCTeX works fine.


This variable is not defined (or set) until AUCTeX is loaded. On your system, it seems to be deferred until it is first needed ("autoloaded" in emacs slang).

More precisely:

  • you start emacs, some initialization happens during which emacs notes that LaTeX-mode is defined in some .el file in the AUCTeX package;
  • if you try to inspect TeX-engine at this point, the variable has never been defined;
  • if you now open a .tex file, emacs turns on LaTeX-mode, which is not loaded yet. So emacs loads the AUCTeX package, and now TeX-engine is defined;
  • at this point, you can inspect TeX-engine from any buffer of the emacs session (it will have a default value in all buffers, and a buffer-local value in AUCTeX buffers).

For your second question, you can use the command TeX-engine-set, which will apply the setting to the current buffer. To apply the setting to the default value (for all buffers), set the variable through the customize interface.

Your Answer

