1
2;; Additional mactex utilities.
3;; All functions are based on code by Richard J. Fateman, copyright 1987.
4;; Fateman's code was ported to Common Lisp by William Schelter.
5
6;; If you want LaTeX style quotients, first load mactex and second
7;; define tex-mquotient as follows
8
9(defun tex-mquotient (x l r)
10  (if (or (null (cddr x)) (cdddr x)) (wna-err (caar x)))
11  (setq l (tex (cadr x) (append l '("\\frac{")) nil 'mparen 'mparen)
12	r (tex (caddr x) (list "}{") (append '("}") r) 'mparen 'mparen))
13  (append l r))
14
15;; (defprop mtimes ("\\,") texsym)
16;; adds a thin space.
17;; The following tells TeX to use whatever it thinks best.
18;; (defprop mtimes (" ") texsym)
19
20;; To use amsmath style matrices, define tex-matrix as
21;; (to TeX the code, you'll need to \usepackage{amsmath})
22
23(defun tex-matrix (x l r) ;; matrix looks like ((mmatrix)((mlist) a b) ...)
24  (append l `("\\begin{pmatrix}")
25	 (mapcan #'(lambda(y)
26			  (tex-list (cdr y) nil (list " \\\\ ") " & "))
27		 (cdr x))
28	 '("\\end{pmatrix}") r))
29
30