15

I use Inkscape to convert an SVG to pdf latex, after the conversion I want to scale the image so it matches the second image. But the text does not scale accordingly to the boxes. I use the following code to render the first image. Does anyone know how I can scale the boxes and the text, so it matches the second image?

\usepackage{svg}


\begin{figure}[ht] 
    \centering 
    \includesvg[width=0.7\textwidth]{someimage} 
    \caption{foo} 
    \label{bar} 
\end{figure}

Wrongly Scaled image

Image should scale to this

3 Answers3

32

I am adding this because the accepted answer does not mention this solution, which is much cleaner.

\includesvg treats whatever text in your figure independently by default.

The cleanest way to scale your text with your figure is to set the inkscapelatex parameter to false. This document explains this as follows:

If option inkscapelatex=true is set, the output is split into a seperate PDF/EPS/PS file (see optioninkscapeformat) and a corresponding LATEX file. This is the default setting. Setting inkscapelatex=false will result in a single PDF/EPS/PS file, where any contained text won’t be rendered by LATEX.

Therefore, \includesvg[inkscapelatex=false,<other params>]{svgfile} is what you are looking for.

clel
  • 325
cPickle
  • 421
  • 7
    This should be the accepted solution. – GBF_Gabriel Nov 21 '19 at 13:46
  • 7
    But that means LaTeX's font will not be used for the text, mathematical expressions will not be typeset by LaTeX, and so on. There is a case for still rendering text in LaTeX AND being able to scale the image and the text at the same time. – pintoch Jul 07 '20 at 11:05
  • Another option would be to use \includesvg[pretex=\small,<other params>]{<svgfile>} or any other font size switch than \small fulfilling your need – mrpiggi Jul 14 '21 at 10:07
9

There are a few different possibilities:

  • \fontsize{8}{10}\selectfont (or whatever size is appropriate) to use a smaller font size.

  • use the same font size as in your document already during the design process in inkscape

  • or, as Harald Hanche-Olsen pointed out in his comment include the graphic with a larger size and scale it down using \scalebox or similar tools.

4

To add to the answer of cPickle (because I'm not allowed to comment yet):

You can also set the option inkscapelatex=false globally by using \svgsetup after importing the svg package:

\usepackage{svg}
\svgsetup{inkscapelatex=false}