[XeTeX] HELP! ** ERROR ** Page number 65536l too large!

Heiko Oberdiek heiko.oberdiek at googlemail.com
Fri Sep 30 04:03:34 CEST 2011


On Thu, Sep 29, 2011 at 09:00:21PM +0100, Jonathan Kew wrote:

> Note that the DVI file format postamble includes a two-byte field for the
> total number of pages present, so if you try to put more than 64K pages in
> a DVI file, the postamble (at least) will necessarily be incorrect, even
> if the file is otherwise well-formed.

TeX or pdfTeX generate such a file (I have tried a file with 70000 pages).
But the DVI drivers behave different:
* dvitype is ok, it reports
  | there are really 70000 pages, not 4464!
  and lists all pages.
* dvi2tty prints all 70000 pages.
* dvips only prints 4464 pages, but reports in the header:
  | %%Pages: 70000
* dvipdfmx only prints 4464 pages.
* XeTeX aborts with
  | ** ERROR ** Page number 70001l too large!

Perhaps dvips could be fixed, it already knows the correct
number of pages?

And if someone wants to play:

% iniTeX
\catcode`\{=1 %
\catcode`\}=2 %
\catcode`\#=6 %
\countdef\C=0 %
\C=1 %
\countdef\X=255 %
\X=70000 %
\chardef\I=1 %
\let\A=\advance
\let\S=\shipout
\let\H=\hbox
\let\N=\ifnum
\let\F=\fi
\def\P{%
  \S\H{}%
  \A\C\I
  \N\C>\X
    \let\P\relax
  \F
  \P
}
\P
\end

Yours sincerely
  Heiko Oberdiek


More information about the XeTeX mailing list