From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id EN91GG4tE2VyigAAauVa8A:P1 (envelope-from ) for ; Tue, 26 Sep 2023 21:13:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id EN91GG4tE2VyigAAauVa8A (envelope-from ) for ; Tue, 26 Sep 2023 21:13:50 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4D65657D85 for ; Tue, 26 Sep 2023 21:13:49 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=ndnMu1Hi; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1695755629; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=P2Ykj4C4Ny7AH9/eyI5s/Jp1S3MtrnVsbsQbcrN2n0E=; b=FygWiXHnk4AwA8svX3413szomrxZ25SscDME/QAY+GJOrsj9i26Fwg5VbxRe+waAPY5SP6 LLl/m09r8n+/9bhX6vh30SEGVeO5aYRCs17A2lMHZ2BbusUOEOWFHIBjYPEHs19iFgrdZ+ vbSoK+PfGWWz+PMWW3QOHnNW9cnUPjZjRdcW00OMKaN8pkgLfFYSenwB0+hUVzf+Lcl2BD uIC2VRLn62lPBb/5S3jFRdp5Xa3MNy15ENYONKcGnWVCUXI1v0rdAsHPoBplIWuUeIB2In 3JiatbmUgE3HaWp30uYi1p3ryGdZBqORuvT8IioI5lBAs9rO6kL+1Mdr/oF2vA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1695755629; a=rsa-sha256; cv=none; b=GKaj5zQ/PXwwDnriVwRqV1xnvZiMSLXQgizS7XACl5+znh8zlgViiUqRYxj9WOvMf7QsI/ s6KdMqhHO/IM36Ce97c6slh75H/VLoSRRHH5ThSdMNrDG5+XTJks94IRaOcuHSWDpdcAnz kMJ3vSETJqWZOqGcYubv9lXk48M9v3+Ldl/XXnvkxQqtcFN8RGHrYRDEX/VtgwHQkz9En/ w83HKTO0qemlCrFpQXV6KKpZVzs63+poYDR75lq+SJpFRTrLE4Xwp5nXdYjo+7iN+PRYEj XFcZxBu/BpOuGMwLgb9zh6Ag98JEQ/NkNzC4dCJPfHKVrEaObqizM8Lf1t6nOA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=ndnMu1Hi; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlDUR-00049A-Db; Tue, 26 Sep 2023 15:12:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlDUM-000491-R7 for emacs-orgmode@gnu.org; Tue, 26 Sep 2023 15:12:55 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qlDUJ-000744-TA for emacs-orgmode@gnu.org; Tue, 26 Sep 2023 15:12:54 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 95902240103 for ; Tue, 26 Sep 2023 21:12:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1695755567; bh=P2Ykj4C4Ny7AH9/eyI5s/Jp1S3MtrnVsbsQbcrN2n0E=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=ndnMu1HiYfTcS2je9KkDlKgHNttTpN5BlSVrpD1F8bzJ0aX8EHldCJbIQtv9Ndh2e 8Ag1UOLF3mPgZEzojD7yUreUIlzO7msiIJk3TuS17c0m6kGlmWz+iDp85EyCqdmd86 eKaBjJygRvQNCNN9aoM+2+/86yQ/ZQ0zjDUV9D3yQyX3ILR/bHmigc0hhec6p1lVFK u3zJtBG5YCPKLRGVzXzPWfjh/3jKdXZF0POjQK6a5Iu0cF7AdiSd8y0UJEsPh+psEs uKepkcWu0GGH4JhlalvPW/Jj1ZYntncjT3XF+ce3djEwPMjakks1ttAayaR2Vnx7I2 mCxHqKp/ZeoNw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Rw8Wy6BfQz9rxG; Tue, 26 Sep 2023 21:12:46 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: Max Nikulin Cc: emacs-orgmode@gnu.org, "Thomas S. Dye" Subject: Re: [patch] ox-latex.el: Add `LATEX_PRE_HEADER' keyword In-Reply-To: (Max Nikulin's message of "Tue, 26 Sep 2023 22:39:46 +0700") References: <874jjuj8vu.fsf@posteo.net> <87pm2776qq.fsf@posteo.net> <875y3yytp4.fsf@posteo.net> <87r0ml3oax.fsf@tsdye.online> Date: Tue, 26 Sep 2023 19:12:46 +0000 Message-ID: <87lecsvjdd.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.67.36.66; envelope-from=maciaschain@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: -5.43 X-Spam-Score: -5.43 X-Migadu-Queue-Id: 4D65657D85 X-TUID: HHiyahzutyzk 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. > 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. IMHO, LaTeX_pre_header is obvious and transparent to the user: a version of LaTeX_header that behaves exactly the same, except that it exports the lines before \documentclass. It is simple and requires little code to implement, and it is used for all cases of code before the declaration of the class, since its syntax is consistent with LaTeX_header. And its use does not require further explanation. You can even play with constructions like: #+NAME: pre #+begin_src latex :exports none (some stuff) #+end_src #+begin_src latex :noweb yes :results raw ,#+LaTeX_pre_header: <
>
#+end_src

> 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.

I think that this would not be the case. This is not just any part of
the preamble, but a fairly definite part. Broadly speaking, LaTeX_header
would take care of what is after \documenclass (the axis of a LaTeX
document); LaTeX_pre_header would do it of anything that may have come
before. And both provide a less constricted preamble for advanced use of
LaTeX. Frankly, I can't think of a simpler solution.

> \begin{filecontents*} from the original post is not convincing.

Are you not convinced by some instructions that are included in the
official documentation of a LaTeX package (pdfx)?

https://i.imgur.com/NdLWmwc.png

The thing is that here it is not a question of whether something can be
done in this way or in another better way. This is how a given package
recommends doing it. If the user wants to use that specific package, she/he
will have to follow these instructions. It's more. I am thinking, for
example, of the case in which the user has to obtain a * tex file, not a
PDF, because she/he is collaborating with more people who do not use
Org, but do use that code in the * tex document.

--
Juan Manuel Mac=C3=ADas

https://juanmanuelmacias.com

https://lunotipia.juanmanuelmacias.com

https://gnutas.juanmanuelmacias.com