Here is utility that provides a maxima level interface to
putprop. Specifically, texput allows a user to change
the behavior of maxima's tex function.
--------start of file--------------------------------------
(defun $texput (e str1 &optional str2)
(cond ((mstringp e)
(setq e (define-symbol (string-left-trim '(#\&) e)))))
(setq str1 (stripdollar str1))
(cond ((null str2)
(putprop e str1 'texword))
(t
(putprop e 'tex-matchfix 'tex)
(setq str2 (stripdollar str2))
(putprop e (list (list str1) str2) 'texsym))))
--------end of file------------------------------------------
A few examples.
(C1) load("e:/mactex_utility.lisp")$
Loading e:/mactex_utility.lisp
Finished loading e:/mactex_utility.lisp
/* tex mue tex as "\mu_e", etc */
(C2) texput(mue, "\\mu_e")$
(C3) texput(e, "\\mathbf{E}")$
(C4) texput(b, "\\mathbf{B}")$
/* Let's try it */
(C5) tex([mue,e,b,e.b]);
$$\left[ \mu_e,\mathbf{E},\mathbf{B},\mathbf{E}\cdot \mathbf{B} \right] $$
(D5) FALSE
/* Define a matchfix operator || and tex it as \|. To do this,
use three arguments to texput
*/
(C6) matchfix("||","||")$
(C7) texput("||","\\|","\\|")$
(C8) tex(|| e + b ||);
$$\|\mathbf{E}+\mathbf{B}\|$$
(D8) FALSE
/* One more time. Before texput */
(C9) matchfix("<<",">>")$
(C10) tex(<<x,y>>);
$$<<\left(x,y\right)$$
(D10) FALSE
(C11) texput("<<","\\langle ", " \\rangle ")$
/* after texput */
(C12) tex(<<x,y>>);
$$\langle x,y \rangle $$
(D12) FALSE
(C13) tex(<<x>>);
$$\langle x \rangle $$
(D13) FALSE
1. I wrote this function this morning; it hasn't been thoroughly
tested. Let me know if you see any problems with it.
2. Commercial Macsyma used qput to do the same thing; it seemed
to me that I'd have to modify mactex.lisp in a handful of
places to use qput in this way.
3. If you find this function useful you can either put it in
mactex.lisp and re-compile mactex or you put it in your
maxima-intial.lisp file. If you don't have a maxima-init.lisp
file, get one by hacking your macsys.lisp file according to
http://www.math.utexas.edu/pipermail/maxima/2002/001245.html
Barton