Debian Codegraph @

texmf-dist/tex/generic/atbegshi/atbegshi.sty

raw
1 %%
2 %% This is file `atbegshi.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% atbegshi.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% Project: atbegshi
12 %% Version: 2019/12/05 v1.19
13 %%
14 %% Copyright (C)
15 %% 2007-2011 Heiko Oberdiek
16 %% 2016-2019 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/atbegshi/issues
33 %%
34 %%
35 %% The Base Interpreter refers to any `TeX-Format',
36 %% because some files are installed in TDS:tex/generic//.
37 %%
38 %% This work consists of the main source file atbegshi.dtx
39 %% and the derived files
40 %% atbegshi.sty, atbegshi.pdf, atbegshi.ins, atbegshi.drv,
41 %% atbegshi-example1.tex, atbegshi-example2.tex,
42 %% atbegshi-test1.tex, atbegshi-test2.tex, atbegshi-test3.tex.
43 %%
44 \begingroup\catcode61\catcode48\catcode32=10\relax%
45 \catcode13=5 % ^^M
46 \endlinechar=13 %
47 \catcode35=6 % #
48 \catcode39=12 % '
49 \catcode44=12 % ,
50 \catcode45=12 % -
51 \catcode46=12 % .
52 \catcode58=12 % :
53 \catcode64=11 % @
54 \catcode123=1 % {
55 \catcode125=2 % }
56 \expandafter\let\expandafter\x\csname [email protected]\endcsname
57 \ifx\x\relax % plain-TeX, first loading
58 \else
59 \def\empty{}%
60 \ifx\x\empty % LaTeX, first loading,
61 % variable is initialized, but \ProvidesPackage not yet seen
62 \else
63 \expandafter\ifx\csname PackageInfo\endcsname\relax
64 \def\x#1#2{%
65 \immediate\write-1{Package #1 Info: #2.}%
66 }%
67 \else
68 \def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
69 \fi
70 \x{atbegshi}{The package is already loaded}%
71 \aftergroup\endinput
72 \fi
73 \fi
74 \endgroup%
75 \begingroup\catcode61\catcode48\catcode32=10\relax%
76 \catcode13=5 % ^^M
77 \endlinechar=13 %
78 \catcode35=6 % #
79 \catcode39=12 % '
80 \catcode40=12 % (
81 \catcode41=12 % )
82 \catcode44=12 % ,
83 \catcode45=12 % -
84 \catcode46=12 % .
85 \catcode47=12 % /
86 \catcode58=12 % :
87 \catcode64=11 % @
88 \catcode91=12 % [
89 \catcode93=12 % ]
90 \catcode123=1 % {
91 \catcode125=2 % }
92 \expandafter\ifx\csname ProvidesPackage\endcsname\relax
93 \def\x#1#2#3[#4]{\endgroup
94 \immediate\write-1{Package: #3 #4}%
95 \xdef#1{#4}%
96 }%
97 \else
98 \def\x#1#2[#3]{\endgroup
99 #2[{#3}]%
100 \ifx#1\@undefined
101 \xdef#1{#3}%
102 \fi
103 \ifx#1\relax
104 \xdef#1{#3}%
105 \fi
106 }%
107 \fi
108 \expandafter\x\csname [email protected]\endcsname
109 \ProvidesPackage{atbegshi}%
110 [2019/12/05 v1.19 At begin shipout hook (HO)]%
111 \begingroup\catcode61\catcode48\catcode32=10\relax%
112 \catcode13=5 % ^^M
113 \endlinechar=13 %
114 \catcode123=1 % {
115 \catcode125=2 % }
116 \catcode64=11 % @
117 \def\x{\endgroup
118 \expandafter\edef\csname AtBegShi@AtEnd\endcsname{%
119 \endlinechar=\the\endlinechar\relax
120 \catcode13=\the\catcode13\relax
121 \catcode32=\the\catcode32\relax
122 \catcode35=\the\catcode35\relax
123 \catcode61=\the\catcode61\relax
124 \catcode64=\the\catcode64\relax
125 \catcode123=\the\catcode123\relax
126 \catcode125=\the\catcode125\relax
127 }%
128 }%
129 \x\catcode61\catcode48\catcode32=10\relax%
130 \catcode13=5 % ^^M
131 \endlinechar=13 %
132 \catcode35=6 % #
133 \catcode64=11 % @
134 \catcode123=1 % {
135 \catcode125=2 % }
136 \def\TMP@EnsureCode#1#2{%
137 \edef\AtBegShi@AtEnd{%
138 \AtBegShi@AtEnd
139 \catcode#1=\the\catcode#1\relax
140 }%
141 \catcode#1=#2\relax
142 }
143 \TMP@EnsureCode{40}{12}% (
144 \TMP@EnsureCode{41}{12}% )
145 \TMP@EnsureCode{44}{12}% ,
146 \TMP@EnsureCode{45}{12}% -
147 \TMP@EnsureCode{47}{12}% /
148 \TMP@EnsureCode{46}{12}% .
149 \TMP@EnsureCode{58}{12}% :
150 \TMP@EnsureCode{91}{12}% [
151 \TMP@EnsureCode{93}{12}% ]
152 \TMP@EnsureCode{94}{7}% ^(superscript)
153 \TMP@EnsureCode{96}{12}% `
154 \edef\AtBegShi@AtEnd{\AtBegShi@AtEnd\noexpand\endinput}
155 \begingroup\expandafter\expandafter\expandafter\endgroup
156 \expandafter\ifx\csname RequirePackage\endcsname\relax
157 \def\TMP@RequirePackage#1[#2]{%
158 \begingroup\expandafter\expandafter\expandafter\endgroup
159 \expandafter\ifx\csname ver@#1.sty\endcsname\relax
160 \input #1.sty\relax
161 \fi
162 }%
163 \TMP@RequirePackage{infwarerr}[2007/09/09]%
164 \TMP@RequirePackage{ltxcmds}[2010/03/01]%
165 \else
166 \RequirePackage{infwarerr}[2007/09/09]%
167 \RequirePackage{ltxcmds}[2010/03/01]%
168 \fi
169 \begingroup\expandafter\expandafter\expandafter\endgroup
170 \expandafter\ifx\csname @ifdefinable\endcsname\relax
171 \def\AtBegShi@CheckDefinable#1{%
172 \ifcase\ifx#1\relax
173 \ltx@one
174 \else
175 \ifx#1\@undefined
176 \ltx@one
177 \else
178 \ltx@zero
179 \fi
180 \fi
181 \@PackageError{atbegshi}{%
182 \string#1\space is already defined%
183 }\@ehd
184 \fi
185 }%
186 \else
187 \def\AtBegShi@CheckDefinable#1{%
188 \@ifdefinable{#1}{}%
189 }%
190 \fi
191 \ltx@newif\ifAtBegShi@Discarded
192 \AtBegShi@CheckDefinable\AtBeginShipoutDiscard
193 \def\AtBeginShipoutDiscard{%
194 \deadcycles=\ltx@zero
195 \global\AtBegShi@Discardedtrue
196 }
197 \begingroup\expandafter\expandafter\expandafter\endgroup
198 \expandafter\ifx\csname currentgrouplevel\endcsname\relax
199 \catcode`X=9 % ignore
200 \catcode`E=14 % comment
201 \else
202 \catcode`X=14 % comment
203 \catcode`E=9 % ignore
204 \fi
205 \def\AtBegShi@Shipout{%
206 X \begingroup
207 X \setbox\AtBeginShipoutBox=\hbox\bgroup
208 X \kern\p@
209 E \edef\AtBegShi@GroupLevel{\number\currentgrouplevel}%
210 \afterassignment\AtBegShi@Test
211 X \global
212 \setbox\AtBeginShipoutBox=%
213 }
214 \def\AtBegShi@Test{%
215 X \ifdim\lastkern=0pt %
216 E \ifnum\AtBegShi@GroupLevel<\currentgrouplevel
217 \expandafter\aftergroup
218 \fi
219 \AtBegShi@Output
220 }
221 \def\AtBegShi@Output{%
222 X \egroup
223 X \endgroup
224 \ifvoid\AtBeginShipoutBox
225 \@PackageWarning{atbegshi}{Ignoring void shipout box}%
226 \else
227 \let\AtBegShi@OrgProtect\protect
228 \csname set@typeset@protect\endcsname
229 \global\AtBegShi@Discardedfalse
230 \AtBegShi@Hook
231 \expandafter\gdef\expandafter\AtBegShi@HookNext
232 \expandafter{\expandafter}%
233 \AtBegShi@HookNext
234 \ifAtBegShi@Discarded
235 \@PackageInfoNoLine{atbegshi}{Shipout page discarded}%
236 \global\AtBegShi@Discardedfalse
237 \begingroup
238 \setbox\AtBeginShipoutBox\box\AtBeginShipoutBox
239 \endgroup
240 \let\protect\AtBegShi@OrgProtect
241 \else
242 \AtBegShi@First
243 \let\protect\AtBegShi@OrgProtect
244 \AtBegShi@GetBoxSize\AtBeginShipoutBox
245 \ltx@ifundefined{AtNextShipout}{%
246 }{%
247 \AtNextShipout{\AtBegShi@GetBoxSize\@cclv}%
248 }%
249 \AtBeginShipoutOriginalShipout\box\AtBeginShipoutBox
250 \fi
251 \fi
252 }
253 \def\AtBegShi@GetBoxSize#1{%
254 \xdef\AtBeginShipoutBoxWidth{\the\wd#1}%
255 \xdef\AtBeginShipoutBoxHeight{\the\ht#1}%
256 \xdef\AtBeginShipoutBoxDepth{\the\dp#1}%
257 }
258 \def\AtBeginShipoutBoxWidth{0pt}
259 \def\AtBeginShipoutBoxHeight{0pt}
260 \def\AtBeginShipoutBoxDepth{0pt}
261 \catcode`\X=11 %
262 \catcode`\E=11 %
263 \def\AtBegShi@First{%
264 \ifx\AtBegShi@HookFirst\ltx@empty
265 \else
266 \AtBeginShipoutAddToBox{\AtBegShi@HookFirst}%
267 \fi
268 \global\let\AtBegShi@First\ltx@empty
269 \global\let\AtBeginShipoutFirst\AtBegShi@FirstDisabled
270 }
271 \gdef\AtBegShi@Hook{}
272 \gdef\AtBegShi@HookNext{}
273 \gdef\AtBegShi@HookFirst{}
274 \AtBegShi@CheckDefinable\AtBeginShipout
275 \def\AtBeginShipout{%
276 \AtBegShi@AddHook\AtBegShi@Hook
277 }
278 \AtBegShi@CheckDefinable\AtBeginShipoutNext
279 \def\AtBeginShipoutNext{%
280 \AtBegShi@AddHook\AtBegShi@HookNext
281 }
282 \AtBegShi@CheckDefinable\AtBeginShipoutFirst
283 \def\AtBeginShipoutFirst{%
284 \AtBegShi@AddTo\AtBegShi@HookFirst
285 }
286 \long\def\AtBegShi@FirstDisabled#1{%
287 \@PackageWarning{atbegshi}{%
288 First page is already shipped out, ignoring\MessageBreak
289 \string\AtBeginShipoutFirst
290 }%
291 }
292 \begingroup\expandafter\expandafter\expandafter\endgroup
293 \expandafter\ifx\csname g@addto@macro\endcsname\relax
294 \long\def\AtBegShi@AddTo#1#2{%
295 \begingroup
296 \toks\ltx@zero\expandafter{#1#2}%
297 \xdef#1{\the\toks\ltx@zero}%
298 \endgroup
299 }%
300 \else
301 \let\AtBegShi@AddTo\g@addto@macro
302 \fi
303 \long\def\AtBegShi@AddHook#1#2{%
304 \AtBegShi@AddTo#1{\AtBegShi@Item{#2}}%
305 }
306 \long\def\AtBegShi@Item#1{%
307 \ifAtBegShi@Discarded
308 \else
309 #1%
310 \ifAtBegShi@Discarded
311 \else
312 \ifvoid\AtBeginShipoutBox
313 \@PackageWarning{atbegshi}{%
314 Shipout box was voided by hook,\MessageBreak
315 ignoring shipout box%
316 }%
317 \AtBeginShipoutDiscard
318 \fi
319 \fi
320 \fi
321 }
322 \AtBegShi@CheckDefinable\AtBeginShipoutInit
323 \def\AtBeginShipoutInit{%
324 \ltx@IfUndefined{newbox}{%
325 \@PackageError{atbegshi}{%
326 \string\AtBeginShipoutInit\space failed\MessageBreak
327 because of missing \expandafter\string\csname newbox\endcsname
328 }\@ehc
329 }{%
330 \csname newbox\endcsname\AtBeginShipoutBox
331 \AtBegShi@CheckDefinable\AtBeginShipoutOriginalShipout
332 \global\let\AtBeginShipoutOriginalShipout\shipout
333 \global\let\shipout\AtBegShi@Shipout
334 }%
335 \gdef\AtBeginShipoutInit{}%
336 }
337 \begingroup\expandafter\expandafter\expandafter\endgroup
338 \expandafter\ifx\csname AtBeginDocument\endcsname\relax
339 \AtBeginShipoutInit
340 \else
341 \AtBeginDocument{\AtBeginShipoutInit}%
342 \fi
343 \def\AtBeginShipoutAddToBox#1{%
344 \ifhbox\AtBeginShipoutBox
345 \edef\AtBegShi@restore{%
346 \hfuzz=\the\hfuzz\relax
347 \hbadness=\the\hbadness\relax
348 }%
349 \hfuzz=1073741823sp\relax
350 \hbadness=2147483647\relax
351 \setbox\AtBeginShipoutBox=\hbox to \wd\AtBeginShipoutBox{%
352 \setbox\ltx@zero=\hbox{%
353 \begingroup
354 \AtBegShi@restore
355 #1%
356 \endgroup
357 }%
358 \wd\ltx@zero=0pt\relax
359 \ht\ltx@zero=0pt\relax
360 \dp\ltx@zero=0pt\relax
361 \raise\ht\AtBeginShipoutBox\copy\ltx@zero
362 \unhcopy\AtBeginShipoutBox
363 }%
364 \AtBegShi@restore
365 \else
366 \ifvbox\AtBeginShipoutBox
367 \edef\AtBegShi@restore{%
368 \vfuzz=\the\vfuzz\relax
369 \vbadness=\the\vbadness\relax
370 \dimen\ltx@zero=\the\dimen\ltx@zero\relax
371 }%
372 \edef\AtBegShi@restorebox{%
373 \ht\AtBeginShipoutBox=\the\ht\AtBeginShipoutBox\relax
374 \dp\AtBeginShipoutBox=\the\dp\AtBeginShipoutBox\relax
375 }%
376 \vfuzz=1073741823sp\relax
377 \vbadness=2147483647\relax
378 \dimen\ltx@zero=\ht\AtBeginShipoutBox
379 \advance\dimen\ltx@zero by \dp\AtBeginShipoutBox
380 \setbox\AtBeginShipoutBox=\vbox to \dimen\ltx@zero{%
381 \setbox\ltx@zero=\hbox{%
382 \begingroup
383 \AtBegShi@restore
384 #1%
385 \endgroup
386 }%
387 \wd\ltx@zero=0pt\relax
388 \ht\ltx@zero=0pt\relax
389 \dp\ltx@zero=0pt\relax
390 \baselineskip=0pt\relax
391 \lineskip=0pt\relax
392 \lineskiplimit=0pt\relax
393 \copy\ltx@zero
394 \unvbox\AtBeginShipoutBox
395 \kern0pt%
396 }%
397 \AtBegShi@restore
398 \AtBegShi@restorebox
399 \fi
400 \fi
401 }
402 \def\AtBeginShipoutAddToBoxForeground#1{%
403 \ifhbox\AtBeginShipoutBox
404 \edef\AtBegShi@restore{%
405 \hfuzz=\the\hfuzz\relax
406 \hbadness=\the\hbadness\relax
407 }%
408 \hfuzz=1073741823sp\relax
409 \hbadness=2147483647\relax
410 \setbox\AtBeginShipoutBox=\hbox to \wd\AtBeginShipoutBox{%
411 \unhcopy\AtBeginShipoutBox
412 \kern-\wd\AtBeginShipoutBox
413 \setbox\ltx@zero=\hbox{%
414 \begingroup
415 \AtBegShi@restore
416 #1%
417 \endgroup
418 }%
419 \wd\ltx@zero=0pt\relax
420 \ht\ltx@zero=0pt\relax
421 \dp\ltx@zero=0pt\relax
422 \raise\ht\AtBeginShipoutBox\copy\ltx@zero
423 \kern\wd\AtBeginShipoutBox
424 }%
425 \AtBegShi@restore
426 \else
427 \ifvbox\AtBeginShipoutBox
428 \edef\AtBegShi@restore{%
429 \vfuzz=\the\vfuzz\relax
430 \vbadness=\the\vbadness\relax
431 \dimen\ltx@zero=\the\dimen\ltx@zero\relax
432 }%
433 \edef\AtBegShi@restorebox{%
434 \ht\AtBeginShipoutBox=\the\ht\AtBeginShipoutBox\relax
435 \dp\AtBeginShipoutBox=\the\dp\AtBeginShipoutBox\relax
436 }%
437 \vfuzz=1073741823sp\relax
438 \vbadness=2147483647\relax
439 \dimen\ltx@zero=\ht\AtBeginShipoutBox
440 \advance\dimen\ltx@zero by \dp\AtBeginShipoutBox
441 \setbox\AtBeginShipoutBox=\vbox to \dimen\ltx@zero{%
442 \setbox\ltx@zero=\hbox{%
443 \begingroup
444 \AtBegShi@restore
445 #1%
446 \endgroup
447 }%
448 \wd\ltx@zero=0pt\relax
449 \ht\ltx@zero=0pt\relax
450 \dp\ltx@zero=0pt\relax
451 \baselineskip=0pt\relax
452 \lineskip=0pt\relax
453 \lineskiplimit=0pt\relax
454 \unvbox\AtBeginShipoutBox
455 \kern-\dimen\ltx@zero
456 \copy\ltx@zero
457 \kern\dimen\ltx@zero
458 }%
459 \AtBegShi@restore
460 \AtBegShi@restorebox
461 \fi
462 \fi
463 }
464 \begingroup\expandafter\expandafter\expandafter\endgroup
465 \expandafter\ifx\csname RequirePackage\endcsname\relax
466 \def\TMP@RequirePackage#1[#2]{%
467 \begingroup\expandafter\expandafter\expandafter\endgroup
468 \expandafter\ifx\csname ver@#1.sty\endcsname\relax
469 \input #1.sty\relax
470 \fi
471 }%
472 \TMP@RequirePackage{iftex}[2019/11/07]%
473 \else
474 \RequirePackage{iftex}[2019/11/07]%
475 \fi
476 \ifpdf
477 \def\AtBegShi@horigin{%
478 \ifx\pdfhorigin\@undefined\pdfvariable horigin\else\pdfhorigin\fi}%
479 \def\AtBegShi@vorigin{%
480 \ifx\pdfvorigin\@undefined\pdfvariable vorigin\else\pdfvorigin\fi}%
481 \else
482 \def\AtBegShi@horigin{72.27pt}%
483 \def\AtBegShi@vorigin{72.27pt}%
484 \fi
485 \begingroup
486 \ifcase
487 \expandafter\ifx\csname picture\endcsname\relax
488 1%
489 \else
490 \expandafter\ifx\csname endpicture\endcsname\relax
491 1%
492 \else
493 0%
494 \fi
495 \fi
496 \endgroup
497 \def\AtBegShi@BeginPicture{%
498 \begingroup
499 \picture(0,0)\relax
500 \begingroup\expandafter\expandafter\expandafter\endgroup
501 \expandafter\ifx\csname unitlength\endcsname\relax
502 \else
503 \unitlength=1pt\relax
504 \fi
505 \ignorespaces
506 }%
507 \def\AtBegShi@EndPicture{%
508 \endpicture
509 \endgroup
510 }%
511 \else
512 \endgroup
513 \def\AtBegShi@BeginPicture{%
514 \setbox\ltx@zero=\hbox\bgroup
515 \begingroup
516 \ignorespaces
517 }%
518 \def\AtBegShi@EndPicture{%
519 \endgroup
520 \egroup
521 \ht\ltx@zero=0pt\relax
522 \dp\ltx@zero=0pt\relax
523 \copy\ltx@zero
524 }%
525 \fi
526 \def\AtBeginShipoutUpperLeft#1{%
527 \AtBeginShipoutAddToBox{%
528 \kern-\AtBegShi@horigin\relax
529 \vbox to 0pt{%
530 \kern-\AtBegShi@vorigin\relax
531 \AtBegShi@BeginPicture
532 #1%
533 \AtBegShi@EndPicture
534 \vss
535 }%
536 }%
537 }
538 \def\AtBeginShipoutUpperLeftForeground#1{%
539 \AtBeginShipoutAddToBoxForeground{%
540 \kern-\AtBegShi@horigin\relax
541 \vbox to 0pt{%
542 \kern-\AtBegShi@vorigin\relax
543 \AtBegShi@BeginPicture
544 #1%
545 \AtBegShi@EndPicture
546 \vss
547 }%
548 }%
549 }
550 \def\AtBegShi@AbortIfUndefined#1{%
551 \begingroup\expandafter\expandafter\expandafter\endgroup
552 \expandafter\ifx\csname#1\endcsname\relax
553 \expandafter\AtBegShi@AtEnd
554 \fi
555 }
556 \AtBegShi@AbortIfUndefined{currentgrouplevel}%
557 \AtBegShi@AbortIfUndefined{AtBeginDocument}%
558 \AtBegShi@AbortIfUndefined{@ifpackageloaded}%
559 \AtBegShi@AbortIfUndefined{@ifclassloaded}%
560 \def\AtBegShi@PatchCrop{%
561 \begingroup
562 \def\AtBegShi@Crop@shipout{%
563 \afterassignment\CROP@ship
564 \setbox\@cclv=%
565 }%
566 \def\AtBegShi@Crop@ship{%
567 \ifvoid\@cclv
568 \expandafter\aftergroup
569 \fi
570 \CROP@@ship
571 }%
572 \def\AtBegShi@Crop@shiplist{%
573 \lineskip\z@
574 \lineskiplimit\z@
575 \baselineskip\z@
576 \CROP@kernel
577 \box\@cclv
578 }%
579 \def\AtBegShi@Crop@@ship{%
580 \CROP@shipout\vbox{%
581 \CROP@shiplist
582 }%
583 }%
584 \ifx\AtBegShi@Crop@ship\CROP@ship
585 \ifx\AtBegShi@Crop@shiplist\CROP@shiplist
586 \ifx\AtBegShi@Crop@@ship\CROP@@ship
587 \let\AtBegShi@found\relax
588 \ifx\shipout\AtBegShi@Crop@shipout
589 \def\AtBegShi@found{\shipout}%
590 \else\ifx\AtBeginShipoutOriginalShipout\AtBegShi@Crop@shipout
591 \def\AtBegShi@found{\AtBeginShipoutOriginalShipout}%
592 \else\ifx\@EveryShipout@Org@Shipout\AtBegShi@Crop@shipout
593 \def\AtBegShi@found{\@EveryShipout@Org@Shipout}%
594 \else\ifx\GPTorg@shipout\AtBegShi@Crop@shipout
595 \def\AtBegShi@found{\GPTorg@shipout}%
596 \else\ifx\THBorg@shipout\AtBegShi@Crop@shipout
597 \def\AtBegShi@found{\THBorg@shipout}%
598 \else\ifx\mem@oldshipout\AtBegShi@Crop@shipout
599 \def\AtBegShi@found{\mem@oldshipout}%
600 \fi\fi\fi\fi\fi\fi
601 \ifx\AtBegShi@found\relax
602 \else
603 \expandafter\endgroup
604 \expandafter\def\AtBegShi@found{%
605 \edef\AtBegShi@GroupLevel{\number\currentgrouplevel}%
606 \afterassignment\CROP@ship
607 \setbox\AtBeginShipoutBox=%
608 }%
609 \def\CROP@ship{%
610 \ifnum\AtBegShi@GroupLevel=\currentgrouplevel
611 \else
612 \expandafter\aftergroup
613 \fi
614 \CROP@@ship
615 }%
616 \def\CROP@shiplist{%
617 \lineskip 0pt\relax
618 \lineskiplimit 0pt\relax
619 \baselineskip 0pt\relax
620 \CROP@kernel
621 \box\AtBeginShipoutBox
622 }%
623 \def\CROP@@ship{%
624 \ifvoid\AtBeginShipoutBox
625 \else
626 \setbox\AtBeginShipoutBox=\vbox{%
627 \CROP@shiplist
628 }%
629 \AtBegShi@GetBoxSize\AtBeginShipoutBox
630 \expandafter\CROP@shipout
631 \expandafter\box
632 \expandafter\AtBeginShipoutBox
633 \fi
634 }%
635 \@PackageInfoNoLine{atbegshi}{Package `crop' patched}%
636 \begingroup
637 \fi
638 \fi
639 \fi
640 \fi
641 \endgroup
642 \let\AtBegShi@PatchCrop\relax
643 }
644 \@ifpackageloaded{crop}{%
645 \AtBegShi@PatchCrop
646 }{%
647 \AtBeginDocument{\AtBegShi@PatchCrop}%
648 }
649 \def\AtBegShi@PatchEveryshi{%
650 \begingroup
651 \long\def\AtBegShi@Everyshi@shipout{%
652 \afterassignment\@EveryShipout@Test
653 \global\setbox\@cclv= %
654 }%
655 \long\def\AtBegShi@Everyshi@Test{%
656 \ifvoid\@cclv\relax
657 \aftergroup\@EveryShipout@Output
658 \else
659 \@EveryShipout@Output
660 \fi
661 }%
662 \ifx\AtBegShi@Everyshi@Test\@EveryShipout@Test
663 \let\AtBegShi@found\relax
664 \ifx\shipout\AtBegShi@Everyshi@shipout
665 \def\AtBegShi@found{\shipout}%
666 \else\ifx\AtBeginShipoutOriginalShipout\AtBegShi@Everyshi@shipout
667 \def\AtBegShi@found{\AtBeginShipoutOriginalShipout}%
668 \else\ifx\CROP@shipout\AtBegShi@Everyshi@shipout
669 \def\AtBegShi@found{\CROP@shipout}%
670 \else\ifx\GPTorg@shipout\AtBegShi@Everyshi@shipout
671 \def\AtBegShi@found{\GPTorg@shipout}%
672 \else\ifx\THBorg@shipout\AtBegShi@Everyshi@shipout
673 \def\AtBegShi@found{\THBorg@shipout}%
674 \else\ifx\mem@oldshipout\AtBegShi@Everyshi@shipout
675 \def\AtBegShi@found{\mem@oldshipout}%
676 \else
677 \expandafter\ifx\csname @EveryShipout@Org@Shipout\endcsname
678 \relax
679 \ifx\@EveryShipout@Shipout\AtBegShi@Everyshi@shipout
680 \def\AtBegShi@found{\@EveryShipout@Shipout}%
681 \fi
682 \fi
683 \fi\fi\fi\fi\fi\fi
684 \ifx\AtBegShi@found\relax
685 \else
686 \expandafter\endgroup
687 \expandafter\def\AtBegShi@found{%
688 \edef\AtBegShi@GroupLevel{\number\currentgrouplevel}%
689 \afterassignment\@EveryShipout@Test
690 \setbox\AtBeginShipoutBox=%
691 }%
692 \def\@EveryShipout@Test{%
693 \ifnum\AtBegShi@GroupLevel=\currentgrouplevel
694 \else
695 \expandafter\aftergroup
696 \fi
697 \AtBegShi@Everyshi@Output
698 }%
699 \def\AtBegShi@Everyshi@Output{%
700 \ifvoid\AtBeginShipoutBox
701 \else
702 \global\setbox\ltx@cclv\box\AtBeginShipoutBox
703 \expandafter\@EveryShipout@Output
704 \fi
705 }%
706 \@PackageInfoNoLine{atbegshi}{Package `everyshi' patched}%
707 \begingroup
708 \fi
709 \fi
710 \endgroup
711 \let\AtBegShi@PatchEveryshi\relax
712 }
713 \@ifpackageloaded{everyshi}{%
714 \AtBegShi@PatchEveryshi
715 }{%
716 \AtBeginDocument{\AtBegShi@PatchEveryshi}%
717 }
718 \def\AtBegShi@PatchMemoir{%
719 \begingroup
720 \def\AtBegShi@Memoir@shipout{%
721 \afterassignment\mem@shipi
722 \setbox\@cclv=%
723 }%
724 \def\AtBegShi@Memoir@shipi{%
725 \ifvoid\@cclv
726 \expandafter\aftergroup
727 \fi
728 \mem@shipii
729 }%
730 \def\AtBegShi@Memoir@shipiiA{%
731 \mem@oldshipout\vbox{%
732 \trimmarks
733 \unvbox\@cclv
734 }%
735 }%
736 \def\AtBegShi@Memoir@shipiiB{%
737 \ifvoid\@cclv
738 \mem@oldshipout\box\@cclv
739 \else
740 \mem@oldshipout\vbox{%
741 \trimmarks
742 \unvbox\@cclv
743 }%
744 \fi
745 }%
746 \def\AtBegShi@Memoir@PatchAB{%
747 \ifvoid\AtBeginShipoutBox
748 \else
749 \setbox\AtBeginShipoutBox=\vbox{%
750 \trimmarks
751 \ifvbox\AtBeginShipoutBox
752 \unvbox\AtBeginShipoutBox
753 \else
754 \box\AtBeginShipoutBox
755 \fi
756 }%
757 \AtBegShi@GetBoxSize\AtBeginShipoutBox
758 \expandafter\mem@oldshipout
759 \expandafter\box
760 \expandafter\AtBeginShipoutBox
761 \fi
762 }%
763 \def\AtBegShi@Memoir@shipiiC{% 2008/08/07 v1.6180339a
764 \ifvoid\@cclv
765 \mem@oldshipout\box\@cclv
766 \else
767 \ifshowtrims
768 \mem@oldshipout\vbox{\trimmarks\unvbox\@cclv}%
769 \else
770 \mem@oldshipout\box\@cclv
771 \fi
772 \fi
773 }%
774 \def\AtBegShi@Memoir@shipiiD{% 2011/03/06 v3.6j
775 \ifvoid\@cclv
776 \mem@oldshipout\box\@cclv
777 \else
778 \ifshowtrims
779 \mem@oldshipout\vbox{%
780 \trimmarks
781 \nointerlineskip
782 \box\@cclv
783 }%
784 \else
785 \mem@oldshipout\box\@cclv
786 \fi
787 \fi
788 }%
789 \def\AtBegShi@Memoir@PatchCD{%
790 \ifvoid\AtBeginShipoutBox
791 \else
792 \ifshowtrims
793 \setbox\AtBeginShipoutBox=\vbox{%
794 \trimmarks
795 \nointerlineskip
796 \box\AtBeginShipoutBox
797 }%
798 \fi
799 \AtBegShi@GetBoxSize\AtBeginShipoutBox
800 \expandafter\mem@oldshipout
801 \expandafter\box
802 \expandafter\AtBeginShipoutBox
803 \fi
804 }%
805 \ifx\AtBegShi@Memoir@shipi\mem@shipi
806 \let\AtBegShi@found\ltx@one
807 \ifx\AtBegShi@Memoir@shipiiA\mem@shipii
808 \let\AtBegShi@found\ltx@zero
809 \global\let\AtBegShi@Memoir@PatchX\AtBegShi@Memoir@PatchAB
810 \else\ifx\AtBegShi@Memoir@shipiiB\mem@shipii
811 \let\AtBegShi@found\ltx@zero
812 \global\let\AtBegShi@Memoir@PatchX\AtBegShi@Memoir@PatchAB
813 \else\ifx\AtBegShi@Memoir@shipiiC\mem@shipii
814 \let\AtBegShi@found\ltx@zero
815 \global\let\AtBegShi@Memoir@PatchX\AtBegShi@Memoir@PatchCD
816 \else\ifx\AtBegShi@Memoir@shipiiD\mem@shipii
817 \let\AtBegShi@found\ltx@zero
818 \global\let\AtBegShi@Memoir@PatchX\AtBegShi@Memoir@PatchCD
819 \fi\fi\fi\fi
820 \ifcase\AtBegShi@found
821 \let\AtBegShi@found\relax
822 \ifx\shipout\AtBegShi@Memoir@shipout
823 \def\AtBegShi@found{\shipout}%
824 \else\ifx\AtBeginShipoutOriginalShipout\AtBegShi@Memoir@shipout
825 \def\AtBegShi@found{\AtBeginShipoutOriginalShipout}%
826 \else\ifx\CROP@shipout\AtBegShi@Memoir@shipout
827 \def\AtBegShi@found{\CROP@shipout}%
828 \else\ifx\GPTorg@shipout\AtBegShi@Memoir@shipout
829 \def\AtBegShi@found{\GPTorg@shipout}%
830 \else\ifx\THBorg@shipout\AtBegShi@Memoir@shipout
831 \def\AtBegShi@found{\THBorg@shipout}%
832 \else\ifx\@EveryShipout@Org@Shipout\AtBegShi@Memoir@shipout
833 \def\AtBegShi@found{\@EveryShipout@Org@Shipout}%
834 \fi\fi\fi\fi\fi\fi
835 \ifx\AtBegShi@found\relax
836 \else
837 \expandafter\endgroup
838 \expandafter\def\AtBegShi@found{%
839 \edef\AtBegShi@GroupLevel{\number\currentgrouplevel}%
840 \afterassignment\mem@shipi
841 \setbox\AtBeginShipoutBox=%
842 }%
843 \def\mem@shipi{%
844 \ifnum\AtBegShi@GroupLevel=\currentgrouplevel
845 \else
846 \expandafter\aftergroup
847 \fi
848 \mem@shipii
849 }%
850 \let\mem@shipii\AtBegShi@Memoir@PatchX
851 \@PackageInfoNoLine{atbegshi}{Class `memoir' patched}%
852 \begingroup
853 \fi
854 \fi
855 \fi
856 \endgroup
857 \let\AtBegShi@PatchMemoir\relax
858 }
859 \@ifclassloaded{memoir}{%
860 \AtBegShi@PatchMemoir
861 }{%
862 \AtBeginDocument{\AtBegShi@PatchMemoir}%
863 }
864 \AtBegShi@AtEnd%
865 %% \section{Installation}
866 \endinput
867 %%
868 %% End of file `atbegshi.sty'.