| 1 |
\documentclass[pagesize=auto, fontsize=12pt]{scrartcl} |
| 2 |
|
| 3 |
\usepackage{fixltx2e} |
| 4 |
\usepackage{etex} |
| 5 |
\usepackage{lmodern} |
| 6 |
\usepackage[T1]{fontenc} |
| 7 |
\usepackage{textcomp} |
| 8 |
\usepackage{hologo} |
| 9 |
\usepackage{microtype} |
| 10 |
\usepackage{hyperref} |
| 11 |
|
| 12 |
\newcommand*{\mail}[1]{\href{mailto:#1}{\texttt{#1}}} |
| 13 |
\newcommand*{\pkg}[1]{\textsf{#1}} |
| 14 |
\newcommand*{\cs}[1]{\texttt{\textbackslash#1}} |
| 15 |
\makeatletter |
| 16 |
\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}} |
| 17 |
\makeatother |
| 18 |
\newcommand*{\opt}[1]{\texttt{#1}} |
| 19 |
\newcommand*{\meta}[1]{\textlangle\textsl{#1}\textrangle} |
| 20 |
\newcommand*{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}} |
| 21 |
\newcommand*{\outputonly}[1]{\cmd{\outputonly}\texttt{\{#1\}}} |
| 22 |
|
| 23 |
\addtokomafont{title}{\rmfamily} |
| 24 |
|
| 25 |
\title{The \pkg{selectp} package\thanks{This manual corresponds to \pkg{selectp}~v1.0, dated~Sept 25, 1992.}} |
| 26 |
\subtitle{Select pages for output} |
| 27 |
\author{% |
| 28 |
Donald Arseneau\thanks{\mail{[email protected]}},% |
| 29 |
\and based on macros in TUGBoat, 8:2 (1987), p.~217% |
| 30 |
\and written by Don Knuth,% |
| 31 |
\and and with suggestions from Hossein Saiedian.% |
| 32 |
} |
| 33 |
\date{Sept 25, 1992} |
| 34 |
|
| 35 |
|
| 36 |
\begin{document} |
| 37 |
|
| 38 |
\maketitle |
| 39 |
|
| 40 |
|
| 41 |
\section{Instructions} |
| 42 |
|
| 43 |
This style file defines the command \cmd{\outputonly} which selects specific |
| 44 |
pages for output, much as \cmd{\includeonly} selects certain files for input. |
| 45 |
To use \pkg{selectp.sty} in \LaTeX, specify \opt{selectp} as one of the document |
| 46 |
style options and give the command \cmd{\outputonly}\marg{list of page numbers} |
| 47 |
before \verb|\begin{document}|. Only pages given in the list will be output |
| 48 |
to the DVI file. For example |
| 49 |
% |
| 50 |
\begin{verbatim} |
| 51 |
\documentstyle[12pt,selectp,subeqn]{article} |
| 52 |
\outputonly{1,3, 7-12 16 17} |
| 53 |
\end{verbatim} |
| 54 |
% |
| 55 |
which will allow only pages 1, 3, 7, 8, 9, 10, 11, 12, 16, 17 to be output. |
| 56 |
For \hologo{plainTeX}, use \verb|\input{selectp.sty}|. |
| 57 |
|
| 58 |
The number list should consist of numbers and number ranges (\verb|7-12|, e.\,g.)\ % |
| 59 |
separated by commas or spaces. The order is not random but \emph{must be the |
| 60 |
order that the pages are produced}; normally this means the numbers must |
| 61 |
always increase. If an invalid page number appears on the list, no pages |
| 62 |
will be output until the list is re-synchronized or the document ends. |
| 63 |
|
| 64 |
Any time the document's page number does not increment normally, |
| 65 |
\pkg{selectp.sty} tries to re-synchronize the page number with the \cmd{\outputonly} |
| 66 |
list of numbers. This is necessary when \cmd{\includeonly} is used. |
| 67 |
|
| 68 |
Pages that are labeled with roman numerals or letters should still be |
| 69 |
listed with a normal arabic number; page~xi should be referred to as~6. |
| 70 |
|
| 71 |
In \LaTeX, unfortunately, pages~i and~1 are both number~1, so it is |
| 72 |
tricky to skip over all the roman-numbered pages and then print |
| 73 |
page~1. If there are 3 roman-numbered pages, |
| 74 |
% |
| 75 |
\begingroup |
| 76 |
\addtokomafont{labelinglabel}{\ttfamily} |
| 77 |
\begin{labeling}{1-3,8-12} |
| 78 |
\item[1-3] |
| 79 |
will print pages i, ii, iii; not pages 1, 2, 3 |
| 80 |
\item[1-3,1-5] |
| 81 |
will print pages i, ii, iii, 1, 2, 3, 4, 5 |
| 82 |
\item[1-3,8-12] |
| 83 |
will print pages i, ii, iii, 8, 9, 10, 11, 19 |
| 84 |
\item[1,1-5] |
| 85 |
will print i, 1, 2, 3, 4, 5 |
| 86 |
\item[1-6] |
| 87 |
prints pages i, ii, iii only, not pages 4, 5, 6 !!! |
| 88 |
\item[0,2-6] |
| 89 |
prints pages 2, 3, 4, 5, 6, since there is no page~0 and the |
| 90 |
\verb|outputonly| page list is resynchronized when the actual page |
| 91 |
number goes back to~1) |
| 92 |
\end{labeling} |
| 93 |
\endgroup |
| 94 |
% |
| 95 |
The last example is illuminating. \LaTeX\ looks for page~0, but can't find |
| 96 |
it. It skips pages until the page number goes from~3~(iii) to~1, at which |
| 97 |
point it resynchronizes by reading~\texttt{2} from the list, waiting for page~2 |
| 98 |
to be produced, and then writing page~2. Selectp then reads~\texttt{-6}, and |
| 99 |
\emph{Continues} outputting pages until it has done page~6. As long as the |
| 100 |
numbers of the intervening pages are less than~6 (the end of the range), |
| 101 |
those pages will be printed. |
| 102 |
|
| 103 |
If there are no roman numeral pages, the number list is simple, because |
| 104 |
the numbers must increase monotonically. |
| 105 |
|
| 106 |
\LaTeX\ will not write auxilliary files while selecting output pages, so |
| 107 |
the cross references and citations must be correct on the run \emph{before} |
| 108 |
using \cmd{\outputonly}. Unfortunately, this means you must produce the |
| 109 |
full-size DVI file at least once. |
| 110 |
|
| 111 |
If multuple \cmd{\outputonly} commands are given, the lists are concatenated. |
| 112 |
|
| 113 |
In \hologo{plainTeX}, specify roman numeral pages as negative numbers, but do not |
| 114 |
use ranges until getting to the ordinary (arabic) page numbers (e.\,g.,\ % |
| 115 |
\outputonly{-1,-2,-3,-4, 1-8}). In \hologo{plainTeX} specifying page~1 will \emph{not} |
| 116 |
print page~i. |
| 117 |
|
| 118 |
If a page number in the list is not found, generally no more pages will be |
| 119 |
printed. For example, suppose a document has 50~pages, the list \verb*|3 5 910 13| |
| 120 |
(which perhaps should read \verb*|9 10|) causes \LaTeX\ to process silently |
| 121 |
through the whole document looking for page~910. Only pages~3 and~5 will |
| 122 |
be printed. |
| 123 |
|
| 124 |
\emph{Except} if the number terminating a \emph{range} is not found \verb*|{3 5-910 13}|, |
| 125 |
\LaTeX\ continues outputting pages until the end. |
| 126 |
|
| 127 |
\emph{Except} if the actual page number changes discontinuously, then the number |
| 128 |
list \emph{may} be scanned for the next number greater than the new page number. |
| 129 |
(Jumps are usually due to the numbering being changed from roman to arabic |
| 130 |
with the page reset to~1, or because an included file was skipped due to |
| 131 |
an \cmd{\includeonly} command.) The list is scanned if the page number jumps |
| 132 |
backward, or if it jumps forward \emph{past} the current target page. (``Target |
| 133 |
page'' = the end of the current range or the next number to be printed out, |
| 134 |
as appropriate.) |
| 135 |
|
| 136 |
Numbers must be integers: \texttt{4.3} is illegal, even if some other style file |
| 137 |
is generating page numbers in that format. |
| 138 |
|
| 139 |
\pagebreak[1] |
| 140 |
|
| 141 |
Of course non-numbers are illegal. Some plausible mistakes: |
| 142 |
% |
| 143 |
\begin{quote} |
| 144 |
\verb|page|, \verb|xvii|, \verb|IV|, \verb|12--16|, \verb|49ff|, \verb|49-|, \verb|5_7|. |
| 145 |
\end{quote} |
| 146 |
% |
| 147 |
\verb|5_7| could be a typo for the range \verb|5-7|. |
| 148 |
To specify page~49 and all following (\verb|49ff| or \verb|49-|), use a range |
| 149 |
ending with a non-existent page: \verb|49-99999|. |
| 150 |
The typo \verb|12--16| prints pages~12 and~16, not the range~12 through~16 as |
| 151 |
intended. |
| 152 |
|
| 153 |
|
| 154 |
\section{Examples of use} |
| 155 |
|
| 156 |
Suppose a document has pages i, ii, iii, iv, v, vi, 1, 2, 3,\dots, 33, but pages |
| 157 |
22\dots28 are absent due to \cmd{\includeonly}; here are some examples of valid |
| 158 |
uses of \cmd{\outputonly}. |
| 159 |
% |
| 160 |
\begin{labeling}[\enspace\textendash]{\outputonly{0,4,23-27,31-99}} |
| 161 |
\item[\outputonly{15-20}] |
| 162 |
prints only the 6 pages 15...20 |
| 163 |
\item[\outputonly{1-3}] |
| 164 |
prints pages i, ii, iii (in \LaTeX)\\ |
| 165 |
\hologo{plainTeX} prints pages 1, 2, 3 |
| 166 |
\item[\outputonly{1,1,2}] |
| 167 |
prints pages i, 1, 2 |
| 168 |
\item[\outputonly{0,1,2}] |
| 169 |
prints pages 1, 2 |
| 170 |
\item[\outputonly{1,3-6}] |
| 171 |
prints pages i, iii, iv, v, vi |
| 172 |
\item[\outputonly{4,3-6}] |
| 173 |
prints pages iv, 3, 4, 5, 6 |
| 174 |
\item[\outputonly{5,2}] |
| 175 |
prints pages v, 2 |
| 176 |
\item[\outputonly{5-2}] |
| 177 |
prints only page v only! |
| 178 |
\item[\outputonly{5-7}] |
| 179 |
prints pages v, vi only! |
| 180 |
\item[\outputonly{1-33}] |
| 181 |
prints pages i, ii, iii, iv, v, vi only! |
| 182 |
\item[\outputonly{29-99}] |
| 183 |
prints pages 29, 30, 31, 32, 33 |
| 184 |
\item[\outputonly{19-99}] |
| 185 |
prints pages 19, 20, 21, 29, 30, 31, 32, 33 |
| 186 |
\item[\outputonly{24-32}] |
| 187 |
prints pages 29, 30, 31, 32 |
| 188 |
\item[\outputonly{15-25,32}] |
| 189 |
prints pages 15, 16, 17, 18, 19, 20, 21, 32 |
| 190 |
\item[\outputonly{0,4,23-27,31-99}] |
| 191 |
prints pages 4, 31, 32, 33 |
| 192 |
\end{labeling} |
| 193 |
|
| 194 |
Version 0.9 (test), Sept 25, 1992: |
| 195 |
Send problem reports to \mail{[email protected]} |
| 196 |
|
| 197 |
\end{document} |