emacs-diffs
[Top][All Lists]
Advanced

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

master 6b6b2c11ed: Add new user option table-latex-environment


From: Lars Ingebrigtsen
Subject: master 6b6b2c11ed: Add new user option table-latex-environment
Date: Mon, 9 May 2022 06:03:47 -0400 (EDT)

branch: master
commit 6b6b2c11edc46517a3a1ac9f869bdd40adf8a3df
Author: Vladimir Nikishkin 
<for.emacs-table.el-environment-patch_2022-05-09@lockywolf.net>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Add new user option table-latex-environment
    
    * lisp/textmodes/table.el (table-latex-environment): New user
    option (bug#55333).
    (table--generate-source-prologue): Use it.
---
 etc/NEWS                |  6 ++++++
 lisp/textmodes/table.el | 15 +++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 5860010f02..92a956c176 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2135,6 +2135,12 @@ This holds the value of the previous call to 
'set-locale-environment'.
 This macro can be used to change the locale temporarily while
 executing code.
 
+** table.el
+
+---
+*** New user option 'table-latex-environment'.
+This allows switching between "table" and "tabular".
+
 ** Tabulated List Mode
 
 +++
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index 2175900194..5093a99442 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -753,6 +753,16 @@ the cell contents dynamically."
   :type 'string
   :group 'table)
 
+(defcustom table-latex-environment "tabular"
+  "Which tabular-compatible environment to use when generating latex.
+\"tabular\" and \"longtable\" are known to work."
+  :tag "Latex environment used to export tables"
+  :type '(choice
+         (const :tag "tabular" "tabular")
+         (const :tag "longtable"  "longtable")
+          string)
+  :version "29.1")
+
 (defcustom table-cals-thead-rows 1
   "Number of top rows to become header rows in CALS table."
   :tag "CALS Header Rows"
@@ -3025,7 +3035,8 @@ CALS (DocBook DTD):
                "")))
      ((eq language 'latex)
       (insert (format "%% This LaTeX table template is generated by emacs 
%s\n" emacs-version)
-             "\\begin{tabular}{|" (apply #'concat (make-list (length col-list) 
"l|")) "}\n"
+             "\\begin{" table-latex-environment "}{|"
+              (apply #'concat (make-list (length col-list) "l|")) "}\n"
              "\\hline\n"))
      ((eq language 'cals)
       (insert (format "<!-- This CALS table template is generated by emacs %s 
-->\n" emacs-version)
@@ -3051,7 +3062,7 @@ CALS (DocBook DTD):
      ((eq language 'html)
       (insert "</table>\n"))
      ((eq language 'latex)
-      (insert "\\end{tabular}\n"))
+      (insert "\\end{" table-latex-environment "}\n"))
      ((eq language 'cals)
       (set-marker-insertion-type (table-get-source-info 'colspec-marker) t) ;; 
insert before
       (save-excursion



reply via email to

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