76

I use Inkscape on Windows 7 platform. The principle to enter integrals and other mathematical symbols in Inkscape seems that the best thing to do and write them in a LaTeX compiler and cut them in Adobe PDF and paste it into Inkscape as figures.

Seems to be how you make pictures like this in Inkscape:

integral figure

Is there any way to type LaTeX code directly into the text boxes Inkscape?

I know this question is utopian but it never hurts to try.

4

8 Answers 8

57

Here an Inkscape answer (summarizing the comments and some additional info). There are two ways to include LaTeX input.

  1. Use the PDF+LaTeX export built into Inkscape

    Advantage: Built-in, text stays editable

    Disadvantage: Tex code can be typed but is not rendered, hence you may need to adjust the x,y positioning values later in your document --> annoying. Further, no line break is supported and you need to add a parbox or minipage or something later manually

  2. Get the textext plug-in for Inkscape

    Advantage: Render the code directly in you Inkscape document, including line breaks etc.

    Disadvantage: Text becomes a SVG picture and can not be edited outside of Inkscape. No problem within Inkscape of course (objects can be edited by selecting them and using the Extensions->Textext menu item). This means after exporting and including the PDF in your document scaling your graphic will cause the text to scale too --> Possibly undesired effects

    Installation details for textext:

    Get the Inkscape plugin textext from here.

    Installing it was a bit tricky for me (Inkscape 0.48). Installation instructions can be read here.

    First I placed the extension files in the ~/.config/inkscape/extensions folder.

    Then I installed Pstoedit via the Ubuntu package manager

    After that I was presented with an Error from some python modules. This blog post solved it for me: Blogpost

    After that I was able to select Extensions->Textext from my Inkscape menu bar. In the box that pops up type you LaTeX code just like you would in a normal document. You can specify a preamble file. I'd include any packages affecting the font in your document as the result is a SVG image of you TeX input, meaning that the font will not change if you decide to change your LaTeX-preamble at some point

4
  • 1
    Installation in Inkscape 0.91/Fedora was very easy, simply sudo dnf install pdf2svg and copy plugin files to ~/.config/inkscape/extensions. Restart Inkscape. Results are perfect. As for the problem of "scaling" I recommend putting all the TeX object as "scale 1.0" and scale the figure instead.
    – alfC
    Mar 6, 2016 at 2:12
  • To me, the chief advantage of textext over the pre-installed LaTeX extension for InkScape is that the LaTeX code for textext objects can be edited later and recompiled within InkScape later on. With the pre-installed LaTeX extension, you can only typeset code once; if you made an error, you must delete it and start over. Mar 6, 2016 at 2:54
  • make sure that you're using Python2 with textext! Apr 10, 2018 at 13:46
  • I was using a snap installation of inkscape and couldn't make this work until I uninstalled and installed again with sudo apt-get install inkscape Jun 30, 2019 at 22:44
33
+100

Not an Inkscape answer!


You can use Ipe extensible drawing editor for this. I've used it extensively until I got the hang of TikZ but still use it for quick and dirty image preparing. It supports a lot of features implemented (linetypes, colors, transformations, coordinates, object snapping etc.). Also if you know Lua then you can directly hack into it and create your own stuff (I don't).

Here is how you can do as simple as possible. First you draw your shapes, polygons etc. (and also choose to enter LaTeX formula selected in the image below).

enter image description here

Then, after clicking OK either choose Run LaTeX from the menu or Ctrl+L then it finds your LaTeX distro and compiles that part as in the image below. You don't have to do it for each formula, you can keep them as source and then compile all at once.

enter image description here

After finishing your picture, you can save as XML, PDF or EPS formats. After two minutes I have this

enter image description here

5
  • I find new ideas everyday in tex.stackexchange. I haven't tried this software. There was a time I was using DIA to generate my tikz code. I may have heard or read of Ipe but I never gave it any attention, probably because I don't use Inkscape. I might try it soon.
    – hpesoj626
    Aug 14, 2012 at 14:11
  • 1
    @hpesoj626 It's the poor man's (academia that is) Photoshop :)
    – percusse
    Aug 15, 2012 at 23:25
  • 1
    I now realized that I have received a bounty for this answer. I don't know whose bounty it is but thank you very much indeed for a slightly undeserving answer.
    – percusse
    Aug 31, 2012 at 14:15
  • ipe is available in the Ubuntu repositories.
    – a06e
    Mar 14, 2016 at 13:58
  • +1: I have forgotten about IPE - good to be reminded :). (FYI: en.wikipedia.org/wiki/Ipe_(software)). The manual is currently (September 2018) from December 9, 2016. Sep 24, 2018 at 20:45
23

Update 04-05-2022

Good news is that the built-in feature is back in Extensions > Render > Mathematics > LaTeX (pdflatex).... Just make sure you have installed a LaTeX distribution (preferably TinyTeX), Ghostscript, and pstoedit (pdf2svg), and you have added them all to your environment variable path as instructed here.


old answer

TL;DR install TexText from here

Unfortunately, the earlier answers on this page are mostly irrelevant or outdated. The question is about putting LaTeX math inside Inkscape, not including vector graphics inside Latex! Not to mention that the OPs' question is about Windows, not Linux. Here are some options:

  1. In some versions of Inkscape, as explained here in Inkscape wiki, there used to be a "built-in support for including a LaTeX formula". You could just go to Extensions->Render->LaTeX ... and put your formula. For some reason, this has vanished as I have addressed the issue here! This feature hopefully will be back in the following versions (this tweet)

  2. The TexText plugin has been the de facto tool for LaTeX rendering inside Inkscape. However, due to the lack of proper support, it has been forked several times:

  1. If you are really desperate, you can use any of the LaTeX to vector graphics application I have mentioned here to generate for example an SVG and import it into Inkscape.
4
  • 1
    Yes, this is the best and simplest solution for Inkscape. Aug 12, 2017 at 5:49
  • 3
    From which version on is Render->LaTeX available. It seems notto be there in 0.91.
    – M. Winter
    Mar 23, 2018 at 18:40
  • 1
    Looks like this has changed again: Extensions->Render->Formula (pdflatex) now
    – llama
    Jun 15, 2022 at 22:34
  • How (if even possible) can we edit formulas done with LaTeX (pdflatex)...? Jul 3 at 14:48
6

This is really a comment to Martin H, however, I don't have enough reputation to produce a comment at this time.

I followed your link to get textext, scrolled down to the Windows section of the installation heading. From there I followed the instructions to download and install 2. pstoedit and 3. ghostscript [I already run MikTeX (instruction number 1 on the list) through TeXMaker] I then downloaded and installed the 4. Textext. All of these installations were automatically performed in the usual way of downloading .exe files and clicking "next, next, ..., finish" through the dialog boxes.

At this point, following the advice given (by Martin H), I was unsure what was meant in his answer by "I placed the extension files in the ~/.config/inkscape/extensions folder"

Opening Inkscape at this time gives me the TeX Text option under the Extensions menu. However, clicking this yields the same error as encountered by Martin H. Following the link for the blog post provided and then the steps to fix this error, I open Inkscape only to get the error:

Traceback (most recent call last):
File "textext.py", line 936, in <module>
e.affect()
File "C:\Program Files (x86)\Inkscape\share\extensions\inkex.py", line 215, in affect
self.effect()
File "textext.py", line 349, in effect
% ';\n'.join(converter_errors))
RuntimeError: No Latex -> SVG converter available:
Pdf2Svg: Command pdf2svg failed: [Error 2] The system cannot find the file specified;
PstoeditPlotSvg: Command pstoedit -help failed: [Error 2] The system cannot find the file specified;
SkConvert: Command pstoedit failed: [Error 2] The system cannot find the file specified
3
  • 1
    ~/.config/inkscape/extensions is a folder in Unix/Unix-like OS's. In Windows 7 you can find it your installation folder, usually C:\Program Files\inkscape\extensions.
    – hpesoj626
    Aug 14, 2012 at 14:05
  • 1
    true, sorry for not specifying that in more detail. The path I mentioned is for Linux systems. I am not a Windows user, hence I can not give you much advice. But the message No Latex -> SVG converter available shows you that pstoedit installation may not have been successful. You can test it by opening a command window in Windows via Windows start button-> Run type cmd click ok and then in the console window that opens type pstoedit, hit enter and see if the program can be found. If not, locate pstoedit.exe on your system and add the path of it to the environmental variables in Windows
    – Martin H
    Aug 14, 2012 at 16:50
  • 1
    this is actually not an answer to the question but a different question. the textext extension installation method is outdated and you may follow the new repo, as I have mentioned din my answer here.
    – Foad
    Jul 3, 2017 at 13:46
6

LaTeXText is an Inkscape extension based on the outdated textext extension mentioned in the previous answers. This is relevant for Inkscape version >= 0.91 on Linux and Mac, and version >=0.92.2 on Windows.

The installation instructions are on the Github page, and are fairly verbose. I'll just demonstrate: The Github page has installation instructions and .gif of how it works.

The extension is found (after installation) in Extensions -> Render -> Text with LaTeX (GTK3).

For example: the output after applying the extension:

enter image description here

The LaTeX rendered output is produced in a separate layer (named Rendered Latex), while the original LaTeX code is left in the original layer (Layer 1 in my case). You can see this if you activate the Layers window (Ctrl+Shift+L shortcut in Inkscape).

Just hide the original layer (click the eye icon in the Layers window) in the final output, then you'll be left with the desired rendered output.

layer

1
  • 1
    Well the latest release of textext is more recent than the package you refer to. They now moved to github.
    – strpeter
    Oct 21, 2018 at 19:50
5

Workaround, not a direct answer:

I'm adding this answer because as far as I can tell it gives you everything you need and it is definitely the simplest:

This is superior to simply screencapping latex output as it is resizeable etc. and works nicely with inkscape when it is an svg.

3
  • 2
    there are other options for generating vector graphics from latex
    – Foad
    May 31, 2018 at 12:06
  • This is basically the same as part 3 of @Foad's answer .
    – strpeter
    Oct 21, 2018 at 19:42
  • Appreciate the direct example here. Works great too!
    – Thom Ives
    Mar 6, 2020 at 22:19
3

To summarize, complete and update some of the recent ('16) answers, here is a step by step installation of tex text in ubuntu 16.04 (can surely be derived to other linux distributions) and a mini guide to using tex text in current (0.91) version of inksape. Prerequisite: texlive and pdflatex, then:

  • install pdftoedit and texlive: sudo apt-get install texlive pstoedit
  • install pdf2svg: sudo apt-get install pdf2svg
  • get tex text from https://bitbucket.org/pv/textext/downloads/
  • copy the extracted files in ~/.config/inksape/extensions (not the unzipped folder as a whole, but its content)
  • (re)start inksape

Then tex text is found in Extensions -> Tex Text

Upon starting I get these 2 frames:

enter image description here enter image description here

In the converter dropdown menu you have the choice between ps2Svg, ps2edit, Inkscape, Inkscape (+text-to-path). As an example, type the following in the Text field: \(\displaystyle\frac{\pi^2}{6}=\lim_{n \to \infty}\sum_{k=1}^n \frac{1}{k^2}\) (the default sample from the extensions -> render -> Latex...) This is what I get with the above mentioned converters:

  • ps2Svg:

enter image description here

  • ps2edit: nothing is produced

  • Inkscape:

enter image description here

  • Inkscape (+text-to-path):

enter image description here

By comparison, the Extensions -> Render -> LaTeX gives: enter image description here

To modify an equation, select it and go back to tex text: Extensions -> Tex Text and make sure to select the same converter as the one you used for originally writing the equation.

4
  • +1 Great answer! I am very happy with this answer because I am starting to use the Ubuntu 15.04 platform. The support for LaTeX that comes by default on Inkscape for Ubuntu is very limited. Mar 6, 2017 at 21:15
  • In my case (Ubuntu 15.04) the path seems to be usr / share / inkscape / extensions. I downloaded the "textext" type files. I decompressing on my desktop. But I am not allowed to copy the "textext" tag in the extensions folder. I think it's something simple to solve. But I'm a first-time Linux user. Can you help me solve this problem? Mar 7, 2017 at 19:53
  • @MathOverview use sudo.
    – calocedrus
    Mar 8, 2017 at 8:22
  • This solution seems out-dated. There is now an Inkscape built-in extension that renders Latex automatically within Inkscape. Aug 12, 2017 at 5:51
3

The by far easiest to install and use tool I found is WriteTex, also mentioned in Foad's answer.

All you need to do, as explained in WriteTex, and I quote, is:

"Just drop writetex.py and writetex.inx to Inkscape extension folder, which is normally at $inkscapeFolder$/share/extensions. Make sure you have at least one LaTeX command and one PDFtoSVG converter are in your path."

Works like a charm :-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .