Inkscape and Latex

I’ve been a fan of the open source Inkscape for some time now, especially for lower-level vector graphics drawing. But for diagramming purposes, I’ve tended to use OmniGraffle (made only for the Mac). I’ve found it pretty handy to use OmniGraffle with the program LatexIt (which comes bundled with the MacTex distribution).

Little did I know that Inkscape comes with batteries included Latex rendering support.  And with its “connectors” tool, Inkscape is a very competitive alternative to diagramming that is cross-platform and is open source.  For Latex rendering, it converts your favorite Latex equation into SVG (via Extensions->Render->LaTeX Formula).

As you can see from the image, I rendered an equation and then rotated the summation symbol 90 degrees counter-clockwise since it is just another SVG object to play with in Inkscape.

This is a powerful feature that comes with the Inkscape distribution, but unfortunately you may not see it in your menu.  You can Google around and figure how to get this to work based on various forum posts (though depending on your setup this may take a while).

Because it can be kind of a pain to figure out how to get this “default” feature to work properly, I thought I’d explain it for Ubuntu and OS X in one place so it would be potentially easier for others to get it going.

First of all, by “default” or “batteries included”, I mean that this is a Python extension that is included by default in the Inkscape software distribution.  According to the Python file itself, for the plugin to work properly:

eqtexsvg.py
functions for converting LaTeX equation string into SVG path
This extension need, to work properly:
– a TeX/LaTeX distribution (MiKTeX …)
– pstoedit software: <http://www.pstoedit.net/pstoedit&gt;

eqtexsvg.pyfunctions for converting LaTeX equation string into SVG pathThis extension need, to work properly:    – a TeX/LaTeX distribution (MiKTeX …)    – pstoedit software: <http://www.pstoedit.net/pstoedit&gt;

I’m assuming you have a Latex package installed (e.g. on Ubuntu, something like ‘texlive-full’ or ‘lyx’ or on OS X, the MacTex distribution).

The plugin basically takes the equation you feed in, runs latex and dvips on it to create a Postscript file.  The real meat comes in the program ‘pstoedit‘: it converts your postscript file to SVG.

But you have to make sure this program is installed properly.  If you try to install it from source with the default settings, it may not work because for SVG output in pstoedit, you need the GNU plotutils library.

The easy solution for both of these is to install pstoedit from a package repository such as apt on Ubuntu and MacPorts on OS X and it should depend on plotutils.  Unfortunately, the install on OS X may take some time because a larger list of dependencies are actually all compiled before pstoedit itself is installed.

But after you install these packages, restart Inkscape and the plugin should show up in the menu and work.

7 comments

  1. zeina · June 30, 2010
  2. Geet · June 30, 2010

    Hi, thanks for the pointer to the plugin. I noticed it earlier I do like the feature that you can re-edit equations. I haven’t yet tried it yet, though. Might give it a shot …

  3. Mark · February 13, 2011

    Thanks for the pointer Geet. I have some trouble setting up Inkscape on mac os X. I have a new mac mini working on HDMI display monitor.
    I am trying to install and use Inkscape. I have X11 installed on my os x 10.6.3. Can you advise me?

  4. Geet · February 14, 2011

    Hi Mark, could you tell me more specifically what’s going wrong? Send me an email if you wish

  5. Huub · October 26, 2011

    I’m using pstoedit on Linux and on MacOSX 10.5 where it works fine. The problem for me is now that I can’t get it to work on MacOSX 10.6. Reason is with 10.6, my Macbook runs on x64 mode and both Fink and MacPorts are 32 bits. I’ve tried to compile MacPorts from source in an attempt to get it x64, but then it goes wrong on the tar package. If there is a solution, I would very much like to hear it.

  6. u · October 27, 2011

    Ok, managed to install it from MacPorts after all.

  7. Geet · October 27, 2011

    Ok — great to hear

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s