Re: [PATCH] org.el (org-format-latex-header): put DEFAULT-PACKAGES before PACKAGES

2022-06-17 Thread Ihor Radchenko
Sébastien Miquel  writes:

> 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!
Applied onto main via 9fb9a2bdf with amendments to the commit message.
I have capitalized begging of sentences and added double space between
sentences as described in https://orgmode.org/worg/org-contribute.html

Best,
Ihor



Re: [PATCH] org.el (org-format-latex-header): put DEFAULT-PACKAGES before PACKAGES

2022-06-17 Thread Sébastien Miquel

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?= 
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



Re: [PATCH] org.el (org-format-latex-header): put DEFAULT-PACKAGES before PACKAGES

2022-06-16 Thread Ihor Radchenko
Sébastien Miquel  writes:

> Ihor Radchenko writes:
>> We actually have 2 options here:
>> 1. Change the docstring
>> 2. Change the template
>>
>> Can moving [PACKAGES] up break the existing configs? It might.
>> I am inclined to change the docstring instead.
>
> Thanks for having a look at this.
>
> It makes more sense for a package in PACKAGES to depend on a
> DEFAULT-PACKAGE than vice versa.
> ...
> I've also just checked that by default, for document export,
> DEFAULT-PACKAGES are inserted before PACKAGES --- the default
> templates from =org-latex-classes= do not include =DEFAULT-PACKAGES=
> nor =PACKAGES=, and in this case, =org-splice-latex-header= adds both
> default packages and packages at the end, with default packages coming
> first.
>
> =org-format-latex-header= is only used to generate images for preview,
> and in some cases by ob-latex to compile a document from a LaTeX src
> block.

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?

Best,
Ihor



Re: [PATCH] org.el (org-format-latex-header): put DEFAULT-PACKAGES before PACKAGES

2022-06-14 Thread Sébastien Miquel

Hi,

Ihor Radchenko writes:

We actually have 2 options here:
1. Change the docstring
2. Change the template

Can moving [PACKAGES] up break the existing configs? It might.
I am inclined to change the docstring instead.


Thanks for having a look at this.

It makes more sense for a package in PACKAGES to depend on a
DEFAULT-PACKAGE than vice versa.

=org-latex-packages-alist= and =org-latex-classes=' are two important
docstrings. People are likely to have crafted their configuration by
reading these documentation.

I've also just checked that by default, for document export,
DEFAULT-PACKAGES are inserted before PACKAGES --- the default
templates from =org-latex-classes= do not include =DEFAULT-PACKAGES=
nor =PACKAGES=, and in this case, =org-splice-latex-header= adds both
default packages and packages at the end, with default packages coming
first.

=org-format-latex-header= is only used to generate images for preview,
and in some cases by ob-latex to compile a document from a LaTeX src
block.

Regards,

--
Sébastien Miquel




Re: [PATCH] org.el (org-format-latex-header): put DEFAULT-PACKAGES before PACKAGES

2022-06-14 Thread Ihor Radchenko
Sébastien Miquel  writes:

> The attached patch puts DEFAULT-PACKAGES before PACKAGES in 
> org-format-latex-header, as per org-latex-packages-alist's and 
> org-latex-classes' documentations.
> ...
> -\[PACKAGES]
>  \[DEFAULT-PACKAGES]
> +\[PACKAGES]

Thanks!

We actually have 2 options here:
1. Change the docstring
2. Change the template

Can moving [PACKAGES] up break the existing configs? It might.
I am inclined to change the docstring instead.

Best,
Ihor



[PATCH] org.el (org-format-latex-header): put DEFAULT-PACKAGES before PACKAGES

2022-06-13 Thread Sébastien Miquel

Hi,

The attached patch puts DEFAULT-PACKAGES before PACKAGES in 
org-format-latex-header, as per org-latex-packages-alist's and 
org-latex-classes' documentations.


Regards,

--
Sébastien Miquel
From 983e35f19371e3ea85ed28bd46f36ea5a52a3950 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= 
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.
---
 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