From 0beed8846195717e6db051033cac8fd942f89c53 Mon Sep 17 00:00:00 2001 From: "Pedro A. Aranda Gutierrez" Date: Sun, 28 Jan 2024 17:51:23 +0100 Subject: [PATCH] Refine packages for font management * lisp/org.el: Change `org-latex-default-packages-alist' to refine font management depending on the latex compiler. Differentiate between pdflatex and lualatex/xetex packages for font management. lualatex/xetex should use fontspec instead of fontenc/inputenc. When using fontspec, you need to load amsmath before fontspec and you don't need amssymb. --- lisp/org.el | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 796545392..539a128f1 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3421,15 +3421,21 @@ header, or they will be appended." (default-value var))) (defcustom org-latex-default-packages-alist - '(("AUTO" "inputenc" t ("pdflatex")) + '(;; amsmath before fontspec for lualatex and xetex + ("" "amsmath" t ("lualatex" "xetex")) + ;; fontspec ASAP for lualatex and xetex + ("" "fontspec" t ("lualatex" "xetex")) + ;; inputenc and fontenc are for pdflatex only + ("AUTO" "inputenc" t ("pdflatex")) ("T1" "fontenc" t ("pdflatex")) ("" "graphicx" t) ("" "longtable" nil) ("" "wrapfig" nil) ("" "rotating" nil) ("normalem" "ulem" t) - ("" "amsmath" t) - ("" "amssymb" t) + ;; amsmath and amssymb after inputenc/fontenc for pdflatex + ("" "amsmath" t ("pdflatex")) + ("" "amssymb" t ("pdflatex")) ("" "capt-of" nil) ("" "hyperref" nil)) "Alist of default packages to be inserted in the header. @@ -3440,7 +3446,9 @@ incompatibility with another package you are using. The packages in this list are needed by one part or another of Org mode to function properly: +- fontspec: for font and character selection in lualatex and xetex - inputenc, fontenc: for basic font and character selection + in pdflatex - graphicx: for including images - longtable: For multipage tables - wrapfig: for figure placement @@ -3448,8 +3456,8 @@ Org mode to function properly: - ulem: for underline and strike-through - amsmath: for subscript and superscript and math environments - amssymb: for various symbols used for interpreting the entities - in `org-entities'. You can skip some of this package if you don't - use any of the symbols. + in `org-entities'. You can skip some of this package if you + don't use any of the symbols. - capt-of: for captions outside of floats - hyperref: for cross references @@ -15211,20 +15219,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