Home > Reviews, Tutorials > Using LaTeX in Inkscape

Using LaTeX in Inkscape

If you want to type equations, Greeks, mathematical symbols, LaTeX in Inkscape, this post will show you how to do so. I will just use the extension called “Tex Text” (or “Textext”…I’m not sure). In order to install the extension, we need to instal some extra tools. There are many websites explain how to install the extension to Inkscape, but some links are dead and not updated to recent, so I decide to make this simple tutorial by referencing some of the existing links. Here are the summary:

  1. You have to have LaTeX and Inkscape in your system first. For me, I use Inkscape 0.47 and it works great!
  2. Install pstoedit by typing on the terminal: sudo apt-get install pstoedit
  3. Install pdf2svg. You can get it from Ubuntu repository or manually install it.
  4. Install Tex Text extension:
    1. download Tex Text package–I use version 0.4.4 (textext-0.4.4.tar.gz)–from [3]
    2. Unpack the archived file and you will see 3 files: 1) LICENSE.txt, 2) textext.py and 3) textext.inx
    3. The original textext.py will produce some warning when run it, so we will need to edit the code to suppress the warnings. To suppress the DeprecationWarning popup, add the red lines to textext.py (near line 54): (Thanks to cortiver [1])import sys, os, glob, traceback, platform
      sys.path.append(‘/usr/share/inkscape/extensions’)
      sys.path.append(r’c:/Program Files/Inkscape/share/extensions’)
      sys.path.append(os.path.dirname(__file__)

      # Suppress the DeprecationWarning when importing md5
      import warnings
      warnings.simplefilter(“ignore”, DeprecationWarning)

      import inkex
      import os, sys, tempfile, traceback, glob, re, copy, md5
      from lxml import etree

    4. After editing the file, now we will copy the files (textext.py and textext.inx) to the extension folder:
      1. If you want all the users to be able to use this feature: /usr/share/inkscape/extensions
        sudo cp ~/Downloads/textext* /usr/share/inkscape/extensions
      2. If you are the only one who will need the feature: ~/.config/inkscape/extensions
        sudo cp ~/Downloads/textext* ~/.config/inkscape/extensions
    5. If you have any problem with some permission problems, please try the followings (thanks to anjames [1]):
      sudo chown root:root /usr/share/inkscape/extensions/textext*
      sudo chmod a+rX /usr/share/inkscape/extensions/textext*
  5. Now restart your Inkscape, and ENJOY!

Now…how to use it?

For example, please refer to [2]. you may try the followings:

  1. Go to Extensions>Tex Text you will see 3 parts: 1) preamble file, 2) scale factor and 3) text
  2. In text, just type
    $\phi^2=\nu_i+5$ Hi there!
    And press OK
  3. You should see something like
    \phi^2=\nu_i+5 Hi there!
    on the Inkscape canvas. That’s it!

[1] http://ubuntuforums.org/archive/index.php/t-1001635.html
[2] http://eugenwintersberger.vox.com/library/post/use-inkscape-with-latex.html
[3] http://pav.iki.fi/software/textext/

Advertisements
  1. July 9, 2010 at 1:22 pm

    Here is another potential error to fix:

    when I copy and pasteed the line

    warnings.simplefilter(”ignore”, DeprecationWarning)

    into emacs, the double quotes became an unrecognizable symbol to python – because they were curvy instead of straight lines.

    e.g. I replaced
    ”ignore”
    with
    “ignore”

    Thanks for the great link!

  2. December 10, 2010 at 3:00 am

    With Inkscape 0.48, you don’t need any extensions anymore. Inkscape, now, can
    export pdf and text-part like Xfig. You can see how it works from the link below:

    http://thaitug.daytag.org/wordpress/?p=448

    • admin
      January 4, 2011 at 12:29 am

      Thank you very much krab pom ^_^. Your blog is super informative and helpful. In fact, I have been learning a lot about latex from your blog. Keep doing it na krab!

  1. No trackbacks yet.

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

%d bloggers like this: