branch: master
commit be9ffba8b310db2a791af41a0a5c3c3f39935e88
Author: Arash Esbati <ar...@gnu.org>
Commit: Arash Esbati <ar...@gnu.org>

    Add new style/supertabular.el
    
    * Makefile.in (STYLESRC): Add new style.
    
    * NEWS.org (Added): Announce the new style.
    
    * latex.el (LaTeX-indent-environment-list): Add environments
    provided by the supertabular.sty.
    
    * style/supertabular.el: New file.
---
 Makefile.in           |   3 +-
 NEWS.org              |   4 +-
 latex.el              |   5 +++
 style/supertabular.el | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 110 insertions(+), 3 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 671be421..2cb9397a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -200,7 +200,8 @@ STYLESRC = style/prosper.el \
           style/wasysym.el   style/refcount.el  style/simpleicons.el \
           style/changebar.el style/amsrefs.el   style/standalone.el \
           style/diagbox.el   style/contract.el  style/enotez.el \
-          style/authblk.el   style/tabularray.el style/ninecolors.el
+          style/authblk.el   style/tabularray.el style/ninecolors.el \
+          style/supertabular.el
 
 STYLEELC = $(STYLESRC:.el=.elc)
 
diff --git a/NEWS.org b/NEWS.org
index 673c7c93..a8335a22 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -10,8 +10,8 @@
 
 ** Added
 
-- Add new support files =style/authblk.el=, =style/ninecolors.el= and
-  =style/tabularray.el=.
+- Add new support files =style/authblk.el=, =style/ninecolors.el=,
+  =style/supertabular.el= and =style/tabularray.el=.
 
 * [14.0.6] - 2024-06-30
 
diff --git a/latex.el b/latex.el
index 7f709a82..e65dbdf9 100644
--- a/latex.el
+++ b/latex.el
@@ -4168,6 +4168,11 @@ consideration just as is in the non-commented source 
code."
     ("drcases"       LaTeX-indent-tabular)
     ("drcases*"      LaTeX-indent-tabular)
     ("cases*"        LaTeX-indent-tabular)
+    ;; envs of supertabular.sty
+    ("supertabular"    LaTeX-indent-tabular)
+    ("supertabular*"   LaTeX-indent-tabular)
+    ("mpsupertabular"  LaTeX-indent-tabular)
+    ("mpsupertabular*" LaTeX-indent-tabular)
     ;; envs of tabularray.sty
     ("+array"   LaTeX-indent-tabular)
     ("+matrix"  LaTeX-indent-tabular)
diff --git a/style/supertabular.el b/style/supertabular.el
new file mode 100644
index 00000000..12a8a057
--- /dev/null
+++ b/style/supertabular.el
@@ -0,0 +1,101 @@
+;;; supertabular.el --- AUCTeX style for `supertabular.sty' (v4.2c)  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2024 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <ar...@gnu.org>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2024-07-21
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file adds support for `supertabular.sty' (v4.2c) from 2024/07/20.
+;; `supertabular.sty' is part of TeXLive.
+
+;;; Code:
+
+(require 'tex)
+(require 'latex)
+
+;; Silence the compiler:
+(declare-function font-latex-add-keywords "font-latex" (keywords class))
+
+(defun LaTeX-supertabular-insert-caption (optional &optional prompt)
+  "Insert the arguments of caption macros provided by supertabular package."
+  (let* ((caption (TeX-read-string
+                   (TeX-argument-prompt optional prompt "Caption")))
+         (short-caption
+          (if (>= (length caption) LaTeX-short-caption-prompt-length)
+              (TeX-read-string
+               (TeX-argument-prompt t nil "Short caption"))
+            "")))
+    (TeX-argument-insert short-caption t)
+    (TeX-argument-insert caption optional)
+    (when auto-fill-function (LaTeX-fill-paragraph))))
+
+(TeX-add-style-hook
+ "supertabular"
+ (lambda ()
+   (TeX-add-symbols
+    '("tablefirsthead" t)
+    '("tablehead" t)
+
+    '("tabletail" t)
+    '("tablelasttail" t)
+
+    '("topcaption" LaTeX-supertabular-insert-caption)
+    '("bottomcaption" LaTeX-supertabular-insert-caption)
+    '("tablecaption" LaTeX-supertabular-insert-caption)
+
+    '("shrinkheight" (TeX-arg-length "Max. height")))
+
+   ;; Add the environments provided by the package:
+   (LaTeX-add-environments
+    '("supertabular"    LaTeX-env-array)
+    '("supertabular*"   LaTeX-env-tabular*)
+    '("mpsupertabular"  LaTeX-env-array)
+    '("mpsupertabular*" LaTeX-env-tabular*))
+
+   ;; Append the environments to `LaTeX-item-list':
+   (add-to-list 'LaTeX-item-list '("supertabular" . LaTeX-item-array) t)
+   (add-to-list 'LaTeX-item-list '("supertabular*" . LaTeX-item-tabular*) t)
+   (add-to-list 'LaTeX-item-list '("mpsupertabular" . LaTeX-item-array) t)
+   (add-to-list 'LaTeX-item-list '("mpsupertabular*" . LaTeX-item-tabular*) t)
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+              (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("shrinkheight"   "{"))
+                              'function)
+     (font-latex-add-keywords '(("tablefirsthead" "{")
+                                ("tablehead"      "{")
+                                ("tabletail"      "{")
+                                ("tablelasttail"  "{")
+                                ("topcaption"     "[{")
+                                ("bottomcaption"  "[{")
+                                ("tablecaption"   "[{"))
+                              'textual)))
+ TeX-dialect)
+
+(defvar LaTeX-supertabular-package-options
+  '("errorshow" "pageshow" "debugshow" "estimate" "calculate")
+  "Package options for the supertabular package.")
+
+;;; supertabular.el ends here

Reply via email to