1

I made a figure in inkscape to be included in my document. The document itself has the following structure

main.tex
   |
   |- /chapters
          |- chap1.tex
          |- chap2.tex
          |- /figures
                |- fig1.pdf
                |- fig1.pdf_tex
                |- fig1.svg

In the main.tex I include all the chapters separately. I also have there a \graphicspath{{chapters/figures}} to include the path to the figures. To export/import the figures from inkscape to LaTeX I follow this instruction. The including code looks like

\begin{figure}[]
\centering
\input{chapters/figures/fig1.pdf_tex}
\caption{Figure}
\label{fig:fig}
\end{figure}

When I now compile the document, I get the error message that file fig1.pdf is not found, even though it's in the same directory as fig1.pdf_tex.

Is there something I need to add to make it work?

EDIT: So I tried the solution proposed in here, but replacing the input statement with \import{chapters/figures}{chapters/figures/fig1.pdf_tex} leads to the same error.

fukurai
  • 33

1 Answers1

0

You need to add an extra slash to your graphicspath:

\graphicspath{{chapters/figures/}}

However, I would recommend using the svg package. It takes away this hassle by providing the \includesvg command and even recompiles the svg file when it has been altered.

In your case, you could write

\usepackage[svgpath=./chapters/figures/]{svg}

in your preamble and then create the figure using

\begin{figure}
    \centering
    \includesvg{fig1}
    \caption{Figure}
    \label{fig:fig}
\end{figure}
schtandard
  • 14,892
  • Your edit made it work. So now I can get rid of the *.pdf and *.pdf_tex and just work on the svg-files in the figures folder, right? – fukurai Feb 02 '17 at 10:54
  • @fukurai: No, not quite. LaTeX still imports the .pdf file using the .pdf_tex file. What the svg package does is call inkscape to renew these files if they are outdated (i.e. the .svg file changed). So inkscape will still have to be installed and the .pdf_tex and .pdf files will still appear in your images folder. Note that write18 has to be enabled (call LaTeX with the -shell-excape option) for this to work. Also, you might run into the bug discussed in this question. – schtandard Feb 02 '17 at 13:28