home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / text / tex / 10402 < prev    next >
Encoding:
Text File  |  1992-08-21  |  1.9 KB  |  46 lines

  1. Newsgroups: comp.text.tex
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!mips!sdd.hp.com!usc!sol.ctr.columbia.edu!news.unomaha.edu!unocss!hossein
  3. From: hossein@unocss.unomaha.edu (Hossein Saiedian)
  4. Subject: Printing selected pages in (La)TeX 
  5. Message-ID: <hossein.714421305@unocss>
  6. Sender: news@news.unomaha.edu (UNO Network News Server)
  7. Organization: University of Nebraska at Omaha
  8. Date: Fri, 21 Aug 1992 18:21:45 GMT
  9. Lines: 35
  10.  
  11. I've the following macro which prepares the selected pages of a
  12. documents:
  13.  
  14. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  15. %  Printing out selected pages -- TUGBoat, 8:2 (1987), p. 217
  16. %            written by Don Knuth
  17. %  The file "pages.tex" should contain the list of all pages to be printed
  18. %  out.  It should end with -999 or some other impossible number.
  19. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  20.  
  21. \def\pageno{\count0}  % this line was added to work with LaTeX. H.Saiedian
  22. \let\Shipout=\shipout
  23. \newread\pages \newcount\nextpage \openin\pages=pages
  24. \def\getnextpage{\ifeof\pages\else
  25.  {\endlinechar=-1\read\pages to\next
  26.   \ifx\next\empty    %in this case we should have eof now
  27.   \else\global\nextpage=\next\fi}\fi}
  28.  
  29. \ifeof\pages\else\message{OK, I'll ship only the requested pages!}
  30.  \getnextpage\fi
  31. \def\shipout{\ifeof\pages\let\next=\Shipout
  32.  \else\ifnum\pageno=\nextpage\getnextpage\let\next=\Shipout
  33.   \else\let\next=\Tosspage\fi\fi \next}
  34. \newbox\garbage \def\Tosspage{\deadcycles=0\setbox\garbage=}
  35.  
  36. % End of macro %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  37.  
  38. page.tex should contain a list of pages to be printed. A limitation is
  39. that if you have a large number of pages to be printed you have to list
  40. each individual page explicitly.
  41.  
  42. Do any of you TeXperts know how to modify the above macro so that one
  43. can specify a range of pages (e.g., 37-83, 100-130) instead of listing
  44. individual page numbers?
  45.  
  46.