GNU bug report logs - #55333
[PATCH] Choose latex environment for table.el export

Previous Next

Package: emacs;

Reported by: Vladimir Nikishkin <for.emacs-table.el-environment-patch_2022-05-09 <at> lockywolf.net>

Date: Mon, 9 May 2022 07:05:03 UTC

Severity: normal

Tags: patch

Merged with 55329

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55333 in the body.
You can then email your comments to 55333 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55333; Package emacs. (Mon, 09 May 2022 07:05:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vladimir Nikishkin <for.emacs-table.el-environment-patch_2022-05-09 <at> lockywolf.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 09 May 2022 07:05:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Vladimir Nikishkin
 <for.emacs-table.el-environment-patch_2022-05-09 <at> lockywolf.net>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Choose latex environment for table.el export
Date: Mon, 09 May 2022 10:30:57 +0800
Dear Emacs Developers,

Please, consider this patch for inclusion.
This patch slightly generalises the way Emacs' table.el handles
latex export.
Currently, the export always uses the "tabular" environment.
This patch adds a customize option to select a different one, and
adds one built-in suggestion of "longtable", which should be
perfectly compatible with "tabular".

The patch creates 1 new customize variable:
1. table-latex-environment

And changes the following 2 functions:
1. table--generate-source-epilogue
2. table--generate-source-prologue

#+begin_src patch
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index 2175900194..eafa3e7b3c 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -753,6 +753,18 @@ table-html-cell-attribute
   :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)
+  :group 'table
+  :local t)
+
 (defcustom table-cals-thead-rows 1
   "Number of top rows to become header rows in CALS table."
   :tag "CALS Header Rows"
@@ -3025,7 +3037,7 @@ table--generate-source-prologue
 		"")))
      ((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 +3063,7 @@ table--generate-source-epilogue
      ((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
#+end_patch

The copyright disclaimer has been signed by me and submitted to FSF
last August.

-- 
Your sincerely,
Vladimir Nikishkin (MiEr, lockywolf)
(Laptop)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55333; Package emacs. (Mon, 09 May 2022 10:06:01 GMT) Full text and rfc822 format available.

Message #8 received at 55333 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Vladimir Nikishkin
 <for.emacs-table.el-environment-patch_2022-05-09 <at> lockywolf.net>
Cc: 55333 <at> debbugs.gnu.org
Subject: Re: bug#55333: [PATCH] Choose latex environment for table.el export
Date: Mon, 09 May 2022 12:05:05 +0200
Vladimir Nikishkin
<for.emacs-table.el-environment-patch_2022-05-09 <at> lockywolf.net> writes:

> Please, consider this patch for inclusion.
> This patch slightly generalises the way Emacs' table.el handles
> latex export.
> Currently, the export always uses the "tabular" environment.
> This patch adds a customize option to select a different one, and
> adds one built-in suggestion of "longtable", which should be
> perfectly compatible with "tabular".

Thanks; makes sense to me, so I've pushed it to Emacs 29 (with some
small changes).

By the way, the patch didn't apply directly, so it seems like something
had mangled it in transmission.  For future patches, it's probably
better to include patches as attachments.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 55333 <at> debbugs.gnu.org and Vladimir Nikishkin <for.emacs-table.el-environment-patch_2022-05-09 <at> lockywolf.net> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 09 May 2022 10:06:02 GMT) Full text and rfc822 format available.

Forcibly Merged 55329 55333. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 09 May 2022 10:15:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 29.1, send any further explanations to 55333 <at> debbugs.gnu.org and Vladimir Nikishkin <for.emacs-table.el-environment-patch_2022-05-09 <at> lockywolf.net> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 09 May 2022 12:26:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 07 Jun 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 322 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.