[texhax] includegraphics with spaces in the file path?

Heiko Oberdiek heiko.oberdiek at googlemail.com
Thu Dec 9 15:35:07 CET 2010


On Thu, Dec 09, 2010 at 08:36:01AM -0500, Peter Davis wrote:

> On Thu, Dec 9, 2010 at 7:36 AM, Heiko Oberdiek <
> heiko.oberdiek at googlemail.com> wrote:
> 
> > It's more complicate, it depends on:
> > * Primitive support:
> >  * pdfTeX: \pdfximage
> >    file name argument as general text (curly braces).
> >  * XeTeX: \XeTeXpicfile, \XeTeXpdffile
> >    file name argument in quotes, at least it is known that
> >    quotes can be used because of XeTeX.
> >    That solves the problem for spaces, but how quotes
> >    can be used inside file names?
> >
> 
> 
> I've tried quoting with XeTeX (Mik2.9), but no go.  I've tried both "s
> around the entire file spec., and replacing the " " with "\ ".  Neither of
> those approaches work.  Is there some other method of quoting?

Quoting works if you use \XeTeXpicfile or \XeTeXpdffile directly.
However it doesn't work in \includegraphics (without package grffile),
because the space is also used as terminator in macro processing
of the file name.

> * File test for existence
> >  It is needed by graphics package, e.g. for finding a file
> >  a supported extension.
> >  * pdfTeX: several primitves can be used, pdftex.def uses
> >    \pdffilesize with file name argument as general text.
> >    And package `grffile' cures the problem for package graphics.
> >  * XeTeX: \openin with file name in quotes.
> >    Of course, graphics.sty does not know about quotes.
> >
> 
> >From my (very limited) understanding, redefining the calls to \openin only
> works on Windows, not Mac or Linux systems.  At least, I've read that in
> some discussions.

In general the quoting feature can't be tested in a simple reliable
manner without trying file open. I assume that quoting is always
available in case of XeTeX. Because I couldn't find it documentated,
it might be luck if the assumption is right.

> > Thus I see, I will update package `grffile' to support
> > spaces with XeTeX.
> 
> That would be fantastic!

Please try version 1.13:
  http://www.informatik.uni-freiburg.de/~oberdiek/tmp/grffile.pdf
(The .pdf file contains .dtx file attachted. 'tex grffile.dtx'
extracts the package.)

Yours sincerely
  Heiko Oberdiek


More information about the texhax mailing list