Simple TeX based graphical front end display for maxima.
Subject: Simple TeX based graphical front end display for maxima.
From: Rod Stephenson
Date: Mon, 22 Sep 2003 13:25:59 +1200
One of the nice things with maxima is having the underlying Tcl
interpreter available and I often find this useful. To illustrate
what can be done, here's some code that produces and displays dvi
output, written in a few lines of tcl: a graphical front end for
maxima output.
# file texgui.tcl
proc saveTexString {} {
sendMaxima .maxima.text "tex(%, \"tmptexfile\");"
after 100 {exec latex maxout.tex}
}
.menu.maxima add command -command saveTexString -label TeX \
-acc Ctrl+t
bind .maxima.text <Control-t> saveTexString
To use this, save the preceding lines to a file (say texgui.tcl).
Bring up the Tcl console (Options/Show Tcl Console), then in the
console, source (File/Source...) the file. This will create a new
menu item in the Maxima menu (Maxima/TeX), as well as a keyboard
accelerator (Ctrl-t) to invoke the command.
Create in the working directory a tex source file maxout.tex such as
\documentclass{article}
\begin{document}
\input{tmptexfile.}
\end{document}
Now (assuming you have tex installed), hitting Ctrl-t will produce a
maxout.dvi file with the last maxima output appended. I open this
with a dvi previewer (yap, available with the MikTeX distribution)
which updates when the dvi file changes, and this gives me an
updating display of beautifully formatted equations.
This is not industrial strength - in particular there is no line
breaking in equations: note the authors comment in mactex.lisp -
;;Undone and really pretty hard: line breaking
and as Knuth says in the TeX book "Its quite an art to decide how to
break long displayed formulas... TeX never attempts to break them." I
just keep tmptexfile open in an editor and judiciously add $$$$'s
here and there to break up long formulas.
It does give nice output for simple equations. (Solutions to ODE's
with undefined constants %C confuse it naturally, this shouldn't be
too hard to patch) Only tested under Windoze, I developed this as an
alternative to going through the hoops of getting texmacs working
with cygwin.
I'd like to know if there's a way of sourcing the Tcl file
automatically when maxima starts up. Any other feedback, suggestions
for improvement would be welcome.
Rod Stephenson