From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GJ8bMu8JamDYVwAAgWs5BA (envelope-from ) for ; Sun, 04 Apr 2021 20:48:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id AEARLO8JamCteAAAB5/wlQ (envelope-from ) for ; Sun, 04 Apr 2021 18:48:15 +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 6B49733C97 for ; Sun, 4 Apr 2021 20:48:14 +0200 (CEST) Received: from localhost ([::1]:43774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lT7nA-00062s-24 for larch@yhetil.org; Sun, 04 Apr 2021 14:48:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lT7ld-00062f-Vo for emacs-orgmode@gnu.org; Sun, 04 Apr 2021 14:46:38 -0400 Received: from gateway24.websitewelcome.com ([192.185.51.122]:38286) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lT7la-0006ph-1V for emacs-orgmode@gnu.org; Sun, 04 Apr 2021 14:46:35 -0400 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway24.websitewelcome.com (Postfix) with ESMTP id 565A713502 for ; Sun, 4 Apr 2021 13:46:21 -0500 (CDT) Received: from box2035.bluehost.com ([74.220.219.237]) by cmsmtp with SMTP id T7lMl3zY41cHeT7lNlPmxb; Sun, 04 Apr 2021 13:46:21 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tsdye.online; s=default; h=Content-Type:MIME-Version:Message-ID:Date: Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding: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=6Crxr0tHPTL0xt5iSo26xa1H6rHeuPqAbcjT5nhNCTE=; b=Um/PV4h8LAVhyVoX9Ux5hfuhaP t2u6kLpXz7+kc1QIAtJGG2zjmGT9Qh8UcbCV9D/uHTzJY3gN9LQkORWW7Ae8wncDS4L66BFeovPPo 5Jz5M0YekFjXw44DaKscYDHnjfD8eyqnJfD6k55jPK7X9qx4m63e3puhEJAA9xXvZFwxy9nPlAZLa OqWznnpAb7daTE3Hq1Si6Sd6F/bf5ZHVsyX12Z4tiDEunK/tYze1BKyZc6YushQwIuGSGBj49EjWF ZslCanO/5NlcdsJTDQ2j3t2JdkjAv+pMCkzxXHUOD5T11ug47l/kAxwlDkG30WMajVZZ01G7xqFuk 715rJ9fg==; Received: from cpe-50-113-36-248.hawaii.res.rr.com ([50.113.36.248]:46054 helo=poto-foou.tsdye.online) by box2035.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1lT7lM-002I87-Gr for emacs-orgmode@gnu.org; Sun, 04 Apr 2021 12:46:20 -0600 User-agent: mu4e 1.2.0; emacs 26.3 From: "Thomas S. Dye" To: org-mode Subject: [PATCH] LaTeX export: arbitrary float environments Date: Sun, 04 Apr 2021 08:46:18 -1000 Message-ID: <87o8et6g79.fsf@tsdye.online> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box2035.bluehost.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tsdye.online X-BWhitelist: no X-Source-IP: 50.113.36.248 X-Source-L: No X-Exim-ID: 1lT7lM-002I87-Gr X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: cpe-50-113-36-248.hawaii.res.rr.com (poto-foou.tsdye.online) [50.113.36.248]:46054 X-Source-Auth: tsd@tsdye.online X-Email-Count: 1 X-Source-Cap: dHNkeWVvbmw7dHNkeWVvbmw7Ym94MjAzNS5ibHVlaG9zdC5jb20= X-Local-Domain: yes Received-SPF: pass client-ip=192.185.51.122; envelope-from=tsd@tsdye.online; helo=gateway24.websitewelcome.com X-Spam_score_int: 17 X-Spam_score: 1.7 X-Spam_bar: + X-Spam_report: (1.7 / 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, FROM_SUSPICIOUS_NTLD=0.5, FROM_SUSPICIOUS_NTLD_FP=1.307, PDS_OTHER_BAD_TLD=1.999, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no 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: , 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=1617562095; 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:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=6Crxr0tHPTL0xt5iSo26xa1H6rHeuPqAbcjT5nhNCTE=; b=AEDNimjmjmCVVCdqbqwWW6xV2LQXktWdQypEeXwZi04vh3VIWJd+p+X/8VBShGy5W97otV CUobZ3AgYJZSt+fdQT7Ix+qJOeXotD/1tmoaUVHFLIaLOKkePLda1w7Iv/3DYgmIRxo6uf 6wMpAN2m0sR8tmSlVqK7x3/9o0gE+6JqQi5inIS6oKgokofgtvD3jMZYs/zYFPHqm1iuoq hotFx966T6cbDekZdgw9o7qo9dYQt0DDblWaxGhZd+i1THbFemz4D1/PW1HT9ZRVG5l3tL MvhrJJeC89BCYqfPZf5RyMgUsz2OUyMCspjMoSPObgjMJFC22cY5bmMtpAjNKw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1617562095; a=rsa-sha256; cv=none; b=KLBsp7sdVLRzi/+po1lZIDzeL+BZYMWbTfZm3G4sxkQgP1o+41nQMWFFZyxOwtP8DwLNHX ajtbEnuUOjYKHHu1tNhnsWpewsVfC/QQb/25CmJi6VDoqlk8sgWo3gVRQqGBv88JqlMC8u 5HtmbjFKaX78Ir/4EEk6I2DReG+f96QrTkyaezXQNgkqmmR7w8YhNSbO/cb8I9C59/kKSi SUU9OBhiGRTuFjPm8mEEKcRwS4/ll/NdMu2z1A9qRpvTNVYy9NhDkdkU5tG/rBejcKfnYL 1JEMNrcQrJZgA4E/kNetKveqvt+9dogpR6zZ7Mk58+L3mcYl4ojg53VRgikH7g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tsdye.online header.s=default header.b="Um/PV4h8"; dmarc=none; 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: -1.44 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tsdye.online header.s=default header.b="Um/PV4h8"; dmarc=none; 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: 6B49733C97 X-Spam-Score: -1.44 X-Migadu-Scanner: scn0.migadu.com X-TUID: mgW2RNcfmW+v --=-=-= Content-Type: text/plain; format=flowed Aloha all, LaTeX users are able to define arbitrary float types, e.g. with the float package. The attached patch makes them accessible from Org mode. This is a follow on to my efforts several years ago to support the Tufte-LaTeX package in Org mode, and a suggestion at the time (by Rasmus iirc) to implement an :environment attribute for LaTeX export. This patch achieves a similar goal, but is a bit lighter imo. Let me know if you have questions. All the best, Tom --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-LaTeX-export-arbitrary-float-environments.patch Content-Description: patch >From 5154901b781f93d08851f96431c976f010fc420c Mon Sep 17 00:00:00 2001 From: "Thomas S. Dye" Date: Sun, 4 Apr 2021 08:11:40 -1000 Subject: [PATCH] LaTeX export: arbitrary float environments * lisp/ox-latex.el (`org-latex--inline-image', `org-latex--decorate table'): recognize arbitrary :float value. LaTeX users are able to define arbitrary float types. This patch makes them accessible from Org mode. * etc/ORG-NEWS: Announce new :float capability. --- etc/ORG-NEWS | 6 +++++- lisp/ox-latex.el | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 9fc126b2f..cdfb1c727 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -12,6 +12,10 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org. * Version 9.5 (not yet released) ** New options and settings +*** LaTeX attribute ~:float~ now passes through arbitrary values + +LaTeX users are able to define arbitrary float types, e.g. with the float package. The Org mode LaTeX exporter is now able to process and export arbitrary float types. The user is responsible for ensuring that Org mode configures LaTeX to process any new float type. + *** Option ~org-hidden-keywords~ now also applies to #+SUBTITLE: The option ~org-hidden-keywords~ previously applied @@ -106,7 +110,7 @@ behavior. By default ox-html now inlines webp images. ** New features -*** =ob-python= improvements to =:return= header argument +*** =ob-python= improvements to =:return= header argument The =:return= header argument in =ob-python= now works for session blocks as well as non-session blocks. Also, it now works with the diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 376d27a07..514801d7c 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -2377,6 +2377,7 @@ used as a communication channel." ((string= float "sideways") 'sideways) ((string= float "multicolumn") 'multicolumn) ((and (plist-member attr :float) (not float)) 'nonfloat) + (float float) ((or float (org-element-property :caption parent) (org-string-nw-p (plist-get attr :caption))) @@ -2470,6 +2471,18 @@ used as a communication channel." nil t)))) ;; Return proper string, depending on FLOAT. (pcase float + ((and (pred stringp) env-string) + (format "\\begin{%s}%s +%s%s +%s%s +%s\\end{%s}" + env-string + placement + (if caption-above-p caption "") + (if center "\\centering" "") + comment-include image-code + (if caption-above-p "" caption) + env-string)) (`wrap (format "\\begin{wrapfigure}%s %s%s %s%s @@ -3200,7 +3213,7 @@ centered." (defun org-latex--decorate-table (table attributes caption above? info) "Decorate TABLE string with caption and float environment. -ATTRIBUTES is the plist containing is LaTeX attributes. CAPTION +ATTRIBUTES is the plist containing LaTeX attributes. CAPTION is its caption, as a string or nil. It is located above the table if ABOVE? is non-nil. INFO is the plist containing current export parameters. @@ -3211,6 +3224,7 @@ Return new environment, as a string." (cond ((and (not float) (plist-member attributes :float)) nil) ((member float '("sidewaystable" "sideways")) "sidewaystable") ((equal float "multicolumn") "table*") + (float float) ((or float (org-string-nw-p caption)) "table") (t nil)))) (placement -- 2.25.1 --=-=-= Content-Type: text/plain; format=flowed -- Thomas S. Dye https://tsdye.online/tsdye --=-=-=--