summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Nikishkin <for.emacs-table.el-environment-patch_2022-05-09@lockywolf.net>2022-05-09 12:03:33 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-05-09 12:03:42 +0200
commit6b6b2c11edc46517a3a1ac9f869bdd40adf8a3df (patch)
treee18a8b4efc80c60804337f64c8503622681e8583
parent52a27a67c1f501898bdb13841ce07609bbe4772e (diff)
downloademacs-6b6b2c11edc46517a3a1ac9f869bdd40adf8a3df.tar.gz
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.
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/textmodes/table.el15
2 files changed, 19 insertions, 2 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 5860010f022..92a956c176d 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 2175900194c..5093a994423 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