[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/auctex 9ede1fa203 03/77: Improve insertion of & in matr
From: |
Tassilo Horn |
Subject: |
[elpa] externals/auctex 9ede1fa203 03/77: Improve insertion of & in matrix-like environments |
Date: |
Fri, 26 Aug 2022 16:06:31 -0400 (EDT) |
branch: externals/auctex
commit 9ede1fa203a898886b7d3f90fe2e56394b710c45
Author: Arash Esbati <arash@gnu.org>
Commit: Arash Esbati <arash@gnu.org>
Improve insertion of & in matrix-like environments
* style/amsmath.el (LaTeX-item-equation-matrix): New function.
("amsmath"): Use the function for matrix-like environments in
`LaTeX-item-list'.
---
style/amsmath.el | 42 ++++++++++++++++++++++++++++++++++--------
1 file changed, 34 insertions(+), 8 deletions(-)
diff --git a/style/amsmath.el b/style/amsmath.el
index 5e7812e7b7..f72f8be8fd 100644
--- a/style/amsmath.el
+++ b/style/amsmath.el
@@ -57,7 +57,8 @@
"align*" "gather*" "flalign*" "multline*" "equation*"
"split"
"cases"
- "matrix" "smallmatrix" "pmatrix" "bmatrix" "Bmatrix" "vmatrix" "Vmatrix"
+ "matrix" "smallmatrix"
+ "bmatrix" "Bmatrix" "pmatrix" "vmatrix" "Vmatrix"
"subequations"
'("subarray" "Alignment"))
@@ -126,13 +127,13 @@
("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)
- ("smallmatrix" . LaTeX-item-equation)
+ ("matrix" . LaTeX-item-equation-matrix)
+ ("pmatrix" . LaTeX-item-equation-matrix)
+ ("bmatrix" . LaTeX-item-equation-matrix)
+ ("Bmatrix" . LaTeX-item-equation-matrix)
+ ("vmatrix" . LaTeX-item-equation-matrix)
+ ("Vmatrix" . LaTeX-item-equation-matrix)
+ ("smallmatrix" . LaTeX-item-equation-matrix)
("subarray" . LaTeX-item-equation)
("cases" . LaTeX-item-equation))
LaTeX-item-list))
@@ -225,6 +226,31 @@ If SUPPRESS is non-nil, do not insert line break macro."
(LaTeX-newline)
(indent-according-to-mode))))
+(defun LaTeX-item-equation-matrix ()
+ "Insert contents to terminate a line in matrix environments.
+Put line break macro on the last line and insert suitable number
+of ampersands if possible. This number is extracted from the
+first line of the environment."
+ (end-of-line 0)
+ (just-one-space)
+ (TeX-insert-macro "\\")
+ (forward-line 1)
+ (indent-according-to-mode)
+ (let* ((p (point))
+ (s (save-excursion
+ (LaTeX-find-matching-begin)
+ (point)))
+ (e (save-excursion
+ (goto-char s)
+ (search-forward "\\\\" p t)))
+ n)
+ (save-excursion
+ (goto-char s)
+ (setq n (how-many "[^\\]&" s e)))
+ (when (and n (> n 0))
+ (save-excursion
+ (insert (make-string n ?&))))))
+
(defun LaTeX-item-equation-alignat (&optional suppress)
"Insert contents to terminate a line in multi-line equations environment.
Put line break macro on the last line. Next, if the current
- [elpa] externals/auctex updated (b91f15b3a3 -> 0029ca410f), Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 71a288a2fe 08/77: Add styles for iftex bundle, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 9ede1fa203 03/77: Improve insertion of & in matrix-like environments,
Tassilo Horn <=
- [elpa] externals/auctex 7846cb9f94 04/77: Mention 'M-RET' alias which runs `LaTeX-insert-item', Tassilo Horn, 2022/08/26
- [elpa] externals/auctex ba6e5ef69c 07/77: ; Fix warnings reported by 'make dynvars-check', Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 619f329595 10/77: * tex-ispell.el (TeX-ispell-skip-cmds-list): Support shortvrb.sty., Tassilo Horn, 2022/08/26
- [elpa] externals/auctex fabe675915 12/77: Adapt regression test for the previous commit, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex ecf8b28cda 14/77: Add new style/multibib.el, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex e9af1e68fb 15/77: Fix preview-latex to work with desktop.el again, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 37e5a450a3 20/77: Complete LaTeX lengths and counters, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 3f0d5a7411 23/77: Add support for \linespread macro, Tassilo Horn, 2022/08/26
- [elpa] externals/auctex d47a6e8716 29/77: Support complex \input path (bug#55511), Tassilo Horn, 2022/08/26
- [elpa] externals/auctex 9378b66daa 61/77: Add TODO, Tassilo Horn, 2022/08/26