Compile using latexmk in emacs
First, look at TeX-command-list
to ensure that it has an entry for latexmk
. If not, you need to add a line to this variable to allow the executable to be invoked by Auctex; unfortunately this variable is not well-documented (see the manual); I explain a little later.
Second, the default program is specified by the variable TeX-command-default
. Change this to the identifier used by TeX-command-list
, that is, the string just before the specification of the latexmk
command.
E.g., if one of the elements in TeX-command-list
is shown (which you can see using C-h v
):
("Latex Make" "latexmk %(-pdf) %t" TeX-run-TeX)
then TeX-command-default
needs to be "Latex Make"
.
The Auctex variable TeX-command-default
This variable isn't, as I said, well-documented. It should be a list of lists, each of which takes the form:
'("Handle" "external-command %(switches) %(arguments)" Auctex-handler)
where Handle
introduces a handle for facility to be run from the C-c C-c
dialog, so the list of handles in TeX-command-default
is the list of possible completions at this prompt. The second option is a form specifying the executable to be run, and Auctex-handler
is an Elisp function that handles the process and invokes the external command. TeX-run-TeX
and TeX-run-command
are the most common handlers, but there are special handlers for Bibtex, the spell checkers, etc.