| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% File: pagesel.dtx |
| 4 |
% Version: 2020-08-03 v1.10 |
| 5 |
% Info: Select pages of a document for output |
| 6 |
% |
| 7 |
% Copyright (C) |
| 8 |
% 1999, 2003, 2006-2008 Heiko Oberdiek |
| 9 |
% 2016-2020 Oberdiek Package Support Group |
| 10 |
% https://github.com/ho-tex/pagesel/issues |
| 11 |
% |
| 12 |
% This work may be distributed and/or modified under the |
| 13 |
% conditions of the LaTeX Project Public License, either |
| 14 |
% version 1.3c of this license or (at your option) any later |
| 15 |
% version. This version of this license is in |
| 16 |
% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 17 |
% and the latest version of this license is in |
| 18 |
% https://www.latex-project.org/lppl.txt |
| 19 |
% and version 1.3 or later is part of all distributions of |
| 20 |
% LaTeX version 2005/12/01 or later. |
| 21 |
% |
| 22 |
% This work has the LPPL maintenance status "maintained". |
| 23 |
% |
| 24 |
% The Current Maintainers of this work are |
| 25 |
% Heiko Oberdiek and the Oberdiek Package Support Group |
| 26 |
% https://github.com/ho-tex/pagesel/issues |
| 27 |
% |
| 28 |
% This work consists of the main source file pagesel.dtx |
| 29 |
% and the derived files |
| 30 |
% pagesel.sty, pagesel-2016-05-16.sty, |
| 31 |
% pagesel.pdf, pagesel.ins, pagesel.drv. |
| 32 |
% |
| 33 |
% Distribution: |
| 34 |
% CTAN:macros/latex/contrib/pagesel/pagesel.dtx |
| 35 |
% CTAN:macros/latex/contrib/pagesel/pagesel.pdf |
| 36 |
% |
| 37 |
% Unpacking: |
| 38 |
% (a) If pagesel.ins is present: |
| 39 |
% tex pagesel.ins |
| 40 |
% (b) Without pagesel.ins: |
| 41 |
% tex pagesel.dtx |
| 42 |
% (c) If you insist on using LaTeX |
| 43 |
% latex \let\install=y\input{pagesel.dtx} |
| 44 |
% (quote the arguments according to the demands of your shell) |
| 45 |
% |
| 46 |
% Documentation: |
| 47 |
% (a) If pagesel.drv is present: |
| 48 |
% latex pagesel.drv |
| 49 |
% (b) Without pagesel.drv: |
| 50 |
% latex pagesel.dtx; ... |
| 51 |
% The class ltxdoc loads the configuration file ltxdoc.cfg |
| 52 |
% if available. Here you can specify further options, e.g. |
| 53 |
% use A4 as paper format: |
| 54 |
% \PassOptionsToClass{a4paper}{article} |
| 55 |
% |
| 56 |
% Programm calls to get the documentation (example): |
| 57 |
% pdflatex pagesel.dtx |
| 58 |
% makeindex -s gind.ist pagesel.idx |
| 59 |
% pdflatex pagesel.dtx |
| 60 |
% makeindex -s gind.ist pagesel.idx |
| 61 |
% pdflatex pagesel.dtx |
| 62 |
% |
| 63 |
% Installation: |
| 64 |
% TDS:tex/latex/pagesel/pagesel.sty |
| 65 |
% TDS:doc/latex/pagesel/pagesel.pdf |
| 66 |
% TDS:source/latex/pagesel/pagesel.dtx |
| 67 |
% |
| 68 |
%<*ignore> |
| 69 |
\begingroup |
| 70 |
\catcode123=1 % |
| 71 |
\catcode125=2 % |
| 72 |
\def\x{LaTeX2e}% |
| 73 |
\expandafter\endgroup |
| 74 |
\ifcase 0\ifx\install y1\fi\expandafter |
| 75 |
\ifx\csname processbatchFile\endcsname\relax\else1\fi |
| 76 |
\ifx\fmtname\x\else 1\fi\relax |
| 77 |
\else\csname fi\endcsname |
| 78 |
%</ignore> |
| 79 |
%<*install> |
| 80 |
\input docstrip.tex |
| 81 |
\Msg{************************************************************************} |
| 82 |
\Msg{* Installation} |
| 83 |
\Msg{* Package: pagesel 2020-08-03 v1.10 Select pages of a document for output (HO)} |
| 84 |
\Msg{************************************************************************} |
| 85 |
|
| 86 |
\keepsilent |
| 87 |
\askforoverwritefalse |
| 88 |
|
| 89 |
\let\MetaPrefix\relax |
| 90 |
\preamble |
| 91 |
|
| 92 |
This is a generated file. |
| 93 |
|
| 94 |
Project: pagesel |
| 95 |
Version: 2020-08-03 v1.10 |
| 96 |
|
| 97 |
Copyright (C) |
| 98 |
1999, 2003, 2006-2008 Heiko Oberdiek |
| 99 |
2016-2020 Oberdiek Package Support Group |
| 100 |
|
| 101 |
This work may be distributed and/or modified under the |
| 102 |
conditions of the LaTeX Project Public License, either |
| 103 |
version 1.3c of this license or (at your option) any later |
| 104 |
version. This version of this license is in |
| 105 |
https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 106 |
and the latest version of this license is in |
| 107 |
https://www.latex-project.org/lppl.txt |
| 108 |
and version 1.3 or later is part of all distributions of |
| 109 |
LaTeX version 2005/12/01 or later. |
| 110 |
|
| 111 |
This work has the LPPL maintenance status "maintained". |
| 112 |
|
| 113 |
The Current Maintainers of this work are |
| 114 |
Heiko Oberdiek and the Oberdiek Package Support Group |
| 115 |
https://github.com/ho-tex/pagesel/issues |
| 116 |
|
| 117 |
|
| 118 |
This work consists of the main source file pagesel.dtx |
| 119 |
and the derived files |
| 120 |
pagesel.sty, pagesel-2016-05-16.sty, pagesel.pdf, |
| 121 |
pagesel.ins, pagesel.drv. |
| 122 |
|
| 123 |
\endpreamble |
| 124 |
\let\MetaPrefix\DoubleperCent |
| 125 |
|
| 126 |
\generate{% |
| 127 |
\file{pagesel.ins}{\from{pagesel.dtx}{install}}% |
| 128 |
\file{pagesel.drv}{\from{pagesel.dtx}{driver}}% |
| 129 |
\usedir{tex/latex/pagesel}% |
| 130 |
\file{pagesel.sty}{\from{pagesel.dtx}{package}}% |
| 131 |
\file{pagesel-2016-05-16.sty}{\from{pagesel.dtx}{packagefrozen}} |
| 132 |
} |
| 133 |
|
| 134 |
\catcode32=13\relax% active space |
| 135 |
\let =\space% |
| 136 |
\Msg{************************************************************************} |
| 137 |
\Msg{*} |
| 138 |
\Msg{* To finish the installation you have to move the following} |
| 139 |
\Msg{* file into a directory searched by TeX:} |
| 140 |
\Msg{*} |
| 141 |
\Msg{* pagesel.sty} |
| 142 |
\Msg{*} |
| 143 |
\Msg{* To produce the documentation run the file `pagesel.drv'} |
| 144 |
\Msg{* through LaTeX.} |
| 145 |
\Msg{*} |
| 146 |
\Msg{* Happy TeXing!} |
| 147 |
\Msg{*} |
| 148 |
\Msg{************************************************************************} |
| 149 |
|
| 150 |
\endbatchfile |
| 151 |
%</install> |
| 152 |
%<*ignore> |
| 153 |
\fi |
| 154 |
%</ignore> |
| 155 |
%<*driver> |
| 156 |
\NeedsTeXFormat{LaTeX2e} |
| 157 |
\ProvidesFile{pagesel.drv}% |
| 158 |
[2020-08-03 v1.10 Select pages of a document for output (HO)]% |
| 159 |
\documentclass{ltxdoc} |
| 160 |
\usepackage{holtxdoc}[2011/11/22] |
| 161 |
\begin{document} |
| 162 |
\DocInput{pagesel.dtx}% |
| 163 |
\end{document} |
| 164 |
%</driver> |
| 165 |
% \fi |
| 166 |
% |
| 167 |
% |
| 168 |
% |
| 169 |
% \GetFileInfo{pagesel.drv} |
| 170 |
% |
| 171 |
% \title{The \xpackage{pagesel} package} |
| 172 |
% \date{2020-08-03 v1.10} |
| 173 |
% \author{Heiko Oberdiek\thanks |
| 174 |
% {Please report any issues at \url{https://github.com/ho-tex/pagesel/issues}}} |
| 175 |
% |
| 176 |
% \maketitle |
| 177 |
% |
| 178 |
% \begin{abstract} |
| 179 |
% Single pages or page areas can be selected for output. |
| 180 |
% \end{abstract} |
| 181 |
% |
| 182 |
% \tableofcontents |
| 183 |
% |
| 184 |
% \newenvironment{param}{^^A |
| 185 |
% \newcommand{\entry}[1]{\meta{\###1}:&}^^A |
| 186 |
% \begin{tabular}[t]{@{}l@{ }l@{}}^^A |
| 187 |
% }{^^A |
| 188 |
% \end{tabular}^^A |
| 189 |
% } |
| 190 |
% |
| 191 |
% \newcommand*{\Option}[1]{\textsf{#1}} |
| 192 |
% |
| 193 |
% \section{Usage} |
| 194 |
% The package \Package{pagesel} is a \LaTeXe\ package: |
| 195 |
% \begin{quote} |
| 196 |
% |\usepackage|\oarg{options}|{pagesel}| |
| 197 |
% \end{quote} |
| 198 |
% (For plain\TeX\ and \LaTeX\,2.09 the similar package |
| 199 |
% \URL{\Package{selectp}}^^A |
| 200 |
% {https://ctan.org/pkg/selectp} |
| 201 |
% from \NameEmail{Donald Arsenau}{[email protected]} can be used.) |
| 202 |
% |
| 203 |
% Depending on the options the package works in two modes: |
| 204 |
% \begin{enumerate} |
| 205 |
% \item If no page selecting option is present, so the package |
| 206 |
% ignores the other options and finishes itself. So no |
| 207 |
% page will be suppressed by the package and auxiliary files |
| 208 |
% will be written. |
| 209 |
% \item With at least one page selecting option the specified |
| 210 |
% pages are selected and the other are suppressed. |
| 211 |
% The default for this mode is that auxiliary will not be |
| 212 |
% overwritten. (This can be changed by an option.) |
| 213 |
% \end{enumerate} |
| 214 |
% |
| 215 |
% \subsection{Page selecting} |
| 216 |
% The package \Package{pagesel} sets up a new counter that is |
| 217 |
% incremented by each \cmd{\shipout}. |
| 218 |
% In this way the package counts the output pages regardless the value |
| 219 |
% of the page counter. So each page can individually by addressed, |
| 220 |
% even if there are several pages with the same page number. |
| 221 |
% |
| 222 |
% \subsubsection{Options\texorpdfstring{ for selecting pages}{}} |
| 223 |
% \begin{description} |
| 224 |
% \item[\Option{odd}:] The output pages must have an odd number. |
| 225 |
% All even output pages are suppressed. If there are no |
| 226 |
% page areas specified so all odd pages are print. With |
| 227 |
% page areas only the odd pages in this areas are selected. |
| 228 |
% \item[\Option{even}:] The opposite of option \Option{odd}. |
| 229 |
% \item[Page area:] A page area consists of three elements: |
| 230 |
% the starting output page number, an ``area'' hyphen, and |
| 231 |
% the output page number of the last page in this area. |
| 232 |
% Each component is optional, so there are four kinds |
| 233 |
% to spezify a page area: |
| 234 |
% \begin{description} |
| 235 |
% \item[\meta{m}\Option{-}\meta{n}:] All pages between |
| 236 |
% \meta{m} and \meta{n} inclusive. |
| 237 |
% \item[\Option{-}\meta{n}:] All pages until \meta{n} inclusive. |
| 238 |
% \item[\meta{m}\Option{-}:] The page area starts with \meta{m} |
| 239 |
% and all pages to the end of document are selected. |
| 240 |
% \item[\Option{-}:] All pages (not very useful). |
| 241 |
% \item[\meta{s}:] The single page \meta{s}. |
| 242 |
% \end{description} |
| 243 |
% \end{description} |
| 244 |
% |
| 245 |
% \subsubsection{Examples} |
| 246 |
% \newcommand*{\exam}[1]{\texttt{\strut[#1]}}^^A hash-ok |
| 247 |
% \begin{tabular}{ll} |
| 248 |
% Options & Output pages\\ |
| 249 |
% \hline |
| 250 |
% \exam{1, 4, 9}& 1, 4, and 9\\ |
| 251 |
% \exam{7-10, 3}& 3, 7, 8, 9, and 10\\ |
| 252 |
% \exam{odd, 3-6}& 3, and 5\\ |
| 253 |
% \exam{-4, 3, even, 7-8}& 2, 4, and 8\\ |
| 254 |
% \end{tabular} |
| 255 |
% |
| 256 |
% \subsection{Auxiliary files} |
| 257 |
% If a page is suppressed, the \cmd{\write} commands are not |
| 258 |
% performed. Labels, index entries, or entries for the |
| 259 |
% table of contents aren't written. So it is likely that |
| 260 |
% the table of contents, registers, and lists are incomplete. |
| 261 |
% \subsubsection{Options\texorpdfstring{ for handling auxiliary files}{}} |
| 262 |
% \begin{description} |
| 263 |
% \item[\Option{nofiles}:] This is the default. Auxiliary files are |
| 264 |
% read but not written or changed. Also the job is aborted |
| 265 |
% after the last selected page for saving time. |
| 266 |
% \item[\Option{nonofiles}/\Option{files}:] Auxiliary files are |
| 267 |
% written. |
| 268 |
% \end{description} |
| 269 |
% \subsubsection{\texorpdfstring{Package }{}\Package{hyperref}} |
| 270 |
% In old versions of \Package{hyperref} [1999/04/12 v6.55] (and below) |
| 271 |
% there is a bug with \cmd{\nofiles}: |
| 272 |
% \begin{itemize} |
| 273 |
% \item Some ``garbage'' appears on terminal and in the log file. |
| 274 |
% This is harmless and can be ignored. |
| 275 |
% \item The outline auxiliary file \cmd{\jobname.out}, however, |
| 276 |
% is opened and truncated to zero bytes. |
| 277 |
% Version 1.0 of this package had |
| 278 |
% loaded a patch file \File{hypnofil.tex}, if it detects |
| 279 |
% \Package{hyperref} to get \cmd{\nofiles} work. |
| 280 |
% |
| 281 |
% With the new version of \Package{hyperref} [1999/04/13 v6.56] |
| 282 |
% \cmd{\nofiles} works now. Therefore the workaround code |
| 283 |
% is no longer needed and removed. |
| 284 |
% \end{itemize} |
| 285 |
% |
| 286 |
% \StopEventually{ |
| 287 |
% } |
| 288 |
% |
| 289 |
% \section{Implementation} |
| 290 |
% \begin{macrocode} |
| 291 |
%<*package> |
| 292 |
% \end{macrocode} |
| 293 |
% \subsection{New implementation using the LaTeX kernel hooks} |
| 294 |
% \begin{macrocode} |
| 295 |
\NeedsTeXFormat{LaTeX2e} |
| 296 |
\ProvidesPackage{pagesel} |
| 297 |
[2020-08-03 v1.10 Select pages of a document for output (HO)]% |
| 298 |
% \end{macrocode} |
| 299 |
% \begin{macrocode} |
| 300 |
\providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} |
| 301 |
\IfFormatAtLeastTF{2020/10/01}{}{\input{pagesel-2016-05-16.sty}} |
| 302 |
\IfFormatAtLeastTF{2020/10/01}{}{\endinput} |
| 303 |
|
| 304 |
% \end{macrocode} |
| 305 |
% If the package is loaded twice, the package code does not |
| 306 |
% work. So stop loading the package, if it is already loaded. |
| 307 |
% \begin{macrocode} |
| 308 |
\@ifundefined{ps@oddpages}{}{% |
| 309 |
\PackageWarningNoLine{pagesel}{Package already loaded.}% |
| 310 |
\endinput |
| 311 |
} |
| 312 |
% \end{macrocode} |
| 313 |
% \begin{macrocode} |
| 314 |
%</package> |
| 315 |
% \end{macrocode} |
| 316 |
% \subsection{Package} |
| 317 |
% \begin{macrocode} |
| 318 |
%<*packagefrozen> |
| 319 |
\NeedsTeXFormat{LaTeX2e} |
| 320 |
\ProvidesPackage{pagesel} |
| 321 |
[2020-08-03 v1.10 Select pages of a document for output (legacy code) (HO)]% |
| 322 |
% \end{macrocode} |
| 323 |
% |
| 324 |
% If the package is loaded twice, the package code does not |
| 325 |
% work. So stop loading the package, if it is already loaded. |
| 326 |
% \begin{macrocode} |
| 327 |
\@ifundefined{ps@makevoid}{}{% |
| 328 |
\PackageWarningNoLine{pagesel}{Package already loaded.}% |
| 329 |
\endinput |
| 330 |
} |
| 331 |
% \end{macrocode} |
| 332 |
% |
| 333 |
% \begin{macro}{\ps@makevoid} |
| 334 |
% Macro \cmd{\ps@makevoid} clears the output box. Because |
| 335 |
% nothing is shipped out and this is intended, we reduce |
| 336 |
% the counter \cmd{\deadcycles} in order to avoid problems, if |
| 337 |
% more than \cmd{\maxdeadcycles} pages are omitted. |
| 338 |
% \begin{macrocode} |
| 339 |
\newcommand*{\ps@makevoid}{% |
| 340 |
\global\setbox\@cclv\copy\voidb@x |
| 341 |
\begingroup |
| 342 |
\count@=\deadcycles |
| 343 |
\advance\count@ by -1\relax |
| 344 |
\deadcycles=\count@ |
| 345 |
\endgroup |
| 346 |
} |
| 347 |
%</packagefrozen> |
| 348 |
% \end{macrocode} |
| 349 |
% \end{macro} |
| 350 |
% |
| 351 |
% \begin{macro}{\ps@oddpages} |
| 352 |
% \begin{macrocode} |
| 353 |
%<*package|packagefrozen> |
| 354 |
\newcommand*\ps@oddpages{0} |
| 355 |
\DeclareOption{odd}{\renewcommand*\ps@oddpages{1}} |
| 356 |
\DeclareOption{even}{\renewcommand*\ps@oddpages{2}} |
| 357 |
% \end{macrocode} |
| 358 |
% \end{macro} |
| 359 |
% |
| 360 |
% \begin{macrocode} |
| 361 |
\DeclareOption{nofiles}{\let\ps@nofiles\nofiles} |
| 362 |
\DeclareOption{nonofiles}{\let\ps@nofiles\@empty} |
| 363 |
\DeclareOption{files}{\let\ps@nofiles\@empty} |
| 364 |
\ExecuteOptions{nofiles} |
| 365 |
% \end{macrocode} |
| 366 |
% |
| 367 |
% \begin{macrocode} |
| 368 |
\DeclareOption*{% |
| 369 |
\begingroup |
| 370 |
\expandafter\ps@checkoption\CurrentOption-\END |
| 371 |
\edef\x{\endgroup\noexpand\ps@store{\ps@first}{\ps@last}}% |
| 372 |
\x |
| 373 |
} |
| 374 |
% \end{macrocode} |
| 375 |
% |
| 376 |
% \begin{macro}{\ps@checkoption} |
| 377 |
% \begin{macrocode} |
| 378 |
\newcommand\ps@checkoption{} |
| 379 |
\def\ps@checkoption#1-#2\END{% |
| 380 |
\ifx\\#2\\% |
| 381 |
\ifx\\#1\\% |
| 382 |
% empty option |
| 383 |
\def\ps@first{\maxdimen}% |
| 384 |
\def\ps@last{\maxdimen}% |
| 385 |
\else |
| 386 |
\edef\ps@first{#1}% |
| 387 |
\edef\ps@last{#1}% |
| 388 |
\fi |
| 389 |
\else |
| 390 |
\ifx\\#1\\% |
| 391 |
\def\ps@first{-\maxdimen}% |
| 392 |
\else |
| 393 |
\edef\ps@first{#1}% |
| 394 |
\fi |
| 395 |
\ps@checklast#2% |
| 396 |
\fi |
| 397 |
} |
| 398 |
% \end{macrocode} |
| 399 |
% \end{macro} |
| 400 |
% |
| 401 |
% \begin{macro}{\ps@checklast} |
| 402 |
% \begin{macrocode} |
| 403 |
\newcommand\ps@checklast{} |
| 404 |
\def\ps@checklast#1-{% |
| 405 |
\ifx\\#1\\% |
| 406 |
\def\ps@last{\maxdimen}% |
| 407 |
\else |
| 408 |
\edef\ps@last{#1}% |
| 409 |
\fi |
| 410 |
} |
| 411 |
% \end{macrocode} |
| 412 |
% \end{macro} |
| 413 |
% |
| 414 |
% \begin{macro}{\ps@store} |
| 415 |
% \begin{macrocode} |
| 416 |
\newcommand*{\ps@store}[2]{% |
| 417 |
\expandafter\def\expandafter\ps@testlist\expandafter{% |
| 418 |
\ps@testlist\ps@pagetest{#1}{#2}% |
| 419 |
}% |
| 420 |
} |
| 421 |
% \end{macrocode} |
| 422 |
% \end{macro} |
| 423 |
% |
| 424 |
% \begin{macro}{\ps@testlist} |
| 425 |
% \begin{macrocode} |
| 426 |
\newcommand*\ps@testlist{} |
| 427 |
% \end{macrocode} |
| 428 |
% \end{macro} |
| 429 |
% |
| 430 |
% \begin{macrocode} |
| 431 |
\ProcessOptions |
| 432 |
% \end{macrocode} |
| 433 |
% |
| 434 |
% \begin{macrocode} |
| 435 |
\begingroup |
| 436 |
\edef\x{% |
| 437 |
\ifnum\ps@oddpages>0 \relax\fi |
| 438 |
\ifx\ps@testlist\@empty\else\relax\fi |
| 439 |
}% |
| 440 |
\ifx\x\@empty |
| 441 |
\endgroup |
| 442 |
\PackageInfo{pagesel}{Nothing to do}% |
| 443 |
\expandafter\endinput |
| 444 |
\fi |
| 445 |
\endgroup |
| 446 |
% \end{macrocode} |
| 447 |
% |
| 448 |
% \begin{macrocode} |
| 449 |
%</package|packagefrozen> |
| 450 |
%<*packagefrozen> |
| 451 |
\RequirePackage{everyshi} |
| 452 |
%</packagefrozen> |
| 453 |
% \end{macrocode} |
| 454 |
% |
| 455 |
% \begin{macrocode} |
| 456 |
%<*package|packagefrozen> |
| 457 |
\ps@nofiles |
| 458 |
% \end{macrocode} |
| 459 |
% |
| 460 |
% \begin{macro}{\c@ps@count} |
| 461 |
% \begin{macrocode} |
| 462 |
\newcounter{ps@count} |
| 463 |
\setcounter{ps@count}{0} |
| 464 |
% \end{macrocode} |
| 465 |
% \end{macro} |
| 466 |
% |
| 467 |
% \begin{macro}{\ps@ReturnAfterElseFi} |
| 468 |
% \begin{macro}{\ps@ReturnAfterFi} |
| 469 |
% \begin{macrocode} |
| 470 |
\long\def\ps@ReturnAfterElseFi#1\else#2\fi{\fi#1} |
| 471 |
\long\def\ps@ReturnAfterFi#1\fi{\fi#1} |
| 472 |
% \end{macrocode} |
| 473 |
% \end{macro} |
| 474 |
% \end{macro} |
| 475 |
% |
| 476 |
% \begin{macrocode} |
| 477 |
\newcommand{\ps@lastpage}{\maxdimen} |
| 478 |
\ifx\ps@nofiles\nofiles |
| 479 |
\ifx\ps@testlist\@empty |
| 480 |
\else |
| 481 |
\def\ps@lastpage{0}% |
| 482 |
\newcommand*{\ps@pagetest}[2]{% |
| 483 |
\ifnum#2>\ps@lastpage\relax |
| 484 |
\def\ps@lastpage{#2}% |
| 485 |
\fi |
| 486 |
}% |
| 487 |
\ps@testlist |
| 488 |
\let\ps@pagetest\relax |
| 489 |
\fi |
| 490 |
\fi |
| 491 |
% \end{macrocode} |
| 492 |
% |
| 493 |
% \begin{macro}{\ps@ifinset} |
| 494 |
% \begin{macrocode} |
| 495 |
\newcommand*{\ps@ifinset}[4]{% |
| 496 |
\ifnum#1>\value{ps@count}% |
| 497 |
\ps@ReturnAfterElseFi{#4}% |
| 498 |
\else |
| 499 |
\ps@ReturnAfterFi{% |
| 500 |
\ifnum#2<\value{ps@count}% |
| 501 |
\ps@ReturnAfterElseFi{#4}% |
| 502 |
\else |
| 503 |
\ps@ReturnAfterFi{#3}% |
| 504 |
\fi |
| 505 |
}% |
| 506 |
\fi |
| 507 |
} |
| 508 |
% \end{macrocode} |
| 509 |
% \end{macro} |
| 510 |
% |
| 511 |
% \begin{macro}{\ps@pagetest} |
| 512 |
% \begin{macrocode} |
| 513 |
\newcommand*{\ps@pagetest}[2]{% |
| 514 |
\ps@ifinset{#1}{#2}{\let\ps@next\@empty}{}% |
| 515 |
} |
| 516 |
% \end{macrocode} |
| 517 |
% \end{macro} |
| 518 |
% |
| 519 |
% \begin{macrocode} |
| 520 |
%</package|packagefrozen> |
| 521 |
%<packagefrozen>\EveryShipout{% |
| 522 |
%<package>\AddToHook{shipout/before}{% |
| 523 |
%<*package|packagefrozen> |
| 524 |
\stepcounter{ps@count}% |
| 525 |
\ifnum\value{ps@count}>\ps@lastpage\relax |
| 526 |
\global\output{% |
| 527 |
\ps@cleanup@if |
| 528 |
\ps@group@message |
| 529 |
\typeout{% |
| 530 |
Package pagesel Notice: Aborting LaTeX job % |
| 531 |
after last selected page (\ps@lastpage).% |
| 532 |
}% |
| 533 |
\ps@message@ignore |
| 534 |
\global\setbox\@cclv\box\voidb@x |
| 535 |
\deadcycles0\relax |
| 536 |
% \end{macrocode} |
| 537 |
% First leave the output group before ending the job. |
| 538 |
% \begin{macrocode} |
| 539 |
\aftergroup\@@end |
| 540 |
}% |
| 541 |
\fi |
| 542 |
\let\ps@next\@empty |
| 543 |
\ifx\ps@testlist\@empty |
| 544 |
\else |
| 545 |
%<packagefrozen> \let\ps@next\ps@makevoid |
| 546 |
%<package> \let\ps@next\DiscardShipoutBox |
| 547 |
\ps@testlist |
| 548 |
\fi |
| 549 |
\ifnum\ps@oddpages=1 % |
| 550 |
\ifodd\value{ps@count}% |
| 551 |
\else |
| 552 |
%<packagefrozen> \let\ps@next\ps@makevoid |
| 553 |
%<package> \let\ps@next\DiscardShipoutBox |
| 554 |
\fi |
| 555 |
\fi |
| 556 |
\ifnum\ps@oddpages=2 % |
| 557 |
\ifodd\value{ps@count}% |
| 558 |
%<packagefrozen> \let\ps@next\ps@makevoid |
| 559 |
%<package> \let\ps@next\DiscardShipoutBox |
| 560 |
\else |
| 561 |
\fi |
| 562 |
\fi |
| 563 |
%<packagefrozen> \ps@begindvi |
| 564 |
\ps@next |
| 565 |
} |
| 566 |
%</package|packagefrozen> |
| 567 |
% \end{macrocode} |
| 568 |
% |
| 569 |
% \begin{macrocode} |
| 570 |
%<*package|packagefrozen> |
| 571 |
%<packagefrozen>\begingroup\expandafter\expandafter\expandafter\endgroup |
| 572 |
%<packagefrozen>\expandafter\ifx\csname currentiflevel\endcsname\relax |
| 573 |
%<packagefrozen> \let\ps@cleanup@if\@empty |
| 574 |
%<packagefrozen>\else |
| 575 |
\def\ps@cleanup@if{% |
| 576 |
\ifnum\currentiflevel>\@ne |
| 577 |
\csname fi\endcsname |
| 578 |
\expandafter\ps@cleanup@if |
| 579 |
\fi |
| 580 |
}% |
| 581 |
%<packagefrozen>\fi |
| 582 |
% \end{macrocode} |
| 583 |
% Because of \cs{aftergroup} it is too dangerous to perform |
| 584 |
% a similar cleanup for groups. |
| 585 |
% \begin{macrocode} |
| 586 |
%<packagefrozen> \begingroup\expandafter\expandafter\expandafter\endgroup |
| 587 |
%<packagefrozen> \expandafter\ifx\csname currentgrouplevel\endcsname\relax |
| 588 |
%<packagefrozen> \let\ps@group@message\@empty |
| 589 |
%<packagefrozen> \def\ps@message@ignore{% |
| 590 |
%<packagefrozen> \typeout{% |
| 591 |
%<packagefrozen> (pagesel) \space\space\@spaces\@spaces\@spaces |
| 592 |
%<packagefrozen> Messages (\string\end\space occurred ...) can be ignored.% |
| 593 |
%<packagefrozen> }% |
| 594 |
%<packagefrozen> }% |
| 595 |
%<packagefrozen>\else |
| 596 |
\def\ps@group@message{% |
| 597 |
\ifnum\currentgrouplevel>\@ne |
| 598 |
\def\ps@message@ignore{% |
| 599 |
\typeout{% |
| 600 |
(pagesel) \space\space\@spaces\@spaces\@spaces |
| 601 |
Message (\string\end\space occurred ...) % |
| 602 |
can be ignored.% |
| 603 |
}% |
| 604 |
}% |
| 605 |
\else |
| 606 |
\let\ps@message@ignore\@empty |
| 607 |
\fi |
| 608 |
}% |
| 609 |
%<packagefrozen>\fi |
| 610 |
%</package|packagefrozen> |
| 611 |
% \end{macrocode} |
| 612 |
% |
| 613 |
% \subsection{AtBeginDvi hook support} |
| 614 |
% |
| 615 |
% The material of box \cs{@begindvibox} is recorded in parallel |
| 616 |
% in box \cs{ps@begindvibox}. |
| 617 |
% \begin{macrocode} |
| 618 |
%<*packagefrozen> |
| 619 |
\newbox\ps@begindvibox |
| 620 |
\ifvoid\@begindvibox |
| 621 |
\else |
| 622 |
\global\setbox\ps@begindvibox\vbox{% |
| 623 |
\unvbox\@begindvibox |
| 624 |
}% |
| 625 |
\fi |
| 626 |
\let\ps@org@AtBeginDvi\AtBeginDvi |
| 627 |
\def\AtBeginDvi#1{% |
| 628 |
\global\setbox\ps@begindvibox\vbox{% |
| 629 |
\unvbox\ps@begindvibox |
| 630 |
#1% |
| 631 |
}% |
| 632 |
\ps@org@AtBeginDvi{#1}% |
| 633 |
} |
| 634 |
% \end{macrocode} |
| 635 |
% |
| 636 |
% \begin{macro}{\ps@begindvi} |
| 637 |
% Macro \cs{ps@begindvi} is called the similar way as \cs{@begindvi}. |
| 638 |
% If the first page is printed, then \cs{AtBeginDvi} should work |
| 639 |
% as usual. Otherwise the contents of box \cs{ps@begindvibox} is |
| 640 |
% set on the first selected page. |
| 641 |
% \begin{macrocode} |
| 642 |
\def\ps@begindvi{% |
| 643 |
\ifx\ps@next\@empty |
| 644 |
\global\let\ps@begindvi\@empty |
| 645 |
\else |
| 646 |
\global\let\ps@begindvi\ps@begindvi@do |
| 647 |
\fi |
| 648 |
} |
| 649 |
\def\ps@begindvi@do{% |
| 650 |
\ifx\ps@next\@empty |
| 651 |
\setbox\@cclv\vbox{% |
| 652 |
\unvbox\ps@begindvibox |
| 653 |
\box\@cclv |
| 654 |
}% |
| 655 |
\global\let\ps@begindvi\@empty |
| 656 |
\fi |
| 657 |
} |
| 658 |
% \end{macrocode} |
| 659 |
% \end{macro} |
| 660 |
% |
| 661 |
% \begin{macrocode} |
| 662 |
%</packagefrozen> |
| 663 |
% \end{macrocode} |
| 664 |
% |
| 665 |
% \section{Installation} |
| 666 |
% |
| 667 |
% \subsection{Download} |
| 668 |
% |
| 669 |
% \paragraph{Package.} This package is available on |
| 670 |
% CTAN\footnote{\CTANpkg{pagesel}}: |
| 671 |
% \begin{description} |
| 672 |
% \item[\CTAN{macros/latex/contrib/pagesel/pagesel.dtx}] The source file. |
| 673 |
% \item[\CTAN{macros/latex/contrib/pagesel/pagesel.pdf}] Documentation. |
| 674 |
% \end{description} |
| 675 |
% |
| 676 |
% |
| 677 |
% |
| 678 |
% \subsection{Package installation} |
| 679 |
% |
| 680 |
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting |
| 681 |
% \docstrip\ archive. The files are extracted by running the |
| 682 |
% \xfile{.dtx} through \plainTeX: |
| 683 |
% \begin{quote} |
| 684 |
% \verb|tex pagesel.dtx| |
| 685 |
% \end{quote} |
| 686 |
% |
| 687 |
% \paragraph{TDS.} Now the different files must be moved into |
| 688 |
% the different directories in your installation TDS tree |
| 689 |
% (also known as \xfile{texmf} tree): |
| 690 |
% \begin{quote} |
| 691 |
% \def\t{^^A |
| 692 |
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} |
| 693 |
% pagesel.sty & tex/latex/pagesel/pagesel.sty\\ |
| 694 |
% pagesel.pdf & doc/latex/pagesel/pagesel.pdf\\ |
| 695 |
% pagesel.dtx & source/latex/pagesel/pagesel.dtx\\ |
| 696 |
% \end{tabular}^^A |
| 697 |
% }^^A |
| 698 |
% \sbox0{\t}^^A |
| 699 |
% \ifdim\wd0>\linewidth |
| 700 |
% \begingroup |
| 701 |
% \advance\linewidth by\leftmargin |
| 702 |
% \advance\linewidth by\rightmargin |
| 703 |
% \edef\x{\endgroup |
| 704 |
% \def\noexpand\lw{\the\linewidth}^^A |
| 705 |
% }\x |
| 706 |
% \def\lwbox{^^A |
| 707 |
% \leavevmode |
| 708 |
% \hbox to \linewidth{^^A |
| 709 |
% \kern-\leftmargin\relax |
| 710 |
% \hss |
| 711 |
% \usebox0 |
| 712 |
% \hss |
| 713 |
% \kern-\rightmargin\relax |
| 714 |
% }^^A |
| 715 |
% }^^A |
| 716 |
% \ifdim\wd0>\lw |
| 717 |
% \sbox0{\small\t}^^A |
| 718 |
% \ifdim\wd0>\linewidth |
| 719 |
% \ifdim\wd0>\lw |
| 720 |
% \sbox0{\footnotesize\t}^^A |
| 721 |
% \ifdim\wd0>\linewidth |
| 722 |
% \ifdim\wd0>\lw |
| 723 |
% \sbox0{\scriptsize\t}^^A |
| 724 |
% \ifdim\wd0>\linewidth |
| 725 |
% \ifdim\wd0>\lw |
| 726 |
% \sbox0{\tiny\t}^^A |
| 727 |
% \ifdim\wd0>\linewidth |
| 728 |
% \lwbox |
| 729 |
% \else |
| 730 |
% \usebox0 |
| 731 |
% \fi |
| 732 |
% \else |
| 733 |
% \lwbox |
| 734 |
% \fi |
| 735 |
% \else |
| 736 |
% \usebox0 |
| 737 |
% \fi |
| 738 |
% \else |
| 739 |
% \lwbox |
| 740 |
% \fi |
| 741 |
% \else |
| 742 |
% \usebox0 |
| 743 |
% \fi |
| 744 |
% \else |
| 745 |
% \lwbox |
| 746 |
% \fi |
| 747 |
% \else |
| 748 |
% \usebox0 |
| 749 |
% \fi |
| 750 |
% \else |
| 751 |
% \lwbox |
| 752 |
% \fi |
| 753 |
% \else |
| 754 |
% \usebox0 |
| 755 |
% \fi |
| 756 |
% \end{quote} |
| 757 |
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's |
| 758 |
% TDS installing feature, then some files can already be in the right |
| 759 |
% place, see the documentation of \docstrip. |
| 760 |
% |
| 761 |
% \subsection{Refresh file name databases} |
| 762 |
% |
| 763 |
% If your \TeX~distribution |
| 764 |
% (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh |
| 765 |
% these. For example, \TeX\,Live\ users run \verb|texhash| or |
| 766 |
% \verb|mktexlsr|. |
| 767 |
% |
| 768 |
% \subsection{Some details for the interested} |
| 769 |
% |
| 770 |
% \paragraph{Unpacking with \LaTeX.} |
| 771 |
% The \xfile{.dtx} chooses its action depending on the format: |
| 772 |
% \begin{description} |
| 773 |
% \item[\plainTeX:] Run \docstrip\ and extract the files. |
| 774 |
% \item[\LaTeX:] Generate the documentation. |
| 775 |
% \end{description} |
| 776 |
% If you insist on using \LaTeX\ for \docstrip\ (really, |
| 777 |
% \docstrip\ does not need \LaTeX), then inform the autodetect routine |
| 778 |
% about your intention: |
| 779 |
% \begin{quote} |
| 780 |
% \verb|latex \let\install=y\input{pagesel.dtx}| |
| 781 |
% \end{quote} |
| 782 |
% Do not forget to quote the argument according to the demands |
| 783 |
% of your shell. |
| 784 |
% |
| 785 |
% \paragraph{Generating the documentation.} |
| 786 |
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate |
| 787 |
% the documentation. The process can be configured by the |
| 788 |
% configuration file \xfile{ltxdoc.cfg}. For instance, put this |
| 789 |
% line into this file, if you want to have A4 as paper format: |
| 790 |
% \begin{quote} |
| 791 |
% \verb|\PassOptionsToClass{a4paper}{article}| |
| 792 |
% \end{quote} |
| 793 |
% An example follows how to generate the |
| 794 |
% documentation with pdf\LaTeX: |
| 795 |
% \begin{quote} |
| 796 |
%\begin{verbatim} |
| 797 |
%pdflatex pagesel.dtx |
| 798 |
%makeindex -s gind.ist pagesel.idx |
| 799 |
%pdflatex pagesel.dtx |
| 800 |
%makeindex -s gind.ist pagesel.idx |
| 801 |
%pdflatex pagesel.dtx |
| 802 |
%\end{verbatim} |
| 803 |
% \end{quote} |
| 804 |
% |
| 805 |
% \begin{History} |
| 806 |
% \begin{Version}{1999/03/01 v0.9} |
| 807 |
% \item |
| 808 |
% The first version was built as a response to a question |
| 809 |
% of \NameEmail{Dirk Kuypers}{[email protected]}, |
| 810 |
% published in the newsgroup |
| 811 |
% \href{news:de.comp.text.tex}{de.comp.text.tex}:\\ |
| 812 |
% \URL{``\link{Re: pdflatex nur fuer bestimmte Seiten?!?}''}^^A |
| 813 |
% {https://groups.google.com/group/de.comp.text.tex/msg/6b68c7b3439fb658} |
| 814 |
% \end{Version} |
| 815 |
% \begin{Version}{1999/04/05 v1.0} |
| 816 |
% \item |
| 817 |
% Documentation added in dtx format. |
| 818 |
% \item |
| 819 |
% Copyright: LPPL (\CTAN{macros/latex/base/lppl.txt}) |
| 820 |
% \item |
| 821 |
% Options |odd|, |even| added. |
| 822 |
% \item |
| 823 |
% \cmd{\nofiles} added, bug fix for \Package{hyperref}. |
| 824 |
% \item |
| 825 |
% Abort loading of package, if nothing to do. |
| 826 |
% \end{Version} |
| 827 |
% \begin{Version}{1999/04/13 v1.1} |
| 828 |
% \item |
| 829 |
% \cs{nofiles} bug fix removed |
| 830 |
% because of \xpackage{hyperref} 6.55. |
| 831 |
% \item |
| 832 |
% First CTAN release. |
| 833 |
% \end{Version} |
| 834 |
% \begin{Version}{2003/06/05 v1.2} |
| 835 |
% \item |
| 836 |
% \cs{deadcyles} is decremented for omitted pages. |
| 837 |
% \item |
| 838 |
% LPPL 1.2. |
| 839 |
% \end{Version} |
| 840 |
% \begin{Version}{2006/02/20 v1.3} |
| 841 |
% \item |
| 842 |
% Code is not changed. |
| 843 |
% \item |
| 844 |
% New DTX framework. |
| 845 |
% \item |
| 846 |
% LPPL 1.3 |
| 847 |
% \end{Version} |
| 848 |
% \begin{Version}{2006/03/02 v1.4} |
| 849 |
% \item |
| 850 |
% Support for \cs{AtBeginDvi} added. |
| 851 |
% \end{Version} |
| 852 |
% \begin{Version}{2006/03/07 v1.5} |
| 853 |
% \item |
| 854 |
% Job is aborted after last selected page. |
| 855 |
% \end{Version} |
| 856 |
% \begin{Version}{2007/04/11 v1.6} |
| 857 |
% \item |
| 858 |
% Line ends sanitized. |
| 859 |
% \end{Version} |
| 860 |
% \begin{Version}{2007/04/12 v1.7} |
| 861 |
% \item |
| 862 |
% Hard coded box number 255 replaced by macro \cs{@cclv}. |
| 863 |
% \end{Version} |
| 864 |
% \begin{Version}{2008/08/11 v1.8} |
| 865 |
% \item |
| 866 |
% Code is not changed. |
| 867 |
% \item |
| 868 |
% URL updated from \texttt{www.dejanews.com} |
| 869 |
% to \texttt{groups.google.com}. |
| 870 |
% \end{Version} |
| 871 |
% \begin{Version}{2016/05/16 v1.9} |
| 872 |
% \item |
| 873 |
% Documentation updates. |
| 874 |
% \end{Version} |
| 875 |
% \begin{Version}{2020-08-03 v1.10} |
| 876 |
% \item Updated to follow the changes in the hook management |
| 877 |
% of LaTeX 2020/10/01 |
| 878 |
% \end{Version} |
| 879 |
% \end{History} |
| 880 |
% |
| 881 |
% \PrintIndex |
| 882 |
% |
| 883 |
% \Finale |
| 884 |
\endinput |