From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 OMU0KOaiMGGXNwEAgWs5BA (envelope-from ) for ; Thu, 02 Sep 2021 12:09:42 +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 EADqI+aiMGGqMwAAB5/wlQ (envelope-from ) for ; Thu, 02 Sep 2021 10:09:42 +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 D05EF24ECB for ; Thu, 2 Sep 2021 12:09:41 +0200 (CEST) Received: from localhost ([::1]:38184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mLjfA-0007Kn-6q for larch@yhetil.org; Thu, 02 Sep 2021 06:09:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mLjeW-0007K9-SP for emacs-orgmode@gnu.org; Thu, 02 Sep 2021 06:09:02 -0400 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]:34335) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mLjeS-0006ep-Vf for emacs-orgmode@gnu.org; Thu, 02 Sep 2021 06:08:58 -0400 Received: by mail-io1-xd29.google.com with SMTP id y18so1718283ioc.1 for ; Thu, 02 Sep 2021 03:08:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Z2EgLJUs95xmucvA6gVxonNvnrb+aToq0plnplm2kT8=; b=CG0+rGyRLEs6cmeSWsgjc7wUyKsOLn3UACF8KM87GnNbtUPLbQ/rsWX9kf1mQgZZJw 88BqBZCcERvogxng03aMMQ9RbMfrz1+1oQ+R5d936tgikZ7yt/bmUMm2lVr9yi7DXyoU echcSy8tyVsPCMDVJTY/uGoN8zHfiZRonJnNHH7yso4BUmE15Tn2k9Uk9cob0cUOk7t9 LJxRwZ+/7tZGNBhIAOJrzexSTw0lcIJqlYQppqEwZYiOCpCZaIhIGv3fzePVuaaB4L08 yse0Axdm73hWsIEbJVBc4rDiinV/zWV8zuD4MEPbB1PhAR6DTk3VMdC0kcZfWnxTskzG 34Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Z2EgLJUs95xmucvA6gVxonNvnrb+aToq0plnplm2kT8=; b=RsFIlJdnyK0kDODbudiaAzTQ/x74a514ltDR9dKdqlNzUHT4pv3HFQLWgqBPARMKVw h+d6DebSKbVqeOYZJYhJAsT7SO0FXjEoRDXGEOFcZU10OmwtzYxcL88dCNCU0+8hwwJj ZUXfVp9KmhRxTCQYqVONG2H62yGAslXBwcU3pEt8uMbz3gQ/DDu18HT68CocIAwQGEDi Ae+i976yDECqeZttxDWTV/t8svuTNokkixXoBnENA3RMMQTfkyMPrLRlnCPmB00xOCFn 17k4/PEwFCvN/2R4i7GoceQndKR3X9pFYJ7SLMVQGGq8+LbGx6oGAU9ViDj6QalTSWAr DytQ== X-Gm-Message-State: AOAM531DcRV0lxWAd0+G98LQBlTvHjViz3d0ofNSzgQ7N6vIIdfOp3vP riHMtHfiiuMVYgcDvYeL/+nABoFDNEwpM/T8OnnQiYmuZGo= X-Google-Smtp-Source: ABdhPJwlZ569QuqMwEJoEIjwDLNM9E6QhIjUaB5c89cL0pLvwaxqQa49Pp9cD+tLNhSwNr9ROWJIIb8BG7hrPuzki2A= X-Received: by 2002:a5d:8acf:: with SMTP id e15mr2071779iot.184.1630577335583; Thu, 02 Sep 2021 03:08:55 -0700 (PDT) MIME-Version: 1.0 References: <87ilzjgyqg.fsf@posteo.net> In-Reply-To: <87ilzjgyqg.fsf@posteo.net> From: Vikas Rawal Date: Thu, 2 Sep 2021 15:38:43 +0530 Message-ID: Subject: Re: Support for tabularray in LaTeX export To: =?UTF-8?Q?Juan_Manuel_Mac=C3=ADas?= Content-Type: multipart/alternative; boundary="000000000000ddca8e05cb005e6c" Received-SPF: pass client-ip=2607:f8b0:4864:20::d29; envelope-from=vikasrawal@gmail.com; helo=mail-io1-xd29.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_FROM=0.001, HTML_MESSAGE=0.001, 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=1630577382; 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=Z2EgLJUs95xmucvA6gVxonNvnrb+aToq0plnplm2kT8=; b=Bk4bMlVarcy0rNS/Wx0/TFNhgliJttBYcAC/31Ti3SJVI9HesTFgz3v+Mc2P2LHQiGEjIA 9+lqTJxwO+zR3T/GZcJvlSrWQbZdxlU6zRHQKM6WMVfcPXY+vaSP8FEsoa3U6N9j2kMmiR Z6ucYhr19y1RfEtUi0UcKB0saRoMk5PC07GuI4B1I0I+LWePm3A4xsKCE319Bx/2/6yQAG wqtDLWkKqJ6PUwWxgONPg3/xT/+Q8P6Qsp51pXu9mS1HCx4gwa/v6EyZ3CgUgwQEDOAWDw OnqJlmKGamNXHMd5OP7whPRaiZIPvpPO1ItJxZHq2AQ0ffAF3WejtzCLoAMYgw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630577382; a=rsa-sha256; cv=none; b=bD6edwZIkKr2weqDejI7T6hXeNFgMYtgSsPje1jF5/xQm5RK7YAsSwZTe4fCSdI/FvMDXq cmaA7lEXcqriBU0Og5igIBoMHNpAQUQBiQR49C/vd+VVXQqRvcEUecVET2NIR/R580HrRL 6Qrt5Pxu+T90zMAzDUDSJHI+0uUxrkJmDWiHmJQYJN4mJ7Ld8Uk9Vp1dKD4WtNIsxm2zRB 0OTzxsaO27H6KxvWGme3yuhwx9REJndpOdxvNrdIfasrhKRvX7TEfpPjWGawXhV/6Brv3G nbMdXUN73qJZzdBVoYnFBL+7stvr8WGVfwflic/HV8AW1SZ/Mx+pMu/s289S8A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CG0+rGyR; 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.12 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CG0+rGyR; 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: D05EF24ECB X-Spam-Score: -3.12 X-Migadu-Scanner: scn1.migadu.com X-TUID: Q7J2biPTexJO --000000000000ddca8e05cb005e6c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable This is perfect. Thank you, Juan Manuel. Vikas On Thu, 2 Sept 2021 at 14:06, Juan Manuel Mac=C3=ADas wrote: > Hi Vikas, > > You can define a modified version of `org-latex--org-table', > adding a new LaTeX attribute `:options'. Something like this: > > #+begin_src emacs-lisp > (defun my/org-latex--org-table (table contents info) > "Return appropriate LaTeX code for an Org table. > > TABLE is the table type element to transcode. CONTENTS is its > contents, as a string. INFO is a plist used as a communication > channel. > > 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 > (let ((w (plist-get attr :width))) > (cond ((not w) "") > ((member table-env '("tabular" "longtable")) "") > ((member table-env '("tabu" "longtabu")) > (format (if (plist-get attr :spread) " spread %s " > " to %s ") > w)) > (t (format "{%s}" w))))) > (caption (org-latex--caption/label-string table info)) > (above? (org-latex--caption-above-p table info))) > (cond > ((member table-env '("longtable" "longtabu")) > (let ((fontsize (let ((font (plist-get attr :font))) > (and font (concat font "\n"))))) > (concat (and fontsize (concat "{" fontsize)) > (format "\\begin{%s}%s{%s}\n" table-env width alignment) > (and above? > (org-string-nw-p caption) > (concat caption "\\\\\n")) > contents > (and (not above?) > (org-string-nw-p caption) > (concat caption "\\\\\n")) > (format "\\end{%s}" table-env) > (and fontsize "}")))) > (t > (let ((output (format "\\begin{%s}%s%s{%s}\n%s\\end{%s}" > table-env > (if opt opt "") > width > alignment > contents > table-env))) > (org-latex--decorate-table output attr caption above? info)))))) > > (advice-add 'org-latex--org-table :override #'my/org-latex--org-table) > #+end_src > > and then: > > #+ATTR_LATEX: :environment longtblr > #+ATTR_LATEX: :align > #+ATTR_LATEX: :booktabs t > #+ATTR_LaTeX: :options [] > > Best regards, > > Juan Manuel > > Vikas Rawal writes: > > > tabularray (CTAN: Package tabularray) provides longtblr environment > > that is called as > > > > --- > > \begin{longtblr}[various-table-options]{column and row specifications} > > > > \end{longtblr} > > --- > > > > Adding something like the following to orgmode tables makes them > > export nicely as longtblr > > > > --- > > #+ATTR_LATEX: :environment longtblr > > #+ATTR_LATEX: :align width=3D0.8\textwidth,colspec=3D{lX[2,r]X[3,r]X > > [r,bg=3Dgray9]} > > #+ATTR_LATEX: :booktabs t > > --- > > > > Everything seems to work very well with orgmode except that I cannot > > figure out how to pass [various table options] from orgmode. These > > table options include, most importantly, table notes. > > > > I normally use threeparttable for table notes, but longtblr does not > > seem to work with threeparttable and has its own syntax for table > > notes. > > > > Any advice on how to pass [table-options] to longtblr environment? > > > > Vikas > > > --000000000000ddca8e05cb005e6c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
This is perfect. Thank you, Juan Manuel.

Vikas

On Thu, 2 Sept 2021 at 14:06, Juan Manuel Mac=C3=ADas <maciaschain@posteo.net> wrote:=
Hi Vikas,

You can define a modified version of `org-latex--org-table',
adding a new LaTeX attribute `:options'. Something like this:

#+begin_src emacs-lisp
(defun my/org-latex--org-table (table contents info)
=C2=A0 "Return appropriate LaTeX code for an Org table.

TABLE is the table type element to transcode.=C2=A0 CONTENTS is its
contents, as a string.=C2=A0 INFO is a plist used as a communication
channel.

This function assumes TABLE has `org' as its `:type' property and `table' as its `:mode' attribute."
=C2=A0 (let* ((attr (org-export-read-attribute :attr_latex table))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(alignment (org-latex--align-string table= info))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(opt (org-export-read-attribute :attr_lat= ex table :options))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(table-env (or (plist-get attr :environme= nt)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 (plist-get info :latex-default-table-environment)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(width
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (let ((w (plist-get attr :width)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (cond ((not w) "")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((member tab= le-env '("tabular" "longtable")) "")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((member tab= le-env '("tabu" "longtabu"))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(forma= t (if (plist-get attr :spread) " spread %s "
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0" to %s ")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0w))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (t (format &= quot;{%s}" w)))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(caption (org-latex--caption/label-string= table info))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(above? (org-latex--caption-above-p table= info)))
=C2=A0 =C2=A0 (cond
=C2=A0 =C2=A0 =C2=A0((member table-env '("longtable" "lo= ngtabu"))
=C2=A0 =C2=A0 =C2=A0 (let ((fontsize (let ((font (plist-get attr :font))) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 (and font (concat font "\n")))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (concat (and fontsize (concat "{" fon= tsize))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (format "\\beg= in{%s}%s{%s}\n" table-env width alignment)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (and above?
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(org-string-nw-p caption)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(concat caption "\\\\\n"))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 contents
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (and (not above?) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(org-string-nw-p caption)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(concat caption "\\\\\n"))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (format "\\end= {%s}" table-env)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (and fontsize "= ;}"))))
=C2=A0 =C2=A0 =C2=A0(t
=C2=A0 =C2=A0 =C2=A0 (let ((output (format "\\begin{%s}%s%s{%s}\n%s\\e= nd{%s}"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 table-env
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (if opt opt "")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 width
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 alignment
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 contents
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 table-env)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (org-latex--decorate-table output attr caption = above? info))))))

(advice-add 'org-latex--org-table :override #'my/org-latex--org-tab= le)
#+end_src

and then:

#+ATTR_LATEX: :environment longtblr
#+ATTR_LATEX: :align <align-options>
#+ATTR_LATEX: :booktabs t
#+ATTR_LaTeX: :options [<options>]

Best regards,

Juan Manuel

Vikas Rawal writes:

> tabularray (CTAN: Package tabularray) provides longtblr environment > that is called as
>
> ---
> \begin{longtblr}[various-table-options]{column and row specifications}=
>
> \end{longtblr}
> ---
>
> Adding something like the following to orgmode tables makes them
> export nicely as longtblr
>
> ---
> #+ATTR_LATEX: :environment longtblr
> #+ATTR_LATEX: :align width=3D0.8\textwidth,colspec=3D{lX[2,r]X[3,r]X > [r,bg=3Dgray9]}
> #+ATTR_LATEX: :booktabs t
> ---
>
> Everything seems to work very well with orgmode except that I cannot > figure out how to pass [various table options] from orgmode. These
> table options include, most importantly, table notes.
>
> I normally use threeparttable for table notes, but longtblr does not > seem to work with threeparttable and has its own syntax for table
> notes.
>
> Any advice on how to pass [table-options] to longtblr environment?
>
> Vikas
>
--000000000000ddca8e05cb005e6c--