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 IIerFvX0d2I3AAAAbAwnHQ (envelope-from ) for ; Sun, 08 May 2022 18:51:01 +0200 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 +NuXFvX0d2IaugAAauVa8A (envelope-from ) for ; Sun, 08 May 2022 18:51:01 +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 0251C29504 for ; Sun, 8 May 2022 18:51:00 +0200 (CEST) Received: from localhost ([::1]:45536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnjXS-0008Fn-0X for larch@yhetil.org; Sun, 08 May 2022 12:13:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36090) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnjWT-0008F1-RQ for emacs-orgmode@gnu.org; Sun, 08 May 2022 12:12:41 -0400 Received: from mout01.posteo.de ([185.67.36.65]:37379) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnjWR-0002tB-Qp for emacs-orgmode@gnu.org; Sun, 08 May 2022 12:12:41 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id B1552240028 for ; Sun, 8 May 2022 18:12:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1652026356; bh=O/7BnA9gWcxRxWDpGB1qhxfcDaC60MZ4EqBifKbbQkw=; h=From:To:Cc:Subject:Date:From; b=TbdOaQTeGyK/e8Xt0tj4PCQ6AiPgpD5bgMaKxO4PnVLS3pMVcVuSgZnAyLEUSzmiO yGLExBH87dOMCc2UBjPKJ0a8WbFtGcZfOpdkyid+1OYolBgJTlrdOTGwdvQ/hjY3dy Mb1Cst5uNb8R8t29xYlnHp/Hq3JS/3nCBTP4tFSM9CcNn5cCcp/Qu56eJgf3WFCYUP nXyX1/Pdo87UqVzJ6sw6oYU6PoQSdo/9ixLkDSfYHNCmeprX3jtj4HXhV6PPiFIK/0 igYd5blOnyUgCCnWKhm6G6BQhOg/2kwjPVkA+KftKWYAqWH4GEFfFJaTJp8DZBD/Rn Xqr9H7itSWHiA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Kx8Tb5RFMz9rxF; Sun, 8 May 2022 18:12:35 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: "Thomas S. Dye" Cc: Maxim Nikulin , orgmode Subject: Re: Export LaTeX command inside figure environment References: <871qx4c3ii.fsf@tsdye.online> <874k20dfwh.fsf@posteo.net> <87v8uga78j.fsf@tsdye.online> Date: Sun, 08 May 2022 16:12:38 +0000 In-Reply-To: <87v8uga78j.fsf@tsdye.online> (Thomas S. Dye's message of "Sat, 07 May 2022 20:06:20 -1000") Message-ID: <87tua0nguh.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain 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, T_SCC_BODY_TEXT_LINE=-0.01 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=1652028661; 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=529B3KNp5kGN7p1XYzuYvzcGk79kPviZRzwYRZE3DNY=; b=b5fkDMBflKG/s8cDSa8KzWAyPHCxGrctdNY4uuXEDl3H4ZvFzP56S/hToUYl7SOhFr2GOT i8ZDyf1osMyPAMNBhJ/MgNC6cwkEiuOYDtVd3i9J/hhvMwWz31dSoRFnt2Xsbkx1WosTuo qRIUTGjY56+g5Lq0zRkmcR3d83BNq8ZeMKd18DiNwEpCWkPRyCSwryKyphbuFR60dQsvn+ TwCPU9ywjAJRMo5OpUhw9FD8FvwkL+/TVIcZ7gC0v8a+Xeyy15VKIgipwgVfEQNeAFkPt1 4mK5S3WqYiLvSA9zu19+qWJrRyRJraUo1PObmOmFh1WLu93GyOjq7eGJVsg/7Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1652028661; a=rsa-sha256; cv=none; b=ulmQ+uJclahYUTx4OiySx019lmDXIjhqY59AH6Y83GB938hk0rsm0ldmyVBdFfFcVR7j92 Am+GxbAXBxTsIKxNsDIRcT0OXTIH5bv/86EcRn1/6O9UGQ6HIhW5/srPtjVRuWZuciYxFz U78OcXBcZeoOfasVYHTpQ2d/4DuVPmhB1ftWQdLhqrBqUEDASPVbe+aytIw2EEiudy1NwM vQTLS+EDyZnMvOKGKtJMkVu6F7edjM/1mX9Dh4073Anf7mRePZ+rEOBITi19NizU1otkIn tmrQk3424iUqDB7Bt7QjjEk0ycB5o36ZBEeeJLDUSLVqnlZeDHpE+A8DHHWHNQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=TbdOaQTe; 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: -7.71 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=TbdOaQTe; 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: 0251C29504 X-Spam-Score: -7.71 X-Migadu-Scanner: scn0.migadu.com X-TUID: oLrOMk/woXVm Thomas S. Dye writes: > It would be better to have a LaTeX attribute, say :commands, that > places commands within \begin{figure} ... \end{figure}. This is a possible solution from the LaTeX side, which would avoid having to modify the Org code and can also be used to introduce more complex arbitrary code into the figure environment. It consists of defining a variable (for arbitrary code) and redefining the figure environment to include that variable. Something like this: #+NAME: preamble #+begin_src latex :exports none \usepackage{graphicx,xparse} \def\myfigcode#1{#1} \let\svfigure\figure \let\endsvfigure\endfigure \DeclareDocumentEnvironment{figure}{o}{% \IfNoValueTF{#1}{% \begin{svfigure}} {\begin{svfigure}[#1]} \myfigcode% } {\end{svfigure}} #+end_src #+begin_src latex :noweb yes :results raw ,#+LaTeX_HEADER: <> #+end_src Here I use the dummy images from the graphicx package. Of course, then it is necessary to apply a zero value to the variable again, or enclose all in a \begingroup...\endgroup. It's a bit tricky and I haven't tried it too much: @@latex:\begingroup\def\myfigcode{{\centering\fbox{\textbf{Hello world!!!}}\par\vspace{5ex}}}@@ #+caption: This is a caption #+ATTR_LaTeX: :placement [h] :width .5\linewidth [[file:example-image-a.jpg]] @@latex:\endgroup@@ #+caption: This is a caption #+ATTR_LaTeX: :placement [h] :width .5\linewidth [[file:example-image-b.jpg]] A screenshot: https://i.imgur.com/8JIU6nX.png Best regards, Juan Manuel