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:
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
2. If you are the only one who will need the feature: ~/.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. 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”