Hello,
1. TeXmacs. If the interface is in the math input mode, then a user inputs
nicely typeset mathematical formulae. They are converted to ascii maxima
syntax by a thin layer of scheme, see
/usr/share/TeXmacs/plugins/maxima/progs/maxima-input.scm .
Honestly speaking, I always thought that using ascii input mode is easier
- there may be many 2-d typeset formulas which look the same, one of them
correct, and all the others will produce syntax errors.
TeXmacs starts maxima via the script /usr/libexec/TeXmacs/bin/tm_maxima .
It instructs maxima to read
/usr/share/TeXmacs/plugins/maxima/lisp/texmacs-maxima-5.11.0.lisp when it
starts. This file redefines a few functions in maxima. This has 2 results:
(1) maxima writes all expressions in LaTeX form (well, in reality more
close to plain TeX than to LaTeX), and (2) maxima writes some control
characters to indicate where are prompts, LaTeX expressions, and so on (to
follow the TeXmacs communication protocol).
It is easy to see all bytes flowing from teXmacs to maxima and back in
real time. Just follow explanations in
/usr/share/TeXmacs/examples/plugins/pnambic/readme.tm . In short:
change the line
exec maxima -u $1 -l $2 -p "$TEXMACS_MAXIMA_PATH/texmacs-maxima-5.11.0.lisp";;
in /usr/libexec/TeXmacs/bin/tm_maxima to
tee /tmp/in |\
maxima -u $1 -l $2 -p "$TEXMACS_MAXIMA_PATH/texmacs-maxima-5.11.0.lisp" |\
tee /tmp/out
cd /tmp
mkfifo in
mkfifo out
cat out | p_out
# p_out is compiled from
# /usr/share/TeXmacs/examples/plugins/pnambic/src/p_out.c
# it will print ctrl-chars in hex
# this xterm window will show maxima output
# switch to another xterm or whatever you use and do
cat in
# this xterm will show maxima input
Then start a maxima session in TeXmacs.
2. wxmaxima. I don't know details, but in principle it works in a similar
way. It instructs maxima to write all expressions in some dialect of xml
(instead of TeX). You can observe the real maxima input and output in the
same way: just write a wrapper script "maxima" which says
tee /tmp/in | /usr/bin/maxima $* | tee /tmp/out
and place the directory in which it lives before /usr/bin in your $PATH.
Or just edit /usr/bin/maxima to insert these tee commands into the proper
place.
Hope this will help,
Andrey