I don't think it is much in the AUCTeX spirit to tune
LaTeX-command in order to specify that you want to use
pdflatex. AUCTeX knows about TeX engines and how to activate DVI or PDF mode depending on the engine. See the documentation of processor options, in particular about
(C-c C-t C-p) This command toggles the PDF mode of AUCTeX, a buffer-local minor mode which is enabled by default. You can customize TeX-PDF-mode to give it a different default or set it as a file local variable on a per-document basis. This option usually results in calling either PDFTeX or ordinary TeX.
User Option: TeX-engine
This variable allows you to choose which TeX engine should be used for typesetting the document, i.e. the executables which will be used
when you invoke the ‘TeX’ or ‘LaTeX’ commands. The value should be one
of the symbols defined in TeX-engine-alist-builtin or
TeX-engine-alist. The symbols ‘default’, ‘xetex’, ‘luatex’ and ‘omega’
are available from the built-in list.
User Option: TeX-engine-alist
Alist of TeX engines and associated commands. Each entry is a list with a maximum of five elements. The first element is a symbol used to
identify the engine. The second is a string describing the engine. The
third is the command to be used for plain TeX. The fourth is the
command to be used for LaTeX. The fifth is the command to be used for
the ‘--engine’ parameter of ConTeXt’s ‘texexec’ program. Each command
can either be a variable or a string. An empty string or nil means
there is no command available.
If you just want to change the engine or PDF vs. DVI mode for the current document, the easiest way is probably to use the Command → TeXing options menu, otherwise for your particular options mentioned here (
-synctex=-1 -aux-directory auto), I believe the following variable is the appropriate one:
User Option: TeX-command-extra-options
String with the extra options to be given to the TeX processor. For
example, if you need to enable the shell escape feature to compile a
document, add the following line to the list of local variables of the
%%% TeX-command-extra-options: "-shell-escape"
By default this option is not safe as a file-local variable because a
specially crafted document compiled with shell escape enabled can be
used for malicious purposes.
In your particular case, if you really want to customize the parameters you gave using Emacs file variables, you could use this:
%%% Local Variables:
%%% TeX-PDF-mode: t
%%% TeX-engine: default
%%% TeX-command-extra-options: "-synctex=-1 -aux-directory=auto"
If for instance you would like to use the LuaTeX engine instead of the default (which is normally pdfTeX for LaTeX documents), just replace
luatex. In such a case, if AUCTeX detects that you have a LaTeX document, it will compile it with the
lualatex command, thanks to
TeX-engine-alist-builtin, which gives the defaults for things you haven't overridden via
TeX-engine-alist-builtin is a variable defined in ‘tex.el’.
Its value is
((default "Default" TeX-command LaTeX-command ConTeXt-engine)
(xetex "XeTeX" "xetex" "xelatex" "xetex")
(luatex "LuaTeX" "luatex" "lualatex --jobname=%s" "luatex")
(omega "Omega" TeX-Omega-command LaTeX-Omega-command ConTeXt-Omega-engine))
Alist of built-in TeX engines and associated commands.
For a description of the format see ‘TeX-engine-alist’.
But for the selection of DVI vs. PDF mode, I believe I would rather use the Command → TeXing options menu or set the mode globally with something like this in your Emacs configuration:
;; Use nil for DVI mode
(setq-default TeX-PDF-mode t)
The following would also work but is less efficient if you have many TeX files opened when you start Emacs, because the hook is run every time for each TeX/LaTeX/etc. file:
If you use desktop.el in Emacs, beware that it saves and restores buffer-local values of variables. This can be very confusing when testing Emacs' init config dealing with variables that are automatically buffer-local when set (
TeX-PDF-mode is one of these, so this applies here).
In order to have AUCTeX use a directory that is different from your
auto dir and clearly belongs to AUCTeX, you might want to customize
TeX-style-local. I use something like this:
(defun my-TeX-mode-hook ()
(setq TeX-auto-local "auctex-auto"
;; Use the new dirs in `TeX-style-path' instead of the default ones,
;; otherwise AUCTeX won't find them.
(mapc #'(lambda (arg)
(when (member (car arg) TeX-style-path)
(delete (car arg) TeX-style-path)
(push (cdr arg) TeX-style-path)))
'(("auto" . "auctex-auto")
("style" . "auctex-style"))))
(add-hook 'TeX-mode-hook 'my-TeX-mode-hook)
Since it's a bit complicated, though, you may rather choose to rename your
auto to something else, or accept the possibility that there might be conflicts one day, between what AUCTeX writes there and what your use of
-aux-directory could cause to be written there (if
-aux-directory is only about the
.aux file, it's probably safe).