blob: 5a1405d3c4400c6a2f75ceb70fa58093a9140ae4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
%From Tugboat volume 8, number 2 july 1987
%by Donald Knuth
%
% The idea is to make TeX look for a file called pages.tex. if such a
%file doesn't exit, everything works as before, Otherwise the file
%should contain a list of apge numbers, one per line, in the order that
%they will be generated. After the last page number has been matched,
%all further pages will be printed. Thus, if you want ot print pages
%123 and all pages from 300 onwards, your file pages.tex should say
% 123
% 300
%but if you want to print pages 123 and 300 only, the file should say,
%e.g.,
% 123
% 300
% -99999999999 % impossible number
%so that the end of file will never occur.
%
\let\Shipout=\shipout
\newread\pages \newcount\nextpage \openin\pages=pages
\def\getnextpage{\ifeof\pages\else
{\endlinechar=-1\read\pages to\next \ifx\next\empty % in this case we
should have eof now \else\global\nextpage=\next\fi}\fi}
\ifeof\pages\else\message{OK, I'll ship only the requested pages!}
\getnextpage\fi
\def\shipout{\ifeof\pages\let\next=\Shipout
\else\ifnum\pageno=\nextpage\getnextpage\let\next=\Shipout
\else\let\next=\Tosspage\fi\fi \next}
\newbox\garbage \def\Tosspage{\deadcycles=0\setbox\garbage=}
|