Initial Commit
[packages] / xemacs-packages / auctex / style / booktabs.el
1 ;;; booktabs.el -- AUCTeX style for booktabs.sty
2
3 ;; Copyright (C) 2003, 2004, 2013 Free Software Foundation, Inc.
4
5 ;; Author:   Ralf Angeli <angeli@iwi.uni-sb.de>
6 ;; Maintainer: auctex-devel@gnu.org
7 ;; Created:  2003-10-21
8 ;; Keywords: tex
9
10 ;; This file is part of AUCTeX.
11
12 ;; AUCTeX is free software; you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 3, or (at your option)
15 ;; any later version.
16
17 ;; AUCTeX is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 ;; General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with AUCTeX; see the file COPYING.  If not, write to the Free
24 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25 ;; 02110-1301, USA.
26
27 ;;; Commentary:
28
29 ;; This file adds support for `booktabs.sty'.
30
31 ;;; Code:
32
33 (defun LaTeX-booktabs-arg-paren (optional prompt)
34   "Prompt for a value and use parentheses when it is inserted.
35 If OPTIONAL is non-nil the parameter is labeled as optional.
36 PROMPT is the value of the prompt to be shown."
37   (let ((TeX-arg-opening-brace "\(")
38         (TeX-arg-closing-brace "\)"))
39     (TeX-parse-argument optional prompt)))
40
41 (TeX-add-style-hook
42  "booktabs"
43  (lambda ()
44    ;; Do not append an empty group to toprule, midrule, and bottomrule macros,
45    ;; otherwise one gets a wrong spacing in the table.
46    (setq TeX-insert-braces-alist (append TeX-insert-braces-alist
47                                          '(("toprule" . nil)
48                                            ("midrule" . nil)
49                                            ("bottomrule" . nil))))
50    ;; New symbols
51    (TeX-add-symbols
52     '("toprule" [ "Thickness" ])
53     '("midrule" [ "Thickness" ])
54     '("bottomrule" [ "Thickness" ])
55     ;; The `ignore' resets `last-optional-rejected' to nil so that the trim
56     ;; argument is prompted also when the thickness is skipped.
57     '("cmidrule" [ "Thickness" ] (ignore) [ LaTeX-booktabs-arg-paren "Trim" ]
58       "Column(s)")
59     '("addlinespace" [ "Height" ])
60     '("morecmidrules")
61     '("specialrule" "Thickness" "Space above" "Space below"))
62
63    ;; Fontification
64    (when (and (featurep 'font-latex)
65               (eq TeX-install-font-lock 'font-latex-setup))
66      (font-latex-add-keywords '(("toprule" "[")
67                                 ("midrule" "[")
68                                 ("bottomrule" "[")
69                                 ("cmidrule" "[({")
70                                 ("addlinespace" "[")
71                                 ("morecmidrules" "")
72                                 ("specialrule" "{{{"))
73                               'function)))
74  LaTeX-dialect)
75
76 (defvar LaTeX-booktabs-package-options nil
77   "Package options for the booktabs package.")
78
79 ;;; booktabs.el ends here