1

If the image is in the document's directory this works:

\usepackage{graphicx}
\usepackage{grffile}

\begin{document}
    \input{"image name with spaces"}
\end{document}

If the image is in a sub directory called images this works:

\usepackage{graphicx}
\graphicspath{{./images/}}

\begin{document}
    \input{imagenamewithoutspaces}
\end{document}

But, again if the image is in a sub directory called images, this does not work:

\usepackage{graphicx}
\usepackage{grffile}
\graphicspath{{./images/}}

\begin{document}
    \input{"image name with spaces"}
\end{document}

Am I doing something wrong or is there a limitation when using grffile with graphicspath?

Edit

The graphic I input is a .pdf_tex-file created by Inkscape's PDF+LaTeX export. I input the file by \input{"image name with spaces.pdf_tex"}. In this file \includegraphics{image name with spaces.pdf} is called.

Daniel
  • 1,787
  • \graphicspath don't work with \input, so your example doesn't make sense. – Ulrike Fischer Nov 12 '15 at 13:13
  • Works as I described. But maybe the problem is more tricky than I expected (see my edit). – Daniel Nov 12 '15 at 13:58
  • 1
    Where is image name with spaces.pdf_tex? (But I always wonder why people waste their life time to get file names with spaces working, when it is so easy to replace the spaces by something sensible.) – Ulrike Fischer Nov 12 '15 at 14:13
  • It is in the subdirectory images. (In my case it is because I want to support another application that automatically exports with spaces. Actually, I wonder why LaTeX does not support file names with spaces by default given that they are allowed in modern OSs.) – Daniel Nov 12 '15 at 14:35
  • And why do you expect that latex can find it there? As I wrote: \graphicspath sets the search pathes for graphics, not for arbitray files. And I suggest that you read the documentation of grffile to understand some of the problems involved with spaces. It is imho a very bad feature of modern OS to allow them. It makes it very difficult to pass file names around in scripts. – Ulrike Fischer Nov 12 '15 at 14:42
  • I see. Sorry for my confusion. So I need to find a way to support spaces in file names with import. And this support is not by grffile. – Daniel Nov 12 '15 at 14:50
  • Okay, so it seems I need to (1) specify the path explicitly in the input and embrace with quotes for the tex file, like \input{"./images/image name with spaces.pdf_tex"} and (2) add \usepackage{grffile} and \graphicspath{{./images/}} to the preamble for the inclusion of the graphics that happens within the the file. – Daniel Nov 12 '15 at 14:58
  • 1
    You are confusing search path problems and problems with spaces. \input{"images/image name with spaces.pdf_tex"} should work fine. See http://tex.stackexchange.com/questions/241828/define-path-for-packages-in-the-latex-file-analog-of-inputpath-or-graphicspa for a way to set search pathes for other files. – Ulrike Fischer Nov 12 '15 at 15:00
  • I see. Thanks. So LaTeX supports spaces in file names out of the box after all. Just the graphics input via \includegraphics is more tricky. My knowledge of LaTeX is very limited. – Daniel Nov 12 '15 at 15:01

0 Answers0