[texhax] Request for advice on figures for on-line and printable book.

Thomas Vaughan tevaughan at gmail.com
Tue Mar 8 17:22:55 CET 2011


I don't know if this be the right forum in which to make my request,
but, if not, then I'd appreciate someone's pointing me to the right

I've started in LaTeX to write a book with some physics and math
content, and I'd like some advice on the best way forward for the

I have an ambitious goal:

   (a) The printed version of the book should stand on its own as a
sufficient presentation of the material, but

   (b) the electronic version should have dynamic figures, each of
which is derived from the same source as the corresponding static
figure in the printed version.

By "dynamic" I mean, ideally, that the reader should be able to modify
the parameters of a figure and to see the figure change accordingly in
a real-time, interactive way. For example, if a figure had one
adjustable parameter, then it would be nice if a slider bar for that
parameter appeared next to the image in the electronic version so that
the reader could move the slider while watching the figure change. For
a three-dimensional figure, one of the parameters might control the
position of the camera relative to the object in view.

A less ambitious goal is to make each dynamic figure be a canned
animation that varies across parameter space in a way that I determine
ahead of time, but I'll settle for this only if there is no practical
way to produce truly interactive figures.

I have done a small amount of investigation on this already.

Usually, I use gnuplot for figures, and gnuplot even has the very nice
'bind' keyword that for some terminals allows interactive animation of
the kind that I want. One of the problems with gnuplot, however, is
that its three-dimensional graphics lack perspective. Another problem
is that interactivity of the kind that I want seems to require
launching gnuplot. The canvas terminal is nice, but the emitted
javascript seems merely to hard-code the low-level drawing
instructions needed to render the plot. So the canvas interactivity is
limited to panning, zooming, and the like. If the canvas terminal
could be modified to encapsulate the drawing routine into a javascript
function that takes adjustable parameters of the plot and to emit some
code that implements any 'bind' directives in the input source, then
gnuplot might be a viable solution, even though the three-dimensional
figures wouldn't be as nice as I'd like. The idea would be to have
each gnuplot input file define the figure and print it to two
terminals, one of which is something like png_cairo and the other of
which is canvas. Then use hyperref to make a link in the PDF version
so that the dynamic figure is launched in a Web browser when the
reader clicks on the figure in the PDF file. Alas, this solution seems
not quite available because of the limitation of the canvas support in

I've considered using WebGL, either by writing my own graphics library
for plots and drawings or by using one that already exists. SpiderGL
looks interesting. However, even if I could somehow produce nice,
dynamic plots via WebGL, I've not figured out how to produce
high-quality static figures from the same source for inclusion in the
PDF document.

Recently, I've also looked at the animate package for LaTeX. It would
certainly be cool to make animations from pgf, sketch, or gnuplot, and
it might even be most convenient just to use asymptote, which seems to
do everything along these lines. However, it seems that here I'd be
limited to canned animations for the dynamic figures.

Hopefully, I've overlooked a good option.

If anyone has any other ideas about what I might look into, then
please let me know.

Thomas E. Vaughan

More information about the texhax mailing list