I am trying to convert an SVG image (or a PDF image) to TikZ code. I installed svg2tikz two ways, 1) as an Inkscape extension and 2) as a Python pip extension.

The documentation is useless. I cannot find any documentation on how to actually use svg2tikz either as an Inkscape extension or via python.

Another answer suggested using the code

tikz_export.py example.svg -o example.tex 

but when I try to use it for my problem I obtain

~/Downloads> python tikz_export.py DeformedContour.svg .o DeformedContour.tex File "tikz_export.py", line 8 ^ SyntaxError: invalid syntax

I don't care how to convert either the PDF or the SVG image to TikZ, it just needs to be converted.

New contributor
user415366 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • I don't know svg2tikz so I don't think I can help with this specific question. But why don't you just include the PDF directly or use the SVG package? What do you need the TikZ code for? It's probably going to be a mess anyways.
    – schtandard
    Jun 22 at 6:14
  • Maybe it's a simple mismatch of Python 2 and 3, i.e., your python call uses Python 2 and the code expects Python 3 or vice versa? Other than that, svg2tikz is not very actively maintained judging from the Github page, so you may have more luck using one of Inkscape's built-in export formats or even redoing the graphic in TikZ from scratch (which may take some time but you will learn a lot and the result may be nicer and more readable/adjustable than automatically exported code).
    – Marijn
    Jun 22 at 13:25


Your Answer

user415366 is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.