TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The XeTeX reference manual says that this engine understands \pdfpageheight and \pdfpagewidth. However, is seems to ignore the requests to change paper size in the middle of the document. Consider this example (from https://www.tug.org/members/TUGboat/tb32-3/tb102veytsman-ebooks.pdf)

\advance\pdfpageheight by 2in
\advance\pdfpageheight by 2\topmargin
\advance\pdfpageheight by \footskip
\advance\pdfpageheight by \textheight
\advance\pdfpageheight by -\pagegoal}


This line has a footnote\footnote{\lipsum[6-8]}.

And this line too\footnote{\lipsum[12]}.

  1. pdflatex produces two pages with different page heights as intended.

  2. lualatex also works fine

  3. xelatex (XeTeX, Version 3.1415926-2.3-0.9997.5 (TeX Live 2011), xdvipdfmx-0.7.8) produces two pages of the same height (letter), which is not what I wanted.

My questions:

  1. Is this a bug in xetex or, possibly, in xdvipdfmx, or maybe I do something wrong?

  2. Are there any workarounds - for example, using PostScript \specials instead of \pdfpageheight?

share|improve this question
up vote 10 down vote accepted

What a complicated example ;-).

As default the both lengths have the value 0pt in xetex. If you change only one xetex will ignore it and fall back to the default. So you should also set \pdfpagewidth then it will work:

share|improve this answer
Thanks! I would consider this a bug: XeTeX manual says about compatibility with pdftex, and this behavior is not compatible. Still, your solution works great. By the way, the example was not contrived: people asked for this feature for e-book formatting - please see our paper. – Boris Jan 13 '12 at 16:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.