1

I have the following example:

\documentclass{article}
\usepackage{svg}
\begin{document}

\begin{figure}[htbp]
  \centering
  \includesvg{fig1}
  \caption{svg image}
\end{figure}

\end{document}

I would like to include the figure fig1.svg into my latex document.
I enabled -shell-escape

When compiling I get the following error message:

Package svg Warning: The export with Inkscape failed for file
(svg)                `fig1.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 7.

As far as I understand, latex cannot find Inkscape (which is installed in my machine). I use Texworks 0.6.2 and MikTex 2.9 within Win10.

How can I set correctly the directory where LaTex can find Inkscape (which is actually located in C:\Program Files\Inkscape

  • 1
    You need Inkscape on your path (system variable PATH). In svg-package documentation: An working installation ofInkscapeis required for the automated integration of SVG graphics,whereby the installation path must be known to the operating system. – Vladimir Feb 8 at 23:44
  • @Vladimir thanks. my problem is that I do not know how to change the installation path in Windows. – Dario Feb 9 at 9:41
  • In the answer below you will need to add if there is an empty box C:\Program Files\Inkscape OR if there are existing entries ;C:\Program Files\Inkscape (that is use a semicolon as separator) – KJO Feb 10 at 0:40
2

I am answering just for the messages in this case see links below for a wider choice

"Package svg Warning: The export with Inkscape failed for file 'yourimagepath/filename.svg' "

! Package svg Error: File 'filename_svg-tex.pdf' is missing.

In windows Inkscape needs to be "on path" whilst SVG is running via -shell-escape

In TeXworks and many other editors, this can be done without all the rigmarole of adjusting the system. However DO NOTE this will only help the sessions from within the editor. There is a different method needed for working with the command line console.

You simply need to add the Inkscape folder to those that TeXworks will use, note your inkscape folder may be in program files or program files (x86) or any other location you installed it (you may need to search with explorer outside of the editor to ensure it is the one containing inkscape.exe)

In this users case if there is an empty box then enter C:\Program Files\Inkscape OR if there are existing entries ;C:\Program Files\Inkscape (that is Windows uses a semicolon as separator, Mac user need a full colon)

Make an accurate note of the folder name as you may need it later.

enter image description here

That sould allow svg to work from inside TeXworks

For my fuller description of failures of SVG to launch see https://tex.stackexchange.com/a/474097/170109

To set Inkscape folder permanently (you did make a note of it, did you not) in your path there is a good guide at https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/

  • Very good and complete answer. My true compliments. – Sebastiano Feb 9 at 23:25

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.