0

This question already has an answer here:

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.

marked as duplicate by Chris H, ebosi, Zarko, Kurt, Martin Schröder Feb 2 '17 at 11:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • What's the exact content of the includegraphics line in fig1.pdf_tex? This has been addressed before I think. – Chris H Feb 2 '17 at 9:42
  • 1
    Is the pdf found if you use \includegraphics{chapters/figures/fig1.pdf} to your main.tex? – Ulrike Fischer Feb 2 '17 at 9:44
  • @ChrisH: it's \put(0,0){\includegraphics[width=\unitlength,page=1]{fig1.pdf}}% and I tried the solutions of Including pdf_tex images from inkscape, but that didn't worked either. – fukurai Feb 2 '17 at 9:55
  • @UlrikeFischer If I use \includegraphics{chapters/figures/fig1.pdf} instead of the \input statement, pdflatex finds the file and displays it in the document, just without the texts in the figure. – fukurai Feb 2 '17 at 10:06
  • Now test the graphicspath command by trying \includegraphics{fig1.pdf}. – Ulrike Fischer Feb 2 '17 at 10:22
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}
  • 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 2 '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 2 '17 at 13:28

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