On 8/21/07, Peter Gustafson <petegus at spaceshipone.engin.umich.edu> wrote:
> foo(x):=x$
> tex('foo(x)=foo(x))$
>
> Ideally, this would output:
>
> $$\mathrm{foo}\left(x\right)=x$$
>
> or similar based on the above environment.
Pete, the TeX environment stuff, as it was presented, doesn't
affect the stuff inside the environment (instead it affects only
the environment itself e.g. $$ vs \begin{equation}).
At present (Maxima 5.12.99rc2) I get the following output.
foo(x):=x$
tex('foo(x)=foo(x))$
=> $${\it foo}\left(x\right)=x$$
Dunno if that is close enough.
> Also, what about doing:
> texput(foo(x),"\alpha\left(x\right)")$
> foo(x):=x$
> tex('foo(x)=foo(x))$
>
> By intent, this would output:
>
> $$\alpha\left(x\right)=x$$
How about
texput (nounify (foo), "\\alpha");
foo(x) := x;
tex ('foo(x) = foo(x));
=> $$\alpha\left(x\right)=x$$
The nounify(foo) is a little obscure.
> Most of my output that goes into tex format is for general consumption.
> It does not require (perhaps should not have) a maxima like structure.
Maybe it is enough to substitute "=" for ":=" and run the result through tex.
baz(x) := sin(x) + cos(x);
fundef (baz);
=> baz(x) := sin(x) + cos(x)
subst ("=", ":=", fundef (baz));
=> baz(x) = sin(x) + cos(x)
tex (subst ("=", ":=", fundef (baz)));
=> $${\it baz}\left(x\right)=\sin x+\cos x$$
Handling that in a less clumsy way involves Lisp programming
at present. Probably it should be possible to customize tex
output via Maxima programming.
Hope this helps,
Robert Dodier