Clicky

LaTeX in Inkscape

December 10, 2007

Inkscape is an excellent program for creating vector graphics of all kinds, especially SVG, but until recently I thought it was pointless to try using it for anything containing mathematics because I couldn’t even figure out how to make a subscript with it’s text tool. However, I recently realized that it now has built-in support for embedding LaTeX equations, found found right on the menu: Effects > Render > LaTeX formula.

Basically you enter a valid LaTeX expression and Inkscape calls LaTeX, converts the DVI output to SVG, and embeds it in your Inkscape document. The result is a high-resolution scalable equation, table, or whatever you like. It is converted to a path so you need not worry about fonts or text-placement issues.

There is also an Inkscape extension called textext which ultimately does the same thing but has a few more features such as allowing for a custom preamble and scaling factor. In contrast to the built-in effect, textext stores the original LaTeX expression so that you can edit it at any time by selecting it and running the extension again and the associated object will be recreated. To use textext, just download the extension and place it in ~/.inkscape/extensions/. A menu item will appear when you restart Inkscape: Effects > Tex Text.

Note: Unfortunately, the version of pstoedit that ships with Ubuntu Gutsy, version 3.44, has a conflict with certain versions of Ghostscript, namely the one shipping with Gutsy, which prevents either of these extensions from working (see bugs 123499 and 156365). If you are running Gutsy, try installing the latest version of pstoedit from the Hardy repository. If you choose this route, as opposed to compiling the new version for your own system, you will probably also need libpstoedit0c2a