From 95806243e40d5f9f19a8db71e2b8b0cd0c5fdb68 Mon Sep 17 00:00:00 2001 From: TEC Date: Mon, 7 Jun 2021 00:46:09 +0800 Subject: [PATCH] ox-latex: Change default compiler to latexmk * lisp/ox-latex.el (org-latex-pdf-process): Check for the presence of latexmk when setting the default, and use it when available. Fall back to the current default. This is important for the incoming citation support, as PDF generation will now need to involve bibliography generation. By using latexmk this is taken care of for us. The -%latex part of the command is slightly hacky, but allows latexmk to behave more intelligently for non-pdflatex options. Note that latexmk also seems to care about the order of the arguments. --- lisp/ox-latex.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 9724b0d87..c761cfd7f 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1165,9 +1165,11 @@ (defcustom org-latex-bib-compiler "bibtex" :package-version '(Org . "9.0")) (defcustom org-latex-pdf-process - '("%latex -interaction nonstopmode -output-directory %o %f" - "%latex -interaction nonstopmode -output-directory %o %f" - "%latex -interaction nonstopmode -output-directory %o %f") + (if (executable-find "latexmk") + '("latexmk -f -pdf -%latex -interaction=nonstopmode -output-directory=%o %f") + '("%latex -interaction nonstopmode -output-directory %o %f" + "%latex -interaction nonstopmode -output-directory %o %f" + "%latex -interaction nonstopmode -output-directory %o %f")) "Commands to process a LaTeX file to a PDF file. This is a list of strings, each of them will be given to the @@ -1211,7 +1213,7 @@ (defcustom org-latex-pdf-process (const :tag "texi2dvi" ("cd %o; LATEX=\"%latex\" texi2dvi -p -b -V %b.tex")) (const :tag "latexmk" - ("latexmk -g -pdf -pdflatex=\"%latex\" -outdir=%o %f")) + ("latexmk -f -pdf -%latex -interaction=nonstopmode -output-directory=%o %f")) (function))) (defcustom org-latex-logfiles-extensions -- 2.31.1