[Tex/LaTex] Extract code LaTeX from a figure create with Inkscape

graphicsinkscape

I'm trying to understand how Inkscape works with LaTeX? What are the steps to export any figure drawn with this program in LaTeX language? Is the code TikZ or something else? Could someone suggest me how to proceed? Thank you.

Best Answer

Ok so here we go.

I decided to make this visual tutorial because some people are just more cartesian... Also because the extension has changed in the last years.

But don't be lazy, be sure to check this answer and this too, and if you run into problems with text check this.

First thing is to download the svg2tikz (here), this should be pretty straightforward, just click on the green button and save (or open) the .zip file.

Open your windows explorer and go to C:\Program Files\Inkscape\share\extensions it is inside this folder that the extension files will be drop, leave it open.

Open the zip file and navigate to svg2tikz-master\svg2tikz\extensions\ it should look like this:

7zip with extension

Select the first 3 files and drag'n'drop them to the folder you left open before. This should be C:\Program Files\Inkscape\share\extensions, and look like this:

inkscape extension folder

Once you done that, open Inkscape. Make your drawing and select Save As...

random lines

You may also use the Extension menu and go for Export, but you won't get to choose where the file is saved.

At the end of the list you will see Tikz Code .tex like this:

save as tikz code

In my example the image code is:

\begin{tikzpicture}[y=0.80pt, x=0.80pt, yscale=-1.000000, xscale=1.000000, inner sep=0pt, outer sep=0pt]
  \path[draw=black,line join=miter,line cap=butt,line width=0.056pt]
    (12.2944,5.9435) -- (23.2524,102.6950) .. controls (35.7691,59.6863) and
    (34.2478,-2.8197) .. (107.7096,38.8176);

\end{tikzpicture}