From f2d2e3abeb47cebaecec010493939d64a7ac2fd4 Mon Sep 17 00:00:00 2001 From: "Pedro A. Aranda" 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