[XeTeX] Default values of \pdfpage{width, height} (was: XeTeX and pdfpages: no dice?)

Jonathan Kew jonathan_kew at sil.org
Thu Aug 2 23:33:05 CEST 2007


On 2 Aug 2007, at 7:58 pm, Andreas Matthias wrote:

> Andreas Matthias wrote:
>
>> There's still one thing that puzzles me: Why doesn't
>> \pdfpage{width,height} have sensible defaults?

Mainly because I'd never considered what happens if you don't set  
them at start of document, but then do set them mid-document within a  
group. I agree that the result is not exactly intuitive!

>>
>>
>> \documentclass{article}
>> %\pdfpagewidth=\paperwidth
>> %\pdfpageheight=\paperheight
>> \begin{document}
>> aaa
>> \newpage
>> \begingroup
>> \pdfpagewidth=80mm
>> \pdfpageheight=150mm
>> bbb
>> \newpage
>> \endgroup
>> ccc
>> \end{document}
>>
>>
>> I am pretty sure most (or nearly all?) users wouldn't be
>> able to tell what they get from the above example before
>> running it -- with and without the two line uncommented.
>>
>> I really hope that it's not just me for whom the result of this
>> example is highly unexpected.
>>
>> However, I still cannot see any advantage of this weird default. :-(
>
> No opinions? Do all of you agree?

Sorry, I've been busy elsewhere, and hadn't looked into this yet, but  
I should do something about it before the release of 0.997.

The root of the issue is that \pdfpage{width,height} are "faked" by  
xetex (as it isn't actually generating the PDF itself) by writing a  
papersize \special at the beginning of the page, if these parameters  
have been set. If they're unset, however, no \special is written.

What happens in your example is that if the parameters are initially  
unset, you get the driver's default paper size. Then you set them  
within a group, and xetex writes a papersize \special at the  
beginning of the second page. Then you end the group, and the  
parameters become unset.... so no further \specials are written, and  
the setting from within the group persists beyond where you'd expect.

If we read a config file as part of format creation, then the  
parameters will always be set to real values, the papersize \special  
will always be written, and you won't get this slightly odd behavior.  
I'll take a look at the pdftex configuration setup; maybe we can  
"borrow" their settings.

The disadvantage of that would be that it would lose the current  
ability to set the default paper size from the command line (as the  
document would always override it). So another option might be to  
write a "papersize=default" \special instead if the \pdfpage 
{width,height} parameters are unset; the driver would then revert to  
its default media size (from a config-file or command-line). I think  
I prefer this to setting the media size in the standard .fmt files,  
actually, though of course it would still be possible to do that if  
desired. (I like being able to set the size from the command line on  
occasion.)

JK



More information about the XeTeX mailing list