emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org.el (org-format-latex-header): put DEFAULT-PACKAGES before PACKAGES
@ 2022-06-13  9:12 Sébastien Miquel
  2022-06-14 13:21 ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Sébastien Miquel @ 2022-06-13  9:12 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 198 bytes --]

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

[-- Attachment #2: 0001-org.el-org-format-latex-header-put-DEFAULT-PACKAGES-.patch --]
[-- Type: text/x-patch, Size: 921 bytes --]

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] org.el (org-format-latex-header): put DEFAULT-PACKAGES before PACKAGES
  2022-06-13  9:12 [PATCH] org.el (org-format-latex-header): put DEFAULT-PACKAGES before PACKAGES Sébastien Miquel
@ 2022-06-14 13:21 ` Ihor Radchenko
  2022-06-14 14:26   ` Sébastien Miquel
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2022-06-14 13:21 UTC (permalink / raw)
  To: sebastien.miquel; +Cc: emacs-orgmode

Sébastien Miquel <sebastien.miquel@posteo.eu> 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] org.el (org-format-latex-header): put DEFAULT-PACKAGES before PACKAGES
  2022-06-14 13:21 ` Ihor Radchenko
@ 2022-06-14 14:26   ` Sébastien Miquel
  2022-06-16 12:19     ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Sébastien Miquel @ 2022-06-14 14:26 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] org.el (org-format-latex-header): put DEFAULT-PACKAGES before PACKAGES
  2022-06-14 14:26   ` Sébastien Miquel
@ 2022-06-16 12:19     ` Ihor Radchenko
  2022-06-17 12:19       ` Sébastien Miquel
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2022-06-16 12:19 UTC (permalink / raw)
  To: sebastien.miquel; +Cc: emacs-orgmode

Sébastien Miquel <sebastien.miquel@posteo.eu> 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] org.el (org-format-latex-header): put DEFAULT-PACKAGES before PACKAGES
  2022-06-16 12:19     ` Ihor Radchenko
@ 2022-06-17 12:19       ` Sébastien Miquel
  2022-06-18  4:50         ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Sébastien Miquel @ 2022-06-17 12:19 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 236 bytes --]

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

[-- Attachment #2: 0001-org.el-org-format-latex-header-put-DEFAULT-PACKAGES-.patch --]
[-- Type: text/x-patch, Size: 1319 bytes --]

From 72742cab341f66525e0acb0b92de65fb6d24c27f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= <sebastien.miquel@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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] org.el (org-format-latex-header): put DEFAULT-PACKAGES before PACKAGES
  2022-06-17 12:19       ` Sébastien Miquel
@ 2022-06-18  4:50         ` Ihor Radchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Ihor Radchenko @ 2022-06-18  4:50 UTC (permalink / raw)
  To: sebastien.miquel; +Cc: emacs-orgmode

Sébastien Miquel <sebastien.miquel@posteo.eu> 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-18  4:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-13  9:12 [PATCH] org.el (org-format-latex-header): put DEFAULT-PACKAGES before PACKAGES Sébastien Miquel
2022-06-14 13:21 ` Ihor Radchenko
2022-06-14 14:26   ` Sébastien Miquel
2022-06-16 12:19     ` Ihor Radchenko
2022-06-17 12:19       ` Sébastien Miquel
2022-06-18  4:50         ` Ihor Radchenko

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).