On 1 Dec 2011, at 16:26, Philip TAYLOR wrote:
> 
> And it cost me, and fellow members of this list, considerable work
> to identify the problem.  Multiply that by the number of fellow
> sufferers that must have hit this error message and been completely
> mystified, as I was, and the overheads of translating one extra
> error message vanish into insignificance.

The straightforward solution, "use \XeTeXpdffile", was offered pretty quickly, 
IIRC. If people wish to discuss the details in depth, they are of course 
welcome to do so, but that discussion was not necessary to resolve the problem 
you faced when trying to include a PDF graphic.

>> I don't think that the fact the picture command says it cannot load a PDF
>> file when, in fact, it cannot, is cause for much comment.  And the fact it
>> says it cannot load a picture or PDF file this time should not be taken as
>> implying that that exact command might ever be able to load a PDF file
>> at all.
> 
> I'm sure that Humpty Dumpty, M.E.P., would argue just that.  But for the
> common man on the top deck of the Number 53 Clapham Common Omnibus,
> a diagnostic that says :
> 
>            ! Unable to load picture or PDF file
> 
> when it is called with the path to a non-existence JPG,

It would presumably be better if this said "! Picture file not found" (or 
something like that)...

> and
> 
>            ! Unable to load picture or PDF file
> 
> when it is called with the path to a most-definitely-existent PDF

...whereas here, a message such as "! Not a supported graphic file format" 
would perhaps be more useful.

> 
> must certainly be one of the most confusing things that he will have
> encountered in his life.

If the common man on the top deck of the Number 53 ever encounters any of these 
messages, at any stage in his life, then the typical Clapham resident must be 
quite unlike my neighbours here in semi-rural Oxfordshire!

OK, now a little background (if I'm recalling the history correctly). Once upon 
a time, xetex existed only on a single operating system, and relied on that 
OS's facilities to do things like access fonts and read graphic files. In order 
to simplify the inclusion of graphics, the command \XeTeXpicfile was created, 
and it could read any file format that was supported by the QuickTime graphics 
importer component - including not just PNG and JPEG, but also TIFF and many 
other formats - including PDF.

However, using this for PDF files proved to be less than ideal, in many cases, 
as it resulted in a rasterized version of the PDF being included in the output. 
So a variant of this command, \XeTeXpdffile, was created that used a different 
implementation and embedded the original PDF data in the output rather than 
rasterizing it. However, the two commands shared much of their implementation 
at the Web code level, and in particular they don't distinguish the two cases 
at the point where it is determined that "this failed for some reason", so they 
just print a generic, shared error message.

I don't remember for sure, but I suspect the error message originally just said 
something like "unable to load picture", and the "or PDF" was added when the 
specialized PDF variant of the original \XeTeXpicfile was introduced. Yes, it 
would perhaps have been better to separate the two, but the implementor was 
presumably feeling lazy that day. :)

Now, once xetex escaped from its original OS X birthplace and evolved to run on 
other platforms, it was necessary to replace the use of the QuickTime graphics 
importer library to implement \XeTeXpicfile with other code, and one result of 
this is that on non-Mac platforms, only a few graphic formats are supported - 
and in particular, \XeTeXpicfile does not support PDF. But it and its 
PDF-specific sibling still use the same shared message. Less than ideal, but 
c'est la vie.

And as for how \XeTeX{pic|pdf}file behaves: it's 
sort-of-like-a-box-but-not-really. My advice would be to always \hbox it; this 
will save you hours of grief.

JK




--------------------------------------------------
Subscriptions, Archive, and List information, etc.:
  http://tug.org/mailman/listinfo/xetex

Reply via email to