[XeTeX] pagesize not set

Jonathan Kew jonathan_kew at sil.org
Sat May 20 16:47:08 CEST 2006


On 20 May 2006, at 3:28 pm, Ralf Stubner wrote:

> Hi everybody,
>
> If I compile the following document with xelatex on linux, I get a A4
> sized PDF file. If I separately call 'xelatex -no-pdf' and  
> 'xdvipdfmx',
> I get the expected A5 sized PDF file.

Yes, that makes sense.

> What's going wrong?

You've encountered an unfinished piece of xdvipdfmx!

The papersize option is passed to the driver as a \special. The  
driver has to process this \special command before it begins actually  
placing any content on the page, and therefore it pre-scans the  
entire page and processes certain \special commands in advance of the  
main page-drawing process; then it backs up to the beginning of the  
page in the input file and re-reads it, interpreting the content and  
skipping the already-processed \specials such as papersize.

However, when the input is coming from a pipe (running automatically,  
in parallel with xetex), the driver can't use fseek() to back up in  
the input and re-read it. And therefore it is unable to handle the  
papersize \special.

xdv2pdf (the output driver XeTeX has been using on OS X) solves this  
by requiring papersize \specials to be at the beginning of a page,  
otherwise they don't take effect until the following page (and a  
warning is printed). But a better approach for xdvipdfmx is probably  
to buffer the .xdv stream so as to be able to return to the beginning  
of the page, as it is sometimes tricky for the user to ensure that  
the \special precedes all printable content (depending on the  
interaction of other macro files).

So... you can expect this to be fixed at some point; it's a known  
issue, I just haven't gotten around to it yet.

JK



More information about the XeTeX mailing list