mrpiggi / svg

Handling SVG pictures in LaTeX documents using Inkscape, ImageMagick and/or Ghostscript
Other
65 stars 12 forks source link

inkscapeexe as package option behaves differently from svgsetup macro #32

Closed ProcyonTheEvil closed 3 years ago

ProcyonTheEvil commented 3 years ago

Hello,

I noticed that the option inkscapeexe behaves differently when set as a package option from the case when set as a parameter to the svgsetup macro:

This works:

% !TeX encoding = UTF-8
% !TeX spellcheck = en_GB
% !TeX program = lualatex
\documentclass{article}
\usepackage{svg}
\svgsetup{inkscape=overwrite,inkscapeexe="C:/Program Files/Inkscape/bin/inkscape.exe"}
\begin{document}
\includesvg{test.svg}
\end{document}

This fails:

% !TeX encoding = UTF-8
% !TeX spellcheck = en_GB
% !TeX program = lualatex
\documentclass{article}
\usepackage[inkscape=overwrite,inkscapeexe="C:/Program Files/Inkscape/bin/inkscape.exe"]{svg}
\begin{document}
\includesvg{test.svg}
\end{document}

with the following error:

("C:/Users/Username/AppData/Local/Programs/MiKTeX 2.9/tex/context/base/mkii/su
pp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count189
\scratchdimen=\dimen153
\scratchbox=\box50
\nofMPsegments=\count190
\nofMParguments=\count191
\everyMPshowfont=\toks24
\MPscratchCnt=\count192
\MPscratchDim=\dimen154
\MPnumerator=\count193
\makeMPintoPDFobject=\count194
\everyMPtoPDFconversion=\toks25
)
("C:/Users/Username/AppData/Local/Programs/MiKTeX 2.9/tex/latex/epstopdf-pkg/e
pstopdf-base.sty"
Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 48
5.
) ("|'C:/ProgramFiles/Inkscape/bin/inkscape.exe' -V")
runsystem(call "C:/ProgramFiles/Inkscape/bin/inkscape.exe" -V > test.svg.ink.ver
.aux)...failed 
runsystem(del test.svg.ink.ver.aux)...executed
Package svg Info: Calling Inkscape on input line 11.
runsystem("C:/ProgramFiles/Inkscape/bin/inkscape.exe" "test.svg" -D --export-lat
ex --export-filename="test_svg-tex.pdf")...failed 
runsystem("C:/ProgramFiles/Inkscape/bin/inkscape.exe" "test.svg" -D --export-lat
ex --without-gui --export-pdf="test_svg-tex.pdf")...failed 

! Package svg Error: Inkscape version not detected.

See the svg package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.11 \includesvg{test.svg}

It was tried to invoke `"C:/ProgramFiles/Inkscape/bin/inkscape.exe"'
for file "test.svg"
but no result was produced. Check the log file
and set `inkscapeversion=<version>' manually.

i.e. the space in the path name is removed (whole log is attached). Using the short 8.3 name format does not work either. Using a pathname without a space works perfectly when inkscapeexe is set as a package option. I expected that the location of inkscapeexe does not matter. Anyway, please add the line \svgsetup{inkscapeexe="C:/Program Files/Inkscape/bin/inkscape.exe"} as an example to the documentation. I assume especially Windows users need to set this option and I had to do some trial and error before I figured out how to do it correctly.

mrpiggi commented 3 years ago

Probably this is related to the way, package options are parsed. I'll have a look.

mrpiggi commented 3 years ago

It is related to the kernel, see https://stackoverflow.com/q/2675365

Because of the way package svg parses the option after these where passed by the kernel, the proposed workaround with any set of braces won't work. So you really have to use \svgsetup after the package was loaded. I will a hint to the documentation.

mrpiggi commented 3 years ago

related to https://github.com/latex3/latex2e/issues/85