Illustrations in LaTeX
March 9th, 2008I really like books with great illustrations (great here means that the font should be the same as in the text etc, probably the best example of such a book is the “The Art of Computer Programming” by D. Knuth). I thus hardly ever felt happy with drawing things in a vector graphics program and always chose to program/typeset the graphics in some sort of programming language. In the past years I’ve played around with different packages/programs for doing this; the list includes:
- Matlab. I like it a lot for prototyping, but the plots usually look crappy. Same is true for the open source alternative octave.
- Gnuplot. Very powerful but the standard outputs usually look really bad.
- PSTricks. Some very impressive examples, but sucks when used in combination with PDF.
- PyX. From the website: “PyX is a Python package for the creation of PostScript and PDF files.” While I liked the Python environment and the power it gives you, it lead to problems when I wanted to include the plots in presentations: the fonts don’t agree or it’s harder to draw edges to other elements on the slides. It just lacked the integration with LaTeX. Note: it’s possible to work around some of the issues like for example the font problem, but usually it feels quite hacky.
- PGF/TikZ. As it’s from the same author who wrote the excellent Beamer package for presentations it integrates nicely with LaTeX and Beamer. It’s supposed to work with both DVI/PS and PDF. They recently released version 2 and by looking and the documentation you can immediately realize the sheer power this package has, especially for drawing general illustrations. It became my tool of choice about a year ago for drawing graphical models and such like, I however didn’t like the plot environment so much (it’s hardly existing at all).
This weekend I then finally played around with the Gnuplot TikZ terminal which addresses my last issue with PGF/TikZ: plotting functions and data. With this tool you can use gnuplot to create the actual plotting scripts and also to create the illustrations. However, instead of producing for example a PDF, the terminal outputs a .tex file that can then be included in the LaTeX document. The actual drawing in the document is then done by PGF/TikZ. The results look truly awesome. The installation is still a little bit messy as it needs the yet unreleased gnuplot 4.3 CVS.
May 6th, 2008 at 9:43 am
Did you ever give Metapost a try? It integrates highly with tex. Knuth gave a talk about it two years ago in Zurich. (I didn’t try it by myself, though.)
May 6th, 2008 at 9:51 am
I think I tried it at one point. As far as I can remember I didn’t like it because it seemed way too complex to me. That’s the thing I really like about TikZ: it’s rather intuitive and has an almost perfect documentation.
October 31st, 2008 at 7:33 pm
I had the same problem, but I needed to use existing outputs (from CAD programs, Inkscape, …). I played little with the overpic package, but it was too much time consuming.
The name of solution is TpX (http://tpx.sourceforge.net/). It is interactive graphical program, which is able to import usual vector formats (pdf, svg, ps, emf). The result is separated into 2 files – the first one contains a graphic part of the image, the second file is standard latex picture environment with the \includegraphics{…} and all the text of the image.