problem with matrix tex output



Michel Talon <talon at lpthe.jussieu.fr> writes:

> Jacinto M? Jim?nez Mart?nez wrote:
>
>> Hi, I?m newbie in maxima and I don?t know how to change the tex output for
>> a
>> matrix. The tex() command in maxima produces  \pmatrix, but I?d like to
>> change the default option, i.e. , to produce \bmatrix.
>> 
>>  
>> 
>> How can I do it?
>> 
>
> Only by editing the source code mactex.lisp under the src directory
> of maxima. Then you reload mactex.lisp and it should work. The relevant part 
> is:
>
>
> (defun tex-matrix(x l r) ;;matrix looks like ((mmatrix)((mlist) a b) ...)
>   (append l `("\\pmatrix{")
> 	  (mapcan #'(lambda(y)
> 		      (tex-list (cdr y) nil (list "\\cr ") "&"))
> 		  (cdr x))
> 	  '("}") r))
>
> Here you can replace pmatrix by whatever you like.

Here is how I put in the proper latex command:

set_tex_environment(matrix,concat("\\begin{bmatrix}",""),"\\end{bmatrix}~%")$
texmatrix(l) := block([s,i,n,m:l],
  n : length(m),
  s : tex1(rlist(m[1])),
  for i:2 thru n do ( s : concat(s,"\\\\",newline,tex1(rlist(m[i]))) ),
  s : concat(s,newline),
  s)$
texput(matrix,texmatrix)$

Leo