From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp0 ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms0.migadu.com with LMTPS
	id QJdWGLIneGF1WgAAgWs5BA
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 26 Oct 2021 18:07:14 +0200
Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp0 with LMTPS
	id AKH/E7IneGE0cgAA1q6Kng
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 26 Oct 2021 16:07:14 +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 9A10B1C922
	for <larch@yhetil.org>; Tue, 26 Oct 2021 18:07:13 +0200 (CEST)
Received: from localhost ([::1]:52594 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	id 1mfOym-0005GR-L1
	for larch@yhetil.org; Tue, 26 Oct 2021 12:07:12 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57162)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <maciaschain@posteo.net>)
 id 1mfOxM-0005CH-B5
 for emacs-orgmode@gnu.org; Tue, 26 Oct 2021 12:05:44 -0400
Received: from mout02.posteo.de ([185.67.36.66]:45973)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <maciaschain@posteo.net>)
 id 1mfOxJ-0003d8-92
 for emacs-orgmode@gnu.org; Tue, 26 Oct 2021 12:05:44 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 98DD9240106
 for <emacs-orgmode@gnu.org>; Tue, 26 Oct 2021 18:05:35 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1635264335; bh=ZwASGXF7LwdI3saVAQa1ZhAjApfGSdtH4tPswij10w0=;
 h=From:To:Cc:Subject:Date:From;
 b=abE2OXuZFr7J6y8vLgQmjVrJxz3EcQk1UBuJSILWZE8P64tgo4baZzQSYrQIeCmus
 h7CJ0Aj2ITKfm1BsgFGSvth1iOVFKFFx8odxIMpyCBpOYoEIW/aYPK6B0xmFYL8HBM
 myw0lMMGMIeAs4BnbSxuvxME70uzwZjxkK+o8vqHNv/XpdizUphxbgxLtbdTom/Ijz
 kyZpBCot8oWTyG04s9xyI+IHt9cu3lzuVcL4XQCtEMh3vp4fdHVS0+W+flSgzpRJcf
 a5dL5PqFD6o7oLb+zzNZ355YEMQMzJhQfeygvjZuOFF9uqIeR3cn78Yrh4C0dUs5AV
 d2uulm5lN0Mlg==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4HdxW22YDcz9rxT;
 Tue, 26 Oct 2021 18:05:34 +0200 (CEST)
From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= <maciaschain@posteo.net>
To: orgmode <emacs-orgmode@gnu.org>
Subject: [patch] ox-latex.el: add `:options' LaTeX attribute to tables 
Date: Tue, 26 Oct 2021 16:05:33 +0000
Message-ID: <87mtmvwz3m.fsf@posteo.net>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=185.67.36.66; envelope-from=maciaschain@posteo.net;
 helo=mout02.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, 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.23
Precedence: list
List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=subscribe>
Cc: Vikas Rawal <vikasrawal@gmail.com>
Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org
Sender: "Emacs-orgmode" <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
X-Migadu-Flow: FLOW_IN
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1635264434;
	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:list-id:list-help:list-unsubscribe:
	 list-subscribe:list-post:dkim-signature;
	bh=pK8I0bhWfO26uEkiwlhMIzGZVPPboznvBZUqB+38x5c=;
	b=RtDOBucq4WKQcQJUZvG26uX9d1xGprYZ3lA6NNr+h3ILzOHXmxrkSv//FfQRYJkJRdNYTY
	2VVj9x6tUOksbSLPrDg1QqnebZA8Z12e7tQPhVI+uP4n1qgiJ+QyGNRm3aqGClKDL/9sbu
	iagmd0Wzb465jAg00rZ4zUJV+CzFfr/plNQorHgxEsLYpEUI2mts/t8F1gy+UTR0M6eRmG
	GSibz1n16Od9hv32UvqZ8vprJ0ASskqxQCETmgTWctELlzmsw4vtdw381jHvLcDaWFjxH8
	UHHCl7ZsXWYmdqt4uCQ+ifPZImXeD0CTdIPXlO5iheXdfqZsxtPuxt3lDb2Dhw==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635264434; a=rsa-sha256; cv=none;
	b=h8CJo43uhYe9DCCQyfRz1QofZi0fmg9soKi3PE5g5NjAssDXPfrJb6aXkI02UHVb1bNc0E
	kttit3BkRfGkLsw58G3JSr27tcHVNqNoUpZzpzfGI1in9R1pWMuPCZueyXC1RLOaiYvRC4
	NA0x7bxQjCu0//gfruFAqkncYgN77/ZY0BHIz1CQmW/dQ9vgBofHR6X3iyaUeFhOa+CMRg
	atwx3mGEEoSiVm013MsUvJj/8drp06cTTRvIw2Zu4Tuxla9xeOtZqwlZoiROCzJxvvdcTU
	5PHGIdNoqmd6h0IhxnEqMtv8wrmCbiHf35rR8i/t7KJhTWCyVxCiauER+q4hIQ==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=posteo.net header.s=2017 header.b=abE2OXuZ;
	dmarc=pass (policy=none) header.from=posteo.net;
	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.26
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=posteo.net header.s=2017 header.b=abE2OXuZ;
	dmarc=pass (policy=none) header.from=posteo.net;
	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: 9A10B1C922
X-Spam-Score: -3.26
X-Migadu-Scanner: scn0.migadu.com
X-TUID: hQTspVBQ8DPj

--=-=-=
Content-Type: text/plain

Hi,

The `:options' attr. allows adding an optional argument with various
table options (between brackets in LaTeX export), since certain tabular
environments, such as `longtblr' of the `tabularray' LaTeX package,
provides this structure (see:
https://list.orgmode.org/CALtzAB1yM+uG_xHghCxTLRX5mgbzNvT5+PO=DuaBB28nCsVqEA@mail.gmail.com/#r)

Example:

#+ATTR_LATEX: :environment longtblr
#+ATTR_LATEX: :align colspec = {XXX}, width = 0.85\linewidth
#+ATTR_LATEX: :options remark{Note} = {Lorem ipsum dolor sit amet}

==> \begin{longtblr}[remark{Note} = {Lorem ipsum dolor sit amet}]{colspec = {XXX}, width = 0.85\linewidth}

Best regards,

Juan Manuel


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-ox-latex.el-add-options-latex-attribute-to-tables.patch

>From 9b51d999029f91adc93a6009bc3ddf56bba7ba4a Mon Sep 17 00:00:00 2001
From: Juan Manuel Macias <maciaschain@posteo.net>
Date: Tue, 26 Oct 2021 12:29:55 +0200
Subject: [PATCH] ox-latex.el: add `options' latex attribute to tables

* lisp/ox-latex.el (org-latex--org-table): The `:options' LaTeX
attribute allows adding an optional argument (\begin{env}[opt]), since
certain tabular environments, such as longtblr, accept optional
arguments.
---
 lisp/ox-latex.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 3e3967033..409d92164 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -3314,6 +3314,7 @@ This function assumes TABLE has `org' as its `:type' property and
 `table' as its `:mode' attribute."
   (let* ((attr (org-export-read-attribute :attr_latex table))
 	 (alignment (org-latex--align-string table info))
+         (opt (org-export-read-attribute :attr_latex table :options))
 	 (table-env (or (plist-get attr :environment)
 			(plist-get info :latex-default-table-environment)))
 	 (width
@@ -3343,8 +3344,9 @@ This function assumes TABLE has `org' as its `:type' property and
 		(format "\\end{%s}" table-env)
 		(and fontsize "}"))))
      (t
-      (let ((output (format "\\begin{%s}%s{%s}\n%s\\end{%s}"
+      (let ((output (format "\\begin{%s}%s%s{%s}\n%s\\end{%s}"
 			    table-env
+                            (if opt (format "[%s]" opt) "")
 			    width
 			    alignment
 			    contents
-- 
2.33.0


--=-=-=--