Some of these suggestions are probably harmless, though they are examples of
na?ve programming. Some are wrong. For example, using TeX's equation mode
for Maxima programs is wrong.
Consider foo(x):=sin(x)^12.
To make it correct, foo would have to be set in Roman, probably; maybe in
bold. Not as individual math italic letters; sin would have to be set as
\sin in Roman font, and the exponent of 12 would have to be in {} else it
would look like sin(x)^1 * 2.
It is possible that the "grind" functionality could be changed to work with
TeX, but a person doing that would have to understand the Lisp program.
And it is not clear that this is of much value.
As for expressing a preference for \frac rather than \over, it seems that
there is no benefit, and maybe a disadvantage in that (I think) plain TeX
has no |frac.
Not everyone uses LaTeX. Same for $$ vs \begin{equation}.
So while it is great to have free labor, it is not so great when the free
labor consists of inserting gratuitous incompatibilities, bad coding
practice, and errors. Maybe there is something different that Ryan can look
at that would represent a chance to make some progress.
RJF
-----Original Message-----
From: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu]
On Behalf Of Ryan Krauss
Sent: Monday, August 20, 2007 1:15 PM
To: Robert Dodier
Cc: maxima list
Subject: Re: [Maxima] Another question about tex output.
Sorry, I have been away for a while.
This sounds like a big step in the right direction. I think I really like
it.
I don't know what the current output is for matrices and fractions.
Those were two big ones that I had to parse into something more
Latex-ish when I wrote my python code to do semi-auto latex/maxima
(%i21) tex(3/5);
$${{3}\over{5}}$$
I would prefer \frac{3}{5}, but that is fairly minor compared to what
you have already done.
Ryan
On 7/22/07, Robert Dodier <robert.dodier at gmail.com> wrote:
> On 7/12/07, Ryan Krauss <ryanlists at gmail.com> wrote:
>
> > I really two aspects of Robert's proposal:
> > 1. being able to customized TEX-ENVIRONMENT so I could set mine to
> > \begin{equation}...\end{equation}
> > 2. I really like the idea of being able to output comments that don't
> > get put in an environment - I like to add comments to any derivation
> > or symbolic work so that I can make sense of it later or copy and
> > paste it into a publication.
>
> OK, I've made some modifications to src/mactex.lisp (not
> yet committed) to change the TeX environment.
> Now the following outputs are obtained.
>
> load (stringproc); /* need some stuff for these examples */
>
> (1) Change environment for general expressions to \begin{equation} ...
> \end{equation}
>
> get_tex_environment_default ();
> => [$$, $$]
> tex (sin(x) + cos(y));
> => $$\cos y+\sin x$$
> set_tex_environment_default
> (concat (newline, "\\begin{equation}", newline),
> concat (newline, "\\end{equation}", newline));
> tex (sin(x) + cos(y));
> =>
> \begin{equation}
> \cos y+\sin x
> \end{equation}
>
>
> (2) Change environment for functions from verbatim to equation
>
> get_tex_environment (":=");
> => [$$, $$]
> tex (foo(x) := sin(x)^3);
> =>
> \begin{verbatim}
> foo(x):=sin(x)^3;
> \end{verbatim}
> set_tex_environment (":=", "$$", "$$");
> tex (foo(x) := sin(x)^3);
> => $$foo(x):=sin(x)^3$$
>
>
> (3) Change environment for plain text to nothing. Also,
> suppress the paragraph operator (the operator just
> carries the TeX environment property on behalf of the text).
>
> get_tex_environment (paragraph);
> => [$$, $$]
> tex (paragraph ("A guy walks into a bar."));
> => $${\it paragraph}\left(\mbox{{}A guy walks into a bar.{}}\right)$$
> set_tex_environment (paragraph, newline, newline);
> :lisp (defun tex-paragraph (x l r) (append l (list (l-string (cadr x)))
r))
> :lisp (setf (get '$paragraph 'tex) 'tex-paragraph)
> tex (paragraph ("A guy walks into a bar."));
> =>
> A guy walks into a bar.
>
>
> This stuff is implemented by introducing a new property,
> TEX-ENVIRONMENT, which specifies the TeX environment
> if present, and otherwise *TEX-ENVIRONMENT-DEFAULT* is
> assumed. TEX-ENVIRONMENT is assigned to a few symbols
> (only MDEFINE, MDEFMACRO, and MLABLE at present
> because these were treated specially by TEX1 already).
>
> The user interface to maintain TEX-ENVIRONMENT comprises these functions:
> get_tex_environment_default ()
> set_tex_environment_default (env_open, env_close)
> get_tex_environment (x)
> set_tex_environment (x, env_open, env_close)
>
> Comments?
>
> best
> Robert Dodier
>
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima