1

Can anyone check what is wrong with this svg? This is the file from a famous article, rendered correctly in both Chrome and Inkscape:

svg

My MWE in Overleaf:

\documentclass{article}
\usepackage{svg}

\begin{document}
\begin{figure}
    \includesvg[width=\linewidth]{./flow-matic-4.svg}
\end{figure}
\end{document}

And the result:

incorrectly rendered

3
  • I would guess that this is either a bug in the svg package or the SVG uses some features that are not supported by that package. Either way you should be find if you convert that SVG to an EPS using Inkscape and the use \includegraphics to include that into your TeX document.
    – Raven
    May 6, 2021 at 7:23
  • 1
    Remember that LaTeX does not support SVG, the svg package attempts to use inkscape to convert the SVG into a format that LaTeX understands. So saying that Chrome and inkscape renders the file correctly is kinda irrelevant as it is the conversion that is important.
    – daleif
    May 6, 2021 at 7:34
  • @Raven Ok I'll try that EPS, never heard of it. svg uses Inkscape under the hood, and the file is rendered correctly in Inkscape, that's why I thought it should be included nicely. May 6, 2021 at 7:49

1 Answer 1

3

The svg package uses Inkscape to convert a given SVG file to PDF and inputs the resulting file afterwards. By default, the Inkscape export is invoked with flag --export-latex in order to process any text in the SVG file via LaTeX. As your intention is to leave text as it is and not to process it via LaTeX, you should pass inkscapelatex=false to \includesvg.

This should work:

\documentclass{article}
\usepackage{svg}

\begin{document}
\begin{figure}
  \includesvg[width=\linewidth,inkscapelatex=false]{./flow-matic-4.svg}
\end{figure}
\end{document}
2
  • 1
    Mister you saved my a** today! May 6, 2021 at 8:03
  • OMG thank you!!!! I was going crazy! Jul 13, 2022 at 3:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .