I am currently working on my PhD thesis, and I am having trouble including a pdf_tex
and pdf
file created using Inkscape
. I am using TeXStudio
and PDFLaTeX
.
The relevant files are:
phd_thesis_all/phd_thesis/tex/thesis.tex
phd_thesis_all/phd_thesis/tex/Chapter05/teleoperation.tex
phd_thesis_all/phd_thesis_figs/images/teleoperation/solidworks_model_view.pdf_tex
phd_thesis_all/phd_thesis_figs/images/teleoperation/solidworks_model_view.pdf
phd_thesis_all/phd_thesis_figs/images/teleoperation/solidworks_model_view.png
phd_thesis_all/phd_thesis_figs/images/teleoperation/solidworks_model_view.svg
The svg
has added annotations to the png
file. This is exported as a pdf
and pdf_tex
file for use in the thesis.
The command to include the file with the diagram is in thesis.tex
.
% Chapter 5
\FloatBarrier
\chapter{Teleoperation}
\label{ch:teleoperation}
\include{Chapter05/teleoperation}
The figure import command in Chapter05/teleoperation.tex
is:
\begin{figure}[htb]
\centering
\import{../../phd_thesis_figs/}{images/teleoperation/solidworks_model_view.pdf_tex}
\caption{\SolidWorks Model with Coordinate Systems Highlighted}
\label{fig:solidworks_model_view}
\end{figure}
When I try to compile the document, it comes up with the error:
(../../phd_thesis_figs/images/teleoperation/solidworks_model_view.pdf_tex
LaTeX Warning: File `solidworks_model_view.pdf' not found on input line 52.
! Package pdftex.def Error: File `solidworks_model_view.pdf' not found.
See the pdftex.def package documentation for explanation.
Type H <return> for immediate help.
...
l.52 ...length,page=1]{solidworks_model_view.pdf}}
%
?
In other words, it is finding the .pdf_tex
file just fine, but is choking on the \includegraphics
command inside to get the pdf
file. I thought the \import
command modified the search paths for files in its command. My graphicspath
is set so I can import graphics file from that directory tree just fine.
If I change the figure inclusion to:
\includegraphics[width=\linewidth]{images/teleoperation/solidworks_model_view.png}
Everything works perfectly fine. Why can I not do the same with \import
and pdf_tex
files?
For completeness, here is the pdf_tex
file generated by Inkscape. THe offending \includegraphics
directive is on line 52.
%% Creator: Inkscape 0.91_64bit, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'solidworks_model_view.pdf' (pdf, eps, ps)
%%
%% To include the image in your LaTeX document, write
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics{<filename>.pdf}
%% To scale the image, write
%% \def\svgwidth{<desired width>}
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics[width=<desired width>]{<filename>.pdf}
%%
%% Images with a different path to the parent latex file can
%% be accessed with the `import' package (which may need to be
%% installed) using
%% \usepackage{import}
%% in the preamble, and then including the image with
%% \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%% \graphicspath{{<path to file>/}}
%%
%% For more information, please see info/svg-inkscape on CTAN:
%% http://tug.ctan.org/tex-archive/info/svg-inkscape
%%
\begingroup%
\makeatletter%
\providecommand\color[2][]{%
\errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
\renewcommand\color[2][]{}%
}%
\providecommand\transparent[1]{%
\errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
\renewcommand\transparent[1]{}%
}%
\providecommand\rotatebox[2]{#2}%
\ifx\svgwidth\undefined%
\setlength{\unitlength}{1680bp}%
\ifx\svgscale\undefined%
\relax%
\else%
\setlength{\unitlength}{\unitlength * \real{\svgscale}}%
\fi%
\else%
\setlength{\unitlength}{\svgwidth}%
\fi%
\global\let\svgwidth\undefined%
\global\let\svgscale\undefined%
\makeatother%
\begin{picture}(1,0.60119048)%
\put(0,0){\includegraphics[width=\unitlength,page=1]{solidworks_model_view.pdf}}%
\put(0.80420207,0.1664867){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$z$}}}%
\put(0.77685686,0.12356509){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$x$}}}%
\put(0.7926602,0.10007423){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{$y$}}}%
\end{picture}%
\endgroup%
Best Answer
Ok, I've just been battling the same problem.
My solution was to add a
\graphicspath{{figs/}}
in the beginning of the file, so that it know where to look for the .pdf file. I'm not sure why, but addingfigs/
in the beginning of the input command\input{figs/AMB-SyRM4d.pdf_tex}
was not enough.Hope this helps.