emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 8599849: ox-latex: add `options' latex attribute to


From: ELPA Syncer
Subject: [elpa] externals/org 8599849: ox-latex: add `options' latex attribute to tables
Date: Sat, 6 Nov 2021 09:57:29 -0400 (EDT)

branch: externals/org
commit 85998490d974991e095f69cf3b6ff6bfa8c3a14f
Author: Juan Manuel MacĂ­as <maciaschain@posteo.net>
Commit: Nicolas Goaziou <mail@nicolasgoaziou.fr>

    ox-latex: 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 af88b85..29c0362 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 d73d0d3..7bb7fe5 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 3e39670..409d921 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]