displa for sub and superscripted functions



I'm trying to get my jacobi polynomials to display correctly.  My (bogus) 
code is

(setf (get '$jacobi_p 'dimension) 'dimension-jacobi-p)

(defun dimension-jacobi-p (form result)
  (let ((form1 `((mexpt) (($P simp array) ,(nth 1 form))
                 (,(nth 2 form) ,(nth 3 form)))))
    (dimension-function `((,form1 simp) ,(nth 4 form)) result)))


It "works" for 

(C5) jacobi_p(n,a,b,x);
                                           (a, b)
(D5)                                      P      (x)
                                           n


but fails for 
(C6) jacobi_p(n,1/2,b,x);
                                      ("//", SIMP)(b)
(D6)                                 P               (x)
                                      n

A general dimension function for subscripted and superscripted functions
would be ideal.  It would need to optionally surround super or subscripts 
with parens.  I understand mactex a bit better and was able to do this
for mactex.


Barton