branch: externals/auctex commit e111d19ada11a74b7a53873b2d8b95556af31ee8 Author: Arash Esbati <ar...@gnu.org> Commit: Arash Esbati <ar...@gnu.org>
Add final adjustments for LaTeX 2019-10-01 * latex.el (LaTeX-env-contents): Adjust function to LaTeX kernel 2019-10-01 release. Remove check for usage within preamble only. Add query for optional argument with completion. (LaTeX-verbatim-environments): (LaTeX-indent-environment-list): Add filecontents(*) environments. * style/amsmath.el ("amsmath"): Add support for \overunderset macro. Delete unnecessary `function' before `lambda'. Re-indent the code. --- latex.el | 36 ++++--- style/amsmath.el | 293 ++++++++++++++++++++++++++++--------------------------- 2 files changed, 170 insertions(+), 159 deletions(-) diff --git a/latex.el b/latex.el index 514ffbb..aaa4a1f 100644 --- a/latex.el +++ b/latex.el @@ -1227,14 +1227,22 @@ Just like array and tabular." (LaTeX-insert-item)) (defun LaTeX-env-contents (environment) - "Insert ENVIRONMENT with filename for contents." - (save-excursion - (when (re-search-backward LaTeX-header-end nil t) - (error "Put %s environment before \\begin{document}" environment))) - (LaTeX-insert-environment environment - (concat TeX-grop - (TeX-read-string "File: ") - TeX-grcl)) + "Insert ENVIRONMENT with optional argument and filename for contents." + (let* ((opt '("overwrite" "force" "nosearch")) + (arg (mapconcat #'identity + (TeX-completing-read-multiple + (TeX-argument-prompt t nil "Options") + (if (string= environment "filecontents*") + opt + (cons "noheader" opt))) + ","))) + (LaTeX-insert-environment environment + (concat + (when (and arg (not (string= arg ""))) + (concat LaTeX-optop arg LaTeX-optcl)) + TeX-grop + (TeX-read-string "File: ") + TeX-grcl))) (delete-horizontal-space)) (defun LaTeX-env-args (environment &rest args) @@ -3023,7 +3031,7 @@ including values of the variable #'TeX--list-of-string-p) (defcustom LaTeX-verbatim-environments - '("verbatim" "verbatim*") + '("verbatim" "verbatim*" "filecontents" "filecontents*") "Verbatim environments. Programs should not use this variable directly but the function @@ -3196,6 +3204,8 @@ consideration just as is in the non-commented source code." (defcustom LaTeX-indent-environment-list '(("verbatim" current-indentation) ("verbatim*" current-indentation) + ("filecontents" current-indentation) + ("filecontents*" current-indentation) ("tabular" LaTeX-indent-tabular) ("tabular*" LaTeX-indent-tabular) ("align" LaTeX-indent-tabular) @@ -3210,15 +3220,15 @@ consideration just as is in the non-commented source code." ("equation*") ("picture") ("tabbing")) - "Alist of environments with special indentation. + "Alist of environments with special indentation. The second element in each entry is the function to calculate the indentation level in columns. Environments present in this list are not filled by filling functions, see `LaTeX-fill-region-as-paragraph'." - :group 'LaTeX-indentation - :type '(repeat (list (string :tag "Environment") - (option function)))) + :group 'LaTeX-indentation + :type '(repeat (list (string :tag "Environment") + (option function)))) (defcustom LaTeX-indent-environment-check t "*If non-nil, check for any special environments." diff --git a/style/amsmath.el b/style/amsmath.el index 4a2a399..65aed4e 100644 --- a/style/amsmath.el +++ b/style/amsmath.el @@ -1,6 +1,6 @@ ;;; amsmath.el --- Style hook for the AMS-LaTeX amsmath package. -;; Copyright (C) 2002, 2005-2007, 2012-2014, 2017-2018 +;; Copyright (C) 2002, 2005-2007, 2012-2014, 2017-2019 ;; Free Software Foundation, Inc. ;; FIXME: What about the copyright for <= 2001? @@ -30,150 +30,151 @@ ;;; Code: -(TeX-add-style-hook "amsmath" - (function - (lambda () - - (LaTeX-add-environments - '("align" LaTeX-env-label) - '("gather" LaTeX-env-label) - '("flalign" LaTeX-env-label) - '("multline" LaTeX-env-label) - '("alignat" LaTeX-amsmath-env-alignat) - '("alignat*" LaTeX-amsmath-env-alignat) - '("xalignat" LaTeX-amsmath-env-alignat) - '("xalignat*" LaTeX-amsmath-env-alignat) - '("xxalignat" LaTeX-amsmath-env-alignat) - '("aligned" ["Vertical position (t or b)"]) - '("gathered" ["Vertical position (t or b)"]) - '("alignedat" LaTeX-amsmath-env-alignedat) - "align*" "gather*" "flalign*" "multline*" "equation*" - "split" - "cases" - "matrix" "smallmatrix" "pmatrix" "bmatrix" "Bmatrix" "vmatrix" "Vmatrix" - "subequations" - '("subarray" "Alignment")) - - (TeX-add-symbols - '("eqref" TeX-arg-ref) - '("numberwithin" TeX-arg-counter "Section level") - '("raisetag" "Dimension") - '("shoveright" t) '("shoveleft" t) - '("intertext" t) - '("hdotsfor" ["Stretch"] "Number of columns to cover") - '("xleftarrow" ["Below"] "Above") - '("xrightarrow" ["Below"] "Above") - '("overset" "Accent symbol" "Symbol") - '("underset" "Accent symbol" "Symbol") - '("dfrac" 2) - '("tfrac" 2) - '("binom" 2) - '("dbinom" 2) - '("tbinom" 2) - '("genfrac" "Left delimiter" "Right delimiter" "Thickness" - "Mathstyle" 2) - '("cfrac" ["position (l or r)"] 2) - '("smash" ["where (t or b)"] t) - '("sideset" "Left" "Right") - '("tag" "(Tag)") - '("tag*" "Tag") - '("displaybreak" ["Weight (0..4)"]) - '("allowdisplaybreaks" ["Weight (1..4)"]) - '("substack" t) - '("leftroot" "Push root index left by") - '("uproot" "Push root index upward by") - '("boxed" t) - '("mspace" t) - '("mod" t) - '("pmod" t) - '("pod" t) - '("overleftrightarrow" t) - '("underleftarrow" t) - '("underrightarrow" t) - '("underleftrightarrow" t) - '("dddot" t) - '("ddddot" t) - "bmod" "notag" - "dots" "dotsb" "dotsc" "dotsi" "dotsm" "dotso" "nobreakdash" - '("lvert" TeX-arg-insert-right-brace-maybe) - '("lVert" TeX-arg-insert-right-brace-maybe) - "rvert" "rVert" - "iint" "iiint" "iiiint" "idotsint") - - (setq LaTeX-item-list - (append '(("split" . LaTeX-item-equation) - ("multline" . LaTeX-item-equation) - ("multline*" . LaTeX-item-equation) - ("gather" . LaTeX-item-equation) - ("gather*" . LaTeX-item-equation) - ("gathered" . LaTeX-item-equation) - ("align" . LaTeX-item-equation) - ("align*" . LaTeX-item-equation) - ("aligned" . LaTeX-item-equation) - ("alignat" . LaTeX-item-equation-alignat) - ("alignat*" . LaTeX-item-equation-alignat) - ("xalignat" . LaTeX-item-equation-alignat) - ("xalignat*" . LaTeX-item-equation-alignat) - ("xxalignat" . LaTeX-item-equation-alignat) - ("alignedat" . LaTeX-item-equation-alignat) - ("flalign" . LaTeX-item-equation) - ("flalign*" . LaTeX-item-equation) - ("matrix" . LaTeX-item-equation) - ("pmatrix" . LaTeX-item-equation) - ("bmatrix" . LaTeX-item-equation) - ("Bmatrix" . LaTeX-item-equation) - ("vmatrix" . LaTeX-item-equation) - ("Vmatrix" . LaTeX-item-equation) - ("subarray" . LaTeX-item-equation) - ("cases" . LaTeX-item-equation)) - LaTeX-item-list)) - - ;; When `LaTeX-amsmath-label' is nil, use value of LaTeX-equation-label: - (unless LaTeX-amsmath-label - (setq LaTeX-amsmath-label LaTeX-equation-label)) - - (setq LaTeX-label-alist - ;; Append amsmath environments to `LaTeX-label-alist', in order not to - ;; override possible custome values. - (append LaTeX-label-alist - '(("align" . LaTeX-amsmath-label) - ("alignat" . LaTeX-amsmath-label) - ("xalignat" . LaTeX-amsmath-label) - ("multline" . LaTeX-amsmath-label) - ("flalign" . LaTeX-amsmath-label) - ("gather" . LaTeX-amsmath-label)))) - - (set (make-local-variable 'TeX-braces-association) - (append '(("\\lvert" . "\\rvert") - ("\\lVert" . "\\rVert")) - TeX-braces-association)) - (set (make-local-variable 'TeX-left-right-braces) - (append '(("\\lvert") ("\\rvert") ("\\lVert") ("\\rVert")) - TeX-left-right-braces)) - - ;; amsmath includes amstext, amsbsy, & amsopn. - ;; So we run their hooks, too. - (TeX-run-style-hooks "amstext" "amsbsy" "amsopn") - - ;; RefTeX support: Tell RefTeX about amsmath environments. - (when (fboundp 'reftex-add-to-label-alist) - (reftex-add-to-label-alist '(AMSTeX))) - - ;; Add \eqref to `reftex-ref-style-alist' and associate it to `e' - (when (and (boundp 'reftex-ref-style-alist) - ;; check if Emacs is already equipped with this - (not (assoc "AMSmath" reftex-ref-style-alist))) - ;; Append it to a local version in order to avoid a clash with - ;; user settings - (add-to-list (make-local-variable 'reftex-ref-style-alist) - '("AMSmath" "amsmath" (("\\eqref" ?e))) - t)) - - ;; Activate `AMSmath' when `LaTeX-reftex-ref-style-auto-activate' - ;; is non-nil - (and LaTeX-reftex-ref-style-auto-activate - (fboundp 'reftex-ref-style-activate) - (reftex-ref-style-activate "AMSmath")))) +(TeX-add-style-hook + "amsmath" + (lambda () + + (LaTeX-add-environments + '("align" LaTeX-env-label) + '("gather" LaTeX-env-label) + '("flalign" LaTeX-env-label) + '("multline" LaTeX-env-label) + '("alignat" LaTeX-amsmath-env-alignat) + '("alignat*" LaTeX-amsmath-env-alignat) + '("xalignat" LaTeX-amsmath-env-alignat) + '("xalignat*" LaTeX-amsmath-env-alignat) + '("xxalignat" LaTeX-amsmath-env-alignat) + '("aligned" ["Vertical position (t or b)"]) + '("gathered" ["Vertical position (t or b)"]) + '("alignedat" LaTeX-amsmath-env-alignedat) + "align*" "gather*" "flalign*" "multline*" "equation*" + "split" + "cases" + "matrix" "smallmatrix" "pmatrix" "bmatrix" "Bmatrix" "vmatrix" "Vmatrix" + "subequations" + '("subarray" "Alignment")) + + (TeX-add-symbols + '("eqref" TeX-arg-ref) + '("numberwithin" TeX-arg-counter "Section level") + '("raisetag" "Dimension") + '("shoveright" t) '("shoveleft" t) + '("intertext" t) + '("hdotsfor" ["Stretch"] "Number of columns to cover") + '("xleftarrow" ["Below"] "Above") + '("xrightarrow" ["Below"] "Above") + '("overset" "Accent symbol" "Symbol") + '("underset" "Accent symbol" "Symbol") + '("overunderset" "Accent symbol" "Symbol below" "Symbol") + '("dfrac" 2) + '("tfrac" 2) + '("binom" 2) + '("dbinom" 2) + '("tbinom" 2) + '("genfrac" "Left delimiter" "Right delimiter" "Thickness" + "Mathstyle" 2) + '("cfrac" ["position (l or r)"] 2) + '("smash" ["where (t or b)"] t) + '("sideset" "Left" "Right") + '("tag" "(Tag)") + '("tag*" "Tag") + '("displaybreak" ["Weight (0..4)"]) + '("allowdisplaybreaks" ["Weight (1..4)"]) + '("substack" t) + '("leftroot" "Push root index left by") + '("uproot" "Push root index upward by") + '("boxed" t) + '("mspace" t) + '("mod" t) + '("pmod" t) + '("pod" t) + '("overleftrightarrow" t) + '("underleftarrow" t) + '("underrightarrow" t) + '("underleftrightarrow" t) + '("dddot" t) + '("ddddot" t) + "bmod" "notag" + "dots" "dotsb" "dotsc" "dotsi" "dotsm" "dotso" "nobreakdash" + '("lvert" TeX-arg-insert-right-brace-maybe) + '("lVert" TeX-arg-insert-right-brace-maybe) + "rvert" "rVert" + "iint" "iiint" "iiiint" "idotsint") + + (setq LaTeX-item-list + (append '(("split" . LaTeX-item-equation) + ("multline" . LaTeX-item-equation) + ("multline*" . LaTeX-item-equation) + ("gather" . LaTeX-item-equation) + ("gather*" . LaTeX-item-equation) + ("gathered" . LaTeX-item-equation) + ("align" . LaTeX-item-equation) + ("align*" . LaTeX-item-equation) + ("aligned" . LaTeX-item-equation) + ("alignat" . LaTeX-item-equation-alignat) + ("alignat*" . LaTeX-item-equation-alignat) + ("xalignat" . LaTeX-item-equation-alignat) + ("xalignat*" . LaTeX-item-equation-alignat) + ("xxalignat" . LaTeX-item-equation-alignat) + ("alignedat" . LaTeX-item-equation-alignat) + ("flalign" . LaTeX-item-equation) + ("flalign*" . LaTeX-item-equation) + ("matrix" . LaTeX-item-equation) + ("pmatrix" . LaTeX-item-equation) + ("bmatrix" . LaTeX-item-equation) + ("Bmatrix" . LaTeX-item-equation) + ("vmatrix" . LaTeX-item-equation) + ("Vmatrix" . LaTeX-item-equation) + ("subarray" . LaTeX-item-equation) + ("cases" . LaTeX-item-equation)) + LaTeX-item-list)) + + ;; When `LaTeX-amsmath-label' is nil, use value of LaTeX-equation-label: + (unless LaTeX-amsmath-label + (setq LaTeX-amsmath-label LaTeX-equation-label)) + + (setq LaTeX-label-alist + ;; Append amsmath environments to `LaTeX-label-alist', in order not to + ;; override possible custome values. + (append LaTeX-label-alist + '(("align" . LaTeX-amsmath-label) + ("alignat" . LaTeX-amsmath-label) + ("xalignat" . LaTeX-amsmath-label) + ("multline" . LaTeX-amsmath-label) + ("flalign" . LaTeX-amsmath-label) + ("gather" . LaTeX-amsmath-label)))) + + (set (make-local-variable 'TeX-braces-association) + (append '(("\\lvert" . "\\rvert") + ("\\lVert" . "\\rVert")) + TeX-braces-association)) + (set (make-local-variable 'TeX-left-right-braces) + (append '(("\\lvert") ("\\rvert") ("\\lVert") ("\\rVert")) + TeX-left-right-braces)) + + ;; amsmath includes amstext, amsbsy, & amsopn. + ;; So we run their hooks, too. + (TeX-run-style-hooks "amstext" "amsbsy" "amsopn") + + ;; RefTeX support: Tell RefTeX about amsmath environments. + (when (fboundp 'reftex-add-to-label-alist) + (reftex-add-to-label-alist '(AMSTeX))) + + ;; Add \eqref to `reftex-ref-style-alist' and associate it to `e' + (when (and (boundp 'reftex-ref-style-alist) + ;; check if Emacs is already equipped with this + (not (assoc "AMSmath" reftex-ref-style-alist))) + ;; Append it to a local version in order to avoid a clash with + ;; user settings + (add-to-list (make-local-variable 'reftex-ref-style-alist) + '("AMSmath" "amsmath" (("\\eqref" ?e))) + t)) + + ;; Activate `AMSmath' when `LaTeX-reftex-ref-style-auto-activate' + ;; is non-nil + (and LaTeX-reftex-ref-style-auto-activate + (fboundp 'reftex-ref-style-activate) + (reftex-ref-style-activate "AMSmath")))) LaTeX-dialect) (defun LaTeX-amsmath-env-alignat (env) @@ -240,6 +241,6 @@ START and END." "alignedleftspaceyes" "alignedleftspaceno" "alignedleftspaceyesifneg") - "Package options for the amsmath package.") + "Package options for the amsmath package.") ;;; amsmath.el ends here.