monnier pushed a commit to branch externals/auctex
in repository elpa.
commit 02768a760ebb6851313eb069b5c42ae467dbe3a6
Author: Mosè Giordano <[email protected]>
Date: Fri Apr 19 15:47:09 2013 +0200
Some improvements to amsthm style file.
* style/amsthm.el (LaTeX-amsthm-package-options): New variable.
("amsthm"): Remove `newtheorem' macro, already defined in
`latex.el'. Use `TeX-arg-define-environment' in `newtheorem*'
macro. Add `qedhere', `swapnumbers', and `newtheoremstyle'
macros. Add `newtheorem*' regexp to match new environments. Add
fontification.
---
ChangeLog | 7 ++++++
style/amsthm.el | 56 ++++++++++++++++++++++++++++++++++++------------------
2 files changed, 44 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 60f1186..af6b142 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2013-04-19 Mos� Giordano <[email protected]>
+ * style/amsthm.el (LaTeX-amsthm-package-options): New variable.
+ ("amsthm"): Remove `newtheorem' macro, already defined in
+ `latex.el'. Use `TeX-arg-define-environment' in `newtheorem*'
+ macro. Add `qedhere', `swapnumbers', and `newtheoremstyle'
+ macros. Add `newtheorem*' regexp to match new environments. Add
+ fontification.
+
* style/article.el ("article"): Add counters and pagestyles.
* style/beamer.el ("beamer"): Ditto.
diff --git a/style/amsthm.el b/style/amsthm.el
index 9903040..2214980 100644
--- a/style/amsthm.el
+++ b/style/amsthm.el
@@ -1,6 +1,6 @@
;;; amsthm.el --- Style hook for the AMS-LaTeX amsthm package.
-;; Copyright (C) 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2013 Free Software Foundation, Inc.
;; Author: Carsten Dominik <[email protected]>
;; Maintainer: [email protected]
@@ -24,24 +24,42 @@
;;; Code:
-(TeX-add-style-hook "amsthm"
- (function
- (lambda ()
- (LaTeX-add-environments
- '("proof" (lambda (env &rest ignore)
- (LaTeX-insert-environment
- env
- (let ((heading (read-string "(optional) Heading: ")))
- (if (string= heading "")
- ""
- (format "[%s]" heading))))))
- )
- (TeX-add-symbols
- '("newtheorem" "Environment name" ["Share numbering with"] "Heading"
- ["Number subordinated in each"])
- '("newtheorem*" "Environment name" "Heading")
- '("theoremstyle" LaTeX-amsthm-complete-theoremstyle)
- ))))
+(defvar LaTeX-amsthm-package-options nil
+ "Package options for the amsthm package.")
+
+(TeX-add-style-hook
+ "amsthm"
+ (lambda ()
+ (LaTeX-add-environments
+ '("proof" (lambda (env &rest ignore)
+ (LaTeX-insert-environment
+ env
+ (let ((heading (read-string "(optional) Heading: ")))
+ (if (string= heading "")
+ ""
+ (format "[%s]" heading))))))
+ )
+ (TeX-add-symbols
+ '("newtheorem*" TeX-arg-define-environment "Heading")
+ '("theoremstyle" LaTeX-amsthm-complete-theoremstyle)
+ "qedhere"
+ "swapnumbers"
+ '("newtheoremstyle" "Style name" (TeX-arg-length nil "Space above")
+ (TeX-arg-length nil "Space below") "Body font" "Indent amount"
+ "Theorem head font" "Punctuation after head"
+ (TeX-arg-length nil "Space after head") "Theorem head spec"))
+
+ (TeX-auto-add-regexp
+ `(,(concat "\\\\newtheorem\\*{\\(" TeX-token-char "+\\)}")
+ 1 LaTeX-auto-environment))
+
+ ;; Fontification
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("newtheorem" "*{[{[")
+ ("theoremstyle" "{")
+ ("newtheoremstyle" "{{{{{{{{{"))
+ 'function))))
(defun LaTeX-amsthm-complete-theoremstyle (&rest ignore)
(insert TeX-grop