[XeTeX] XeTeX and pdfpages: no dice?
Andreas Matthias
amat at kabsi.at
Sun Apr 15 19:28:18 CEST 2007
Jonathan Kew wrote:
> On 15 Apr 2007, at 2:32 am, Andreas Matthias wrote:
>> Especially the driver business of XeTeX puzzles me a bit.
> OK, let me clarify a bit.
[...]
> Hope that makes things a bit clearer!
It did. Thanks a lot.
>> To detect the number of pages of a PDF file, I used some really
>> clever macro code that Heiko Oberdiek send me some years ago.
>> I am not sure if it is really foolproof and it is not too fast,
>> since it parses the whole PDF. But it is really wonderful to
>> see what can be done on TeX macro level.
>
> That's amazing!
It is. And it's a nice example on doing the catcode-twist.
>> Oh, I nearly forgot that: Why do \pdfpagewidth and \pdfpageheight
>> not have sensible defaults. Concerning pdftex these dimens are
>> set in pdftexconfig.tex which is read when creating the format
>> files. Wouldn't this be usefull for xetex as well?
>
> It probably would. Currently, you will simply get the driver's
> default page size, unless you use a -papersize option to change it,
> or set these dimens yourself, or use a papersize \special.
>
> Note that the PDF page size is entirely the responsibility of the
> driver, and xetex itself doesn't have any way to read the driver's
> default. However, if we set these dimens by default, then they'll
> override the driver anyway; what they actually do (remember that
> xetex isn't generating the PDF itself!) is to automatically insert
> a papersize \special at the beginning of each \shipout, and then
> the driver sees that and sets the page size accordingly.
Let's have an example:
\documentclass{article}
%\pdfpagewidth=\paperwidth
%\pdfpageheight=\paperheight
\begin{document}
aaa
\newpage
\begingroup
\pdfpagewidth=80mm
\pdfpageheight=150mm
bbb
\newpage
\endgroup
ccc
\end{document}
I would expect to get a document, where the first and third page
have the save size and the second has another size. That's what
I get when running it through pdflatex. But when running it
through xelatex, the second and the third page have the same size.
I can correct this by setting \pdfpage{width,height} to
\paper{width,height}. The problem with this approach is that not
all LaTeX classes do set \paper{width,height}. For instance
minimal.cls does not.
The above code is roughly what pdfpages does when using the `fitpaper'
option.
Ciao
Andreas
More information about the XeTeX
mailing list