I would like to use latexmk to compile my LaTeX documents in Emacs. Especially I need the Emacs functionality next-error
, which is typically called with C-x `,
Sorry I don't have the ability to comment, or I would just add this as a comment. Chris Conway's answer works, except that it should use TeX-run-TeX
instead of TeX-run-command
so that AucTeX knows to process the error messages.
(add-hook 'LaTeX-mode-hook (lambda ()
(push
'("Latexmk" "latexmk -pdf %s" TeX-run-TeX nil t
:help "Run Latexmk on file")
TeX-command-list)))
It might also be wise to add something like
'("%(-PDF)"
(lambda ()
(if (and (not TeX-Omega-mode)
(or TeX-PDF-mode TeX-DVI-via-PDFTeX))
"-pdf" "")))
to TeX-expand-list
and use "latexmk %(-PDF) %s"
so that it will work in both pdf and dvi mode. Personally, I find it easier to use customize especially when you are experimenting.