Reputation: 72
I am doing a beamer latex presentation and I would like to know how is it possible to add directly a svg graphic on it. I know that it is possible to convert the svg file to pdf format and then include it to beamer, but I want to include the svg file directly (without convert it to pdf format).
The code must looks like:
\begin{frame}
\frametitle{Frame SVG example}
\begin{figure}
\includegraphics[\textwidth]{graphic.svg}
\end{figure}
\end{frame}
Thanks in advance!
Upvotes: 3
Views: 8550
Reputation: 51
You can use the SVG package to achieve that. It will convert your .svg on the fly using Inkscape (which needs to be installed on your computer). It will re-export your figures if the .svg file is changed.
A minimal example could look like this:
\documentclass{beamer}
\usepackage{svg}
\setsvg{inkscape = "C:/Program Files/Inkscape/inkscape.exe" -z -D}
\begin{document}
\begin{frame}
\includesvg[width=0.7\textwidth]{path/to/mysvgimage}
\end{frame}
\end{document}
There are some things to consider, such as text formatting and alignment. Have a look at the documentation of the SVG package.
You also need to make sure that your allow latex to call Inkscape with
pdflatex -synctex=1 -interaction=nonstopmode --shell-escape %.tex
or
latex -interaction=nonstopmode --shell-escape %.tex
Upvotes: 5