Mercurial > emacs
comparison lisp/calc/calccomp.el @ 91204:53108e6cea98
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-294
author | Miles Bader <miles@gnu.org> |
---|---|
date | Thu, 06 Dec 2007 09:51:45 +0000 |
parents | f55f9811f5d7 7c7322501bc1 |
children | 56a72e2bd635 |
comparison
equal
deleted
inserted
replaced
91203:db40129142b2 | 91204:53108e6cea98 |
---|---|
29 | 29 |
30 ;; This file is autoloaded from calc-ext.el. | 30 ;; This file is autoloaded from calc-ext.el. |
31 | 31 |
32 (require 'calc-ext) | 32 (require 'calc-ext) |
33 (require 'calc-macs) | 33 (require 'calc-macs) |
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 | 34 |
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 |
48 ;;; | 38 ;;; |
78 ;; called by math-compose-expr. | 68 ;; called by math-compose-expr. |
79 (defvar math-comp-left-bracket) | 69 (defvar math-comp-left-bracket) |
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) | |
74 (let (v) | |
75 (if (and math-compose-hash-args | |
76 (let ((p calc-arg-values)) | |
77 (setq v 1) | |
78 (while (and p (not (equal (car p) a))) | |
79 (setq p (and (eq math-compose-hash-args t) (cdr p)) | |
80 v (1+ v))) | |
81 p)) | |
82 (if (eq math-compose-hash-args 1) | |
83 "#" | |
84 (format "#%d" v)) | |
85 (if (memq calc-language calc-lang-allow-underscores) | |
86 (math-to-underscores (symbol-name (nth 1 a))) | |
87 (symbol-name (nth 1 a)))))) | |
83 | 88 |
84 (defun math-compose-expr (a prec) | 89 (defun math-compose-expr (a prec) |
85 (let ((math-compose-level (1+ math-compose-level)) | 90 (let ((math-compose-level (1+ math-compose-level)) |
86 (math-expr-opers (math-expr-ops)) | 91 (math-expr-opers (math-expr-ops)) |
87 spfn) | 92 spfn) |
92 (let ((math-comp-selected nil)) | 97 (let ((math-comp-selected nil)) |
93 (and math-comp-tagged (setq math-comp-tagged a)) | 98 (and math-comp-tagged (setq math-comp-tagged a)) |
94 (list 'tag a (math-compose-expr a prec)))) | 99 (list 'tag a (math-compose-expr a prec)))) |
95 ((and (not (consp a)) (not (integerp a))) | 100 ((and (not (consp a)) (not (integerp a))) |
96 (concat "'" (prin1-to-string a))) | 101 (concat "'" (prin1-to-string a))) |
97 ((setq spfn (assq (car-safe a) math-expr-special-function-mapping)) | 102 ((setq spfn (assq (car-safe a) |
103 (get calc-language 'math-special-function-table))) | |
98 (setq spfn (cdr spfn)) | 104 (setq spfn (cdr spfn)) |
99 (funcall (car spfn) a spfn)) | 105 (if (consp spfn) |
106 (funcall (car spfn) a spfn) | |
107 (funcall spfn a))) | |
100 ((math-scalarp a) | 108 ((math-scalarp a) |
101 (if (or (eq (car-safe a) 'frac) | 109 (if (or (eq (car-safe a) 'frac) |
102 (and (nth 1 calc-frac-format) (Math-integerp a))) | 110 (and (nth 1 calc-frac-format) (Math-integerp a))) |
103 (if (memq calc-language '(tex latex eqn math maple c fortran pascal)) | 111 (if (and |
112 calc-language | |
113 (not (memq calc-language | |
114 '(flat big unform)))) | |
104 (let ((aa (math-adjust-fraction a)) | 115 (let ((aa (math-adjust-fraction a)) |
105 (calc-frac-format nil)) | 116 (calc-frac-format nil)) |
106 (math-compose-expr (list '/ | 117 (math-compose-expr (list '/ |
107 (if (memq calc-language '(c fortran)) | 118 (if (memq calc-language |
119 calc-lang-slash-idiv) | |
108 (math-float (nth 1 aa)) | 120 (math-float (nth 1 aa)) |
109 (nth 1 aa)) | 121 (nth 1 aa)) |
110 (nth 2 aa)) prec)) | 122 (nth 2 aa)) prec)) |
111 (if (and (eq calc-language 'big) | 123 (if (and (eq calc-language 'big) |
112 (= (length (car calc-frac-format)) 1)) | 124 (= (length (car calc-frac-format)) 1)) |
266 (cons 'vleft (cons base | 278 (cons 'vleft (cons base |
267 (math-compose-rows | 279 (math-compose-rows |
268 (cdr a) | 280 (cdr a) |
269 (if full rows 3) t))))) | 281 (if full rows 3) t))))) |
270 (if (or calc-full-vectors (< (length a) 7)) | 282 (if (or calc-full-vectors (< (length a) 7)) |
271 (if (and (eq calc-language 'tex) | 283 (if (and |
272 (math-matrixp a)) | 284 (setq spfn (get calc-language 'math-matrix-formatter)) |
273 (if (and (integerp calc-language-option) | 285 (math-matrixp a)) |
274 (or (= calc-language-option 0) | 286 (funcall spfn a) |
275 (> calc-language-option 1) | 287 (list 'horiz |
276 (< calc-language-option -1))) | 288 math-comp-left-bracket |
277 (append '(vleft 0 "\\matrix{") | 289 (math-compose-vector (cdr a) |
278 (math-compose-tex-matrix (cdr a)) | 290 (concat math-comp-comma " ") |
279 '("}")) | 291 math-comp-vector-prec) |
280 (append '(horiz "\\matrix{ ") | 292 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 | 293 (list 'horiz |
318 math-comp-left-bracket | 294 math-comp-left-bracket |
319 (math-compose-vector (list (nth 1 a) (nth 2 a) (nth 3 a)) | 295 (math-compose-vector (list (nth 1 a) (nth 2 a) (nth 3 a)) |
320 (concat math-comp-comma " ") | 296 (concat math-comp-comma " ") |
321 math-comp-vector-prec) | 297 math-comp-vector-prec) |
322 math-comp-comma (if (memq calc-language '(tex latex)) | 298 math-comp-comma |
323 " \\ldots" " ...") | 299 (if (setq spfn (get calc-language 'math-dots)) |
300 (concat " " spfn) | |
301 " ...") | |
324 math-comp-comma " " | 302 math-comp-comma " " |
325 (list 'break math-compose-level) | 303 (list 'break math-compose-level) |
326 (math-compose-expr (nth (1- (length a)) a) | 304 (math-compose-expr (nth (1- (length a)) a) |
327 (if (equal math-comp-comma "") 1000 0)) | 305 (if (equal math-comp-comma "") 1000 0)) |
328 math-comp-right-bracket))))))) | 306 math-comp-right-bracket))))))) |
352 (t "( ...")))) | 330 (t "( ...")))) |
353 ((eq (car a) 'var) | 331 ((eq (car a) 'var) |
354 (let ((v (rassq (nth 2 a) math-expr-variable-mapping))) | 332 (let ((v (rassq (nth 2 a) math-expr-variable-mapping))) |
355 (if v | 333 (if v |
356 (symbol-name (car v)) | 334 (symbol-name (car v)) |
357 (if (and (memq calc-language '(tex latex)) | 335 (if (setq spfn (get calc-language 'math-var-formatter)) |
358 calc-language-option | 336 (funcall spfn a prec) |
359 (not (= calc-language-option 0)) | 337 (math-compose-var a))))) |
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) | 338 ((eq (car a) 'intv) |
388 (list 'horiz | 339 (list 'horiz |
389 (if (eq calc-language 'maple) "" | 340 (if (memq (nth 1 a) '(0 1)) "(" "[") |
390 (if (memq (nth 1 a) '(0 1)) "(" "[")) | |
391 (math-compose-expr (nth 2 a) 0) | 341 (math-compose-expr (nth 2 a) 0) |
392 (if (memq calc-language '(tex latex)) " \\ldots " | 342 " .. " |
393 (if (eq calc-language 'eqn) " ... " " .. ")) | |
394 (math-compose-expr (nth 3 a) 0) | 343 (math-compose-expr (nth 3 a) 0) |
395 (if (eq calc-language 'maple) "" | 344 (if (memq (nth 1 a) '(0 2)) ")" "]"))) |
396 (if (memq (nth 1 a) '(0 2)) ")" "]")))) | |
397 ((eq (car a) 'date) | 345 ((eq (car a) 'date) |
398 (if (eq (car calc-date-format) 'X) | 346 (if (eq (car calc-date-format) 'X) |
399 (math-format-date a) | 347 (math-format-date a) |
400 (concat "<" (math-format-date a) ">"))) | 348 (concat "<" (math-format-date a) ">"))) |
401 ((and (eq (car a) 'calcFunc-subscr) (cdr (cdr a)) | 349 ((and (eq (car a) 'calcFunc-subscr) |
402 (memq calc-language '(c pascal fortran maple))) | 350 (setq spfn (get calc-language 'math-compose-subscr))) |
403 (let ((args (cdr (cdr a)))) | 351 (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) | 352 ((and (eq (car a) 'calcFunc-subscr) (= (length a) 3) |
414 (eq calc-language 'big)) | 353 (eq calc-language 'big)) |
415 (let* ((a1 (math-compose-expr (nth 1 a) 1000)) | 354 (let* ((a1 (math-compose-expr (nth 1 a) 1000)) |
416 (calc-language 'flat) | 355 (calc-language 'flat) |
417 (a2 (math-compose-expr (nth 2 a) 0))) | 356 (a2 (math-compose-expr (nth 2 a) 0))) |
424 (list 'horiz | 363 (list 'horiz |
425 (nth 2 a1) | 364 (nth 2 a1) |
426 ", " | 365 ", " |
427 a2)) | 366 a2)) |
428 (list 'subscr a1 a2)))) | 367 (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) '^) | 368 ((and (eq (car a) '^) |
449 (eq calc-language 'big)) | 369 (eq calc-language 'big)) |
450 (list 'supscr | 370 (list 'supscr |
451 (if (or (math-looks-negp (nth 1 a)) | 371 (if (or (math-looks-negp (nth 1 a)) |
452 (memq (car-safe (nth 1 a)) '(^ / frac calcFunc-sqrt)) | 372 (memq (car-safe (nth 1 a)) '(^ / frac calcFunc-sqrt)) |
467 'flat 'big))) | 387 'flat 'big))) |
468 (math-compose-expr (nth 2 a) 0)))) | 388 (math-compose-expr (nth 2 a) 0)))) |
469 (list 'vcent | 389 (list 'vcent |
470 (math-comp-height a1) | 390 (math-comp-height a1) |
471 a1 '(rule ?-) a2))) | 391 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) | 392 ((and (eq (car a) 'calcFunc-lambda) |
481 (> (length a) 2) | 393 (> (length a) 2) |
482 (memq calc-language '(nil flat big))) | 394 (memq calc-language '(nil flat big))) |
483 (let ((p (cdr a)) | 395 (let ((p (cdr a)) |
484 (ap calc-arg-values) | 396 (ap calc-arg-values) |
523 (not (eq calc-language 'unform)) | 435 (not (eq calc-language 'unform)) |
524 (= (length a) 3) | 436 (= (length a) 3) |
525 (integerp (nth 2 a))) | 437 (integerp (nth 2 a))) |
526 (let ((c (math-compose-expr (nth 1 a) -1))) | 438 (let ((c (math-compose-expr (nth 1 a) -1))) |
527 (if (> prec (nth 2 a)) | 439 (if (> prec (nth 2 a)) |
528 (if (memq calc-language '(tex latex)) | 440 (if (setq spfn (get calc-language 'math-big-parens)) |
529 (list 'horiz "\\left( " c " \\right)") | 441 (list 'horiz (car spfn) c (cdr spfn)) |
530 (if (eq calc-language 'eqn) | 442 (list 'horiz "(" c ")")) |
531 (list 'horiz "{left ( " c " right )}") | |
532 (list 'horiz "(" c ")"))) | |
533 c))) | 443 c))) |
534 ((and (eq (car a) 'calcFunc-choriz) | 444 ((and (eq (car a) 'calcFunc-choriz) |
535 (not (eq calc-language 'unform)) | 445 (not (eq calc-language 'unform)) |
536 (memq (length a) '(2 3 4)) | 446 (memq (length a) '(2 3 4)) |
537 (math-vectorp (nth 1 a)) | 447 (math-vectorp (nth 1 a)) |
661 (+ (* (1- (nth 1 a)) (+ ca cd)) (1- ca)) | 571 (+ (* (1- (nth 1 a)) (+ ca cd)) (1- ca)) |
662 (/ (1- (* (nth 1 a) (+ ca cd))) 2))) | 572 (/ (1- (* (nth 1 a) (+ ca cd))) 2))) |
663 (make-list (nth 1 a) c)))))) | 573 (make-list (nth 1 a) c)))))) |
664 ((and (eq (car a) 'calcFunc-evalto) | 574 ((and (eq (car a) 'calcFunc-evalto) |
665 (setq calc-any-evaltos t) | 575 (setq calc-any-evaltos t) |
666 (memq calc-language '(tex latex eqn)) | 576 (setq spfn (get calc-language 'math-evalto)) |
667 (= math-compose-level (if math-comp-tagged 2 1)) | 577 (= math-compose-level (if math-comp-tagged 2 1)) |
668 (= (length a) 3)) | 578 (= (length a) 3)) |
669 (list 'horiz | 579 (list 'horiz |
670 (if (memq calc-language '(tex latex)) "\\evalto " "evalto ") | 580 (car spfn) |
671 (math-compose-expr (nth 1 a) 0) | 581 (math-compose-expr (nth 1 a) 0) |
672 (if (memq calc-language '(tex latex)) " \\to " " -> ") | 582 (cdr spfn) |
673 (math-compose-expr (nth 2 a) 0))) | 583 (math-compose-expr (nth 2 a) 0))) |
674 (t | 584 (t |
675 (let ((op (and (not (eq calc-language 'unform)) | 585 (let ((op (and (not (eq calc-language 'unform)) |
676 (if (and (eq (car a) 'calcFunc-if) (= (length a) 4)) | 586 (if (and (eq (car a) 'calcFunc-if) (= (length a) 4)) |
677 (assoc "?" math-expr-opers) | 587 (assoc "?" math-expr-opers) |
893 (if (string-match | 803 (if (string-match |
894 "\\`calcFunc-\\([a-zA-Z0-9']+\\)\\'" | 804 "\\`calcFunc-\\([a-zA-Z0-9']+\\)\\'" |
895 (symbol-name func)) | 805 (symbol-name func)) |
896 (math-match-substring (symbol-name func) 1) | 806 (math-match-substring (symbol-name func) 1) |
897 (symbol-name func)))) | 807 (symbol-name func)))) |
898 (if (memq calc-language '(c fortran pascal maple)) | 808 (if (memq calc-language calc-lang-allow-underscores) |
899 (setq func (math-to-underscores func))) | 809 (setq func (math-to-underscores func))) |
900 (if (and (memq calc-language '(tex latex)) | 810 (if (setq spfn (get calc-language 'math-func-formatter)) |
901 calc-language-option | 811 (funcall spfn func a) |
902 (not (= calc-language-option 0)) | 812 |
903 (string-match "\\`[a-zA-Z][a-zA-Z0-9]+\\'" func)) | 813 (list 'horiz func calc-function-open |
904 (if (< (prefix-numeric-value calc-language-option) 0) | 814 (math-compose-vector (cdr a) ", " 0) |
905 (setq func (format "\\%s" func)) | 815 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 | 816 |
949 | 817 |
950 (defun math-prod-first-term (x) | 818 (defun math-prod-first-term (x) |
951 (while (eq (car-safe x) '*) | 819 (while (eq (car-safe x) '*) |
952 (setq x (nth 1 x))) | 820 (setq x (nth 1 x))) |
1001 (defun math-compose-rows (a count first) | 869 (defun math-compose-rows (a count first) |
1002 (if (cdr a) | 870 (if (cdr a) |
1003 (if (<= count 0) | 871 (if (<= count 0) |
1004 (if (< count 0) | 872 (if (< count 0) |
1005 (math-compose-rows (cdr a) -1 nil) | 873 (math-compose-rows (cdr a) -1 nil) |
1006 (cons (concat (if (memq calc-language '(tex latex)) " \\ldots" " ...") | 874 (cons (concat |
1007 math-comp-comma) | 875 (let ((mdots (get calc-language 'math-dots))) |
876 (if mdots | |
877 (concat " " mdots) | |
878 " ...")) | |
879 math-comp-comma) | |
1008 (math-compose-rows (cdr a) -1 nil))) | 880 (math-compose-rows (cdr a) -1 nil))) |
1009 (cons (list 'horiz | 881 (cons (list 'horiz |
1010 (if first (concat math-comp-left-bracket " ") " ") | 882 (if first (concat math-comp-left-bracket " ") " ") |
1011 (math-compose-expr (car a) math-comp-vector-prec) | 883 (math-compose-expr (car a) math-comp-vector-prec) |
1012 math-comp-comma) | 884 math-comp-comma) |
1013 (math-compose-rows (cdr a) (1- count) nil))) | 885 (math-compose-rows (cdr a) (1- count) nil))) |
1014 (list (list 'horiz | 886 (list (list 'horiz |
1015 (if first (concat math-comp-left-bracket " ") " ") | 887 (if first (concat math-comp-left-bracket " ") " ") |
1016 (math-compose-expr (car a) math-comp-vector-prec) | 888 (math-compose-expr (car a) math-comp-vector-prec) |
1017 (concat " " math-comp-right-bracket))))) | 889 (concat " " math-comp-right-bracket))))) |
1018 | |
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 | 890 |
1044 (defun math-vector-is-string (a) | 891 (defun math-vector-is-string (a) |
1045 (while (and (setq a (cdr a)) | 892 (while (and (setq a (cdr a)) |
1046 (or (and (natnump (car a)) | 893 (or (and (natnump (car a)) |
1047 (<= (car a) 255)) | 894 (<= (car a) 255)) |