auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] [elpa] externals/auctex 2e7ca50 36/36: Merge branch 'mast


From: Tassilo Horn
Subject: [AUCTeX-diffs] [elpa] externals/auctex 2e7ca50 36/36: Merge branch 'master' into externals/auctex
Date: Thu, 22 Dec 2016 13:08:13 +0000 (UTC)

branch: externals/auctex
commit 2e7ca50778b6dda75f1ce2f6b96219818041d138
Merge: 1b5875c b44d524
Author: Tassilo Horn <address@hidden>
Commit: Tassilo Horn <address@hidden>

    Merge branch 'master' into externals/auctex
---
 Makefile.in                                  |    4 +-
 doc/auctex.texi                              |    7 +-
 font-latex.el                                |   36 +++--
 latex.el                                     |   30 ++++-
 style/FiraMono.el                            |   70 ++++++++++
 style/FiraSans.el                            |  102 +++++++++++++++
 style/alltt.el                               |    7 +-
 style/{expl3.el => amsfonts.el}              |   42 +++---
 style/amssymb.el                             |    1 +
 style/array.el                               |    2 +-
 style/beamer.el                              |    6 +-
 style/bicaption.el                           |  181 ++++++++++++++++++++++++++
 style/caption.el                             |  123 +++++++++++------
 style/comment.el                             |    7 +-
 style/{ltxtable.el => dcolumn.el}            |   36 +++--
 style/empheq.el                              |   12 +-
 style/expl3.el                               |    7 +-
 style/fancyhdr.el                            |    6 +-
 style/fancyvrb.el                            |    7 +-
 style/kpfonts.el                             |   26 ++--
 style/listings.el                            |    7 +-
 style/longtable.el                           |   61 +++++++--
 style/ltxtable.el                            |   34 ++++-
 style/mathtools.el                           |   45 +++----
 style/minted.el                              |   14 +-
 style/newfloat.el                            |    1 +
 style/ntheorem.el                            |   12 +-
 style/siunitx.el                             |    6 +
 style/splitidx.el                            |   16 +--
 style/subcaption.el                          |  108 +++++++++------
 style/subfiles.el                            |   56 ++++++++
 style/tabularx.el                            |    4 +
 style/tabulary.el                            |    4 +
 style/textpos.el                             |   18 ++-
 style/url.el                                 |    8 +-
 tests/latex/latex-test.el                    |   33 ++++-
 tests/latex/tabular-count-ampersands-in.tex  |   36 +++++
 tests/latex/tabular-count-ampersands-out.tex |   43 ++++++
 tex-buf.el                                   |   16 ++-
 tex-ispell.el                                |    3 +
 tex.el                                       |   31 +++--
 41 files changed, 994 insertions(+), 274 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 84e2bd5..c038460 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -157,7 +157,9 @@ STYLESRC = style/prosper.el \
           style/splitidx.el  style/tikz.el      style/xcolor.el \
           style/pdflscape.el style/commath.el   style/empheq.el \
           style/framed.el    style/paracol.el   style/menukeys.el \
-          style/bidi.el
+          style/bidi.el      style/FiraMono.el  style/FiraSans.el \
+          style/bicaption.el style/amsfonts.el  style/subfiles.el \
+          style/dcolumn.el
 
 STYLEELC = $(STYLESRC:.el=.elc)
 
diff --git a/doc/auctex.texi b/doc/auctex.texi
index 9420dfb..0bf2cab 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -1101,7 +1101,12 @@ inserts the suitable number of ampersands.
 
 You can use @kbd{C-c @key{LFD}} (@code{LaTeX-insert-item}) to terminate
 rows in these environments.  It supplies line break macro @samp{\} and
-inserts the suitable number of ampersands on the next line.
+inserts the suitable number of ampersands on the next line.  @AUCTeX{}
+also supports the @address@hidden@address@hidden@}} notation (which may contain
+another @samp{*}-expression) in the format string when calculating the
+number of ampersands.  Please note that @samp{num} and @samp{cols} must
+be enclosed in braces; expressions like @samp{*2l} are not recognized
+correctly by the algorithm.
 
 @deffn Command LaTeX-insert-item
 @kindex C-c @key{LFD}
diff --git a/font-latex.el b/font-latex.el
index a7982c5..df33ad0 100644
--- a/font-latex.el
+++ b/font-latex.el
@@ -225,7 +225,7 @@ effect unless you call \[font-lock-fontify-buffer] or 
restart
 Emacs."
   ;; Possibly add some words about XEmacs here. :-(
   :type '(choice (number :tag "Scale factor")
-                 (const color))
+                (const color))
   :initialize 'custom-initialize-default
   :set (lambda (symbol value)
         (set-default symbol value)
@@ -387,7 +387,7 @@ variable `font-latex-fontify-sectioning'." ',num)
     ("textual"
      (("item" "[") ("title" "{") ("author" "{") ("date" "{")
       ("thanks" "{") ("address" "{") ("caption" "[{")
-      ("textsuperscript" "{"))
+      ("textsuperscript" "{") ("textsubscript" "{"))
      'font-lock-type-face 2 command)
     ("bold-command"
      (("textbf" "{") ("textsc" "{") ("textup" "{") ("boldsymbol" "{")
@@ -842,8 +842,7 @@ locking machinery will be triggered."
     (dolist (elt keywords)
       (add-to-list list elt))
     (funcall (intern (format "font-latex-match-%s-make" class)))
-    (setq font-lock-set-defaults nil)
-    (font-lock-set-defaults)))
+    (font-latex-update-font-lock)))
 
 (defvar font-latex-keywords font-latex-keywords-1
   "Default expressions to highlight in TeX mode.")
@@ -1264,6 +1263,25 @@ triggers Font Lock to recognize the change."
   ;; influencing fontification in her file-local variables section.
   (add-hook 'hack-local-variables-hook 
#'font-latex-after-hacking-local-variables t t))
 
+(defun font-latex-update-font-lock (&optional syntactic-kws)
+  "Tell font-lock about updates of fontification rules.
+If SYNTACTIC-KWS is non-nil, also update
+`font-latex-syntactic-keywords'."
+  ;; Update syntactic keywords.
+  (when syntactic-kws
+    (font-latex-set-syntactic-keywords))
+
+  ;; Let font-lock recompute its fontification rules.
+  (setq font-lock-set-defaults nil)
+  (font-lock-set-defaults)
+
+  ;; Re-initialize prettification if needed.
+  (when (and (boundp 'prettify-symbols-mode)
+            (boundp 'prettify-symbols--keywords)
+            prettify-symbols-mode
+            prettify-symbols--keywords)
+    (font-lock-add-keywords nil prettify-symbols--keywords)))
+
 (defun font-latex-jit-lock-force-redisplay (buf start end)
   "Compatibility for Emacsen not offering `jit-lock-force-redisplay'."
   ;; The following block is an expansion of `jit-lock-force-redisplay'
@@ -1362,9 +1380,7 @@ modified.  Such variables include
              (memq 'LaTeX-verbatim-macros-with-braces-local hacked-local-vars)
              (memq 'LaTeX-verbatim-macros-with-delims-local hacked-local-vars))
       ;; Ok, we need to refresh fontification.
-      (font-latex-set-syntactic-keywords)
-      (setq font-lock-set-defaults nil)
-      (font-lock-set-defaults))))
+      (font-latex-update-font-lock t))))
 
 ;;; Utility functions
 
@@ -1375,7 +1391,7 @@ character.  Character pairs are usually { } or [ ].  
Comments are
 ignored during the search."
   (let ((parse-sexp-ignore-comments
         (not (eq major-mode 'doctex-mode))) ; scan-sexps ignores comments
-        (init-point (point))
+       (init-point (point))
        (mycount 1)
        (esc-char (or (and (boundp 'TeX-esc) TeX-esc) "\"))
        ;; XXX: Do not look up syntax-table properties since they may
@@ -1761,9 +1777,9 @@ The \begin{equation} and \end{equation} are not fontified 
here."
                             ;; XXX: Should this rather be done by
                             ;; extending the region to be fontified?
                             (+ limit font-latex-multiline-boundary) 'move)
-          (setq end (match-beginning 0))
+         (setq end (match-beginning 0))
        (goto-char beg)
-        (setq end beg))
+       (setq end beg))
       (font-latex-put-multiline-property-maybe beg end)
       (store-match-data (list beg end))
       t)))
diff --git a/latex.el b/latex.el
index 56cb491..e5601fb 100644
--- a/latex.el
+++ b/latex.el
@@ -1373,12 +1373,31 @@ right number."
 
        ;; The below block accounts for one unit of move for
        ;; one column.
-       (setq cols (+ cols (skip-chars-forward
-                           LaTeX-array-column-letters end)))
+       (setq cols (+ cols
+                     ;; treat *-operator specially.
+                     (if (eq (following-char) ?*)
+                         ;; *-operator is there.
+                         (progn
+                           ;; pick up repetition number and count
+                           ;; how many columns are repeated.
+                           (re-search-forward
+                            "\*[
%]*{[
%]*\([0-9]+\)[
%]*}" end)
+                           (let ((n (string-to-number
+                                     (match-string-no-properties 1)))
+                                 ;; get start and end of repeated spec.
+                                 (s (progn (down-list 1) (point)))
+                                 (e (progn (up-list 1) (1- (point)))))
+                             (* n (1+ (LaTeX-array-count-columns s e)))))
+                       ;; not *-operator.
+                       (skip-chars-forward
+                        LaTeX-array-column-letters end))))
+       ;; Do not skip over `*' (see above) and `[' (siunitx has `S[key=val]':):
        (skip-chars-forward (concat
-                            "^" LaTeX-array-column-letters
-                            TeX-grop) end)
-       (if (eq (following-char) ?{) (forward-list 1))
+                            "^" LaTeX-array-column-letters "*"
+                            TeX-grop LaTeX-optop) end)
+       (when (or (eq (following-char) ?\{)
+                 (eq (following-char) ?\[))
+         (forward-list 1))
 
        ;; Not sure whether this is really necessary or not, but
        ;; prepare for possible infinite loop anyway.
@@ -6284,6 +6303,7 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\' or $."
      '("suppressfloats" [ TeX-arg-tb "Suppress floats position" ])
      '("ensuremath" "Math commands")
      '("textsuperscript" "Text")
+     '("textsubscript" "Text")
      '("textcircled" "Text")
      '("mathring" t)
 
diff --git a/style/FiraMono.el b/style/FiraMono.el
new file mode 100644
index 0000000..a037c68
--- /dev/null
+++ b/style/FiraMono.el
@@ -0,0 +1,70 @@
+;;; FiraMono.el --- AUCTeX style for `FiraMono.sty' (v2016/02/13)
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash.esbati'at'gmail.com>
+;; Maintainer: address@hidden
+;; Created: 2016-11-11
+;; 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 `FiraMono.sty' (v2016/02/13).
+;; `FiraMono.sty' is part of TeXLive.
+
+;;; Code:
+
+(TeX-add-style-hook
+ "FiraMono"
+ (lambda ()
+
+   ;; `textcomp' is always loaded:
+   (TeX-run-style-hooks "textcomp")
+
+   ;; If package option `type1' is given, load `fontaxes':
+   (when (LaTeX-provided-package-options-member "FiraMono" "type1")
+     (TeX-run-style-hooks "fontaxes"))
+
+   ;; Macros:
+   (TeX-add-symbols
+    '("sufigures"        -1)
+    '("firamonooldstyle" -1)
+    '("firamonolining"   -1)
+    '("firamonomedium"   -1))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("sufigures"        "")
+                               ("firamonooldstyle" "")
+                               ("firamonolining"   "")
+                               ("firamonomedium"   ""))
+                             'type-declaration)))
+ LaTeX-dialect)
+
+(defvar LaTeX-FiraMono-package-options '("scaled" "scale"
+                                        "type1"
+                                        "lining" "lf"
+                                        "oldstyle" "osf"
+                                        "nomap"
+                                        "medium" "mb")
+  "Package options for the FiraMono package.")
+
+;;; FiraMono.el ends here
diff --git a/style/FiraSans.el b/style/FiraSans.el
new file mode 100644
index 0000000..3874443
--- /dev/null
+++ b/style/FiraSans.el
@@ -0,0 +1,102 @@
+;;; FiraSans.el --- AUCTeX style for `FiraSans.sty' (v2016/11/20)
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash.esbati'at'gmail.com>
+;; Maintainer: address@hidden
+;; Created: 2016-11-11
+;; 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 `FiraSans.sty' (v2016/11/20).
+;; `FiraSans.sty' is part of TeXLive.
+
+;;; Code:
+
+(TeX-add-style-hook
+ "FiraSans"
+ (lambda ()
+
+   ;; `textcomp' is always loaded:
+   (TeX-run-style-hooks "textcomp")
+
+   ;; If package option `type1' is given, load `fontaxes':
+   (when (LaTeX-provided-package-options-member "FiraSans" "type1")
+     (TeX-run-style-hooks "fontaxes"))
+
+   ;; Macros:
+   (TeX-add-symbols
+    '("sufigures"        -1)
+    '("firaoldstyle"     -1)
+    '("firalining"       -1)
+    '("firatabular"      -1)
+    '("firaproportional" -1)
+    '("firathin"         -1)
+    '("firalight"        -1)
+    '("firaextralight"   -1)
+    '("firaultralight"   -1)
+    '("firamedium"       -1)
+    '("firabook"         -1)
+    '("firasemibold"     -1)
+    '("firaextrabold"    -1)
+    '("firaheavy"        -1))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("sufigures"        "")
+                               ("firaoldstyle"     "")
+                               ("firalining"       "")
+                               ("firatabular"      "")
+                               ("firaproportional" "")
+                               ("firathin"         "")
+                               ("firalight"        "")
+                               ("firaextralight"   "")
+                               ("firaultralight"   "")
+                               ("firamedium"       "")
+                               ("firabook"         "")
+                               ("firasemibold"     "")
+                               ("firaextrabold"    "")
+                               ("firaheavy"        ""))
+                             'type-declaration)))
+ LaTeX-dialect)
+
+(defvar LaTeX-FiraSans-package-options
+  '("scaled" "scale"
+    "type1"
+    "lining" "lf"
+    "oldstyle" "osf"
+    "tabular" "t"
+    "proportional" "p"
+    "book"
+    "medium" "mb"
+    "semibold" "sb"
+    "light" "l"
+    "extralight"
+    "ultralight"
+    "thin"
+    "extrabold"
+    "heavy"
+    "default"
+    "sfdefault")
+  "Package options for the FiraSans package.")
+
+;;; FiraSans.el ends here
diff --git a/style/alltt.el b/style/alltt.el
index ccb6ac9..ed64ac4 100644
--- a/style/alltt.el
+++ b/style/alltt.el
@@ -38,13 +38,10 @@
                '("alltt" current-indentation) t)
    (add-to-list 'LaTeX-verbatim-environments-local "alltt")
    ;; Fontification
-   (when (and (featurep 'font-latex)
+   (when (and (fboundp 'font-latex-update-font-lock)
              (eq TeX-install-font-lock 'font-latex-setup))
-     ;; For syntactic fontification, e.g. verbatim constructs.
-     (font-latex-set-syntactic-keywords)
      ;; Tell font-lock about the update.
-     (setq font-lock-set-defaults nil)
-     (font-lock-set-defaults)))
+     (font-latex-update-font-lock t)))
  LaTeX-dialect)
 
 (defvar LaTeX-alltt-package-options nil
diff --git a/style/expl3.el b/style/amsfonts.el
similarity index 55%
copy from style/expl3.el
copy to style/amsfonts.el
index 6293b87..ba15ace 100644
--- a/style/expl3.el
+++ b/style/amsfonts.el
@@ -1,10 +1,9 @@
-;;; expl3.el --- AUCTeX style for `expl3.sty'
+;;; amsfonts.el --- AUCTeX style for `amsfonts.sty' version 3.01
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2016 Free Software Foundation, Inc.
 
-;; Author: Tassilo Horn <address@hidden>
 ;; Maintainer: address@hidden
-;; Created: 2015-02-22
+;; Author: Mosè Giordano <address@hidden>
 ;; Keywords: tex
 
 ;; This file is part of AUCTeX.
@@ -26,26 +25,29 @@
 
 ;;; Commentary:
 
-;; This file adds support for `expl3.sty'.
+;; This file adds support for `amsfonts.sty' version 3.01.
 
 ;;; Code:
 
-(defvar LaTeX-expl3-syntax-table
-  (let ((st (copy-syntax-table LaTeX-mode-syntax-table)))
-    ;; Make _ and : symbol chars
-    (modify-syntax-entry ?\_ "_" st)
-    (modify-syntax-entry ?\: "_" st)
-    st))
-
 (TeX-add-style-hook
- "expl3"
+ "amsfonts"
  (lambda ()
-   (set-syntax-table LaTeX-expl3-syntax-table)
+   (TeX-add-symbols
+    '("bold" 1))
+   ;; New math font by `amsfonts'.
+   (setq TeX-font-list
+        (append
+         TeX-font-list
+         '((?\C-k "" "" "\mathfrak{" "}"))))
+   ;; Fontification
    (when (and (featurep 'font-latex)
-             (eq TeX-install-font-lock 'font-latex-setup))
-     ;; For syntactic fontification, e.g. verbatim constructs.
-     (font-latex-set-syntactic-keywords)
-     ;; Tell font-lock about the update.
-     (setq font-lock-set-defaults nil)
-     (font-lock-set-defaults)))
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("bold" "{"))
+                             'bold-command)))
  LaTeX-dialect)
+
+;; The `psamsfonts' option is obsolete in AMSFonts v3
+(defvar LaTeX-amsfonts-package-options nil
+  "Package options for the amsfonts package.")
+
+;;; amsfonts.el ends here.
diff --git a/style/amssymb.el b/style/amssymb.el
index 2aec6b6..c53a52f 100644
--- a/style/amssymb.el
+++ b/style/amssymb.el
@@ -36,6 +36,7 @@
 (TeX-add-style-hook
  "amssymb"
  (lambda ()
+   (TeX-run-style-hooks "amsfonts")
    (TeX-add-symbols
     "boxdot"
     "boxplus"
diff --git a/style/array.el b/style/array.el
index 645371d..721e9de 100644
--- a/style/array.el
+++ b/style/array.el
@@ -34,7 +34,7 @@
 (TeX-auto-add-type "array-newcolumntype" "LaTeX")
 
 (defvar LaTeX-array-newcolumntype-regexp
-  '("\\newcolumntype{\([a-zA-Z]+\)}"
+  '("\\newcolumntype{\([^}]+\)}"
     1 LaTeX-auto-array-newcolumntype)
   "Matches the argument of `\newcolumntype' from `array'
 package.")
diff --git a/style/beamer.el b/style/beamer.el
index b9e5953..fe75e05 100644
--- a/style/beamer.el
+++ b/style/beamer.el
@@ -181,11 +181,7 @@
                                ("author" "[{")
                                ("date" "[{")
                                ("frametitle" "<[{")) 'slide-title)
-     ;; For syntactic fontification, e.g. verbatim constructs.
-     (font-latex-set-syntactic-keywords)
-     ;; Tell font-lock about the update.
-     (setq font-lock-set-defaults nil)
-     (font-lock-set-defaults)))
+     (font-latex-update-font-lock t)))
  LaTeX-dialect)
 
 (defun TeX-arg-beamer-overlay-spec (_optional &optional _prompt)
diff --git a/style/bicaption.el b/style/bicaption.el
new file mode 100644
index 0000000..b361393
--- /dev/null
+++ b/style/bicaption.el
@@ -0,0 +1,181 @@
+;;; bicaption.el --- AUCTeX style for `bicaption.sty' (v1.1-158)
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash.esbati'at'gmail.com>
+;; Maintainer: address@hidden
+;; Created: 2016-11-11
+;; 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 `bicaption.sty' (v1.1-158) from
+;; 2016/03/27.  `bicaption.sty' is part of TeXLive.
+
+;; If things do not work or when in doubt, press `C-c C-n'.  Comments
+;; for improvement are welcome.
+
+;;; Code:
+
+(defvar LaTeX-bicaption-key-val-options
+  '(("bi-lang" ("first" "second" "both"))
+    ("bi-singlelinecheck" ("false" "no" "off" "0" "true" "yes" "on" "1"))
+    ("bi-slc" ("false" "no" "off" "0" "true" "yes" "on" "1"))
+    ("bi-swap" ("false" "no" "off" "0" "true" "yes" "on" "1"))
+    ("listtype+"))
+  "Key=value options for bicaption macros.")
+
+(defun LaTeX-arg-bicaption-bicaption (optional &optional prompt star cap-box 
label-inside)
+  "Query for the arguments of \"\bicaption\" incl. a label and insert them.
+PROMPT replaces the standard one.  If STAR is non-nil, then do
+not query for a \label and short captions, insert only captions.
+If CAP-BOX is non-nil, also query and include optional arguments
+for the box command.  If LABEL-INSIDE is non-nil, insert \label
+inside the first mandatory argument, otherwise after all
+arguments."
+  (let* (;; isubcaption needs an environment, "minipage" will be
+        ;; popular.  If so, check next higher environment to find out
+        ;; where we are
+        (currenv (if (string= (LaTeX-current-environment) "minipage")
+                     (LaTeX-current-environment 2)
+                   (LaTeX-current-environment)))
+        (captionI (TeX-read-string
+                   (TeX-argument-prompt
+                    optional (when prompt
+                               (concat "1. " prompt "bicaption"))
+                    "1. bicaption")))
+        (short-captionI
+         (when (and (not star)
+                    (>= (length captionI) LaTeX-short-caption-prompt-length))
+           (TeX-read-string
+            (TeX-argument-prompt t (when prompt
+                                     (concat "Short 1. " prompt "bicaption"))
+                                 "Short 1. bicaption"))))
+        (captionII (TeX-read-string
+                    (TeX-argument-prompt
+                     optional (when prompt
+                                (concat "2. " prompt "bicaption"))
+                     "2. bicaption")))
+        (short-captionII
+         (when (and (not star)
+                    (>= (length captionII) LaTeX-short-caption-prompt-length))
+           (TeX-read-string
+            (TeX-argument-prompt t (when prompt
+                                     (concat "Short 2. " prompt "bicaption"))
+                                 "Short 2. bicaption")))))
+    (indent-according-to-mode)
+    ;; Insert short & regular 1. caption
+    (when (and short-captionI (not (string= short-captionI "")))
+      (insert LaTeX-optop short-captionI LaTeX-optcl))
+    (insert TeX-grop captionI)
+    ;; For i(sub)?captionbox, the label must be inserted here
+    (when (and label-inside (not star))
+      (LaTeX-label currenv 'environment))
+    (insert TeX-grcl)
+    (LaTeX-fill-paragraph)
+    (LaTeX-newline)
+    (indent-according-to-mode)
+    ;; Insert short & regular 2. caption
+    (when (and short-captionII (not (string= short-captionII "")))
+      (insert LaTeX-optop short-captionII LaTeX-optcl))
+    (insert TeX-grop captionII TeX-grcl)
+    ;; Insert width & pos in case of captionbox macros:
+    (when cap-box
+      (let* ((TeX-arg-opening-brace "[")
+            (TeX-arg-closing-brace "]")
+            (width (completing-read (TeX-argument-prompt t nil "Width")
+                                    (mapcar (lambda (elt) (concat TeX-esc (car 
elt)))
+                                            (LaTeX-length-list))))
+            (inpos (if (and width (not (string-equal width "")))
+                       (completing-read (TeX-argument-prompt t nil "Inner 
position")
+                                        '("c" "l" "r" "s"))
+                     "")))
+       (TeX-argument-insert width t)
+       (TeX-argument-insert inpos t)))
+    (LaTeX-fill-paragraph)
+    ;; Insert label
+    (when (and (not label-inside) (not star))
+      (LaTeX-newline)
+      (indent-according-to-mode)
+      (LaTeX-label currenv 'environment))))
+
+(defun LaTeX-arg-bicaption-captionsetup (optional)
+  "Query for 2 arguments for \"\captionsetup\" with bicaption.sty loaded.
+When OPTIONAL is non-nil, include both as optional arguments in
+square brackets."
+  (let* ((flttype (completing-read (TeX-argument-prompt optional nil "Float 
type")
+                                 LaTeX-caption-supported-float-types))
+        (biflt (if (and (not (or (string= flttype "bi")
+                                 (string= flttype "bi-first")
+                                 (string= flttype "bi-second")))
+                        flttype (not (string= flttype "")))
+                   (completing-read (TeX-argument-prompt optional nil 
"Bicaption type")
+                                    '("bi" "bi-first" "bi-second"))
+                 "")))
+    (TeX-argument-insert flttype optional)
+    (TeX-argument-insert biflt optional)))
+
+(TeX-add-style-hook
+ "bicaption"
+ (lambda ()
+
+   ;; Load caption.el:
+   (TeX-run-style-hooks "caption")
+
+   ;; Macros
+   (TeX-add-symbols
+    '("bicaption"        (LaTeX-arg-bicaption-bicaption))
+    '("bicaption*"       (LaTeX-arg-bicaption-bicaption  nil    t))
+    '("bicaptionbox"     (LaTeX-arg-bicaption-bicaption  nil   nil  t t)   t)
+    '("bicaptionbox*"    (LaTeX-arg-bicaption-bicaption  nil    t   t)     t)
+    '("bisubcaption"     (LaTeX-arg-bicaption-bicaption "sub-"))
+    '("bisubcaption*"    (LaTeX-arg-bicaption-bicaption "sub-"  t))
+    '("bisubcaptionbox"  (LaTeX-arg-bicaption-bicaption "sub-" nil  t   t) t)
+    '("bisubcaptionbox*" (LaTeX-arg-bicaption-bicaption "sub-"  t   t   t) t))
+
+   ;; Everything starting with i(sub)?caption should get its own line
+   (LaTeX-paragraph-commands-add-locally '("bicaption" "bisubcaption"))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("bicaption"       "*[{[{")
+                               ("bicaptionbox"    "*[{[{[[")
+                               ("bisubcaption"    "*[{[{")
+                               ("bisubcaptionbox" "*[{[{[["))
+                             'textual)))
+ LaTeX-dialect)
+
+(defun LaTeX-bicaption-package-options ()
+  "Prompt for package options for the bicaption package."
+  (TeX-read-key-val t
+                   (append
+                    `(,(list "language"
+                             (cond ((and (member "babel" (TeX-style-list))
+                                         (LaTeX-babel-active-languages))
+                                    (butlast (LaTeX-babel-active-languages)))
+                                   ((and (member "polyglossia" 
(TeX-style-list))
+                                         (LaTeX-polyglossia-active-languages))
+                                    (butlast (LaTeX-babel-active-languages)))
+                                   (t nil))))
+                    LaTeX-bicaption-key-val-options
+                    LaTeX-caption-key-val-options)))
+
+;;; bicaption.el ends here
diff --git a/style/caption.el b/style/caption.el
index 4e394f0..d8699fa 100644
--- a/style/caption.el
+++ b/style/caption.el
@@ -1,8 +1,8 @@
 ;;; caption.el --- AUCTeX style for `caption.sty' (v3.3-111)
 
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2016 Free Software Foundation, Inc.
 
-;; Author: Arash Esbati <esbati'at'gmx.de>
+;; Author: Arash Esbati <arash.esbati'at'gmail.com>
 ;; Maintainer: address@hidden
 ;; Created: 2015-02-21
 ;; Keywords: tex
@@ -80,6 +80,7 @@
     ("parskip")
     ("position"        ("top" "above" "bottom" "below" "auto"))
     ("singlelinecheck" ("false" "no" "off" "0" "true" "yes" "on" "1"))
+    ("slc"             ("false" "no" "off" "0" "true" "yes" "on" "1"))
     ("skip")
     ("strut"      ("false" "no" "off" "0" "true" "yes" "on" "1"))
     ("style"      ("base" "default"))
@@ -105,6 +106,7 @@
 (defvar LaTeX-caption-supported-float-types
   '("figure" "table" "ContinuedFloat"  ; Standard caption.sty
     "sub" "subtable" "subfigure"        ; subcaption.sty
+    "bi" "bi-first" "bi-second"         ; bicaption.sty
     "ruled" "boxed"                    ; float.sty
     "floatingfigure" "floatingtable"   ; floatflt.sty
     "lstlisting"                       ; listings.sty
@@ -174,12 +176,25 @@ in `caption'-completions."
              (when (and (string-equal key "labelformat")
                         (boundp 'LaTeX-subcaption-key-val-options))
                (pushnew (list "subrefformat"
-                              (delete-dups (apply 'append (list val) 
val-match)))
+                              (delete-dups (apply #'append (list val) 
val-match)))
                         opts :test #'equal))
-             (pushnew (list key (delete-dups (apply 'append (list val) 
val-match)))
+             (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)))))
+      (setq LaTeX-caption-key-val-options-local (copy-alist opts))))
+  ;; Support for environments defined with newfloat.sty: These
+  ;; environments are added to "type" and "type*" key:
+  (when (and (member "newfloat" (TeX-style-list))
+            (fboundp 'LaTeX-newfloat-DeclareFloatingEnvironment-list)
+            (LaTeX-newfloat-DeclareFloatingEnvironment-list))
+    (dolist (key '("type" "type*"))
+      (let* ((val (mapcar #'car 
(LaTeX-newfloat-DeclareFloatingEnvironment-list)))
+            (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)))
+       (pushnew (list key (delete-dups (apply #'append val val-match)))
+                opts :test #'equal)
+       (setq LaTeX-caption-key-val-options-local (copy-alist opts))))))
 
 (defun LaTeX-arg-caption-command (optional &optional prompt)
   "Insert caption-commands from `caption.sty'. If OPTIONAL,
@@ -212,39 +227,48 @@ suffix of the command."
 ;; entry to the list of figures or tables.
 
 ;; The first mandatory argument {<heading>} contains the caption text
-;; and the label.  We use `TeX-insert-macro' to do the job. (Thanks to
-;; M. Giordano for his valuable comments on this!)
+;; and the label.  We used to use `TeX-insert-macro' to do the job
+;; (Thanks to M. Giordano for his valuable comments on this!), but now
+;; moved to `LaTeX-label'.
 
 ;; Syntax:
 ;;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]