aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/calc/calc-aent.el
diff options
context:
space:
mode:
authorJay Belanger <[email protected]>2005-01-31 09:05:27 +0000
committerJay Belanger <[email protected]>2005-01-31 09:05:27 +0000
commit8d5cd17257e20550ff1d77a8fc682d3359d8f0d2 (patch)
tree0decf384f2867fcb59c85821d2f7088e29f3a417 /lisp/calc/calc-aent.el
parent1be70c6150ce8a16ad0526d6948bac42aeb99308 (diff)
(math-read-token): Read LaTeX matrices.
Diffstat (limited to 'lisp/calc/calc-aent.el')
-rw-r--r--lisp/calc/calc-aent.el18
1 files changed, 16 insertions, 2 deletions
diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el
index bf4f5c382e..49aae82a95 100644
--- a/lisp/calc/calc-aent.el
+++ b/lisp/calc/calc-aent.el
@@ -763,8 +763,22 @@ in Calc algebraic input.")
((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 "[")