# How to extract this SVG to LaTeX?

I want to extract SVG picture for my Beamer presentation. I do the following but I get output in Fig. 1, based on the thread answer How to include SVG diagrams in LaTeX?, without any errors/warnings

# https://tex.stackexchange.com/a/2107/13173
inkscape -D -z --file=image.svg --export-pdf=image.pdf --export-latex


Input is Wiki Ebola SVG picture.

Fig. 1 Output from the command where all textual content is missing

OS: Debian 8.7
Inkscape: Inkscape 0.48.5 r10040 (Oct 7 2014)

• The LaTeX/text is in the generated image.pdf_tex file. You have to include it into your document with \input{image.pdf_tex} – user31729 Mar 5 '17 at 8:00
• If maintain standard LaTeX font sizes and font type is not a must, is just safer and easier save it as PDF only (not pdf+LaTeX) and include the graphics just as JPG and PNG images. Otherwise, using xelatex or lualatex there are not problem to use the same font in the .svg and .tex files, so I guess that the issue will be only take care of the font size and the size of the SVG file, to avoid scaling in LaTeX. – Fran Mar 5 '17 at 11:29

Here are two ways to include an .svg image into LaTeX, there might be more possibilities of course.

The first one is the usage of the exporting figure to .pdf and .pdf_tex, where the second file contains the text (LaTeX) content.

Use \usepackage{graphicx} and \input{image.pdf_tex} then.

The easier way is \usepackage{svg} and \includesvg. This does the conversion internally, in this case, graphicx is loaded automatically. Similar to \includegraphics, \includesvg allows for some options to configure the width and behaviour of the inclusion, important is pretex, for example. I refer to the manual for more information about the svg package.

However, in both ways the font size is too large, so use \tiny for example and optionally, some scale etc. option.

\documentclass{article}

\usepackage{graphicx}

\usepackage{svg}

\begin{document}

{\tiny
\input{image.pdf_tex}}

\includesvg[pretex=\tiny]{img}

\end{document}


• What is the point of having such a confusing pdf output, the one in my body? - - Yes, I note that there is such a file as pdf.tex. Your approach seems to work. – Léo Léopold Hertz 준영 Mar 5 '17 at 8:13
• @LéoLéopoldHertz준영: The .pdf file does contain the pure graphics only. I don't have developped inkscape ;-) – user31729 Mar 5 '17 at 8:40
• @LéoLéopoldHertz준영 you explicitly told inkscape that you want two files by using the option --export-latex. – samcarter_is_at_topanswers.xyz Mar 5 '17 at 10:02
• @LéoLéopoldHertz준영 The same content in both files would make zero sense. The whole point is to get all the text in latex format, which will ensure that the fonts etc. match the ones from your document. If this is too complicate, leave out the --export-latex option and you will simply get one image to include. – samcarter_is_at_topanswers.xyz Mar 5 '17 at 10:06
• @LéoLéopoldHertz준영, as you seem (from your the comments on this answer) to want a simple file structure, at the expense of losing font-matching, my answer to the question you linked might help, as might the link in it – Chris H Mar 6 '17 at 8:55