[XeTeX] XeTeXpdffile positions differently on MacOS and Linux

Jonathan Kew jonathan_kew at sil.org
Fri May 16 14:39:34 CEST 2008


On 13 May 2008, at 9:26 pm, Paul Howson wrote:

> Hi Jonathan,
>
> Version of xetex on OSX is:
> This is XeTeXk, Version 3.141592-2.2-0.996 (Web2C 7.5.6)
>
> Someone else runs the Linux system, so I don't have direct access to
> it. However we installed the latest versions of TexLive in the same
> week last September, so they should be identical.
>
> Here are two PDFs of sample pages from the two systems (sorry I don't
> have access to Linux at short notice so am sending the actual sample).
> The text is slightly different, but the positioning effects are  
> obvious:
>
>       http://www.tdgq.com.au/download/Sample-Linux.pdf
>       http://www.tdgq.com.au/download/Sample-OSX.pdf
>
> Ignore everything except the "red flags" in the left margin. See how
> they are positioned differently. The OSX one is the correct position.
> However I had to resort to \lower and \kern to get it in the right
> place.
>
> And here is the PDF of the included "red flag" image:
>
>       http://www.tdgq.com.au/download/red_flag_with_stem.pdf
>
> Here is the code which positions those red flags.
> This line defines the red flag object:
>
> \def\redflag{\smash{\raise7.25mm\hbox{\kern9.5mm\XeTeXpdffile
> red_flag_with_stem.pdf\relax}}}
>
> And here is how it is positioned at the front of a paragraph
> (straightforward, #1 is the text of the para):
>
> \def\flaglist#1{\list{\llap{\hbox to 17mm{\redflag\hfil}}#1}}
>
> The \def\redflag macro is the one to look at. Notice the 9.5mm kern
> which pushes the red flag 9.5mm to the right of where it should be.
> That's necessary on OSX to make it appear at the correct horizontal
> position. On Linux however with that code it appears exactly 9.5mm too
> far to the right!! So it appears the Linux version is reading the PDF
> info correctly and the OSX version is not.
>
> Similarly the \raise7.25mm moves the flag up for the OSX version. On
> the Linux version the flag appears 9.6mm higher than the OSX version
> (measured from a printout).
>
> The PDF file "red_flag_with_stem.pdf" has a "page size" of 4.1mm x
> 4.8mm.
>
> Apologies for all the Adobe Illustrator "junk" in that file. You can
> find the various bounding, crop, etc boxes if you scroll down through
> the PDF source -- look for "%!PS-Adobe-3.0".
>
> Apologies also for not having a very simple example, however the
> essence of the problem should be obvious.
>
> Do you think this is a xetex or a xdvipdfmx problem?

This is a xetex problem; the issue shows up when the crop-box of the  
PDF has very large coordinates (around 7200pt in your case) rather  
than being close to the origin. In this situation, a discrepancy  
between how the Linux and Mac versions deal with the coordinates (and  
the slight difference between TeX and PostScript units) becomes  
clearly visible. The difference between a "point" of 1/72 inch and  
one of 1/72.27 inch, when multiplied by 7200, leads to an offset of  
about 9.5mm... exactly what you're seeing.

I have just made some corrections in the xetex svn source (version  
0.998.5-dev), and with this latest version I am seeing consistent  
behavior across the platforms. Unfortunately, this does mean that  
when you update to TeX Live 2008 (or another release that includes  
the fix) you will need to adjust your document to remove the  
"compensating" kerns you currently have in the OS X version.

(Most people will be unaffected; it's the huge coordinates involved  
in your cropped PDF from Illustrator that make the discrepancy visible.)

JK



More information about the XeTeX mailing list