[texworks] technical problem involving \include, \includegraphics \graphicspath and grffile package

Bruno Voisin bvoisin at me.com
Sun Apr 17 08:27:28 CEST 2011

Le 16 avr. 2011 à 17:25, Mehdi Ranjbaran a écrit :

> The path to the directory contains, however, space characters and that's the source of my problems. I use grffile package together with \graphicspath:
> \usepackage[space]{grffile}
> \graphicspath{../../My Graphic Files/}
> but get the error message:
> "
> ! Package pdftex.def Error: File `fig1.pdf' not found.
> [...]
> However, when I don't use \graphicspath and include the full path of the graphic file in \includegraphics I have no difficulty and the final .pdf file is produced:
> \includegraphics{../../My Graphic Files/fig1.pdf}
> Do you know how I can get rid of this pesky error? I don't want to write the full path every time I use \includegraphics.

Did you try putting the path in \graphicspath between double braces, like

\graphicspath{{../../My Graphic Files/}}

According to its doc, \graphicspath is supposed to contain a list of directories, each within its own set of curly braces. Says grfguide.pdf:

> The format is the same as for the LATEX2ε primitive \input at path. A list of directories, each in a {} group (even if there is only one in the list). For example:
> \graphicspath{{eps/}{tiff/}}

Other than that, my suggestion would have been to include the path between double quotes "[...]". On the Mac this has been a way to include arbitrary file names for quite some time (XeTeX, OzTeX, ...), and I thought this was more-or-less a standard on any platform. But since you're using the grffile package, its doc seems to say it's not compatible with double quotes.

Bruno Voisin

More information about the texworks mailing list