From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.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 GOJWDuBtLGOpIAEAbAwnHQ (envelope-from ) for ; Thu, 22 Sep 2022 16:14:56 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id aAwyDuBtLGPOvAAAauVa8A (envelope-from ) for ; Thu, 22 Sep 2022 16:14:56 +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 64D088AFD for ; Thu, 22 Sep 2022 16:14:55 +0200 (CEST) Received: from localhost ([::1]:43636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obMyb-0003RE-Pw for larch@yhetil.org; Thu, 22 Sep 2022 10:14:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57166) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obMrH-0004f0-NE for emacs-orgmode@gnu.org; Thu, 22 Sep 2022 10:07:19 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:34696) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obMrF-0008Aq-Un for emacs-orgmode@gnu.org; Thu, 22 Sep 2022 10:07:19 -0400 Received: by mail-pf1-x431.google.com with SMTP id e68so9436564pfe.1 for ; Thu, 22 Sep 2022 07:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date; bh=iANw3GGLK6E/aPAKcL06gg+FrNgEiNajP4Vdi7RX8ZI=; b=DaSta07LthtSdhND67/sByep9uhKWKdxDE4hy0x9tPgyV6Sabuolv96L5oFlqg3KwE HogvZi3ozdyTiYxEUIIigmMATSkJ9MJE2ZVmUDk7O920LgmZ+MDFBTfhhBTpk/kubTyz FaJTR1waHNGz0p3ED7Dy2tjj65JYF4BpBWF5RwTO1AMx8xHFOfe+FQqT2lUJr9sOE4y0 NbEhG8gy0V5UbSphjB2peQEOjwFsp9L9cdWyd3xI7fPXzbiwSgzEF/UI/lFpfd60KRdk 0yrWbz6rGRKzzOcKiTYacDtkDVccOlEf9sAgYtVoY0iDPA5m5GUOl4ZzXJLfswhhcCY6 XNqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=iANw3GGLK6E/aPAKcL06gg+FrNgEiNajP4Vdi7RX8ZI=; b=Jha0EohpvW2b2Pi85btnKTxk53m+XNv4Jp6x8A5yptmyHlp8qg0jMWgMQwKVUK4ltT vQ8I3qKSDMTE0SncfIYRbj38IWygnXGLHagogwLADI8GA4ZRZmW4i+RiZhBF2B9uYE5X 9gqIrBBgLsQE16+rWtQQoHK8apmetT7U0nJzE27oMvrvYfpO9IGnSy+DDoSKycpmPnb7 UAm0F/AMOYt8jFQch6YmdlzOIw+RMx5v1jq1LT3AroIv/fsdxs+3vdC63GH8YG+Kr1yQ JpmkHctsFjxdbaff4iNe2mCIza4wLasEGNy/XfzKu85EmtpA6ytC4Gne0CA+ZdF+/WyZ LBzA== X-Gm-Message-State: ACrzQf2vzOc7se3fBo2Oohiqg21oZV+qFQrz3nQ3gPgpDJgZ3Wgc+hBz ARPuMjL4x+imhpEgu18/vSk= X-Google-Smtp-Source: AMsMyM52DUQvVqCMvtIuetpdQdB+ygT34EdvTWtYYH8ywmmlOMd74HU2wdyyAB5YwMEjg886LeNygQ== X-Received: by 2002:a63:e516:0:b0:434:9462:69cd with SMTP id r22-20020a63e516000000b00434946269cdmr3012245pgh.503.1663855636397; Thu, 22 Sep 2022 07:07:16 -0700 (PDT) Received: from localhost ([2409:8a70:2b5:ad00:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id i8-20020a1709026ac800b00176a579fae8sm4064196plt.210.2022.09.22.07.07.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 07:07:15 -0700 (PDT) From: Ihor Radchenko To: Juan Manuel =?utf-8?Q?Mac=C3=ADas?= Cc: orgmode Subject: Re: [Patch] Pre-/postpend arbitrary LaTeX code to a section In-Reply-To: <878rmcvlcz.fsf@posteo.net> References: <87o7vcsw8m.fsf@posteo.net> <87czbqyy5i.fsf@localhost> <87sfkmdkxa.fsf@posteo.net> <878rmdxg17.fsf@localhost> <878rmcvlcz.fsf@posteo.net> Date: Thu, 22 Sep 2022 22:08:03 +0800 Message-ID: <87czbna4e4.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=yantar92@gmail.com; helo=mail-pf1-x431.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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=1663856096; 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=iANw3GGLK6E/aPAKcL06gg+FrNgEiNajP4Vdi7RX8ZI=; b=SSPUe274mG1eyhvP3zprmPCfBcmJEDnUCWea97kdpoyj3qBI9Kk9WvWlwIDAIXFR9K4XoY 5TLRyhSItDQqAilGXYBUzfVMjKSGEvjxcZIQnX9VD3C8GMNnxosfmYX5OG8tbXD8kXehsN 6gaQjvqAVfFTuY2JKnMQSHw+gqCTzRENc03yJXMMaNJPJIvbzUOI4moJiorFznxTPOI05N uYk439CyBosZ+GEcKJ7sk/SZ7eRDzulk8q6fKo34/QyHv9OaksFasUXLFXYNE9jm7frHEe TnZma3dML9+/E9dOTdd8LG5/iLQmn+GxiONSLPvnqbV1cd8yyDvx0+8e8Yk38g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663856096; a=rsa-sha256; cv=none; b=Wf5zqDrAMdY3p9vccGjH2VXHIFEwnLTyyDmMGhL8VyAzAtMCvdPClGsY1Uzz+vIQDhacFS FrP7+WFliSpdsVzFH2i4pW0GbLKrZ/GMJ9TiMTtUYwIv7n99uiWJxk8Q6u1NR6XuMoVtWU Qd71cOhVvUxln3/jN/yvBo+S4JyqFQHkOw8J/RHzXlIkAKKjIxRJ/Jn84SU1ZU10BLdQHl IXKlaZf9Y6kMTfqN9QOU60wBsvMW4633YMIwA9c9ESsYPaRLjiRnu6xJotH57Ob4nnWDiz k1WrKg1Dy83yfVx71hh9x6ilCXYcHZlfnYB+QU5ao7NZRiA/Y5lVfpOOwwgNOg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=DaSta07L; dmarc=pass (policy=none) header.from=gmail.com; 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: -5.65 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=DaSta07L; dmarc=pass (policy=none) header.from=gmail.com; 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: 64D088AFD X-Spam-Score: -5.65 X-Migadu-Scanner: scn0.migadu.com X-TUID: XW7XiRTW/MMt Juan Manuel Mac=C3=ADas writes: >> I suggest to use more canonical attr_latex that explicitly limits the >> export backend. > > I see. But in any case, something like `:prepend "section"' would be > unnecessary (and even counterproductive) for what I'm proposing, but I'm > afraid I didn't explain myself well in the first message. One of the > benefits of approaching this issue with a few minor modifications to > org-latex-headline is that the result is regardless of the section level > at which the property is applied. We may want to prefix the section with > a specific LaTeX code only for \section (or \paragraph or whatever) and > we may want to introduce a more general LaTeX code, level-agnostic. > Explicitly put "section", "subsection", etc, IMHO unnecessarily > complicates things. But I also insist (as I said at the beginning) that > I don't know if this use case can also be extended to other users. Yeah. Extra matcher is probably too cumbersome. Yet, I feel like conditional prefix/suffix may be useful in some scenarios. 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-attribute= '" :END: #+ATTR_BACKEND: :export_template "can also work on non-headings" Paragraph. 2. The generic Org export routine will remove the :export_template attributes prior to passing the element to backend-defined export transcoder, thus avoiding the problem Max raised wrt ox-html attributes. 3. Similar to :export_template, we can have :export_prefix/:export_suffix, but I feel that the template will be more flexible. WDYT? --=20 Ihor Radchenko, 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