From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id aOfmHrXgamNcrgAAbAwnHQ (envelope-from ) for ; Wed, 09 Nov 2022 00:05:25 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id oNnLHrXgamNmPwEAauVa8A (envelope-from ) for ; Wed, 09 Nov 2022 00:05:25 +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 20B482B0F5 for ; Wed, 9 Nov 2022 00:05:23 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1osXdw-0000Lj-EC; Tue, 08 Nov 2022 18:04:32 -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 1osXds-0000IR-Oh for emacs-orgmode@gnu.org; Tue, 08 Nov 2022 18:04:28 -0500 Received: from whuk14.whukhost.com ([5.77.41.174]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1osXdo-0007gQ-V9 for emacs-orgmode@gnu.org; Tue, 08 Nov 2022 18:04:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=heagren.com ; s=default; h=Content-Transfer-Encoding:Content-Type:Message-ID:Subject:To: From:Date:MIME-Version:Sender:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=M7Jj9uy7HL61GrhyyK+5V5tddoQ37HQg0dqevm9Zdas=; b=DHh5P106aNxZxkAdISTBke15kI i4ceJeCuFrFvQnRTAmGYyW1blvyjiUhsG7U2ZzurRWd2FYjSEYSW0w94ZgbIi1D4sBuYh4d2Q1DUQ M0AW8uOxCvj1c4PiSbWSWDbC5gwWC7hvAoBHka6paL5Likh3mhijO78ajx5ZBmnG0mMeeHjsNS4O2 dJxMJDE/Z3O93dZBfrrezAPhppj5zref2Wb9rE8PWsbMhz0yjhF4MXWUOsXPXMJR+vmmqAIzYDuex vWK4TUltxf3Iwn+Ujr4kTvCcWlXkJ3k7PNMF1ZF2nRHxLRx0QBec2w08sGCnvqNV8V5gCGbQKYdC8 MmHVulQQ==; Received: from [::1] (port=39470 helo=whuk14.whukhost.com) by whuk14.whukhost.com with esmtpa (Exim 4.95) (envelope-from ) id 1osXdl-006CNR-9P for emacs-orgmode@gnu.org; Tue, 08 Nov 2022 23:04:22 +0000 MIME-Version: 1.0 Date: Tue, 08 Nov 2022 23:04:22 +0000 From: hugo@heagren.com To: emacs-orgmode@gnu.org Subject: Can :packages and :headers arguments in latex SRC blocks be made affect EXPORT blocks of results? User-Agent: Roundcube Webmail/1.5.2 Message-ID: X-Sender: hugo@heagren.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - whuk14.whukhost.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - heagren.com X-Get-Message-Sender-Via: whuk14.whukhost.com: authenticated_id: hugo@heagren.com X-Authenticated-Sender: whuk14.whukhost.com: hugo@heagren.com X-Source: X-Source-Args: X-Source-Dir: Received-SPF: pass client-ip=5.77.41.174; envelope-from=hugo@heagren.com; helo=whuk14.whukhost.com 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, 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=1667948724; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=M7Jj9uy7HL61GrhyyK+5V5tddoQ37HQg0dqevm9Zdas=; b=UKhFUztbqLu5Pu38EgiYkVQeJzXcGF0dsPLcgmnwa9/eJdP2h/TGeOEZUvHrXasBZJTIvz 1c5TXm2Tn8HioHgkR02MXqrvSFGTueDeAAas05LOvL+8gaHSLxWrilTFMn6RszyOUthhFq 7+pxuPu34t0/ktRkh4mMbobbTSmn1uEZRvIvtTqiT4TDeMgMVAj+eKAFY+nZbO47kjeaAg MGmaXRKAwItcr1Hnh9BgcOT4NTNlmwAmblWJ66etbetbgnkCC7fTEndFfN1BRnI6Y/XqRN FtF2GN1X16lvi+lip19zBp/sNtPIjfHBiN4HDT5fQoCvqybDAbGbQo42OUEnBQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1667948724; a=rsa-sha256; cv=none; b=kxf06uL7vQExPWCal78FZypqdSjErQf0n+yiF7m9uHzOkCZ6WHABlyMATASNfMIPrz7KAv mg8MB0+a+Kbz5uELJfnWsZGVdxINUrKoMkamb5q2nlq35RPUkO+6ACWA8T7MqMnJtEz3Te g2oLpG7LOTBEbkXSgbAreNlfuKsP03oyFmN8WfE0IbP+njUfOMwhlm7+2RH2CGFmtGktyK 7cL4Om4lZcZVUL+olR1unjse3Ao7FeLJ2bIQmIVUQX3hhm1eqCbs1bldTnzoZmcs3ZpDxJ dMZOm0NClGhVWV5Jl7toytWUz+gPbDR7PJzLj3D/rp5MovlGI3pL+REhRZAOwA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=heagren.com header.s=default header.b=DHh5P106; dmarc=none; 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: 1.38 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=heagren.com header.s=default header.b=DHh5P106; dmarc=none; 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: 20B482B0F5 X-Spam-Score: 1.38 X-Migadu-Scanner: scn0.migadu.com X-TUID: VwwCUIW9+6vr tl;dr: can I have `:packages' and `:headers' arguments from LaTeX src block take effect, when I export those blocks as export blocks? I wanted a way to write tikz snippets inside org documents, preview them in the document as images, but have the tikz /code/ appear when I exported to LaTeX. So far I have this: ,---- | #+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: :packages '((nil "tikz" t)) | #+header: :imagemagick t :fit t | #+header: :headers '("\\usetikzlibrary{calc,positioning,patterns}") | #+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} `---- This works almost perfectly. It's set generate an EXPORT block of LaTeX code when exporting, and an inline image in the results block otherwise. When generating this inline image, it takes into account the necessary `:packages' and extra `:headers' defined. The only problem is that when I export to LaTeX, what is included is /just/ what was in the results block, which is /just/ the code inside the original src block (i.e. the export does not include the `:packages' or `:headers' information, and thus fails to compile because the LaTeX file doesn't load tikz). 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). Ideally, I would like to not have to change anything in the file between working on it (previewing) and exporting. Solutions to similar problems (e.g. ) seem to require commenting and uncommenting lines. I would really like a single, write-once solution (and am perfectly happy with it being verbose). If there /isn't/ a way to do this at the moment but someone knows roughly what would have to change in org for there to be, that would be great information to have too. I would be happy to try to work up a patch. I've looked at some of the code and it looks just about approachable. TIA Hugo