9

I would like to export from .svg to .pdf_tex from command line but on inkscape 1.0 or later, for instance, https://stackoverflow.com/a/41110512/9302545.

Explanation

In Inkscape 0.92 or earlier if I use a .svg file in a .tex I only use the lualatex --shell-scape myfile.tex and this compiler creates a folder svg-inkscape with a couple of files name_svg_tex.pdf and name_svg-tex.pdf_tex. Then I prefer to do it manually and generate the last two files for embeded svg in a pdf from .tex. In other words I want to replicate for Inkscape 0.92

inkscape -D --export-filename=MyOutput.pdf_tex spektralnorm.svg

These are the errors:

So

Did you run the export with Inkscape? There's no file
`./svg-inkscape/spektralnorm.pdf_tex'
although `./svg-inkscape/spektralnorm.pdf' was found.


inkscape:42353): Unknown option -z

Package svg Warning: The export with Inkscape failed for file
(svg)                `img/spektralnorm.svg'
(svg)                Troubleshooting: Please check in the log file how
(svg)                the invocation of Inkscape took place and try to
(svg)                execute it yourself in the terminal on input line 31.

The important is generate the file .pdf_tex, generate .pdf is covered.

inkscape -D --export-type="pdf" spektralnorm.svg

And thanks, I hope that svg package updates pdflatex, xelatex, lualatex for Inkscape 1.0

Please note that I can not do

 inkscape -D --export-filename=MyOutput.pdf_tex spektralnorm.svg

because only InkFileExportCmd::export: Unknown export type: pdf_tex. Allowed values: [svg,png,ps,eps,pdf,emf,wmf,xaml] are supported, not even as a .tex.

This inkscape's docs helps me create a .pdf from .svg but not a .pdf_tex.

Oromion
  • 107
  • 3
  • 9
  • What about 'inkscape -D --export-latex --export-filename=my_file.pdf my_file.svg' ? – Moini Jun 19 '20 at 01:00
  • It's weird, for a single svg, exports 12 pages in the pdf. I tried with this [svg](https://de.wikipedia.org/wiki/Datei:Matrix-2-norm_qtl1.svg) and is not similar to native exporting with \usepackage{svg} and lualatex --shell-escape foo.tex. – Oromion Jun 19 '20 at 02:10
  • @Oromion The 12 pages get created because of the different layers of text and graphic elements. It will look fine in your document – samcarter_is_at_topanswers.xyz Jun 19 '20 at 07:35
  • Oh, thank you SamCarter. Then Moini answer is correct. I proposed this question because meanwhile I had TexLive 2019 with Inkscape 1.X I had an issue with lualatex when converts svg to pdf and generated .pdf_tex. But now I have TeXLive 2020 and works well as before. – Oromion Jun 19 '20 at 16:14
  • off topic of this question, sorry for left TX.SX so I'm happy that will continue learning about LaTeX in new forums. – Oromion Jun 20 '20 at 13:24

2 Answers2

10

So then, I'm going to formalize my comment as an answer:

With Inkscape 1.0, the command should be:

inkscape -D --export-latex --export-filename=my_file.pdf my_file.svg
Moini
  • 1,239
  • 9
  • 10
  • Where would I change the command in LaTeX? Some magic seems to call Inkscape and Inkscape does not recognize the command line parameters. Now I need to find out where the magic comes from. – Thomas Weller Apr 15 '21 at 13:06
4

Alternatively, if someone does not want to name the exported file for some reason, this works for me:

inkscape -D --export-latex --export-type="pdf" my_file.svg
Viggar
  • 140
  • 1
  • 8