Possibly useful hack for tex output...



Over the years I've kept a hacked version of mactex.lisp which defined a 
"literal" command.
This allowed me to maintain a file that could be batched or otherwise read 
through maxima,
to generate tex or latex input including a lot of literal text. I've 
written many papers using this hack.
But  mactex.lisp has evolved to the point
where keeping my version in sync  became painful, so I tried another 
approach, which sems to work.  A snippet below...
=====  defining the incantations=======
load("mactex.lisp")$
out:openw("outfile.tex");

savtex(exp)::=
        buildq([exp],tex(exp,out))$

lit(exp)::=
        buildq([exp],(newline(out),printf(out,exp),newline(out)))$

===   Invoking... =====
lit("Final focus of the microscope will be achieved by adjusting the zone 
plate z position.
A strategy for focusing that minimizes the required number of images is of 
interest both to minimize
clock time, and to minimize radiation damage of the sample. To understand 
this, it's useful to derive a relationship
between the  blur  of the image, and the offset in zone plate position 
from ideal focus.
In what follows, $cd$ is the true camera position, $od$ the desired object 
distance, and $f$ the zone plate focal length.");

eq1: cd=1/(1/f-1/od);
savtex(eq1);
lit("The actual image at $ip$ is formed when the sample is displaced from 
where it should be, by a positive $err$.");

eq2: ip=1/(1/f-1/(od+err));
savtex(eq2);

====== and so forth

which produces output as expected...

====  contents of outfile.tex
Final focus of the microscope will be achieved by adjusting the zone plate 
z position.
A strategy for focusing that minimizes the required number of images is of 
interest both to minimize
clock time, and to minimize radiation damage of the sample. To understand 
this, it's useful to derive a relationship
between the  blur  of the image, and the offset in zone plate position 
from ideal focus.
In what follows, $cd$ is the true camera position, $od$ the desired object 
distance, and $f$ the zone plate focal length.
$${\it cd}={{1}\over{{{1}\over{f}}-{{1}\over{{\it od}}}}}$$

The actual image at $ip$ is formed when the sample is displaced from where 
it should be, by a positive $err$.
$${\it ip}={{1}\over{{{1}\over{f}}-{{1}\over{{\it od}+{\it err}}}}}$$

======
which can be invoked as usual within your main tex file
...
\input outfile.tex
...

By combining this approach with "texput" commands I hope I've seen the 
last
of hacking mactex.lisp... 

Steve