emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Timothy <tecosaur@gmail.com>
To: org-mode-email <emacs-orgmode@gnu.org>
Subject: [PATCH] Change default latex compiler to latexmk
Date: Mon, 07 Jun 2021 00:55:03 +0800	[thread overview]
Message-ID: <87sg1v3pco.fsf@gmail.com> (raw)

[-- 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


             reply	other threads:[~2021-06-06 16:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-06 16:55 Timothy [this message]
2021-06-29 14:32 ` [PATCH] Change default latex compiler to latexmk Bruce D'Arcus
2021-06-30 10:48   ` Bastien
2021-06-30 11:14     ` Bruce D'Arcus
2021-07-09 12:30       ` Bruce D'Arcus
2021-07-09 14:17         ` Bastien
2021-07-09 14:25           ` Timothy
2021-07-09 15:03             ` Bastien
2021-07-09 16:41               ` Timothy
2021-07-09 16:50                 ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sg1v3pco.fsf@gmail.com \
    --to=tecosaur@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).