batch modifies input



On 8/14/08, John Lapeyre <pdl at johnlapeyre.com> wrote:

>  I have a question about how batch() works. Before printing
>  the input lines, 'batch' modifies them; strips spaces,
>  rearranges terms, omits the trailing semicolon, etc. Is
>  there some way to control this?

The Maxima input parser throws away comments and white space,
so there's no way to recover the original input format.

>  The reason I ask is because, I am writing a latex document
>  that has portions of maxima sessions interspersed with the
>  text. I am using imaxima in emacs with the imaxima-latex
>  command to give latex output which i cut and pasted into my
>  document.

Not sure what you want to do here, but maybe something like:

with_stdout ("mydoc.tex",
  print ("\\documentclass{article}
\\begin{document}"),
  print ("Introduction and discussion.
First result:"),
  tex (a = expand ((x + y)^2)),
  print ("In closing ...."),
  print ("\\end{document}"));

i.e. intersperse ordinary text (including LaTeX document stuff)
w/ tex(...) output. Just a thought.

Note that Maxima is happy with embedded line breaks in strings;
useful if you're constructing paragraphs.

best

Robert Dodier