From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp2 ([2001:41d0:8:6d80::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms0.migadu.com with LMTPS
	id KNxlLPRJhGHwSAEAgWs5BA
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Thu, 04 Nov 2021 22:00:36 +0100
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 CIYrKPRJhGGHAwAAB5/wlQ
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Thu, 04 Nov 2021 21:00:36 +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 E2C0527372
	for <larch@yhetil.org>; Thu,  4 Nov 2021 22:00:35 +0100 (CET)
Received: from localhost ([::1]:54560 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 1mijqc-0003Gl-Sr
	for larch@yhetil.org; Thu, 04 Nov 2021 17:00:34 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:47272)
 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 1mijpv-0003Gc-1l
 for emacs-orgmode@gnu.org; Thu, 04 Nov 2021 16:59:51 -0400
Received: from mout01.posteo.de ([185.67.36.65]:42199)
 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 1mijpr-00034s-TB
 for emacs-orgmode@gnu.org; Thu, 04 Nov 2021 16:59:50 -0400
Received: from submission (posteo.de [89.146.220.130]) 
 by mout01.posteo.de (Postfix) with ESMTPS id DD841240026
 for <emacs-orgmode@gnu.org>; Thu,  4 Nov 2021 21:59:42 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1636059582; bh=w4ZY7xcNaDXLTYQX/c5sHuV9mJR89wcbQyJnFtnr6b4=;
 h=From:To:Cc:Subject:Date:From;
 b=T8ogq1JzWdtE2/1lx43VeV88IqT1SZfsJtIJb+1pGXD/unl1oFXs0YMdOhAuT/+qI
 O8Kt25ToEYnVeEofshSJYSAifeHMFYUlRCuME5uWEBKqVw/tulvEUKBBa78nczi9Pi
 zt0uQdkEY/HA5yp4ySrsjPKsqN2fHbeSWozEnOHPqD6JRzkal0k6YC6JF4OghK1rYN
 wqtP2tkXFTrQCast/fVQSA6A5ptOp5lX7+vYN1LrYg1VbSjUvqTuqUdP/pZDloksWZ
 cVKKiEU7Um/pihFcfaIARxKx8a+Vjq8qZ1ZAv5opbtH3BtQn3vBF21o6m7Ms5qBydp
 B296gg7dHX5+A==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4HlbcF6Z5Gz9rxR;
 Thu,  4 Nov 2021 21:59:41 +0100 (CET)
From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= <maciaschain@posteo.net>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Subject: Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables
References: <87mtmvwz3m.fsf@posteo.net> <87y265ryi3.fsf@nicolasgoaziou.fr>
 <87tugtw34f.fsf@posteo.net> <87tugtrsvx.fsf@nicolasgoaziou.fr>
Date: Thu, 04 Nov 2021 20:59:40 +0000
In-Reply-To: <87tugtrsvx.fsf@nicolasgoaziou.fr> (Nicolas Goaziou's message of
 "Wed, 03 Nov 2021 19:33:38 +0100")
Message-ID: <87k0hneiwz.fsf@posteo.net>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
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, 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.29
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: orgmode <emacs-orgmode@gnu.org>
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=1636059636;
	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=Hk0i6hnHd/Lh0Kouf1vCy/+5ZRsrldYmJIkMlsxgrqc=;
	b=XA5AY6gdG/qp63YXiZ8oLTBeIrJnJvmHyMX7dVUYG/mkDCWYggSgUvm5TW2YLgqfHMZQYs
	Q/HhZxx+8IbGMcIIGNWNHcWcOxWo9YhTLFTp7drtaRgscPSqdEHd/Bb0vpX703ekTzw1SJ
	miiep5GKd3nLA6hyKXDYC+Fh4Dwy2BRRZBfYoZVrLtUvzVUEGHaiJXoKRTUtFgZVzRypDT
	+aRACleKyD1avwbWJu0wzcBo8CRYN7kG1e7kn8uy+oxip2Fz97FF9Sb2BFTNZ6dUK1RpPd
	dDhrLzu2lTvnUmGfM53HbWqw67s0h5o0o8s31CP6hZYdSuWEo2GLVU6YjEzYIA==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1636059636; a=rsa-sha256; cv=none;
	b=YIvCQJHBdIRm9w6R4aCrN0blZbcxMSh2Jj/2Z/ZG4FN0zCdY1cW3NVGuSwM6TZOmtJNYUF
	LwyX0CH4/s8k2+CJgzcSSp1rx7NJIL/BSqnZLQSXAaUzMiZrihba0jqavvwYkdC8BLLbpR
	LG0LPeSHhzfZWMvC4Dk/tdZvQi6nP30QYawniyIH3mdmepo6YB40cKUosybfz86EL7tVkh
	s7fUwOskJzta6avWE3GjgyWQwb83Sv0NJNofMZ2BL3xDZTY8a9f9Un19Ci7AqmIcajQiFi
	aLS4x1KMZijOcmrRdu9eCOx3/ENOtJ8hVTdNnDuMbrZWBbg8Y7hlRIC6D1ryow==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=posteo.net header.s=2017 header.b=T8ogq1Jz;
	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.12
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=posteo.net header.s=2017 header.b=T8ogq1Jz;
	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: E2C0527372
X-Spam-Score: -3.12
X-Migadu-Scanner: scn0.migadu.com
X-TUID: XmIevQISb1j/

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

Hi Nicolas,

Nicolas Goaziou writes:

> Good idea. Thanks.

Attached here the updated patch.

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 fc9062caf43956ac68b72f16afbd5584ec84e687 Mon Sep 17 00:00:00 2001
From: Juan Manuel Macias <maciaschain@posteo.net>
Date: Thu, 4 Nov 2021 21:38:26 +0100
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.
* doc/org-manual.org (Tables in LaTeX export): this feature in the manual.
* etc/ORG-NEWS (New :options attribute when exporting tables to
LaTeX): this feature in `ORG-NEWS'.
---
 doc/org-manual.org |  9 +++++++++
 etc/ORG-NEWS       | 14 ++++++++++++++
 lisp/ox-latex.el   |  4 +++-
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index af88b8506..50cdb9101 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13572,6 +13572,14 @@ include:
   The LaTeX export back-end uses these attributes for regular tables
   to set their alignments, fonts, and widths.
 
+- =:options= ::
+
+  The =:options= attribute allows adding an optional argument with a
+  list of various table options (between brackets in LaTeX export),
+  since certain tabular environments, such as =longtblr= of the
+  =tabularray= LaTeX package, provides this structure. For example:
+  =:options remark{Note}={note},remark{Source}={source}=.
+
 - =:spread= ::
 
   When =:spread= is non-~nil~, the LaTeX export back-end spreads or
@@ -19770,6 +19778,7 @@ moves across a special context.
               (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
               (define-key yas/keymap [tab] 'yas/next-field)))
   #+end_src
+
 ** Using Org on a TTY
 :PROPERTIES:
 :DESCRIPTION: Using Org on a tty.
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index d73d0d3c3..626e19335 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -53,6 +53,13 @@ structures is supported.  Storing references between different
 variables is also supported (see =:inherit= key in
 ~org-persist-register~).
 
+*** New :options attribute when exporting tables to LaTeX 
+
+The =:options= attribute allows adding an optional argument with a
+list of various table options (between brackets in LaTeX export),
+since certain tabular environments, such as =longtblr= of the
+=tabularray= LaTeX package, provides this structure.
+
 ** New functions and changes in function arguments
 
 *** New function ~org-element-cache-map~ for quick mapping across Org elements
@@ -1555,6 +1562,7 @@ the headline to use for making the table of contents.
 ,* Another section
 ,#+TOC: headlines 1 :target "#TargetSection"
 #+end_example
+
 ** New functions
 *** ~org-dynamic-block-insert-dblock~
 
@@ -1845,6 +1853,7 @@ CIDER version which has not =sesman= integrated, only has
 (dissoc Clojure 'JVM)
 (conj clojurists "stardiviner")
 #+end_src
+
 *** Add ~:results link~ support for Babel
 
 With this output format, create a link to the file specified in
@@ -1863,14 +1872,17 @@ wget -c "https://ben.akrin.com/crackzor/crackzor_1.0.c.gz"
 #+begin_src js :session "*Javascript REPL*"
 console.log("stardiviner")
 #+end_src
+
 *** Add ~:session~ support of ob-js for Indium
 #+begin_src js :session "*JS REPL*"
 console.log("stardiviner")
 #+end_src
+
 *** Add ~:session~ support of ob-js for skewer-mode
 #+begin_src js :session "*skewer-repl*"
 console.log("stardiviner")
 #+end_src
+
 *** Add support for links to LaTeX equations in HTML export
 Use MathJax links when enabled (by ~org-html-with-latex~), otherwise
 add a label to the rendered equation.
@@ -1957,6 +1969,7 @@ you should expect to see something like:
 #+BEGIN_EXAMPLE
   ,#+STARTUP: shrink
 #+END_EXAMPLE
+
 *** Allow to filter by tags/property when capturing colview
 
 You can now use =:match= to filter entries using a todo/tags/properties
@@ -2339,6 +2352,7 @@ To use =vertica= in an sql =SRC_BLK= set the =:engine= like this:
   SELECT * FROM nodes;
   ,#+END_SRC
 #+END_EXAMPLE
+
 **** C++: New header ~:namespaces~
 
 The new ~:namespaces~ export option can be used to specify namespaces
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.1


--=-=-=--