From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id AO7ACh3ka2MlPgAAbAwnHQ (envelope-from ) for ; Wed, 09 Nov 2022 18:32:13 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id qK+xCh3ka2PYAAAA9RJhRA (envelope-from ) for ; Wed, 09 Nov 2022 18:32:13 +0100 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 C0F5F1191E for ; Wed, 9 Nov 2022 18:32:12 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1osouu-0000Px-JN; Wed, 09 Nov 2022 12:31:12 -0500 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 1osous-0000PV-Dy for emacs-orgmode@gnu.org; Wed, 09 Nov 2022 12:31:10 -0500 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 1osouq-0000u2-Cx for emacs-orgmode@gnu.org; Wed, 09 Nov 2022 12:31:10 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id A11B3240104 for ; Wed, 9 Nov 2022 18:31:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1668015064; bh=A4AiH08taEFYHByCKl5t6X672R3GumUvDlqnzeesaOw=; h=From:To:Cc:Subject:Date:From; b=oA5Kqui5xnzWEhonB3/Dybpj/ylc++DtpMlzD8IpnOY2BHhxXnuCP3H03/SRy+0v8 P40l7bWQhD0HvbHa8JoQbxOGhIbIDSXOsIPYfld4+MrJbGcv87bYo5b2Jd3xVTYvtM ECvDh0E3qh1UtLG5PGe8zEM14L+lajkkybl3MXweXUwV6vSFY4y47ZEfNPEtwB0bPN Lsyj50dB+WijKfoYKZsQ/wJ/T4Pi29LOAMxyE+ZYlapOdkn50h8xw8t2vsH9bVt5bs RCFHXoLddU0ofIkOBvJrQq7EiN8yIQlGApPxAhIXolTjAs+/eXTm32ST9JHNueplgA DmLoAoA2v5dbA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N6sSl3vP2z6tmL; Wed, 9 Nov 2022 18:31:02 +0100 (CET) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: hugo@heagren.com Cc: emacs-orgmode@gnu.org Subject: Re: Can :packages and :headers arguments in latex SRC blocks be made affect EXPORT blocks of results? References: Date: Wed, 09 Nov 2022 17:30:59 +0000 In-Reply-To: (hugo@heagren.com's message of "Tue, 08 Nov 2022 23:04:22 +0000") Message-ID: <87sfisf31o.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=maciaschain@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1668015132; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=CFeymxrbA5dYmvB15NHy0GEcel4LVWEvcEMkdM4ZPJw=; b=EOraoEnzqnTtGODxOc050OIFRaMaFlhZOT74r5cSSIUWmZLgB/sONWmdjiT5V3KQGIHscv vmi1LQ+RUHN0sEDrlJ3xQto5Yw12fE8p9zhGnxdU4OT1lPwaimgraHk1zI+pFHFcgb8C1i XY33iymLq6mqUA6yopUWoAZvPIqPC8+OsbzQSQ2HRqQv8VgK1R3kVb3rUZstax068DXQ5k BAs+C6RgqL2e7kJ7HttqpPzypnMV6QsJhTC9XBxs1RmvSrProA8zYMsBVyZ1a0I8qmzhTR KRD1NWr4KfdH5quzx5N3KsMPg84C3G4R9WK22K93mODVKnk17GiytewkTUWppw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1668015132; a=rsa-sha256; cv=none; b=Q4Gu7NToG5nuNXJfBWvo4tRxP0WFdxBGIT1hmvFZCXQzJamgBzKXW4Sx6x4ELa4Pc8nS1i DNMNEUCunm1DgrI1q6e2stLW1AazaMr+aZCYjNmUQkAyYo44cr9LSNkqLBREWyRy8lmcCH +jTcy/9JJS8yYBpfcWS9vgxH/QRj+3Fyv1k0IcA697gzhSxz4VKJb7IG6NIA8fPeiB5+1E O2h9F2elYLsuo8hOSiMjt/sRaertyh/5rj8N8chWb1ra4wMmv3wigvQKLu48onbYt5FMgC VEMRjN6sOlHzzBP3iFTS8dfPcoRgMaHCg2GvL0PPr+wbcsbzr0h1q0ZqeaGgLA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=oA5Kqui5; 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: -3.22 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=oA5Kqui5; 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: C0F5F1191E X-Spam-Score: -3.22 X-Migadu-Scanner: scn1.migadu.com X-TUID: da4thkbdJ8cm hugo@heagren.com writes: > Is there a way around this? Either to export the src block another way, > or to add metadata to the to the resulting EXPORT block (or just text, > though I'm not sure how that would work for `:packages', since they > require text to be added to the resulting exported LaTeX file in a > different place from where the text of the block goes). If I have understood correctly what you want to do, maybe a solution would be this. You can starting from a single block that includes the preamble for both preview and export: #+NAME: preamble #+begin_src latex :exports none \usepackage{tikz} \usetikzlibrary{calc,positioning,patterns} #+end_src This block returns the above as a simple string: #+NAME: pre #+begin_src emacs-lisp :exports none :results silent :var x = preamble (with-temp-buffer (insert x) (LaTeX-mode) (setq preamble-prev (buffer-string))) #+end_src And this one adds the necessary LaTeX headers when you export the document, so LaTeX doesn't crash when compiling. #+begin_src latex :noweb yes :results raw ,#+LaTeX_HEADER: <> #+end_src And the final block: #+header: :results (if (org-export-derived-backend-p org-export-current-backend 'latex) "latex" "file raw") #+header: :file (if (org-export-derived-backend-p org-export-current-backend 'latex) nil "foo.png") #+header: :imagemagick t :fit t #+header: :headers `(,(progn (org-babel-ref-resolve "pre") preamble-prev)) #+begin_src latex \begin{tikzpicture}[on grid, font=\footnotesize, level distance=2.5cm, sibling distance=2.5cm, every node/.style={circle,draw,fill=white}, touch/.style={circle,draw=red!100,fill=red!40,thick}, invirtueof/.style={circle,draw=red!50,fill=red!20,very thick}] \node [invirtueof] {Car} child {node {wheel}} child {node [invirtueof] {body} child {node {driver door}} child {node [invirtueof] {passenger door} child {node [touch] {region of door}}}}; \end{tikzpicture} #+end_src #+RESULTS: [[file:foo.png]] Best regards, Juan Manuel