Ihor Radchenko writes:
Thanks for the clarification! Now, your patch makes much more sense. Can
you update the commit message explaining the above shortly and linking
to this thread?

See attached.

Thanks,

--
Sébastien Miquel
From 72742cab341f66525e0acb0b92de65fb6d24c27f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= <sebastien.miq...@posteo.eu>
Date: Mon, 13 Jun 2022 11:04:34 +0200
Subject: [PATCH] org.el (org-format-latex-header): put DEFAULT-PACKAGES before
 PACKAGES

* lisp/org.el (org-format-latex-header): put DEFAULT-PACKAGES before
PACKAGES, as per org-latex-packages-alist's documentation.

`org-format-latex-header' is mostly used to generate in-buffer images
from LaTeX fragments. For LaTeX document export, the header is
generated by `org-splice-latex-header' ond `org-latex-classes' instead
and the default and documented behaviour is to insert DEFAULT-PACKAGES
before PACKAGES.

See also
https://list.orgmode.org/877d5gg5rt.fsf@localhost/T/#m2ad2f3b1509e1af72016e8e6fad3557ff3083046
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 95dff27ad..0acfa4846 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3248,8 +3248,8 @@ images at the same place."
 
 (defcustom org-format-latex-header "\\documentclass{article}
 \\usepackage[usenames]{color}
-\[PACKAGES]
 \[DEFAULT-PACKAGES]
+\[PACKAGES]
 \\pagestyle{empty}             % do not remove
 % The settings below are copied from fullpage.sty
 \\setlength{\\textwidth}{\\paperwidth}
-- 
2.36.1

Reply via email to