-
Notifications
You must be signed in to change notification settings - Fork 0
/
afterpage.sty
122 lines (121 loc) · 3.4 KB
/
afterpage.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
%%
%% This is file `afterpage.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% afterpage.dtx (with options: `package')
%%
%% This is a generated file.
%%
%% Copyright 1993 1994 1995 1996 1997 1998 1999
%% The LaTeX3 Project and any individual authors listed elsewhere
%% in this file.
%%
%% This file is part of the Standard LaTeX `Tools Bundle'.
%% -------------------------------------------------------
%%
%% This file, and all the other files in this bundle as listed below,
%% may be distributed under the terms of the LaTeX Project Public
%% License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
%%
%% File: afterpage.dtx Copyright (C) 1994 1994 1995 David Carlisle
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{afterpage}
[1995/10/27 v1.08 After-Page Package (DPC)]
\newtoks\AP@output
\global\AP@output\expandafter{\the\output}
\newbox\AP@partial
\newbox\AP@footins
\def\AP@savetop{%
\ifvmode
\let\AP@noindent\empty
\else\ifhmode
\setbox\z@\lastbox
\edef\AP@noindent
{{\everypar{}\ifvoid\z@\noindent\else\indent\fi}}%
\par
\else
\abovedisplayshortskip\z@\abovedisplayskip\z@
\belowdisplayshortskip\z@\belowdisplayskip\z@
\xdef\AP@disp{%
\predisplaysize\the\predisplaysize
\prevgraf\the\prevgraf\relax}%
$$\vskip-\baselineskip\vskip-\parskip
\edef\AP@noindent{%
\toks@{\the\everydisplay}\everydisplay{}%
{\everypar{}\noindent}$$\AP@disp\aftergroup\noexpand\AP@ed}%
\fi\fi
\begingroup
\nointerlineskip\null
\output{%
\global\setbox\AP@partial\vbox{%
\unvbox\@cclv
\global\setbox\@ne\lastbox}%
\global\setbox\AP@footins\box\footins}%
\eject
\endgroup}
\let\AP@\relax
\def\AP@ed{\everydisplay\expandafter{\the\toks@}\ignorespaces}
\def\AP@@{%
\AP@savetop
\global\expandafter\let\expandafter\AP@\expandafter\relax\AP@
\par
\addboxcontents\AP@partial
\ifvoid\AP@footins\else
\insert\footins{\unvbox\AP@footins}\fi
\AP@noindent}
\long\def\afterpage#1{%
\ifx\AP@\relax
\gdef\AP@{{#1\par}}%
\global\output{%
\the\AP@output
\ifnum\outputpenalty>-\@Mi
\global\output\expandafter{\the\AP@output}%
\aftergroup\AP@@
\fi}%
\else
\expandafter\gdef\expandafter\AP@\expandafter{\AP@{#1\par}}%
\fi}
\let\AP@clearpage\clearpage
\def\clearpage{%
\ifx\AP@\relax
\AP@clearpage
\else
\global\output\expandafter{\the\AP@output}%
\AP@clearpage
\global\expandafter\let\expandafter\AP@\expandafter\relax
\expandafter\expandafter\AP@
\fi}
\let\AP@enddocument\enddocument
\def\enddocument{%
\ifx\AP@\relax\else
\global\output\expandafter{\the\AP@output}%
\AP@clearpage
\global\expandafter\let\expandafter\AP@\expandafter\relax
\expandafter\expandafter\AP@
\fi
\AP@enddocument}
\def\addboxcontents#1{{%
\splittopskip\z@
\splitmaxdepth\maxdimen
\setbox#1\vbox{\break\unvbox#1}%
\setbox\z@\vsplit#1to\z@
\setbox#1\vbox{\break\unvbox#1}%
\skip@\ht#1%
\splittopskip\vsize
\setbox\z@\vsplit#1to\z@
\advance\skip@-\ht#1%
\skip\tw@\skip@
\advance\skip@\splittopskip
\advance\skip@\prevdepth
\advance\skip@-\baselineskip
\advance\skip\tw@\ifdim-\skip@<\lineskiplimit\lineskip\else-\skip@\fi
\vskip\skip\tw@
\global\dimen@i\dp#1%
\unvbox#1}%
\prevdepth\dimen@i}
\endinput
%%
%% End of file `afterpage.sty'.