mrpiggi / svg

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

Inkscape droped --file and --export-TYPE= parameter #20

Closed theScrabi closed 4 years ago

theScrabi commented 4 years ago

Acording to this issue: https://gitlab.com/inkscape/inbox/issues/1244 Inkscape 1.0 (beta) does not accept the --file and --export-TYPE= anymore. Therefore this package is broken if used with a newer inkscape version. Problem is fedora is already rolling out this version therefore on fedora this package can not be used anymore.

Just run into this very annoying.

theScrabi commented 4 years ago

Apperently what they want one to use in the future are actions: https://wiki.inkscape.org/wiki/index.php?title=Using_the_Command_Line#Via_actions

mrpiggi commented 4 years ago

I actually did some development for v2.03 and fixed it with #8 but currently I do not have time to go on with development. I will see, what I can do. Maybe I will provide a little patch for v2.02

For now, you can use this workaround

\usepackage{svg}
\makeatletter
\ifdefined\svg@ink@ver\else
  \def\svg@ink@ver{1}% change version to 0 if necessary
  \renewcommand*\svg@ink@cmd[2]{%
    \svg@ink@exe\space"#1.\svg@file@ext"\space%
    --without-gui\space\svg@ink@area\space%
    \ifx\svg@ink@dpi\relax\else--export-dpi=\svg@ink@dpi\space\fi%
    \if@svg@ink@latex--export-latex\space\fi%
    \ifx\svg@ink@opt\@empty\else\svg@ink@opt\space\fi%
    \ifnum\svg@ink@ver<\@ne%
      --export-\svg@ink@format="#2.\svg@ink@format"\space%
    \else%
      --export-type=\svg@ink@format\space%
      --export-file="#2.\svg@ink@format"\space%
    \fi%
  }%
\fi
\makeatother
theScrabi commented 4 years ago

Thank you :)

fstengel commented 4 years ago

Inkscape 1.0rc1 changed things a bit (again). No more --without-gui and --export-file becomes --export-filename. So the patch becomes:

\usepackage{svg}
\makeatletter
\ifdefined\svg@ink@ver\else
  \def\svg@ink@ver{1}% change version to 0 if necessary
  \renewcommand*\svg@ink@cmd[2]{%
    \svg@ink@exe\space"#1.\svg@file@ext"\space%
    \svg@ink@area\space%
    \ifx\svg@ink@dpi\relax\else--export-dpi=\svg@ink@dpi\space\fi%
    \if@svg@ink@latex--export-latex\space\fi%
    \ifx\svg@ink@opt\@empty\else\svg@ink@opt\space\fi%
    \ifnum\svg@ink@ver<\@ne%
      --export-\svg@ink@format="#2.\svg@ink@format"\space%
    \else%
      --export-type=\svg@ink@format\space%
      --export-filename="#2.\svg@ink@format"\space%
    \fi%
  }%
\fi
\makeatother

Thanks again for that precious tool

mrpiggi commented 4 years ago

Thanks for the report. I will adapt package svg as soon as I find some time for this...

fstengel commented 4 years ago

Le 24 avr. 2020 à 14:17, Falk Hanisch notifications@github.com a écrit :

Thanks for the report. I will adapt package svg as soon as I find some time for this...

No problem. Lets hope Inkscape's command line options won't change with the final release... — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mrpiggi/svg/issues/20#issuecomment-618975040, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABB5SU6FJVYACLIZPS3LFUDROF7PFANCNFSM4KPWDMBQ.

-- Frank STENGEL (fstengelmac.com)

jvasile commented 4 years ago

I and @kfogel ran into this bug and it looks like inkscape is fairly sanguine about breaking 3rd party tools. This is, after all, a major version release.

Once 1.0 ships and the interface settles, the challenge will be supporting both old and new CLI interfaces. The right answer might be to ship a wrapper script, call that, and have it call inkscape with the correct parameters. We had just started to think about what that might look like when we came here to see who else had encountered the bug and what solutions exist.

Thanks, @mrpiggi and @fstengel for the workarounds.

We've incorporated the workaround as a plugin into our Latex / Jinja templating system. It detects when the workaround is needed and adds it to your latex doc via jinja templating at build time. Thanks again.

jendrikw commented 4 years ago

For detecting the version, inkscape recommends calling inkscape --without-gui (or inkscape -z) and checking the exit code, but I'm not sure how you can do that in latex.

https://gitlab.com/inkscape/inbox/-/issues/2416

mrpiggi commented 4 years ago

Detecting version in LaTeX: https://github.com/mrpiggi/svg/blob/develop/source/svg.dtx#L4138

I already did something about this some time ago. I am going to provide a bug fix release until the end of this week.

mrpiggi commented 4 years ago

v2.02f was shipped to CTAN

mrpiggi commented 4 years ago

Inkscape 1.0rc1 changed things a bit (again). No more --without-gui and --export-file becomes --export-filename.

As well as --export-type is implied by the file extension of --export-filename