"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "style/breqn.el" between
auctex-12.2.tar.gz and auctex-12.3.tar.gz

About: AUCTEX is an extensible package for writing and formatting TeX files in GNU Emacs and XEmacs.

breqn.el  (auctex-12.2):breqn.el  (auctex-12.3)
;;; breqn.el --- AUCTeX style for `breqn.sty' (v0.98e) ;;; breqn.el --- AUCTeX style for `breqn.sty' (v0.98j)
;; Copyright (C) 2017--2019 Free Software Foundation, Inc. ;; Copyright (C) 2017--2020 Free Software Foundation, Inc.
;; Author: Arash Esbati <arash@gnu.org> ;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org ;; Maintainer: auctex-devel@gnu.org
;; Created: 2017-01-06 ;; Created: 2017-01-06
;; Keywords: tex ;; Keywords: tex
;; This file is part of AUCTeX. ;; This file is part of AUCTeX.
;; AUCTeX is free software; you can redistribute it and/or modify it ;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by ;; under the terms of the GNU General Public License as published by
skipping to change at line 29 skipping to change at line 29
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details. ;; General Public License for more details.
;; You should have received a copy of the GNU General Public License ;; 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 ;; along with AUCTeX; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA. ;; 02110-1301, USA.
;;; Commentary: ;;; Commentary:
;; This file adds support for `breqn.sty' (v0.98e) from 2017/01/27. ;; This file adds support for `breqn.sty' (v0.98j) from 2020/04/19.
;; `breqn.sty' is part of TeXLive. ;; `breqn.sty' is part of TeXLive.
;; In breqn documentation, there is the following statement: ;; In breqn documentation, there is the following statement:
;; ;;
;; 9 Various environment options ;; 9 Various environment options
;; ;;
;; Use of the normal \label command instead of the label option ;; Use of the normal \label command instead of the label option
;; works, I think, most of the time (untested). ;; works, I think, most of the time (untested).
;; ;;
;; To be on the safe side, a label should be written in the optional ;; To be on the safe side, a label should be written in the optional
skipping to change at line 53 skipping to change at line 53
;; ... ;; ...
;; \end{dmath} ;; \end{dmath}
;; ;;
;; This style achieves this requirement by using the function ;; This style achieves this requirement by using the function
;; `LaTeX-env-label-as-keyval'. ;; `LaTeX-env-label-as-keyval'.
;;; Code: ;;; Code:
(require 'latex) (require 'latex)
;; Silence the compiler:
(declare-function LaTeX-color-definecolor-list "color" ())
(declare-function LaTeX-xcolor-definecolor-list "xcolor" ())
(defvar LaTeX-breqn-key-val-options (defvar LaTeX-breqn-key-val-options
'(("style" ("\\tiny" "\\scriptsize" "\\footnotesize" "\\small" '(("style" ("\\tiny" "\\scriptsize" "\\footnotesize" "\\small"
"\\normalsize" "\\large" "\\Large" "\\LARGE" "\\normalsize" "\\large" "\\Large" "\\LARGE"
"\\huge" "\\Huge")) "\\huge" "\\Huge"))
("number") ("number")
("indentstep") ("indentstep")
("compact") ("compact")
("spread") ("spread")
("frame") ("frame")
("framesep") ("framesep")
("background")
("color")
("breakdepth")) ("breakdepth"))
"Key=value options for breqn environments. "Key=value options for breqn environments.
The keys \"label\" and \"labelprefix\" are omitted.") The keys \"label\" and \"labelprefix\" are omitted.")
(defvar LaTeX-breqn-key-val-options-local nil
"Buffer-local key=value options for breqn environments.")
(make-variable-buffer-local 'LaTeX-breqn-key-val-options-local)
(defvar LaTeX-breqn-key-val-label-regexp (defvar LaTeX-breqn-key-val-label-regexp
`(,(concat `(,(concat
"\\\\begin{" "\\\\begin{"
(regexp-opt '("dmath" "dseries" "dgroup" "darray")) (regexp-opt '("dmath" "dseries" "dgroup" "darray"))
"}" "}"
(LaTeX-extract-key-value-label)) (LaTeX-extract-key-value-label))
1 LaTeX-auto-label) 1 LaTeX-auto-label)
"Matches the label inside an optional argument after \\begin{<breqn-env's>}.") "Matches the label inside an optional argument after \\begin{<breqn-env's>}.")
(defun LaTeX-breqn-env (env) (defun LaTeX-breqn-env (env)
"Insert ENV from breqn package incl. optional key=val argument. "Insert ENV from breqn package incl. optional key=val argument.
Keys offered for key=val query depend on ENV. \"label\" and Keys offered for key=val query depend on ENV. \"label\" and
\"labelprefix\" are omitted." \"labelprefix\" are omitted."
(let ((keyvals (let ((keyvals
(TeX-read-key-val t (TeX-read-key-val t
(cond ((or (string= env "dgroup") (cond ((or (string= env "dgroup")
(string= env "dgroup*")) (string= env "dgroup*"))
(append '(("noalign") ("brace")) (append '(("noalign") ("brace"))
LaTeX-breqn-key-val-options-local)) LaTeX-breqn-key-val-options))
((or (string= env "darray") ((or (string= env "darray")
(string= env "darray*")) (string= env "darray*"))
(append '(("noalign") ("brace") ("cols" ("{}")) ) (append '(("noalign") ("brace") ("cols" ("{}")) )
LaTeX-breqn-key-val-options-local)) LaTeX-breqn-key-val-options))
(t LaTeX-breqn-key-val-options-local))))) (t LaTeX-breqn-key-val-options)))))
(LaTeX-insert-environment env (when (and keyvals (LaTeX-insert-environment env (when (and keyvals
(not (string= keyvals ""))) (not (string= keyvals "")))
(concat LaTeX-optop keyvals LaTeX-optcl))) (concat LaTeX-optop keyvals LaTeX-optcl)))
(LaTeX-env-label-as-keyval nil nil keyvals env))) (LaTeX-env-label-as-keyval nil nil keyvals env)))
(defun LaTeX-breqn-update-color-keys ()
"Update color relevant keys from `LaTeX-breqn-key-val-options-local'."
(when (or (member "xcolor" (TeX-style-list))
(member "color" (TeX-style-list)))
(let* ((colorcmd (if (member "xcolor" (TeX-style-list))
#'LaTeX-xcolor-definecolor-list
#'LaTeX-color-definecolor-list))
(keys '("color" "background"))
(tmp (copy-alist LaTeX-breqn-key-val-options-local)))
(dolist (x keys)
(setq tmp (assq-delete-all (car (assoc x tmp)) tmp))
(push (list x (mapcar #'car (funcall colorcmd))) tmp))
(setq LaTeX-breqn-key-val-options-local
(copy-alist tmp)))))
(add-hook 'TeX-auto-cleanup-hook #'LaTeX-breqn-update-color-keys t)
(add-hook 'TeX-update-style-hook #'TeX-auto-parse t) (add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
(TeX-add-style-hook (TeX-add-style-hook
"breqn" "breqn"
(lambda () (lambda ()
;; Local version of key-val options
(setq LaTeX-breqn-key-val-options-local
(copy-alist LaTeX-breqn-key-val-options))
;; Add breqn to parser: ;; Add breqn to parser:
(TeX-auto-add-regexp LaTeX-breqn-key-val-label-regexp) (TeX-auto-add-regexp LaTeX-breqn-key-val-label-regexp)
;; Tell AUCTeX that we want to prefix the labels with `LaTeX-equation-label': ;; Tell AUCTeX that we want to prefix the labels with `LaTeX-equation-label':
(let ((envs '("dmath" "dseries" "dgroup" "darray"))) (let ((envs '("dmath" "dseries" "dgroup" "darray")))
(dolist (env envs) (dolist (env envs)
(add-to-list 'LaTeX-label-alist `(,env . LaTeX-equation-label) t))) (add-to-list 'LaTeX-label-alist `(,env . LaTeX-equation-label) t)))
;; For RefTeX, we must distinguish between equation and eqnarray-like: ;; For RefTeX, we must distinguish between equation and eqnarray-like:
;; breqn env == equivalent -- starred ;; breqn env == equivalent -- starred
skipping to change at line 165 skipping to change at line 135
'("dseries*" LaTeX-breqn-env) '("dseries*" LaTeX-breqn-env)
'("dgroup" LaTeX-breqn-env) '("dgroup" LaTeX-breqn-env)
'("dgroup*" LaTeX-breqn-env) '("dgroup*" LaTeX-breqn-env)
'("darray" LaTeX-breqn-env) '("darray" LaTeX-breqn-env)
'("darray*" LaTeX-breqn-env) '("darray*" LaTeX-breqn-env)
'("dsuspend")) '("dsuspend"))
(TeX-add-symbols (TeX-add-symbols
'("condition" [ "Punctuation mark (default ,)" ] t) '("condition" [ "Punctuation mark (default ,)" ] t)
'("condition*" [ "Punctuation mark (default ,)" ] t) '("condition*" [ "Punctuation mark (default ,)" ] t)
'("hiderel" t)) '("hiderel" t)))
;; Fontification
(when (and (featurep 'font-latex)
(eq TeX-install-font-lock 'font-latex-setup)
(boundp 'font-latex-math-environments))
(make-local-variable 'font-latex-math-environments)
(let ((envs '(;; Do not insert the starred versions here;
;; function `font-latex-match-math-envII' takes
;; care of it
"dmath" "dseries" "dgroup" "darray")))
(dolist (env envs)
(add-to-list 'font-latex-math-environments env t)))))
LaTeX-dialect) LaTeX-dialect)
(defvar LaTeX-breqn-package-options nil (defvar LaTeX-breqn-package-options nil
"Package options for the breqn package.") "Package options for the breqn package.")
;;; breqn.el ends here ;;; breqn.el ends here
 End of changes. 11 change blocks. 
49 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)