1

I am trying to include an SVG image into my document which had always (kind of) seemed to work when using \includesvg. But now I have an image that I created from a postscript file, modified in Inkscape (saved as plain svg), which is not centered at all when included using:

\begin{figure}                                                                   
  \centering                                                                     
     \includesvg{resources/svg/an-image}                                                                                                
\end{figure} 

When I run everything through pdflatex, the left border of the image is positioned in the center of the page, most of the right part is cut off and if I add a caption it is placed way below the images lower border. It looks as if the image had a very large empty margin (which it definitely does not have in the SVG file).

Unfortunately the image itself is confidential so I cannot share it here. What might be the cause of this? Might there be a workaround using another command than \includesvg (that one has caused me unnecessary trouble before)?

nox
  • 4,160
  • 12
  • 26
Peter
  • 178
  • 1
    Can you copy the .svg file, replace everything confidential with one large rectangle and if this also produces the error, share the svg file for us to test? – samcarter_is_at_topanswers.xyz Jun 21 '18 at 15:00
  • if you work with Inkscape, yo just save a copy in pdf format and import it using graphicx package like in this post – J Leon V. Jun 21 '18 at 15:00
  • 1
    After some inspection I believe the problem probably lies with inkscape, the apparent image size after including the image with \includesvg approximately matches the pagesize in Inkscape before resizing to the actual content's dimensions. I will just do as suggested and use another file format for now. – Peter Jun 21 '18 at 15:44
  • I believe there is little advantage in exporting a modified postscript as .svg as opposed to, say, PDF if you only want to include it in a .tex document. – moewe Jun 21 '18 at 15:49

1 Answers1

1

You may have invisible objects that extend outside of the SVG's viewBox (inksacpe's page). Have a look at the inkscapearea option. Possible values are

  • drawing/nocrop (default) : adjust SVG viewbox to fit all elements.
  • page/nocrop : respect SVG viewBox.
NicolaF_
  • 113