1 ;;; array.el --- AUCTeX style for `array.sty'
3 ;; Copyright (C) 2013, 2015 Free Software Foundation, Inc.
5 ;; Author: Mads Jensen <mje@inducks.org>
6 ;; Maintainer: auctex-devel@gnu.org
9 ;; This file is part of AUCTeX.
11 ;; AUCTeX is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 3, or (at your option)
16 ;; AUCTeX is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with AUCTeX; see the file COPYING. If not, write to the Free
23 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
28 ;; This file adds support for `array.sty'
34 (TeX-auto-add-type "array-newcolumntype" "LaTeX")
36 (defvar LaTeX-array-newcolumntype-regexp
37 '("\\\\newcolumntype{\\([^}]+\\)}"
38 1 LaTeX-auto-array-newcolumntype)
39 "Matches the argument of `\\newcolumntype' from `array'
42 (defun LaTeX-array-auto-prepare ()
43 "Clear `LaTeX-auto-array-newcolumntype' before parsing."
44 (setq LaTeX-auto-array-newcolumntype nil))
46 (defun LaTeX-array-auto-cleanup ()
47 "Move parsed column specification from
48 `LaTeX-auto-array-newcolumntype' to `LaTeX-array-column-letters'."
49 (when (LaTeX-array-newcolumntype-list)
50 (LaTeX-array-update-column-letters)))
52 (defun LaTeX-array-update-column-letters ()
53 "Update and uniquify the value of `LaTeX-array-column-letters'
54 and make it buffer local. "
55 (set (make-local-variable 'LaTeX-array-column-letters)
57 (TeX-delete-duplicate-strings
59 (concat LaTeX-array-column-letters
60 (mapconcat 'car (LaTeX-array-newcolumntype-list) ""))
64 (add-hook 'TeX-auto-prepare-hook #'LaTeX-array-auto-prepare t)
65 (add-hook 'TeX-auto-cleanup-hook #'LaTeX-array-auto-cleanup t)
66 (add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
72 (TeX-auto-add-regexp LaTeX-array-newcolumntype-regexp)
78 (let ((col (TeX-read-string "Column type: ")))
79 (LaTeX-add-array-newcolumntypes col)
80 (LaTeX-array-update-column-letters)
82 [ "Number of arguments" ] t)
87 ;; `array.sty' adds a couple of new lengths. They're added here, rather than
88 ;; in the `TeX-add-symbols' block.
89 (LaTeX-add-lengths "extratabsurround" "extrarowheight")
91 ;; `array.sty' adds some new column specification letters.
92 (set (make-local-variable 'LaTeX-array-column-letters)
93 (concat LaTeX-array-column-letters "m" "b"))
96 (when (and (featurep 'font-latex)
97 (eq TeX-install-font-lock 'font-latex-setup))
98 (font-latex-add-keywords '(("newcolumntype" "{[{"))
102 (defvar LaTeX-array-package-options nil
103 "Package options for array.")
105 ;; array.el ends here