[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 13941d8 54/78: Add new style subcaption.el.
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 13941d8 54/78: Add new style subcaption.el. |
Date: |
Mon, 19 Oct 2015 09:11:03 +0000 |
branch: externals/auctex
commit 13941d86b37b8425822c853b88e12bd8a8f07210
Author: Arash Esbati <address@hidden>
Commit: Tassilo Horn <address@hidden>
Add new style subcaption.el.
* Makefile.in (STYLESRC): Add new style.
* style/subcaption.el: New file.
---
ChangeLog | 4 +
Makefile.in | 2 +-
style/subcaption.el | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 163 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8695c91..a4cfa2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2015-09-25 Arash Esbati <address@hidden>
+ * Makefile.in (STYLESRC): Add new style.
+
+ * style/subcaption.el: New file.
+
* 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.
diff --git a/Makefile.in b/Makefile.in
index 5b689b1..9846055 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -152,7 +152,7 @@ STYLESRC = style/prosper.el \
style/mnras.el style/environ.el style/polyglossia.el \
style/vwcol.el style/textpos.el style/transparent.el \
style/fontenc.el style/Alegreya.el style/gloss-italian.el \
- style/AlegreyaSans.el
+ style/subcaption.el style/AlegreyaSans.el
STYLEELC = $(STYLESRC:.el=.elc)
diff --git a/style/subcaption.el b/style/subcaption.el
new file mode 100644
index 0000000..8223c91
--- /dev/null
+++ b/style/subcaption.el
@@ -0,0 +1,158 @@
+;;; subcaption.el --- AUCTeX style for `subcaption.sty' (v1.1-100)
+
+;; Copyright (C) 2015 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <esbati'at'gmx.de>
+;; Maintainer: address@hidden
+;; Created: 2015-09-19
+;; Keywords: tex
+
+;; This file is part of AUCTeX.
+
+;; AUCTeX is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; AUCTeX is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with AUCTeX; see the file COPYING. If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;;; Commentary:
+
+;; This file adds support for `subcaption.sty' (v1.1-100) from
+;; 2015-09-15. `subcaption.sty' is part of TeXLive.
+
+;;; Code:
+
+(defvar LaTeX-subcaption-key-val-options
+ '(("subrefformat" ("default" "empty" "simple" "brace" "parens")))
+ "Key=value options for subcaption package. This key takes the
+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
+and \\label and insert only a caption."
+ (let ((lof (unless star
+ (TeX-read-string
+ (TeX-argument-prompt t prompt "List entry"))))
+ (caption (TeX-read-string
+ (TeX-argument-prompt optional prompt "Sub-caption"))))
+ (LaTeX-indent-line)
+ (when (and lof (not (string-equal lof "")))
+ (insert LaTeX-optop lof LaTeX-optcl))
+ (insert TeX-grop caption TeX-grcl)
+ (unless star
+ (LaTeX-newline)
+ (LaTeX-indent-line)
+ (TeX-insert-macro "label"))))
+
+(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 only a caption."
+ (let ((caption (TeX-read-string
+ (TeX-argument-prompt optional prompt "Sub-caption"))))
+ (LaTeX-indent-line)
+ (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 (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 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)))))
+
+(TeX-add-style-hook
+ "subcaption"
+ (lambda ()
+ ;; Run style hook for caption.el
+ (TeX-run-style-hooks "caption")
+
+ ;; Make "subrefformat" available in key-vals of caption.el:
+ (setq LaTeX-caption-key-val-options-local
+ (append LaTeX-subcaption-key-val-options
+ LaTeX-caption-key-val-options-local))
+
+ (TeX-add-symbols
+ ;; Basic commands
+ '("subcaption" (LaTeX-arg-subcaption-subcaption))
+ '("subcaption*" (LaTeX-arg-subcaption-subcaption t))
+ '("subcaptionbox" ["List entry"] (LaTeX-arg-subcaption-subcaptionbox) t)
+ '("subcaptionbox*" (LaTeX-arg-subcaption-subcaptionbox t) t)
+ '("subref" TeX-arg-ref)
+ ;; \subref* is only available with hyperref.sty loaded, we don't
+ ;; check if hyperref.el is loaded and make it available directly.
+ '("subref*" TeX-arg-ref)
+ '("phantomcaption" 0)
+ '("phantomsubcaption" 0))
+
+ ;; The next 2 macros are part of the kernel of caption.sty, but we
+ ;; load them within subcaption.el.
+ (TeX-add-symbols
+ '("DeclareCaptionSubType"
+ [TeX-arg-eval
+ completing-read (TeX-argument-prompt t nil "Numbering scheme")
+ '("arabic" "roman" "Roman" "alph" "Alph" "fnsymbol")]
+ (TeX-arg-eval
+ completing-read (TeX-argument-prompt nil nil "Type")
+ '("figure" "table")))
+
+ '("DeclareCaptionSubType*"
+ [TeX-arg-eval completing-read
+ (TeX-argument-prompt t nil "Numbering scheme")
+ '("arabic" "roman" "Roman" "alph" "Alph" "fnsymbol")]
+ (TeX-arg-eval completing-read
+ (TeX-argument-prompt nil nil "Type")
+ '("figure" "table"))))
+
+ ;; The subfigure & subtable environments
+ (LaTeX-add-environments
+ '("subfigure" LaTeX-env-minipage)
+ '("subtable" LaTeX-env-minipage))
+
+ ;; Introduce env's to RefTeX if loaded
+ (when (fboundp 'reftex-add-label-environments)
+ (reftex-add-label-environments
+ `(("subfigure" ?f ,LaTeX-figure-label "~\\ref{%s}" caption)
+ ("subtable" ?t ,LaTeX-table-label "~\\ref{%s}" caption))))
+
+ ;; Fontification
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("subcaption" "*[{")
+ ("subcaptionbox" "*[{[[{")
+ ("phantomcaption" "")
+ ("phantomsubcaption" ""))
+ 'textual)
+ (font-latex-add-keywords '(("subref" "*{"))
+ 'reference)
+ (font-latex-add-keywords '(("DeclareCaptionSubType" "*[{"))
+ 'function)) )
+ LaTeX-dialect)
+
+(defun LaTeX-subcaption-package-options ()
+ "Prompt for package options for the subcaption package."
+ (TeX-read-key-val t
+ (append LaTeX-subcaption-key-val-options
+ LaTeX-caption-key-val-options)))
+
+;;; subcaption.el ends here
- [elpa] externals/auctex 5ed22c0 45/78: FiX TeX error parsing., (continued)
- [elpa] externals/auctex 5ed22c0 45/78: FiX TeX error parsing., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 66b97ff 20/78: Don't add font-latex-setup to latex-mode-hook, Tassilo Horn, 2015/10/19
- [elpa] externals/auctex c3cb0ff 26/78: Rename TeX-update to TeX-command-run-all., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex e2b2413 28/78: Reference TeX-command-run-all in documentation., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 69004bc 33/78: Fix wrong TeX-command-default guess for region files, Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 29261e3 34/78: Minor improvements to hyperref.el., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 066cf5a 36/78: Create Italian style file for polyglossia., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 3536b06 48/78: Use default argument of completing-read., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 100ba35 50/78: Fix mail address in Maintainer-header., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 440936d 52/78: Make `LaTeX-indent-environment-list' local., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 13941d8 54/78: Add new style subcaption.el.,
Tassilo Horn <=
- [elpa] externals/auctex 7b4b894 40/78: Add new style fontenc.el., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 05cf5be 43/78: Append `-list' to `LaTeX-eso-pic-package-options'., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex d4ba585 30/78: Fix missing unfontification of invisible property, Tassilo Horn, 2015/10/19
- [elpa] externals/auctex f470df8 51/78: Make `LaTeX-indent-environment-list' local., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 4cfe30e 46/78: Do not reference auto.el in Makefile and gitignore., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 0ac0fa8 57/78: Avoid searching with kpathsea in duplicate directories., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 48093fa 58/78: Use LaTeX-add-lengths for LaTeX-lengths., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 2da69ab 11/78: Add fontification for `\newcolumntype'., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex f4c5af9 37/78: Fix loading of polyglossia language style files., Tassilo Horn, 2015/10/19
- [elpa] externals/auctex 8359f08 39/78: Fix in Italian language polyglossia style file., Tassilo Horn, 2015/10/19