changeset 59817:14c6462097a2

(math-read-token): Read LaTeX matrices.
author Jay Belanger <jay.p.belanger@gmail.com>
date Mon, 31 Jan 2005 09:05:27 +0000
parents b1f8d50fb879
children 7129914ec664
files lisp/calc/calc-aent.el
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calc/calc-aent.el	Mon Jan 31 06:39:44 2005 +0000
+++ b/lisp/calc/calc-aent.el	Mon Jan 31 09:05:27 2005 +0000
@@ -763,8 +763,22 @@
 		     ((eq (nth 1 code) 'punc)
 		      (setq math-exp-token 'punc
 			    math-expr-data (nth 2 code)))
-		     ((and (eq (nth 1 code) 'mat)
-			   (string-match " *{" math-exp-str math-exp-pos))
+                     ((and (eq (nth 1 code) 'begenv)
+                           (string-match " *{\\([^}]*\\)}" math-exp-str math-exp-pos))
+                      (setq math-exp-pos (match-end 0)
+                            envname (match-string 1 math-exp-str)
+                            math-exp-token 'punc
+                            math-expr-data "[")
+                      (cond ((or (string= envname "matrix")
+                                 (string= envname "bmatrix")
+                                 (string= envname "pmatrix"))
+                             (if (setq j (string-match (concat "\\\\end{" envname "}")
+                                               math-exp-str math-exp-pos))
+                                 (setq math-exp-str 
+                                       (replace-match "]" t t math-exp-str))
+                               (error "%s" (concat "No closing \\end{" envname "}"))))))
+                      ((and (eq (nth 1 code) 'mat)
+                            (string-match " *{" math-exp-str math-exp-pos))
 		      (setq math-exp-pos (match-end 0)
 			    math-exp-token 'punc
 			    math-expr-data "[")