[texhax] includegraphics with spaces in the file path?

Heiko Oberdiek heiko.oberdiek at googlemail.com
Tue Oct 4 17:31:47 CEST 2011


On Tue, Oct 04, 2011 at 04:59:34PM +0200, Heiko Oberdiek wrote:

> On Tue, Oct 04, 2011 at 10:37:52AM -0400, Peter Davis wrote:
> 
> > Ok, the following is probably not *minimal*, but it's a very  small example
> > that demonstrates the problem, at least with This is XeTeX, Version
> > 3.1415926-2.3-0.9997.5 (Web2C 2011)
> > 
> > 
> > Any clues about why this fails, or how to make it work, would be GREATLY
> > appreciated ...
> > 
> > 
> > \documentclass[letterpaper]{article}
> > [...]
> 
> A more minimal example:
> 
> 
> \documentclass[letterpaper]{article}
> 
> \usepackage{graphicx}
> \usepackage{grffile}
> \pagestyle{empty}
> 
> \newsavebox{\XMPG}
> \sbox{\XMPG}{\includegraphics{s_ _1.eps}}
> 
> \begin{document}
> 
> \usebox{\XMPG}
> 
> \end{document}
> 
> The file type is important, .png runs fine, .eps breaks with
>   ! Missing $ inserted.
> 
> I will have to investigate (later, no time for now).

I need to fix xetex.def's \Gread at eps as well to replace
\IfFileExists by \grffile at IfFileExists that supports spaces.

Crude workaround until grffile is fixed:

\usepackage{grffile}
\makeatletter
\@ifpackagelater{grffile}{2011/10/01}{}{%
  \let\org at Gread@eps\Gread at eps
  \def\Gread at eps#1{%
    \let\OrgGreadEpsOpenin\openin
    \def\openin\@inputcheck##1 \ifeof{%
      \OrgGreadEpsOpenin\@inputcheck"#1"\relax\ifeof
    }%
    \org at Gread@eps{#1}%
    \let\openin\OrgGreadEpsOpenin
  }%
}
\makeatother

Yours sincerely
  Heiko Oberdiek


More information about the texhax mailing list