Hi all,
please find attached some patches containing:
* style/enumitem.el (LaTeX-enumitem-auto-cleanup): Move some
operations from style hook into this function.
(LaTeX-enumitem-newlist-list-item-arg-local): Delete now unused
variable.
* style/amsthm.el (LaTeX-amsthm-theoremstyle-list): New variable
replacing the deleted function
`LaTeX-amsthm-complete-theoremstyle'.
(LaTeX-amsthm-env-label): New function to insert user defined
environments.
("amsthm"): Improve handling of "newtheorem*" and
"newtheoremstyle".
* style/AlegreyaSans.el ("AlegreyaSans"): Remove SmallCaps
font declaration command.
* style/Alegreya.el ("Alegreya"): Remove SmallCaps
font declaration command.
* style/caption.el (LaTeX-arg-caption-captionbox): Fix doctring.
* style/subcaption.el (LaTeX-arg-subcaption-subcaption): Fix
doctring.
(LaTeX-arg-subcaption-subcaptionbox): ditto.
As always, comments are welcome and looking forward to 11.89.
Best, Arash
>From f081066fb962a26e305ac54d1b78ac5841b1acdc Mon Sep 17 00:00:00 2001
From: Arash Esbati <[email protected]>
Date: Sat, 24 Oct 2015 16:21:04 +0200
Subject: [PATCH 1/4] Fix docstring.
* style/caption.el (LaTeX-arg-caption-captionbox): Fix doctring.
* style/subcaption.el (LaTeX-arg-subcaption-subcaption): Fix
doctring.
(LaTeX-arg-subcaption-subcaptionbox): ditto.
---
ChangeLog | 8 ++++++++
style/caption.el | 2 +-
style/subcaption.el | 4 ++--
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3b4b629..3f7ac31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-10-24 Arash Esbati <[email protected]>
+
+ * style/caption.el (LaTeX-arg-caption-captionbox): Fix doctring.
+
+ * style/subcaption.el (LaTeX-arg-subcaption-subcaption): Fix
+ doctring.
+ (LaTeX-arg-subcaption-subcaptionbox): ditto.
+
2015-10-19 Mosè Giordano <[email protected]>
* tex-buf.el (TeX-command): Check that AUCTeX can find a working
diff --git a/style/caption.el b/style/caption.el
index 4412443..4e394f0 100644
--- a/style/caption.el
+++ b/style/caption.el
@@ -221,7 +221,7 @@ suffix of the command."
(defun LaTeX-arg-caption-captionbox (optional &optional star prompt)
"Query for the arguments of `\\captionbox' incl. a label and
-insert them. If STAR is t, then do not query for a `\\label' and
+insert them. If STAR is non-nil, then do not query for a `\\label' and
insert only a caption."
(let ((caption (TeX-read-string
(TeX-argument-prompt optional prompt "Caption"))))
diff --git a/style/subcaption.el b/style/subcaption.el
index 83b20a0..6205366 100644
--- a/style/subcaption.el
+++ b/style/subcaption.el
@@ -38,7 +38,7 @@ same values as \"labelformat\" from caption package.")
(defun LaTeX-arg-subcaption-subcaption (optional &optional star prompt)
"Query for the arguments of \\subcaption incl. a label and
-insert them. If STAR is t, then do not query for the lof entry
+insert them. If STAR is non-nil, then do not query for the lof entry
and \\label and insert only a caption."
(let ((lof (unless star
(TeX-read-string
@@ -56,7 +56,7 @@ and \\label and insert only a caption."
(defun LaTeX-arg-subcaption-subcaptionbox (optional &optional star prompt)
"Query for the arguments of \\subcaptionbox incl. a label and
-insert them. If STAR is t, then do not query for a \\label and
+insert them. If STAR is non-nil, then do not query for a \\label and
insert only a caption."
(let ((caption (TeX-read-string
(TeX-argument-prompt optional prompt "Sub-caption"))))
--
2.6.2
>From be230c7eb8cced4e6b041f657e483b3894973fdf Mon Sep 17 00:00:00 2001
From: Arash Esbati <[email protected]>
Date: Sat, 24 Oct 2015 16:24:44 +0200
Subject: [PATCH 2/4] Remove SmallCaps font declaration command.
* style/AlegreyaSans.el ("AlegreyaSans"): Remove SmallCaps
font declaration command.
* style/Alegreya.el ("Alegreya"): Remove SmallCaps
font declaration command.
---
ChangeLog | 6 ++++++
style/Alegreya.el | 6 ++----
style/AlegreyaSans.el | 6 ++----
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3f7ac31..df6b60e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2015-10-24 Arash Esbati <[email protected]>
+ * style/AlegreyaSans.el ("AlegreyaSans"): Remove SmallCaps
+ font declaration command.
+
+ * style/Alegreya.el ("Alegreya"): Remove SmallCaps
+ font declaration command.
+
* style/caption.el (LaTeX-arg-caption-captionbox): Fix doctring.
* style/subcaption.el (LaTeX-arg-subcaption-subcaption): Fix
diff --git a/style/Alegreya.el b/style/Alegreya.el
index e2a444f..70e69e0 100644
--- a/style/Alegreya.el
+++ b/style/Alegreya.el
@@ -1,4 +1,4 @@
-;;; Alegreya.el --- AUCTeX style for `Alegreya.sty' (v2015/09/02)
+;;; Alegreya.el --- AUCTeX style for `Alegreya.sty' (v2015/10/22)
;; Copyright (C) 2015 Free Software Foundation, Inc.
@@ -26,7 +26,7 @@
;;; Commentary:
-;; This file adds support for `Alegreya.sty' (v2015/09/02).
+;; This file adds support for `Alegreya.sty' (v2015/10/22).
;; `Alegreya.sty' is part of TeXLive.
;;; Code:
@@ -49,7 +49,6 @@
'("useosf")
;; Text commands
'("Alegreya" -1)
- '("AlegreyaSC" -1)
'("AlegreyaBlack" -1)
'("AlegreyaLF" -1)
'("AlegreyaOsF" -1)
@@ -67,7 +66,6 @@
("textin" "{"))
'type-command)
(font-latex-add-keywords '(("Alegreya" "")
- ("AlegreyaSC" "")
("AlegreyaBlack" "")
("AlegreyaLF" "")
("AlegreyaOsF" "")
diff --git a/style/AlegreyaSans.el b/style/AlegreyaSans.el
index 4d9b497..494890d 100644
--- a/style/AlegreyaSans.el
+++ b/style/AlegreyaSans.el
@@ -1,4 +1,4 @@
-;;; AlegreyaSans.el --- AUCTeX style for `AlegreyaSans.sty' (v2015/09/02)
+;;; AlegreyaSans.el --- AUCTeX style for `AlegreyaSans.sty' (v2015/10/22)
;; Copyright (C) 2015 Free Software Foundation, Inc.
@@ -26,7 +26,7 @@
;;; Commentary:
-;; This file adds support for `AlegreyaSans.sty' (v2015/09/02).
+;; This file adds support for `AlegreyaSans.sty' (v2015/10/22).
;; `AlegreyaSans.sty' is part of TeXLive.
;;; Code:
@@ -58,7 +58,6 @@
'("AlegreyaSansMedium" -1)
'("AlegreyaSansExtraBold" -1)
'("AlegreyaSansBlack" -1)
- '("AlegreyaSansSC" -1)
'("textsu" t) ; superior figures
'("sufigures" -1) ;
'("textin" t) ; inferior figures
@@ -79,7 +78,6 @@
("AlegreyaSansMedium" "")
("AlegreyaSansExtraBold" "")
("AlegreyaSansBlack" "")
- ("AlegreyaSansSC" "")
("sufigures" "")
("infigures" ""))
'type-declaration)))
--
2.6.2
>From c9084f01e4ff1695d413392609f10bc8d10de8e7 Mon Sep 17 00:00:00 2001
From: Arash Esbati <[email protected]>
Date: Sat, 24 Oct 2015 16:31:28 +0200
Subject: [PATCH 3/4] Improve style.
* style/amsthm.el (LaTeX-amsthm-theoremstyle-list): New variable
replacing the deleted function
`LaTeX-amsthm-complete-theoremstyle'.
(LaTeX-amsthm-env-label): New function to insert user defined
environments.
("amsthm"): Improve handling of "newtheorem*" and
"newtheoremstyle".
---
ChangeLog | 8 ++++
style/amsthm.el | 144 ++++++++++++++++++++++++++++++++++++++++++++++----------
2 files changed, 126 insertions(+), 26 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index df6b60e..4178918 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2015-10-24 Arash Esbati <[email protected]>
+ * style/amsthm.el (LaTeX-amsthm-theoremstyle-list): New variable
+ replacing the deleted function
+ `LaTeX-amsthm-complete-theoremstyle'.
+ (LaTeX-amsthm-env-label): New function to insert user defined
+ environments.
+ ("amsthm"): Improve handling of "newtheorem*" and
+ "newtheoremstyle".
+
* style/AlegreyaSans.el ("AlegreyaSans"): Remove SmallCaps
font declaration command.
diff --git a/style/amsthm.el b/style/amsthm.el
index 57f2315..8bc33d4 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, 2013, 2014 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2013--2015 Free Software Foundation, Inc.
;; Author: Carsten Dominik <[email protected]>
;; Maintainer: [email protected]
@@ -22,51 +22,143 @@
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.
+;;; Commentary:
+
+;; The style provides the function `LaTeX-amsthm-env-label' which
+;; enables new defined environments with "\newtheoreom" to interact
+;; with AUCTeX and RefTeX mechanisms for inserting labels. Check
+;; docstring of `LaTeX-amsthm-env-label' for instructions.
+
;;; Code:
(defvar LaTeX-amsthm-package-options nil
"Package options for the amsthm package.")
+(defvar LaTeX-amsthm-theoremstyle-list
+ '(("plain") ("definition") ("remark"))
+ "List of theorem styles provided by `amsthm.el' and new ones
+defined with \"\\newtheoremstyle\".")
+
+(defvar LaTeX-amsthm-fontdecl
+ (mapcar (lambda (elt) (concat TeX-esc elt))
+ '("itshape" "bfseries" "scshape"
+ "ttfamily" "upshape" "mdseries"
+ "rmfamily" "sffamily" "slshape"))
+ "List of font declaration commands for \"\\newtheoremstyle\".")
+
+(defun LaTeX-amsthm-env-label (environment)
+ "Insert ENVIRONMENT, query for an optional argument and prompt
+for label. AUCTeX users should add ENVIRONMENT to
+`LaTeX-label-alist' via customize or in init-file with:
+
+ (add-to-list 'LaTeX-label-alist '(\"lemma\" . \"lem:\"))
+
+RefTeX users should customize or add ENVIRONMENT to
+`LaTeX-label-alist' and `reftex-label-alist', e.g.
+
+ (add-to-list 'LaTeX-label-alist '(\"lemma\" . \"lem:\"))
+ (add-to-list 'reftex-label-alist
+ '(\"lemma\" ?m \"lem:\" \"~\\ref{%s}\"
+ nil (\"Lemma\" \"lemma\") nil))"
+ (let ((opthead (TeX-read-string
+ (TeX-argument-prompt t nil "Heading"))))
+ (LaTeX-insert-environment environment
+ (when (and opthead
+ (not (string= opthead "")))
+ (format "[%s]" opthead))))
+ (when (LaTeX-label environment 'environment)
+ (LaTeX-newline)
+ (indent-according-to-mode)))
+
+;; Needed for auto-parsing
+(require 'tex)
+
+;; Setup parsing for \newtheorem
+(TeX-auto-add-type "amsthm-newtheorem" "LaTeX")
+
+;; Setup parsing for \newtheoremstyle
+(TeX-auto-add-type "amsthm-newtheoremstyle" "LaTeX")
+
+(defun LaTeX-amsthm-auto-prepare ()
+ "Clear `LaTeX-auto-amsthm-newtheorem' and
+`LaTeX-auto-amsthm-newtheoremstyle' before parsing."
+ (setq LaTeX-auto-amsthm-newtheorem nil)
+ (setq LaTeX-auto-amsthm-newtheoremstyle nil))
+
+(defun LaTeX-amsthm-auto-cleanup ()
+ "Move parsed results from `LaTeX-auto-amsthm-newtheorem' and
+make them available as new environments. Update
+`LaTeX-amsthm-theoremstyle-list' with styles defined with
+\"\\newtheoremstyle\"."
+ (dolist (newthm (mapcar 'car (LaTeX-amsthm-newtheorem-list)))
+ (LaTeX-add-environments (list newthm 'LaTeX-amsthm-env-label)))
+ (dolist (newthmstyle (LaTeX-amsthm-newtheoremstyle-list))
+ (add-to-list (make-local-variable 'LaTeX-amsthm-theoremstyle-list)
+ newthmstyle)))
+
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-amsthm-auto-prepare t)
+(add-hook 'TeX-auto-prepare-hook #'LaTeX-amsthm-auto-cleanup t)
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
(TeX-add-style-hook
"amsthm"
(lambda ()
(LaTeX-add-environments
- '("proof" (lambda (env &rest ignore)
- (LaTeX-insert-environment
- env
- (let ((heading (TeX-read-string "(optional) Heading: ")))
- (if (string= heading "")
- ""
- (format "[%s]" heading))))))
- )
+ '("proof" LaTeX-amsthm-env-label))
(TeX-add-symbols
- '("newtheorem*" TeX-arg-define-environment "Heading")
- '("theoremstyle" LaTeX-amsthm-complete-theoremstyle)
+ '("newtheorem*"
+ (TeX-arg-eval
+ (lambda ()
+ (let ((nthm (TeX-read-string
+ (TeX-argument-prompt nil nil "Environment")))
+ (heading (TeX-read-string
+ (TeX-argument-prompt nil nil "Heading"))))
+ (LaTeX-add-amsthm-newtheorems nthm)
+ (LaTeX-add-environments (list nthm 'LaTeX-amsthm-env-label))
+ (insert (concat TeX-grop nthm TeX-grcl))
+ (format "%s" heading)))))
+
+ '("theoremstyle"
+ (TeX-arg-eval completing-read
+ "Style: "
+ LaTeX-amsthm-theoremstyle-list))
"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"))
+
+ '("newtheoremstyle"
+ (TeX-arg-eval
+ (lambda ()
+ (let ((nthmstyle (TeX-read-string
+ (TeX-argument-prompt nil nil "Style name"))))
+ (LaTeX-add-amsthm-newtheoremstyles nthmstyle)
+ (add-to-list (make-local-variable 'LaTeX-amsthm-theoremstyle-list)
+ (list nthmstyle))
+ (format "%s" nthmstyle))))
+ (TeX-arg-length "Space above")
+ (TeX-arg-length "Space below")
+ (TeX-arg-eval completing-read
+ "Body font: " LaTeX-amsthm-fontdecl)
+ "Indent amount"
+ (TeX-arg-eval completing-read
+ "Theorem head font: " LaTeX-amsthm-fontdecl)
+ "Punctuation after head"
+ (TeX-arg-length "Space after head")
+ "Theorem head spec"))
(TeX-auto-add-regexp
- `(,(concat "\\\\newtheorem\\*{\\(" TeX-token-char "+\\)}")
- 1 LaTeX-auto-environment))
+ `(,(concat "\\\\newtheorem\\*?{\\(" TeX-token-char "+\\)}")
+ 1 LaTeX-auto-amsthm-newtheorem))
+ (TeX-auto-add-regexp
+ `(,(concat "\\\\newtheoremstyle{\\(" TeX-token-char "+\\)}")
+ 1 LaTeX-auto-amsthm-newtheoremstyle))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
- (font-latex-add-keywords '(("newtheorem" "*{[{[")
- ("theoremstyle" "{")
+ (font-latex-add-keywords '(("newtheorem" "*{[{[")
+ ("theoremstyle" "{")
("newtheoremstyle" "{{{{{{{{{"))
'function)))
LaTeX-dialect)
-(defun LaTeX-amsthm-complete-theoremstyle (&rest ignore)
- (insert TeX-grop
- (completing-read "Style: " '(("plain" . nil)
- ("definition" . nil)
- ("remark" . nil)))
- TeX-grcl))
-
;;; amsthm.el ends here
--
2.6.2
>From ac36b6e39de80b02210e4e4d0a334768a7b125ee Mon Sep 17 00:00:00 2001
From: Arash Esbati <[email protected]>
Date: Sat, 24 Oct 2015 16:35:15 +0200
Subject: [PATCH 4/4] Improve style.
* style/enumitem.el (LaTeX-enumitem-auto-cleanup): Move some
operations from style hook into this function.
(LaTeX-enumitem-newlist-list-item-arg-local): Delete now unused
variable.
---
ChangeLog | 5 +++++
style/enumitem.el | 29 ++++++++++-------------------
2 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4178918..3f5aec6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2015-10-24 Arash Esbati <[email protected]>
+ * style/enumitem.el (LaTeX-enumitem-auto-cleanup): Move some
+ operations from style hook into this function.
+ (LaTeX-enumitem-newlist-list-item-arg-local): Delete now unused
+ variable.
+
* style/amsthm.el (LaTeX-amsthm-theoremstyle-list): New variable
replacing the deleted function
`LaTeX-amsthm-complete-theoremstyle'.
diff --git a/style/enumitem.el b/style/enumitem.el
index dff94aa..a527c86 100644
--- a/style/enumitem.el
+++ b/style/enumitem.el
@@ -116,11 +116,6 @@ plus available through `enumitem' package.")
"List of description like environments defined by command
`\\newlist' from `enumitem' package.")
-(defvar LaTeX-enumitem-newlist-list-item-arg-local nil
- "Local list of all description like environments defined by command
-`\\newlist' plus available through `enumitem' package.")
-(make-variable-buffer-local 'LaTeX-enumitem-newlist-list-item-arg-local)
-
(defvar LaTeX-auto-enumitem-newlist nil
"Temporary for parsing the arguments of `\\newlist' from
`enumitem' package.")
@@ -183,7 +178,16 @@ package.")
(when (or (string-equal type "description")
(string-equal type "description*"))
(add-to-list 'LaTeX-enumitem-newlist-list-item-arg
- (list env))))))
+ (list env)))))
+ ;; Now add the parsed env's to the local list.
+ (when LaTeX-enumitem-newlist-list
+ (setq LaTeX-enumitem-newlist-list-local
+ (append LaTeX-enumitem-newlist-list
+ LaTeX-enumitem-newlist-list-local)))
+ ;; Tell AUCTeX about parsed description like environments.
+ (when LaTeX-enumitem-newlist-list-item-arg
+ (dolist (env LaTeX-enumitem-newlist-list-item-arg)
+ (add-to-list 'LaTeX-item-list `(,(car env) . LaTeX-item-argument)))))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-enumitem-auto-prepare t)
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-enumitem-auto-cleanup t)
@@ -302,19 +306,6 @@ in `enumitem'-completions."
(append '(("itemize*") ("enumerate*") ("description*"))
LaTeX-enumitem-newlist-list-local)))
- ;; Now add the parsed env's to the local list.
- (setq LaTeX-enumitem-newlist-list-local
- (append LaTeX-enumitem-newlist-list
- LaTeX-enumitem-newlist-list-local))
-
- ;; Move parsed description like env's into a local variable.
- (setq LaTeX-enumitem-newlist-list-item-arg-local
- LaTeX-enumitem-newlist-list-item-arg)
-
- ;; Tell AUCTeX about special items parsed
- (dolist (env LaTeX-enumitem-newlist-list-item-arg-local)
- (add-to-list 'LaTeX-item-list `(,(car env) . LaTeX-item-argument)))
-
;; Standard env's take key-val as optional argument.
(LaTeX-add-environments
'("itemize" LaTeX-enumitem-env-with-opts)
--
2.6.2
_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel