[Tex/LaTex] SVG and inkscape

inkscapesvg

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

Best Answer

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/