On 26/09/2023 04:57, Thomas S. Dye wrote:
Aloha all,

Juan Manuel Macías <maciasch...@posteo.net> writes:

If so, Org should have native support of \DocumentMetadata, not
LATEX_PRE_HEADER or something similar.

If it were the only case of code before \documentclass, I would agree.
But, as I have already said above, the diversity of use cases makes the
implementation of /ad hoc/ solutions unviable, in my opinion.

FWIW, I agree with Juan Manuel here and would welcome a straightforward way to insert material before the header.

I just have checked that a dirty hack with a few lines of code for `org-export-filter-final-output-functions' allows to insert arbitrary text to the beginning of export result. Perhaps a more elegant solution exists, but I admit it is not a straightforward way. At least it is possible.

I do not mind that generation of preamble should be more flexible, but I consider LATEX_PRE_HEADER as an ad hoc solution, so I am trying to find a better variant. That is why I asked for details concerning particular use cases.

I remember recipes like "put \usepackage{cmap} immediately after \documentclass" (nowadays this particular one should not be necessary). So I would prefer to avoid keywords per each chunk of preamble code.

\begin{filecontents*} from the original post is not convincing. \DocumentMetadata perhaps should be supported out of the box.

I would consider some kind of templates that use predefined fragments

#+LATEX_REPLACE_TEMPLATE: :preamble mypreamble
#+name: mypreamble
#+begin_src latex :exports none :noweb yes

with ability to use fine grain snippets instead

#+LATEX_REPLACE_TEMPLATE: :preamble detailedpreamble
#+name: detailedpreamble
#+begin_src latex :exports none :noweb yes

I hope, something similar may be made more readable than series of LATEX_HEADER & Co lines.

Reply via email to