From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 0NUdLXVAeGGApAAAgWs5BA (envelope-from ) for ; Tue, 26 Oct 2021 19:52:53 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id iHy0KHVAeGFvfQAAB5/wlQ (envelope-from ) for ; Tue, 26 Oct 2021 17:52:53 +0000 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 0D6C0100CD for ; Tue, 26 Oct 2021 19:52:53 +0200 (CEST) Received: from localhost ([::1]:55314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfQd2-0005xq-75 for larch@yhetil.org; Tue, 26 Oct 2021 13:52:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfQXC-0000co-2T for emacs-orgmode@gnu.org; Tue, 26 Oct 2021 13:46:50 -0400 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:38672) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfQX9-0007zc-F3 for emacs-orgmode@gnu.org; Tue, 26 Oct 2021 13:46:49 -0400 Received: by mail-pg1-x532.google.com with SMTP id e65so240157pgc.5 for ; Tue, 26 Oct 2021 10:46:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=d6gb9Ah3+ZdA4+BOOu1Naxfm0FlTOEedVdRlCavFMwk=; b=OMWTXxsajfsTaZYXAFGf1HWI9rf+v5U/YC0ivwHO6+/tOwMLzkFeFiMg5UoNQb6MK2 HhwPdiv+KFF1OwI/USBGycBjcy3TH1xxNKzxRCwuK1DI+e/AXNVeLFh+rqQhfAHOkPsv Qhq1vII8/dLHtpUVAo5vnsU0nwSht5L/9mLUPwsxgAH1Lh9GoCtzdNDMMviA/kuFoHHV FKHGqgFbrXMyOpHl5khame03EuvODkLXO52O76w9MuJYP4yljoV576TFXFqn4lMZcDww TLYzFlNqDViSRkmcKdf0/XeHJ/8nPyTczHvteCPrxh9rt0hlhbtNGyDHIbwlViBpuZje eInA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=d6gb9Ah3+ZdA4+BOOu1Naxfm0FlTOEedVdRlCavFMwk=; b=bMyy5hZlHP6jQDdkJtsPvJpIwT66wZKL7wooerLLGbgeyYl2n90fXe2MPrkYBnyK4I /J6+zJPTIuaoCMUMu5jTXjxwXQCsjPqv9gIBIjFzQePlAi22vGb+t0M8Mtw2McpKZ+14 /zGPh7v/15oDedi8av31nMtAK46z9Ny37UEDwbrUxe0w6GH5Oq+HPzpX/IR/bo0j7VtJ aIX6duE5JBF4uRsnm3a7Ux5xoKWHcNYb1BZRu0W4O3O256IyhLM3XrWPRE0V0xRqj5m8 I8Sr4YsSXRp+cyOVf/7XHBhVwEsaoPYmGYP1+vbSgkqi3S/NqEotwuFWTY1oEd64kXfe Jgtw== X-Gm-Message-State: AOAM530D7XcCT1rWlK4alC7XcwButyrs/CTSMgTL0ywwzM+TVvJmxq4Y y/8vdDGQenZ9jtAHXWCejIXLZYJKiow= X-Google-Smtp-Source: ABdhPJyLaixWPzErM+xmrpNDnkEFBrlHv987PunhJed43fo4ZcrWXU9w3oFOPbcd/EL/i6mTg0Y/mg== X-Received: by 2002:a63:9518:: with SMTP id p24mr20185951pgd.80.1635270404689; Tue, 26 Oct 2021 10:46:44 -0700 (PDT) Received: from [192.168.1.124] (c-71-59-145-34.hsd1.or.comcast.net. [71.59.145.34]) by smtp.gmail.com with ESMTPSA id i5sm20031158pgo.36.2021.10.26.10.46.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Oct 2021 10:46:44 -0700 (PDT) Subject: Re: Sub-figures in Org Mode To: =?UTF-8?Q?Juan_Manuel_Mac=c3=adas?= References: <87tuh87gp3.fsf@posteo.net> From: Jason Ross Message-ID: <9e59a818-7a92-c244-f6ba-9677cbdf6768@gmail.com> Date: Tue, 26 Oct 2021 10:46:42 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <87tuh87gp3.fsf@posteo.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::532; envelope-from=jasonross1024@gmail.com; helo=mail-pg1-x532.google.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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.215, 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.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635270773; 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=d6gb9Ah3+ZdA4+BOOu1Naxfm0FlTOEedVdRlCavFMwk=; b=YxqMRKCeOGkwEnpcKuCoBR/3n4Cy7j01pHNHydpNqeB4ptktdLXqDs00Oje33OMC81EKWz CKdgHNg5bjSMRVx9McoT+Nyp3iqk36/V4+giX4+JXzMvIBNN+sKJOxQGtfYHuCHpIUV09C yLivKuMs8Zbb71OPBzuLB7aanyRMIQrGwQ9AbkS4tsnnPB9edk4ia2STwpy+UnET5vQq+F PUNT+5kozjx4TvZzKvmkLoJVCVm+GB1wYY/1zzD5PBm8wJ9vexO7Gj/7VupRrsTXZZ1wvA lmvhK7av1PRY3N3uKHETXWwzAdpkrI4uBZquC15jvjgqDTEyEjSrTV4dUK3wgA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635270773; a=rsa-sha256; cv=none; b=OVs+Rg9D/xCc8dyLdWtI6foWzNoIjXrfBo6Sz0JUfw9nOMEmdSqRos5/QkW01HX4qRfis6 2rDg9JWTX64GOsZnjlGNiqhQJn07R3LzDq/hDxm1HMlgMTsLfdGApmfbYynT7bqEX6aN5O bnPONcYPGFs/Yyg5mRA8F9UFFOpumjwqGBKk8m5Bk/iwOfXcTq4P/hMtelbY0/eTu8JBNN bmGP714fyAC4NnWbi+JE99F+Em/FZonl5qkOYQkh/bDMrmyfRYbwZbKKiehAftTCeGus4d rNkgzd/mzGlr+FMz0bSKniKOrZ4qc28nhCPV3B8hNjP/Fkre+cidATGwIKCKog== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=OMWTXxsa; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.13 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=OMWTXxsa; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 0D6C0100CD X-Spam-Score: -3.13 X-Migadu-Scanner: scn0.migadu.com X-TUID: 4zgPc2FWk9jM Hi Juan, On 10/22/21 5:00 PM, Juan Manuel MacĂ­as wrote: > Hi Jason, > > Jason Ross writes: > >> Are there any workarounds people use to create subfigures in Org Mode >> when exporting to LaTeX? Example output: > > In this thread I explain a procedure to export images as subfigures > using org links: https://list.orgmode.org/87mty1an66.fsf@posteo.net/ > > Best regards, > > Juan Manuel > Those are some really clever solutions. I hadn't considered using a dsl for figure options. I'm looking at declaring a "figure" block the way you are, but `org-element-map'ing over the links inside the block and processing them with the "normal" link-handling machinery. That way, image options work the same way in a subfigure as they do normally. Here's what I'm messing with for the ConTeXt backend (this relies on some changes to figure handling I haven't pushed yet): #+begin_src elisp (defun org-context--special-block-figure (orig-fun special-block contents info) (let ((type (org-element-property :type special-block))) (if (string= "figure" (downcase type)) (let* ((attr (org-export-read-attribute :attr_context special-block)) (links (org-element-map special-block 'link #'identity)) (placefigure-options (org-context--format-arguments (org-context--get-placefigure-options special-block info))) (captionp (mapcan (lambda (link) (let* ((parent (org-export-get-parent-element link)) (caption (org-string-nw-p (org-context--caption/label-string parent info)))) (and caption (list caption)))) links)) (image-codes (mapconcat (lambda (link) (let ((figure-string (org-context--get-link-figure-string link info))) (if captionp (let ((caption (org-string-nw-p (org-context--caption/label-string (org-export-get-parent-element link) info)))) (format "{%s}\n{%s}" figure-string (or caption ""))) (format "{%s}" figure-string))) ) links "\n")) (dimensions (let* ((rows (plist-get attr :rows)) (cols (plist-get attr :cols)) (nlinks (length links))) (if (and rows cols) (cons (string-to-number rows) (string-to-number cols)) (cons 1 nlinks)))) combination-options) (if captionp (push (cons "alternative" "text") combination-options) (push (cons "alternative" "label") combination-options)) (push (cons "nx" (format "%s" (cdr dimensions))) combination-options) (push (cons "ny" (format "%s" (car dimensions))) combination-options) (message (format "%S" combination-options)) (format "\\startplacefigure[%s] \\startcombination[%s] %s \\stopcombination \\stopplacefigure" placefigure-options (org-context--format-arguments combination-options) image-codes)) (funcall orig-fun special-block contents info)))) (advice-add 'org-context-special-block :around #'org-context--special-block-figure) #+end_src