[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 2e7ca50 36/36: Merge branch 'master' into extern
From: |
Tassilo Horn |
Subject: |
[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
+ "\\*[ \t\r\n%]*{[ \t\r\n%]*\\([0-9]+\\)[
\t\r\n%]*}" 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* (;; \bisubcaption 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 \bi(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 \bi(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:
;; \captionbox[<list entry>]{<heading>}[<width>][<inner-pos>]{<contents>}
;; \captionbox*{<heading>}[<width>][<inner-pos>]{<contents>}
-(defun LaTeX-arg-caption-captionbox (optional &optional star prompt)
- "Query for the arguments of `\\captionbox' incl. a label and
-insert them. If STAR is non-nil, then do not query for a `\\label' and
-insert only a caption."
- (let ((caption (TeX-read-string
- (TeX-argument-prompt optional prompt "Caption"))))
- (LaTeX-indent-line)
+(defun LaTeX-arg-caption-captionbox (optional &optional star)
+ "Query for the arguments of \"\\captionbox\" incl. a label and insert them.
+If STAR is non-nil, then do not query for a \\label and a short
+caption, insert only a caption."
+ (let* ((currenv (LaTeX-current-environment))
+ (caption (TeX-read-string
+ (TeX-argument-prompt optional nil "Caption")))
+ (short-caption
+ (when (and (not star)
+ (>= (length caption) LaTeX-short-caption-prompt-length))
+ (TeX-read-string
+ (TeX-argument-prompt t nil "Short caption")))))
+ (indent-according-to-mode)
+ (when (and short-caption (not (string= short-caption "")))
+ (insert LaTeX-optop short-caption LaTeX-optcl))
(insert TeX-grop caption)
- (unless star (TeX-insert-macro "label"))
+ (unless star (LaTeX-label currenv 'environment))
(insert TeX-grcl))
- (let* ((width (completing-read (TeX-argument-prompt t prompt "Width")
- (mapcar (lambda(elt) (concat TeX-esc (car
elt)))
+ (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 (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)))))
+ (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))
+ ;; Fill the paragraph before inserting {}. We can use
+ ;; `LaTeX-fill-paragraph' without messing up the code since
+ ;; \caption starts a new paragraph with AUCTeX
+ ;; (cf. `paragraph-start').
+ (LaTeX-fill-paragraph))
(TeX-add-style-hook
"caption"
@@ -257,6 +281,21 @@ insert only a caption."
(setq LaTeX-caption-key-val-options-local
(copy-alist LaTeX-caption-key-val-options))
+ ;; Append key=vals from bicaption.sty if loaded: "language" key
+ ;; depends on the active languages, it is appended extra where main
+ ;; language is removed from the list:
+ (when (and (member "bicaption" (TeX-style-list))
+ ;; Make sure that one of these packages is loaded:
+ (or (fboundp 'LaTeX-babel-active-languages)
+ (fboundp 'LaTeX-polyglossia-active-languages)))
+ (setq LaTeX-caption-key-val-options-local
+ (append
+ `(,(list "language"
+ (or (butlast (LaTeX-babel-active-languages))
+ (butlast (LaTeX-polyglossia-active-languages)))))
+ LaTeX-bicaption-key-val-options
+ LaTeX-caption-key-val-options-local)))
+
;; Caption commands:
(TeX-add-symbols
'("caption*" t)
@@ -269,21 +308,27 @@ insert only a caption."
'("captionof"
(TeX-arg-eval completing-read (TeX-argument-prompt nil nil "Float type")
LaTeX-caption-supported-float-types)
- ["List entry"] t)
+ ["Short caption"] t)
'("captionof*"
(TeX-arg-eval completing-read (TeX-argument-prompt nil nil "Float type")
LaTeX-caption-supported-float-types)
- ["List entry"] t)
+ t)
'("captionsetup"
- [TeX-arg-eval completing-read (TeX-argument-prompt t nil "Float type")
- LaTeX-caption-supported-float-types]
+ (TeX-arg-conditional (member "bicaption" (TeX-style-list))
+ ([LaTeX-arg-bicaption-captionsetup])
+ ([TeX-arg-eval completing-read
+ (TeX-argument-prompt t nil "Float type")
+ LaTeX-caption-supported-float-types]))
(LaTeX-arg-caption-command))
'("captionsetup*"
- [TeX-arg-eval completing-read (TeX-argument-prompt t nil "Float type")
- LaTeX-caption-supported-float-types]
+ (TeX-arg-conditional (member "bicaption" (TeX-style-list))
+ ([LaTeX-arg-bicaption-captionsetup])
+ ([TeX-arg-eval completing-read
+ (TeX-argument-prompt t nil "Float type")
+ LaTeX-caption-supported-float-types]))
(LaTeX-arg-caption-command))
'("clearcaptionsetup"
@@ -296,7 +341,7 @@ insert only a caption."
(TeX-arg-eval completing-read (TeX-argument-prompt nil nil "Float type")
LaTeX-caption-supported-float-types))
- '("captionbox" ["List entry"] (LaTeX-arg-caption-captionbox) t)
+ '("captionbox" (LaTeX-arg-caption-captionbox) t)
'("captionbox*" (LaTeX-arg-caption-captionbox t) t)
@@ -351,9 +396,9 @@ insert only a caption."
(font-latex-add-keywords '(("caption" "*[{")
("captionlistentry" "[{")
("captionof" "*{[{")
- ("captionbox" "*[{[[{"))
+ ("captionbox" "*[{[["))
'textual)
- (font-latex-add-keywords '(("captionsetup" "*[{")
+ (font-latex-add-keywords '(("captionsetup" "*[[{")
("clearcaptionsetup" "*[{")
("DeclareCaptionFont" "{{")
("DeclareCaptionFormat" "*{{")
diff --git a/style/comment.el b/style/comment.el
index ac33ebd..d420e6b 100644
--- a/style/comment.el
+++ b/style/comment.el
@@ -43,7 +43,8 @@
;; New environments
(mapc 'LaTeX-add-environments LaTeX-comment-env-list)
;; Fontification
- (when (and (featurep 'font-latex)
+ (when (and (fboundp 'font-latex-add-keywords)
+ (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
;; For syntactic fontification.
(add-to-list 'font-latex-syntactic-keywords-extra
@@ -56,15 +57,13 @@
`(,(format "^\\(\\\\\\)end *{\\(?:%s\\)}"
(regexp-opt LaTeX-comment-env-list))
(1 ">" t)))
- (font-latex-set-syntactic-keywords)
(font-latex-add-keywords '(("includecomment" "{")
("excludecomment" "{")
("specialcomment" "{{{")
("processcomment" "{{{{"))
'variable)
;; Tell font-lock about the update.
- (setq font-lock-set-defaults nil)
- (font-lock-set-defaults)))
+ (font-latex-update-font-lock t)))
LaTeX-dialect)
;;; comment.el ends here
diff --git a/style/ltxtable.el b/style/dcolumn.el
similarity index 55%
copy from style/ltxtable.el
copy to style/dcolumn.el
index 93dd218..d013b0f 100644
--- a/style/ltxtable.el
+++ b/style/dcolumn.el
@@ -1,10 +1,10 @@
-;;; ltxtable.el --- AUCTeX style for `ltxtable.sty' (v0.2)
+;;; dcolumn.el --- AUCTeX style for `dcolumn.sty' (v1.06)
-;; Copyright (C) 2015 Free Software Foundation, Inc.
+;; Copyright (C) 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-03-14
+;; Created: 2016-12-18
;; Keywords: tex
;; This file is part of AUCTeX.
@@ -26,26 +26,24 @@
;;; Commentary:
-;; This file adds support for `ltxtable.sty' (v0.2) from 1995/12/11.
-;; `ltxtable.sty' is part of TeXLive.
+;; This file adds support for `dcolumn.sty' (v1.06) from 2014/10/28.
+;; `dcolumn.sty' is part of TeXLive.
;;; Code:
(TeX-add-style-hook
- "ltxtable"
+ "dcolumn"
(lambda ()
- (TeX-run-style-hooks "tabularx" "longtable")
- (TeX-add-symbols
- '("LTXtable"
- (TeX-arg-length "Width" "1.0\\linewidth")
- (TeX-arg-eval
- (lambda ()
- (let ((longtable (file-relative-name
- (read-file-name "File with longtable: "))))
- (format "%s" longtable)))))))
+
+ ;; `dcolumn.sty' adds one new column specification letter:
+ (set (make-local-variable 'LaTeX-array-column-letters)
+ (concat LaTeX-array-column-letters "D"))
+
+ ;; Also run style hook for `array':
+ (TeX-run-style-hooks "array"))
LaTeX-dialect)
-(defvar LaTeX-ltxtable-package-options nil
- "Package options for the ltxtable package.")
+(defvar LaTeX-dcolumn-package-options nil
+ "Package options for the dcolumn package.")
-;;; ltxtable.el ends here
+;;; dcolumn.el ends here
diff --git a/style/empheq.el b/style/empheq.el
index cbafdb1..2db9b93 100644
--- a/style/empheq.el
+++ b/style/empheq.el
@@ -288,9 +288,9 @@ number of ampersands if possible."
;; `LaTeX-empheq-item-equation' when `M-RET' is invoked
(add-to-list 'LaTeX-item-list '("empheq" . LaTeX-empheq-item-equation) t)
- ;; Reftex support: Append definition to `reftex-label-alist'
- (when (boundp 'reftex-label-alist)
- (add-to-list 'reftex-label-alist '("empheq" ?e nil nil t) t))
+ ;; Reftex support: Use `reftex-add-label-environments'
+ (when (fboundp 'reftex-add-label-environments)
+ (reftex-add-label-environments '(("empheq" ?e nil nil t))))
(TeX-add-symbols
'("empheqset" (TeX-arg-key-val LaTeX-empheq-key-val-options-local))
@@ -399,8 +399,8 @@ number of ampersands if possible."
(dolist (env envs)
(add-to-list 'LaTeX-label-alist `(,env . LaTeX-amsmath-label) t)))
- ;; RefTeX support: Append original definitions to `reftex-label-alist'
- (when (boundp 'reftex-label-alist)
+ ;; RefTeX support: Add original definitions with
`reftex-add-label-environments'
+ (when (fboundp 'reftex-add-label-environments)
(let ((envs '(("AmSalign" ?e nil nil eqnarray-like)
("AmSequation" ?e nil nil t)
("AmSgather" ?e nil nil eqnarray-like)
@@ -408,7 +408,7 @@ number of ampersands if possible."
("AmSflalign" ?e nil nil eqnarray-like)
("AmSalignat" ?e nil nil alignat-like))))
(dolist (env envs)
- (add-to-list 'reftex-label-alist env t))))
+ (reftex-add-label-environments `(,env)))))
;; Append original definitions to `LaTeX-item-list'; functions
;; are provided by amsmath.el
diff --git a/style/expl3.el b/style/expl3.el
index 6293b87..b686b52 100644
--- a/style/expl3.el
+++ b/style/expl3.el
@@ -41,11 +41,8 @@
"expl3"
(lambda ()
(set-syntax-table LaTeX-expl3-syntax-table)
- (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)
diff --git a/style/fancyhdr.el b/style/fancyhdr.el
index 76f33c7..47748ae 100644
--- a/style/fancyhdr.el
+++ b/style/fancyhdr.el
@@ -63,7 +63,8 @@
(LaTeX-add-pagestyles "fancy" "fancyplain")
;; Fontification
- (when (and (featurep 'font-latex)
+ (when (and (fboundp 'font-latex-add-keywords)
+ (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("fancyhead" "[{")
("fancyfoot" "[{")
@@ -81,8 +82,7 @@
("plainheadrulewidth" "")
("plainfootrulewidth" "")) 'variable)
;; Tell font-lock about the update.
- (setq font-lock-set-defaults nil)
- (font-lock-set-defaults)))
+ (font-latex-update-font-lock)))
LaTeX-dialect)
;; Because there can be many positions, `TeX-completing-read-multiple' is used
diff --git a/style/fancyvrb.el b/style/fancyvrb.el
index 3404365..e0f7c6a 100644
--- a/style/fancyvrb.el
+++ b/style/fancyvrb.el
@@ -175,7 +175,7 @@
;; Fontification
(when (and (fboundp 'font-latex-add-keywords)
- (fboundp 'font-latex-set-syntactic-keywords)
+ (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("DefineVerbatimEnvironment" "{{{")
("CustomVerbatimEnvironment" "{{{")
@@ -189,11 +189,8 @@
; actually be verbatim.
'textual)
(font-latex-add-keywords '(("fvset" "{")) 'variable)
- ;; 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-fancyvrb-package-options nil
diff --git a/style/kpfonts.el b/style/kpfonts.el
index 026c81f..78bc9ab 100644
--- a/style/kpfonts.el
+++ b/style/kpfonts.el
@@ -515,19 +515,6 @@ following commands are defined:
(LaTeX-kpfonts-mode))
;;; Kpfonts Minor Mode ends here
-;; New fonts by `kpfonts'.
-(setq TeX-font-list
- (append
- TeX-font-list
- '(;; Math fonts
- (?\C-h "" "" "\\mathup{" "}")
- (?\C-k "" "" "\\mathfrak{" "}")
- (?\C-p "" "" "\\mathscr{" "}")
- ;; Text fonts
- (?\C-l "\\textscsl{" "}")
- (?\C-o "\\textothersc{" "}")
- (?\C-q "\\textotherscsl{" "}"))))
-
(TeX-add-style-hook
"kpfonts"
(lambda ()
@@ -554,6 +541,19 @@ following commands are defined:
'("wideparen" 1)
'("widering" 1))
+ ;; New fonts by `kpfonts'.
+ (setq TeX-font-list
+ (append
+ TeX-font-list
+ '(;; Math fonts
+ (?\C-h "" "" "\\mathup{" "}")
+ (?\C-k "" "" "\\mathfrak{" "}")
+ (?\C-p "" "" "\\mathscr{" "}")
+ ;; Text fonts
+ (?\C-l "\\textscsl{" "}")
+ (?\C-o "\\textothersc{" "}")
+ (?\C-q "\\textotherscsl{" "}"))))
+
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
diff --git a/style/listings.el b/style/listings.el
index e3a48a9..b2b8f90 100644
--- a/style/listings.el
+++ b/style/listings.el
@@ -351,7 +351,7 @@ with user-defined values via the \"lstdefinestyle\" macro."
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "lstinline")
;; Fontification
(when (and (fboundp 'font-latex-add-keywords)
- (fboundp 'font-latex-set-syntactic-keywords)
+ (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("lstnewenvironment" "{[[{{")) 'function)
(font-latex-add-keywords '(("lstinputlisting" "[{")) 'reference)
@@ -363,11 +363,8 @@ with user-defined values via the \"lstdefinestyle\" macro."
("lstdefinestyle" "{{")
("lstset" "{"))
'variable)
- ;; 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-listings-package-options '("draft" "final" "savemem"
diff --git a/style/longtable.el b/style/longtable.el
index a9659dc..aeb275e 100644
--- a/style/longtable.el
+++ b/style/longtable.el
@@ -29,17 +29,34 @@
;;; Code:
+(defvar LaTeX-longtable-skipping-regexp
+ (regexp-opt '("[l]" "[r]" "[c]" ""))
+ "Regexp matching between \\begin{longtable} and column specification.
+For longtable environments only.")
+
+(defun LaTeX-item-longtable (&optional suppress)
+ "Insert line break macro on the last line and suitable number of &'s.
+For longtable environments. If SUPPRESS is non-nil, do not
+insert line break macro."
+ (unless suppress
+ (save-excursion
+ (end-of-line 0)
+ (just-one-space)
+ (TeX-insert-macro "\\")))
+ (LaTeX-insert-ampersands
+ LaTeX-longtable-skipping-regexp #'LaTeX-array-count-columns))
+
(TeX-add-style-hook
"longtable"
(lambda ()
(LaTeX-add-environments
'("longtable" (lambda (environment)
(let* ((pos (completing-read (TeX-argument-prompt t nil
"Position")
- '(("l") ("r") ("c"))))
- (fmt (TeX-read-string "Format: "
LaTeX-default-format))
- (caption (TeX-read-string "Caption: "))
- (short-caption (when (>= (length caption)
LaTeX-short-caption-prompt-length)
- (TeX-read-string "(Optional) Short
caption: "))))
+ '(("l") ("r") ("c"))))
+ (fmt (TeX-read-string "Format: "
LaTeX-default-format))
+ (caption (TeX-read-string "Caption: "))
+ (short-caption (when (>= (length caption)
LaTeX-short-caption-prompt-length)
+ (TeX-read-string "(Optional) Short
caption: "))))
(setq LaTeX-default-format fmt)
(LaTeX-insert-environment environment
(concat
@@ -48,17 +65,26 @@
(concat TeX-grop fmt
TeX-grcl)))
;; top caption -- do nothing if user skips caption
(unless (zerop (length caption))
+ ;; insert `\caption[short-caption]{caption':
+ (insert TeX-esc "caption")
+ (when (and short-caption (not (string= short-caption
"")))
+ (insert LaTeX-optop short-caption LaTeX-optcl))
+ (insert TeX-grop caption)
+ ;; ask for a label and insert it
+ (LaTeX-label environment 'environment)
;; the longtable `\caption' is equivalent to a
;; `\multicolumn', so it needs a `\\' at the
- ;; end of the line
- (insert (LaTeX-compose-caption-macro caption
short-caption) "\\\\")
+ ;; end of the line. Prior to that, add } to
+ ;; close `\caption{'
+ (insert TeX-grcl "\\\\")
+ ;; fill the caption
+ (LaTeX-fill-paragraph)
+ ;; Insert a new line and indent
(LaTeX-newline)
- (indent-according-to-mode)
- ;; ask for a label and insert a new line only
- ;; if a label is actually inserted
- (when (LaTeX-label environment 'environment)
- (LaTeX-newline)
- (indent-according-to-mode)))))))
+ (indent-according-to-mode))
+ ;; Insert suitable number of &'s, suppress line break
+ (LaTeX-item-longtable t)))))
+
(TeX-add-symbols
;; Commands to end table rows
'("endhead" 0)
@@ -84,6 +110,9 @@
;; custome values.
(add-to-list 'LaTeX-label-alist '("longtable" . LaTeX-table-label) t)
+ ;; Append longtable to `LaTeX-item-list' with `LaTeX-item-longtable'
+ (add-to-list 'LaTeX-item-list '("longtable" . LaTeX-item-longtable) t)
+
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
@@ -94,4 +123,10 @@
'textual)))
LaTeX-dialect)
+;; `longtable.sty' has two options "errorshow" and "pausing", both for
+;; debugging purposes. We ignore them both in order to make package
+;; loading faster in a buffer.
+(defvar LaTeX-longtable-package-options nil
+ "Package options for the longtable package.")
+
;; longtable.el ends here
diff --git a/style/ltxtable.el b/style/ltxtable.el
index 93dd218..4ce184b 100644
--- a/style/ltxtable.el
+++ b/style/ltxtable.el
@@ -31,10 +31,20 @@
;;; Code:
+(defvar LaTeX-ltxtable-file-regexp
+ `(,(concat "\\\\LTXtable"
+ "{\\(?:[^}]+\\)}"
+ "{\\(\\.*[^#}%\\\\\\.\n\r]+\\)\\(\\.[^#}%\\\\\\.\n\r]+\\)?}")
+ 1 TeX-auto-file)
+ "Matches the file argument of \\LTXtable marco from ltxtable package.
+The regexp for the 2. argument is the same as for \"input\" and
+\"include\" entries in `LaTeX-auto-regexp-list'.")
+
(TeX-add-style-hook
"ltxtable"
(lambda ()
(TeX-run-style-hooks "tabularx" "longtable")
+
(TeX-add-symbols
'("LTXtable"
(TeX-arg-length "Width" "1.0\\linewidth")
@@ -42,7 +52,29 @@
(lambda ()
(let ((longtable (file-relative-name
(read-file-name "File with longtable: "))))
- (format "%s" longtable)))))))
+ (format "%s" longtable))))))
+
+ ;; Make sure that \LTXtable stays in its own line:
+ (LaTeX-paragraph-commands-add-locally "LTXtable")
+
+ ;; Tell AUCTeX about a new file-include command:
+ (TeX-auto-add-regexp LaTeX-ltxtable-file-regexp)
+
+ ;; Tell RefTeX about a new file-include command: Add
+ ;; LTXtable{<width>} as a regexp (without \) to
+ ;; `reftex-include-file-commands' and run
+ ;; `reftex-compile-variables'. Do this all only once.
+ (when (and (boundp 'reftex-include-file-commands)
+ (not (string-match "LTXtable"
+ (mapconcat #'identity
reftex-include-file-commands "|"))))
+ (add-to-list 'reftex-include-file-commands "LTXtable{\\(?:[^}]+\\)}" t)
+ (reftex-compile-variables))
+
+ ;; Fontification
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("LTXtable" "{{"))
+ 'textual)))
LaTeX-dialect)
(defvar LaTeX-ltxtable-package-options nil
diff --git a/style/mathtools.el b/style/mathtools.el
index c6c4b17..025feca 100644
--- a/style/mathtools.el
+++ b/style/mathtools.el
@@ -133,8 +133,8 @@
`(,env . LaTeX-item-equation) t)
(add-to-list 'LaTeX-label-alist
`(,env . LaTeX-amsmath-label) t)
- (when (boundp 'reftex-label-alist)
- (add-to-list 'reftex-label-alist `(,env ?e nil nil t) t)))))
+ (when (fboundp 'reftex-add-label-environments)
+ (reftex-add-label-environments `((,env ?e nil nil t)))))))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-mathtools-auto-prepare t)
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-mathtools-auto-cleanup t)
@@ -144,28 +144,22 @@
"Query and insert mathstyle argument to various commands.
If OPTIONAL, insert it as optional argument in brackets."
(TeX-argument-insert
- (let ((style (completing-read
- (TeX-argument-prompt optional nil
- (concat "Math style: " TeX-esc) t)
- '("displaystyle" "textstyle"
- "scriptstyle" "scriptscriptstyle"))))
- (if (string= style "")
- style
- (concat TeX-esc style)))
- optional))
+ (completing-read
+ (TeX-argument-prompt optional nil
+ (concat "Math style: " TeX-esc) t)
+ '("displaystyle" "textstyle"
+ "scriptstyle" "scriptscriptstyle"))
+ optional TeX-esc))
(defun LaTeX-mathtools-arg-mathsize-completion (optional)
"Query and insert math size argument to various commands.
If OPTIONAL, insert it as optional argument in brackets."
(TeX-argument-insert
- (let ((size (completing-read
- (TeX-argument-prompt optional nil
- (concat "Size command: " TeX-esc) t)
- '("big" "Big" "bigg" "Bigg"))))
- (if (string= size "")
- size
- (concat TeX-esc size)))
- optional))
+ (completing-read
+ (TeX-argument-prompt optional nil
+ (concat "Size command: " TeX-esc) t)
+ '("big" "Big" "bigg" "Bigg"))
+ optional TeX-esc))
(defun LaTeX-mathtools-arg-declarepaireddelimiter (optional &optional X)
"Query and insert various \\DeclarePairedDelimiter macros from mathtools
package."
@@ -183,7 +177,7 @@ If OPTIONAL, insert it as optional argument in brackets."
1)))
(LaTeX-add-mathtools-DeclarePairedDelimiters
`(,cmd ,(if X arg "")))
- (TeX-argument-insert (concat TeX-esc cmd) optional)
+ (TeX-argument-insert cmd optional TeX-esc)
(when arg
(insert (concat LaTeX-optop arg LaTeX-optcl)))))
@@ -458,13 +452,13 @@ Put line break macro on the last line. Next, insert an
ampersand."
("multlined" . LaTeX-amsmath-label))
LaTeX-label-alist))
- ;; RefTeX support: Add env's to `reftex-label-alist'
- (when (boundp 'reftex-label-alist)
+ ;; RefTeX support: Add env's with `reftex-add-label-environments'
+ (when (fboundp 'reftex-add-label-environments)
(let ((envs '(("lgathered" ?e nil nil t)
("rgathered" ?e nil nil t)
("multlined" ?e nil nil t))))
(dolist (env envs)
- (add-to-list 'reftex-label-alist env t))))
+ (reftex-add-label-environments `(,env)))))
;; Fontification
(when (and (featurep 'font-latex)
@@ -481,7 +475,10 @@ Put line break macro on the last line. Next, insert an
ampersand."
("renewgathered" "{{{{"))
'function)
(font-latex-add-keywords '(("usetagform" "{"))
- 'variable)))
+ 'variable)
+ (font-latex-add-keywords '(("refeq" "{")
+ ("noeqref" "{"))
+ 'reference)))
LaTeX-dialect)
;;; mathtools.el ends here
diff --git a/style/minted.el b/style/minted.el
index a4f413d..b4bc572 100644
--- a/style/minted.el
+++ b/style/minted.el
@@ -168,13 +168,10 @@
(car name-lang)
(cadr name-lang))))
(add-to-list 'TeX-auto-symbol (list lang 'TeX-arg-file))))
- (when (and (fboundp 'font-latex-add-keywords)
- (fboundp 'font-latex-set-syntactic-keywords)
+ (when (and (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
;; Refresh font-locking so that the verbatim envs take effect.
- (font-latex-set-syntactic-keywords)
- (setq font-lock-set-defaults nil)
- (font-lock-set-defaults)))
+ (font-latex-update-font-lock t)))
(add-hook 'TeX-auto-prepare-hook #'LaTeX-minted-auto-prepare t)
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-minted-auto-cleanup t)
@@ -219,18 +216,15 @@
;; Fontification
(when (and (fboundp 'font-latex-add-keywords)
- (fboundp 'font-latex-set-syntactic-keywords)
+ (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(;; FIXME: Those have the form \mint{lang}|code|
;; so ideally the verbatim arg should be
;; recognized.
"mint" "mintinline")
'function)
- ;; 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-minted-package-options '("section" "chapter" "cache"
diff --git a/style/newfloat.el b/style/newfloat.el
index e84fad7..166eff5 100644
--- a/style/newfloat.el
+++ b/style/newfloat.el
@@ -119,6 +119,7 @@ If `caption.el' is loaded, add the new floating environment
to
(LaTeX-add-environments flt)
(add-to-list (make-local-variable 'LaTeX-indent-environment-list)
`(,flt current-indentation) t)
+ (add-to-list 'LaTeX-label-alist `(,flt . "lst:") t)
(when (fboundp 'reftex-add-label-environments)
(reftex-add-label-environments
`((,flt ?l "lst:" "~\\ref{%s}" caption nil nil)))))
diff --git a/style/ntheorem.el b/style/ntheorem.el
index b7c22ea..5ce4803 100644
--- a/style/ntheorem.el
+++ b/style/ntheorem.el
@@ -288,12 +288,12 @@ make them available as new environments. Update
'("shadecolor"
(TeX-arg-eval
(lambda ()
- (let ((color
- (if (or (member "xcolor" (TeX-style-list))
- (member "color" (TeX-style-list)))
- (completing-read "color: " (or
(LaTeX-xcolor-definecolor-list)
-
(LaTeX-color-definecolor-list)))
- (TeX-read-string "color: "))))
+ (let ((color (cond ((member "xcolor" (TeX-style-list))
+ (completing-read "Color name: "
(LaTeX-xcolor-definecolor-list)))
+ ((member "color" (TeX-style-list))
+ (completing-read "Color name: "
(LaTeX-color-definecolor-list)))
+ (t
+ (TeX-read-string "Color name: ")))))
(format "%s" color)))))
'("theoremframepreskip"
diff --git a/style/siunitx.el b/style/siunitx.el
index a5890f5..9fad553 100644
--- a/style/siunitx.el
+++ b/style/siunitx.el
@@ -590,11 +590,17 @@ string."
"ab"
"zb"
"yb"))
+
+ ;; `siunitx.sty' adds new column specification letters
+ (set (make-local-variable 'LaTeX-array-column-letters)
+ (concat LaTeX-array-column-letters "s" "S"))
+
(TeX-run-style-hooks "l3keys2e"
"array"
"amstext"
"xparse"
"expl3")
+
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
diff --git a/style/splitidx.el b/style/splitidx.el
index a2d9be7..554c7a3 100644
--- a/style/splitidx.el
+++ b/style/splitidx.el
@@ -230,12 +230,10 @@
(add-to-list 'TeX-complete-list
'("|see{\\([^{}\n\r]*\\)" 1 LaTeX-index-entry-list))
- ;; Append our defintion to `reftex-index-macros' in order not to
- ;; override any user customizations.
- (when (boundp 'reftex-index-macros)
- (add-to-list 'reftex-index-macros
- `("\\sindex[]{*}" 1
- ,LaTeX-splitidx-sindex-reftex-quick-id-key "" nil t)))
+ ;; Tell RefTeX with `reftex-add-index-macros'
+ (when (fboundp 'reftex-add-index-macros)
+ (reftex-add-index-macros
+ `(("\\sindex[]{*}" 1 ,LaTeX-splitidx-sindex-reftex-quick-id-key "" nil
t))))
;; 3.2 Marking up index entries
;; \index should be an alias for \sindex
@@ -247,10 +245,8 @@
(LaTeX-splitidx-newindex-list) ]
(TeX-arg-index)))
;; Tell RefTeX to look in the optional arg. for the index short cut
- (when (boundp 'reftex-index-macros)
- (add-to-list 'reftex-index-macros
- '("\\index[]{*}" 1 ?i "" nil t)
- t))
+ (when (fboundp 'reftex-add-index-macros)
+ (reftex-add-index-macros '(("\\index[]{*}" 1 ?i "" nil t))))
(add-to-list 'LaTeX-auto-regexp-list
`(,(concat
"\\\\index\\(?:\\[[^{}]*\\]\\)?"
diff --git a/style/subcaption.el b/style/subcaption.el
index 6205366..fc5fc63 100644
--- a/style/subcaption.el
+++ b/style/subcaption.el
@@ -36,50 +36,71 @@
"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 non-nil, 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))
+(defun LaTeX-arg-subcaption-subcaption (optional &optional star)
+ "Query for the arguments of \"\\subcaption\" incl. a label and insert them.
+If STAR is non-nil, then do not query for a \\label and a short
+caption, insert only a caption."
+ (let* (;; \subcaption 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)))
+ (caption (TeX-read-string
+ (TeX-argument-prompt optional nil "Sub-caption")))
+ (short-caption
+ (when (and (not star)
+ (>= (length caption) LaTeX-short-caption-prompt-length))
+ (TeX-read-string
+ (TeX-argument-prompt t nil "Short caption")))))
+ (indent-according-to-mode)
+ (when (and short-caption (not (string= short-caption "")))
+ (insert LaTeX-optop short-caption LaTeX-optcl))
(insert TeX-grop caption TeX-grcl)
+ ;; Fill the \subcaption paragraph before inserting the \label:
+ (LaTeX-fill-paragraph)
(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 non-nil, 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)
+ (save-excursion
+ (LaTeX-label currenv 'environment))
+ ;; Move \label into next line if we have one:
+ (when (looking-at (regexp-quote "\\label{"))
+ (LaTeX-newline)
+ (indent-according-to-mode)
+ (end-of-line)))))
+
+(defun LaTeX-arg-subcaption-subcaptionbox (optional &optional star)
+ "Query for the arguments of \"\\subcaptionbox\" incl. a label and insert
them.
+If STAR is non-nil, then do not query for a \\label and a short
+caption, insert only a caption."
+ (let* ((currenv (LaTeX-current-environment))
+ (caption (TeX-read-string
+ (TeX-argument-prompt optional nil "Sub-caption")))
+ (short-caption
+ (when (and (not star)
+ (>= (length caption) LaTeX-short-caption-prompt-length))
+ (TeX-read-string
+ (TeX-argument-prompt t nil "Short Sub-caption")))))
+ (indent-according-to-mode)
+ (when (and short-caption (not (string= short-caption "")))
+ (insert LaTeX-optop short-caption LaTeX-optcl))
(insert TeX-grop caption)
- (unless star (TeX-insert-macro "label"))
+ (unless star (LaTeX-label currenv 'environment))
(insert TeX-grcl))
- (let* ((width (completing-read (TeX-argument-prompt t prompt "Width")
+ (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 (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)))))
+ (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))
+ ;; Fill the paragraph before inserting {}. We use this function
+ ;; since we add \subcaption to `paragraph-start' in the style hook
+ ;; below.
+ (LaTeX-fill-paragraph))
(TeX-add-style-hook
"subcaption"
@@ -96,7 +117,7 @@ insert only a caption."
;; 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)
'("subcaptionbox*" (LaTeX-arg-subcaption-subcaptionbox t) t)
'("subref" TeX-arg-ref)
;; \subref* is only available with hyperref.sty loaded, we don't
@@ -124,11 +145,18 @@ insert only a caption."
(TeX-argument-prompt nil nil "Type")
'("figure" "table"))))
+ ;; Everything starting with \subcaption should get its own line
+ (LaTeX-paragraph-commands-add-locally "subcaption")
+
;; The subfigure & subtable environments
(LaTeX-add-environments
'("subfigure" LaTeX-env-minipage)
'("subtable" LaTeX-env-minipage))
+ ;; Append them to `LaTeX-label-alist':
+ (add-to-list 'LaTeX-label-alist '("subfigure" . LaTeX-figure-label) t)
+ (add-to-list 'LaTeX-label-alist '("subtable" . LaTeX-table-label) t)
+
;; Introduce env's to RefTeX if loaded
(when (fboundp 'reftex-add-label-environments)
(reftex-add-label-environments
@@ -139,7 +167,7 @@ insert only a caption."
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("subcaption" "*[{")
- ("subcaptionbox" "*[{[[{")
+ ("subcaptionbox" "*[{[[")
("phantomcaption" "")
("phantomsubcaption" ""))
'textual)
diff --git a/style/subfiles.el b/style/subfiles.el
new file mode 100644
index 0000000..604e4f9
--- /dev/null
+++ b/style/subfiles.el
@@ -0,0 +1,56 @@
+;;; subfiles.el --- AUCTeX style for the subfiles package.
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Uwe Brauer <address@hidden>
+;; Created: 07 Nov 2016
+;; 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.
+
+;; Acknowledgements
+;; Mosè Giordano <address@hidden>
+;; Arash Esbati <address@hidden>
+
+;;; Commentary:
+
+;; This file adds support for the subfiles package.
+
+;;; Code:
+
+(defvar LaTeX-subfiles-package-options nil
+ "Package options for the subfiles package.")
+
+(TeX-add-style-hook
+ "subfiles"
+ (lambda ()
+ ;; The following code will fontify `\subfile{}' like include.
+ (when (and (featurep 'font-latex)
+ (eq TeX-install-font-lock 'font-latex-setup))
+ (font-latex-add-keywords '(("subfile" "{"))
+ 'reference))
+ ;; The following code will run `TeX-run-style-hooks' on the subfile master
file.
+ ;; Thanks to Mosè Giordano <address@hidden> for presenting a better
solution using `assoc'.
+ (TeX-run-style-hooks
+ (file-name-base (cadr (assoc "subfiles" LaTeX-provided-class-options))))
+ (TeX-add-symbols
+ '("subfile" TeX-arg-file)))
+ LaTeX-dialect)
+
+
+;;; subfiles.el ends here
diff --git a/style/tabularx.el b/style/tabularx.el
index 63a1272..2d484db 100644
--- a/style/tabularx.el
+++ b/style/tabularx.el
@@ -43,6 +43,10 @@
;; `LaTeX-indent-environment-list' in order not to override custom settings.
(add-to-list (make-local-variable 'LaTeX-indent-environment-list)
'("tabularx" LaTeX-indent-tabular) t)
+
+ ;; Append tabularx to `LaTeX-item-list' with `LaTeX-item-tabular*'
+ (add-to-list 'LaTeX-item-list '("tabularx" . LaTeX-item-tabular*) t)
+
;; New symbols
(TeX-add-symbols
"tracingtabularx"
diff --git a/style/tabulary.el b/style/tabulary.el
index 289401e..aa0fcf5 100644
--- a/style/tabulary.el
+++ b/style/tabulary.el
@@ -43,6 +43,10 @@
;; `LaTeX-indent-environment-list' in order not to override custom settings.
(add-to-list (make-local-variable 'LaTeX-indent-environment-list)
'("tabulary" LaTeX-indent-tabular))
+
+ ;; Append tabulary to `LaTeX-item-list' with `LaTeX-item-tabular*'
+ (add-to-list 'LaTeX-item-list '("tabulary" . LaTeX-item-tabular*) t)
+
;; New symbols
(TeX-add-symbols
"tymax" "tymin" "tyformat")
diff --git a/style/textpos.el b/style/textpos.el
index 9c27ddd..e8a31e6 100644
--- a/style/textpos.el
+++ b/style/textpos.el
@@ -83,17 +83,23 @@ them."
'("textblockcolour"
(TeX-arg-eval
(lambda ()
- (let ((color (completing-read "Color name: "
- (or (LaTeX-xcolor-definecolor-list)
- (LaTeX-color-definecolor-list)))))
+ (let ((color (cond ((member "xcolor" (TeX-style-list))
+ (completing-read "Color name: "
(LaTeX-xcolor-definecolor-list)))
+ ((member "color" (TeX-style-list))
+ (completing-read "Color name: "
(LaTeX-color-definecolor-list)))
+ (t
+ (TeX-read-string "Color name: ")))))
(format "%s" color)))))
'("textblockrulecolour"
(TeX-arg-eval
(lambda ()
- (let ((color (completing-read "Color name: "
- (or (LaTeX-xcolor-definecolor-list)
- (LaTeX-color-definecolor-list)))))
+ (let ((color (cond ((member "xcolor" (TeX-style-list))
+ (completing-read "Color name: "
(LaTeX-xcolor-definecolor-list)))
+ ((member "color" (TeX-style-list))
+ (completing-read "Color name: "
(LaTeX-color-definecolor-list)))
+ (t
+ (TeX-read-string "Color name: ")))))
(format "%s" color)))))
'("TPshowboxestrue")
diff --git a/style/url.el b/style/url.el
index efdc297..9c36a07 100644
--- a/style/url.el
+++ b/style/url.el
@@ -57,7 +57,8 @@
(add-to-list 'LaTeX-verbatim-macros-with-braces-local "url")
;; Fontification
- (when (and (featurep 'font-latex)
+ (when (and (fboundp 'font-latex-add-keywords)
+ (fboundp 'font-latex-update-font-lock)
(eq TeX-install-font-lock 'font-latex-setup))
(font-latex-add-keywords '(("path" "{") ("url" "{")) 'reference)
(font-latex-add-keywords '(("Url" "")
@@ -74,11 +75,8 @@
("urldef" "")
("urlstyle" "{"))
'variable)
- ;; 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-urlstyle (optional &optional prompt)
diff --git a/tests/latex/latex-test.el b/tests/latex/latex-test.el
index cc23caf..e8d8900 100644
--- a/tests/latex/latex-test.el
+++ b/tests/latex/latex-test.el
@@ -1,6 +1,6 @@
;;; latex-test.el --- tests for LaTeX mode
-;; Copyright (C) 2014, 2015 Free Software Foundation, Inc.
+;; Copyright (C) 2014--2016 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
@@ -24,6 +24,13 @@
(require 'ert)
(require 'latex)
+;; Add the "style/" directory to `TeX-style-path',
+;; so we can load style files inside tests.
+(add-to-list 'TeX-style-path
+ (expand-file-name "../../style"
+ (when load-file-name
+ (file-name-directory load-file-name))))
+
(defun AUCTeX-set-ert-path (&rest sym-val)
"Set first element of SYM-VAL to the next one, and so on.
@@ -48,7 +55,11 @@ line and from another directory."
'LaTeX-math-indent/in
"math-indent-in.tex"
'LaTeX-math-indent/out
- "math-indent-out.tex")
+ "math-indent-out.tex"
+ 'tabular-count-ampersands/in
+ "tabular-count-ampersands-in.tex"
+ 'tabular-count-ampersands/out
+ "tabular-count-ampersands-out.tex")
(ert-deftest LaTeX-indent-tabular ()
(should (string=
@@ -106,4 +117,22 @@ line and from another directory."
(LaTeX-insert-environment "foobar")
(buffer-string)))))
+;; Test for inserting &'s with `M-RET' in various tabular environment.
+;; FIXME: One thing missing is running style hooks while running the test.
+(ert-deftest LaTeX-count-ampersands-inserted-in-tabular ()
+ (should (string=
+ (with-temp-buffer
+ (insert-file-contents tabular-count-ampersands/in)
+ (LaTeX-mode)
+ (goto-char (point-min))
+ ;; Do not ask for opt. argument in (TeX-insert-macro "\\"):
+ (let ((TeX-insert-macro-default-style 'mandatory-args-only))
+ (while (search-forward "LaTeX-insert-item" nil t)
+ (LaTeX-insert-item)))
+ (buffer-string))
+ (with-temp-buffer
+ (insert-file-contents tabular-count-ampersands/out)
+ (LaTeX-mode)
+ (buffer-string)))))
+
;;; latex-test.el ends here
diff --git a/tests/latex/tabular-count-ampersands-in.tex
b/tests/latex/tabular-count-ampersands-in.tex
new file mode 100644
index 0000000..97bc5f8
--- /dev/null
+++ b/tests/latex/tabular-count-ampersands-in.tex
@@ -0,0 +1,36 @@
+\documentclass{article}
+% \usepackage{tabularx,tabulary,longtable}
+\begin{document}
+
+Standard LaTeX tabular:
+\begin{tabular}[t]{llll}
+ 1 & 2 & 3 & LaTeX-insert-item
+\end{tabular}
+
+LaTeX tabular with *-operator:
+\begin{tabular}[t]{*{3}{l}r}
+ 1 & 2 & 3 & LaTeX-insert-item
+\end{tabular}
+
+\begin{tabular}{*{3}{l}>{\tiny\hfill}l<{\hfill}}
+ 1 & 2 & 3 & LaTeX-insert-item
+\end{tabular}
+
+\begin{tabular}[t]{*{3}{lc}r}
+ 1 & 2 & 3 & 4 & 5 & 6 & LaTeX-insert-item
+\end{tabular}
+
+\begin{tabular}[t]{*{3}{lc*{2}{l}} r}
+ 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & LaTeX-insert-item
+\end{tabular}
+
+Standard LaTeX tabular*:
address@hidden@{}}
+ 1 & 2 & 3 & LaTeX-insert-item
+\end{tabular*}
+
address@hidden|l}|r|}
+ 1 & 2 & 3 & LaTeX-insert-item
+\end{tabular*}
+
+\end{document}
diff --git a/tests/latex/tabular-count-ampersands-out.tex
b/tests/latex/tabular-count-ampersands-out.tex
new file mode 100644
index 0000000..1163637
--- /dev/null
+++ b/tests/latex/tabular-count-ampersands-out.tex
@@ -0,0 +1,43 @@
+\documentclass{article}
+% \usepackage{tabularx,tabulary,longtable}
+\begin{document}
+
+Standard LaTeX tabular:
+\begin{tabular}[t]{llll}
+ 1 & 2 & 3 & LaTeX-insert-item \\
+ &&&
+\end{tabular}
+
+LaTeX tabular with *-operator:
+\begin{tabular}[t]{*{3}{l}r}
+ 1 & 2 & 3 & LaTeX-insert-item \\
+ &&&
+\end{tabular}
+
+\begin{tabular}{*{3}{l}>{\tiny\hfill}l<{\hfill}}
+ 1 & 2 & 3 & LaTeX-insert-item \\
+ &&&
+\end{tabular}
+
+\begin{tabular}[t]{*{3}{lc}r}
+ 1 & 2 & 3 & 4 & 5 & 6 & LaTeX-insert-item \\
+ &&&&&&
+\end{tabular}
+
+\begin{tabular}[t]{*{3}{lc*{2}{l}} r}
+ 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & LaTeX-insert-item \\
+ &&&&&&&&&&&&
+\end{tabular}
+
+Standard LaTeX tabular*:
address@hidden@{}}
+ 1 & 2 & 3 & LaTeX-insert-item \\
+ &&&
+\end{tabular*}
+
address@hidden|l}|r|}
+ 1 & 2 & 3 & LaTeX-insert-item \\
+ &&&
+\end{tabular*}
+
+\end{document}
diff --git a/tex-buf.el b/tex-buf.el
index d9648f8..07bb78b 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -3677,7 +3677,21 @@ forward, if negative)."
TeX-error-overview-buffer-name)
(set-window-dedicated-p (selected-window) t))
(TeX-pop-to-buffer TeX-error-overview-buffer-name))))
- (error "No error or warning to show"))
+ (error (concat "No error or warning to show"
+ ;; Suggest to display warnings and bad boxes with the
+ ;; appropriate key-bindings if there are such
+ ;; messages in the output buffer. Rationale of the
+ ;; test: `TeX-error-overview-list-entries' is nil,
+ ;; but if `TeX-error-list' is not nil it means that
+ ;; there are hidden warnings/bad boxes.
+ (when (TeX-process-get-variable (TeX-active-master)
+ 'TeX-error-list)
+ (format ". Type `%s' and `%s' to display \
+warnings and bad boxes"
+ (substitute-command-keys
+
"\\<TeX-mode-map>\\[TeX-toggle-debug-warnings]")
+ (substitute-command-keys
+
"\\<TeX-mode-map>\\[TeX-toggle-debug-bad-boxes]"))))))
(error "No process for this document"))
(error "Error overview is available only in Emacs 24 or later")))
diff --git a/tex-ispell.el b/tex-ispell.el
index b12ee3e..9578a91 100644
--- a/tex-ispell.el
+++ b/tex-ispell.el
@@ -51,6 +51,7 @@
;; fontaxes.sty
;; fontspec.sty
;; listings.sty
+;; ltxtable.sty
;; mdframed.sty
;; minted.sty
;; nameref.sty
@@ -153,6 +154,8 @@
;; listings.sty
("lstinputlisting" . 1)
("lstset" . 1)
+ ;; ltxtable.sty
+ ("LTXtable" . 2)
;; mdframed.sty
("mdfsetup" . 1)
("mdfapptodefinestyle" . 2)
diff --git a/tex.el b/tex.el
index e192899..ab301fd 100644
--- a/tex.el
+++ b/tex.el
@@ -2513,7 +2513,9 @@ name of master file if it cannot be determined otherwise."
(file-name-directory buffer-file-name)))))))
(defun TeX-add-local-master ()
- "Add local variable for `TeX-master'."
+ "Add local variable for `TeX-master'.
+
+Get `major-mode' from master file and enable it."
(when (and (buffer-file-name)
(string-match TeX-one-master
(file-name-nondirectory (buffer-file-name)))
@@ -2526,20 +2528,31 @@ name of master file if it cannot be determined
otherwise."
"End:")))
(beginning-of-line 1)
(insert prefix "TeX-master: " (prin1-to-string TeX-master) "\n"))
- (let ((comment-prefix (cond ((eq major-mode 'texinfo-mode) "@c ")
- ((eq major-mode 'doctex-mode) "% ")
- (t "%%% ")))
- (mode (concat (and (boundp 'japanese-TeX-mode) japanese-TeX-mode
- "japanese-")
- (substring (symbol-name major-mode) 0 -5))))
+ (let* ((mode (if (stringp TeX-master)
+ (with-current-buffer
+ (find-file-noselect
+ (TeX-master-file TeX-default-extension))
+ major-mode)
+ major-mode))
+ (comment-prefix (cond ((eq mode 'texinfo-mode) "@c ")
+ ((eq mode 'doctex-mode) "% ")
+ (t "%%% ")))
+ (mode-string (concat (and (boundp 'japanese-TeX-mode)
japanese-TeX-mode
+ "japanese-")
+ (substring (symbol-name mode) 0 -5))))
(newline)
(when (eq major-mode 'doctex-mode)
(insert comment-prefix TeX-esc "endinput\n"))
(insert
comment-prefix "Local Variables:\n"
- comment-prefix "mode: " mode "\n"
+ comment-prefix "mode: " mode-string "\n"
comment-prefix "TeX-master: " (prin1-to-string TeX-master) "\n"
- comment-prefix "End:\n")))))
+ comment-prefix "End:\n")
+ (funcall mode)
+ ;; TeX modes run `VirTeX-common-initialization' which kills all local
+ ;; variables, thus `TeX-master' will be forgotten after `(funcall
+ ;; mode)'. Reparse local variables in order to bring it back.
+ (hack-local-variables)))))
(defun TeX-local-master-p ()
"Return non-nil if there is a `TeX-master' entry in local variables spec.
- [elpa] externals/auctex a833aff 26/36: Use `LaTeX-item-longtable' while inserting longtable's, (continued)
- [elpa] externals/auctex a833aff 26/36: Use `LaTeX-item-longtable' while inserting longtable's, Tassilo Horn, 2016/12/22
- [elpa] externals/auctex 80d2a08 10/36: Min fix to kpfonts package, Tassilo Horn, 2016/12/22
- [elpa] externals/auctex 79c8264 19/36: Fix query for defined colors in style/textpos.el, Tassilo Horn, 2016/12/22
- [elpa] externals/auctex 0265793 25/36: Add "s" and "S" to `LaTeX-array-column-letters', Tassilo Horn, 2016/12/22
- [elpa] externals/auctex 7518a8a 31/36: Mention that arguments to *-operator must be in braces, Tassilo Horn, 2016/12/22
- [elpa] externals/auctex db3fcb9 32/36: * tex.el (TeX-add-local-master): Inherit major mode from master file., Tassilo Horn, 2016/12/22
- [elpa] externals/auctex 1aa46c3 23/36: ; Use third argument of `TeX-argument-insert', Tassilo Horn, 2016/12/22
- [elpa] externals/auctex 40da84e 20/36: Support RefTeX with `reftex-add-label-environments' in style/empheq.el, Tassilo Horn, 2016/12/22
- [elpa] externals/auctex b44d524 35/36: Uniform font-lock updates/don't break prettify (bug#25245), Tassilo Horn, 2016/12/22
- [elpa] externals/auctex 3677ddc 28/36: Add new style/dcolumn.el, Tassilo Horn, 2016/12/22
- [elpa] externals/auctex 2e7ca50 36/36: Merge branch 'master' into externals/auctex,
Tassilo Horn <=