Hi Ihor,

here is my first patch in the process of coming closer to pandoc's way of
managing fonts for LaTeX export.

Best, /PA

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

Sagen's Paradeiser, write BE!
Year 1 of the New Koprocracy
From 7f29f18060b41f9200567248c5462898eba14547 Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" <paag...@gmail.com>
Date: Sun, 20 Apr 2025 11:04:23 +0200
Subject: [PATCH] Use the same packages as pandoc
Preparing the font management infrastructure, align with pandoc

* lisp/org.el: org-latex-default-packages-alist use the same packages
as pandoc. It seems a well-accepted standard for fonts when exporting
to any LaTeX flavour. XeTeX will uses ~math-spec~ whereas LuaLaTeX
uses ~unicode-math~.

Link: https://lists.gnu.org/archive/html/emacs-orgmode/2025-04/msg00335.html
---
 etc/ORG-NEWS | 3 +++
 lisp/org.el  | 8 ++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 980838392..1b0097d5b 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -335,2 +335,2 @@ This option makes ~org-cite~'s ~basic~ insert processor use
 It can also be set to dynamically compute ~crm-separator~ so that the
 separator does not appear in completion candidates.

+*** LaTeX export font management is changing
+Exporting to LaTeX and Beamer is undergoing a gradual change:
+1. Default font management packages follow [[https://github.com/jgm/pandoc/blob/main/data/templates/fonts.latex][~pandoc~ conventions]]
 ** New functions and changes in function arguments

 # This also includes changes in function behavior from Elisp perspective.
diff --git a/lisp/org.el b/lisp/org.el
index 78e8c0692..44d0bec75 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3533,13 +3533,13 @@ header, or they will be appended."
 	  (default-value var)))

 (defcustom org-latex-default-packages-alist
-  '(;; amsmath before fontspec for lualatex and xetex
-    (""     "amsmath"   t ("lualatex" "xetex"))
-    ;; fontspec ASAP for lualatex and xetex
-    (""     "fontspec"  t ("lualatex" "xetex"))
+  '(;; fontspec is loaded by either of these
+    (""     "mathspec"     t ("xetex"))
+    (""     "unicode-math" t ("lualatex"))
     ;; inputenc and fontenc are for pdflatex only
     ("AUTO" "inputenc"  t ("pdflatex"))
     ("T1"   "fontenc"   t ("pdflatex"))
+    (""     "textcomp"   t ("pdflatex")) ;; to provide Euro et.al.
     (""     "graphicx"  t)
     (""     "longtable" nil)
     (""     "wrapfig"   nil)
--
2.34.1

Reply via email to