Saturday, December 11, 2010

Inkscape and Tex Text

I have found for Ubuntu the best software for drawing figures for research is Inkscape.  It is cross platform which is a big bonus, and of course it is free!   It is also found in the Ubuntu software repositories.



I wanted a vector graphics drawing program vs a raster graphics program which essentially means that the quality of the image holds up when zoomed in (aka no pixel-ation). Please see the Wikipedia article link and image below.

Vector graphics (From Wikipedia, the free encyclopedia)



Another big requirement for me is that the drawing software should be able to handle equation input easily and quickly since I work a lot with math in my research. Inkscape does this flawlessly and uses LaTex math input!! However, there are two ways to go about this. The first is using the built in InkLaTeX (see InkLaTeX - Extensions for drawing LaTeX text on Inkscape for more info).



Unfortunately, the formula cannot be re-edited if need be.  However, the second option allows this and is what I recommend.  It is using Textext in Inkscape. To install simply download the files: textext.inx and textext.py. Then, depending on what version of Ubuntu you are using the files will go into ~/.config/inkscape/extensions/ for Inkscape 0.47 versions or later (the ~/.config folder can be found in your homefolder and will be named what ever you called it; mine for example is timbarber/.config since that is my login name; you will also have to click on "Show Hidden Files" under the View menu) and in ~/.inkscape/extensions/ for earlier versions. Also for Linux installations some additional requirements are: (see Textext for additional platform installation help as well; I do not know why these are needed either)

On Linux, you’ll need to have pdflatex and one of the following installed:

- Pstoedit with its plot-svg back-end compiled in, or,
- Pstoedit and Skconvert, or,
- Pdf2svg (the one by David Barton & Matthew Flaschen, not the one by PDFtron)

I think you can get all this done under the Ubuntu repositories for the Inkscape installation (see next image).


Once installed simply go to Extensions and there should be a separate Tex Text file.


The next few images is an example of inserting an equation and editing it.  Simply click the equation image and select Extensions->;Text Text again.  If an error or warning pops up like I have shown, I am not sure why or what it is for but just click "Ok" and everything should be fine.






For additional information please also see this blog post:

The Typethinker
Trying to make sense

Integrating Inkscape graphics in LaTeX


and this website:

LaTeX in Inkscape
jblevins.org » log » latex-in-inkscape
CHAPEL HILL, DECEMBER 10, 2007


by Jason R. Blevins

ASSISTANT PROFESSOR OF ECONOMICS AT THE OHIO STATE UNIVERSITY

3 comments:

  1. I just noticed that sometimes the Tex Text equation cannot be edited. I found this re-reading The Typethinker Blog:Integrating Inkscape graphics in LaTeX

    http://typethinker.blogspot.com/2008/06/integrating-inkscape-graphics-in-latex.html

    "This feature is a little feeble, however: do not ungroup the text object, or else it will become uneditable."

    ReplyDelete
  2. Some interesting comments from The Typethinker Blog post on LaTex/Tex Text in Inkscape. i will repost a few here. Note, I am using a windows machine for the moment, and I am trying to figure out how to get Tex Text to work properly Inkscape for Windows, :(. I will update once I get the solution.

    "About the font size:
    word, openoffice, latex and anything else uses as a measure "pt", which is defined as 72 pt per inch. So a text with 12 pt is 0.166666 inch tall.

    For some reason (I guess you have to live with it) svg is using as measure px. Which is defines as 90 px per inch. So if you set 12 px, the text is only 0.133333 inch tall.

    Solution: Set 15 px as font size.

    I admit this is very annoying about svg. Svg was not inteded for print I guess. "

    ReplyDelete
  3. A good link on the different font formats, True Type Font (TTF) which is Windows and Open Type Font (OTF) which is what Linux uses.

    http://blogs.adobe.com/typblography/TT%20PS%20OpenType.pdf

    ReplyDelete