TeX output under derivabbrev : true



> Thinking about it...

This version here should be more robust.  Please note, however, that
my approach is quite simple-minded (I just adapted a few lines from
mactex.lisp).

If you need more sophisticated things I suggest you take a look at
Barton Willis's pdiff package (in share/contrib), which also contains
examples of getting TeX output in various notations.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(in-package "MAXIMA")

(defun tex-derivative (x l r)
  (tex (if $derivabbrev
	   (tex-dabbrev x)
	   (tex-d x '$|d|)) l r lop rop ))

(defun tex-dabbrev (x)
  ;; Format diff(f,x,1,y,1) so that it looks like
  ;; f
  ;;  x y
  (let*
      ((arg (cadr x)) ;; the function being differentiated
       (difflist (cddr x)) ;; list of derivs e.g. (x 1 y 2)
       (ords (odds difflist 0))	;; e.g. (1 2)
       (vars (odds difflist 1))) ;; e.g. (x y)
    (append
     (if (symbolp arg)
	 `((,arg array))
	 `((mqapply array) ,arg))
     (if (and (= (length vars) 1)
	      (= (car ords) 1))
	 vars
	 `(((mtimes) ,@(mapcan #'(lambda (var ord)
				   (make-list ord :initial-element var))
			       vars ords)))))))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Wolfgang