neatroff.ms: include .co request
[neatroff_make.git] / tmac / tmac.keep
blob80d02139691e434ba465eb3bc282374b9371c1cd
1 .\" A package for managing floating objects
2 .\"
3 .\" The package provides the following macros:
4 .\"
5 .\" .keepbeg type
6 .\"   Starts a floating object.  The argument specifies its type:
7 .\"   'f' for simple floating objects, 't' for floating objects
8 .\"   that should be printed at page top, and 'd' for non-floating
9 .\"   objects.
10 .\"
11 .\" .keepend
12 .\"   Ends a floating object.
13 .\"
14 .\" .keepbop
15 .\"   This macro should be called at the beginning of each page,
16 .\"   after printing page header.
17 .\"
18 .\" .keepeof
19 .\"   This macro should be called when the document ends, to
20 .\"   output all queued floating objects.
21 .\"
22 .\" .keepbeg.rst
23 .\"   This macro is called by this package just before printing a
24 .\"    floating object.  It may be redefined if necessary.
25 .\"
26 .\" .keepend.rst
27 .\"   This macro is called by this package just after printing
28 .\"   a floating object.  It may be redefined if necessary.
29 .\"
30 .nr keepi 0             \" current queued object index
31 .nr keepn 0             \" the last queued object
32 .de keepbeg
33 .       br
34 .       nr keeptype 1
35 .       if 'd'\\$1' .nr keeptype 0
36 .       if 't'\\$1' .nr keeptype 2
37 .       da keepdiv
39 .de keepbeg.rst
40 .       in 0
42 .de keepend.rst
43 .       in 0
45 .de keepprint
46 .       if \\n[keepprint]=0 \{\
47 .               nr keepprint 1
48 .               ev keepenv
49 .               keepbeg.rst
50 .               nf
51 .               \\$1
52 .               ev
53 .               keepend.rst
54 .               nr keepprint 0
55 .               rm \\$1
56 .       \}
58 .de keepend
59 .       br
60 .       di
61 .       ie \\n[keeptype]=0 \{\
62 .               if \\n(.t<=\\n(dn .bp
63 .               keepprint keepdiv \}
64 .       el .ie (\\n[keeptype]=1)&(\\n[keepi]=\\n[keepn])&(\\n(.t>\\n(dn) \{\
65 .               keepprint keepdiv \}
66 .       el \{\
67 .               nr keep\\n[keepn].top \\n[keeptype]-1
68 .               nr keep\\n[keepn].len \\n(dn
69 .               rn keepdiv keep\\n[keepn].div
70 .               nr keepn +1
71 .       \}
73 .de keepbop
74 .       if (\\n[keepi]<\\n[keepn])&(\\n[keep\\n[keepi].len]<\\n(.t) \{\
75 .               keepprint keep\\n[keepi].div
76 .               nr keepi +1
77 .               if (\\n[keepi]<\\n[keepn])&(1-\\n[keep\\n[keepi].top]) .keepbop
78 .       \}
80 .de keepeof
81 .       keepbop
82 .       if \\n[keepi]<\\n[keepn] \{\
83 .               bp
84 .               keepeof
85 .       \}