mrpiggi / svg

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

No helpful error message when inkscape conversion fails #43

Open jansol opened 2 years ago

jansol commented 2 years ago

So it turns out that Inkscape 1.1 (and presumably 1.0) saves as SVG 2.0 by default, and this includes some subtle changes* that break SVG 1.1 parsers i.e. older Inkscape releases. This is a problem for example when using ubuntu 21.10 for editing the SVGs on the desktop and editing the LaTeX document on overleaf.com with the 2021 texlive environment which is presumably running on the previous ubuntu LTS.

Unfortunately all that LaTeX has to say about it is a relatively uninformative "blahblah_svg.pdf_tex: no such file". I've already reported this to overleaf, but on selfhosted overleaf instances and other environments this might still come as a surprise and as such it would be great if the svg package could report problems the inkscape shell command encounters.

*such as using context-stroke and context-fill instead of specific colours in curve end markers

mrpiggi commented 2 years ago

Package svg is more or less an utility for Inkscape export automation via CLI. So if an export fails and no *.pdf_tex is generated, what do you think this package should do? This package does not and will not do any validity checks on SVG files itself.

jansol commented 2 years ago

It could see to it that whatever inkscape prints to stdout/stderr ends up in the LaTeX log. Or, if inkscape returns a nonzero exit code it could report that.

mrpiggi commented 2 years ago

AFAIR, the usage of stdout and stderr by Inkscape was kind of messy:

https://github.com/mrpiggi/svg/issues/31 https://gitlab.com/inkscape/inbox/-/issues/3882

If you are willing to provide a minimal example one overleaf, I will see what I can do.

jansol commented 2 years ago

In a blank overleaf template use this as the document body:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{svg}
\title{svg-poc}
\author{tester}
\date{April 2022}
\begin{document}
\maketitle
\section{Introduction}
\includesvg[width=\columnwidth]{broken.svg}
\end{document}

And upload this file: broken.svg

TeX Live 2021 fails with this. The upcoming TeX Live 2022 should have a newer Inkscape that converts this svg file correctly.

jansol commented 2 years ago

I don't have an old inkscape version at hand, but if it does simply not output anything useful that is unfortunate. In that case the error about the missing file could perhaps point out that this is a possible reason for the file being missing.