Saving an SVG image to TeX code in Inkscape

I'm trying to export a SVG file into TeX code (pstricks) using Inkscape. I've created the code but I think something is missing in the preamble. What packages should I use? And what is the proper name to enter in the documentclass?
I'm adding the screenshot of all the errors which have occurred.

Because my code is too long I decided to upload it using a link:

• Is there any reason why you don't export directly to .pdf? – Bernard May 21 '17 at 10:29
• Yes. Unfortunately I have to create a .tex file @Bernard – Hendrra May 21 '17 at 10:36
• @Bernard perhaps LaTeX -> dvi -> ps. While Inkscape can export eps (or you can convert) I've had trouble in the past. – Chris H May 21 '17 at 10:36
• @Hendrra: Sure, but then you use \includegraphics. I mentioned this possibility because the pstricks code produced by all these graphic programs is not very good. – Bernard May 21 '17 at 10:43
• @Chris: With Inkscape you can save as .pdf. I didn't use this possibility very often, but I never had any problem. – Bernard May 21 '17 at 10:44

The documentclass is up to you. For pstricks you need the package pstricks. If you compile with pdflatex you should also load auto-pst-pdf.

Don't forget do add the document environment as suggested by your editor.

• Now there are no errors but there is only a blank pdf file when I open it. – Hendrra May 21 '17 at 10:37
• Thank you for another advice! How can I do it? – Hendrra May 21 '17 at 10:55
• Is it possible to add many lines of code using {}? – Hendrra May 21 '17 at 11:12
• @Hendrra See here on how to properly format your code (multi-lined). – Troy May 21 '17 at 12:32
• Unfortunately my code was too long so I added a link directly to it. – Hendrra May 21 '17 at 13:57

Use

\documentclass{article}
\usepackage{pstricks}

\begin{document}
\psset{unit=0.2pt}

.. the rest of your code ...

\end{document}


and then run it with xelatex or the sequence latex->dvips->ps2pdf. If you have still problems paste the complete code into your question as text and not as an image.

• Unfortunately I still have some problems with that code. I posted a link to my .tex file. – Hendrra May 21 '17 at 13:56
• instead of your given \psset use \psset{unit=0.2pt}. See my edited answer. – user2478 May 21 '17 at 14:15
• Unfortunately there are still some errors: "Undefined control sequence". Have your code worked? How to run it using xelatex? – Hendrra May 21 '17 at 14:29
• I suppose you run your document with pdf latex instead of xelatex or the sequence latex->dvips->ps2pdf. – user2478 May 21 '17 at 15:09