[Tex/LaTex] include svg images with the svg package

graphicssvg

I'm trying to use the svg package for inserting svg images in my latex file, as suggested in other questions. But now I ran into a problem:

For example I have a image figure1.svg, if I write

\includesvg{figure1}

it will give an error says

ERROR: LaTeX Error: File `figure1.pdf_tex' not found.

But if I write

\includesvg{figure1.svg}

it will give another error says

ERROR: LaTeX Error: Unknown graphics extension: .svg.

How can I fix this problem? I'll prefer not having to convert all my svg files to pdf_tex files with some external program.


Update

My LaTeX environment is latest the TeXLive 2013 on Windows 7. A MWE code would be

\documentclass{article}
\usepackage{svg}

\begin{document}

\begin{figure}[htbp]
  \centering
  \includesvg{figure1.svg}
  \caption{svg image}
\end{figure}

\end{document}

Best Answer

The problem is that you have given a file extension: you should not do this (indeed this seems clear in the svg manual. For me, the short demo

\documentclass{article}
\usepackage{svg}
\usepackage{amsmath} % you need amsmath as the demo includes a use of \eqref
\begin{document}

\begin{figure}[htbp]
  \centering
  \includesvg{image}
  \caption{svg image}
\end{figure}

\end{document}

using the demonstration file used by the package works fine.

Note that for this to work:

  • You need Inkscape on your path (why?) (schtandard pointed to this step-by-step of the setup)
  • You need to compile your .tex file to PDF with the --shell-escape option enabled