Subject: Re: [ maxima-Bugs-534874 ] Fixes for mactex.lisp
From: Jesper Harder
Date: Wed, 17 Jul 2002 18:53:35 +0200
Raymond Toy writes:
>
> Also, shouldn't lsum do some instead of just printing lsum?
You're right. I forgot that it isn't defined in the Maxima version.
This is how it's done in the version from Texmacs:
--- /home/harder/maxima/src/mactex.lisp Wed Jul 17 15:50:58 2002
+++ mactex.lisp Wed Jul 17 17:56:31 2002
@@ -545,10 +545,21 @@
;; TeX is lots more flexible .. but
(defprop %sum tex-sum tex)
+(defprop %lsum tex-lsum tex)
(defprop %product tex-sum tex)
;; easily extended to union, intersect, otherops
+(defun tex-lsum(x l r)
+ (let ((op (cond ((eq (caar x) '%lsum) "\\sum_{")
+ ;; extend here
+ ))
+ ;; gotta be one of those above
+ (s1 (tex (cadr x) nil nil 'mparen rop));; summand
+ (index ;; "index = lowerlimit"
+ (tex `((min simp) , (caddr x), (cadddr x)) nil nil 'mparen 'mparen)))
+ (append l `( ,op ,@index "}}{" ,@s1 "}") r)))
+
(defun tex-sum(x l r)
(let ((op (cond ((eq (caar x) '%sum) "\\sum_{")
((eq (caar x) '%product) "\\prod_{")
@@ -653,6 +664,11 @@
(defprop mminus 100. tex-rbp)
(defprop mminus 100. tex-lbp)
+(defprop min tex-infix tex)
+(defprop min ("\\in{") texsym)
+(defprop min 80. tex-lbp)
+(defprop min 80. tex-rbp)
+
(defprop mequal tex-infix tex)
(defprop mequal (=) texsym)
(defprop mequal 80. tex-lbp)
Examples:
tex('lsum(x^i,i,[1,2,7]));
==> $$\sum_{i\in{\left[ 1,2,7 \right] }}{x^{i}}$$
tex(lsum(j^2,j,rootsof(x^3-1)));
==> $$\sum_{j\in{ROOTSOF\left(x^3-1\right)}}{j^2}$$
> I have no problems if you send patches to the mailing list
> instead of here. (I'd actually prefer that because I hate
> this web thing too.)
Done :-)