Juan Manuel Macías <maciasch...@posteo.net> writes: > Rationale for this patch: in certain cases, in a LaTeX document, it is > necessary to add code before the class declaration (\documentclass...). > For example, commands like \PassOptionsToPackage, \DocumentMetadata{ }, > etc.; or certain packages that should be loaded first using > \RequirePackage{}; and other miscellaneous cases[1]. I think that by > defining a new keyword `latex_pre_header', which behaves the same as > latex_header but concatenated before the class, these situations can be > resolved from Org.
Thanks for the patch! It looks reasonable. > https://gnutas.juanmanuelmacias.com > From ac6b743a4489f7bc8ab1cdae7ffd3b36e5f3c1d2 Mon Sep 17 00:00:00 2001 > From: Juan Manuel Macias <maciasch...@posteo.net> > Date: Sat, 16 Sep 2023 19:22:39 +0200 > Subject: [PATCH] lisp/ox-latex.el (latex): Add `LATEX_PRE_HEADER' keyword > > * (org-latex-make-preamble): In some cases it is necessary to add code > before the `\documentclass' line. `LATEX_PRE_HEADER' behaves the same as > `LATEX_HEADER', except that it is concatenated before the class. I think that you do not need to `quote' LATEX_PRE_HEADER - it is not a lisp symbol. Also, the new keyword should be documented in the manual. > - (user-error "Unknown LaTeX class `%s'" class)))) > + (user-error "Unknown LaTeX class `%s'" class))) > + (pre-header (mapconcat > + #'org-element-normalize-string > + (list (plist-get info :latex-pre-header) "")))) mapconcat is redundant here. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>