Correcting priority issues in mactex.lisp



Dear all,

I want to fix issues in mactex.lisp regarding how to put parenthes
when tex() function is used to generate latex commands. These
issues also occur in imaxima since it solely depends on tex()
function.

I would like to hear any opinions from you for this before commit.

1) h*cos(a) is displayed as "cos a h"
This is confusing and I want to change the priority of trig functions
to 119 (rather than today's 130) so that the output looks like
"(cos a) h". 119 is chosen to be one less than 120, which is the  
priority
of mtimes.

2) sum(a[n]+b[n],n,1,k) is displayed like

                                k
                               ====
                               \
(%o6)                            >    b  + a
                               /       n    n
                               ====
                               n = 1

in latex. I think b[n]+a[n] should be parenthed in sum. The same thing
happens in product(), too. I want to modify tex-sum() so that the  
priority of
mplus and %sum are considered.

The actual diff attached below is very small. If no arguments, I would  
like
to commit within a day or two.

Yasuaki Honda

RCS file: /cvsroot/maxima/maxima/src/mactex.lisp,v
retrieving revision 1.67
diff -r1.67 mactex.lisp
660,661c660,664
< 	;; gotta be one of those above
< 	(s1 (tex (cadr x) nil nil 'mparen rop))	;; summand
---
 > 	;; gotta be one of those above
 > 	;; 4th arg of tex is changed from mparen to (caar x)
 > 	;; to reflect the operator preceedance correctly.
 > 	;; This change improves the how to put paren.
 > 	(s1 (tex (cadr x) nil nil (caar x) rop))	;; summand
672c675,678
< 	(s1 (tex (cadr x) nil nil 'mparen rop))	;; summand
---
 > 	;; 4th arg of tex is changed from mparen to (caar x)
 > 	;; to reflect the operator preceedance correctly.
 > 	;; This change improves the how to put paren.
 > 	(s1 (tex (cadr x) nil nil (caar x) rop))	;; summand
814c820,821
<     (setf (get a 'tex-rbp) 130)))
---
 >     (setf (get a 'tex-rbp) 119)))
 > ;;    (setf (get a 'tex-rbp) 130)))


Yasuaki Honda
Chiba, Japan

http://members3.jcom.home.ne.jp/imaxima/

mailto:imaxima at mac.com