Hi Robert,
I did miss this very interesting effort of user-defined TeX output
when it was posted last year.
I noticed this just recently and tried it along with Imaxima which
uses latex to render the output of Maixma in Emacs.
It worked great!! Imaxima is benefitted from this extension
since the tex output associted with a function is generated when
in imaxima, and the expression is rendered as intended!!
Here is the simplest example that I created:
dsum(e, v, n) := block([dlist],
if not(numberp(n)) then
apply(nounify(dsum),[e,v,n])
else
apply(lsum,[e,v,listify(divisors(n))]));
tex_dsum (e) := concat("\\sum_{{", tex1(second(e)), "} | {",
tex1(third(e)), "}}{", tex1(first(e)), "}")$
texput(nounify(dsum), tex_dsum);
The following pdf file captured an imaxima session which demonstrates
this used-defined TeX output with above divisor sum example.
http://members3.jcom.home.ne.jp/imaxima/imax.pdf
Yasuaki Honda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: imax.pdf
Type: application/pdf
Size: 24552 bytes
Desc: not available
Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20090110/2b054bed/attachment-0001.pdf
-------------- next part --------------
On 2008/12/22, at 7:04, Robert Dodier wrote:
> Hello,
>
> there was a question about user-defined TeX output a few months ago.
> I've come up a modification to the existing texput function such that
> texput(foo, texfoo) calls a Maxima function texfoo to generate the TeX
> output for operator foo.
>
> Seem to work OK. See PS below for a batch script and the attached
> png image for the output as rendered by latex + xdvi.
>
> Comments?
>
> Robert Dodier
>
> PS.
> S : openw ("/tmp/texfoo.tex");
> printf (S, "\\documentclass{article}~%");
> printf (S, "\\begin{document}~%");
>
> tex_foo (e) := concat ("\\Phi_{\\upsilon}\\left(", tex1 (first (e)),
> "\\right)");
> texput (foo, tex_foo);
> tex (foo (1), S);
> tex (foo (foo (1)), S);
> tex (a + 1 + foo (2) / foo (3), S);
>
> tex_if (e):= block ([L : args (e)], concat
> ("\\left\\{\\begin{array}{ll}", tex1 (L[2]), "&", tex1 (L[1]), "\\\\",
> tex1 (L[4]), "&\\mbox{otherwise}\\end{array}\\right."));
> texput (verbify ("if"), tex_if);
> texput (nounify ("if"), tex_if);
> tex (if x > 0 then sin(x) else cos(x), S);
> tex (if x > 0 then sin(x) else if x < 0 then cos(x) else 0, S);
>
> tex_diff (e) := block ([a, b, c], [a, b, c] : args (e),
> concat ("{\\partial^", tex1 (c), "\\over\\partial ", tex1 (b),
> "^", tex1 (c), "}", tex1 (a)));
> texput (nounify (diff), tex_diff);
> tex ('diff (foo (w), w), S);
>
> tex_integrate (e) := block ([a, b, c, d], [a, b, c, d] : args (e),
> concat ("\\int_{", tex1 (c), "}^{", tex1 (d), "}", tex1 (a), "
> d\\!", tex1 (b)));
> texput (nounify (integrate), tex_integrate);
> tex ('integrate (sin(u) / exp(u), u, 0, inf), S);
>
> tex ('if n > 0 then 'diff (foo (z), z, 3) else 'integrate (foo (z), z,
> 0, 2*%pi), S);
>
> printf (S, "\\end{document}~%");
> close (S);
> <texfoo.png><mactex.lisp-texput-
> patch>_______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima