From: "Juan Manuel Macías" <maciaschain@posteo.net>
To: orgmode <emacs-orgmode@gnu.org>
Cc: Vikas Rawal <vikasrawal@gmail.com>
Subject: [patch] ox-latex.el: add `:options' LaTeX attribute to tables
Date: Tue, 26 Oct 2021 16:05:33 +0000 [thread overview]
Message-ID: <87mtmvwz3m.fsf@posteo.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 652 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-latex.el-add-options-latex-attribute-to-tables.patch --]
[-- Type: text/x-patch, Size: 1495 bytes --]
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
next reply other threads:[~2021-10-26 16:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-26 16:05 Juan Manuel Macías [this message]
2021-10-27 3:44 ` [patch] ox-latex.el: add `:options' LaTeX attribute to tables Vikas Rawal
2021-10-27 15:52 ` Juan Manuel Macías
2021-10-28 16:10 ` Vikas Rawal
2021-10-28 18:02 ` Juan Manuel Macías
2021-10-28 19:39 ` Juan Manuel Macías
2021-10-29 1:13 ` Vikas Rawal
2021-10-29 1:07 ` Vikas Rawal
2021-10-29 1:08 ` Vikas Rawal
2021-11-03 16:32 ` Nicolas Goaziou
2021-11-03 17:38 ` Juan Manuel Macías
2021-11-03 18:33 ` Nicolas Goaziou
2021-11-04 20:59 ` Juan Manuel Macías
2021-11-06 13:51 ` Nicolas Goaziou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mtmvwz3m.fsf@posteo.net \
--to=maciaschain@posteo.net \
--cc=emacs-orgmode@gnu.org \
--cc=vikasrawal@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).