Adapt src/lib-roff (src/libs/libgroff)
[s-roff.git] / tmac / s.tmac
blob5357e52e4beb67b4dcba1264e6754224cd50b71e
1 .\" -*- nroff -*-
2 .ig
4 s.tmac
6 Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003, 2004, 2006, 2007
7   Free Software Foundation, Inc.
8      Written by James Clark (jjc@jclark.com)
10 This file is part of groff.
12 groff is free software; you can redistribute it and/or modify it under
13 the terms of the GNU General Public License as published by the Free
14 Software Foundation; either version 2, or (at your option) any later
15 version.
17 groff is distributed in the hope that it will be useful, but WITHOUT ANY
18 WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20 for more details.
22 You should have received a copy of the GNU General Public License along
23 with groff; see the file COPYING.  If not, write to the Free Software
24 Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
26 .if !\n(.g .ab These ms macros require groff.
27 .if \n(.C \
28 .       ab The groff ms macros do not work in compatibility mode.
29 .\" Enable warnings (only if none are given on the command line).
30 .\" You can delete this if you want.
31 .if (\n[.warn] == 65543) .warn
32 .\" See if already loaded.
33 .if r GS .nx
34 .mso devtag.tmac
35 .nr GS 1
36 .nr need_eo_h 0
37 .nr need_eo_tl 0
38 .de @error
39 .tm \\n(.F:\\n(.c: macro error: \\$*
41 .de @warning
42 .tm \\n(.F:\\n(.c: macro warning: \\$*
44 .de @fatal
45 .ab \\n(.F:\\n(.c: fatal macro error: \\$*
47 .de @not-implemented
48 .@error sorry, \\$0 not implemented
49 .als \\$0 @nop
51 .als TM @not-implemented
52 .als CT @not-implemented
53 .de @nop
55 .de @init
56 .if !rPO .nr PO \\n(.o
57 .\" a non-empty environment
58 .ev ne
60 .ev
61 .ev nf
62 'nf
63 .ev
65 .ds REFERENCES References
66 .ds ABSTRACT ABSTRACT
67 .ds TOC Table of Contents
68 .ds MONTH1 January
69 .ds MONTH2 February
70 .ds MONTH3 March
71 .ds MONTH4 April
72 .ds MONTH5 May
73 .ds MONTH6 June
74 .ds MONTH7 July
75 .ds MONTH8 August
76 .ds MONTH9 September
77 .ds MONTH10 October
78 .ds MONTH11 November
79 .ds MONTH12 December
80 .ds MO \E*[MONTH\n[mo]]
81 .ds DY \n[dy] \*[MO] \n[year]
82 .de ND
83 .if \\n[.$] .ds DY "\\$*
85 .de DA
86 .if \\n[.$] .ds DY "\\$*
87 .ds CF \\*[DY]
89 .\" indexing
90 .de IX
91 .tm \\$1\t\\$2\t\\$3\t\\$4 ... \\n[PN]
93 .\" print an error message and then try to recover
94 .de @error-recover
95 .@error \\$@ (recovering)
96 .nr *pop-count 0
97 .while !'\\n(.z'' \{\
98 .       \"@warning automatically terminating diversion \\n(.z
99 .       ie d @div-end!\\n(.z .@div-end!\\n(.z
100 .       el .*div-end-default
101 .       nr *pop-count +1
102 .       \" ensure that we don't loop forever
103 .       if \\n[*pop-count]>20 .@fatal recovery failed
105 .while !'\\n[.ev]'0' .ev
106 .par@reset-env
107 .par@reset
109 .de *div-end-default
110 .ds *last-div \\n(.z
113 .ev nf
114 .\\*[*last-div]
117 .\" ****************************
118 .\" ******** module cov ********
119 .\" ****************************
120 .\" Cover sheet and first page.
121 .de cov*err-not-after-first-page
122 .@error \\$0 is not allowed after the first page has started
124 .de cov*err-not-before-tl
125 .@error \\$0 is not allowed before TL
127 .de cov*err-not-again
128 .@error \\$0 is not allowed more than once
130 .de cov*err-not-after-ab
131 .@error \\$0 is not allowed after first AB, LP, PP, IP, SH or NH
133 .als AU cov*err-not-before-tl
134 .als AI cov*err-not-before-tl
135 .als AB cov*err-not-before-tl
136 .de cov*first-page-init
137 .\" Invoked by `.wh 0' trap on first page.
138 .\" We should not come here again, but at short page length,
139 .\" recursion may occur; remove trap and macro to avoid it.
140 .ch cov*first-page-init
141 .rm cov*first-page-init
142 .if !'\\n[.ev]'0' \{\
143 .       @error must be in top-level environment, not `\\n[.ev]',
144 .       @error when first page is started
146 .par@init
147 .als RP cov*err-not-after-first-page
148 .@init
149 .ie \\n[cov*rp-format] \{\
150 .       pg@cs-top
151 .       als FS cov*FS
152 .       als FE cov*FE
154 .el \{\
155 .       pg@top
156 .       als FS @FS
157 .       als FE @FE
159 .wh 0 pg@top
160 .CHECK-FOOTER-AND-KEEP
162 .wh 0 cov*first-page-init
163 .\" This handles the case where FS occurs before TL or LP.
164 .de FS
166 \\*[FS]\\
168 .nr cov*rp-format 0
169 .nr cov*rp-no 0
170 .\" released paper format
171 .de RP
172 .nr cov*rp-format 1
173 .if \\n[.$] .if '\\$1'no' .nr cov*rp-no 1
174 .if rPO .po \\n(POu
175 .pn 0
177 .de TL
179 .als TL cov*err-not-again
180 .rn @AB AB
181 .rn @AU AU
182 .rn @AI AI
183 .di cov*tl-div
184 .par@reset
185 .ft B
186 .ps +2
187 .vs +3p
188 .ll (u;\\n[LL]*5/6)
189 .nr cov*n-au 0
190 .DEVTAG-TL
192 .de @AU
193 .par@reset
194 .if !'\\n(.z'' \{\
195 .       br
196 .       di
198 .nr cov*n-au +1
199 .di cov*au-div!\\n[cov*n-au]
201 .ft I
202 .ie (\\n[PS] >= 1000) \
203 .       ps (\\n[PS]z / 1000u)
204 .el \
205 .       ps \\n[PS]
207 .de @AI
208 .par@reset
209 .if !'\\n(.z'' \{\
210 .       br
211 .       di
213 .ie !\\n[cov*n-au] .@error AI before AU
214 .el \{\
215 .       di cov*ai-div!\\n[cov*n-au]
216 .       nf
217 .       ft R
218 .       ie (\\n[PS] >= 1000) \
219 .               ps (\\n[PS]z / 1000u)
220 .       el \
221 .               ps \\n[PS]
225 .de LP
226 .if !'\\n[.z]'' \{\
227 .       br
228 .       di
231 .cov*ab-init
232 .cov*print
233 .nop \\*[\\$0]\\
236 .als IP LP
237 .als PP LP
238 .als XP LP
239 .als QP LP
240 .als RS LP
241 .als NH LP
242 .als SH LP
243 .als MC LP
244 .als RT LP
245 .als XS LP
247 .de cov*ab-init
248 .als cov*ab-init @nop
249 .als LP @LP
250 .als IP @IP
251 .als PP @PP
252 .als XP @XP
253 .als RT @RT
254 .als XS @XS
255 .als SH @SH
256 .als NH @NH
257 .als QP @QP
258 .als RS @RS
259 .als RE @RE
260 .als QS @QS
261 .als QE @QE
262 .als MC @MC
263 .als EQ @EQ
264 .als EN @EN
265 .als TS @TS
266 .als AB cov*err-not-after-ab
267 .als AU par@AU
268 .als AI par@AI
269 .als TL par@TL
272 .de @AB
273 .if !'\\n(.z'' \{\
274 .       br
275 .       di
277 .cov*ab-init
278 .ie '\*(.T'html' \{\
279 .       cov*tl-au-print
280 .       als cov*tl-au-print @nop
282 .el .di cov*ab-div
283 .par@ab-indent
284 .par@reset
285 .if !'\\$1'no' \{\
286 .       if '\*(.T'html'  \{\
287 .               nf
288 .               sp
289 .       \}
290 .       ft I
291 .       ce 1
292 \\*[ABSTRACT]
293 .       sp
294 .       ft R
297 .@PP
298 .if '\*(.T'html' \{\
299 .       cov*tl-au-print
300 .       als cov*tl-au-print @nop
301 .       par@reset-env
302 .       par@reset
303 .       cov*print
306 .de AE
307 .ie '\*(.T'html' \{\
308 .       als AE cov*err-not-again
310 .el \{\
311 .  ie '\\n(.z'cov*ab-div' \{\
312 .       als AE cov*err-not-again
313 .       br
314 .       di
315 .\"     nr cov*ab-height \\n[dn]
316 .       par@reset-env
317 .       par@reset
318 .       cov*print
319 .  \}
320 .  el .@error AE without AB
323 .de @div-end!cov*ab-div
326 .de cov*print
327 .als cov*print @nop
328 .ie d cov*tl-div \{\
329 .       ie \\n[cov*rp-format] .cov*rp-print
330 .       el .cov*draft-print
332 .el \{\
333 .       if \\n[cov*rp-format] \{\
334 .               @warning RP format but no TL
335 .               bp 1
336 .               als FS @FS
337 .               als FE @FE
338 .               CHECK-FOOTER-AND-KEEP
339 .       \}
340 .       br
343 .de cov*rp-print
344 .nr cov*page-length \\n[.p]
345 .pl 1000i
346 .cov*tl-au-print
347 .sp 3
348 .if d cov*ab-div \{\
349 .  if !'\*(.T'html'  .nf
350 .       cov*ab-div
352 .sp 3
353 .par@reset
354 \\*[DY]
356 .if \\n[cov*fn-height] \{\
357 .       sp |(u;\\n[cov*page-length]-\\n[FM]\
358 -\\n[cov*fn-height]-\\n[fn@sep-dist]>?\\n[nl])
359 .       fn@print-sep
360 .       ev nf
361 .       cov*fn-div
362 .       ev
363 .       ie \\n[cov*rp-no] .rm cov*fn-div
364 .       el \{\
365 .               rn cov*fn-div fn@overflow-div
366 .               nr fn@have-overflow 1
367 .       \}
369 .als FS @FS
370 .als FE @FE
371 .CHECK-FOOTER-AND-KEEP
372 .\" If anything was printed below where the footer line is normally printed,
373 .\" then that's an overflow.
374 .if -\\n[FM]/2+1v+\\n[cov*page-length]<\\n[nl] .@error cover sheet overflow
375 .pl \\n[cov*page-length]u
376 .bp 1
377 .if !\\n[cov*rp-no] .cov*tl-au-print
379 .sp 1
381 .de cov*draft-print
382 .cov*tl-au-print
383 .if d cov*ab-div \{\
384 .       nf
385 .       sp 2
386 .       cov*ab-div
388 .sp 1
390 .de cov*tl-au-print
391 .par@reset
394 .sp 3
395 .ce 9999
396 .if d cov*tl-div \{\
397 .    cov*tl-div
398 .    DEVTAG-EO-TL
400 .nr cov*i 1
401 .nr cov*sp 1v
402 .while \\n[cov*i]<=\\n[cov*n-au] \{\
403 .       ie '\*(.T'html' .br
404 .       el .sp \\n[cov*sp]u
405 .       cov*au-div!\\n[cov*i]
406 .       ie d cov*ai-div!\\n[cov*i] \{\
407 .               sp .5v  
408 .               cov*ai-div!\\n[cov*i]
409 .               nr cov*sp 1v
410 .       \}
411 .       el .nr cov*sp .5v
412 .       nr cov*i +1
414 .ce 0
416 .nr cov*fn-height 0
417 .nr cov*in-fn 0
418 .\" start of footnote on cover
419 .de cov*FS
420 .if \\n[cov*in-fn] \{\
421 .       @error nested FS
422 .       FE
424 .nr cov*in-fn 1
425 .ev fn
426 .par@reset-env
427 .da cov*fn-div
428 .if !\\n[cov*fn-height] .ns
429 .ie \\n[.$] .FP "\\$1" no
430 .el .@LP
432 .de @div-end!cov*fn-div
433 .cov*FE
435 .\" end of footnote on cover
436 .de cov*FE
437 .ie '\\n(.z'cov*fn-div' \{\
438 .       br
439 .       ev
440 .       di
441 .       nr cov*in-fn 0
442 .       nr cov*fn-height +\\n[dn]
444 .el .@error FE without matching FS
446 .\" ***************************
447 .\" ******** module pg ********
448 .\" ***************************
449 .\" Page-level formatting.
450 .\" > 0 if we have a footnote on the current page
451 .nr pg@fn-flag 0
452 .nr pg@colw 0
453 .nr pg@fn-colw 0
454 .nr HM 1i
455 .nr FM 1i
456 .ds LF
457 .ds CF
458 .ds RF
459 .ds LH
460 .ds CH -\En[PN]-
461 .ds RH
462 .ds pg*OH '\E*[LH]'\E*[CH]'\E*[RH]'
463 .ds pg*EH '\E*[LH]'\E*[CH]'\E*[RH]'
464 .ds pg*OF '\E*[LF]'\E*[CF]'\E*[RF]'
465 .ds pg*EF '\E*[LF]'\E*[CF]'\E*[RF]'
466 .de OH
467 .ds pg*\\$0 "\\$*
469 .als EH OH
470 .als OF OH
471 .als EF OH
472 .de PT
473 .ie \\n%=1 .if \\n[pg*P1] .tl \\*[pg*OH]
474 .el \{\
475 .       ie o .tl \\*[pg*OH]
476 .       el .tl \\*[pg*EH]
479 .de BT
480 .ie o .tl \\*[pg*OF]
481 .el .tl \\*[pg*EF]
483 .nr pg*P1 0
484 .de P1
485 .ie r bell_localisms \{\
486 .       DS L
487 .       ft CW
489 .el .nr pg*P1 1
491 .wh -\n[FM]u pg@bottom
492 .wh -\n[FM]u/2u pg*footer
493 .nr MINGW 2n
494 .nr pg@ncols 1
495 .de @MC
496 .if !'\\n(.z'' .error-recover MC while diversion open
498 .ie \\n[pg@ncols]>1 .pg@super-eject
499 .el \{\
500 .       \" flush out any floating keeps
501 .       while \\n[kp@tail]>\\n[kp@head] \{\
502 .               rs
503 .               bp
504 .       \}
506 .ie !\\n(.$ \{\
507 .       nr pg@colw \\n[LL]*7/15
508 .       nr pg*gutw \\n[LL]-(2*\\n[pg@colw])
509 .       nr pg@ncols 2
511 .el \{\
512 .       nr pg@colw (n;\\$1)<?\\n[LL]
513 .       ie \\n[.$]<2 .nr pg*gutw \\n[MINGW]
514 .       el .nr pg*gutw (n;\\$2)
515 .       nr pg@ncols \\n[LL]-\\n[pg@colw]/(\\n[pg@colw]+\\n[pg*gutw])+1
516 .       ie \\n[pg@ncols]>1 \
517 .               nr pg*gutw \\n[LL]-(\\n[pg@ncols]*\\n[pg@colw])/(\\n[pg@ncols]-1)
518 .       el .nr pg*gutw 0
520 .DEVTAG ".mc \\n[pg@ncols] \\n[pg@colw] \\n[pg*gutw]"
521 .mk pg*col-top
523 .nr pg*col-num 0
524 .nr pg@fn-colw \\n[pg@colw]*5/6
525 .par@reset
527 .de 2C
530 .de 1C
531 .MC \\n[LL]u
533 .\" top of page macro
534 .de pg@top
535 .ch pg*footer -\\n[FM]u/2u
536 .nr PN \\n%
537 .nr pg*col-num 0
538 .nr pg@fn-bottom-margin 0
539 .po \\n[PO]u
540 .ev h
541 .par@reset
542 .sp (u;\\n[HM]/2)
544 .sp |\\n[HM]u
545 .if d HD .HD
546 .mk pg@header-bottom
548 .mk pg*col-top
549 .pg*start-col
551 .de pg*start-col
552 .\" Handle footnote overflow before floating keeps, because the keep
553 .\" might contain an embedded footnote.
554 .fn@top-hook
555 .kp@top-hook
556 .tbl@top-hook
559 .de pg@cs-top
560 .sp \\n[HM]u
561 .\" move pg@bottom and pg*footer out of the way
562 .ch pg@bottom \\n[.p]u*2u
563 .ch pg*footer \\n[.p]u*2u
566 .de pg@bottom
567 .tbl@bottom-hook
568 .if \\n[pg@fn-flag] .fn@bottom-hook
569 .nr pg*col-num +1
570 .ie \\n[pg*col-num]<\\n[pg@ncols] .pg*end-col
571 .el .pg*end-page
573 .de pg*end-col
574 'sp |\\n[pg*col-top]u
575 .po (u;\\n[PO]+(\\n[pg@colw]+\\n[pg*gutw]*\\n[pg*col-num]))
576 .\"po +(u;\\n[pg@colw]+\\n[pg*gutw])
577 .pg*start-col
579 .de pg*end-page
580 .po \\n[PO]u
581 .\" Make sure we don't exit if there are still floats or footnotes left-over.
582 .ie \\n[kp@head]<\\n[kp@tail]:\\n[fn@have-overflow] \{\
583 .       \" Switching environments ensures that we don't get an unnecessary
584 .       \" blank line at the top of the page.
585 .       ev ne
586 '       bp
587 .       ev
589 .el \{\
590 .       \" If the text has ended and there are no more footnotes or keeps, exit.
591 .       if \\n[pg@text-ended] .ex
592 .       if r pg*next-number \{\
593 .               pn \\n[pg*next-number]
594 .               rr pg*next-number
595 .               if d pg*next-format \{\
596 .                       af PN \\*[pg*next-format]
597 .                       rm pg*next-format
598 .               \}
599 .       \}
600 '       bp
603 .\" pg@begin number format
604 .de pg@begin
605 .ie \\n[.$]>0 \{\
606 .       nr pg*next-number (;\\$1)
607 .       ie \\n[.$]>1 .ds pg*next-format \\$2
608 .       el .rm pg*next-format
610 .el .rr pg*next-number
611 .pg@super-eject
613 .\" print the footer line
614 .de pg*footer
615 .ev h
616 .par@reset
620 .\" flush out any keeps or footnotes
621 .de pg@super-eject
623 .if !'\\n(.z'' .@error-recover diversion open while ejecting page
624 .\" Make sure we stay in the end macro while there is still footnote overflow
625 .\" left, or floating keeps.
626 .while \\n[kp@tail]>\\n[kp@head]:\\n[pg@fn-flag] \{\
627 .       rs
628 .       bp
632 .nr pg@text-ended 0
633 .de pg@end-text
635 .nr pg@text-ended 1
636 .pg@super-eject
638 .em pg@end-text
639 .\" ***************************
640 .\" ******** module fn ********
641 .\" ***************************
642 .\" Footnotes.
643 .nr fn@sep-dist 8p
644 .ev fn
645 .\" Round it vertically
646 .vs \n[fn@sep-dist]u
647 .nr fn@sep-dist \n[.v]
649 .nr fn*text-num 0 1
650 .nr fn*note-num 0 1
651 .ds * \E*[par@sup-start]\En+[fn*text-num]\E*[par@sup-end]
652 .nr fn*open 0
653 .\" normal FS
654 .de @FS
655 .ie \\n[.$] .fn*do-FS "\\$1" no
656 .el \{\
657 .       ie \\n[fn*text-num]>\\n[fn*note-num] .fn*do-FS \\n+[fn*note-num]
658 .       el .fn*do-FS
661 .\" Second argument of `no' means don't embellish the first argument.
662 .de fn*do-FS
663 .if \\n[fn*open] .@error-recover nested FS
664 .nr fn*open 1
665 .if \\n[.u] \{\
666 .       \" Ensure that the first line of the footnote is on the same page
667 .       \" as the reference.  I think this is minimal.
668 .       ev fn
669 .       nr fn*need 1v
670 .       ev
671 .       ie \\n[pg@fn-flag] .nr fn*need +\\n[fn:PD]
672 .       el .nr fn*need +\\n[fn@sep-dist]
673 .       ne \\n[fn*need]u+\\n[.V]u>?0
675 .ev fn
676 .par@reset-env
677 .fn*start-div
678 .par@reset
679 .ie \\n[.$] .FP \\$@
680 .el .@LP
682 .de @FE
683 .ie !\\n[fn*open] .@error FE without FS
684 .el \{\
685 .       nr fn*open 0
686 .       br
687 .       ev
688 .       fn*end-div
691 .nr fn@have-overflow 0
692 .\" called at the top of each column
693 .de fn@top-hook
694 .nr fn*max-width 0
695 .nr fn*page-bottom-pos 0-\\n[FM]-\\n[pg@fn-bottom-margin]
696 .ch pg@bottom \\n[fn*page-bottom-pos]u
697 .if \\n[fn@have-overflow] \{\
698 .       nr fn@have-overflow 0
699 .       fn*start-div
700 .       ev nf
701 .       fn@overflow-div
702 .       ev
703 .       fn*end-div
706 .\" This is called at the bottom of the column if pg@fn-flag is set.
707 .de fn@bottom-hook
708 .nr pg@fn-flag 0
709 .nr fn@have-overflow 0
710 .nr fn@bottom-pos \\n[.p]-\\n[FM]-\\n[pg@fn-bottom-margin]+\\n[.v]
711 .ev fn
712 .nr fn@bottom-pos -\\n[.v]
714 .ie \\n[nl]+\\n[fn@sep-dist]+\n[.V]>\\n[fn@bottom-pos] \{\
715 .       rn fn@div fn@overflow-div
716 .       nr fn@have-overflow 1
718 .el \{\
719 .       if \\n[pg@ncols]>1 \
720 .               if \\n[fn*max-width]>\\n[pg@fn-colw] \
721 .                       nr pg@fn-bottom-margin \\n[.p]-\\n[FM]-\\n[nl]+1v
722 .       wh \\n[fn@bottom-pos]u fn*catch-overflow
723 .       fn@print-sep
724 .       ev nf
725 .       fn@div
726 .       rm fn@div
727 .       ev
728 .       if '\\n(.z'fn@overflow-div' \{\
729 .               di
730 .               nr fn@have-overflow \\n[dn]>0
731 .       \}
732 .       ch fn*catch-overflow
735 .de fn*catch-overflow
736 .di fn@overflow-div
738 .nr fn*embed-count 0
739 .de @div-end!fn@div
741 .if '\\n[.ev]'fn' .ev
742 .fn*end-div
743 .nr fn*open 0
745 .als @div-end!fn*embed-div @div-end!fn@div
746 .de fn*start-div
747 .ie '\\n(.z'' \{\
748 .       da fn@div
749 .       if !\\n[pg@fn-flag] .ns
751 .el .di fn*embed-div
753 .de fn*end-div
754 .ie '\\n(.z'fn@div' \{\
755 .       di
756 .       nr fn*page-bottom-pos -\\n[dn]
757 .       nr fn*max-width \\n[fn*max-width]>?\\n[dl]
758 .       if !\\n[pg@fn-flag] .nr fn*page-bottom-pos -\\n[fn@sep-dist]
759 .       nr pg@fn-flag 1
760 .       nr fn*page-bottom-pos \\n[nl]-\\n[.p]+\n[.V]>?\\n[fn*page-bottom-pos]
761 .       ch pg@bottom \\n[fn*page-bottom-pos]u
763 .el \{\
764 .       ie '\\n(.z'fn*embed-div' \{\
765 .       di
766 .               rn fn*embed-div fn*embed-div!\\n[fn*embed-count]
767 \!.             fn*embed-start \\n[fn*embed-count]
768 .               rs
769 '               sp (u;\\n[dn]+\\n[fn@sep-dist]+\\n[.V])
770 \!.             fn*embed-end
771 .               nr fn*embed-count +1
772 .       \}
773 .       el \{\
774 .               ev fn
775 .               @error-recover unclosed diversion within footnote
776 .       \}
779 .de fn*embed-start
780 .ie '\\n(.z'' \{\
781 .       fn*start-div
782 .       ev nf
783 .       fn*embed-div!\\$1
784 .       rm fn*embed-div!\\$1
785 .       ev
786 .       fn*end-div
787 .       di fn*null
789 .el \{\
790 \!.     fn*embed-start \\$1
791 .       rs
794 .de fn*embed-end
795 .ie '\\n(.z'fn*null' \{\
796 .       di
797 .       rm fn*null
799 .el \!.fn*embed-end
801 .\" It's important that fn@print-sep use up exactly fn@sep-dist vertical space.
802 .de fn@print-sep
803 .ev fn
804 .in 0
805 .vs \\n[fn@sep-dist]u
806 \D'l 1i 0'
810 .\" ***************************
811 .\" ******** module kp ********
812 .\" ***************************
813 .\" Keeps.
814 .de KS
816 .di kp*div
818 .de KF
819 .if !'\\n(.z'' .@error-recover KF while open diversion
820 .di kp*fdiv
821 .ev k
822 .par@reset-env
823 .par@reset
825 .de KE
826 .ie '\\n(.z'kp*div' .kp*end
827 .el \{\
828 .       ie '\\n(.z'kp*fdiv' .kp*fend
829 .       el .@error KE without KS or KF
832 .de @div-end!kp*div
833 .kp*end
835 .de @div-end!kp*fdiv
836 .kp*fend
838 .de kp*need
839 .ie '\\n(.z'' .ds@need \\$1
840 .el \!.kp*need \\$1
842 .\" end non-floating keep
843 .de kp*end
846 .kp*need \\n[dn]
847 .ev nf
848 .kp*div
850 .rm kp*div
852 .\" Floating keeps.
853 .nr kp@head 0
854 .nr kp@tail 0
855 .\" end floating keep
856 .de kp*fend
860 .ie \\n[.t]-(\\n[.k]>0*1v)>\\n[dn] \{\
861 .       br
862 .       ev nf
863 .       kp*fdiv
864 .       rm kp*fdiv
865 .       ev
867 .el \{\
868 .       rn kp*fdiv kp*div!\\n[kp@tail]
869 .       nr kp*ht!\\n[kp@tail] 0\\n[dn]
870 .       nr kp@tail +1
873 .\" top of page processing for KF
874 .nr kp*doing-top 0
875 .de kp@top-hook
876 .if !\\n[kp*doing-top] \{\
877 .       nr kp*doing-top 1
878 .       kp*do-top
879 .       nr kp*doing-top 0
882 .de kp*do-top
883 .\" If the first keep won't fit, only force it out if we haven't had a footnote
884 .\" and we're at the top of the page.
885 .nr kp*force \\n[pg@fn-flag]=0&(\\n[nl]<=\\n[pg@header-bottom])
886 .nr kp*fits 1
887 .while \\n[kp@tail]>\\n[kp@head]&\\n[kp*fits] \{\
888 .       ie \\n[.t]>\\n[kp*ht!\\n[kp@head]]:\\n[kp*force] \{\
889 .               nr kp*force 0
890 .               \" It's important to advance kp@head before bringing
891 .               \" back the keep, so that if the last line of the
892 .               \" last keep springs the bottom of page trap, a new
893 .               \" page will not be started unnecessarily.
894 .               rn kp*div!\\n[kp@head] kp*temp
895 .               nr kp@head +1
896 .               ev nf
897 .               kp*temp
898 .               ev
899 .               rm kp*temp
900 .       \}
901 .       el .nr kp*fits 0
904 .\" ***************************
905 .\" ******** module ds ********
906 .\" ***************************
907 .\" Displays and non-floating keeps.
908 .de DE
909 .ds*end!\\n[\\n[.ev]:ds-type]
910 .nr \\n[.ev]:ds-type 0
912 .de ds@auto-end
913 .if \\n[\\n[.ev]:ds-type] \{\
914 .       @error automatically terminating display
915 .       DE
918 .de @div-end!ds*div
919 .ie \\n[\\n[.ev]:ds-type] .DE
920 .el .ds*end!2
922 .de ds*end!0
923 .@error DE without DS, ID, CD, LD or BD
925 .de LD
927 .nr \\n[.ev]:ds-type 1
928 .par@reset
930 .sp \\n[DD]u
932 .de ID
934 .ie \\n[.$] .in +(n;\\$1)
935 .el .in +\\n[DI]u
937 .de CD
939 .ce 9999
941 .de RD
943 .rj 9999
945 .de ds*common-end
946 .par@reset
947 .sp \\n[DD]u
949 .als ds*end!1 ds*common-end
950 .de BD
952 .nr \\n[.ev]:ds-type 2
953 .di ds*div
955 .de ds*end!2
957 .ie '\\n(.z'ds*div' \{\
958 .       di
959 .       nf
960 .       in (u;\\n[.l]-\\n[dl]/2>?0)
961 .       ds*div
962 .       rm ds*div
963 .       ds*common-end
965 .el .@error-recover mismatched DE
967 .de DS
969 .di ds*div
970 .ie '\\$1'B' \{\
971 .       LD
972 .       nr \\n[.ev]:ds-type 4
974 .el \{\
975 .       ie '\\$1'L' .LD
976 .       el \{\
977 .               ie '\\$1'C' .CD
978 .               el \{\
979 .                       ie '\\$1'R' .RD
980 .                       el \{\
981 .                               ie '\\$1'I' .ID \\$2
982 .                               el .ID \\$1
983 .                       \}
984 .               \}
985 .       \}
986 .       nr \\n[.ev]:ds-type 3
989 .de ds@need
990 .if '\\n(.z'' \{\
991 .       while \\n[.t]<=(\\$1)&(\\n[nl]>\\n[pg@header-bottom]) \{\
992 .               rs
993 '               sp \\n[.t]u
994 .       \}
997 .de ds*end!3
999 .ie '\\n(.z'ds*div' \{\
1000 .       di
1001 .       ds@need \\n[dn]
1002 .       ev nf
1003 .       ds*div
1004 .       ev
1005 .       rm ds*div
1006 .       ds*common-end
1008 .el .@error-recover mismatched DE
1010 .de ds*end!4
1011 .ie '\\n(.z'ds*div' \{\
1012 .       br
1013 .       di
1014 .       nf
1015 .       in (u;\\n[.l]-\\n[dl]/2>?0)
1016 .       ds@need \\n[dn]
1017 .       ds*div
1018 .       rm ds*div
1019 .       ds*common-end
1021 .el .@error-recover mismatched DE
1023 .\" ****************************
1024 .\" ******** module par ********
1025 .\" ****************************
1026 .\" Paragraph-level formatting.
1027 .\" Load time initialization.
1028 .de par@load-init
1029 .\" PS and VS might have been set on the command-line
1030 .if !rPS .nr PS 10
1031 .if !rLL .nr LL 6i
1032 .ll \\n[LL]u
1033 .\" don't set LT so that it can be defaulted from LL
1034 .ie rLT .lt \\n[LT]u
1035 .el .lt \\n[LL]u
1036 .ie (\\n[PS] >= 1000) \
1037 .       ps (\\n[PS]z / 1000u)
1038 .el \
1039 .       ps \\n[PS]
1040 .\" don't set VS so that it can be defaulted from PS
1041 .ie rVS \{\
1042 .       ie (\\n[VS] >= 1000) \
1043 .               par*vs "(\\n[VS]p / 1000u)"
1044 .       el \
1045 .               par*vs \\n[VS]
1047 .el \{\
1048 .       ie (\\n[PS] >= 1000) \
1049 .               par*vs "((\\n[PS]p / 1000u) + 2p)"
1050 .       el \
1051 .               par*vs "(\\n[PS] + 2)"
1053 .if dFAM .fam \\*[FAM]
1054 .if !rHY .nr HY 14
1055 .hy \\n[HY]
1057 .CHECK-FOOTER-AND-KEEP
1059 .de par*vs
1060 .\" If it's too big to be in points, treat it as units.
1061 .ie (p;\\$1)>=40p .vs (u;\\$1)
1062 .el .vs (p;\\$1)
1064 .de par@ab-indent
1065 .nr 0:li (u;\\n[LL]/12)
1066 .nr 0:ri \\n[0:li]
1068 .de par*env-init
1069 .aln \\n[.ev]:PS PS
1070 .aln \\n[.ev]:VS VS
1071 .aln \\n[.ev]:LL LL
1072 .aln \\n[.ev]:MCLL LL
1073 .aln \\n[.ev]:LT LT
1074 .aln \\n[.ev]:MCLT LT
1075 .aln \\n[.ev]:PI PI
1076 .aln \\n[.ev]:PD PD
1077 .ad \\n[par*adj]
1078 .par@reset-env
1080 .\" happens when the first page begins
1081 .de par@init
1082 .if !rLT .nr LT \\n[LL]
1083 .if !rFL .nr FL \\n[LL]*5/6
1084 .if !rVS \{\
1085 .       ie (\\n[PS] >= 1000) \
1086 .               nr VS (\\n[PS] + 2000)
1087 .       el \
1088 .               nr VS (\\n[PS] + 2)
1090 .if !rDI .nr DI .5i
1091 .if !rFPS \{\
1092 .       ie (\\n[PS] >= 1000) \
1093 .               nr FPS (\\n[PS] - 2000)
1094 .       el \
1095 .               nr FPS (\\n[PS] - 2)
1097 .if !rFVS \{\
1098 .       ie (\\n[FPS] >= 1000) \
1099 .               nr FVS (\\n[FPS] + 2000)
1100 .       el \
1101 .               nr FVS (\\n[FPS] + 2)
1103 .\" don't change environment 0
1104 .ev h
1105 .ie (\\n[PS] >= 1000) \
1106 .       ps (\\n[PS]z / 1000u)
1107 .el \
1108 .       ps \\n[PS]
1109 .if !rQI .nr QI 5n
1110 .if !rPI .nr PI 5n
1111 .ie (\\n[VS] >= 1000) \
1112 .       par*vs "(\\n[VS]p / 1000u)"
1113 .el \
1114 .       par*vs \\n[VS]
1115 .if !rPD .nr PD .3v>?\n(.V
1116 .if !rDD .nr DD .5v>?\n(.V
1117 .if !rFI .nr FI 2n
1118 .if !rFPD .nr FPD \\n[PD]/2
1120 .if !dFAM .ds FAM \\n[.fam]
1121 .nr par*adj \\n[.j]
1122 .par*env-init
1123 .ev h
1124 .par*env-init
1126 .ev fn
1127 .par*env-init
1129 .ev k
1130 .par*env-init
1132 .aln 0:MCLL pg@colw
1133 .aln 0:MCLT pg@colw
1134 .aln k:MCLL pg@colw
1135 .aln k:MCLT pg@colw
1136 .aln fn:PS FPS
1137 .aln fn:VS FVS
1138 .aln fn:LL FL
1139 .aln fn:LT FL
1140 .aln fn:PI FI
1141 .aln fn:PD FPD
1142 .aln fn:MCLL pg@fn-colw
1143 .aln fn:MCLT pg@fn-colw
1145 .de par@reset-env
1146 .nr \\n[.ev]:il 0
1147 .nr \\n[.ev]:li 0
1148 .nr \\n[.ev]:ri 0
1149 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1150 .nr \\n[.ev]:pli 0
1151 .nr \\n[.ev]:pri 0
1152 .nr \\n[.ev]:ds-type 0
1154 .\" par@reset
1155 .de par@reset
1157 .if \\n[need_eo_tl]>0 .DEVTAG-EO-TL
1158 .nr need_eo_tl 0
1159 .if \\n[need_eo_h]>0 .DEVTAG-EO-H
1160 .nr need_eo_h 0
1161 .ce 0
1162 .rj 0
1163 .ul 0
1165 .ie \\n[pg@ncols]>1 \{\
1166 .       ll (u;\\n[\\n[.ev]:MCLL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1167 .       lt \\n[\\n[.ev]:MCLT]u
1169 .el \{\
1170 .       ll (u;\\n[\\n[.ev]:LL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1171 .       lt \\n[\\n[.ev]:LT]u
1173 .in (u;\\n[\\n[.ev]:li]+\\n[\\n[.ev]:pli])
1174 .ft 1
1175 .fam \\*[FAM]
1176 .ie (\\n[\\n[.ev]:PS] >= 1000) \
1177 .       ps (\\n[\\n[.ev]:PS]z / 1000u)
1178 .el \
1179 .       ps \\n[\\n[.ev]:PS]
1180 .ie (\\n[\\n[.ev]:VS] >= 1000) \
1181 .       par*vs "(\\n[\\n[.ev]:VS]p / 1000u)"
1182 .el \
1183 .       par*vs \\n[\\n[.ev]:VS]
1184 .ls 1
1186 .hy \\n[HY]
1188 .de @RT
1189 .nr \\n[.ev]:pli 0
1190 .nr \\n[.ev]:pri 0
1191 .par@reset
1193 .\" This can be redefined by the user.
1194 .de TA
1195 .ta T 5n
1197 .\" \n[PORPHANS] sets number of initial lines of any paragraph,
1198 .\" which must be kept together, without any included page break.
1199 .\" Initialise to reproduce original behaviour; user may adjust it.
1200 .if !rPORPHANS .nr PORPHANS 1
1202 .de par*start
1203 .ds@auto-end
1204 .nr \\n[.ev]:pli \\$1
1205 .nr \\n[.ev]:pri \\$2
1206 .par@reset
1207 .sp \\n[\\n[.ev]:PD]u
1208 .ne \\n[PORPHANS]v+\\n(.Vu
1210 .de par@finish
1211 .nr \\n[.ev]:pli 0
1212 .nr \\n[.ev]:pri 0
1213 .par@reset
1215 .\" normal LP
1216 .de @LP
1217 .par*start 0 0
1218 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1220 .de @PP
1221 .par*start 0 0
1222 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1223 .if !'\*(.T'html' .ti +\\n[\\n[.ev]:ai]u
1225 .de @QP
1226 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1227 .par*start \\n[QI] \\n[QI]
1229 .de @XP
1230 .par*start \\n[\\n[.ev]:PI] 0
1231 .ti -\\n[\\n[.ev]:PI]u
1233 .de @IP
1234 .if \\n[.$]>1 .nr \\n[.ev]:ai (n;\\$2)
1235 .par*start \\n[\\n[.ev]:ai] 0
1236 .if !'\\$1'' \{\
1237 .       \" Divert the label so as to freeze any spaces.
1238 .       di par*label
1239 .       par*push-tag-env
1240 \&\\$1
1241 .       par*pop-tag-env
1242 .       di
1243 .       chop par*label
1244 .       ti -\\n[\\n[.ev]:ai]u
1245 .       ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \{\
1246 .               DEVTAG-COL 1
1247 \\*[par*label]\h'|\\n[\\n[.ev]:ai]u'\c
1248 .               DEVTAG-COL 2
1249 .       \}
1250 .       el \{\
1251 .               DEVTAG-COL 1
1252 \\*[par*label]
1253 .               DEVTAG-COL-NEXT 2
1254 .               br
1255 .       \}
1256 .       rm par*label
1259 .\" We don't want margin characters to be attached when we divert
1260 .\" the tag.  Since there's no way to save and restore the current
1261 .\" margin character, we have to switch to a new environment, taking
1262 .\" what we need of the old environment with us.
1263 .de par*push-tag-env
1264 .nr par*saved-font \\n[.f]
1265 .nr par*saved-size \\n[.s]z
1266 .nr par*saved-ss \\n[.ss]
1267 .ds par*saved-fam \\n[.fam]
1268 .ev par
1271 .ft \\n[par*saved-font]
1272 .ps \\n[par*saved-size]u
1273 .ss \\n[par*saved-ss]
1274 .fam \\*[par*saved-fam]
1276 .de par*pop-tag-env
1279 .de @RS
1281 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1282 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1283 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1284 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1285 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1286 .nr \\n[.ev]:il +1
1287 .nr \\n[.ev]:li +\\n[\\n[.ev]:ai]
1288 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1289 .par@reset
1291 .de @RE
1293 .ie \\n[\\n[.ev]:il] \{\
1294 .       nr \\n[.ev]:il -1
1295 .       nr \\n[.ev]:ai \\n[\\n[.ev]:ai!\\n[\\n[.ev]:il]]
1296 .       nr \\n[.ev]:li \\n[\\n[.ev]:li!\\n[\\n[.ev]:il]]
1297 .       nr \\n[.ev]:ri \\n[\\n[.ev]:ri!\\n[\\n[.ev]:il]]
1298 .       nr \\n[.ev]:pli \\n[\\n[.ev]:pli!\\n[\\n[.ev]:il]]
1299 .       nr \\n[.ev]:pri \\n[\\n[.ev]:pri!\\n[\\n[.ev]:il]]
1301 .el .@error unbalanced \\$0
1302 .par@reset
1304 .de @QS
1306 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1307 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1308 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1309 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1310 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1311 .nr \\n[.ev]:il +1
1312 .nr \\n[.ev]:li +\\n[QI]
1313 .nr \\n[.ev]:ri +\\n[QI]
1314 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1315 .par@reset
1317 .als @QE @RE
1318 .\" start boxed text
1319 .de B1
1321 .HTML-IMAGE
1322 .di par*box-div
1323 .nr \\n[.ev]:li +1n
1324 .nr \\n[.ev]:ri +1n
1325 .nr par*box-in \\n[.in]
1326 .\" remember what 1n is, just in case the point size changes
1327 .nr par*box-n 1n
1328 .in +1n
1329 .ll -1n
1330 .lt -1n
1331 .ti \\n[par*box-in]u+1n
1333 .de @div-end!par*box-div
1336 .\" end boxed text
1337 .\" Postpone the drawing of the box until we're in the top-level diversion,
1338 .\" in case there's a footnote inside the box.
1339 .de B2
1340 .ie '\\n(.z'par*box-div' \{\
1341 .       br
1342 .       if \n[.V]>.25m .sp
1343 .       di
1344 .       if \n[.V]>.25m .sp
1345 .       ds@need \\n[dn]
1346 .       par*box-mark-top
1347 .       ev nf
1348 .       par*box-div
1349 .       ev
1350 .       nr \\n[.ev]:ri -\\n[par*box-n]
1351 .       nr \\n[.ev]:li -\\n[par*box-n]
1352 .       in -\\n[par*box-n]u
1353 .       ll +\\n[par*box-n]u
1354 .       lt +\\n[par*box-n]u
1355 .       par*box-draw \\n[.i]u \\n[.l]u-(\\n[.H]u==1n*1n)
1357 .el .@error B2 without B1
1358 .HTML-IMAGE-END
1360 .de par*box-mark-top
1361 .ie '\\n[.z]'' \{\
1362 .       rs
1363 .       mk par*box-top
1365 .el \!.par*box-mark-top
1367 .de par*box-draw
1368 .ie '\\n[.z]'' \{\
1369 .       nr par*box-in \\n[.i]
1370 .       nr par*box-ll \\n[.l]
1371 .       nr par*box-vpt \\n[.vpt]
1372 .       nr par*box-ad \\n[.j]
1373 .       ad l
1374 .       vpt 0
1375 .       in \\$1
1376 .       ll \\$2
1377 \v'-1v+.25m'\
1378 \D'l (u;\\n[.l]-\\n[.i]) 0'\
1379 \D'l 0 |\\n[par*box-top]u'\
1380 \D'l -(u;\\n[.l]-\\n[.i]) 0'\
1381 \D'l 0 -|\\n[par*box-top]u'
1382 .       br
1383 .       sp -1
1384 .       in \\n[par*box-in]u
1385 .       ll \\n[par*box-ll]u
1386 .       vpt \\n[par*box-vpt]
1387 .       ad \\n[par*box-ad]
1389 .el \!.par*box-draw \\$1 \\$2
1391 .\" \n[HORPHANS] sets how many lines of the following paragraph must be
1392 .\" kept together, with a preceding section header.  Initialise it,
1393 .\" to reproduce original behaviour; user may change it.
1394 .if !rHORPHANS .nr HORPHANS 1
1396 .\" \n[GROWPS] and \n[PSINCR] cause auto-increment of header point size.
1397 .\" Initialise them, so they have no effect, unless explicitly set by the user.
1398 .if !rGROWPS .nr GROWPS 0
1399 .if !rPSINCR .nr PSINCR 1p
1401 .de SH-NO-TAG
1402 .par@finish
1403 .\" Keep the heading and the first few lines of the next paragraph together.
1404 .\" (\n[HORPHANS] defines "first few" -- default = 1; user may redefine it).
1405 .nr sh*minvs \\n[HORPHANS]v
1406 .if \\n[sh*psincr]<0 .nr sh*psincr 0
1407 .ie \\n(VS<1000 .par*vs \\n(VSp+\\n[sh*psincr]u
1408 .el .par*vs \\n(VSp/1000u+\\n[sh*psincr]u
1409 .ne 2v+\\n[sh*minvs]u+\\n[\\n[.ev]:PD]u+\\n(.Vu
1410 .\" Adjust point size for heading text, as specified by \n[GROWPS] and \n[PSINCR].
1411 .ie \\n(PS<1000 .ps \\n(PS+\\n[sh*psincr]u
1412 .el .ps \\n(PSz/1000u+\\n[sh*psincr]u
1413 .sp 1
1414 .ft B
1416 .de @SH
1417 .\" Standard ms implementation does not expect an argument,
1418 .\" but allow ".SH n" to make heading point size match ".NH n",
1419 .\" for same "n", when \n[GROWPS] and \n[PSINCR] are set.
1420 .  nr sh*psincr 0
1421 .  if 0\\$1>0 .nr sh*psincr (\\n[GROWPS]-0\\$1)*\\n[PSINCR]
1422 .  SH-NO-TAG
1423 .  DEVTAG-SH 1
1424 .  if '\*(.T'html' .nr need_eo_h 1
1426 .\" TL, AU, and AI are aliased to these in cov*ab-init.
1427 .de par@TL
1428 .par@finish
1429 .sp 1
1430 .ft B
1431 .ps +2
1432 .vs +3p
1433 .ce 9999
1434 .DEVTAG-TL
1435 .nr need_eo_tl 1
1437 .de par@AU
1438 .par@finish
1439 .sp 1
1440 .ft I
1441 .ce 9999
1443 .de par@AI
1444 .par@finish
1445 .sp .5
1446 .ce 9999
1448 .\" In paragraph macros.
1449 .de NL
1450 .ie (\\n[\\n[.ev]:PS] >= 1000) \
1451 .       ps (\\n[\\n[.ev]:PS]z / 1000u)
1452 .el \
1453 .       ps \\n[\\n[.ev]:PS]
1455 .de SM
1456 .ps -2
1458 .de LG
1459 .ps +2
1461 .de R
1462 .ft R
1464 .\" par*define-font-macro macro font
1465 .de par*define-font-macro
1466 .de \\$1
1467 .ie \En[.$] \{\
1468 .       nr par*prev-font \En[.f]
1469 \&\E$3\f[\\$2]\E$1\f[\En[par*prev-font]]\E$2
1471 .el .ft \\$2
1472 \\..
1474 .par*define-font-macro B B
1475 .par*define-font-macro I I
1476 .par*define-font-macro BI BI
1477 .par*define-font-macro CW CR
1478 .\" underline a word
1479 .de UL
1480 \Z'\\$1'\v'.25m'\D'l \w'\\$1'u 0'\v'-.25m'\\$2
1482 .\" box a word
1483 .de BX
1484 .nr par*bxw \w'\\$1'+.4m
1485 \Z'\v'.25m'\D'l 0 -1m'\D'l \\n[par*bxw]u 0'\D'l 0 1m'\D'l -\\n[par*bxw]u 0''\
1486 \Z'\h'.2m'\\$1'\
1487 \h'\\n[par*bxw]u'
1489 .\" The first time UX is used, put a registered mark after it.
1490 .ds par*ux-rg \(rg
1491 .de UX
1492 \s[\\n[.s]*8u/10u]UNIX\s0\\$1\\*[par*ux-rg]
1493 .ds par*ux-rg
1495 .ds par@sup-start \v'-.9m\s'\En[.s]*7u/10u'+.7m'
1496 .als { par@sup-start
1497 .ds par@sup-end \v'-.7m\s0+.9m'
1498 .als } par@sup-end
1499 .\" footnote paragraphs
1500 .\" FF is the footnote format
1501 .nr FF 0
1502 .\" This can be redefined. It gets a second argument of `no' if the first
1503 .\" argument was supplied by the user, rather than automatically.
1504 .de FP
1506 .if !d par*fp!\\n[FF] \{\
1507 .       @error unknown footnote format `\\n[FF]'
1508 .       nr FF 0
1510 .ie '\\$2'no' .par*fp!\\n[FF]-no "\\$1"
1511 .el .par*fp!\\n[FF] "\\$1"
1513 .de par*fp!0
1514 .@PP
1515 \&\\*[par@sup-start]\\$1\\*[par@sup-end]\ \c
1517 .de par*fp!0-no
1518 .@PP
1519 \&\\$1\ \c
1521 .de par*fp!1
1522 .@PP
1523 \&\\$1.\ \c
1525 .de par*fp!1-no
1526 .@PP
1527 \&\\$1\ \c
1529 .de par*fp!2
1530 .@LP
1531 \&\\$1.\ \c
1533 .de par*fp!2-no
1534 .@LP
1535 \&\\$1\ \c
1537 .de par*fp!3
1538 .@IP "\\$1." (u;\\n[\\n[.ev]:PI]*2)
1540 .de par*fp!3-no
1541 .@IP "\\$1" (u;\\n[\\n[.ev]:PI]*2)
1543 .\" ***************************
1544 .\" ******** module nh ********
1545 .\" ***************************
1546 .\" Numbered headings.
1547 .\" nh*hl is the level of the last heading
1548 .nr nh*hl 0
1549 .\" SN-DOT and SN-NO-DOT represent the section number of
1550 .\" the current heading, with and without a terminating dot.
1551 .ds SN-DOT
1552 .ds SN-NO-DOT
1553 .\" SN-STYLE sets the statement numbering style used in headings
1554 .\" (either SN-DOT or SN-NO-DOT); for backward compatibility with
1555 .\" earlier ms versions, the default is SN-DOT
1556 .als SN-STYLE SN-DOT
1557 .\" Also for backward compatibility, let SN represent SN-DOT.
1558 .als SN SN-DOT
1559 .\" numbered heading
1560 .de @NH
1561 .ie '\\$1'S' \{\
1562 .       shift
1563 .       nr nh*hl 0
1564 .       while \\n[.$] \{\
1565 .               nr nh*hl +1
1566 .               nr H\\n[nh*hl] 0\\$1
1567 .               shift
1568 .       \}
1569 .       if !\\n[nh*hl] \{\
1570 .               nr H1 1
1571 .               nr nh*hl 1
1572 .               @error missing arguments to .NH S
1573 .       \}
1575 .el \{\
1576 .       nr nh*ohl \\n[nh*hl]
1577 .       ie \\n[.$] \{\
1578 .               nr nh*hl 0\\$1
1579 .               ie \\n[nh*hl]<=0 \{\
1580 .                       nr nh*ohl 0
1581 .                       nr nh*hl 1
1582 .               \}
1583 .               el \{\
1584 .                       if \\n[nh*hl]-\\n[nh*ohl]>1 \
1585 .                               @warning .NH \\n[nh*ohl] followed by .NH \\n[nh*hl]
1586 .               \}
1587 .       \}
1588 .       el .nr nh*hl 1
1589 .       while \\n[nh*hl]>\\n[nh*ohl] \{\
1590 .               nr nh*ohl +1
1591 .               nr H\\n[nh*ohl] 0
1592 .       \}
1593 .       nr H\\n[nh*hl] +1
1595 .ds SN-NO-DOT \\n(H1
1596 .nr nh*i 1
1597 .while \\n[nh*i]<\\n[nh*hl] \{\
1598 .       nr nh*i +1
1599 .       as SN-NO-DOT .\\n[H\\n[nh*i]]
1601 .ds SN-DOT \\*[SN-NO-DOT].
1602 .nr sh*psincr (\\n[GROWPS]-\\n[nh*hl])*\\n[PSINCR]
1603 .SH-NO-TAG
1604 .DEVTAG-NH "\\$1"
1605 .  if '\*(.T'html' .nr need_eo_h 1
1606 \\*[SN-STYLE]
1608 .\" ****************************
1609 .\" ******** module toc ********
1610 .\" ****************************
1611 .\" Table of contents generation.
1612 .de @XS
1613 .da toc*div
1614 .ev h
1615 .ie \\n[.$] .XA "\\$1"
1616 .el .XA
1618 .de @div-end!toc*div
1621 .de XA
1622 .ie '\\n(.z'toc*div' \{\
1623 .       if d toc*num .toc*end-entry
1624 .       ie \\n[.$] \{\
1625 .               ie '\\$1'no' .ds toc*num
1626 .               el .ds toc*num "\\$1
1627 .       \}
1628 .       el .ds toc*num \\n[PN]
1629 .       br
1630 .       par@reset
1631 .       na
1632 .       ll -8n
1633 .       in (n;0\\$2)
1635 .el .@error XA without XS
1637 .de XE
1638 .ie '\\n(.z'toc*div' \{\
1639 .       if d toc*num .toc*end-entry
1640 .       ev
1641 .       di
1643 .el .@error XE without XS
1645 .de toc*end-entry
1646 \\a\\t\\*[toc*num]
1648 .rm toc*num
1650 .de PX
1652 .if !'\\$1'no' \{\
1653 .       ce 1
1654 .       ie (\\n[PS] >= 1000) \
1655 .               ps ((\\n[PS]z / 1000u) + 2z)
1656 .       el \
1657 .               ps \\n[PS]+2
1658 .       ft B
1659 \\*[TOC]
1660 .       ft
1661 .       ps
1664 .char \[toc*leader-char] .\h'1m'
1665 .lc \[toc*leader-char]
1666 .ta (u;\\n[.l]-\\n[.i]-\w'000') (u;\\n[.l]-\\n[.i])R
1667 .sp 2
1668 .toc*div
1669 .par@reset
1671 .\" print the table of contents on page i
1672 .de TC
1674 .pg@begin 1 i
1675 .PX \\$1
1677 .\" ****************************
1678 .\" ******** module eqn ********
1679 .\" ****************************
1680 .\" Eqn support.
1681 .de EQ
1683 .de EN
1685 .de @EQ
1687 .ds eqn*num "\\$2
1688 .ie '\\$1'L' .nr eqn*type 0
1689 .el \{\
1690 .       ie '\\$1'I' .nr eqn*type 1
1691 .       el \{\
1692 .               nr eqn*type 2
1693 .               if !'\\$1'C' .ds eqn*num "\\$1
1694 .       \}
1696 .di eqn*div
1697 .in 0
1698 .if \\n[eqn*type]=0 .EQN-HTML-IMAGE-LEFT
1699 .if \\n[eqn*type]=1 \{\
1700 .   if '\*(.T'html' .RS
1701 .EQN-HTML-IMAGE-INLINE
1703 .if \\n[eqn*type]=2 .EQN-HTML-IMAGE
1706 .de @div-end!eqn*div
1707 .@EN
1709 .\" Note that geqn mark and lineup work correctly in centered equations.
1710 .de @EN
1711 .ie !'\\n(.z'eqn*div' .@error-recover mismatched EN
1712 .el \{\
1713 .       br
1714 .       di
1715 .       nr eqn*have-num 0
1716 .       if !'\\*[eqn*num]'' .nr eqn*have-num 1
1717 .       ie \\n[dl]:\\n[eqn*have-num] \{\
1718 .               sp \\n[DD]u
1719 .               par@reset
1720 .               ds eqn*tabs \\n[.tabs]
1721 .               nf
1722 .               ie \\n[dl] \{\
1723 .\"                     --fixme-- this really should not be necessary
1724 .\"                     and indicates that there is extra space creeping into
1725 .\"                     an equation when ps4html is enabled..
1726 .                       ie r ps4html .ds@need \\n[dn]u-1v+\n[.V]u+1i
1727 .                       el .ds@need \\n[dn]u-1v+\n[.V]u
1728 .                       chop eqn*div
1729 .                       ie \\n[eqn*type]=0 \{\
1730 .                               ta (u;\\n[.l]-\\n[.i])R
1731 \\*[eqn*div]\t\\*[eqn*num]
1732 .                       \}
1733 .                       el \{\
1734 .                               ie \\n[eqn*type]=1 .ta \\n[DI]u \
1735 (u;\\n[.l]-\\n[.i])R
1736 .                               el .ta (u;\\n[.l]-\\n[.i]/2)C \
1737 (u;\\n[.l]-\\n[.i])R
1738 \t\\*[eqn*div]\t\\*[eqn*num]
1739 .                       \}
1740 .               \}
1741 .               el \{\
1742 .                       ta (u;\\n[.l]-\\n[.i])R
1743 \t\\*[eqn*num]
1744 .               \}
1745 .\".            if !'\*(.T'html' .sp \\n[DD]u
1746 .               sp \\n[DD]u
1747 .               ta \\*[eqn*tabs]
1748 .       \}
1749 .       el \{
1750 .\" must terminate empty equations in html and ps4html as they contain
1751 .\" the EQN-HTML-IMAGE-END suppression nodes
1752 .               if \\n[dl] .chop eqn*div
1753 .               if '\*(.T'html' \\*[eqn*div]
1754 .               if r ps4html    \\*[eqn*div]
1755 .       \}
1756 .       if !'\*(.T'html' .fi
1757 .       if \\n[eqn*type]=0 .EQN-HTML-IMAGE-END
1758 .       if \\n[eqn*type]=1 \{\
1759 .               EQN-HTML-IMAGE-END
1760 .               if '\*(.T'html' .RE
1761 .       \}
1762 .       if \\n[eqn*type]=2 .EQN-HTML-IMAGE-END
1766 .\" ****************************
1767 .\" ******** module tbl ********
1768 .\" ****************************
1769 .\" Tbl support.
1770 .nr tbl*have-header 0
1771 .\" This gets called if TS occurs before the first paragraph.
1772 .de TS
1774 .\" cov*ab-init aliases TS to @TS
1775 \\*[TS]\\
1777 .de @TS
1778 .sp \\n[DD]u
1779 .if '\\$1'H' .di tbl*header-div
1780 .HTML-IMAGE
1782 .de tbl@top-hook
1783 .if \\n[tbl*have-header] \{\
1784 .       ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl*print-header
1785 .       el .sp \\n[.t]u
1788 .de tbl*print-header
1789 .ev nf
1790 .tbl*header-div
1792 .mk #T
1794 .de TH
1795 .ie '\\n[.z]'tbl*header-div' \{\
1796 .       nr T. 0
1797 .       T#
1798 .       br
1799 .       di
1800 .       ie \\n[dn]+\\n[FM]+\\n[HM]+2v>=\\n[.p] \{\
1801 .               @error ridiculously long table header
1802 .               ds@need \\n[dn]
1803 .               tbl*print-header
1804 .       \}
1805 .       el \{\
1806 .               nr tbl*header-ht \\n[dn]
1807 .               ds@need \\n[dn]u+1v
1808 .               tbl*print-header
1809 .               nr tbl*have-header 1
1810 .       \}
1812 .el .@error-recover .TH without .TS H
1814 .de @div-end!tbl*header-div
1818 .de TE
1819 .ie '\\n(.z'tbl*header-div' .@error-recover .TS H but no .TH before .TE
1820 .el \{\
1821 .       nr tbl*have-header 0
1822 .       if !'\*(.T'html' .sp \\n[DD]u
1824 .HTML-IMAGE-END
1825 .\" reset tabs
1828 .de tbl@bottom-hook
1829 .if \\n[tbl*have-header] \{\
1830 .       nr T. 1
1831 .       T#
1834 .de T&
1836 .\" ****************************
1837 .\" ******** module pic ********
1838 .\" ****************************
1839 .\" Pic support.
1840 .\" PS height width
1841 .de PS
1843 .sp \\n[DD]u
1844 .ie \\n[.$]<2 .@error bad arguments to PS (not preprocessed with pic?)
1845 .el \{\
1846 .       ds@need (u;\\$1)+1v
1847 .       in +(u;\\n[.l]-\\n[.i]-\\$2/2>?0)
1849 .HTML-IMAGE
1851 .de PE
1852 .HTML-IMAGE-END
1853 .par@reset
1854 .sp \\n[DD]u+.5m
1856 .\" ****************************
1857 .\" ******** module ref ********
1858 .\" ****************************
1859 .\" Refer support.
1860 .de ]-
1861 .rm [A [B [C [D [E [G [I [J [N [O [P [Q [R [S [T [V
1862 .rm ref*string
1864 .\" Other
1865 .ds ref*spec!0 Q A T1 S V N P I C D O
1866 .\" Journal article
1867 .ds ref*spec!1 Q A T2 J S V N P I C D O
1868 .\" Book
1869 .ds ref*spec!2 Q A T1 S V P I C D O
1870 .\" Article within book
1871 .ds ref*spec!3 Q A T2 B E S V P I C D O
1872 .\" Tech report
1873 .ds ref*spec!4 Q A T2 R G P I C D O
1874 .\" ][ type
1875 .de ][
1876 .if r [T \{\
1877 .       als [T1 [T
1878 .       als [T2 [T
1880 .ie d ref*spec!\\$1 .ref*build \\*[ref*spec!\\$1]
1881 .el \{\
1882 .       @error unknown reference type `\\$1'
1883 .       ref*build \\*[ref*spec!0]
1885 .ref*print
1886 .rm ref*string
1887 .rm [F [T1 [T2
1889 .\" start of reference number
1890 .ds [. \E*[par@sup-start]
1891 .\" end of reference number
1892 .ds .] \E*[par@sup-end]
1893 .\" period before reference
1894 .ds <. .
1895 .\" period after reference
1896 .ds >. \" empty
1897 .\" comma before reference
1898 .ds <, ,
1899 .\" comma after reference
1900 .ds >, \" empty
1901 .\" start collected references
1902 .de ]<
1903 .als ref*print ref*end-print
1905 \&\\*[REFERENCES]
1906 .par@reset
1908 .\" end collected references
1909 .de ]>
1910 .par@finish
1911 .als ref*print ref*normal-print
1913 .de ref*normal-print
1914 .ie d [F .FS "\\*([.\\*([F\\*(.]"
1915 .el .FS \&
1916 \\*[ref*string]
1919 .de ref*end-print
1920 .ie d [F .IP "\\*([F."
1921 .el .XP
1922 \\*[ref*string]
1924 .als ref*print ref*normal-print
1925 .de ref*build
1926 .rm ref*string ref*post-punct
1927 .nr ref*suppress-period 1
1928 .while \\n[.$] \{\
1929 .       if d [\\$1 \{\
1930 .               ie d ref*add-\\$1 .ref*add-\\$1
1931 .               el .ref*add-dflt \\$1
1932 .       \}
1933 .       shift
1935 .\" now add a final period
1936 .ie d ref*string \{\
1937 .       if !\\n[ref*suppress-period] .as ref*string .
1938 .       if d ref*post-punct \{\
1939 .               as ref*string "\\*[ref*post-punct]
1940 .               rm ref*post-punct
1941 .       \}
1943 .el .ds ref*string
1945 .de ref*add-T1
1946 .ref*field T , " " "\fI" "" "\fP"
1947 .if r [T .nr ref*suppress-period \\n([T
1949 .de ref*add-T2
1950 .ref*field T , " " "\\*Q" "" "\\*U"
1951 .if r [T .nr ref*suppress-period \\n([T
1953 .de ref*add-P
1954 .ie \\n([P>0 .ref*field P , " " "pp. "
1955 .el .ref*field P , " " "p. "
1957 .de ref*add-J
1958 .ref*field J , " " \fI "" \fP
1960 .de ref*add-D
1961 .ref*field D "" " " ( )
1963 .de ref*add-E
1964 .ref*field E , " " "ed. "
1966 .de ref*add-G
1967 .ref*field G "" " " ( )
1969 .de ref*add-B
1970 .ref*field B "" " " "in \fI" "" \fP
1972 .de ref*add-O
1973 .ref*field O . " "
1974 .ie r [O .nr ref*suppress-period \\n([O
1975 .el .nr ref*suppress-period 1
1977 .de ref*add-A
1978 .ref*field A , " "
1979 .if r [A .nr ref*suppress-period \\n([A
1981 .de ref*add-V
1982 .ref*field V "" " " \fB \fR
1984 .de ref*add-N
1985 .ref*field N "" ( "" ")"
1987 .de ref*add-dflt
1988 .ref*field \\$1 , " "
1990 .\" First argument is the field letter.
1991 .\" Second argument is the punctuation character to use to separate this field
1992 .\" from the previous field.
1993 .\" Third argument is a string to insert after the punctuation character of
1994 .\" the previous field (normally a space)
1995 .\" Fourth argument is a string with which to prefix this field.
1996 .\" Fifth argument is a string with which to postfix this field.
1997 .\" Sixth argument is a string to add after the punctuation character supplied
1998 .\" by the next field.
1999 .de ref*field
2000 .if d ref*string \{\
2001 .       ie d ref*post-punct \{\
2002 .               as ref*string "\\$2\\*[ref*post-punct]\\$3\"
2003 .               rm ref*post-punct
2004 .       \}
2005 .       el .as ref*string "\\$2\\$3\"
2007 .as ref*string "\\$4\\*([\\$1\\$5
2008 .if \\n[.$]>5 .ds ref*post-punct "\\$6
2009 .nr ref*suppress-period 0
2011 .\" ****************************
2012 .\" ******** module acc ********
2013 .\" ****************************
2014 .\" Accents and special characters.
2015 .ds Q \(lq
2016 .ds U \(rq
2017 .ds - \(em
2018 .\" Characters
2019 .\" The idea of this definition is for the top of the 3 to be at the x-height.
2020 .if !c\[yogh] .char \[yogh] \Z'\v'\w'x'*0-\En[rst]u'\s[\En[.s]*8u/10u]\
2021 \v'\w'3'*0+\En[rst]u'3\s0'\h'\w'\s[\En[.s]*8u/10u]3'u'
2022 .\" Accents
2023 .de acc*over-def
2024 .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
2025 \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
2027 .de acc*under-def
2028 .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
2030 .de acc*slash-def
2031 .ds \\$1 \Z'\h'(u;-\En[.w]-\w'\\$2'/2)'\
2032 \v'(u;\En[.cdp]-\En[.cht]+\En[rst]+\En[rsb]/2)'\\$2'
2034 .de acc*prefix-def
2035 .ds \\$1 \Z'\h'(u;\w'x'-\w'\\$2'/2)'\\$2'
2037 .acc*prefix-def ' \'
2038 .acc*prefix-def ` \`
2039 .acc*prefix-def ^ ^
2040 .acc*prefix-def , \(ac
2041 .acc*prefix-def : \(ad
2042 .acc*prefix-def ~ ~
2043 .\" improved accent marks
2044 .de AM
2045 .acc*over-def ' \'
2046 .acc*over-def ` \`
2047 .acc*over-def ^ ^
2048 .acc*over-def ~ ~
2049 .acc*over-def : \(ad
2050 .acc*over-def v \(ah
2051 .acc*over-def _ \(a-
2052 .acc*over-def o \(ao
2053 .acc*under-def , \(ac
2054 .acc*under-def . \s[\En[.s]*8u/10u]\v'.2m'.\v'-.2m'\s0
2055 .acc*under-def hook \(ho
2056 .acc*slash-def / /
2057 .char \[hooko] o\E*[hook]
2058 .ds q \[hooko]
2059 .ds 3 \[yogh]
2060 .ds D- \(-D\"                   Icelandic uppercase eth
2061 .ds d- \(Sd\"                   Icelandic lowercase eth
2062 .ds Th \(TP\"                   Icelandic uppercase thorn
2063 .ds th \(Tp\"                   Icelandic lowercase thorn
2064 .ds 8 \(ss\"                    German double s
2065 .ds Ae \(AE\"                   AE ligature
2066 .ds ae \(ae\"                   ae ligature
2067 .ds Oe \(OE\"                   OE ligature
2068 .ds oe \(oe\"                   oe ligature
2069 .ds ? \(r?\"                    upside down ?
2070 .ds ! \(r!\"                    upside down !
2072 .de CHECK-FOOTER-AND-KEEP
2073 .if '\*(.T'html' \{\
2074 .   rm KF
2075 .   als KF KS
2077 .   rm FS
2078 .   de FS
2079 .      sp
2080 .      HTML-NS <cite>
2081 \\..
2082 .   rm FE
2083 .   de FE
2084 .      HTML-NS </cite>
2085 .      sp
2086 \\..
2089 .par@load-init
2090 .\" ****************************
2091 .\" ******** module bell ********
2092 .\" ****************************
2093 .\" Emulate Bell Labs localisms. Note, (a) they're not documented, and
2094 .\" (b) the .P1 and .UC macros collide with different ones in Berkeley ms.
2095 .\" We hack around this by conditionalizing the behavior of P1; UC was
2096 .\" not defined by groff and will be a no-op if called Berkeley style
2097 .\" with no arguments, so there is no problem with hijacking it here.
2099 .\" What's done here is sufficient to give back the Guide to EQN (1976) its
2100 .\" section headings and restore some text that had gone missing as macro
2101 .\" arguments; no warranty express or implied is given as to how well the
2102 .\" typographic details these produce match the original Bell Labs macros.
2104 .\" P1 is now defined in module pg.
2105 .de SC
2106 .nr bell_localisms 1
2107 .NH 
2108 \\$*
2110 .de UC
2111 .if r bell_localisms \f(CW\\$*\fP
2113 .de P2
2114 .if r bell_localisms \{\
2115 .       ft
2116 .       DE
2119 .\" Make sure that no blank lines creep in at the end of this file.