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)?

4
  • 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? Jun 21, 2018 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, 2018 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, 2018 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, 2018 at 15:49

1 Answer 1

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.

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