Take the 2-minute tour ×
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.

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)

\documentclass{article}
\usepackage{everyshi,lipsum}
\pagestyle{empty}
\textheight500cm
\pdfpageheight500cm
\EveryShipout{\pdfpageheight=\pagetotal
\advance\pdfpageheight by 2in
\advance\pdfpageheight by 2\topmargin
\advance\pdfpageheight by \footskip
\advance\pdfpageheight by \textheight
\advance\pdfpageheight by -\pagegoal}
\begin{document}

\lipsum[3-5]
\pagebreak

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

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

\end{document}
  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

1 Answer 1

up vote 8 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:

\documentclass{article}
\showthe\pdfpagewidth
\showthe\pdfpageheight
\begin{document}
\pdfpageheight10cm
\pdfpagewidth5cm
abc
\newpage
\pdfpageheight5cm
\pdfpagewidth15cm
cde
\end{document}
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

 
discard

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.