blob: a22afe689731c3fbea8846021bdae1ec947f0c15 (
plain)
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
|
%% This is part of OpTeX project, see http://petr.olsak.net/optex
\_codedecl \nopagenumbers {Output routine <2019-05-21>}
\_output={\_begoutput \_optexoutput \_endoutput}
\_def \_begoutput{\_prepoffsets} %
\_def \_endoutput{}
\_def\_optexoutput{%
\_shipout\_vbox{%
\_istoksempty \_pgbackground
\_iffalse \_backgroundbox {\_the\_pgbackground}\_nointerlineskip \_fi
\_ensureblack{\_makeheadline}%
\_vbox to\_vsize {\_boxmaxdepth=\_maxdepth \_pagecontents}%
\_ensureblack{\_makefootline}}%
\_advancepageno
\_ifnum\_outputpenalty>-20000 \_else\_dosupereject\_fi
}
\_def \_ensureblack #1{#1} % will be re-defined by color macros
\_def \_pagedest {} % will be re-defined by macros for references
\_def \_prepoffsets {} % will be re-defined by margins macros
\_def \_backgroundbox #1{\_moveleft\_hoffset\_vbox to0pt{\_kern-\voffset #1\_vss}}
\_def\_makeheadline {\_istoksempty \_headline \_iffalse
\_vbox to0pt{\_vskip-\_headlinedist
\_line{\_copy\_strutbox \_the\_headline}\_vss}\_nointerlineskip
\_fi
}
\_def\_makefootline{\_istoksempty \_footline \_iffalse
\_baselineskip=\_footlinedist
\_lineskiplimit=-\maxdimen \_line{\_the\_footline}
\_fi
}
\_def\_pagecontents{\_pagedest % destination of the page
\_ifvoid\_topins \_else \_ensureblack{\_unvbox\_topins}\_fi
\_dimen0=\dp255 \_unvbox255 % open up \box255
\_ifvoid\_footins \_else % footnote info is present
\_vskip\_skip\_footins
\_ensureblack{\_footnoterule \_unvbox\_footins}\fi
\_ifraggedbottom \kern-\_dimen0 \_vfil \_fi
}
\_def \_footnoterule {\kern-3pt \hrule width 2truein \kern 2.6pt }
\_def\_pagebody{\_vbox to\_vsize{\_boxmaxdepth\_maxdepth \_pagecontents}}
% unused, but for backward compatibility
\_newdimen\_headlinedist \_headlinedist=22.5pt
\_newdimen\_footlinedist \_footlinedist=24pt
\_newtoks\_headline \_headline={}
\_newtoks\_footline \_footline={\_hss\_truetenrm \_folio \_hss}
\_newtoks\_pgbackground \_pgbackground={} % for page background
\_public
\headlinedist \footlinedist \pgbackground
\makeheadline \makefootline \pagebody \headline \footline ;
\_countdef\_pageno=0 \_pageno=1 % first page is number 1
\_def \_folio {\_ifnum\_pageno<0 \_romannumeral-\_pageno \_else \_number\_pageno \_fi}
\_def \_nopagenumbers {\_footline={}}
\_def \_advancepageno {%
\_ifnum\_pageno<0 \_global\_advance\_pageno by-1 \_else \_incr\_pageno \_fi
} % increase |pageno|
\_newifi\_ifraggedbottom
\_def \_raggedbottom {\_topskip=10pt plus60pt \_raggedbottomtrue}
\_def \_normalbottom {\_topskip=10pt \_raggedbottomfalse} % undoes \raggedbottom
\_public
\pageno \folio \nopagenumbers \advancepageno \raggedbottom \normalbottom ;
\_newinsert\_footins
\_def \_footnote #1{\_let\_osf=\_empty % parameter #2 (the text) is read later
\_ifhmode \_edef\_osf{\_spacefactor\_the\_spacefactor}\/\_fi
#1\_osf\_vfootnote{#1}}
\_def\_vfootnote#1{\_opfootnote{}{#1}}
\_def \_opfootnote #1#2{\_insert\_footins\_bgroup
\_interlinepenalty=\_interfootnotelinepenalty
\_splittopskip=\_ht\_strutbox % top baseline for broken footnotes
\_splitmaxdepth=\_dp\_strutbox \_floatingpenalty=20000
\_leftskip=0pt \_rightskip=0pt \_spaceskip=0pt \_xspaceskip=0pt \_relax
#1\_textindent{#2}\_footstrut
\_isnextchar \_bgroup {\_bgroup \_aftergroup\_vfootA \_let\_next=}{\_vfootB}%
}
\_def\_vfootA{\_strut\_egroup}
\_def\_vfootB #1{#1\_vfootA}
\_def \_footstrut {\_vbox to\_splittopskip{}}
\_skip\_footins=\_bigskipamount % space added when footnote is present
\_count\_footins=1000 % footnote magnification factor (1 to 1)
\_dimen\_footins=8in % maximum footnotes per page
\_public
\footins \footnote \vfootnote \footstrut ;
\_newinsert\_topins
\_newifi\_ifupage \_newifi\_ifumid
\_def \_topinsert {\_umidfalse \_upagefalse \_oins}
\_def \_midinsert {\_umidtrue \_oins}
\_def \_pageinsert {\_umidfalse \_upagetrue \_oins}
\_skip\_topins=\_zoskip % no space added when a topinsert is present
\_count\_topins=1000 % magnification factor (1 to 1)
\_dimen\_topins=\_maxdimen % no limit per page
\_def \_oins {\_par \_begingroup\_setbox0=\_vbox\_bgroup} % start a \_vbox
\_def \_endinsert {\_egroup % finish the \_vbox
\_ifumid \_dimen0=\_ht0 \_advance\_dimen0 by\_dp0 \_advance\_dimen0 by\_baselineskip
\_advance\_dimen0 by\_pagetotal \_advance\_dimen0 by-\_pageshrink
\_ifdim\_dimen0>\_pagegoal \_umidfalse \_pagefalse \_fi \_fi
\_ifumid \_bigskip \_box0 \_bigbreak
\_else \_insert \_topins {\_penalty100 % floating insertion
\_splittopskip=0pt
\_splitmaxdepth=\_maxdimen \_floatingpenalty=0
\_ifupage \_dimen0=\_dp0
\_vbox to\_vsize {\_unvbox0 \_kern-\_dimen0}% depth is zero
\_else \_box0 \_nobreak \_bigskip \_fi}\_fi\_endgroup}
\_public
\topins \topinsert \midinsert \pageinsert \endinsert ;
\_endcode % -------------------------------------
|