7

I would like to use the .pdf_tex option for my SVG images exported from Inkscape because it's an amazing feature but it doesn't work as intended.

What I do:

  1. Export image from Inkscape

  2. Integrate into TeX by

    \begin{figure}
        \centering
        \def\svgwidth{\columnwidth}
        \input{N1N2N3.pdf_tex}
    \end{figure}
    
  3. Compile

Result:

In the PDF

enter image description here

My original SVG:

enter image description here

So thats not what I expected. Can you help me to get it tidy and neat?

So I fixed it partly by using

\begin{center}
\resizebox{2in}{!}{\input{inkscapeout.pdf_tex}}
\end{center}

to scale text and image together but I still got a problem with the xlabel of the graph because the numbers are moved into the graph and also the legend is moved a little upward.

New result

enter image description here

I uploaded my original svg-file here

https://owncloud.tu-berlin.de/index.php/s/8pRPwotDkiS0C5K

Martin Scharrer
  • 262,582
hcl734
  • 111
  • 1
    related: http://tex.stackexchange.com/questions/113282/text-size-in-inkscape – Marijn Jan 09 '16 at 22:29
  • Thank you for your advice although it doesn't solve my problem entirely. – hcl734 Jan 10 '16 at 10:27
  • The pdf is included a bit too far down, as you have noticed. Workaround: change the corresponding line in the pdf_tex file to \put(0,0.007){\includegraphics[width=\unitlength]{N1N2N3.pdf}}% (around line 50). However, if you are not using any LaTeX code in your graphs, maybe exporting to eps is easier? – Marijn Jan 10 '16 at 23:48
  • Maybe you are right, it's just a nice feature that text and graph use the same font. But still thx for the workaround and if somebody finds a non-workaround solution I would greatly appreciate it. :) – hcl734 Jan 11 '16 at 07:45
  • (The url to your svg document is dead. Could you provide a valid link?) – Clément Jan 13 '17 at 19:26
  • 1
    One main reason to use this feature is that text should be consistent with the font type and font size of the rest of the document. So, if you use this feature, it is up to you take care that the final image size is consistent with that font size ... and not the opposite. The "scalable" nature of Inkscape do not favor take care of real size of the SVG graph and their labels, but this is best approach, i.e, ensure that the original plot is made according to its final size, avoiding any scaling, and that text in Inkscape is really of similar dimensions to the TeX font. – Fran Dec 01 '18 at 19:48
  • 1
    \includesvg apparently treats text in your figure independently, so that it is rendered by LATEX by default. Probably the best way to solve this is to change the option inkscapelatex to false. See this answer. – clel Jul 13 '21 at 10:01
  • Note that this will also use the font style of the figure and not of the document, which might be an unwanted side effect. – clel Jul 13 '21 at 10:03

1 Answers1

1

Selecting a smaller font size should probably improve the result. Unfortunately the external link to the .svg file is death, so I can just guess a value

\begin{figure}
    \fontsize{6pt}{7pt}\selectfont
    \centering
    \def\svgwidth{\columnwidth}
    \input{N1N2N3.pdf_tex}
\end{figure}

Alternatively you could increase the font size in the original .svg (or whatever program you used to produce the graph).