
(/VERSIONCHECK 2) 

(DEFUN |MMLFORM;coerce;OfS;1| (|expr| $)
  (PROG (|s|)
    (RETURN
      (SEQ (LETT |s|
                 (|MMLFORM;postcondition|
                     (|MMLFORM;formatMml|
                         (|MMLFORM;precondition| |expr| $)
                         (QREFELT $ 8) $)
                     $)
                 |MMLFORM;coerce;OfS;1|)
           (EXIT |s|))))) 

(DEFUN |MMLFORM;coerceS;OfS;2| (|expr| $)
  (PROG (|s|)
    (RETURN
      (SEQ (LETT |s|
                 (|MMLFORM;postcondition|
                     (|MMLFORM;formatMml|
                         (|MMLFORM;precondition| |expr| $)
                         (QREFELT $ 8) $)
                     $)
                 |MMLFORM;coerceS;OfS;2|)
           (|sayTeX|
               "<math xmlns=\"http://www.w3.org/1998/Math/MathML\" mathsize=\"big\" display=\"block\">")
           (|MMLFORM;displayElt| |s| $) (|sayTeX| "</math>")
           (EXIT |s|))))) 

(DEFUN |MMLFORM;coerceL;OfS;3| (|expr| $)
  (PROG (|s|)
    (RETURN
      (SEQ (LETT |s|
                 (|MMLFORM;postcondition|
                     (|MMLFORM;formatMml|
                         (|MMLFORM;precondition| |expr| $)
                         (QREFELT $ 8) $)
                     $)
                 |MMLFORM;coerceL;OfS;3|)
           (|sayTeX|
               "<math xmlns=\"http://www.w3.org/1998/Math/MathML\" mathsize=\"big\" display=\"block\">")
           (|sayTeX| |s|) (|sayTeX| "</math>") (EXIT |s|))))) 

(DEFUN |MMLFORM;display;SV;4| (|mathml| $)
  (SEQ (|sayTeX|
           "<math xmlns=\"http://www.w3.org/1998/Math/MathML\" mathsize=\"big\" display=\"block\">")
       (|sayTeX| |mathml|) (|sayTeX| "</math>")
       (EXIT (SPADCALL (QREFELT $ 27))))) 

(DEFUN |MMLFORM;exprex;OfS;5| (|expr| $)
  (PROG (|le| |op| |sop| |args| |nargs| |a| #0=#:G1880 |s1| |s|)
    (RETURN
      (SEQ (LETT |expr| (|MMLFORM;precondition| |expr| $)
                 . #1=(|MMLFORM;exprex;OfS;5|))
           (COND
             ((OR (ATOM |expr|)
                  (EQUAL (|MMLFORM;stringify| |expr| $) "NOTHING"))
              (EXIT (SPADCALL
                        (LIST "{" (|MMLFORM;stringify| |expr| $) "}")
                        (QREFELT $ 30)))))
           (LETT |le| |expr| . #1#)
           (LETT |op| (|SPADfirst| |le|) . #1#)
           (LETT |sop| (SPADCALL |op| (QREFELT $ 31)) . #1#)
           (LETT |args| (CDR |le|) . #1#)
           (LETT |nargs| (LENGTH |args|) . #1#)
           (LETT |s| (SPADCALL (LIST "{" |sop|) (QREFELT $ 30)) . #1#)
           (COND
             ((< 0 |nargs|)
              (SEQ (LETT |a| NIL . #1#) (LETT #0# |args| . #1#) G190
                   (COND
                     ((OR (ATOM #0#)
                          (PROGN (LETT |a| (CAR #0#) . #1#) NIL))
                      (GO G191)))
                   (SEQ (LETT |s1| (SPADCALL |a| (QREFELT $ 31)) . #1#)
                        (EXIT (LETT |s|
                                    (SPADCALL (LIST |s| |s1|)
                                     (QREFELT $ 30)) . #1#)))
                   (LETT #0# (CDR #0#) . #1#) (GO G190) G191
                   (EXIT NIL))))
           (EXIT (LETT |s|
                       (SPADCALL (LIST |s| "}") (QREFELT $ 30)) . #1#)))))) 

(DEFUN |MMLFORM;displayElt| (|mathML| $)
  (PROG (|end| |length| |name| |enE| |enT| |u|)
    (RETURN
      (SEQ (LETT |end| (QCSIZE |mathML|) . #0=(|MMLFORM;displayElt|))
           (LETT |length| 60 . #0#)
           (LETT |name| (|MMLFORM;eltName| 1 |mathML| $) . #0#)
           (LETT |enE|
                 (|MMLFORM;eltLimit| |name| (+ 2 (QCSIZE |name|))
                     |mathML| $) . #0#)
           (COND
             ((< |enE| |length|)
              (SEQ (LETT |u| (SPADCALL 1 |enE| (QREFELT $ 34)) . #0#)
                   (EXIT (|sayTeX|
                             (SPADCALL |mathML| |u| (QREFELT $ 35))))))
             ('T
              (SEQ (LETT |enT|
                         (|MMLFORM;tagEnd| |name| 1 |mathML| $) . #0#)
                   (LETT |u| (SPADCALL 1 |enT| (QREFELT $ 34)) . #0#)
                   (|sayTeX| (SPADCALL |mathML| |u| (QREFELT $ 35)))
                   (LETT |u|
                         (SPADCALL (+ |enT| 1)
                             (- (- |enE| (QCSIZE |name|)) 3)
                             (QREFELT $ 34)) . #0#)
                   (|MMLFORM;displayElt|
                       (SPADCALL |mathML| |u| (QREFELT $ 35)) $)
                   (LETT |u|
                         (SPADCALL (- (- |enE| (QCSIZE |name|)) 2)
                             |enE| (QREFELT $ 34)) . #0#)
                   (EXIT (|sayTeX|
                             (SPADCALL |mathML| |u| (QREFELT $ 35)))))))
           (COND
             ((< |enE| |end|)
              (SEQ (LETT |u|
                         (SPADCALL (+ |enE| 1) |end| (QREFELT $ 34)) . #0#)
                   (EXIT (|MMLFORM;displayElt|
                             (SPADCALL |mathML| |u| (QREFELT $ 35)) $)))))
           (EXIT (SPADCALL (QREFELT $ 27))))))) 

(DEFUN |MMLFORM;eltName| (|pos| |mathML| $)
  (PROG (|i| |u| |name|)
    (RETURN
      (SEQ (LETT |i| (+ |pos| 1) . #0=(|MMLFORM;eltName|))
           (SEQ G190
                (COND
                  ((NULL (SPADCALL
                             (SPADCALL |mathML| |i| (QREFELT $ 37))
                             (|spadConstant| $ 39) (QREFELT $ 41)))
                   (GO G191)))
                (SEQ (EXIT (LETT |i| (+ |i| 1) . #0#))) NIL (GO G190)
                G191 (EXIT NIL))
           (LETT |u|
                 (SPADCALL (+ |pos| 1) (- |i| 1) (QREFELT $ 34)) . #0#)
           (EXIT (LETT |name|
                       (SPADCALL |mathML| |u| (QREFELT $ 35)) . #0#)))))) 

(DEFUN |MMLFORM;eltLimit| (|name| |pos| |mathML| $)
  (PROG (|startS| |endS| |startI| |endI| |level| |pI|)
    (RETURN
      (SEQ (LETT |pI| |pos| . #0=(|MMLFORM;eltLimit|))
           (LETT |startS|
                 (SPADCALL (LIST "<" |name|) (QREFELT $ 30)) . #0#)
           (LETT |endS|
                 (SPADCALL (LIST "</" |name| ">") (QREFELT $ 30)) . #0#)
           (LETT |level| 1 . #0#)
           (SEQ G190 (COND ((NULL (< 0 |level|)) (GO G191)))
                (SEQ (LETT |startI|
                           (SPADCALL |startS| |mathML| |pI|
                               (QREFELT $ 42)) . #0#)
                     (LETT |endI|
                           (SPADCALL |endS| |mathML| |pI|
                               (QREFELT $ 42)) . #0#)
                     (EXIT (COND
                             ((OR (EQL |startI| 0)
                                  (NULL (< |startI| |endI|)))
                              (SEQ (LETT |level| (- |level| 1) . #0#)
                                   (EXIT
                                    (LETT |pI|
                                     (|MMLFORM;tagEnd| |name| |endI|
                                      |mathML| $) . #0#))))
                             ('T
                              (SEQ (LETT |level| (+ |level| 1) . #0#)
                                   (EXIT
                                    (LETT |pI|
                                     (|MMLFORM;tagEnd| |name| |startI|
                                      |mathML| $) . #0#)))))))
                NIL (GO G190) G191 (EXIT NIL))
           (EXIT |pI|))))) 

(DEFUN |MMLFORM;tagEnd| (|name| |pos| |mathML| $)
  (PROG (|pI| |u|)
    (RETURN
      (SEQ (LETT |pI| |pos| . #0=(|MMLFORM;tagEnd|))
           (SEQ G190
                (COND
                  ((NULL (COND
                           ((SPADCALL
                                (SPADCALL |mathML| |pI| (QREFELT $ 37))
                                (SPADCALL ">" (QREFELT $ 43))
                                (QREFELT $ 44))
                            'NIL)
                           ('T 'T)))
                   (GO G191)))
                (SEQ (EXIT (LETT |pI| (+ |pI| 1) . #0#))) NIL (GO G190)
                G191 (EXIT NIL))
           (LETT |u| (SPADCALL |pos| |pI| (QREFELT $ 34)) . #0#)
           (EXIT |pI|))))) 

(DEFUN |MMLFORM;atomize| (|expr| $)
  (PROG (|letmp| |a| #0=#:G1905 |le|)
    (RETURN
      (SEQ (LETT |le| NIL . #1=(|MMLFORM;atomize|))
           (COND
             ((OR (ATOM |expr|)
                  (EQUAL (|MMLFORM;stringify| |expr| $) "NOTHING"))
              (EXIT (LETT |le|
                          (APPEND |le|
                                  (SPADCALL |expr| (QREFELT $ 46))) . #1#))))
           (LETT |letmp| |expr| . #1#)
           (SEQ (LETT |a| NIL . #1#) (LETT #0# |letmp| . #1#) G190
                (COND
                  ((OR (ATOM #0#)
                       (PROGN (LETT |a| (CAR #0#) . #1#) NIL))
                   (GO G191)))
                (SEQ (EXIT (LETT |le|
                                 (APPEND |le|
                                         (|MMLFORM;atomize| |a| $)) . #1#)))
                (LETT #0# (CDR #0#) . #1#) (GO G190) G191 (EXIT NIL))
           (EXIT |le|))))) 

(DEFUN |MMLFORM;ungroup| (|str| $)
  (PROG (|len| |lrow| |rrow| |u1| |u2| |u|)
    (RETURN
      (SEQ (LETT |len| (QCSIZE |str|) . #0=(|MMLFORM;ungroup|))
           (EXIT (COND
                   ((< |len| 14) |str|)
                   ('T
                    (SEQ (LETT |lrow| "<mrow>" . #0#)
                         (LETT |rrow| "</mrow>" . #0#)
                         (LETT |u1|
                               (SPADCALL 1 6 (QREFELT $ 34)) . #0#)
                         (LETT |u2|
                               (SPADCALL (- |len| 6) |len|
                                   (QREFELT $ 34)) . #0#)
                         (COND
                           ((EQUAL (SPADCALL |str| |u1| (QREFELT $ 35))
                                   |lrow|)
                            (COND
                              ((EQUAL (SPADCALL |str| |u2|
                                       (QREFELT $ 35))
                                      |rrow|)
                               (SEQ (LETT |u|
                                     (SPADCALL 7 (- |len| 7)
                                      (QREFELT $ 34)) . #0#)
                                    (EXIT
                                     (LETT |str|
                                      (SPADCALL |str| |u|
                                       (QREFELT $ 35)) . #0#)))))))
                         (EXIT |str|))))))))) 

(DEFUN |MMLFORM;postcondition| (|str| $)
  (PROG (|len| |plusminus| |pos| |ustart| |uend|)
    (RETURN
      (SEQ (LETT |len| (QCSIZE |str|) . #0=(|MMLFORM;postcondition|))
           (LETT |plusminus| "<mo>+</mo><mo>-</mo>" . #0#)
           (LETT |pos|
                 (SPADCALL |plusminus| |str| 1 (QREFELT $ 42)) . #0#)
           (COND
             ((< 0 |pos|)
              (SEQ (LETT |ustart|
                         (SPADCALL 1 (- |pos| 1) (QREFELT $ 34)) . #0#)
                   (LETT |uend|
                         (SPADCALL (+ |pos| 20) |len| (QREFELT $ 34)) . #0#)
                   (LETT |str|
                         (SPADCALL
                             (LIST (SPADCALL |str| |ustart|
                                    (QREFELT $ 35))
                                   "<mo>-</mo>"
                                   (SPADCALL |str| |uend|
                                    (QREFELT $ 35)))
                             (QREFELT $ 30)) . #0#)
                   (EXIT (COND
                           ((< |pos| (- |len| 18))
                            (LETT |str|
                                  (|MMLFORM;postcondition| |str| $) . #0#)))))))
           (EXIT |str|))))) 

(PUT '|MMLFORM;stringify| '|SPADreplace| '|mathObject2String|) 

(DEFUN |MMLFORM;stringify| (|expr| $) (|mathObject2String| |expr|)) 

(DEFUN |MMLFORM;group| (|str| $)
  (SPADCALL (LIST "<mrow>" |str| "</mrow>") (QREFELT $ 30))) 

(DEFUN |MMLFORM;addBraces| (|str| $)
  (SPADCALL (LIST "<mo>{</mo>" |str| "<mo>}</mo>") (QREFELT $ 30))) 

(DEFUN |MMLFORM;addBrackets| (|str| $)
  (SPADCALL (LIST "<mo>[</mo>" |str| "<mo>]</mo>") (QREFELT $ 30))) 

(DEFUN |MMLFORM;parenthesize| (|str| $)
  (SPADCALL (LIST "<mo>(</mo>" |str| "<mo>)</mo>") (QREFELT $ 30))) 

(PUT '|MMLFORM;precondition| '|SPADreplace| '|outputTran|) 

(DEFUN |MMLFORM;precondition| (|expr| $) (|outputTran| |expr|)) 

(DEFUN |MMLFORM;formatSpecial| (|op| |args| |prec| $)
  (PROG (|prescript| #0=#:G1932 |u| #1=#:G1933 |base| |tmp|)
    (RETURN
      (SEQ (LETT |prescript| 'NIL . #2=(|MMLFORM;formatSpecial|))
           (EXIT (COND
                   ((EQUAL |op| "theMap") "<mtext>theMap(...)</mtext>")
                   ((EQUAL |op| "AGGLST")
                    (|MMLFORM;formatNary| "," |args| |prec| $))
                   ((EQUAL |op| "AGGSET")
                    (|MMLFORM;formatNary| ";" |args| |prec| $))
                   ((EQUAL |op| "TAG")
                    (|MMLFORM;group|
                        (SPADCALL
                            (LIST (|MMLFORM;formatMml|
                                      (|SPADfirst| |args|) |prec| $)
                                  "<mo>&#x02192;</mo>"
                                  (|MMLFORM;formatMml|
                                      (SPADCALL |args| (QREFELT $ 47))
                                      |prec| $))
                            (QREFELT $ 30))
                        $))
                   ((EQUAL |op| "VCONCAT")
                    (|MMLFORM;group|
                        (STRCONC "<mtable><mtr>"
                                 (STRCONC (SPADCALL
                                           (PROGN
                                             (LETT #0# NIL . #2#)
                                             (SEQ (LETT |u| NIL . #2#)
                                              (LETT #1# |args| . #2#)
                                              G190
                                              (COND
                                                ((OR (ATOM #1#)
                                                  (PROGN
                                                    (LETT |u|
                                                     (CAR #1#) . #2#)
                                                    NIL))
                                                 (GO G191)))
                                              (SEQ
                                               (EXIT
                                                (LETT #0#
                                                 (CONS
                                                  (STRCONC "<mtd>"
                                                   (STRCONC
                                                    (|MMLFORM;formatMml|
                                                     |u| (QREFELT $ 8)
                                                     $)
                                                    "</mtd>"))
                                                  #0#) . #2#)))
                                              (LETT #1#
                                               (CDR #1#) . #2#)
                                              (GO G190) G191
                                              (EXIT (NREVERSE0 #0#))))
                                           (QREFELT $ 30))
                                          "</mtr></mtable>"))
                        $))
                   ((EQUAL |op| "CONCATB")
                    (|MMLFORM;formatNary| " " |args| |prec| $))
                   ((EQUAL |op| "CONCAT")
                    (|MMLFORM;formatNary| "" |args| (QREFELT $ 8) $))
                   ((EQUAL |op| "QUOTE")
                    (|MMLFORM;group|
                        (STRCONC "<mo>'</mo>"
                                 (|MMLFORM;formatMml|
                                     (|SPADfirst| |args|) (QREFELT $ 8)
                                     $))
                        $))
                   ((EQUAL |op| "BRACKET")
                    (|MMLFORM;group|
                        (|MMLFORM;addBrackets|
                            (|MMLFORM;ungroup|
                                (|MMLFORM;formatMml|
                                    (|SPADfirst| |args|) (QREFELT $ 8)
                                    $)
                                $)
                            $)
                        $))
                   ((EQUAL |op| "BRACE")
                    (|MMLFORM;group|
                        (|MMLFORM;addBraces|
                            (|MMLFORM;ungroup|
                                (|MMLFORM;formatMml|
                                    (|SPADfirst| |args|) (QREFELT $ 8)
                                    $)
                                $)
                            $)
                        $))
                   ((EQUAL |op| "PAREN")
                    (|MMLFORM;group|
                        (|MMLFORM;parenthesize|
                            (|MMLFORM;ungroup|
                                (|MMLFORM;formatMml|
                                    (|SPADfirst| |args|) (QREFELT $ 8)
                                    $)
                                $)
                            $)
                        $))
                   ((EQUAL |op| "OVERBAR")
                    (COND
                      ((NULL |args|) "")
                      (#3='T
                       (|MMLFORM;group|
                           (SPADCALL
                               (LIST "<mover accent='true'><mrow>"
                                     (|MMLFORM;formatMml|
                                      (|SPADfirst| |args|)
                                      (QREFELT $ 8) $)
                                     "</mrow><mo stretchy='true'>&#x000AF;</mo></mover>")
                               (QREFELT $ 30))
                           $))))
                   ((EQUAL |op| "ROOT")
                    (COND
                      ((NULL |args|) "")
                      (#3#
                       (SEQ (LETT |tmp|
                                  (|MMLFORM;group|
                                      (|MMLFORM;formatMml|
                                       (|SPADfirst| |args|)
                                       (QREFELT $ 8) $)
                                      $) . #2#)
                            (EXIT (COND
                                    ((NULL (CDR |args|))
                                     (SPADCALL
                                      (LIST "<msqrt>" |tmp| "</msqrt>")
                                      (QREFELT $ 30)))
                                    ('T
                                     (|MMLFORM;group|
                                      (SPADCALL
                                       (LIST "<mroot><mrow>" |tmp|
                                        "</mrow>"
                                        (|MMLFORM;formatMml|
                                         (|SPADfirst| (CDR |args|))
                                         (QREFELT $ 8) $)
                                        "</mroot>")
                                       (QREFELT $ 30))
                                      $))))))))
                   ((EQUAL |op| "SEGMENT")
                    (SEQ (LETT |tmp|
                               (SPADCALL
                                   (LIST
                                    (|MMLFORM;formatMml|
                                     (|SPADfirst| |args|) (QREFELT $ 8)
                                     $)
                                    "<mo>..</mo>")
                                   (QREFELT $ 30)) . #2#)
                         (EXIT (|MMLFORM;group|
                                   (COND
                                     ((NULL (CDR |args|)) |tmp|)
                                     ('T
                                      (SPADCALL
                                       (LIST |tmp|
                                        (|MMLFORM;formatMml|
                                         (|SPADfirst| (CDR |args|))
                                         (QREFELT $ 8) $))
                                       (QREFELT $ 30))))
                                   $))))
                   ((EQUAL |op| "SUB")
                    (|MMLFORM;group|
                        (SPADCALL
                            (LIST "<msub>"
                                  (|MMLFORM;formatMml|
                                      (|SPADfirst| |args|)
                                      (QREFELT $ 8) $)
                                  (|MMLFORM;formatSpecial| "AGGLST"
                                      (CDR |args|) (QREFELT $ 8) $)
                                  "</msub>")
                            (QREFELT $ 30))
                        $))
                   ((EQUAL |op| "SUPERSUB")
                    (SEQ (LETT |base|
                               (|MMLFORM;formatMml|
                                   (|SPADfirst| |args|) (QREFELT $ 8)
                                   $) . #2#)
                         (LETT |args| (CDR |args|) . #2#)
                         (EXIT (COND
                                 ((EQL (LENGTH |args|) 1)
                                  (SPADCALL "<msub><mrow>"
                                      (SPADCALL |base|
                                       (SPADCALL "</mrow><mrow>"
                                        (SPADCALL
                                         (|MMLFORM;formatMml|
                                          (|SPADfirst| |args|)
                                          (QREFELT $ 8) $)
                                         "</mrow></msub>"
                                         (QREFELT $ 48))
                                        (QREFELT $ 48))
                                       (QREFELT $ 48))
                                      (QREFELT $ 48)))
                                 ((EQL (LENGTH |args|) 2)
                                  (SPADCALL "<msubsup><mrow>"
                                      (SPADCALL |base|
                                       (SPADCALL "</mrow><mrow>"
                                        (SPADCALL
                                         (|MMLFORM;formatMml|
                                          (|SPADfirst| |args|)
                                          (QREFELT $ 8) $)
                                         (SPADCALL "</mrow><mrow>"
                                          (SPADCALL
                                           (|MMLFORM;formatMml|
                                            (|SPADfirst| (CDR |args|))
                                            (QREFELT $ 8) $)
                                           "</mrow></msubsup>"
                                           (QREFELT $ 48))
                                          (QREFELT $ 48))
                                         (QREFELT $ 48))
                                        (QREFELT $ 48))
                                       (QREFELT $ 48))
                                      (QREFELT $ 48)))
                                 ((EQL (LENGTH |args|) 3)
                                  (SPADCALL "<mmultiscripts><mrow>"
                                      (SPADCALL |base|
                                       (SPADCALL "</mrow><mrow>"
                                        (SPADCALL
                                         (|MMLFORM;formatMml|
                                          (|SPADfirst| |args|)
                                          (QREFELT $ 8) $)
                                         (SPADCALL "</mrow><mrow>"
                                          (SPADCALL
                                           (|MMLFORM;formatMml|
                                            (|SPADfirst| (CDR |args|))
                                            (QREFELT $ 8) $)
                                           (SPADCALL
                                            "</mrow><mprescripts/><mrow>"
                                            (SPADCALL
                                             (|MMLFORM;formatMml|
                                              (|SPADfirst|
                                               (CDR (CDR |args|)))
                                              (QREFELT $ 8) $)
                                             "</mrow><none/></mmultiscripts>"
                                             (QREFELT $ 48))
                                            (QREFELT $ 48))
                                           (QREFELT $ 48))
                                          (QREFELT $ 48))
                                         (QREFELT $ 48))
                                        (QREFELT $ 48))
                                       (QREFELT $ 48))
                                      (QREFELT $ 48)))
                                 ((EQL (LENGTH |args|) 4)
                                  (SPADCALL "<mmultiscripts><mrow>"
                                      (SPADCALL |base|
                                       (SPADCALL "</mrow><mrow>"
                                        (SPADCALL
                                         (|MMLFORM;formatMml|
                                          (|SPADfirst| |args|)
                                          (QREFELT $ 8) $)
                                         (SPADCALL "</mrow><mrow>"
                                          (SPADCALL
                                           (|MMLFORM;formatMml|
                                            (|SPADfirst| (CDR |args|))
                                            (QREFELT $ 8) $)
                                           (SPADCALL
                                            "</mrow><mprescripts/><mrow>"
                                            (SPADCALL
                                             (|MMLFORM;formatMml|
                                              (|SPADfirst|
                                               (CDR (CDR |args|)))
                                              (QREFELT $ 8) $)
                                             (SPADCALL "</mrow><mrow>"
                                              (SPADCALL
                                               (|MMLFORM;formatMml|
                                                (|SPADfirst|
                                                 (CDR
                                                  (CDR (CDR |args|))))
                                                (QREFELT $ 8) $)
                                               "</mrow></mmultiscripts>"
                                               (QREFELT $ 48))
                                              (QREFELT $ 48))
                                             (QREFELT $ 48))
                                            (QREFELT $ 48))
                                           (QREFELT $ 48))
                                          (QREFELT $ 48))
                                         (QREFELT $ 48))
                                        (QREFELT $ 48))
                                       (QREFELT $ 48))
                                      (QREFELT $ 48)))
                                 ('T
                                  "<mtext>Problem with multiscript object</mtext>")))))
                   ((EQUAL |op| "SC")
                    (COND
                      ((NULL |args|) "")
                      (#3#
                       (SEQ (LETT |tmp|
                                  (|MMLFORM;formatNaryNoGroup|
                                      "</mtd></mtr><mtr><mtd>" |args|
                                      (QREFELT $ 8) $) . #2#)
                            (EXIT (|MMLFORM;group|
                                      (SPADCALL
                                       (LIST "<mtable><mtr><mtd>" |tmp|
                                        "</mtd></mtr></mtable>")
                                       (QREFELT $ 30))
                                      $))))))
                   ((EQUAL |op| "MATRIX")
                    (|MMLFORM;formatMatrix| (CDR |args|) $))
                   ((EQUAL |op| "ZAG")
                    (SPADCALL
                        (LIST " \\zag{"
                              (|MMLFORM;formatMml| (|SPADfirst| |args|)
                                  (QREFELT $ 8) $)
                              "}{"
                              (|MMLFORM;formatMml|
                                  (|SPADfirst| (CDR |args|))
                                  (QREFELT $ 8) $)
                              "}")
                        (QREFELT $ 30)))
                   (#3#
                    (SPADCALL
                        (LIST "<mtext>not done yet for: " |op|
                              "</mtext>")
                        (QREFELT $ 30))))))))) 

(DEFUN |MMLFORM;formatSub| (|expr| |args| |opPrec| $)
  (PROG (|atomE| |op| |ndiffs| |tmpLE| |numLS| |posLS| |j| |k| |tmpS|
                 |i| |s|)
    (RETURN
      (SEQ (LETT |atomE| (|MMLFORM;atomize| |expr| $)
                 . #0=(|MMLFORM;formatSub|))
           (LETT |op|
                 (|MMLFORM;stringify| (|SPADfirst| |atomE|) $) . #0#)
           (EXIT (COND
                   ((EQUAL |op| "SUB")
                    (COND
                      ((NULL (EQUAL (|MMLFORM;stringify|
                                     (|SPADfirst| (CDR (CDR |atomE|)))
                                     $)
                                    "CONCAT"))
                       "<mtext>Mistake in formatSub: no CONCAT</mtext>")
                      ('T
                       (SEQ (LETT |ndiffs| 0 . #0#)
                            (LETT |tmpLE| (CDR (CDR |atomE|)) . #0#)
                            (SEQ G190
                                 (COND
                                   ((NULL
                                     (EQUAL
                                      (|MMLFORM;stringify|
                                       (|SPADfirst| |tmpLE|) $)
                                      "CONCAT"))
                                    #1=(GO G191)))
                                 (SEQ (LETT |ndiffs|
                                       (+ |ndiffs| 1) . #0#)
                                      (EXIT
                                       (LETT |tmpLE|
                                        (CDR |tmpLE|) . #0#)))
                                 NIL #2=(GO G190) G191 (EXIT NIL))
                            (LETT |numLS| NIL . #0#) (LETT |i| 1 . #0#)
                            (SEQ G190
                                 (COND ((NULL (< |i| |ndiffs|)) #1#))
                                 (SEQ (LETT |numLS|
                                       (APPEND |numLS|
                                        (SPADCALL
                                         (|MMLFORM;stringify|
                                          (|SPADfirst| (CDR |tmpLE|))
                                          $)
                                         (QREFELT $ 50))) . #0#)
                                      (LETT |tmpLE|
                                       (CDR (CDR (CDR |tmpLE|))) . #0#)
                                      (EXIT (LETT |i| (+ |i| 1) . #0#)))
                                 NIL #2# G191 (EXIT NIL))
                            (LETT |numLS|
                                  (APPEND |numLS|
                                          (SPADCALL
                                           (|MMLFORM;stringify|
                                            (|SPADfirst| (CDR |tmpLE|))
                                            $)
                                           (QREFELT $ 50))) . #0#)
                            (LETT |posLS| NIL . #0#) (LETT |i| 0 . #0#)
                            (SEQ G190
                                 (COND
                                   ((NULL (< |i| (LENGTH |args|))) #1#))
                                 (SEQ (LETT |posLS|
                                       (APPEND |posLS|
                                        (SPADCALL
                                         (STRINGIMAGE (+ |i| 1))
                                         (QREFELT $ 50))) . #0#)
                                      (EXIT (LETT |i| (+ |i| 1) . #0#)))
                                 NIL #2# G191 (EXIT NIL))
                            (LETT |tmpS|
                                  (|MMLFORM;stringify|
                                      (SPADCALL |atomE| 2
                                       (QREFELT $ 51))
                                      $) . #0#)
                            (COND
                              ((EQL |ndiffs| 1)
                               (LETT |s|
                                     (SPADCALL
                                      "<mfrac><mo>&#x02202;</mo><mi>"
                                      (SPADCALL |tmpS| "</mi><mrow>"
                                       (QREFELT $ 48))
                                      (QREFELT $ 48)) . #0#))
                              (#3='T
                               (LETT |s|
                                     (SPADCALL
                                      "<mfrac><mrow><msup><mo>&#x02202;</mo><mn>"
                                      (SPADCALL (STRINGIMAGE |ndiffs|)
                                       (SPADCALL "</mn></msup><mi>"
                                        (SPADCALL |tmpS|
                                         "</mi></mrow><mrow>"
                                         (QREFELT $ 48))
                                        (QREFELT $ 48))
                                       (QREFELT $ 48))
                                      (QREFELT $ 48)) . #0#)))
                            (LETT |i| 1 . #0#)
                            (SEQ G190
                                 (COND
                                   ((NULL
                                     (< |i| (+ (LENGTH |posLS|) 1)))
                                    #1#))
                                 (SEQ (LETT |j| 0 . #0#)
                                      (LETT |k| 1 . #0#)
                                      (SEQ G190
                                       (COND
                                         ((NULL
                                           (< |k|
                                            (+ (LENGTH |numLS|) 1)))
                                          #1#))
                                       (SEQ
                                        (COND
                                          ((EQUAL
                                            (SPADCALL |numLS| |k|
                                             (QREFELT $ 52))
                                            (STRINGIMAGE |i|))
                                           (LETT |j| (+ |j| 1) . #0#)))
                                        (EXIT
                                         (LETT |k| (+ |k| 1) . #0#)))
                                       NIL #2# G191 (EXIT NIL))
                                      (COND
                                        ((< 0 |j|)
                                         (SEQ
                                          (LETT |tmpS|
                                           (|MMLFORM;stringify|
                                            (SPADCALL |args| |i|
                                             (QREFELT $ 51))
                                            $) . #0#)
                                          (EXIT
                                           (COND
                                             ((EQL |j| 1)
                                              (LETT |s|
                                               (SPADCALL |s|
                                                (SPADCALL
                                                 "<mo>&#x02202;</mo><mi>"
                                                 (SPADCALL |tmpS|
                                                  "</mi>"
                                                  (QREFELT $ 48))
                                                 (QREFELT $ 48))
                                                (QREFELT $ 48)) . #0#))
                                             ('T
                                              (LETT |s|
                                               (SPADCALL |s|
                                                (SPADCALL
                                                 "<mo>&#x02202;</mo><msup><mi>"
                                                 (SPADCALL |tmpS|
                                                  (SPADCALL "</mi><mn>"
                                                   (SPADCALL
                                                    (STRINGIMAGE |j|)
                                                    "</mn></msup>"
                                                    (QREFELT $ 48))
                                                   (QREFELT $ 48))
                                                  (QREFELT $ 48))
                                                 (QREFELT $ 48))
                                                (QREFELT $ 48)) . #0#)))))))
                                      (EXIT (LETT |i| (+ |i| 1) . #0#)))
                                 NIL #2# G191 (EXIT NIL))
                            (LETT |s|
                                  (SPADCALL |s|
                                      "</mrow></mfrac><mo>(</mo>"
                                      (QREFELT $ 48)) . #0#)
                            (LETT |i| 1 . #0#)
                            (SEQ G190
                                 (COND
                                   ((NULL
                                     (< |i| (+ (LENGTH |posLS|) 1)))
                                    #1#))
                                 (SEQ (LETT |tmpS|
                                       (|MMLFORM;stringify|
                                        (SPADCALL |args| |i|
                                         (QREFELT $ 51))
                                        $) . #0#)
                                      (LETT |s|
                                       (SPADCALL |s|
                                        (SPADCALL "<mi>"
                                         (SPADCALL |tmpS| "</mi>"
                                          (QREFELT $ 48))
                                         (QREFELT $ 48))
                                        (QREFELT $ 48)) . #0#)
                                      (COND
                                        ((< |i| (LENGTH |posLS|))
                                         (LETT |s|
                                          (SPADCALL |s| "<mo>,</mo>"
                                           (QREFELT $ 48)) . #0#)))
                                      (EXIT (LETT |i| (+ |i| 1) . #0#)))
                                 NIL #2# G191 (EXIT NIL))
                            (EXIT (LETT |s|
                                        (SPADCALL |s| "<mo>)</mo>"
                                         (QREFELT $ 48)) . #0#))))))
                   (#3# "<mtext>Mistake in formatSub: no SUB</mtext>"))))))) 

(DEFUN |MMLFORM;formatSub1| (|expr| |args| |opPrec| $)
  (PROG (|atomE| |op| |ndiffs| |tmpLE| |numLS| |posLS| |funcS| |tmpS|
                 |i| |s|)
    (RETURN
      (SEQ (LETT |atomE| (|MMLFORM;atomize| |expr| $)
                 . #0=(|MMLFORM;formatSub1|))
           (LETT |op|
                 (|MMLFORM;stringify| (|SPADfirst| |atomE|) $) . #0#)
           (EXIT (COND
                   ((EQUAL |op| "SUB")
                    (COND
                      ((NULL (EQUAL (|MMLFORM;stringify|
                                     (|SPADfirst| (CDR (CDR |atomE|)))
                                     $)
                                    "CONCAT"))
                       "<mtext>Mistake in formatSub: no CONCAT</mtext>")
                      ('T
                       (SEQ (LETT |ndiffs| 0 . #0#)
                            (LETT |tmpLE| (CDR (CDR |atomE|)) . #0#)
                            (SEQ G190
                                 (COND
                                   ((NULL
                                     (EQUAL
                                      (|MMLFORM;stringify|
                                       (|SPADfirst| |tmpLE|) $)
                                      "CONCAT"))
                                    #1=(GO G191)))
                                 (SEQ (LETT |ndiffs|
                                       (+ |ndiffs| 1) . #0#)
                                      (EXIT
                                       (LETT |tmpLE|
                                        (CDR |tmpLE|) . #0#)))
                                 NIL #2=(GO G190) G191 (EXIT NIL))
                            (LETT |numLS| NIL . #0#) (LETT |i| 1 . #0#)
                            (SEQ G190
                                 (COND ((NULL (< |i| |ndiffs|)) #1#))
                                 (SEQ (LETT |numLS|
                                       (APPEND |numLS|
                                        (SPADCALL
                                         (|MMLFORM;stringify|
                                          (|SPADfirst| (CDR |tmpLE|))
                                          $)
                                         (QREFELT $ 50))) . #0#)
                                      (LETT |tmpLE|
                                       (CDR (CDR (CDR |tmpLE|))) . #0#)
                                      (EXIT (LETT |i| (+ |i| 1) . #0#)))
                                 NIL #2# G191 (EXIT NIL))
                            (LETT |numLS|
                                  (APPEND |numLS|
                                          (SPADCALL
                                           (|MMLFORM;stringify|
                                            (|SPADfirst| (CDR |tmpLE|))
                                            $)
                                           (QREFELT $ 50))) . #0#)
                            (LETT |posLS| NIL . #0#) (LETT |i| 0 . #0#)
                            (SEQ G190
                                 (COND
                                   ((NULL (< |i| (LENGTH |args|))) #1#))
                                 (SEQ (LETT |posLS|
                                       (APPEND |posLS|
                                        (SPADCALL
                                         (STRINGIMAGE (+ |i| 1))
                                         (QREFELT $ 50))) . #0#)
                                      (EXIT (LETT |i| (+ |i| 1) . #0#)))
                                 NIL #2# G191 (EXIT NIL))
                            (LETT |funcS|
                                  (|MMLFORM;stringify|
                                      (SPADCALL |atomE| 2
                                       (QREFELT $ 51))
                                      $) . #0#)
                            (LETT |s|
                                  (SPADCALL "<msub><mi>"
                                      (SPADCALL |funcS| "</mi><mrow>"
                                       (QREFELT $ 48))
                                      (QREFELT $ 48)) . #0#)
                            (LETT |i| 1 . #0#)
                            (SEQ G190
                                 (COND
                                   ((NULL
                                     (< |i| (+ (LENGTH |numLS|) 1)))
                                    #1#))
                                 (SEQ (LETT |s|
                                       (SPADCALL |s|
                                        (SPADCALL "<mo>,</mo><mn>"
                                         (SPADCALL
                                          (SPADCALL |numLS| |i|
                                           (QREFELT $ 52))
                                          "</mn>" (QREFELT $ 48))
                                         (QREFELT $ 48))
                                        (QREFELT $ 48)) . #0#)
                                      (EXIT (LETT |i| (+ |i| 1) . #0#)))
                                 NIL #2# G191 (EXIT NIL))
                            (LETT |s|
                                  (SPADCALL |s|
                                      "</mrow></msub><mo>(</mo>"
                                      (QREFELT $ 48)) . #0#)
                            (LETT |i| 1 . #0#)
                            (SEQ G190
                                 (COND
                                   ((NULL
                                     (< |i| (+ (LENGTH |posLS|) 1)))
                                    #1#))
                                 (SEQ (LETT |tmpS|
                                       (|MMLFORM;formatMml|
                                        (|SPADfirst| |args|)
                                        (QREFELT $ 8) $) . #0#)
                                      (LETT |args| (CDR |args|) . #0#)
                                      (LETT |s|
                                       (SPADCALL |s|
                                        (SPADCALL "<mi>"
                                         (SPADCALL |tmpS| "</mi>"
                                          (QREFELT $ 48))
                                         (QREFELT $ 48))
                                        (QREFELT $ 48)) . #0#)
                                      (COND
                                        ((< |i| (LENGTH |posLS|))
                                         (LETT |s|
                                          (SPADCALL |s| "<mo>,</mo>"
                                           (QREFELT $ 48)) . #0#)))
                                      (EXIT (LETT |i| (+ |i| 1) . #0#)))
                                 NIL #2# G191 (EXIT NIL))
                            (EXIT (LETT |s|
                                        (SPADCALL |s| "<mo>)</mo>"
                                         (QREFELT $ 48)) . #0#))))))
                   ('T "<mtext>Mistake in formatSub: no SUB</mtext>"))))))) 

(DEFUN |MMLFORM;formatSuperSub| (|expr| |args| |opPrec| $)
  (PROG (|atomE| |op| |var| |funcS| |bvarS| |commaS| |i| |commaTest|
                 |j| |s|)
    (RETURN
      (SEQ (LETT |atomE| (|MMLFORM;atomize| |expr| $)
                 . #0=(|MMLFORM;formatSuperSub|))
           (LETT |op|
                 (|MMLFORM;stringify| (|SPADfirst| |atomE|) $) . #0#)
           (EXIT (COND
                   ((EQUAL |op| "SUPERSUB")
                    (COND
                      ((NULL (EQL (LENGTH |args|) 1))
                       "<mtext>Mistake in SuperSub1: #args <> 1</mtext>")
                      ('T
                       (SEQ (LETT |var| (|SPADfirst| |args|) . #0#)
                            (LETT |funcS|
                                  (|MMLFORM;stringify|
                                      (|SPADfirst| (CDR |atomE|)) $) . #0#)
                            (LETT |bvarS|
                                  (|MMLFORM;stringify|
                                      (|SPADfirst| |args|) $) . #0#)
                            (LETT |commaS|
                                  (|MMLFORM;stringify|
                                      (|SPADfirst|
                                       (CDR (CDR (CDR |atomE|))))
                                      $) . #0#)
                            (LETT |commaTest| "," . #0#)
                            (LETT |i| 0 . #0#)
                            (SEQ G190
                                 (COND
                                   ((NULL
                                     (< 0
                                      (SPADCALL |commaTest| |commaS| 1
                                       (QREFELT $ 42))))
                                    #1=(GO G191)))
                                 (SEQ (LETT |i| (+ |i| 1) . #0#)
                                      (EXIT
                                       (LETT |commaTest|
                                        (SPADCALL |commaTest| ","
                                         (QREFELT $ 48)) . #0#)))
                                 NIL #2=(GO G190) G191 (EXIT NIL))
                            (LETT |s|
                                  (SPADCALL "<msup><mi>"
                                      (SPADCALL |funcS| "</mi><mrow>"
                                       (QREFELT $ 48))
                                      (QREFELT $ 48)) . #0#)
                            (LETT |j| 0 . #0#)
                            (SEQ G190 (COND ((NULL (< |j| |i|)) #1#))
                                 (SEQ (LETT |s|
                                       (SPADCALL |s|
                                        "<mo>&#x02032;</mo>"
                                        (QREFELT $ 48)) . #0#)
                                      (EXIT (LETT |j| (+ |j| 1) . #0#)))
                                 NIL #2# G191 (EXIT NIL))
                            (EXIT (LETT |s|
                                        (SPADCALL |s|
                                         (SPADCALL
                                          "</mrow></msup><mo>&#x02061;</mo><mo>(</mo>"
                                          (SPADCALL
                                           (|MMLFORM;formatMml|
                                            (|SPADfirst| |args|)
                                            (QREFELT $ 8) $)
                                           "<mo>)</mo>" (QREFELT $ 48))
                                          (QREFELT $ 48))
                                         (QREFELT $ 48)) . #0#))))))
                   ('T
                    "<mtext>Mistake in formatSuperSub: no SUPERSUB1</mtext>"))))))) 

(DEFUN |MMLFORM;formatSuperSub1| (|expr| |args| |opPrec| $)
  (PROG (|atomE| |op| |var| |funcS| |bvarS| |commaS| |ndiffs|
                 |commaTest| |s|)
    (RETURN
      (SEQ (LETT |atomE| (|MMLFORM;atomize| |expr| $)
                 . #0=(|MMLFORM;formatSuperSub1|))
           (LETT |op|
                 (|MMLFORM;stringify| (|SPADfirst| |atomE|) $) . #0#)
           (EXIT (COND
                   ((EQUAL |op| "SUPERSUB")
                    (COND
                      ((NULL (EQL (LENGTH |args|) 1))
                       "<mtext>Mistake in SuperSub: #args <> 1</mtext>")
                      ('T
                       (SEQ (LETT |var| (|SPADfirst| |args|) . #0#)
                            (LETT |funcS|
                                  (|MMLFORM;stringify|
                                      (|SPADfirst| (CDR |atomE|)) $) . #0#)
                            (LETT |bvarS|
                                  (|MMLFORM;stringify|
                                      (|SPADfirst| |args|) $) . #0#)
                            (LETT |commaS|
                                  (|MMLFORM;stringify|
                                      (|SPADfirst|
                                       (CDR (CDR (CDR |atomE|))))
                                      $) . #0#)
                            (LETT |commaTest| "," . #0#)
                            (LETT |ndiffs| 0 . #0#)
                            (SEQ G190
                                 (COND
                                   ((NULL
                                     (< 0
                                      (SPADCALL |commaTest| |commaS| 1
                                       (QREFELT $ 42))))
                                    (GO G191)))
                                 (SEQ (LETT |ndiffs|
                                       (+ |ndiffs| 1) . #0#)
                                      (EXIT
                                       (LETT |commaTest|
                                        (SPADCALL |commaTest| ","
                                         (QREFELT $ 48)) . #0#)))
                                 NIL (GO G190) G191 (EXIT NIL))
                            (EXIT (LETT |s|
                                        (SPADCALL
                                         "<mfrac><mrow><msup><mo>&#x02146;</mo><mn>"
                                         (SPADCALL
                                          (STRINGIMAGE |ndiffs|)
                                          (SPADCALL "</mn></msup><mi>"
                                           (SPADCALL |funcS|
                                            (SPADCALL
                                             "</mi></mrow><mrow><mo>&#x02146;</mo><msup><mi>"
                                             (SPADCALL
                                              (|MMLFORM;formatMml|
                                               (|SPADfirst| |args|)
                                               (QREFELT $ 8) $)
                                              (SPADCALL "</mi><mn>"
                                               (SPADCALL
                                                (STRINGIMAGE |ndiffs|)
                                                (SPADCALL
                                                 "</mn></msup></mrow></mfrac><mo>&#x02061;</mo><mo>(</mo><mi>"
                                                 (SPADCALL
                                                  (|MMLFORM;formatMml|
                                                   (|SPADfirst| |args|)
                                                   (QREFELT $ 8) $)
                                                  "</mi><mo>)</mo>"
                                                  (QREFELT $ 48))
                                                 (QREFELT $ 48))
                                                (QREFELT $ 48))
                                               (QREFELT $ 48))
                                              (QREFELT $ 48))
                                             (QREFELT $ 48))
                                            (QREFELT $ 48))
                                           (QREFELT $ 48))
                                          (QREFELT $ 48))
                                         (QREFELT $ 48)) . #0#))))))
                   ('T
                    "<mtext>Mistake in formatSuperSub: no SUPERSUB</mtext>"))))))) 

(DEFUN |MMLFORM;formatPlex| (|op| |args| |prec| $)
  (PROG (|p| |opPrec| |n| |checkarg| |hold| |la| |opa| |s|)
    (RETURN
      (SEQ (LETT |checkarg| 'NIL . #0=(|MMLFORM;formatPlex|))
           (LETT |p|
                 (SPADCALL |op| (QREFELT $ 16) (QREFELT $ 53)) . #0#)
           (EXIT (COND
                   ((< |p| 1) (|error| "unknown plex op"))
                   ((EQUAL |op| "INTSIGN")
                    (|MMLFORM;formatIntSign| |args| (QREFELT $ 8) $))
                   (#1='T
                    (SEQ (LETT |opPrec|
                               (SPADCALL (QREFELT $ 17) |p|
                                   (QREFELT $ 55)) . #0#)
                         (LETT |n| (LENGTH |args|) . #0#)
                         (COND
                           ((NULL (EQL |n| 2))
                            (COND
                              ((NULL (EQL |n| 3))
                               (EXIT (|error|
                                      "wrong number of arguments for plex"))))))
                         (LETT |s|
                               (COND
                                 ((OR (EQUAL |op| "SIGMA")
                                      (EQUAL |op| "SIGMA2"))
                                  (SEQ (LETT |checkarg| 'T . #0#)
                                       (EXIT "<mo>&#x02211;</mo>")))
                                 ((OR (EQUAL |op| "PI")
                                      (EQUAL |op| "PI2"))
                                  (SEQ (LETT |checkarg| 'T . #0#)
                                       (EXIT "<mo>&#x0220F;</mo>")))
                                 ((EQUAL |op| "INDEFINTEGRAL")
                                  "<mo>&#x0222B;</mo>")
                                 (#1# "????")) . #0#)
                         (LETT |hold|
                               (|MMLFORM;formatMml|
                                   (|SPADfirst| |args|) (QREFELT $ 8)
                                   $) . #0#)
                         (LETT |args| (CDR |args|) . #0#)
                         (COND
                           ((EQUAL |op| "INDEFINTEGRAL")
                            (SEQ (LETT |hold|
                                       (|MMLFORM;group|
                                        (SPADCALL
                                         (LIST |hold|
                                          (|MMLFORM;formatMml|
                                           (|SPADfirst| |args|)
                                           (QREFELT $ 8) $))
                                         (QREFELT $ 30))
                                        $) . #0#)
                                 (EXIT (LETT |s|
                                        (SPADCALL (LIST |s| |hold|)
                                         (QREFELT $ 30)) . #0#))))
                           (#1#
                            (SEQ (COND
                                   ((EQUAL |hold| "")
                                    (LETT |s|
                                     (SPADCALL
                                      (LIST "<munderover>" |s|
                                       (|MMLFORM;group| " " $))
                                      (QREFELT $ 30)) . #0#))
                                   (#1#
                                    (LETT |s|
                                     (SPADCALL
                                      (LIST "<munderover>" |s|
                                       (|MMLFORM;group| |hold| $))
                                      (QREFELT $ 30)) . #0#)))
                                 (COND
                                   ((NULL (NULL (CDR |args|)))
                                    (SEQ
                                     (LETT |hold|
                                      (|MMLFORM;formatMml|
                                       (|SPADfirst| |args|)
                                       (QREFELT $ 8) $) . #0#)
                                     (COND
                                       ((EQUAL |hold| "")
                                        (LETT |s|
                                         (SPADCALL
                                          (LIST |s|
                                           (|MMLFORM;group| " " $)
                                           "</munderover>")
                                          (QREFELT $ 30)) . #0#))
                                       ('T
                                        (LETT |s|
                                         (SPADCALL
                                          (LIST |s|
                                           (|MMLFORM;group| |hold| $)
                                           "</munderover>")
                                          (QREFELT $ 30)) . #0#)))
                                     (EXIT
                                      (LETT |args| (CDR |args|) . #0#)))))
                                 (EXIT (COND
                                         (|checkarg|
                                          (SEQ
                                           (LETT |la|
                                            (|SPADfirst| |args|) . #0#)
                                           (LETT |opa|
                                            (|MMLFORM;stringify|
                                             (|SPADfirst| |la|) $) . #0#)
                                           (EXIT
                                            (COND
                                              ((EQUAL |opa| "+")
                                               (LETT |s|
                                                (SPADCALL
                                                 (LIST |s| "<mo>(</mo>"
                                                  (|MMLFORM;formatMml|
                                                   (|SPADfirst| |args|)
                                                   (QREFELT $ 8) $)
                                                  "<mo>)</mo>")
                                                 (QREFELT $ 30)) . #0#))
                                              (#1#
                                               (LETT |s|
                                                (SPADCALL
                                                 (LIST |s|
                                                  (|MMLFORM;formatMml|
                                                   (|SPADfirst| |args|)
                                                   (QREFELT $ 8) $))
                                                 (QREFELT $ 30)) . #0#))))))
                                         (#1#
                                          (LETT |s|
                                           (SPADCALL
                                            (LIST |s|
                                             (|MMLFORM;formatMml|
                                              (|SPADfirst| |args|)
                                              (QREFELT $ 8) $))
                                            (QREFELT $ 30)) . #0#)))))))
                         (EXIT (|MMLFORM;group| |s| $)))))))))) 

(DEFUN |MMLFORM;formatIntSign| (|args| |opPrec| $)
  (PROG (|atomE| |varRS| |i| |u1| |u2| |lowlim| |highlim| |bvar|
                 |bvarS| |tmpLE| |integrand|)
    (RETURN
      (SEQ (COND
             ((EQUAL (|MMLFORM;stringify| (|SPADfirst| |args|) $)
                     "NOTHING")
              (SEQ (LETT |bvar| (|SPADfirst| (CDR |args|))
                         . #0=(|MMLFORM;formatIntSign|))
                   (LETT |bvarS| (|MMLFORM;stringify| |bvar| $) . #0#)
                   (LETT |i| 0 . #0#)
                   (LETT |atomE|
                         (|MMLFORM;atomize|
                             (|SPADfirst| (CDR (CDR |args|))) $) . #0#)
                   (LETT |varRS|
                         (|MMLFORM;stringify|
                             (SPADCALL |atomE| (QREFELT $ 56)) $) . #0#)
                   (LETT |tmpLE|
                         (|SPADfirst| (CDR (CDR |args|))) . #0#)
                   (LETT |integrand|
                         (|MMLFORM;formatMml|
                             (|SPADfirst| (CDR |tmpLE|)) (QREFELT $ 8)
                             $) . #0#)
                   (SEQ G190
                        (COND
                          ((NULL (< 0
                                    (LETT |i|
                                     (SPADCALL |varRS| |integrand|
                                      (+ |i| 1) (QREFELT $ 42)) . #0#)))
                           (GO G191)))
                        (SEQ (LETT |u1|
                                   (SPADCALL 1 (- |i| 1)
                                    (QREFELT $ 34)) . #0#)
                             (LETT |u2|
                                   (SPADCALL (+ |i| 2)
                                    (QCSIZE |integrand|)
                                    (QREFELT $ 34)) . #0#)
                             (EXIT (LETT |integrand|
                                    (SPADCALL
                                     (LIST
                                      (SPADCALL |integrand| |u1|
                                       (QREFELT $ 35))
                                      |bvarS|
                                      (SPADCALL |integrand| |u2|
                                       (QREFELT $ 35)))
                                     (QREFELT $ 30)) . #0#)))
                        NIL (GO G190) G191 (EXIT NIL))
                   (EXIT (SPADCALL
                             (LIST (SPADCALL "<mrow><mo>&#x0222B;</mo>"
                                    (SPADCALL |integrand|
                                     (SPADCALL "<mo>&#x02146;</mo><mi>"
                                      (SPADCALL |bvarS| "</mi></mrow>"
                                       (QREFELT $ 48))
                                      (QREFELT $ 48))
                                     (QREFELT $ 48))
                                    (QREFELT $ 48)))
                             (QREFELT $ 30)))))
             ('T
              (SEQ (LETT |lowlim|
                         (|MMLFORM;stringify| (|SPADfirst| |args|) $) . #0#)
                   (LETT |highlim|
                         (|MMLFORM;stringify|
                             (|SPADfirst| (CDR |args|)) $) . #0#)
                   (LETT |bvar|
                         (SPADCALL
                             (|MMLFORM;atomize|
                                 (|SPADfirst| (CDR (CDR |args|))) $)
                             (QREFELT $ 56)) . #0#)
                   (LETT |bvarS| (|MMLFORM;stringify| |bvar| $) . #0#)
                   (LETT |tmpLE|
                         (|SPADfirst| (CDR (CDR |args|))) . #0#)
                   (LETT |integrand|
                         (|MMLFORM;formatMml|
                             (|SPADfirst| (CDR |tmpLE|)) (QREFELT $ 8)
                             $) . #0#)
                   (EXIT (SPADCALL
                             (LIST (SPADCALL
                                    "<mrow><munderover><mo>&#x0222B;</mo><mi>"
                                    (SPADCALL |lowlim|
                                     (SPADCALL "</mi><mi>"
                                      (SPADCALL |highlim|
                                       (SPADCALL "</mi></munderover>"
                                        (SPADCALL |integrand|
                                         (SPADCALL
                                          "<mo>&#x02146;</mo><mi>"
                                          (SPADCALL |bvarS|
                                           "</mi></mrow>"
                                           (QREFELT $ 48))
                                          (QREFELT $ 48))
                                         (QREFELT $ 48))
                                        (QREFELT $ 48))
                                       (QREFELT $ 48))
                                      (QREFELT $ 48))
                                     (QREFELT $ 48))
                                    (QREFELT $ 48)))
                             (QREFELT $ 30)))))))))) 

(DEFUN |MMLFORM;formatMatrix| (|args| $)
  (|MMLFORM;group|
      (|MMLFORM;addBrackets|
          (SPADCALL
              (LIST "<mtable><mtr><mtd>"
                    (|MMLFORM;formatNaryNoGroup|
                        "</mtd></mtr><mtr><mtd>" |args| (QREFELT $ 8)
                        $)
                    "</mtd></mtr></mtable>")
              (QREFELT $ 30))
          $)
      $)) 

(DEFUN |MMLFORM;formatFunction| (|op| |args| |prec| $)
  (|MMLFORM;group|
      (SPADCALL
          (LIST "<mo>" |op| "</mo>"
                (|MMLFORM;parenthesize|
                    (|MMLFORM;formatNary| "," |args| (QREFELT $ 8) $)
                    $))
          (QREFELT $ 30))
      $)) 

(DEFUN |MMLFORM;formatNullary| (|op| $)
  (COND
    ((EQUAL |op| "NOTHING") "")
    ('T
     (|MMLFORM;group|
         (SPADCALL (LIST "<mo>" |op| "</mo><mo>(</mo><mo>)</mo>")
             (QREFELT $ 30))
         $)))) 

(DEFUN |MMLFORM;formatUnary| (|op| |arg| |prec| $)
  (PROG (|p| |opPrec| |s|)
    (RETURN
      (SEQ (LETT |p| (SPADCALL |op| (QREFELT $ 9) (QREFELT $ 53))
                 . #0=(|MMLFORM;formatUnary|))
           (EXIT (COND
                   ((< |p| 1) (|error| "unknown unary op"))
                   (#1='T
                    (SEQ (LETT |opPrec|
                               (SPADCALL (QREFELT $ 10) |p|
                                   (QREFELT $ 55)) . #0#)
                         (LETT |s|
                               (SPADCALL
                                   (LIST "<mo>" |op| "</mo>"
                                    (|MMLFORM;formatMml| |arg| |opPrec|
                                     $))
                                   (QREFELT $ 30)) . #0#)
                         (EXIT (COND
                                 ((< |opPrec| |prec|)
                                  (|MMLFORM;group|
                                      (|MMLFORM;parenthesize| |s| $) $))
                                 ((EQUAL |op| "-") |s|)
                                 (#1# (|MMLFORM;group| |s| $)))))))))))) 

(DEFUN |MMLFORM;formatBinary| (|op| |args| |prec| $)
  (PROG (|p| |opPrec| |la| |opa| |s1| |s2| |s|)
    (RETURN
      (SEQ (LETT |p| (SPADCALL |op| (QREFELT $ 11) (QREFELT $ 53))
                 . #0=(|MMLFORM;formatBinary|))
           (EXIT (COND
                   ((< |p| 1) (|error| "unknown binary op"))
                   (#1='T
                    (SEQ (LETT |opPrec|
                               (SPADCALL (QREFELT $ 12) |p|
                                   (QREFELT $ 55)) . #0#)
                         (COND
                           ((ATOM (|SPADfirst| |args|))
                            (LETT |opa|
                                  (|MMLFORM;stringify|
                                      (|SPADfirst| |args|) $) . #0#))
                           ('T
                            (SEQ (LETT |la| (|SPADfirst| |args|) . #0#)
                                 (EXIT (LETT |opa|
                                        (|MMLFORM;stringify|
                                         (|SPADfirst| |la|) $) . #0#)))))
                         (COND
                           ((OR (OR (OR (EQUAL |opa| "SIGMA")
                                     (EQUAL |opa| "SIGMA2"))
                                    (EQUAL |opa| "PI"))
                                (EQUAL |opa| "PI2"))
                            (COND
                              ((EQUAL |op| "**")
                               (LETT |s1|
                                     (SPADCALL
                                      (LIST "<mo>(</mo>"
                                       (|MMLFORM;formatMml|
                                        (|SPADfirst| |args|) |opPrec|
                                        $)
                                       "<mo>)</mo>")
                                      (QREFELT $ 30)) . #0#))
                              (#1#
                               (LETT |s1|
                                     (|MMLFORM;formatMml|
                                      (|SPADfirst| |args|) |opPrec| $) . #0#))))
                           (#1#
                            (LETT |s1|
                                  (|MMLFORM;formatMml|
                                      (|SPADfirst| |args|) |opPrec| $) . #0#)))
                         (LETT |s2|
                               (|MMLFORM;formatMml|
                                   (|SPADfirst| (CDR |args|)) |opPrec|
                                   $) . #0#)
                         (LETT |op|
                               (COND
                                 ((EQUAL |op| "|")
                                  (LETT |s|
                                        (SPADCALL
                                         (LIST "<mrow>" |s1|
                                          "</mrow><mo>" |op|
                                          "</mo><mrow>" |s2| "</mrow>")
                                         (QREFELT $ 30)) . #0#))
                                 ((EQUAL |op| "**")
                                  (LETT |s|
                                        (SPADCALL
                                         (LIST "<msup><mrow>" |s1|
                                          "</mrow><mrow>" |s2|
                                          "</mrow></msup>")
                                         (QREFELT $ 30)) . #0#))
                                 ((OR (EQUAL |op| "/")
                                      (EQUAL |op| "OVER"))
                                  (LETT |s|
                                        (SPADCALL
                                         (LIST "<mfrac><mrow>" |s1|
                                          "</mrow><mrow>" |s2|
                                          "</mrow></mfrac>")
                                         (QREFELT $ 30)) . #0#))
                                 ((OR (EQUAL |op| "+->") #1#)
                                  (LETT |s|
                                        (SPADCALL
                                         (LIST "<mrow>" |s1|
                                          "</mrow><mo>" |op|
                                          "</mo><mrow>" |s2| "</mrow>")
                                         (QREFELT $ 30)) . #0#))) . #0#)
                         (EXIT (|MMLFORM;group|
                                   (COND
                                     ((OR (EQUAL |op| "OVER") #1#) |s|))
                                   $)))))))))) 

(DEFUN |MMLFORM;formatNary| (|op| |args| |prec| $)
  (|MMLFORM;group| (|MMLFORM;formatNaryNoGroup| |op| |args| |prec| $)
      $)) 

(DEFUN |MMLFORM;formatNaryNoGroup| (|op| |args| |prec| $)
  (PROG (|p| |tmpS| |checkargs| |opPrec| |a| #0=#:G2028 |la| |opa| |l|
             |count| |s|)
    (RETURN
      (SEQ (LETT |checkargs| 'NIL . #1=(|MMLFORM;formatNaryNoGroup|))
           (EXIT (COND
                   ((NULL |args|) "")
                   (#2='T
                    (SEQ (LETT |p|
                               (SPADCALL |op| (QREFELT $ 13)
                                   (QREFELT $ 53)) . #1#)
                         (EXIT (COND
                                 ((< |p| 1)
                                  (|error| "unknown nary op"))
                                 (#2#
                                  (SEQ (COND
                                         ((< 1 (LENGTH |args|))
                                          (COND
                                            ((< 0
                                              (SPADCALL "ZAG"
                                               (|MMLFORM;stringify|
                                                (|SPADfirst|
                                                 (CDR |args|))
                                                $)
                                               1 (QREFELT $ 42)))
                                             (EXIT
                                              (SEQ
                                               (LETT |tmpS|
                                                (|MMLFORM;stringify|
                                                 (|SPADfirst| |args|)
                                                 $) . #1#)
                                               (EXIT
                                                (COND
                                                  ((< 0
                                                    (SPADCALL "ZAG"
                                                     |tmpS| 1
                                                     (QREFELT $ 42)))
                                                   (|MMLFORM;formatZag|
                                                    |args| $))
                                                  ('T
                                                   (SPADCALL
                                                    (LIST
                                                     (SPADCALL
                                                      (|MMLFORM;formatMml|
                                                       (|SPADfirst|
                                                        |args|)
                                                       (QREFELT $ 8) $)
                                                      (SPADCALL
                                                       "<mo>+</mo>"
                                                       (|MMLFORM;formatZag|
                                                        (CDR |args|) $)
                                                       (QREFELT $ 48))
                                                      (QREFELT $ 48)))
                                                    (QREFELT $ 30)))))))))))
                                       (LETT |op|
                                        (COND
                                          ((EQUAL |op| ",")
                                           "<mo>,</mo>")
                                          ((EQUAL |op| ";")
                                           "<mo>;</mo>")
                                          ((EQUAL |op| "*")
                                           (SEQ
                                            (LETT |checkargs| 'T . #1#)
                                            (EXIT "<mo>&#x02062;</mo>")))
                                          ((EQUAL |op| " ")
                                           "<mspace width='0.5em'/>")
                                          ((EQUAL |op| "ROW")
                                           "</mtd><mtd>")
                                          ((EQUAL |op| "+")
                                           (SEQ
                                            (LETT |checkargs| 'T . #1#)
                                            (EXIT "<mo>+</mo>")))
                                          ((EQUAL |op| "-")
                                           (SEQ
                                            (LETT |checkargs| 'T . #1#)
                                            (EXIT "<mo>-</mo>")))
                                          (#2# |op|)) . #1#)
                                       (LETT |l| NIL . #1#)
                                       (LETT |opPrec|
                                        (SPADCALL (QREFELT $ 14) |p|
                                         (QREFELT $ 55)) . #1#)
                                       (LETT |count| 1 . #1#)
                                       (SEQ (LETT |a| NIL . #1#)
                                        (LETT #0# |args| . #1#) G190
                                        (COND
                                          ((OR (ATOM #0#)
                                            (PROGN
                                              (LETT |a|
                                               (CAR #0#) . #1#)
                                              NIL))
                                           (GO G191)))
                                        (SEQ
                                         (COND
                                           (|checkargs|
                                            (COND
                                              ((< |count|
                                                (LENGTH |args|))
                                               (SEQ
                                                (COND
                                                  ((ATOM |a|)
                                                   (LETT |opa|
                                                    (|MMLFORM;stringify|
                                                     |a| $) . #1#))
                                                  ('T
                                                   (SEQ
                                                    (LETT |la|
                                                     |a| . #1#)
                                                    (EXIT
                                                     (LETT |opa|
                                                      (|MMLFORM;stringify|
                                                       (|SPADfirst|
                                                        |la|)
                                                       $) . #1#)))))
                                                (EXIT
                                                 (COND
                                                   ((OR
                                                     (OR
                                                      (OR
                                                       (EQUAL |opa|
                                                        "SIGMA")
                                                       (EQUAL |opa|
                                                        "SIGMA2"))
                                                      (EQUAL |opa|
                                                       "PI"))
                                                     (EQUAL |opa|
                                                      "PI2"))
                                                    (LETT |l|
                                                     (CONS |op|
                                                      (CONS
                                                       (SPADCALL
                                                        (LIST
                                                         "<mo>(</mo>"
                                                         (|MMLFORM;formatMml|
                                                          |a| |opPrec|
                                                          $)
                                                         "<mo>)</mo>")
                                                        (QREFELT $ 30))
                                                       |l|)) . #1#))
                                                   ('T
                                                    (LETT |l|
                                                     (CONS |op|
                                                      (CONS
                                                       (|MMLFORM;formatMml|
                                                        |a| |opPrec| $)
                                                       |l|)) . #1#))))))
                                              ('T
                                               (LETT |l|
                                                (CONS |op|
                                                 (CONS
                                                  (|MMLFORM;formatMml|
                                                   |a| |opPrec| $)
                                                  |l|)) . #1#))))
                                           ('T
                                            (LETT |l|
                                             (CONS |op|
                                              (CONS
                                               (|MMLFORM;formatMml| |a|
                                                |opPrec| $)
                                               |l|)) . #1#)))
                                         (EXIT
                                          (LETT |count|
                                           (+ |count| 1) . #1#)))
                                        (LETT #0# (CDR #0#) . #1#)
                                        (GO G190) G191 (EXIT NIL))
                                       (LETT |s|
                                        (SPADCALL (REVERSE (CDR |l|))
                                         (QREFELT $ 30)) . #1#)
                                       (EXIT
                                        (COND
                                          ((< |opPrec| |prec|)
                                           (|MMLFORM;parenthesize| |s|
                                            $))
                                          (#2# |s|))))))))))))))) 

(DEFUN |MMLFORM;formatZag| (|args| $)
  (PROG (|tmpZag| |op|)
    (RETURN
      (SEQ (LETT |tmpZag| (|SPADfirst| |args|)
                 . #0=(|MMLFORM;formatZag|))
           (EXIT (COND
                   ((< 1 (LENGTH |args|))
                    (SPADCALL "<mfrac>"
                        (SPADCALL
                            (|MMLFORM;formatMml|
                                (|SPADfirst| (CDR |tmpZag|))
                                (QREFELT $ 8) $)
                            (SPADCALL "<mrow><mn>"
                                (SPADCALL
                                    (|MMLFORM;formatMml|
                                     (|SPADfirst| (CDR (CDR |tmpZag|)))
                                     (QREFELT $ 8) $)
                                    (SPADCALL "</mn><mo>+</mo>"
                                     (SPADCALL
                                      (|MMLFORM;formatZag| (CDR |args|)
                                       $)
                                      "</mrow></mfrac>" (QREFELT $ 48))
                                     (QREFELT $ 48))
                                    (QREFELT $ 48))
                                (QREFELT $ 48))
                            (QREFELT $ 48))
                        (QREFELT $ 48)))
                   ((SPADCALL (|SPADfirst| |args|) "..."
                        (QREFELT $ 57))
                    "<mo>&#x2026;</mo>")
                   ('T
                    (SEQ (LETT |op|
                               (|MMLFORM;stringify|
                                   (|SPADfirst| |args|) $) . #0#)
                         (EXIT (COND
                                 ((< 0
                                     (SPADCALL "ZAG" |op| 1
                                      (QREFELT $ 42)))
                                  (SPADCALL "<mfrac>"
                                      (SPADCALL
                                       (|MMLFORM;formatMml|
                                        (|SPADfirst| (CDR |tmpZag|))
                                        (QREFELT $ 8) $)
                                       (SPADCALL
                                        (|MMLFORM;formatMml|
                                         (|SPADfirst|
                                          (CDR (CDR |tmpZag|)))
                                         (QREFELT $ 8) $)
                                        "</mfrac>" (QREFELT $ 48))
                                       (QREFELT $ 48))
                                      (QREFELT $ 48)))
                                 ('T
                                  (|error| (SPADCALL
                                            (SPADCALL
                                             "formatZag: Last argument in ZAG construct has unknown operator: "
                                             |op| (QREFELT $ 48))
                                            (QREFELT $ 58)))))))))))))) 

(DEFUN |MMLFORM;formatZag1| (|args| $)
  (PROG (|tmpZag|)
    (RETURN
      (SEQ (LETT |tmpZag| (|SPADfirst| |args|) |MMLFORM;formatZag1|)
           (EXIT (COND
                   ((< 1 (LENGTH |args|))
                    (SPADCALL "<mfrac>"
                        (SPADCALL
                            (|MMLFORM;formatMml|
                                (|SPADfirst| (CDR |tmpZag|))
                                (QREFELT $ 8) $)
                            (SPADCALL "<mrow><mn>"
                                (SPADCALL
                                    (|MMLFORM;formatMml|
                                     (|SPADfirst| (CDR (CDR |tmpZag|)))
                                     (QREFELT $ 8) $)
                                    (SPADCALL "</mn><mo>+</mo>"
                                     (SPADCALL
                                      (|MMLFORM;formatZag| (CDR |args|)
                                       $)
                                      "</mrow></mfrac>" (QREFELT $ 48))
                                     (QREFELT $ 48))
                                    (QREFELT $ 48))
                                (QREFELT $ 48))
                            (QREFELT $ 48))
                        (QREFELT $ 48)))
                   ((SPADCALL (|SPADfirst| |args|) "..."
                        (QREFELT $ 57))
                    "<mo>&#x2026;</mo>")
                   ('T (|error| "formatZag1: Unexpected kind of ZAG")))))))) 

(DEFUN |MMLFORM;formatMml| (|expr| |prec| $)
  (PROG (|intSplitLen| |len| |nstr| |str| |i| |l| |args| |nargs| |op|)
    (RETURN
      (SEQ (LETT |intSplitLen| 20 . #0=(|MMLFORM;formatMml|))
           (EXIT (COND
                   ((ATOM |expr|)
                    (SEQ (LETT |str|
                               (|MMLFORM;stringify| |expr| $) . #0#)
                         (LETT |len| (QCSIZE |str|) . #0#)
                         (EXIT (COND
                                 ((FIXP |expr|)
                                  (SEQ (LETT |i| |expr| . #0#)
                                       (EXIT
                                        (COND
                                          ((OR (< |i| 0) (< 9 |i|))
                                           (|MMLFORM;group|
                                            (SEQ (LETT |nstr| "" . #0#)
                                             (SEQ G190
                                              (COND
                                                ((NULL
                                                  (< |intSplitLen|
                                                   (LETT |len|
                                                    (QCSIZE |str|) . #0#)))
                                                 (GO G191)))
                                              (SEQ
                                               (LETT |nstr|
                                                (SPADCALL
                                                 (LIST |nstr| " "
                                                  (SPADCALL |str|
                                                   (SPADCALL 1
                                                    |intSplitLen|
                                                    (QREFELT $ 34))
                                                   (QREFELT $ 35)))
                                                 (QREFELT $ 30)) . #0#)
                                               (EXIT
                                                (LETT |str|
                                                 (SPADCALL |str|
                                                  (SPADCALL
                                                   (+ |intSplitLen| 1)
                                                   (QREFELT $ 59))
                                                  (QREFELT $ 35)) . #0#)))
                                              NIL (GO G190) G191
                                              (EXIT NIL))
                                             (EXIT
                                              (COND
                                                ((SPADCALL |nstr|
                                                  (QREFELT $ 60))
                                                 (SPADCALL
                                                  (LIST "<mn>" |str|
                                                   "</mn>")
                                                  (QREFELT $ 30)))
                                                ('T
                                                 (SEQ
                                                  (LETT |nstr|
                                                   (COND
                                                     ((SPADCALL |str|
                                                       (QREFELT $ 60))
                                                      |nstr|)
                                                     ('T
                                                      (SPADCALL
                                                       (LIST |nstr| " "
                                                        |str|)
                                                       (QREFELT $ 30)))) . #0#)
                                                  (EXIT
                                                   (SPADCALL
                                                    (LIST "<mn>"
                                                     (SPADCALL |nstr|
                                                      (SPADCALL 2
                                                       (QREFELT $ 59))
                                                      (QREFELT $ 35))
                                                     "</mn>")
                                                    (QREFELT $ 30))))))))
                                            $))
                                          ('T
                                           (LETT |str|
                                            (SPADCALL
                                             (LIST "<mn>" |str|
                                              "</mn>")
                                             (QREFELT $ 30)) . #0#))))))
                                 ((EQUAL |str| "%pi")
                                  "<mi>&#x003C0;</mi>")
                                 ((EQUAL |str| "%e")
                                  "<mi>&#x02147;</mi>")
                                 ((EQUAL |str| "%i")
                                  "<mi>&#x02148;</mi>")
                                 ('T
                                  (SEQ (COND
                                         ((< 0 |len|)
                                          (COND
                                            ((SPADCALL
                                              (SPADCALL |str| 1
                                               (QREFELT $ 37))
                                              (SPADCALL "%"
                                               (QREFELT $ 43))
                                              (QREFELT $ 44))
                                             (EXIT
                                              (STRCONC
                                               (STRCONC "<mi>" |str|)
                                               "</mi>"))))))
                                       (COND
                                         ((< 1 |len|)
                                          (COND
                                            ((SPADCALL
                                              (SPADCALL |str| 1
                                               (QREFELT $ 37))
                                              (QREFELT $ 61))
                                             (EXIT
                                              (SPADCALL
                                               (LIST "<mn>" |str|
                                                "</mn>")
                                               (QREFELT $ 30)))))))
                                       (COND
                                         ((< 0 |len|)
                                          (COND
                                            ((SPADCALL
                                              (SPADCALL |str| 1
                                               (QREFELT $ 37))
                                              (SPADCALL "\""
                                               (QREFELT $ 43))
                                              (QREFELT $ 44))
                                             (EXIT
                                              (STRCONC
                                               (STRCONC "<mtext>"
                                                |str|)
                                               "</mtext>"))))))
                                       (COND
                                         ((EQL |len| 1)
                                          (COND
                                            ((SPADCALL
                                              (SPADCALL |str| 1
                                               (QREFELT $ 37))
                                              (SPADCALL " "
                                               (QREFELT $ 43))
                                              (QREFELT $ 44))
                                             (EXIT " ")))))
                                       (LETT |i|
                                        (SPADCALL |str| (QREFELT $ 19)
                                         (QREFELT $ 53)) . #0#)
                                       (EXIT
                                        (COND
                                          ((< 0 |i|)
                                           (SPADCALL (QREFELT $ 20) |i|
                                            (QREFELT $ 52)))
                                          ('T
                                           (SEQ
                                            (LETT |i|
                                             (SPADCALL
                                              (SPADCALL " "
                                               (QREFELT $ 43))
                                              |str| (QREFELT $ 62)) . #0#)
                                            (EXIT
                                             (COND
                                               ((< 0 |i|)
                                                (STRCONC
                                                 (STRCONC "<mtext>"
                                                  |str|)
                                                 "</mtext>"))
                                               ('T
                                                (SPADCALL
                                                 (LIST "<mi>" |str|
                                                  "</mi>")
                                                 (QREFELT $ 30)))))))))))))))
                   ('T
                    (SEQ (LETT |l| |expr| . #0#)
                         (EXIT (COND
                                 ((NULL |l|) (QREFELT $ 6))
                                 ('T
                                  (SEQ (LETT |op|
                                        (|MMLFORM;stringify|
                                         (|SPADfirst| |l|) $) . #0#)
                                       (LETT |args| (CDR |l|) . #0#)
                                       (LETT |nargs|
                                        (LENGTH |args|) . #0#)
                                       (EXIT
                                        (COND
                                          ((< 0
                                            (SPADCALL "SUPERSUB" |op| 1
                                             (QREFELT $ 42)))
                                           (|MMLFORM;formatSuperSub|
                                            (|SPADfirst| |l|) |args|
                                            (QREFELT $ 8) $))
                                          ((< 0
                                            (SPADCALL "SUB" |op| 1
                                             (QREFELT $ 42)))
                                           (|MMLFORM;formatSub1|
                                            (|SPADfirst| |l|) |args|
                                            (QREFELT $ 8) $))
                                          ((SPADCALL |op|
                                            (QREFELT $ 18)
                                            (QREFELT $ 63))
                                           (|MMLFORM;formatSpecial|
                                            |op| |args| |prec| $))
                                          ((SPADCALL |op|
                                            (QREFELT $ 16)
                                            (QREFELT $ 63))
                                           (|MMLFORM;formatPlex| |op|
                                            |args| |prec| $))
                                          ((EQL 0 |nargs|)
                                           (|MMLFORM;formatNullary|
                                            |op| $))
                                          ('T
                                           (SEQ
                                            (COND
                                              ((EQL 1 |nargs|)
                                               (COND
                                                 ((SPADCALL |op|
                                                   (QREFELT $ 9)
                                                   (QREFELT $ 63))
                                                  (EXIT
                                                   (|MMLFORM;formatUnary|
                                                    |op|
                                                    (|SPADfirst|
                                                     |args|)
                                                    |prec| $))))))
                                            (COND
                                              ((EQL 2 |nargs|)
                                               (COND
                                                 ((SPADCALL |op|
                                                   (QREFELT $ 11)
                                                   (QREFELT $ 63))
                                                  (EXIT
                                                   (|MMLFORM;formatBinary|
                                                    |op| |args| |prec|
                                                    $))))))
                                            (EXIT
                                             (COND
                                               ((SPADCALL |op|
                                                 (QREFELT $ 15)
                                                 (QREFELT $ 63))
                                                (|MMLFORM;formatNaryNoGroup|
                                                 |op| |args| |prec| $))
                                               ((SPADCALL |op|
                                                 (QREFELT $ 13)
                                                 (QREFELT $ 63))
                                                (|MMLFORM;formatNary|
                                                 |op| |args| |prec| $))
                                               ('T
                                                (SEQ
                                                 (LETT |op|
                                                  (|MMLFORM;formatMml|
                                                   (|SPADfirst| |l|)
                                                   (QREFELT $ 8) $) . #0#)
                                                 (EXIT
                                                  (|MMLFORM;formatFunction|
                                                   |op| |args| |prec|
                                                   $)))))))))))))))))))))) 

(DEFUN |MathMLFormat| ()
  (PROG ()
    (RETURN
      (PROG (#0=#:G2067)
        (RETURN
          (COND
            ((LETT #0# (HGET |$ConstructorCache| '|MathMLFormat|)
                   . #1=(|MathMLFormat|))
             (|CDRwithIncrement| (CDAR #0#)))
            ('T
             (UNWIND-PROTECT
               (PROG1 (CDDAR (HPUT |$ConstructorCache| '|MathMLFormat|
                                   (LIST
                                    (CONS NIL
                                     (CONS 1 (|MathMLFormat;|))))))
                 (LETT #0# T . #1#))
               (COND
                 ((NOT #0#) (HREM |$ConstructorCache| '|MathMLFormat|))))))))))) 

(DEFUN |MathMLFormat;| ()
  (PROG (|dv$| $ |pv$|)
    (RETURN
      (PROGN
        (LETT |dv$| '(|MathMLFormat|) . #0=(|MathMLFormat|))
        (LETT $ (GETREFV 65) . #0#)
        (QSETREFV $ 0 |dv$|)
        (QSETREFV $ 3 (LETT |pv$| (|buildPredVector| 0 0 NIL) . #0#))
        (|haddProp| |$ConstructorCache| '|MathMLFormat| NIL (CONS 1 $))
        (|stuffDomainSlots| $)
        (QSETREFV $ 6 " \\  ")
        (QSETREFV $ 7 1000000)
        (QSETREFV $ 8 0)
        (QSETREFV $ 9 (LIST "-"))
        (QSETREFV $ 10 '(700))
        (QSETREFV $ 11 (LIST "+->" "|" "**" "/" "<" ">" "=" "OVER"))
        (QSETREFV $ 12 (LIST 0 0 900 700 400 400 400 700))
        (QSETREFV $ 13
            (LIST "-" "+" "*" (QREFELT $ 6) "," ";" " " "ROW" ""
                  " \\cr " "&" "</mtd></mtr><mtr><mtd>"))
        (QSETREFV $ 14 (LIST 700 700 800 800 110 110 0 0 0 0 0 0))
        (QSETREFV $ 15 (LIST "ROW" "&"))
        (QSETREFV $ 16
            (LIST "SIGMA" "SIGMA2" "PI" "PI2" "INTSIGN"
                  "INDEFINTEGRAL"))
        (QSETREFV $ 17 '(700 800 700 800 700 700))
        (QSETREFV $ 18
            (LIST "MATRIX" "BRACKET" "BRACE" "CONCATB" "VCONCAT"
                  "AGGLST" "CONCAT" "OVERBAR" "ROOT" "SUB" "TAG"
                  "SUPERSUB" "ZAG" "AGGSET" "SC" "PAREN" "SEGMENT"
                  "QUOTE" "theMap"))
        (QSETREFV $ 19
                  (LIST "cos" "cot" "csc" "log" "sec" "sin" "tan"
                        "cosh" "coth" "csch" "sech" "sinh" "tanh"
                        "acos" "asin" "atan" "erf" "..." "$" "infinity"
                        "Gamma"))
        (QSETREFV $ 20
            (LIST "<mo>cos</mo>" "<mo>cot</mo>" "<mo>csc</mo>"
                  "<mo>log</mo>" "<mo>sec</mo>" "<mo>sin</mo>"
                  "<mo>tan</mo>" "<mo>cosh</mo>" "<mo>coth</mo>"
                  "<mo>csch</mo>" "<mo>sech</mo>" "<mo>sinh</mo>"
                  "<mo>tanh</mo>" "<mo>arccos</mo>" "<mo>arcsin</mo>"
                  "<mo>arctan</mo>" "<mo>erf</mo>" "<mo>&#x2026;</mo>"
                  "<mo>$</mo>" "<mo>&#x221E;</mo>" "<mo>&#x0413;</mo>"))
        $)))) 

(MAKEPROP '|MathMLFormat| '|infovec|
    (LIST '#(NIL NIL NIL NIL NIL NIL '|blank| '|maxPrec| '|minPrec|
             '|unaryOps| '|unaryPrecs| '|binaryOps| '|binaryPrecs|
             '|naryOps| '|naryPrecs| '|naryNGOps| '|plexOps|
             '|plexPrecs| '|specialOps| '|specialStrings|
             '|specialStringsInMML| (|String|) (|OutputForm|)
             |MMLFORM;coerce;OfS;1| |MMLFORM;coerceS;OfS;2|
             |MMLFORM;coerceL;OfS;3| (|Void|) (0 . |void|)
             |MMLFORM;display;SV;4| (|List| $) (4 . |concat|)
             |MMLFORM;exprex;OfS;5| (|Integer|) (|UniversalSegment| 32)
             (9 . |segment|) (15 . |elt|) (|Character|) (21 . |elt|)
             (|CharacterClass|) (27 . |lowerCase|) (|Boolean|)
             (31 . |member?|) (37 . |position|) (44 . |char|) (49 . =)
             (|List| 22) (55 . |list|) (60 . |second|) (65 . |elt|)
             (|List| 21) (71 . |list|) (76 . |elt|) (82 . |elt|)
             (88 . |position|) (|List| 32) (94 . |elt|) (100 . |last|)
             (105 . =) (111 . |coerce|) (116 . |segment|)
             (121 . |empty?|) (126 . |digit?|) (131 . |position|)
             (137 . |member?|) (|SingleInteger|))
          '#(~= 143 |latex| 149 |hash| 154 |exprex| 159 |display| 164
             |coerceS| 169 |coerceL| 174 |coerce| 179 = 189)
          'NIL
          (CONS (|makeByteWordVec2| 1 '(0 0 0))
                (CONS '#(|SetCategory&| |BasicType&| NIL)
                      (CONS '#((|SetCategory|) (|BasicType|)
                               (|CoercibleTo| 22))
                            (|makeByteWordVec2| 64
                                '(0 26 0 27 1 21 0 29 30 2 33 0 32 32
                                  34 2 21 0 0 33 35 2 21 36 0 32 37 0
                                  38 0 39 2 38 40 36 0 41 3 21 32 0 0
                                  32 42 1 36 0 21 43 2 36 40 0 0 44 1
                                  45 0 22 46 1 45 22 0 47 2 21 0 0 0 48
                                  1 49 0 21 50 2 45 22 0 32 51 2 49 21
                                  0 32 52 2 49 32 21 0 53 2 54 32 0 32
                                  55 1 45 22 0 56 2 22 40 0 0 57 1 21
                                  22 0 58 1 33 0 32 59 1 21 40 0 60 1
                                  36 40 0 61 2 21 32 36 0 62 2 49 40 21
                                  0 63 2 0 40 0 0 1 1 0 21 0 1 1 0 64 0
                                  1 1 0 21 22 31 1 0 26 21 28 1 0 21 22
                                  24 1 0 21 22 25 1 0 21 22 23 1 0 22 0
                                  1 2 0 40 0 0 1)))))
          '|lookupComplete|)) 

(MAKEPROP '|MathMLFormat| 'NILADIC T) 
