Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
I just tried it using a simple SVG. I had all prerequisites: adding the --shell-escape option to pdflatex and installing ImageMagick. To me it seems as if the package is a bit buggy. –  Uwe Ziegenhagen Jul 7 '13 at 6:40
    
I spite of your last sentence, I suggest change all \includesvg{..} by \includegraphics{...} without any extension and (1) import the latex document with Lyx to allow an automatic conversion with rsvg-convert or (2) work directly with pdf files that still can be edited with Inkscape. For many files is less painfull the command line (inkscape -f file.svg -A file.pdf). –  Fran Jul 7 '13 at 10:11
    
May be useful: How to include SVG diagrams in LaTeX? –  Harish Kumar Jul 7 '13 at 13:10

1 Answer 1

up vote 9 down vote accepted

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}
\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 (you need amsmath as the demo includes a use of \eqref).

Note that for this to work:

  • You need Inkscape on your path
  • You need to run the file with the --shell-escape option enabled
share|improve this answer
    
Getting this to work on Windows is OK, but on my Mac seems tricky. That's likely an Inkscape/Mac issue, so not relevant here! –  Joseph Wright Aug 24 '13 at 6:56
    
Calling svg as \usepackage[inkscape={/Applications/Inkscape.app/Contents/Resources/bin/inkscap‌​e -z -C}]{svg} seems to solve the issue on Mac OS X (assuming Inkscape has been installed with the .dmg file. –  egreg Aug 24 '13 at 10:54
    
@egreg I'd tried that and also adding Inkscape to /etc/paths: in both cases I get some errors at the Inkscape end, presumably due to which support items I have set up (and which it expects to be present). –  Joseph Wright Aug 24 '13 at 15:13
    
I'll probably remove the version I installed with the .dmg and try with the one provided by Homebrew, which should work out of the box with svg. –  egreg Aug 24 '13 at 15:25
1  
@LWZ No, what actually happens is that the svg package uses Inkscape to convert to PDF on-the-fly. You have to have Inkscape available for this to work. –  Joseph Wright Aug 24 '13 at 16:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.