|
| From: | Max Nikulin |
| Subject: | Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword |
| Date: | Tue, 26 Sep 2023 22:39:46 +0700 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 |
On 26/09/2023 04:57, Thomas S. Dye wrote:
Aloha all, Juan Manuel Macías <maciaschain@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
\providecommand{\pdfxopts}{x-1a}
<<ox-latex-template-preamble>>
#+end_src
with ability to use fine grain snippets instead
#+LATEX_REPLACE_TEMPLATE: :preamble detailedpreamble
#+name: detailedpreamble
#+begin_src latex :exports none :noweb yes
<<ox-latex-template-DocumentMetadata>>
\PassOptionsToPackage...
<<ox-latex-template-documentclass>>
\usepackage{cmap}
\usepackage[english,<<ox-template-language>>]{babel}
<<ox-latex-template-usepackage>>
#+end_src
I hope, something similar may be made more readable than series of
LATEX_HEADER & Co lines.
| [Prev in Thread] | Current Thread | [Next in Thread] |