>From 9bed6eab40cf3f079392d0186cc7caa53da1d498 Mon Sep 17 00:00:00 2001 From: Arash Esbati Date: Sat, 26 Sep 2015 00:05:03 +0200 Subject: [PATCH 4/5] Apply some fixes to caption.el. * style/caption.el (LaTeX-caption-key-val-options): Fix values of hypcap-key. (LaTeX-caption-update-key-val-options): Add support for subcaption.el if loaded. (LaTeX-arg-caption-captionbox): Do not query for the third optional arg. if the second one is empty. ("caption"): Add support for all lowercase \continuedfloat*?. ("caption"): Fix fontification for \captionof. --- ChangeLog | 8 ++++++++ style/caption.el | 57 +++++++++++++++++++++++++++++++++++--------------------- 2 files changed, 44 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74a97ff..8695c91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2015-09-25 Arash Esbati + * style/caption.el (LaTeX-caption-key-val-options): Fix values of hypcap-key. + (LaTeX-caption-update-key-val-options): Add support for + subcaption.el if loaded. + (LaTeX-arg-caption-captionbox): Do not query for the third + optional arg. if the second one is empty. + ("caption"): Add support for all lowercase \continuedfloat*?. + ("caption"): Fix fontification for \captionof. + * style/hyperref.el ("hyperref"): Make `LaTeX-indent-environment-list' local before adding new env's. diff --git a/style/caption.el b/style/caption.el index 448f611..4412443 100644 --- a/style/caption.el +++ b/style/caption.el @@ -1,4 +1,4 @@ -;;; caption.el --- AUCTeX style for `caption.sty' (v3.3-89) +;;; caption.el --- AUCTeX style for `caption.sty' (v3.3-111) ;; Copyright (C) 2015 Free Software Foundation, Inc. @@ -26,7 +26,7 @@ ;;; Commentary: -;; This file adds support for `caption.sty' (v3.3-89) from 2013/05/02. +;; This file adds support for `caption.sty' (v3.3-111) from 2015/09/17. ;; `caption.sty' is part of TeXLive. ;; If things do not work or when in doubt, press `C-c C-n'. Comments @@ -53,7 +53,7 @@ "stretch" "normalcolor" "color" "normal")) ("format" ("plain" "hang")) ("hangindent") - ("hypcap") + ("hypcap" ("false" "no" "off" "0" "true" "yes" "on" "1")) ("hypcapspace") ("indention") ("justification" ("justified" "centering" "centerlast" "centerfirst" @@ -151,18 +151,33 @@ in `caption'-completions." (downcase (substring (nth 1 keyvals) 0 8))) (t (downcase (nth 1 keyvals))))) (val (nth 2 keyvals)) - ;; (key-match (car (assoc key LaTeX-caption-key-val-options-local))) (val-match (cdr (assoc key LaTeX-caption-key-val-options-local))) - (temp (copy-alist LaTeX-caption-key-val-options-local)) - (opts (assq-delete-all (car (assoc key temp)) temp))) + (temp (copy-alist LaTeX-caption-key-val-options-local)) + ;; If `subcaption.el' is loaded, delete and update also the + ;; entry for `subrefformat' when processing the `labelformat'. + (opts (progn + (when (and (string-equal key "labelformat") + (boundp 'LaTeX-subcaption-key-val-options)) + (setq temp + (assq-delete-all + (car (assoc (caar LaTeX-subcaption-key-val-options) temp)) + temp))) + (assq-delete-all (car (assoc key temp)) temp)))) ;; For `\DeclareCaptionOption', only add the value ;; (remember: key=^^^^^^, val="defined key") (if (string-equal key "option") (pushnew (list val) opts :test #'equal) - ;; For anything but `\DeclareCaptionOption', do the standard procedure + ;; For anything but `\DeclareCaptionOption', do the standard + ;; procedure. Again, take care of `subrefformat' for `subcaption.el'. (if val-match - (pushnew (list key (delete-dups (apply 'append (list val) val-match))) - opts :test #'equal) + (progn + (when (and (string-equal key "labelformat") + (boundp 'LaTeX-subcaption-key-val-options)) + (pushnew (list "subrefformat" + (delete-dups (apply 'append (list val) val-match))) + opts :test #'equal)) + (pushnew (list key (delete-dups (apply 'append (list val) val-match))) + opts :test #'equal)) (pushnew (list key (list val)) opts :test #'equal))) (setq LaTeX-caption-key-val-options-local (copy-alist opts))))) @@ -214,26 +229,22 @@ insert only a caption." (insert TeX-grop caption) (unless star (TeX-insert-macro "label")) (insert TeX-grcl)) - (let ((width (completing-read (TeX-argument-prompt t prompt "Width") - (mapcar (lambda(elt) (concat TeX-esc (car elt))) - (LaTeX-length-list)))) - (inpos (completing-read (TeX-argument-prompt t prompt "Inner position") - '("c" "l" "r" "s")))) + (let* ((width (completing-read (TeX-argument-prompt t prompt "Width") + (mapcar (lambda(elt) (concat TeX-esc (car elt))) + (LaTeX-length-list)))) + (inpos (when (and width (not (string-equal width ""))) + (completing-read (TeX-argument-prompt t prompt "Inner position") + '("c" "l" "r" "s"))))) (cond (;; 2 optional args (and width (not (string-equal width "")) inpos (not (string-equal inpos ""))) (insert (format "[%s][%s]" width inpos))) - (;; 1st empty opt. arg, 2nd opt. arg - (and (string-equal width "") - inpos (not (string-equal inpos ""))) - (insert (format "[][%s]" inpos))) (;; 1st opt. arg, 2nd empty opt. arg (and width (not (string-equal width "")) (string-equal inpos "")) (insert (format "[%s]" width))) (t ; Do nothing if both empty - (ignore)))) - (LaTeX-fill-paragraph)) + (ignore))))) (TeX-add-style-hook "caption" @@ -290,6 +301,10 @@ insert only a caption." '("captionbox*" (LaTeX-arg-caption-captionbox t) t) '("ContinuedFloat" 0) + '("ContinuedFloat*" 0) + + '("continuedfloat" 0) + '("continuedfloat*" 0) '("DeclareCaptionFont" (LaTeX-arg-caption-DeclareCaption "Font") t) @@ -335,7 +350,7 @@ insert only a caption." (eq TeX-install-font-lock 'font-latex-setup)) (font-latex-add-keywords '(("caption" "*[{") ("captionlistentry" "[{") - ("captionof" "*[{") + ("captionof" "*{[{") ("captionbox" "*[{[[{")) 'textual) (font-latex-add-keywords '(("captionsetup" "*[{") -- 2.5.2