Article View: comp.text.tex
Article #2614Printing selected pages in (La)TeX
From: Hossein Saiedian
Date: Fri, 21 Aug 1992 18:21
Date: Fri, 21 Aug 1992 18:21
34 lines
1975 bytes
1975 bytes
I've the following macro which prepares the selected pages of a
documents:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Printing out selected pages -- TUGBoat, 8:2 (1987), p. 217
% written by Don Knuth
% The file "pages.tex" should contain the list of all pages to be printed
% out. It should end with -999 or some other impossible number.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\pageno{\count0} % this line was added to work with LaTeX. H.Saiedian
\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=}
% End of macro %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
page.tex should contain a list of pages to be printed. A limitation is
that if you have a large number of pages to be printed you have to list
each individual page explicitly.
Do any of you TeXperts know how to modify the above macro so that one
can specify a range of pages (e.g., 37-83, 100-130) instead of listing
individual page numbers?
Technical Details
Message-ID:
<hossein.714421305@unocss>Path:
arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!mips!sdd.hp.com!usc!sol.ctr.columbia.edu!news.unomaha.edu!unocss!hosseinShow Full Headers
Complete Article Headers
Newsgroups: comp.text.tex Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!mips!sdd.hp.com!usc!sol.ctr.columbia.edu!news.unomaha.edu!unocss!hossein From: hossein@unocss.unomaha.edu (Hossein Saiedian) Subject: Printing selected pages in (La)TeX Message-ID: <hossein.714421305@unocss> Sender: news@news.unomaha.edu (UNO Network News Server) Organization: University of Nebraska at Omaha Date: Fri, 21 Aug 1992 18:21:45 GMT Lines: 35