diff options
| author | Jay Belanger | 2007-12-02 03:14:55 +0000 |
|---|---|---|
| committer | Jay Belanger | 2007-12-02 03:14:55 +0000 |
| commit | 018f0ad2e4ab02f4bad3c5e5d9e3ac88238dbbfc (patch) | |
| tree | 45f5651e6b0aa0195d17a1e296b2808e7cd720bf | |
| parent | 2807e8e4888b9d5208a5139b3a50b8cc72afe854 (diff) | |
| download | emacs-018f0ad2e4ab02f4bad3c5e5d9e3ac88238dbbfc.tar.gz emacs-018f0ad2e4ab02f4bad3c5e5d9e3ac88238dbbfc.zip | |
(math-compose-var): New function.
(math-compose-expr): Allow more special functions to be used.
Change test for formatting fractions. Use variables and property
names to help with language specific formatting.
(math-compose-tex-matrix, math-compose-eqn-matrix)
(math-eqn-special-functions): Move to calc-lang.el
(math-compose-rows): Use property names to help with language specific
formatting.
| -rw-r--r-- | lisp/calc/calccomp.el | 288 |
1 files changed, 67 insertions, 221 deletions
diff --git a/lisp/calc/calccomp.el b/lisp/calc/calccomp.el index 6bd663cef5b..0d25a52c8f6 100644 --- a/lisp/calc/calccomp.el +++ b/lisp/calc/calccomp.el | |||
| @@ -32,16 +32,6 @@ | |||
| 32 | (require 'calc-ext) | 32 | (require 'calc-ext) |
| 33 | (require 'calc-macs) | 33 | (require 'calc-macs) |
| 34 | 34 | ||
| 35 | (defconst math-eqn-special-funcs | ||
| 36 | '( calcFunc-log | ||
| 37 | calcFunc-ln calcFunc-exp | ||
| 38 | calcFunc-sin calcFunc-cos calcFunc-tan | ||
| 39 | calcFunc-sec calcFunc-csc calcFunc-cot | ||
| 40 | calcFunc-sinh calcFunc-cosh calcFunc-tanh | ||
| 41 | calcFunc-sech calcFunc-csch calcFunc-coth | ||
| 42 | calcFunc-arcsin calcFunc-arccos calcFunc-arctan | ||
| 43 | calcFunc-arcsinh calcFunc-arccosh calcFunc-arctanh)) | ||
| 44 | |||
| 45 | ;;; A "composition" has one of the following forms: | 35 | ;;; A "composition" has one of the following forms: |
| 46 | ;;; | 36 | ;;; |
| 47 | ;;; "string" A literal string | 37 | ;;; "string" A literal string |
| @@ -80,6 +70,20 @@ | |||
| 80 | (defvar math-comp-right-bracket) | 70 | (defvar math-comp-right-bracket) |
| 81 | (defvar math-comp-comma) | 71 | (defvar math-comp-comma) |
| 82 | 72 | ||
| 73 | (defun math-compose-var (a v) | ||
| 74 | (if (and math-compose-hash-args | ||
| 75 | (let ((p calc-arg-values)) | ||
| 76 | (setq v 1) | ||
| 77 | (while (and p (not (equal (car p) a))) | ||
| 78 | (setq p (and (eq math-compose-hash-args t) (cdr p)) | ||
| 79 | v (1+ v))) | ||
| 80 | p)) | ||
| 81 | (if (eq math-compose-hash-args 1) | ||
| 82 | "#" | ||
| 83 | (format "#%d" v)) | ||
| 84 | (if (memq calc-language calc-lang-allow-underscores) | ||
| 85 | (math-to-underscores (symbol-name (nth 1 a))) | ||
| 86 | (symbol-name (nth 1 a))))) | ||
| 83 | 87 | ||
| 84 | (defun math-compose-expr (a prec) | 88 | (defun math-compose-expr (a prec) |
| 85 | (let ((math-compose-level (1+ math-compose-level)) | 89 | (let ((math-compose-level (1+ math-compose-level)) |
| @@ -94,17 +98,24 @@ | |||
| 94 | (list 'tag a (math-compose-expr a prec)))) | 98 | (list 'tag a (math-compose-expr a prec)))) |
| 95 | ((and (not (consp a)) (not (integerp a))) | 99 | ((and (not (consp a)) (not (integerp a))) |
| 96 | (concat "'" (prin1-to-string a))) | 100 | (concat "'" (prin1-to-string a))) |
| 97 | ((setq spfn (assq (car-safe a) math-expr-special-function-mapping)) | 101 | ((setq spfn (assq (car-safe a) |
| 102 | (get calc-language 'math-special-function-table))) | ||
| 98 | (setq spfn (cdr spfn)) | 103 | (setq spfn (cdr spfn)) |
| 99 | (funcall (car spfn) a spfn)) | 104 | (if (consp spfn) |
| 105 | (funcall (car spfn) a spfn) | ||
| 106 | (funcall spfn a))) | ||
| 100 | ((math-scalarp a) | 107 | ((math-scalarp a) |
| 101 | (if (or (eq (car-safe a) 'frac) | 108 | (if (or (eq (car-safe a) 'frac) |
| 102 | (and (nth 1 calc-frac-format) (Math-integerp a))) | 109 | (and (nth 1 calc-frac-format) (Math-integerp a))) |
| 103 | (if (memq calc-language '(tex latex eqn math maple c fortran pascal)) | 110 | (if (and |
| 111 | calc-language | ||
| 112 | (not (memq calc-language | ||
| 113 | '(flat big unform)))) | ||
| 104 | (let ((aa (math-adjust-fraction a)) | 114 | (let ((aa (math-adjust-fraction a)) |
| 105 | (calc-frac-format nil)) | 115 | (calc-frac-format nil)) |
| 106 | (math-compose-expr (list '/ | 116 | (math-compose-expr (list '/ |
| 107 | (if (memq calc-language '(c fortran)) | 117 | (if (memq calc-language |
| 118 | calc-lang-slash-idiv) | ||
| 108 | (math-float (nth 1 aa)) | 119 | (math-float (nth 1 aa)) |
| 109 | (nth 1 aa)) | 120 | (nth 1 aa)) |
| 110 | (nth 2 aa)) prec)) | 121 | (nth 2 aa)) prec)) |
| @@ -268,59 +279,25 @@ | |||
| 268 | (cdr a) | 279 | (cdr a) |
| 269 | (if full rows 3) t))))) | 280 | (if full rows 3) t))))) |
| 270 | (if (or calc-full-vectors (< (length a) 7)) | 281 | (if (or calc-full-vectors (< (length a) 7)) |
| 271 | (if (and (eq calc-language 'tex) | 282 | (if (and |
| 272 | (math-matrixp a)) | 283 | (setq spfn (get calc-language 'math-matrix-formatter)) |
| 273 | (if (and (integerp calc-language-option) | 284 | (math-matrixp a)) |
| 274 | (or (= calc-language-option 0) | 285 | (funcall spfn a) |
| 275 | (> calc-language-option 1) | 286 | (list 'horiz |
| 276 | (< calc-language-option -1))) | 287 | math-comp-left-bracket |
| 277 | (append '(vleft 0 "\\matrix{") | 288 | (math-compose-vector (cdr a) |
| 278 | (math-compose-tex-matrix (cdr a)) | 289 | (concat math-comp-comma " ") |
| 279 | '("}")) | 290 | math-comp-vector-prec) |
| 280 | (append '(horiz "\\matrix{ ") | 291 | math-comp-right-bracket)) |
| 281 | (math-compose-tex-matrix (cdr a)) | ||
| 282 | '(" }"))) | ||
| 283 | (if (and (eq calc-language 'latex) | ||
| 284 | (math-matrixp a)) | ||
| 285 | (if (and (integerp calc-language-option) | ||
| 286 | (or (= calc-language-option 0) | ||
| 287 | (> calc-language-option 1) | ||
| 288 | (< calc-language-option -1))) | ||
| 289 | (append '(vleft 0 "\\begin{pmatrix}") | ||
| 290 | (math-compose-tex-matrix (cdr a) t) | ||
| 291 | '("\\end{pmatrix}")) | ||
| 292 | (append '(horiz "\\begin{pmatrix} ") | ||
| 293 | (math-compose-tex-matrix (cdr a) t) | ||
| 294 | '(" \\end{pmatrix}"))) | ||
| 295 | (if (and (eq calc-language 'eqn) | ||
| 296 | (math-matrixp a)) | ||
| 297 | (append '(horiz "matrix { ") | ||
| 298 | (math-compose-eqn-matrix | ||
| 299 | (cdr (math-transpose a))) | ||
| 300 | '("}")) | ||
| 301 | (if (and (eq calc-language 'maple) | ||
| 302 | (math-matrixp a)) | ||
| 303 | (list 'horiz | ||
| 304 | "matrix(" | ||
| 305 | math-comp-left-bracket | ||
| 306 | (math-compose-vector (cdr a) | ||
| 307 | (concat math-comp-comma " ") | ||
| 308 | math-comp-vector-prec) | ||
| 309 | math-comp-right-bracket | ||
| 310 | ")") | ||
| 311 | (list 'horiz | ||
| 312 | math-comp-left-bracket | ||
| 313 | (math-compose-vector (cdr a) | ||
| 314 | (concat math-comp-comma " ") | ||
| 315 | math-comp-vector-prec) | ||
| 316 | math-comp-right-bracket))))) | ||
| 317 | (list 'horiz | 292 | (list 'horiz |
| 318 | math-comp-left-bracket | 293 | math-comp-left-bracket |
| 319 | (math-compose-vector (list (nth 1 a) (nth 2 a) (nth 3 a)) | 294 | (math-compose-vector (list (nth 1 a) (nth 2 a) (nth 3 a)) |
| 320 | (concat math-comp-comma " ") | 295 | (concat math-comp-comma " ") |
| 321 | math-comp-vector-prec) | 296 | math-comp-vector-prec) |
| 322 | math-comp-comma (if (memq calc-language '(tex latex)) | 297 | math-comp-comma |
| 323 | " \\ldots" " ...") | 298 | (if (setq spfn (get calc-language 'math-dots)) |
| 299 | (concat " " spfn) | ||
| 300 | " ...") | ||
| 324 | math-comp-comma " " | 301 | math-comp-comma " " |
| 325 | (list 'break math-compose-level) | 302 | (list 'break math-compose-level) |
| 326 | (math-compose-expr (nth (1- (length a)) a) | 303 | (math-compose-expr (nth (1- (length a)) a) |
| @@ -354,62 +331,23 @@ | |||
| 354 | (let ((v (rassq (nth 2 a) math-expr-variable-mapping))) | 331 | (let ((v (rassq (nth 2 a) math-expr-variable-mapping))) |
| 355 | (if v | 332 | (if v |
| 356 | (symbol-name (car v)) | 333 | (symbol-name (car v)) |
| 357 | (if (and (memq calc-language '(tex latex)) | 334 | (if (setq spfn (get calc-language 'math-var-formatter)) |
| 358 | calc-language-option | 335 | (funcall spfn a v prec) |
| 359 | (not (= calc-language-option 0)) | 336 | (math-compose-var a v))))) |
| 360 | (string-match "\\`[a-zA-Z][a-zA-Z0-9]+\\'" | ||
| 361 | (symbol-name (nth 1 a)))) | ||
| 362 | (if (eq calc-language 'latex) | ||
| 363 | (format "\\text{%s}" (symbol-name (nth 1 a))) | ||
| 364 | (format "\\hbox{%s}" (symbol-name (nth 1 a)))) | ||
| 365 | (if (and math-compose-hash-args | ||
| 366 | (let ((p calc-arg-values)) | ||
| 367 | (setq v 1) | ||
| 368 | (while (and p (not (equal (car p) a))) | ||
| 369 | (setq p (and (eq math-compose-hash-args t) (cdr p)) | ||
| 370 | v (1+ v))) | ||
| 371 | p)) | ||
| 372 | (if (eq math-compose-hash-args 1) | ||
| 373 | "#" | ||
| 374 | (format "#%d" v)) | ||
| 375 | (if (memq calc-language '(c fortran pascal maple)) | ||
| 376 | (math-to-underscores (symbol-name (nth 1 a))) | ||
| 377 | (if (and (eq calc-language 'eqn) | ||
| 378 | (string-match ".'\\'" (symbol-name (nth 2 a)))) | ||
| 379 | (math-compose-expr | ||
| 380 | (list 'calcFunc-Prime | ||
| 381 | (list | ||
| 382 | 'var | ||
| 383 | (intern (substring (symbol-name (nth 1 a)) 0 -1)) | ||
| 384 | (intern (substring (symbol-name (nth 2 a)) 0 -1)))) | ||
| 385 | prec) | ||
| 386 | (symbol-name (nth 1 a))))))))) | ||
| 387 | ((eq (car a) 'intv) | 337 | ((eq (car a) 'intv) |
| 388 | (list 'horiz | 338 | (list 'horiz |
| 389 | (if (eq calc-language 'maple) "" | 339 | (if (memq (nth 1 a) '(0 1)) "(" "[") |
| 390 | (if (memq (nth 1 a) '(0 1)) "(" "[")) | ||
| 391 | (math-compose-expr (nth 2 a) 0) | 340 | (math-compose-expr (nth 2 a) 0) |
| 392 | (if (memq calc-language '(tex latex)) " \\ldots " | 341 | " .. " |
| 393 | (if (eq calc-language 'eqn) " ... " " .. ")) | ||
| 394 | (math-compose-expr (nth 3 a) 0) | 342 | (math-compose-expr (nth 3 a) 0) |
| 395 | (if (eq calc-language 'maple) "" | 343 | (if (memq (nth 1 a) '(0 2)) ")" "]"))) |
| 396 | (if (memq (nth 1 a) '(0 2)) ")" "]")))) | ||
| 397 | ((eq (car a) 'date) | 344 | ((eq (car a) 'date) |
| 398 | (if (eq (car calc-date-format) 'X) | 345 | (if (eq (car calc-date-format) 'X) |
| 399 | (math-format-date a) | 346 | (math-format-date a) |
| 400 | (concat "<" (math-format-date a) ">"))) | 347 | (concat "<" (math-format-date a) ">"))) |
| 401 | ((and (eq (car a) 'calcFunc-subscr) (cdr (cdr a)) | 348 | ((and (eq (car a) 'calcFunc-subscr) |
| 402 | (memq calc-language '(c pascal fortran maple))) | 349 | (setq spfn (get calc-language 'math-compose-subscr))) |
| 403 | (let ((args (cdr (cdr a)))) | 350 | (funcall spfn a)) |
| 404 | (while (and (memq calc-language '(pascal fortran)) | ||
| 405 | (eq (car-safe (nth 1 a)) 'calcFunc-subscr)) | ||
| 406 | (setq args (append (cdr (cdr (nth 1 a))) args) | ||
| 407 | a (nth 1 a))) | ||
| 408 | (list 'horiz | ||
| 409 | (math-compose-expr (nth 1 a) 1000) | ||
| 410 | (if (eq calc-language 'fortran) "(" "[") | ||
| 411 | (math-compose-vector args ", " 0) | ||
| 412 | (if (eq calc-language 'fortran) ")" "]")))) | ||
| 413 | ((and (eq (car a) 'calcFunc-subscr) (= (length a) 3) | 351 | ((and (eq (car a) 'calcFunc-subscr) (= (length a) 3) |
| 414 | (eq calc-language 'big)) | 352 | (eq calc-language 'big)) |
| 415 | (let* ((a1 (math-compose-expr (nth 1 a) 1000)) | 353 | (let* ((a1 (math-compose-expr (nth 1 a) 1000)) |
| @@ -426,25 +364,6 @@ | |||
| 426 | ", " | 364 | ", " |
| 427 | a2)) | 365 | a2)) |
| 428 | (list 'subscr a1 a2)))) | 366 | (list 'subscr a1 a2)))) |
| 429 | ((and (eq (car a) 'calcFunc-subscr) (= (length a) 3) | ||
| 430 | (eq calc-language 'math)) | ||
| 431 | (list 'horiz | ||
| 432 | (math-compose-expr (nth 1 a) 1000) | ||
| 433 | "[[" | ||
| 434 | (math-compose-expr (nth 2 a) 0) | ||
| 435 | "]]")) | ||
| 436 | ((and (eq (car a) 'calcFunc-sqrt) | ||
| 437 | (memq calc-language '(tex latex))) | ||
| 438 | (list 'horiz | ||
| 439 | "\\sqrt{" | ||
| 440 | (math-compose-expr (nth 1 a) 0) | ||
| 441 | "}")) | ||
| 442 | ((and nil (eq (car a) 'calcFunc-sqrt) | ||
| 443 | (eq calc-language 'eqn)) | ||
| 444 | (list 'horiz | ||
| 445 | "sqrt {" | ||
| 446 | (math-compose-expr (nth 1 a) -1) | ||
| 447 | "}")) | ||
| 448 | ((and (eq (car a) '^) | 367 | ((and (eq (car a) '^) |
| 449 | (eq calc-language 'big)) | 368 | (eq calc-language 'big)) |
| 450 | (list 'supscr | 369 | (list 'supscr |
| @@ -469,14 +388,6 @@ | |||
| 469 | (list 'vcent | 388 | (list 'vcent |
| 470 | (math-comp-height a1) | 389 | (math-comp-height a1) |
| 471 | a1 '(rule ?-) a2))) | 390 | a1 '(rule ?-) a2))) |
| 472 | ((and (memq (car a) '(calcFunc-sum calcFunc-prod)) | ||
| 473 | (memq calc-language '(tex latex)) | ||
| 474 | (= (length a) 5)) | ||
| 475 | (list 'horiz (if (eq (car a) 'calcFunc-sum) "\\sum" "\\prod") | ||
| 476 | "_{" (math-compose-expr (nth 2 a) 0) | ||
| 477 | "=" (math-compose-expr (nth 3 a) 0) | ||
| 478 | "}^{" (math-compose-expr (nth 4 a) 0) | ||
| 479 | "}{" (math-compose-expr (nth 1 a) 0) "}")) | ||
| 480 | ((and (eq (car a) 'calcFunc-lambda) | 391 | ((and (eq (car a) 'calcFunc-lambda) |
| 481 | (> (length a) 2) | 392 | (> (length a) 2) |
| 482 | (memq calc-language '(nil flat big))) | 393 | (memq calc-language '(nil flat big))) |
| @@ -525,11 +436,9 @@ | |||
| 525 | (integerp (nth 2 a))) | 436 | (integerp (nth 2 a))) |
| 526 | (let ((c (math-compose-expr (nth 1 a) -1))) | 437 | (let ((c (math-compose-expr (nth 1 a) -1))) |
| 527 | (if (> prec (nth 2 a)) | 438 | (if (> prec (nth 2 a)) |
| 528 | (if (memq calc-language '(tex latex)) | 439 | (if (setq spfn (get calc-language 'math-big-parens)) |
| 529 | (list 'horiz "\\left( " c " \\right)") | 440 | (list 'horiz (car spfn) c (cdr spfn)) |
| 530 | (if (eq calc-language 'eqn) | 441 | (list 'horiz "(" c ")")) |
| 531 | (list 'horiz "{left ( " c " right )}") | ||
| 532 | (list 'horiz "(" c ")"))) | ||
| 533 | c))) | 442 | c))) |
| 534 | ((and (eq (car a) 'calcFunc-choriz) | 443 | ((and (eq (car a) 'calcFunc-choriz) |
| 535 | (not (eq calc-language 'unform)) | 444 | (not (eq calc-language 'unform)) |
| @@ -663,13 +572,13 @@ | |||
| 663 | (make-list (nth 1 a) c)))))) | 572 | (make-list (nth 1 a) c)))))) |
| 664 | ((and (eq (car a) 'calcFunc-evalto) | 573 | ((and (eq (car a) 'calcFunc-evalto) |
| 665 | (setq calc-any-evaltos t) | 574 | (setq calc-any-evaltos t) |
| 666 | (memq calc-language '(tex latex eqn)) | 575 | (setq spfn (get calc-language 'math-evalto)) |
| 667 | (= math-compose-level (if math-comp-tagged 2 1)) | 576 | (= math-compose-level (if math-comp-tagged 2 1)) |
| 668 | (= (length a) 3)) | 577 | (= (length a) 3)) |
| 669 | (list 'horiz | 578 | (list 'horiz |
| 670 | (if (memq calc-language '(tex latex)) "\\evalto " "evalto ") | 579 | (car spfn) |
| 671 | (math-compose-expr (nth 1 a) 0) | 580 | (math-compose-expr (nth 1 a) 0) |
| 672 | (if (memq calc-language '(tex latex)) " \\to " " -> ") | 581 | (cdr spfn) |
| 673 | (math-compose-expr (nth 2 a) 0))) | 582 | (math-compose-expr (nth 2 a) 0))) |
| 674 | (t | 583 | (t |
| 675 | (let ((op (and (not (eq calc-language 'unform)) | 584 | (let ((op (and (not (eq calc-language 'unform)) |
| @@ -895,56 +804,14 @@ | |||
| 895 | (symbol-name func)) | 804 | (symbol-name func)) |
| 896 | (math-match-substring (symbol-name func) 1) | 805 | (math-match-substring (symbol-name func) 1) |
| 897 | (symbol-name func)))) | 806 | (symbol-name func)))) |
| 898 | (if (memq calc-language '(c fortran pascal maple)) | 807 | (if (memq calc-language calc-lang-allow-underscores) |
| 899 | (setq func (math-to-underscores func))) | 808 | (setq func (math-to-underscores func))) |
| 900 | (if (and (memq calc-language '(tex latex)) | 809 | (if (setq spfn (get calc-language 'math-func-formatter)) |
| 901 | calc-language-option | 810 | (funcall spfn func a) |
| 902 | (not (= calc-language-option 0)) | 811 | |
| 903 | (string-match "\\`[a-zA-Z][a-zA-Z0-9]+\\'" func)) | 812 | (list 'horiz func calc-function-open |
| 904 | (if (< (prefix-numeric-value calc-language-option) 0) | 813 | (math-compose-vector (cdr a) ", " 0) |
| 905 | (setq func (format "\\%s" func)) | 814 | calc-function-close)))))))))) |
| 906 | (setq func (if (eq calc-language 'latex) | ||
| 907 | (format "\\text{%s}" func) | ||
| 908 | (format "\\hbox{%s}" func))))) | ||
| 909 | (if (and (eq calc-language 'eqn) | ||
| 910 | (string-match "[^']'+\\'" func)) | ||
| 911 | (let ((n (- (length func) (match-beginning 0) 1))) | ||
| 912 | (setq func (substring func 0 (- n))) | ||
| 913 | (while (>= (setq n (1- n)) 0) | ||
| 914 | (setq func (concat func " prime"))))) | ||
| 915 | (cond ((and (memq calc-language '(tex latex)) | ||
| 916 | (or (> (length a) 2) | ||
| 917 | (not (math-tex-expr-is-flat (nth 1 a))))) | ||
| 918 | (setq left "\\left( " | ||
| 919 | right " \\right)")) | ||
| 920 | ((and (eq calc-language 'eqn) | ||
| 921 | (or (> (length a) 2) | ||
| 922 | (not (math-tex-expr-is-flat (nth 1 a))))) | ||
| 923 | (setq left "{left ( " | ||
| 924 | right " right )}")) | ||
| 925 | ((and (or (and (memq calc-language '(tex latex)) | ||
| 926 | (eq (aref func 0) ?\\)) | ||
| 927 | (and (eq calc-language 'eqn) | ||
| 928 | (memq (car a) math-eqn-special-funcs))) | ||
| 929 | (not (or | ||
| 930 | (string-match "\\hbox{" func) | ||
| 931 | (string-match "\\text{" func))) | ||
| 932 | (= (length a) 2) | ||
| 933 | (or (Math-realp (nth 1 a)) | ||
| 934 | (memq (car (nth 1 a)) '(var *)))) | ||
| 935 | (setq left (if (eq calc-language 'eqn) "~{" "{") | ||
| 936 | right "}")) | ||
| 937 | ((eq calc-language 'eqn) | ||
| 938 | (setq left " ( " | ||
| 939 | right " )")) | ||
| 940 | (t (setq left calc-function-open | ||
| 941 | right calc-function-close))) | ||
| 942 | (list 'horiz func left | ||
| 943 | (math-compose-vector (cdr a) | ||
| 944 | (if (eq calc-language 'eqn) | ||
| 945 | " , " ", ") | ||
| 946 | 0) | ||
| 947 | right))))))))) | ||
| 948 | 815 | ||
| 949 | 816 | ||
| 950 | (defun math-prod-first-term (x) | 817 | (defun math-prod-first-term (x) |
| @@ -1003,8 +870,12 @@ | |||
| 1003 | (if (<= count 0) | 870 | (if (<= count 0) |
| 1004 | (if (< count 0) | 871 | (if (< count 0) |
| 1005 | (math-compose-rows (cdr a) -1 nil) | 872 | (math-compose-rows (cdr a) -1 nil) |
| 1006 | (cons (concat (if (memq calc-language '(tex latex)) " \\ldots" " ...") | 873 | (cons (concat |
| 1007 | math-comp-comma) | 874 | (let ((mdots (get calc-language 'math-dots))) |
| 875 | (if mdots | ||
| 876 | (concat " " mdots) | ||
| 877 | " ...")) | ||
| 878 | math-comp-comma) | ||
| 1008 | (math-compose-rows (cdr a) -1 nil))) | 879 | (math-compose-rows (cdr a) -1 nil))) |
| 1009 | (cons (list 'horiz | 880 | (cons (list 'horiz |
| 1010 | (if first (concat math-comp-left-bracket " ") " ") | 881 | (if first (concat math-comp-left-bracket " ") " ") |
| @@ -1016,31 +887,6 @@ | |||
| 1016 | (math-compose-expr (car a) math-comp-vector-prec) | 887 | (math-compose-expr (car a) math-comp-vector-prec) |
| 1017 | (concat " " math-comp-right-bracket))))) | 888 | (concat " " math-comp-right-bracket))))) |
| 1018 | 889 | ||
| 1019 | (defun math-compose-tex-matrix (a &optional ltx) | ||
| 1020 | (if (cdr a) | ||
| 1021 | (cons (append (math-compose-vector (cdr (car a)) " & " 0) | ||
| 1022 | (if ltx '(" \\\\ ") '(" \\cr "))) | ||
| 1023 | (math-compose-tex-matrix (cdr a) ltx)) | ||
| 1024 | (list (math-compose-vector (cdr (car a)) " & " 0)))) | ||
| 1025 | |||
| 1026 | (defun math-compose-eqn-matrix (a) | ||
| 1027 | (if a | ||
| 1028 | (cons | ||
| 1029 | (cond ((eq calc-matrix-just 'right) "rcol ") | ||
| 1030 | ((eq calc-matrix-just 'center) "ccol ") | ||
| 1031 | (t "lcol ")) | ||
| 1032 | (cons | ||
| 1033 | (list 'break math-compose-level) | ||
| 1034 | (cons | ||
| 1035 | "{ " | ||
| 1036 | (cons | ||
| 1037 | (let ((math-compose-level (1+ math-compose-level))) | ||
| 1038 | (math-compose-vector (cdr (car a)) " above " 1000)) | ||
| 1039 | (cons | ||
| 1040 | " } " | ||
| 1041 | (math-compose-eqn-matrix (cdr a))))))) | ||
| 1042 | nil)) | ||
| 1043 | |||
| 1044 | (defun math-vector-is-string (a) | 890 | (defun math-vector-is-string (a) |
| 1045 | (while (and (setq a (cdr a)) | 891 | (while (and (setq a (cdr a)) |
| 1046 | (or (and (natnump (car a)) | 892 | (or (and (natnump (car a)) |