Bugs in tex-mcond



I wrote:
> If I don't hear any objections, I will soon commit this patch to both
> the trunk and the 5.23 branch.

Oops, I forgot to include the patch :)

    Mark


*** mactex.lisp	22 Nov 2009 04:53:36 -0000	1.71
--- mactex.lisp	10 Jan 2011 21:59:13 -0000
***************
*** 1,3 ****
--- 1,5 ----
+ ;;; -*-  Mode: Lisp; Package: Maxima; Syntax: Common-Lisp; Base: 10 -*- ;;;;
+ 
  (in-package :maxima)
  
  ;; TeX-printing
***************
*** 938,950 ****
  	((= c 0)(odds (cdr n) 1))))
  
  (defun tex-mcond (x l r)
!   (append l
! 	  (tex (cadr x) '("\\mathbf{if}\\;")
! 	       '("\\;\\mathbf{then}\\;") 'mparen 'mparen)
! 	  (if (eql (fifth x) '$false)
! 	      (tex (caddr x) nil r 'mcond rop)
! 	      (append (tex (caddr x) nil nil 'mparen 'mparen)
! 		      (tex (fifth x) '("\\;\\mathbf{else}\\;") r 'mcond rop)))))
  
  (defprop mdo tex-mdo tex)
  (defprop mdoin tex-mdoin tex)
--- 940,958 ----
  	((= c 0)(odds (cdr n) 1))))
  
  (defun tex-mcond (x l r)
!   (labels
!       ((recurse (x l)
! 	  (append (tex (car x) l '("\\;\\mathbf{then}\\;") 'mparen 'mparen)
! 		  (cond ((equal (cdddr x) '(nil))
! 			 (tex (cadr x) nil r 'mcond rop))
! 			((null (cddddr x))
! 			 (append (tex (cadr x) nil nil 'mparen 'mparen)
! 				 (tex (cadddr x) '("\\;\\mathbf{else}\\;") r
! 				      'mcond rop)))
! 			(t (append (tex (cadr x) nil nil 'mparen 'mparen)
! 				   (recurse (cddr x)
! 					    '("\\;\\mathbf{elseif}\\;"))))))))
!   (append l (recurse (cdr x) '("\\mathbf{if}\\;")))))
  
  (defprop mdo tex-mdo tex)
  (defprop mdoin tex-mdoin tex)