mrpiggi / svg

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

Fix `Runaway argument' for macOS 10.15 #36

Closed terrex closed 3 years ago

terrex commented 3 years ago

when verifying version of inkscape:

(|'inkscape' -V 2>&1)
Runaway argument?
! Paragraph ended before \svg@tempb was complete.
<to be read again>
                   \par
l.11 \begin{document}

?

Reverts partially 9b9c5554d5e4a554c9f338ca726dc0df62d41c3c (which fixes mrpiggi#31)

mrpiggi commented 3 years ago

As I do not have an access to MacOS I am really interested, if redirecting stderr to stdout isn't possible. Are you sure? What result do you get, running inkscape -V 2>&1 via terminal.

mrpiggi commented 3 years ago

And what is the result of running pdflatex -shell-escape for this document?

\listfiles
\documentclass{minimal}
\usepackage[T1]{fontenc}
\makeatletter
\begin{document}
\@@input|"'inkscape'\space-V"

\@@input|"inkscape\space-V"

\@@input|"'inkscape'\space-V 2>&1"

\@@input|"'inkscape'\space-V 2>&1"
\end{document}
terrex commented 3 years ago

Ok... macOS was not the real problem. Redirecting stderr to stdout is same as in Linux, because bash shell is the same (2>&1). Al your 4 tests works OK, with no latex errors, I'll attach them; but maybe the problem is when response of the command is further processed by your svg.sty because of locale issues. In my bash, I have LANG=C but LC_ALL is empty, so inkscape throws messages about locale in stderr, so, when redirected to stdout, your current svg.sty from CTAN fails parsing the command output.

I've zipped for you two executions of the same test:

$ pdflatex -shell-escape test.tex
$ LC_ALL=C pdflatex -shell-escape test.tex

With_LC_ALL_empty.zip With_LC_ALL_C.zip

When compiling my original latex project with no custom modifications to svg.sty an adding LC_ALL=C to environment everything is OK.

Maybe, this problem will be resolved when inkscape 1.0 is packaged in macports for macOS. At this moment, my inkscape version is 0.92.5.

I propose my "fifth try" in the meanwhile, forcing locale to C:

\@@input|"LC_ALL=C LANG=C 'inkscape' -V 2>&1"

The output is attached as Fifth try.zip

Fifth try.zip

Thank you for all, and sorry for the inconvenience.

mrpiggi commented 3 years ago

Sorry, but your proposed fix won't work on Windows. I am also reluctant to add any system specific commands as well. I have to think, how to resolve this issue. I could either

  1. provide an additional hook to execute user-defined commands right before invoking Inkscape or
  2. remove redirecting stderr to stdout at all.

I tend to the second variant, because the original problem with MiKTeX has been solved in the meantime and I prefer to implement as generalized functionalities as possible. OS specific workarounds only increase the maintenance effort for me without any real benefit for users.

terrex commented 3 years ago

Nice job @mrpiggi , thank you!

mrpiggi commented 3 years ago

Actually, the "fix" is the partial reverson of 9b9c555 as initial proposed by you ;)