|
From: | Max Nikulin |
Subject: | Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword |
Date: | Mon, 2 Oct 2023 17:42:40 +0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 |
On 27/09/2023 02:12, Juan Manuel Macías wrote:
Max Nikulin writes: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.And it is also possible by simply defining a new class (in Org terminology, not LaTeX). My usual class is an almost empty one, without documentclass and without packages, because I don't want org to write the preamble for me. But I think this is not the point.
LATEX_PRE_HEADER you proposed is a document-local setting while `org-latex-classes' is shared by all Org documents. In that hack I used a buffer-local variable to achieve document-specific fragment.
In the specific cases of \DocumentMetadata and .xmpdata, LATEX_PRE_HEADER needs to be passed through `format-spec' with result of `org-latex--format-spec' call to get notion of Org metadata. Whether it is necessary for \PassOptionsToPackage depends on particular cases. If such options do not vary across documents then certainly `org-latex-classes' becomes viable.
I do not like "[NO-PACKAGES]" and similar keywords to suppress adding of some code snippets. That is why I believe it is better to seek for another approach to generate LaTeX preamble. I have not had a look into Timothy's code yet, so I can say nothing concerning its flexibility in respect to substituting metadata into code before \documentclass.
[Prev in Thread] | Current Thread | [Next in Thread] |