Discussion:
export tex format
(too old to reply)
Daniel Malik
2005-12-11 00:05:15 UTC
Permalink
the command :
tex(f,"f\:\\MATH\\maxima\\totomax\.tex"); give good result : the file
totomax.tex exist with the good tex lines

myfile:\"f\:\\MATH\\maxima\\totomax\.tex\";
or myfile:\"f\\\:\\\\MATH\\\\maxima\\\\totomax\\\.tex\";

and
tex(f,myfile);

give result false in the command line of maxima, but the file does not
exist of the harddisk !

I run with Windows XP !

Thank's for help

Daniel
Robert Dodier
2005-12-11 00:56:54 UTC
Permalink
hello daniel,
Post by Daniel Malik
tex(f,"f\:\\MATH\\maxima\\totomax\.tex"); give good result : the file
totomax.tex exist with the good tex lines
myfile:\"f\:\\MATH\\maxima\\totomax\.tex\";
or myfile:\"f\\\:\\\\MATH\\\\maxima\\\\totomax\\\.tex\";
and
tex(f,myfile);
give result false in the command line of maxima, but the file does not
exist of the harddisk !
tex is quoting (i.e., not evaluating) the file name.
so tex writes a file literally named "myfile".

try this:

tex (expr, ''myfile);

or this:

apply (tex, [expr, myfile]);

in both cases, the variable myfile is evaluated (yielding the file name).

note: '' in the first example is two single-quote characters.

hope this helps,
robert dodier
Paul RIVIER
2005-12-11 10:17:47 UTC
Permalink
hi there,
I take this opportunity to ask you if there is a work in progress to
include a latex export as well.
Few weeks ago, I went in the code of the current Tex lisp file to have a
look, and while I am absolutly not a lisp programmer, that seemed me ok
to start from this file to write a latex exporter. Actually, I find the
latex syntax is more attractive and widely used. The proprietary CAS
maple handles latex export as well. So if there is in this area a good
lisp programmer, I can try to write a short document about how to
convert tex syntax into latex syntax, in the form for exemple of :

{{a} \over {b}} ---------------> \frac{a}{b}
and so on ...

What I would like to avoid is to add a layer using regexp. A plain latex
implementation would be cleaner, but I do not have the lisp skills for
that :)

Regards

Paul
Post by Daniel Malik
tex(f,"f\:\\MATH\\maxima\\totomax\.tex"); give good result : the file
totomax.tex exist with the good tex lines
myfile:\"f\:\\MATH\\maxima\\totomax\.tex\";
or myfile:\"f\\\:\\\\MATH\\\\maxima\\\\totomax\\\.tex\";
and
tex(f,myfile);
give result false in the command line of maxima, but the file does not
exist of the harddisk !
I run with Windows XP !
Thank's for help
Daniel
_______________________________________________
Maxima mailing list
http://www.math.utexas.edu/mailman/listinfo/maxima
Richard Fateman
2005-12-11 16:35:53 UTC
Permalink
1. Since LaTex allows TeX syntax as well, there is no need to
change \over to \frac for use by LaTex. The only reason to
do this is if humans are going to read and edit the output.


2. If you insist on preferring \frac to \over, then you do
not need an expert lisp programmer. You are right
to start with the mactex code. You could learn enough
lisp in one week to change it. You should
probably write out your list of rules first.

3. It is absolutely the wrong thing to do to write a
TeX to LaTex translator in a separate step. It would require
writing a parser for TeX!

So far as I know, the only changes are
\over to \frac
$
$$
and perhaps something to do with matrices.

The real problem in matrices is that except for very small ones,
they cannot be displayed this way, and should be reformatted,
perhaps in blocks.

So the changes are not large.
I do not know if everyone uses latex though, so the existing
code should continue to work.

RJF
Post by Paul RIVIER
hi there,
I take this opportunity to ask you if there is a work in progress to
include a latex export as well.
Few weeks ago, I went in the code of the current Tex lisp file to have a
look, and while I am absolutly not a lisp programmer, that seemed me ok
to start from this file to write a latex exporter. Actually, I find the
latex syntax is more attractive and widely used. The proprietary CAS
maple handles latex export as well. So if there is in this area a good
lisp programmer, I can try to write a short document about how to
{{a} \over {b}} ---------------> \frac{a}{b}
and so on ...
Robert Dodier
2005-12-11 16:51:28 UTC
Permalink
Post by Paul RIVIER
I take this opportunity to ask you if there is a work in progress to
include a latex export as well.
not so far as i know.
Post by Paul RIVIER
I can try to write a short document about how to
{{a} \over {b}} ---------------> \frac{a}{b}
and so on ...
i think that would be very useful, although i can't make
any promises about when we'll make use of it to
program some new functions.

i wonder how we could allow the user to choose tex vs
latex vs amstex. i can see two options --
(1) create new functions latex and amstex,
then the user calls tex (a + b) or latex (a + b) or amstex (a + b)
to process appropriately for different packages.
(2) invent a global variable, say tex_flavor, and set
it to 'tex, 'latex, or 'amstex, without any new functions.
the user always writes tex (a + b) .

i'm in favor of (2), i think, since it would allow switching
between flavors without changing all the function calls.

hope this helps,
robert dodier

Barton Willis
2005-12-11 12:23:37 UTC
Permalink
-----Paul RIVIER wrote: -----
Post by Paul RIVIER
I take this opportunity to ask you if there is a
work in progress to include a latex export as well.
I don't know of anybody that is working on this.
To generate LaTeX output for fractions and matrices,
load 'mactex-utilities':

(%i1) load("mactex-utilities")$
(%i2) tex(a/b);
$$\frac{a}{b}$$
(%o2) false

(%i3) tex(matrix([1,2],[3,4]));
$$\begin{pmatrix}1 & 2 \\ 3 & 4 \\ \end{pmatrix}$$
(%o3) false

Barton
Ryan Krauss
2005-12-11 15:44:31 UTC
Permalink
I think this would be very valuable.

I have written a regexp based python script to convert fractions and
matrices from TeX to LaTeX if anyone is interested. It is actually
part of a package that I wrote that allows you to embedded Maxima in a
LaTeX document so that you can explain your derivation as you go
along. Python looks for environments like
\begin{maxima}
...
\end{maxima}

and takes what is inside them and builds an input script to Maxima.
It then calls Maxima and maxima saves each equation to a seperate .tex
file. Python then uses each of these .tex files to replace the
\begin{maxima} environments with \begin{equation} environments. I
really like combining LaTeX with any CAS in this way.

But all of this would be cleaner if I wasn't doing the TeX->LaTeX
after the fact using regexp.

Ryan
Post by Barton Willis
-----Paul RIVIER wrote: -----
Post by Paul RIVIER
I take this opportunity to ask you if there is a
work in progress to include a latex export as well.
I don't know of anybody that is working on this.
To generate LaTeX output for fractions and matrices,
(%i1) load("mactex-utilities")$
(%i2) tex(a/b);
$$\frac{a}{b}$$
(%o2) false
(%i3) tex(matrix([1,2],[3,4]));
$$\begin{pmatrix}1 & 2 \\ 3 & 4 \\ \end{pmatrix}$$
(%o3) false
Barton
_______________________________________________
Maxima mailing list
http://www.math.utexas.edu/mailman/listinfo/maxima
Robert Dodier
2005-12-11 16:17:50 UTC
Permalink
hello ryan,
Post by Ryan Krauss
But all of this would be cleaner if I wasn't doing the TeX->LaTeX
after the fact using regexp.
in order to get the tex output you want for fractions and matrices,
maybe all you need to do is load mactex-utilities.lisp.

default:

(%i1) tex (aa / bb);
$${{aa}\over{bb}}$$
(%o1) false
(%i2) tex (matrix ([aa, bb], [cc, dd]));
$$\pmatrix{aa&bb\cr cc&dd\cr }$$
(%o2) false

with mactex-utilities:

(%i3) load ("mactex-utilities");
(%o3) /usr/local/share/maxima/5.9.2.6cvs/share/utils/mactex-util\
ities.lisp
(%i4) tex (aa / bb);
$$\frac{aa}{bb}$$
(%o4) false
(%i5) tex (matrix ([aa, bb], [cc, dd]));
$$\begin{pmatrix}aa & bb \\ cc & dd \\ \end{pmatrix}$$
(%o5) false

hope this helps,
robert dodie
Loading...