From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vladimir Nikishkin Newsgroups: gmane.emacs.bugs Subject: bug#55329: [PATCH] Choose latex environment for table.el export Date: Mon, 09 May 2022 10:30:57 +0800 Message-ID: <87ee13wi72.fsf@laptop.lockywolf.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27879"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.6.3; emacs 29.0.50 To: 55329@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 09 05:24:16 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nnu0O-000778-2W for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 09 May 2022 05:24:16 +0200 Original-Received: from localhost ([::1]:55430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nnu0M-0007Za-E8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 08 May 2022 23:24:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nnu0A-0007ZN-Lm for bug-gnu-emacs@gnu.org; Sun, 08 May 2022 23:24:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33461) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nnu0A-00008S-Bg for bug-gnu-emacs@gnu.org; Sun, 08 May 2022 23:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nnu0A-00057y-5f for bug-gnu-emacs@gnu.org; Sun, 08 May 2022 23:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Vladimir Nikishkin Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 09 May 2022 03:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 55329 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.165206659419646 (code B ref -1); Mon, 09 May 2022 03:24:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 May 2022 03:23:14 +0000 Original-Received: from localhost ([127.0.0.1]:55591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nntzO-00056o-H3 for submit@debbugs.gnu.org; Sun, 08 May 2022 23:23:14 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:36256) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nntzN-00056h-0n for submit@debbugs.gnu.org; Sun, 08 May 2022 23:23:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nntzM-0007Nj-RZ for bug-gnu-emacs@gnu.org; Sun, 08 May 2022 23:23:12 -0400 Original-Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:34658) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nntzL-0008WS-Av for bug-gnu-emacs@gnu.org; Sun, 08 May 2022 23:23:12 -0400 Original-Received: by mail-pg1-x52f.google.com with SMTP id g184so8425245pgc.1 for ; Sun, 08 May 2022 20:23:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=user-agent:from:to:subject:date:message-id:mime-version; bh=JSlLOydEMHydKjsBzBMYK6aeSYidVhSva/gFJjaMluw=; b=pjfIQ1r+MJJ/qOg6ixdmK0sdFQE5BEHI+EpWHtKO4WSK8Cwl0Luq2HPlxkOY4ey/xE eJWUtMztJ5PfatWv06ecrfOBU7y2zdq7w8GvisLl0iWZjZd+KroD7xywMFq34kK4Qg46 XLflV3+mGC4nE8anzRGaJc7xhuux1e6n5wLhMQdAbgcLfZAFwdoG6OI+6yJ8+mEi6Bsf 2KxDde3J42NZTkt53Yxa8rxeX/3x4I2mTOb4z8O2kz531El2K5zrX5qvirV0h2aIYA+F JUsdW7+O8q2yBPB5UKH48tQXh8Qax9oKmVrXjE0GmU4nRta+j/7eIVtO+jyhCDoEYJM2 iGxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:user-agent:from:to:subject:date:message-id :mime-version; bh=JSlLOydEMHydKjsBzBMYK6aeSYidVhSva/gFJjaMluw=; b=LQ/h5IyfdyQsGPNQ/0HiOz7N0BkwSbaJGu8VecWdqVrmVk8S4/rsYERt7BPMOqFOt1 Yc5ZZs5YMS0KEdc+wa4fAQ9Hujy/QOx6GIvc8ITUCK6U0EgAWboq5HbNwFz9wWZDwf91 SdJNLX1tmCHmu0HGhwtTpn3ufMLhhxDnZoYRVosMA9uMeWVDDayoQmZP0QegPZdq3JQR H6/SKTvbUJ/3oEh+bx5pV+uXDNQiOylR0B1kSqU6hclrNZIUcBMIr2LsEa0qF+QxKw+q ZLyr0nNLNYaJhZrZb5Y/ZzQXrdTgZ384C9X8E5HGUqjDSGXRtIizzUTLV1UeaLRQASfK O/jQ== X-Gm-Message-State: AOAM532HD/bjjCyk3iyRlMOfvvbqGVW+P3MzBoAmNqKdsOzm/0WlCmX/ Rj8MfooW2L4zrnH7Yo5fO3j6FLMIPcv9ag== X-Google-Smtp-Source: ABdhPJwVZyqS/NBi/cgqs4v4uppocvkxeR6p8C0jDG7kzeeuDftkriXCbka9FVOMUh3svqHT8QLIqg== X-Received: by 2002:a62:3848:0:b0:50d:376e:57ed with SMTP id f69-20020a623848000000b0050d376e57edmr14276957pfa.71.1652066589457; Sun, 08 May 2022 20:23:09 -0700 (PDT) Original-Received: from laptop.lockywolf.net ([2001:470:24:315::102]) by smtp.gmail.com with ESMTPSA id f18-20020a170902ce9200b0015e8d4eb2ccsm5894458plg.278.2022.05.08.20.23.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 20:23:09 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=lockywolf@gmail.com; helo=mail-pg1-x52f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:231690 Archived-At: 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 "\n" emacs-version) @@ -3051,7 +3063,7 @@ table--generate-source-epilogue ((eq language 'html) (insert "\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)