diff options
Diffstat (limited to 'lisp/calc')
-rw-r--r-- | lisp/calc/calc-lang.el | 19 | ||||
-rw-r--r-- | lisp/calc/calc-prog.el | 4 | ||||
-rw-r--r-- | lisp/calc/calccomp.el | 20 |
3 files changed, 31 insertions, 12 deletions
diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el index 63d24bb76d5..2e5737349bc 100644 --- a/lisp/calc/calc-lang.el +++ b/lisp/calc/calc-lang.el @@ -291,11 +291,20 @@ (calc-wrapper (and n (setq n (prefix-numeric-value n))) (calc-set-language 'tex n) - (message (if (and n (/= n 0)) - (if (> n 0) - "TeX language mode with \\hbox{func}(\\hbox{var})" - "TeX language mode with \\func{\\hbox{var}}") - "TeX language mode")))) + (cond ((not n) + (message "TeX language mode")) + ((= n 0) + (message "TeX language mode with multiline matrices")) + ((= n 1) + (message "TeX language mode with \\hbox{func}(\\hbox{var})")) + ((> n 1) + (message + "TeX language mode with \\hbox{func}(\\hbox{var}) and multiline matrices")) + ((= n -1) + (message "TeX language mode with \\func(\\hbox{var})")) + ((< n -1) + (message + "TeX language mode with \\func(\\hbox{var}) and multiline matrices"))))) (defun calc-latex-language (n) (interactive "P") diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el index d5d9123d04d..640fa5b665c 100644 --- a/lisp/calc/calc-prog.el +++ b/lisp/calc/calc-prog.el @@ -520,7 +520,7 @@ (cond ((stringp (car p)) (let ((s (car p))) (if (and (string-match "\\`\\\\dots\\>" s) - (not (eq calc-lang '(tex latex)))) + (not (memq calc-lang '(tex latex)))) (setq s (concat ".." (substring s 5)))) (if (or (and (string-match "[a-zA-Z0-9\"{}]\\|\\`:=\\'\\|\\`#\\|\\`%%" s) @@ -587,7 +587,7 @@ "(") ((and (equal name "}") (memq calc-lang '(tex latex eqn))) ")") - ((and (equal name "&") (eq calc-lang '(tex latex))) + ((and (equal name "&") (memq calc-lang '(tex latex))) ",") ((equal name "#") (search-backward "#") diff --git a/lisp/calc/calccomp.el b/lisp/calc/calccomp.el index dc46159b09b..eff7df2373d 100644 --- a/lisp/calc/calccomp.el +++ b/lisp/calc/calccomp.el @@ -266,12 +266,22 @@ (if (or calc-full-vectors (< (length a) 7)) (if (and (eq calc-language 'tex) (math-matrixp a)) - (append '(horiz "\\matrix{ ") - (math-compose-tex-matrix (cdr a)) - '(" }")) + (if (and (integerp calc-language-option) + (or (= calc-language-option 0) + (> calc-language-option 1) + (< calc-language-option -1))) + (append '(vleft 0 "\\matrix{") + (math-compose-tex-matrix (cdr a)) + '("}")) + (append '(horiz "\\matrix{ ") + (math-compose-tex-matrix (cdr a)) + '(" }"))) (if (and (eq calc-language 'latex) (math-matrixp a)) - (if (memq calc-language-option '(-2 0 2)) + (if (and (integerp calc-language-option) + (or (= calc-language-option 0) + (> calc-language-option 1) + (< calc-language-option -1))) (append '(vleft 0 "\\begin{pmatrix}") (math-compose-tex-matrix (cdr a)) '("\\end{pmatrix}")) @@ -898,7 +908,7 @@ (setq func (substring func 0 (- n))) (while (>= (setq n (1- n)) 0) (setq func (concat func " prime"))))) - (cond ((and (eq calc-language '(tex latex)) + (cond ((and (memq calc-language '(tex latex)) (or (> (length a) 2) (not (math-tex-expr-is-flat (nth 1 a))))) (setq left "\\left( " |