2

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.
Screenshoot

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

Hendrra
  • 429
  • 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
  • @Bernard Where should I use \includegraphics? Is it important to save that SVG image in the folder where I have my .tex file? – Hendrra May 21 '17 at 10:56
  • \includegraphics{mygraphicfile} is used in the .tex file at the place where you want it (or you preferably let it float iserting it in a figure environment. Another solution would be to use one of svg or svg-inkscape packages. – Bernard May 21 '17 at 11:46
  • Related, possible duplicate, possibly helpful: https://tex.stackexchange.com/questions/151232/exporting-from-inkscape-to-latex-via-tikz/151287#151287 – Ethan Bolker May 21 '17 at 12:40
  • @Bernard yes, I use pdf from Inkscape all the time. I mean the OP might not be in a position to use pdf at all. – Chris H May 21 '17 at 15:31

2 Answers2

6

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.

TeXnician
  • 33,589
6

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.

enter image description here

  • 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. –  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. –  May 21 '17 at 15:09