# [XeTeX] includegraphics and spaces in the graphic's filename path

Ulrike Fischer news3 at nililand.de
Tue Aug 24 09:52:13 CEST 2010

Am Tue, 24 Aug 2010 01:28:49 +0100 schrieb Elliott Roper:

> I think these are the relevant excerptions from the file I'm learning with:-
> \usepackage{graphicx}

> \begin{figure}[htp]
> \centering
> \includegraphics[width=\columnwidth]{../Pictures/DJMk2/swing 3.jpg}
> \caption{DJ Don't be more silly}
> \end{figure}

> It does not give any errors, yet prints a few lines of stuff above
> the correct picture "swing 3.jpg" like 3.jpg 3.jpg.pdf
> for another file whose name starts with 3.jpg as well as the one
> I really wanted (and got) "swing 3.jpg".

> Without the space in the file name (and the filename itself
> changed to "swing3.jpg") all that stuff above it goes away.

> I tried untold ways of escaping the space, the whole filename, the

> I found a package called grffile whose doco (item 139 in
> newfaq.pdf) suggested an option [space] that looked promising but
> I have given up trying to make it work and throw myself at your
> mercy.

Well the docu of grffile says that "space" works only for pdftex in
pdf-mode. It is perhaps possible to extend grffile for xetex:
xdvipdfmx seems to be able to use the graphic. You could ask the
author or a comp.text.tex.

But my advice is: Avoid spaces. Nowadays spaces in file names are
not a problem in the majority of cases. But you can waste a lot of
time to find out how to escape them, to quote them or to get around
problems in the few cases (like this here) were it doesn't work as
expected. Rename your graphic to swing_3.jpg and go on with your
work.

--
Ulrike Fischer