emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Small patch: add \usepackage{iftex} when exporting to LaTeX
@ 2024-03-23  7:18 Pedro Andres Aranda Gutierrez
  2024-03-23 14:33 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Pedro Andres Aranda Gutierrez @ 2024-03-23  7:18 UTC (permalink / raw)
  To: Org Mode List, Ihor Radchenko


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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-23 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-23  7:18 Small patch: add \usepackage{iftex} when exporting to LaTeX Pedro Andres Aranda Gutierrez
2024-03-23 14:33 ` Ihor Radchenko

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).