emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [patch] ox-latex.el: add `:options' LaTeX attribute to tables
@ 2021-10-26 16:05 Juan Manuel Macías
  2021-10-27  3:44 ` Vikas Rawal
  2021-11-03 16:32 ` Nicolas Goaziou
  0 siblings, 2 replies; 14+ messages in thread
From: Juan Manuel Macías @ 2021-10-26 16:05 UTC (permalink / raw)
  To: orgmode; +Cc: Vikas Rawal

[-- 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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables
  2021-10-26 16:05 [patch] ox-latex.el: add `:options' LaTeX attribute to tables Juan Manuel Macías
@ 2021-10-27  3:44 ` Vikas Rawal
  2021-10-27 15:52   ` Juan Manuel Macías
  2021-11-03 16:32 ` Nicolas Goaziou
  1 sibling, 1 reply; 14+ messages in thread
From: Vikas Rawal @ 2021-10-27  3:44 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode


>
> 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}

This is excellent. There is only one improvement that I would like you to consider. Is it possible to allow multiple ":options " lines that are appended when exported to
+latex? Something like this:

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

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

This would be more elegant since table notes can be elaborate and putting them all in one line would make them unwieldy.

At the moment, only the last ":options" line is considered.

Thanks a lot.

Vikas


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables
  2021-10-27  3:44 ` Vikas Rawal
@ 2021-10-27 15:52   ` Juan Manuel Macías
  2021-10-28 16:10     ` Vikas Rawal
  0 siblings, 1 reply; 14+ messages in thread
From: Juan Manuel Macías @ 2021-10-27 15:52 UTC (permalink / raw)
  To: Vikas Rawal; +Cc: orgmode

Hi Vikas,

Vikas Rawal writes:

> This is excellent. There is only one improvement that I would like you to consider. Is it possible to allow multiple ":options " lines that are appended when exported to
> +latex? Something like this:
>
> #+ATTR_LATEX: :environment longtblr
> #+ATTR_LATEX: :align colspec = {XXX}, width = 0.85\linewidth
> #+ATTR_LATEX: :options remark{Note} = {Lorem ipsum dolor sit amet}
> #+ATTR_LATEX: :options remark{Source} = {The source of data}
>
>  ==> \begin{longtblr}[remark{Note} = {Lorem ipsum dolor sit amet},
>                       remark{Source} = {The source of data}]{colspec = {XXX}, width = 0.85\linewidth}
>
> This would be more elegant since table notes can be elaborate and putting them all in one line would make them unwieldy.
>
> At the moment, only the last ":options" line is considered.

The normal behavior is that you cannot put more than one property
`:foo', because in that case only the value of the last one is added
when exporting to LaTeX (ther is a property list where each property has
a string value).

I can think of a somewhat tricky solution, in case you want to adapt it
to your use case:

First, you need to convert a plist to an alist (source:
https://caiorss.github.io/Emacs-Elisp-Programming/Elisp_Programming.html#sec-1-8-4):

#+begin_src emacs-lisp
(defun plist->alist (plist)
  (if (null plist)
      '()
    (cons
     (list (car plist) (cadr plist))
     (plist->alist (cddr plist)))))
#+end_src

And this would be the modified function:

#+begin_src emacs-lisp
(defun 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))
	 ;; various `:options' props ;;;; <== modified from here
	 (attr-alist (plist->alist attr))
	 (options-list)
	 (options-str (progn
			(mapc (lambda (m)
				(when (eq (car m) :options)
				  (add-to-list 'options-list (cdr m))))
			      attr-alist)
			(mapconcat (lambda (x) (mapconcat 'identity x "")) options-list " ")))
	 ;;;;;;;; < == to here
	 (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
                            ;; modified here
			    (if options-list (format "[%s]" options-str) "")
			    width
			    alignment
			    contents
			    table-env)))
	(org-latex--decorate-table output attr caption above? info))))))
#+end_src

Pleas tell me if it works for you.

Best regards,

Juan Manuel 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables
  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
  0 siblings, 1 reply; 14+ messages in thread
From: Vikas Rawal @ 2021-10-28 16:10 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode



>
> First, you need to convert a plist to an alist (source:
> https://caiorss.github.io/Emacs-Elisp-Programming/Elisp_Programming.html#sec-1-8-4):
>
>
> And this would be the modified function:
>


This still seems to exporting the second "options" value only.

Vikas


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables
  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
                           ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Juan Manuel Macías @ 2021-10-28 18:02 UTC (permalink / raw)
  To: Vikas Rawal; +Cc: orgmode

Vikas Rawal writes:

> This still seems to exporting the second "options" value only.

Do you still keep this line in your init:

(advice-add 'org-latex--org-table :override #'my/org-latex--org-table) ?

If so, rename the function from my previous email as
`my/org-latex-org-table' and re-evaluate it. And comment the old
`my/org-latex-org-table'.

The new function works well for me. E.g. this:

#+ATTR_LATEX: :environment longtblr
#+ATTR_LATEX: :align align
#+ATTR_LATEX: :options options 1
#+ATTR_LATEX: :options options 2
#+ATTR_LATEX: :options options 3
#+ATTR_LATEX: :options options 4
| lorem | lorem | lorem | lorem | lorem |
|-------+-------+-------+-------+-------|
| ipsum | ipsum | ipsum | ipsum | ipsum |

produces in LaTeX this:

\begin{longtblr}[options 1 options 2 options 3 options 4]{align}
lorem & lorem & lorem & lorem & lorem\\
\hline
ipsum & ipsum & ipsum & ipsum & ipsum\\
\end{longtblr}


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables
  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
  2 siblings, 1 reply; 14+ messages in thread
From: Juan Manuel Macías @ 2021-10-28 19:39 UTC (permalink / raw)
  To: Vikas Rawal; +Cc: orgmode

Juan Manuel Macías writes:

> \begin{longtblr}[options 1 options 2 options 3 options 4]{align}

PS: I think the options should be separated by commas. In this
case, it's necessary to replace the line:

(mapconcat (lambda (x) (mapconcat 'identity x "")) options-list " ")))

by this line:

(mapconcat (lambda (x) (mapconcat 'identity x "")) options-list ",")))

Best regards,

Juan Manuel 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables
  2021-10-28 18:02       ` Juan Manuel Macías
  2021-10-28 19:39         ` Juan Manuel Macías
@ 2021-10-29  1:07         ` Vikas Rawal
  2021-10-29  1:08         ` Vikas Rawal
  2 siblings, 0 replies; 14+ messages in thread
From: Vikas Rawal @ 2021-10-29  1:07 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

>
> Do you still keep this line in your init:
>
> (advice-add 'org-latex--org-table :override #'my/org-latex--org-table) ?

You were right. My bad.

I confirm, the new function works and is a significant improvement.

Vikas


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables
  2021-10-28 18:02       ` Juan Manuel Macías
  2021-10-28 19:39         ` Juan Manuel Macías
  2021-10-29  1:07         ` Vikas Rawal
@ 2021-10-29  1:08         ` Vikas Rawal
  2 siblings, 0 replies; 14+ messages in thread
From: Vikas Rawal @ 2021-10-29  1:08 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

> Do you still keep this line in your init:
>
> (advice-add 'org-latex--org-table :override #'my/org-latex--org-table) ?
>
> If so, rename the function from my previous email as
> `my/org-latex-org-table' and re-evaluate it. And comment the old
> `my/org-latex-org-table'.
>

You were right. My bad. I should have been more careful.

I confirm, the new function works and is a significant improvement.

Vikas


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables
  2021-10-28 19:39         ` Juan Manuel Macías
@ 2021-10-29  1:13           ` Vikas Rawal
  0 siblings, 0 replies; 14+ messages in thread
From: Vikas Rawal @ 2021-10-29  1:13 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

> > \begin{longtblr}[options 1 options 2 options 3 options 4]{align}
>
> PS: I think the options should be separated by commas. In this
> case, it's necessary to replace the line:
>
> (mapconcat (lambda (x) (mapconcat 'identity x "")) options-list " ")))
>
> by this line:
>
> (mapconcat (lambda (x) (mapconcat 'identity x "")) options-list ",")))

I think the user can just write the comma in the option lines. It
might be more flexible to leave it to the user. I am just thinking of
a possibility that some other package may require a different
delimiter between options.

But others may have a different view.

I think this modification is useful and an improvement, and should be incorporated in orgmode itself.

I expect Nicholas would have a sense of whether this is likely to conflict with anything, or if there are some other considerations. Would be great to know from him and others in the know.

Thank you very much.

Vikas


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables
  2021-10-26 16:05 [patch] ox-latex.el: add `:options' LaTeX attribute to tables Juan Manuel Macías
  2021-10-27  3:44 ` Vikas Rawal
@ 2021-11-03 16:32 ` Nicolas Goaziou
  2021-11-03 17:38   ` Juan Manuel Macías
  1 sibling, 1 reply; 14+ messages in thread
From: Nicolas Goaziou @ 2021-11-03 16:32 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: Vikas Rawal, orgmode

Hello,

Juan Manuel Macías <maciaschain@posteo.net> writes:

> 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}

Thank you.

Could you also document it in the manual?

Regards,
-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables
  2021-11-03 16:32 ` Nicolas Goaziou
@ 2021-11-03 17:38   ` Juan Manuel Macías
  2021-11-03 18:33     ` Nicolas Goaziou
  0 siblings, 1 reply; 14+ messages in thread
From: Juan Manuel Macías @ 2021-11-03 17:38 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: orgmode

Hi Nicolas,

Nicolas Goaziou writes:

> Thank you.
>
> Could you also document it in the manual?

Of course, tomorrow I will upload an updated version of the patch with
the documentation in the manual. Should I also add an entry in ORG-NEWS,
in "Version 9.6" node?

Best regards,

Juan Manuel 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables
  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
  0 siblings, 1 reply; 14+ messages in thread
From: Nicolas Goaziou @ 2021-11-03 18:33 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

Juan Manuel Macías <maciaschain@posteo.net> writes:

> Of course, tomorrow I will upload an updated version of the patch with
> the documentation in the manual. Should I also add an entry in ORG-NEWS,
> in "Version 9.6" node?

Good idea. Thanks.

Regards,


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables
  2021-11-03 18:33     ` Nicolas Goaziou
@ 2021-11-04 20:59       ` Juan Manuel Macías
  2021-11-06 13:51         ` Nicolas Goaziou
  0 siblings, 1 reply; 14+ messages in thread
From: Juan Manuel Macías @ 2021-11-04 20:59 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: orgmode

[-- Attachment #1: Type: text/plain, Size: 122 bytes --]

Hi Nicolas,

Nicolas Goaziou writes:

> Good idea. Thanks.

Attached here the updated patch.

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: 5073 bytes --]

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [patch] ox-latex.el: add `:options' LaTeX attribute to tables
  2021-11-04 20:59       ` Juan Manuel Macías
@ 2021-11-06 13:51         ` Nicolas Goaziou
  0 siblings, 0 replies; 14+ messages in thread
From: Nicolas Goaziou @ 2021-11-06 13:51 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode

Hello,

Juan Manuel Macías <maciaschain@posteo.net> writes:

> Attached here the updated patch.

Applied. Thank you.

I added two spaces between sentences in org-manual.org.

Regards,
-- 
Nicolas Goaziou


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-11-06 13:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 16:05 [patch] ox-latex.el: add `:options' LaTeX attribute to tables Juan Manuel Macías
2021-10-27  3:44 ` 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

Code repositories for project(s) associated with this 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).