Initial Commit
[packages] / xemacs-packages / auctex / style / amsthm.el
1 ;;; amsthm.el --- Style hook for the AMS-LaTeX amsthm package.
2
3 ;; Copyright (C) 1997, 2013 Free Software Foundation, Inc.
4
5 ;; Author: Carsten Dominik <dominik@strw.leidenuniv.nl>
6 ;; Maintainer: auctex-devel@gnu.org
7
8 ;; This file is part of AUCTeX.
9
10 ;; AUCTeX is free software; you can redistribute it and/or modify it
11 ;; under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 3, or (at your option)
13 ;; any later version.
14
15 ;; AUCTeX is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 ;; General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with AUCTeX; see the file COPYING.  If not, write to the Free
22 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 ;; 02110-1301, USA.
24
25 ;;; Code:
26
27 (defvar LaTeX-amsthm-package-options nil
28   "Package options for the amsthm package.")
29
30 (TeX-add-style-hook
31  "amsthm"
32  (lambda ()
33    (LaTeX-add-environments
34     '("proof" (lambda (env &rest ignore)
35                 (LaTeX-insert-environment
36                  env
37                  (let ((heading (read-string "(optional) Heading: ")))
38                    (if (string= heading "")
39                        ""
40                      (format "[%s]" heading))))))
41     )
42    (TeX-add-symbols
43     '("newtheorem*" TeX-arg-define-environment "Heading")
44     '("theoremstyle" LaTeX-amsthm-complete-theoremstyle)
45     "qedhere"
46     "swapnumbers"
47     '("newtheoremstyle" "Style name" (TeX-arg-length nil "Space above")
48       (TeX-arg-length nil "Space below") "Body font" "Indent amount"
49       "Theorem head font" "Punctuation after head"
50       (TeX-arg-length nil "Space after head") "Theorem head spec"))
51
52    (TeX-auto-add-regexp
53     `(,(concat "\\\\newtheorem\\*{\\(" TeX-token-char "+\\)}")
54       1 LaTeX-auto-environment))
55
56    ;; Fontification
57    (when (and (featurep 'font-latex)
58               (eq TeX-install-font-lock 'font-latex-setup))
59      (font-latex-add-keywords '(("newtheorem" "*{[{[")
60                                 ("theoremstyle" "{")
61                                 ("newtheoremstyle" "{{{{{{{{{"))
62                               'function)))
63  LaTeX-dialect)
64
65 (defun LaTeX-amsthm-complete-theoremstyle (&rest ignore)
66   (insert TeX-grop
67           (completing-read  "Style: " '(("plain" . nil)
68                                         ("definition" . nil)
69                                         ("remark" . nil)))
70           TeX-grcl))
71
72 ;;; amsthm.el ends here