Org-mode mailing list
 help / color / mirror / Atom feed
* [PATCH] Change default latex compiler to latexmk
@ 2021-06-06 16:55 Timothy
  0 siblings, 0 replies; only message in thread
From: Timothy @ 2021-06-06 16:55 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]

Hey all,

From the earlier discussion on this, I got feeling a consensus had
reached that this is a good idea, as long as we check that latexmk is
available first.
As such, here is a patch changing the default LaTeX compiler to latexmk
--- as long as it's available. For what it's worth I've been using this
exact command in my personal config for months now, and it's worked
excellently.

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-latex-Change-default-compiler-to-latexmk.patch --]
[-- Type: text/x-patch, Size: 2093 bytes --]

From 95806243e40d5f9f19a8db71e2b8b0cd0c5fdb68 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-06 16:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-06 16:55 [PATCH] Change default latex compiler to latexmk Timothy

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git