all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Pedro Andres Aranda Gutierrez <paaguti@gmail.com>
To: Org Mode List <emacs-orgmode@gnu.org>,
	Ihor Radchenko <yantar92@posteo.net>
Subject: Small patch: add \usepackage{iftex} when exporting to LaTeX
Date: Sat, 23 Mar 2024 08:18:52 +0100	[thread overview]
Message-ID: <CAO48Bk8Q15GN+MHSHxv3GVzUpue4Tx2Q9DsjkYdXhxrefSTMJg@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 455 bytes --]

Hi

attached is a small patch to include package iftex to latex exports. Since
we support several
compilers, it is useful to have this package to detect the compiler in
included latex files.

Best, /PA

-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet

[-- Attachment #1.2: Type: text/html, Size: 816 bytes --]

[-- Attachment #2: 0001-Add-iftex-package-when-ixporting-to-LaTeX.patch --]
[-- Type: text/x-patch, Size: 2705 bytes --]

From f2d2e3abeb47cebaecec010493939d64a7ac2fd4 Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" <paaguti@gmail.com>
Date: Sat, 23 Mar 2024 08:13:46 +0100
Subject: [PATCH] Add iftex package when ixporting to LaTeX

---

* org.el: Add package iftex to LaTeX preamble. This is useful to detect
  the compiler in customisation LaTeX code included by the user.

etc/ORG-NEWS |  7 +++++++
 lisp/org.el  | 11 ++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index ca744b932..de0c208da 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -945,6 +945,13 @@ even though it does not have its own ID.  By giving files top-level id
 properties, links to headlines in the file can also be made more
 robust by using the file id instead of the file path.

+*** Added package ~iftex~ when exporting LaTeX documents
+
+When exporting LaTeX documents, add =\usepackage{iftex}= at the
+beginning. Since we support several compilers, the user might
+need to detect which one if active in supporting personal TeX
+customisation code.
+
 ** New features
 *** =ob-tangle.el=: New flag to remove tangle targets before writing

diff --git a/lisp/org.el b/lisp/org.el
index 909ce0024..8ac7340c5 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3445,7 +3445,8 @@ header, or they will be appended."
 	  (default-value var)))

 (defcustom org-latex-default-packages-alist
-  '(;; amsmath before fontspec for lualatex and xetex
+  '((""     "iftex"     nil) ;; include iftex when generating documents
+    ;; amsmath before fontspec for lualatex and xetex
     (""     "amsmath"   t ("lualatex" "xetex"))
     ;; fontspec ASAP for lualatex and xetex
     (""     "fontspec"  t ("lualatex" "xetex"))
@@ -15319,20 +15320,20 @@ INCREMENT-STEP divisor."
 	(setq hour (mod hour 24))
 	(setq pos-match-group 1
               new (format "-%02d:%02d" hour minute)))
-
+
        ((org-pos-in-match-range pos 6) ;; POS on "dmwy" repeater char.
 	(setq pos-match-group 6
               new (car (rassoc (+ nincrements (cdr (assoc (match-string 6 ts-string) idx))) idx))))
-
+
        ((org-pos-in-match-range pos 5) ;; POS on X in "Xd" repeater.
 	(setq pos-match-group 5
               ;; Never drop below X=1.
               new (format "%d" (max 1 (+ nincrements (string-to-number (match-string 5 ts-string)))))))
-
+
        ((org-pos-in-match-range pos 9) ;; POS on "dmwy" repeater in warning interval.
 	(setq pos-match-group 9
               new (car (rassoc (+ nincrements (cdr (assoc (match-string 9 ts-string) idx))) idx))))
-
+
        ((org-pos-in-match-range pos 8) ;; POS on X in "Xd" in warning interval.
 	(setq pos-match-group 8
               ;; Never drop below X=0.
--
2.34.1

             reply	other threads:[~2024-03-23  8:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-23  7:18 Pedro Andres Aranda Gutierrez [this message]
2024-03-23 14:33 ` Small patch: add \usepackage{iftex} when exporting to LaTeX Ihor Radchenko

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

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

  git send-email \
    --in-reply-to=CAO48Bk8Q15GN+MHSHxv3GVzUpue4Tx2Q9DsjkYdXhxrefSTMJg@mail.gmail.com \
    --to=paaguti@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@posteo.net \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.