[XeTeX] xelatex does not find pdf graphics ?

Ross Moore ross at maths.mq.edu.au
Wed Sep 22 01:02:07 CEST 2004

Hi Jonathan, Michael, and others

On 22/09/2004, at 7:58 AM, Jonathan Kew wrote:

> On 21 Sep 2004, at 9:17 pm, Michael Gedalin wrote:
>> I tried to include a pdf graphics using
>> \usepackage[xetex]{graphicx}
>> ...
>> \includegraphics{filename.pdf}
>> The file resided in the same directory where all my style files are. 
>> Usual latex/pdftex found the file without problem. xetex found it 
>> only when I copied the file to the same directory where the tex file 
>> was. Is this a bug or something is wrong in my installation ?
> Probably neither; it's behaving as designed. But perhaps the behavior 
> should be changed.....
> XeTeX doesn't use search paths to look for graphics files; it simply 
> looks for the name as given, relative to the current directory. So 
> unless the graphicx package has some way of prefixing other paths to 
> the name, it wouldn't be found.

It does:

     \graphicspath{{..path1..}{..path2..}...}   % (defined in 

where each  ..pathX..  is just a string of characters.
So you need to include the trailing '/' for a directory,
else it will act like a prefix to the filename.

I just did a test using:


and then  \includegraphics[scale=.65]{Image}
finds the file:   olaviImage.pdf  in the parent directory.
XeLaTeX hands on the name  ../olaviImage.pdf  to xdvi2pdf
so there is no need for searching using a variable.

This should work in all flavours of LaTeX (and plain TeX with a special
'mini-LaTeX' package also loaded --- I forget what that's called).

> From your report, I'm guessing that pdfTeX uses a kpathsearch function 
> to locate graphics files, similarly to how .tex input files, .sty 
> files, etc., are located. I should probably consider adding similar 
> path-searching to the \XeTeXpicfile and \XeTeXpdffile commands. How do 
> others feel about this....any comments?

Putting the images in the same hierarchy as the  .sty  files, as 
Michael seems
to have done, is not really a good idea. It means adjusting the search 
in  texmf.cnf  for other software items when you move between 
    * for  pdfLaTeX, there is just one path that does it all;
    * but for ordinary LaTeX + dvips  you need to set 2 path variables;
    * with XeTeX using  xdv2pdf  it'll be 2 others.

I think that there shouldn't be extra path-searching added.
This will surely result in incompatibilities with the way other
(La)TeX installations work.



> Jonathan
> _______________________________________________
> XeTeX mailing list
> postmaster at tug.org
> http://tug.org/mailman/listinfo/xetex
Ross Moore                                         ross at maths.mq.edu.au
Mathematics Department                             office: E7A-419
Macquarie University                               tel: +61 +2 9850 8955
Sydney, Australia                                  fax: +61 +2 9850 8114

More information about the XeTeX mailing list