Debian Codegraph @

texmf-dist/tex/latex/pagesel/pagesel.sty

raw
1 %%
2 %% This is file `pagesel.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% pagesel.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% Project: pagesel
12 %% Version: 2020-08-03 v1.10
13 %%
14 %% Copyright (C)
15 %% 1999, 2003, 2006-2008 Heiko Oberdiek
16 %% 2016-2020 Oberdiek Package Support Group
17 %%
18 %% This work may be distributed and/or modified under the
19 %% conditions of the LaTeX Project Public License, either
20 %% version 1.3c of this license or (at your option) any later
21 %% version. This version of this license is in
22 %% https://www.latex-project.org/lppl/lppl-1-3c.txt
23 %% and the latest version of this license is in
24 %% https://www.latex-project.org/lppl.txt
25 %% and version 1.3 or later is part of all distributions of
26 %% LaTeX version 2005/12/01 or later.
27 %%
28 %% This work has the LPPL maintenance status "maintained".
29 %%
30 %% The Current Maintainers of this work are
31 %% Heiko Oberdiek and the Oberdiek Package Support Group
32 %% https://github.com/ho-tex/pagesel/issues
33 %%
34 %% This work consists of the main source file pagesel.dtx
35 %% and the derived files
36 %% pagesel.sty, pagesel-2016-05-16.sty, pagesel.pdf,
37 %% pagesel.ins, pagesel.drv.
38 %%
39 \NeedsTeXFormat{LaTeX2e}
40 \ProvidesPackage{pagesel}
41 [2020-08-03 v1.10 Select pages of a document for output (HO)]%
42 \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion}
43 \IfFormatAtLeastTF{2020/10/01}{}{\input{pagesel-2016-05-16.sty}}
44 \IfFormatAtLeastTF{2020/10/01}{}{\endinput}
45
46 \@ifundefined{ps@oddpages}{}{%
47 \PackageWarningNoLine{pagesel}{Package already loaded.}%
48 \endinput
49 }
50 \newcommand*\ps@oddpages{0}
51 \DeclareOption{odd}{\renewcommand*\ps@oddpages{1}}
52 \DeclareOption{even}{\renewcommand*\ps@oddpages{2}}
53 \DeclareOption{nofiles}{\let\ps@nofiles\nofiles}
54 \DeclareOption{nonofiles}{\let\ps@nofiles\@empty}
55 \DeclareOption{files}{\let\ps@nofiles\@empty}
56 \ExecuteOptions{nofiles}
57 \DeclareOption*{%
58 \begingroup
59 \expandafter\ps@checkoption\CurrentOption-\END
60 \edef\x{\endgroup\noexpand\ps@store{\ps@first}{\ps@last}}%
61 \x
62 }
63 \newcommand\ps@checkoption{}
64 \def\ps@checkoption#1-#2\END{%
65 \ifx\\#2\\%
66 \ifx\\#1\\%
67 % empty option
68 \def\ps@first{\maxdimen}%
69 \def\ps@last{\maxdimen}%
70 \else
71 \edef\ps@first{#1}%
72 \edef\ps@last{#1}%
73 \fi
74 \else
75 \ifx\\#1\\%
76 \def\ps@first{-\maxdimen}%
77 \else
78 \edef\ps@first{#1}%
79 \fi
80 \ps@checklast#2%
81 \fi
82 }
83 \newcommand\ps@checklast{}
84 \def\ps@checklast#1-{%
85 \ifx\\#1\\%
86 \def\ps@last{\maxdimen}%
87 \else
88 \edef\ps@last{#1}%
89 \fi
90 }
91 \newcommand*{\ps@store}[2]{%
92 \expandafter\def\expandafter\ps@testlist\expandafter{%
93 \ps@testlist\ps@pagetest{#1}{#2}%
94 }%
95 }
96 \newcommand*\ps@testlist{}
97 \ProcessOptions
98 \begingroup
99 \edef\x{%
100 \ifnum\ps@oddpages>0 \relax\fi
101 \ifx\ps@testlist\@empty\else\relax\fi
102 }%
103 \ifx\x\@empty
104 \endgroup
105 \PackageInfo{pagesel}{Nothing to do}%
106 \expandafter\endinput
107 \fi
108 \endgroup
109 \ps@nofiles
110 \newcounter{ps@count}
111 \setcounter{ps@count}{0}
112 \long\def\ps@ReturnAfterElseFi#1\else#2\fi{\fi#1}
113 \long\def\ps@ReturnAfterFi#1\fi{\fi#1}
114 \newcommand{\ps@lastpage}{\maxdimen}
115 \ifx\ps@nofiles\nofiles
116 \ifx\ps@testlist\@empty
117 \else
118 \def\ps@lastpage{0}%
119 \newcommand*{\ps@pagetest}[2]{%
120 \ifnum#2>\ps@lastpage\relax
121 \def\ps@lastpage{#2}%
122 \fi
123 }%
124 \ps@testlist
125 \let\ps@pagetest\relax
126 \fi
127 \fi
128 \newcommand*{\ps@ifinset}[4]{%
129 \ifnum#1>\value{ps@count}%
130 \ps@ReturnAfterElseFi{#4}%
131 \else
132 \ps@ReturnAfterFi{%
133 \ifnum#2<\value{ps@count}%
134 \ps@ReturnAfterElseFi{#4}%
135 \else
136 \ps@ReturnAfterFi{#3}%
137 \fi
138 }%
139 \fi
140 }
141 \newcommand*{\ps@pagetest}[2]{%
142 \ps@ifinset{#1}{#2}{\let\ps@next\@empty}{}%
143 }
144 \AddToHook{shipout/before}{%
145 \stepcounter{ps@count}%
146 \ifnum\value{ps@count}>\ps@lastpage\relax
147 \global\output{%
148 \ps@cleanup@if
149 \ps@group@message
150 \typeout{%
151 Package pagesel Notice: Aborting LaTeX job %
152 after last selected page (\ps@lastpage).%
153 }%
154 \ps@message@ignore
155 \global\setbox\@cclv\box\voidb@x
156 \deadcycles0\relax
157 \aftergroup\@@end
158 }%
159 \fi
160 \let\ps@next\@empty
161 \ifx\ps@testlist\@empty
162 \else
163 \let\ps@next\DiscardShipoutBox
164 \ps@testlist
165 \fi
166 \ifnum\ps@oddpages=1 %
167 \ifodd\value{ps@count}%
168 \else
169 \let\ps@next\DiscardShipoutBox
170 \fi
171 \fi
172 \ifnum\ps@oddpages=2 %
173 \ifodd\value{ps@count}%
174 \let\ps@next\DiscardShipoutBox
175 \else
176 \fi
177 \fi
178 \ps@next
179 }
180 \def\ps@cleanup@if{%
181 \ifnum\currentiflevel>\@ne
182 \csname fi\endcsname
183 \expandafter\ps@cleanup@if
184 \fi
185 }%
186 \def\ps@group@message{%
187 \ifnum\currentgrouplevel>\@ne
188 \def\ps@message@ignore{%
189 \typeout{%
190 (pagesel) \space\space\@spaces\@spaces\@spaces
191 Message (\string\end\space occurred ...) %
192 can be ignored.%
193 }%
194 }%
195 \else
196 \let\ps@message@ignore\@empty
197 \fi
198 }%
199 \endinput
200 %%
201 %% End of file `pagesel.sty'.