>From f9c9ae8f3c77b48f3cb2915a85d34bfb61fd3cbb Mon Sep 17 00:00:00 2001 From: Arash Esbati Date: Sat, 21 Nov 2015 22:21:02 +0100 Subject: [PATCH 2/4] Improve style/amsthm.el * style/amsthm.el (LaTeX-amsthm-fontdecl): Cover all font changing declarations. ("amsthm"): Overrule the defintion for \newtheorem in `latex.el'. ("amsthm"): Use `TeX-completing-read-multiple' for font related queries. --- style/amsthm.el | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/style/amsthm.el b/style/amsthm.el index 8bc33d4..a01cfe3 100644 --- a/style/amsthm.el +++ b/style/amsthm.el @@ -41,9 +41,18 @@ defined with \"\\newtheoremstyle\".") (defvar LaTeX-amsthm-fontdecl (mapcar (lambda (elt) (concat TeX-esc elt)) - '("itshape" "bfseries" "scshape" - "ttfamily" "upshape" "mdseries" - "rmfamily" "sffamily" "slshape")) + '(;; family + "rmfamily" "sffamily" "ttfamily" + ;; series + "mdseries" "bfseries" + ;; shape + "upshape" "itshape" "slshape" "scshape" + ;; size + "tiny" "scriptsize" "footnotesize" + "small" "normalsize" "large" + "Large" "LARGE" "huge" "Huge" + ;; reset macro + "normalfont")) "List of font declaration commands for \"\\newtheoremstyle\".") (defun LaTeX-amsthm-env-label (environment) @@ -106,6 +115,23 @@ make them available as new environments. Update (LaTeX-add-environments '("proof" LaTeX-amsthm-env-label)) (TeX-add-symbols + ;; Overrule the defintion in `latex.el': + '("newtheorem" + (TeX-arg-eval + (lambda () + (let ((nthm (TeX-read-string + (TeX-argument-prompt nil nil "Environment")))) + (LaTeX-add-amsthm-newtheorems nthm) + (LaTeX-add-environments (list nthm 'LaTeX-theorem-env-label)) + (format "%s" nthm)))) + [ TeX-arg-environment "Numbered like" ] + t [ (TeX-arg-eval progn (if (eq (save-excursion + (backward-char 2) + (preceding-char)) ?\]) + () + (TeX-arg-counter t "Within counter")) + "") ]) + '("newtheorem*" (TeX-arg-eval (lambda () @@ -119,8 +145,7 @@ make them available as new environments. Update (format "%s" heading))))) '("theoremstyle" - (TeX-arg-eval completing-read - "Style: " + (TeX-arg-eval completing-read "Style: " LaTeX-amsthm-theoremstyle-list)) "qedhere" "swapnumbers" @@ -136,11 +161,16 @@ make them available as new environments. Update (format "%s" nthmstyle)))) (TeX-arg-length "Space above") (TeX-arg-length "Space below") - (TeX-arg-eval completing-read - "Body font: " LaTeX-amsthm-fontdecl) + (TeX-arg-eval mapconcat 'identity + (TeX-completing-read-multiple + "Body font: " + LaTeX-amsthm-fontdecl) "") "Indent amount" - (TeX-arg-eval completing-read - "Theorem head font: " LaTeX-amsthm-fontdecl) + (TeX-arg-eval mapconcat 'identity + (TeX-completing-read-multiple + "Theorem head font: " + LaTeX-amsthm-fontdecl) "") + "Punctuation after head" (TeX-arg-length "Space after head") "Theorem head spec")) -- 2.6.3