[OS X TeX] includegraphics in xelatex and filenames with spaces

Bernhard Barkow bb at creativeeyes.at
Mon Feb 4 08:16:12 CET 2008


On 2008-02-03, at 20:21, Álex Bueno wrote:
> I posted this to the xetex list last week, but I didn't get any  
> responses. So I wonder if anyone here knows why this happens:
>> As far as I've read, it seems xetex should allow spaces
>> in filenames of included graphics. Yet I can't get this to work
>> properly. I'd use \XeTeXpicfile instead of \includegraphics, but it
>> doesn't seem to have a draft option, which is a must with dozens of
>> images in a file.
>> I started putting double quotes around the filename, but got an
>> "Unable to load picture" error that suggested writing ""filename"". I
>> found that that gave the suggestion to add another set of quotes and
>> eventually dispensed with the quotes:
>> \documentclass[12pt,letterpaper,oneside]{report}
>> \usepackage[final,xetex]{graphicx}
>> \usepackage{fontspec,xunicode,fixltx2e,xltxtra}
>> \setromanfont{Minion Pro}
>> \begin{document}
>> 	\begin{figure}[tbp]
>> 		\includegraphics[width=3in]{foo bar.tiff}
>> 	\end{figure}
>> \end{document}
>> This includes the image, but I get this text next to the image:
>> bar.tiff bar.bb
>> What might be going on with this?
>> I'm using the version of xetex in Maclive 2007.

[I assume you did read all the threads on this list discussing spaces  
in filenames?]

I just tried this example, the interesting thing is that my XeLaTeX  
seems not to include TIFF files at all (just white space), and JPEG  
files are included, but at a wrong scale (looks like assuming a  
300dpi resolution where the image has only 72; in draft mode the  
bounding box is displayed correctly, I'll have to examine that further).

With a space in the filename I get the same "bar.tiff bar.bb",  
without the space it works ok (apart from the size issue). (By the  
way, I would avoid these spaces anyway, they are never really  
necessary and just keep causing problems, no matter how advanced our  
computing infrastructure gets.)

Some other things I tried:
pdflatex shows the same behavior; however, using
  	\includegraphics[width=3cm]{{foo bar.jpg}}
gives the same result in XeLaTeX, but although showing the message
LaTeX Warning: File `{foo bar.jpg}' not found on input line 11.
<use  "foo bar.jpg" > [1] (./1.aux) )
in the log file, it includes the picture in pdflatex.
Using double quotes yields
! Unable to load picture or PDF file 'foo'.
<to be read again>
l.12 ^^I\includegraphics[width=3cm]{"foo bar.jpg"}
in xelatex and
! LaTeX Error: Unknown graphics extension: .jpg".
l.12 	\includegraphics[width=3cm]{"foo bar.jpg"}
in pdflatex (both aborting at that point).

This is no help at all to you, but all I can come up with so far…


_________________________________ Bernhard Barkow __
___________________ gpg key ID _ A89F09C45921020D __

More information about the macostex-archives mailing list