# [Maxima] text interspersed with Maxima output

Ryan Krauss ryanlists at gmail.com
Wed Jul 4 08:44:13 CDT 2007

This may be way more complicated and hackish then what you have in
mind, but I have written Python scripts that I use extensively to do
this sort of thing in two ways.  Both allow/assume that I am mixing
Maxima and Latex.  So, this might not be ideal for someone who want
without having to learn Latex).

So, the old way allows me to add a new environment to a Latex document:

\begin{maxima}
[maxima code here]
\end{maxima}

My Python script then is a complicated, messy pre-processor for Latex.
It sorts through the document finds all the \begin{maxima}
envrionments, puts them into a batch file for Maxima - adding TeX
output commands for each environment.  After Maxima finishes running
the batch file, it takes all the TeX output files (one for each
\begin{maxima} environment) and substitutes them back into the Latex
environment, changing the environment from \begin{maxima} to
.

me to add Latex code in comments in a *.wxm file.  It then takes the
.wxm file and turns it into the input file I was discussing above.
Here is an example snipet:

/* [wxMaxima: input   start ] */
/*
\section{A Simple Example}
This file gives a simple example of intermingling \LaTeX{} and Maxima.

Here is one equation:
*/
eq1:x+y=7;
/* [wxMaxima: input   end   ] */

Attached are some example files that may clarify what my code does.
(The header.tex file is only attached in case some actually wanted to
run Latex on the latex_output.tex file)

The one thing it doesn't do right now that might be necessary for the
application you are talking about is echo back the verbatim Maxima
code.  But I don't think that would be too difficult.

I would be glad to share the code if anyone is interested.  But it is
fairly messy and disorganized.  It is all in Python and depends on
Scipy/Numpy and wxPython.  You don't have to be a Python programmer to
use it.  There is a gui to select your input files and run the various
aspects of the process.

FWIW,

Ryan

> On 7/3/07, Robert Dodier <robert.dodier at gmail.com> wrote:
> > Hello,
> >
> > Recently I think someone was asking about how to get
> > Maxima output and ordinary text in the same document.
> > (Or maybe I'm mistaken. Wouldn't be the first time.)
> > Anyway I found this web site
> > http://melusine.eu.org/syracuse/maxima
> > which has a lot of interesting stuff, including a script
> > named pmaxima which can process documents which
> > comprise Maxima commands and ordinary text.
> > http://melusine.eu.org/syracuse/maxima/scripts/pmaxima
> >
> > Maybe this will be useful to someone.
> >
> > Robert Dodier
> > _______________________________________________
> > Maxima mailing list
> > Maxima at math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima
> >
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example_input_old_way.tex
Type: application/x-tex
Size: 506 bytes
Desc: not available
Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070704/68ab7645/attachment-0003.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example_input_new_way.wxm
Type: application/octet-stream
Size: 816 bytes
Desc: not available
Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070704/68ab7645/attachment-0001.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: latex_output.tex
Type: application/x-tex
Size: 431 bytes
Desc: not available
Url : http://www.math.utexas.edu/pipermail/maxima/attachments/20070704/68ab7645/attachment-0004.bin
-------------- next part --------------
A non-text attachment was scrubbed...