mrpiggi / svg

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

SVG extracted using `svg-extract` looks different from the original SVG #48

Open amine-aboufirass opened 1 year ago

amine-aboufirass commented 1 year ago

Here's my SVG drawing:

enter image description here

I include it in my LaTeX document using the svg package as follows:

\documentclass{article}

\usepackage{svg}

\begin{document}
    \includesvg{idea.svg}
\end{document}

Which results in the following:

enter image description here

Then I use the svg-extract package to extract it out into a PDF including the rendered LaTeX math:

\documentclass{article}

\usepackage[extractformat=pdf]{svg-extract}

\begin{document}
    \includesvg[keepaspectratio]{idea.svg}
\end{document}

I run latexmk --shell-escape idea.tex and the resulting PDF is as follows:

enter image description here

It looks like the text has been moved to accomodate some smaller bounding box than that which the SVG originally intended.

How can I prevent this behavior and get back the SVG as it looked in the original PDF?

mrpiggi commented 1 year ago

Just for the sake of completeness, here is a cross-prost from https://tex.stackexchange.com/questions/678479

mrpiggi commented 1 year ago

As mentioned in the comments, for now latexmk --shell-escape -pdf idea.tex should work. Nevertheless, this would need some investigation at some point.

bedw8 commented 10 months ago

As mentioned in the comments, for now latexmk --shell-escape -pdf idea.tex should work. Nevertheless, this would need some investigation at some point.

hi, i have the same problem, and that line also doesn't work for me.

I'm not sure, but i'm guessing svg-extract is importing the same preamble of the main document, while including a svg with svg only make it agnostic to the document preamble ???

The thing i'm seeing is, for instance, when i include a svg with pretex=\footnotesize, in the main document it looks well, but in the svg-extract version of it the text font size is normal. Also, I noticed that the text on the extracted version has double space between lines. And that is how i have formatted the text on my main document. But, in the included svg, the text does not have that huge space between lines.

mrpiggi commented 10 months ago

hi, i have the same problem, and that line also doesn't work for me.

This kind of error report doesn't work for me. What action should I take without any information. How should I be able to reproduce the issue without a running minimal example?

I'm not sure, but i'm guessing svg-extract is importing the same preamble of the main document, while including a svg with svg only make it agnostic to the document preamble ???

Well, instead of guessing, having a brief look into the package documentation would maybe be an approach.

In general, graphics extracted with package svg-extract should look the same as those included with package svg as long as you carefully do all your markup settings in the preamble.