From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 0Ky7OoIZL2NiCAAAbAwnHQ (envelope-from ) for ; Sat, 24 Sep 2022 16:51:47 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id KA/LOYIZL2MS5gAAG6o9tA (envelope-from ) for ; Sat, 24 Sep 2022 16:51:46 +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 989C516743 for ; Sat, 24 Sep 2022 16:51:46 +0200 (CEST) Received: from localhost ([::1]:45334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oc6VN-0003jQ-B7 for larch@yhetil.org; Sat, 24 Sep 2022 10:51:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc6UN-0003fj-4T for emacs-orgmode@gnu.org; Sat, 24 Sep 2022 10:50:45 -0400 Received: from mout01.posteo.de ([185.67.36.65]:39311) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oc6UK-00059f-Dq for emacs-orgmode@gnu.org; Sat, 24 Sep 2022 10:50:42 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 47823240027 for ; Sat, 24 Sep 2022 16:50:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1664031036; bh=XoOiaM4AcMjBYB170jHWzNL6Ek04cyQNDWgw4bJ/lTg=; h=From:To:Cc:Subject:Date:From; b=mIs+2wwa1UI54foeBPxE5z+VzprmERTgoDlmUM+GWtazyrPvqjw1eRKst3mPd1rJ4 SC7LxtQfFETfJZ1q26U0lDD0FudOtUMHcBOPzuiGIkVHqC7oVGebb7/GJfZxDf4ZDn VhNOMc+gbSiYmgFkEthvW7nelzw0LiCxtfmuyh1jOakImkqfZVspA0VaGMI0uZDSOY ugitC/u5tQfAaZ0ySbMUAK26TdsUlVswRZxYL3vqiVexLMiLfYw+5RAWmILefm5Wcr KTYqAVFqTAUjzA4dJV39Qa2SLzl1kHAZMqLpzPVFKlMCBuiP/tL6Vx9FsWwqwB9TwS ZUBzVa5JLdQlQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MZX4q199lz9rxK; Sat, 24 Sep 2022 16:50:34 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: Ihor Radchenko Cc: orgmode Subject: Re: [Patch] Pre-/postpend arbitrary LaTeX code to a section References: <87o7vcsw8m.fsf@posteo.net> <87czbqyy5i.fsf@localhost> <87sfkmdkxa.fsf@posteo.net> <878rmdxg17.fsf@localhost> <878rmcvlcz.fsf@posteo.net> <87czbna4e4.fsf@localhost> Date: Sat, 24 Sep 2022 14:50:32 +0000 In-Reply-To: <87czbna4e4.fsf@localhost> (Ihor Radchenko's message of "Thu, 22 Sep 2022 22:08:03 +0800") Message-ID: <87h70wbzd3.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.65; envelope-from=maciaschain@posteo.net; helo=mout01.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, 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1664031106; 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=2lz92QEBxzzSlYGvyjsPfHGs6fNY+/otzyGoC9u+cI4=; b=V314RHuw64q+NKO4yLAtMAcYc1LF7sJ0RqcZ9pXdCZSNy0k1d2rNvU/DyaddBSH7EFArKC 2vf24jvR3BuXkAG+scFr1BlhTo6DChZE9q9g7MevIeX+kxyFvCw6PbfG5NIaE1+IsVwuMY j5yvc8rjDemS95Ip+FUOGlMGnUO5+JZdUpzkzzoYv4BB794DZeBYBhe+GIFSmKpcFe/Va+ 6cp3FQnFNOrHxlDIXw7KOWr2aBonsg7rzw3UgdMHX3OBlBv3qXIYoSpEcjW9OihOFh8kEP F/m4ADzt4RR1/H3BJ2QJlrDrB3Z9+xsDEp7VO1DD6rE+hEtpP7Zaa4vm5agjVA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1664031106; a=rsa-sha256; cv=none; b=TkN0b1t2j6BL0vrYRYiEQRtViOYlp2AwY/zD5GqIJYnAJ/czt2A5w1WUBeNy77aTk4yDpa WlUHBIKKbG4OL9QPjgMMme2jeEpuVkaOlOY11ZZ5OnJmggh2iBDNxe6aX5G9Dcl9I5kHsp xASg2KY41vlwzTU546stctNhnX5O6ka7diLCL8WepfyK0IihTHbdsUzez7vJKT0rHCwVfg 5ClK9T5i6FvpGWU+KBTXOdRuu25Z30mY7qvBwcxnlASryxhMSVBv/o5NkGN9lXZ/8eXG0m ZekdpP8AbEUBBuQwOtmZdh/s4QxSAY7VcEy8I8J5aCVWCQbMrZQKaSQm6QixBQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=mIs+2wwa; dmarc=pass (policy=none) header.from=posteo.net; 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" X-Migadu-Spam-Score: -2.55 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=mIs+2wwa; dmarc=pass (policy=none) header.from=posteo.net; 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" X-Migadu-Queue-Id: 989C516743 X-Spam-Score: -2.55 X-Migadu-Scanner: scn1.migadu.com X-TUID: qhVJmf8IhFCH Hi, Ihor, sorry for the late reply, Ihor Radchenko writes: > Having read the available replies in this thread, I am thinking of the > following: > > 1. Instead of explicit prefix and suffix, we can unify extra text around > the exported Org element to a template: > > * headline > :PROPERTIES: > :ATTR_BACKEND: :export_template "\begin{myenv}\n%s\n\end{myenv}" > :ATTR_BACKEND+: "The %%s instances are replaced by the exported element" > :ATTR_BACKEND+: (concat "arbitrary sexp, the exported element is bound to= : " *this*) > :ATTR_BACKEND+: babel_block_name(exported=3D*this*) > :ATTR_BACKEND+: "the property lines are concatenated with \" \" (space)," > :ATTR_BACKEND+: "just like the usual approach in `org-export-read-attribu= te'" > :END: I really like this approach and I would buy it. On the one hand, if I understand correctly, it's a universal solution that doesn't depend on a particular backend (although, to be honest, I don't see much use for this beyond LaTeX: maybe in HTML). And, on the other hand, `:export_template' is an attribute that can be, as you say, very versatile. With this, in my opinion, it would no longer be necessary to define two 'pre' and 'post' attributes. I imagine the value of ATTR_BACKEND (would quotes be necessary?) could be easily converted to a plist, with code borrowed from `org-export-read-attribute': (:export_template "\\begin{myenv}\\n%s\\n\\end{myenv} ... etc. ...") > #+ATTR_BACKEND: :export_template "can also work on non-headings" > Paragraph. In this case I would not see it necessary, IMHO. For simple things (of the begin/end style) there are the special blocks. And for more complex pre- and/or post- code we have export blocks and export snippets. Since there is no heading involved here, there would be no danger of the pre-code leaving with the content of the previous header. Best regards, Juan Manuel=20 --=20 -- ------------------------------------------------------ Juan Manuel Mac=C3=ADas=20 https://juanmanuelmacias.com https://lunotipia.juanmanuelmacias.com https://gnutas.juanmanuelmacias.com