I typed a large entry yesterday, but Mozilla crashed before I could post it. Believe it or not, I can get it to reliably segfault upon loading one of the webpages at the W3C. I would have better apprieciated the irony if I had not lost my work at the same time.
At first, and this is scary, it occurred to me that I should use Netscape 4.7 because it would be less likely to crash. Instead I'm using gedit.
We've made some improvements to the Octal API that make it a bit easier to write plugins, and we're very close to defining the wavetable extension and generator event formats.
After long months of investigation and experimentation, I think I've finally figured out a grand unified theory of including illustrations in TeX/LaTeX documents. Here is what I've learned:
- Blithely ignore any and all macro packages claiming to
do
illustrations/diagrams/pictures for LaTeX. There are too
many of them,
with too much overlapping functionality. My experience has
been that
these packages are limited, fragile, verbose in the extreme,
and
produce only mediocre-looking diagrams (if they don't
overload
TeX by typesetting 28272 dots to fake a smooth curve.)
- Use tools that can be made to produce EPS output. For
example, some of the stuff that comes with almost any Linux
distribution:
- Illustration: Metapost is a dialect of Knuth's
Metafont language, that
is designed for mathematical and technical illustration. It
outputs
directly to EPS format. Use Metapost if you're in need of
algorithmically generated, highly precise illustrations,
color and shading, or heavy use of TeX typesetting within
diagrams.
This is not without its downsides. Like Metafont and TeX, Metapost is a bizarre but powerful language. It combines a heavily declarative style (it will actually solve systems of equations to determine where things go) with imperative features and loops, and syntax elements taken from both C and Pascal.
- Diagramming: GNU Pic is a free implementation of
Brian Kernighan's original PIC language. There's a fun CACM
article from the 80's with examples, which is how I first
found out about it. The central idea is that Pic is a
language to build abstract diagrams involving simple shapes,
points, lines, and curves with prebuilt commands for
labeling and arranging all the above. Pic has a much simpler
syntax than Metapost, and its intuitive object-placement
commands and relative positioning mean that you almost never
have to use absolute coordinates or lay things out on graph
paper first. If you declare your splines and lines
correctly, the output can look really fabulous.
PIC is well-suited to discrete-math kinds of diagrams with only minimal need for text labels: graph theory, data structures/algorithms, pipes and filters, basic software architecture diagrams (not too complex, PIC is not UML!) simple scatter/line plots, state transition diagrams, automata theory diagrams, and that sort of thing. PIC's economy and loose syntax are especially nice if you will automatically generate diagrams from code or other data, as some C.S. texts do.
Integrating PIC into your documents is a slightly weird issue; you can use groff to get postscript straight off, but this prevents you from using TeX math or fonts in the diagram. The alternative is to embed the diagram source in your TeX, and run the entire thing through GNU Pic in its TeX mode to change the diagram into TeX specials. XDVI and DVIPS will correctly render these, but DVIPDF does not.
- Wysiwyg. The venerable Xfig is always available, it usually comes with your X distribution. Its large library of premade symbols is a plus; I used it to design great-looking circuit diagrams for a digital logic class last year. However, xfig's interface is rather weird and harsh-looking, so it's nice to have Dia as an alternative. Through EPS, both tools are easy to integrate with LaTeX. And of course, you can always use GIMP's EPS output if you need to integrate bitmaps.
- Illustration: Metapost is a dialect of Knuth's
Metafont language, that
is designed for mathematical and technical illustration. It
outputs
directly to EPS format. Use Metapost if you're in need of
algorithmically generated, highly precise illustrations,
color and shading, or heavy use of TeX typesetting within
diagrams.
- At the {La}TeX level, use nothing but
\epsfbox{} and related commands to include your EPS
figures. This is a simple and consistent way of including
all your graphics and illustrations regardless of how they
were made. If they come from source files in pic, fig, or
metapost, you can use make to manage the project
and update the EPS when needed.
It's pretty neat that even after 25+ years, UNIX still excels at one of its earliest uses: advanced document preparation and typesetting applications. Because it is used so heavily for this, it is also a great environment for learning computer science: even after more than a year using Linux, I am amazed at the immense resources for education available to the Linux user, both in the enormous volume of useful programs installed with the typical distro, and in easily being able to read the various postscript papers, technical reports, articles, and books found online, or download and examine the source to so many UNIX applications.
Neat stuff.
