I am trying to get the svg package working on an OSX system. If I use inkscape to save the *.svg files as *.pdf and *.pdf_tex, then the sample file from this question works fine:
\documentclass{article}
\usepackage{svg}
\usepackage{amsmath}
\begin{document}
\begin{figure}[htbp]
\centering
\includesvg{example}
\caption{svg image}
\end{figure}
\end{document}
But no matter what I try, the package will not create the pdf and pdf_tex files automatically. Instead I get an error:
! LaTeX Error: File `./example' not found.
I have added inkscape to the PATH. I've added the --shell-escape
option to the latex command… I'm at a loss.
Best Answer
This is a macOS-specific issue.
The
inkscape
shell script which invokes the main inkscape binary has to change directory to the inkscape installation directory, which is why it fails finding the SVG files in the current working directory.See this explanatory comment on line 30 of the inkscape script,
/usr/local/bin/inkscape
on my macOS:That's a smoking gun if I've ever seen one. :)
You can try commenting out the
cd "$BASE" || exit 1
line, and the conversion should still work for simple SVGs. This is what I am currently doing.Alternatively, one would have to modify
svg
LaTeX package to invoke inkscape with full input and output pathnames instead of relative. Another option would be to modify theinkscape
shell script to expand relative paths to absolute.