I'm using AUCTeX 11.86 in Emacs 23.3.1, under Linux (Ubuntu 12.04.1). Some of my files I compile with LaTeX, a few with XeLaTeX. I'd just like to be able to enter C-c C-c to compile, and have the file itself tell AUCTeX which processor to use. Is there a variable I can set in a file which will allow me to do this?

  • 3
    M-x add-file-local-variable RET TeX-engine RET xetex RET
    – giordano
    Commented Sep 17, 2013 at 10:37
  • M-x TeX-engine-set RET xetex RET will change the engine for that file regardless of whether any 'engine' variables are set.
    – jon
    Commented Sep 17, 2013 at 14:15

1 Answer 1


You could insert at the end of your .tex file:

%%% Local Variables: 
%%% mode: LaTeX
%%% TeX-PDF-mode: t
%%% TeX-engine: xetex 
%%% End:

and type C-c C-n to activate the style change. And next time you open the file in an emacs buffer, the engine will already be set to xetex.

[earlier wrong answer replaced by this one provided by Sean Allred in his comment]

  • 1
    You can also C-c C-n to apply the changes then and there. Also, mode: TeX-PDF works only on technicality; the appropriate lines are mode: LaTeX and TeX-PDF-mode: t. Commented Sep 18, 2013 at 1:54
  • @SeanAllred: replaced my answer by yours!
    – user4686
    Commented Sep 18, 2013 at 6:37
  • 2
    @Alasdair I don't think this is the preferred method. Use the TeX-engine = xetex method, instead.
    – egreg
    Commented Sep 18, 2013 at 10:34
  • 1
    @Alasdair That is, if you want to use XeTeX. See the documentation for TeX-engine for a full list of supported values. Commented Sep 18, 2013 at 14:05
  • 1
    (Saith the maintainer of AUCTeX.) There may be many things that AUCTeX does that are engine-dependent, and it is the obvious way to check which engine a document expects (for hooks, etc). Setting the compilation command directly bypasses this and could have unpleasant side-effects, ones that could be avoided be abstracting the command into the idea of a TeX-engine. :-) Commented Sep 19, 2013 at 0:58

You must log in to answer this question.

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