>From e061f5a0a5777a61706c3c346c6b21da0dc0f635 Mon Sep 17 00:00:00 2001 From: Arash Esbati Date: Sat, 23 Jan 2016 17:09:58 +0100 Subject: [PATCH 3/4] Improve font related queries * style/theorem.el (LaTeX-theorem-fontdecl): Do not prefix the elements with `TeX-esc'. (LaTeX-arg-theorem-fontdecl): New function. ("theorem"): Use `LaTeX-arg-theorem-fontdecl' for font related queries. --- style/theorem.el | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/style/theorem.el b/style/theorem.el index 7d8bffd..d8466f1 100644 --- a/style/theorem.el +++ b/style/theorem.el @@ -42,21 +42,34 @@ "List of theorem styles provided by `theorem.sty'.") (defvar LaTeX-theorem-fontdecl - (mapcar (lambda (elt) (concat TeX-esc elt)) - '(;; 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")) + '(;; 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 \"\\theorem(body\|header)font\".") +(defun LaTeX-arg-theorem-fontdecl (optional &optional prompt) + "Prompt for font declaration commands in \"\\theorem(body\|header)font\". +If OPTIONAL is non-nil, insert the resulting value as an optional +argument. Use PROMPT as the prompt string." + ;; `INITIAL-INPUT' (5th argument to `TeX-completing-read-multiple') + ;; is hard-coded to `TeX-esc'. + (let* ((crm-separator (regexp-quote TeX-esc)) + (fontdecl (mapconcat 'identity + (TeX-completing-read-multiple + (TeX-argument-prompt optional prompt "Font") + LaTeX-theorem-fontdecl nil nil TeX-esc) + TeX-esc))) + (TeX-argument-insert fontdecl optional))) + (defun LaTeX-theorem-env-label (environment) "Insert ENVIRONMENT, query for an optional argument and prompt for label. AUCTeX users should add ENVIRONMENT to @@ -133,16 +146,10 @@ make them available as new environments." LaTeX-theorem-theoremstyle-list)) '("theorembodyfont" - (TeX-arg-eval mapconcat 'identity - (TeX-completing-read-multiple - "Body font: " - LaTeX-theorem-fontdecl) "")) + (LaTeX-arg-theorem-fontdecl "Body font")) '("theoremheaderfont" - (TeX-arg-eval mapconcat 'identity - (TeX-completing-read-multiple - "Header font: " - LaTeX-theorem-fontdecl) "")) + (LaTeX-arg-theorem-fontdecl "Header font")) '("theorempreskipamount" (TeX-arg-length "Skip before theorem")) -- 2.7.0