* groffer.sh:
[s-roff.git] / tmac / s.tmac
blob7fd95aee3eb8d055d95396ee56d28d922a3e1d80
1 .\" -*- nroff -*-
2 .ig
4 s.tmac
6 Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc.
7      Written by James Clark (jjc@jclark.com)
9 This file is part of groff.
11 groff is free software; you can redistribute it and/or modify it under
12 the terms of the GNU General Public License as published by the Free
13 Software Foundation; either version 2, or (at your option) any later
14 version.
16 groff is distributed in the hope that it will be useful, but WITHOUT ANY
17 WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19 for more details.
21 You should have received a copy of the GNU General Public License along
22 with groff; see the file COPYING.  If not, write to the Free Software
23 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 .if !\n(.g .ab These ms macros require groff.
26 .if \n(.C \
27 .       ab The groff ms macros do not work in compatibility mode.
28 .\" Enable warnings (only if none are given on the command line).
29 .\" You can delete this if you want.
30 .if (\n[.warn] == 65543) .warn
31 .\" See if already loaded.
32 .if r GS .nx
33 .nr GS 1
34 .de @error
35 .tm \\n(.F:\\n(.c: macro error: \\$*
37 .de @warning
38 .tm \\n(.F:\\n(.c: macro warning: \\$*
40 .de @fatal
41 .ab \\n(.F:\\n(.c: fatal macro error: \\$*
43 .de @not-implemented
44 .@error sorry, \\$0 not implemented
45 .als \\$0 @nop
47 .als TM @not-implemented
48 .als CT @not-implemented
49 .de @nop
51 .de @init
52 .nr PO \\n(.o
53 .\" a non-empty environment
54 .ev ne
56 .ev
57 .ev nf
58 'nf
59 .ev
61 .ds REFERENCES References
62 .ds ABSTRACT ABSTRACT
63 .ds TOC Table of Contents
64 .ds MONTH1 January
65 .ds MONTH2 February
66 .ds MONTH3 March
67 .ds MONTH4 April
68 .ds MONTH5 May
69 .ds MONTH6 June
70 .ds MONTH7 July
71 .ds MONTH8 August
72 .ds MONTH9 September
73 .ds MONTH10 October
74 .ds MONTH11 November
75 .ds MONTH12 December
76 .ds MO \\*[MONTH\n[mo]]
77 .ds DY \n[dy] \*[MO] \n[year]
78 .de ND
79 .if \\n[.$] .ds DY "\\$*
81 .de DA
82 .if \\n[.$] .ds DY "\\$*
83 .ds CF \\*[DY]
85 .\" indexing
86 .de IX
87 .tm \\$1\t\\$2\t\\$3\t\\$4 ... \\n[PN]
89 .\" print an error message and then try to recover
90 .de @error-recover
91 .@error \\$@ (recovering)
92 .nr *pop-count 0
93 .while !'\\n(.z'' \{\
94 .       \"@warning automatically terminating diversion \\n(.z
95 .       ie d @div-end!\\n(.z .@div-end!\\n(.z
96 .       el .*div-end-default
97 .       nr *pop-count +1
98 .       \" ensure that we don't loop forever
99 .       if \\n[*pop-count]>20 .@fatal recovery failed
101 .while !'\\n[.ev]'0' .ev
102 .par@reset-env
103 .par@reset
105 .de *div-end-default
106 .ds *last-div \\n(.z
109 .ev nf
110 .\\*[*last-div]
113 .\" ****************************
114 .\" ******** module cov ********
115 .\" ****************************
116 .\" Cover sheet and first page.
117 .de cov*err-not-after-first-page
118 .@error \\$0 is not allowed after the first page has started
120 .de cov*err-not-before-tl
121 .@error \\$0 is not allowed before TL
123 .de cov*err-not-again
124 .@error \\$0 is not allowed more than once
126 .de cov*err-not-after-ab
127 .@error \\$0 is not allowed after first AB, LP, PP, IP, SH or NH
129 .als AU cov*err-not-before-tl
130 .als AI cov*err-not-before-tl
131 .als AB cov*err-not-before-tl
132 .de cov*first-page-init
133 .rm cov*first-page-init
134 .par@init
135 .als RP cov*err-not-after-first-page
136 .@init
137 .ie \\n[cov*rp-format] \{\
138 .       pg@cs-top
139 .       als FS cov*FS
140 .       als FE cov*FE
142 .el \{\
143 .       pg@top
144 .       als FS @FS
145 .       als FE @FE
147 .wh 0 pg@top
148 .CHECK-FOOTER-AND-KEEP
150 .wh 0 cov*first-page-init
151 .\" This handles the case where FS occurs before TL or LP.
152 .de FS
154 \\*[FS]\\
156 .nr cov*rp-format 0
157 .nr cov*rp-no 0
158 .\" released paper format
159 .de RP
160 .nr cov*rp-format 1
161 .if \\n[.$] .if '\\$1'no' .nr cov*rp-no 1
162 .pn 0
164 .de TL
166 .als TL cov*err-not-again
167 .rn @AB AB
168 .rn @AU AU
169 .rn @AI AI
170 .if !'\*(.T'html' .di cov*tl-div
171 .par@reset
172 .ft B
173 .ps +2
174 .vs +3p
175 .ll (u;\\n[LL]*5/6)
176 .nr cov*n-au 0
177 .HTML-TAG ".tl"
179 .de @AU
180 .par@reset
181 .if !'\\n(.z'' \{\
182 .       br
183 .       di
185 .nr cov*n-au +1
186 .di cov*au-div!\\n[cov*n-au]
188 .ft I
189 .ps \\n[PS]
191 .de @AI
192 .if !'\*(.T'html' .par@reset
193 .if !'\\n(.z'' \{\
194 .       br
195 .       di
197 .ie !\\n[cov*n-au] .@error AI before AU
198 .el \{\
199 .       di cov*ai-div!\\n[cov*n-au]
200 .       nf
201 .       ft R
202 .       ps \\n[PS]
205 .de LP
206 .if !'\\n[.z]'' \{\
207 .       br
208 .       di
211 .cov*ab-init
212 .cov*print
213 \\*[\\$0]\\
215 .als IP LP
216 .als PP LP
217 .als XP LP
218 .als QP LP
219 .als RS LP
220 .als NH LP
221 .als SH LP
222 .als MC LP
223 .als RT LP
224 .als XS LP
225 .de cov*ab-init
226 .als cov*ab-init @nop
227 .als LP @LP
228 .als IP @IP
229 .als PP @PP
230 .als XP @XP
231 .als RT @RT
232 .als XS @XS
233 .als SH @SH
234 .als NH @NH
235 .als QP @QP
236 .als RS @RS
237 .als RE @RE
238 .als QS @QS
239 .als QE @QE
240 .als MC @MC
241 .als EQ @EQ
242 .als EN @EN
243 .als TS @TS
244 .als AB cov*err-not-after-ab
245 .als AU par@AU
246 .als AI par@AI
247 .als TL par@TL
249 .de @AB
250 .if !'\\n(.z'' \{\
251 .       br
252 .       di
254 .cov*ab-init
255 .if !'\*(.T'html' .di cov*ab-div
256 .par@ab-indent
257 .par@reset
258 .if !'\\$1'no' \{\
259 .       ft I
260 .       ce 1
261 \\*[ABSTRACT]
262 .       sp
263 .       ft R
266 .@PP
267 .if '\*(.T'html' \{\
268 .       cov*tl-au-print
269 .       als cov*tl-au-print @nop
270 .       par@reset-env
271 .       par@reset
272 .       cov*print
275 .de AE
276 .ie '\*(.T'html' \{\
277 .       als AE cov*err-not-again
279 .el \{\
280 .  ie '\\n(.z'cov*ab-div' \{\
281 .       als AE cov*err-not-again
282 .       br
283 .       di
284 .\"     nr cov*ab-height \\n[dn]
285 .       par@reset-env
286 .       par@reset
287 .       cov*print
288 .  \}
289 .  el .@error AE without AB
292 .de @div-end!cov*ab-div
295 .de cov*print
296 .als cov*print @nop
297 .ie d cov*tl-div \{\
298 .       ie \\n[cov*rp-format] .cov*rp-print
299 .       el .cov*draft-print
301 .el \{\
302 .       if \\n[cov*rp-format] \{\
303 .               @warning RP format but no TL
304 .               bp 1
305 .               als FS @FS
306 .               als FE @FE
307 .               CHECK-FOOTER-AND-KEEP
308 .       \}
309 .       br
312 .de cov*rp-print
313 .nr cov*page-length \\n[.p]
314 .pl 1000i
315 .cov*tl-au-print
316 .sp 3
317 .if d cov*ab-div \{\
318 .  if !'\*(.T'html'  .  nf
319 .       cov*ab-div
321 .sp 3
322 .par@reset
323 \\*[DY]
325 .if \\n[cov*fn-height] \{\
326 .       sp |(u;\\n[cov*page-length]-\\n[FM]\
327 -\\n[cov*fn-height]-\\n[fn@sep-dist]>?\\n[nl])
328 .       fn@print-sep
329 .       ev nf
330 .       cov*fn-div
331 .       ev
332 .       ie \\n[cov*rp-no] .rm cov*fn-div
333 .       el \{\
334 .               rn cov*fn-div fn@overflow-div
335 .               nr fn@have-overflow 1
336 .       \}
338 .als FS @FS
339 .als FE @FE
340 .CHECK-FOOTER-AND-KEEP
341 .\" If anything was printed below where the footer line is normally printed,
342 .\" then that's an overflow.
343 .if -\\n[FM]/2+1v+\\n[cov*page-length]<\\n[nl] .@error cover sheet overflow
344 .pl \\n[cov*page-length]u
345 .bp 1
346 .if !\\n[cov*rp-no] .cov*tl-au-print
348 .sp 1
350 .de cov*draft-print
351 .cov*tl-au-print
352 .if d cov*ab-div \{\
353 .       nf
354 .       sp 2
355 .       cov*ab-div
357 .sp 1
359 .de cov*tl-au-print
360 .par@reset
363 .sp 3
364 .ce 9999
365 .if d cov*tl-div .cov*tl-div
366 .nr cov*i 1
367 .nr cov*sp 1v
368 .while \\n[cov*i]<=\\n[cov*n-au] \{\
369 .       sp \\n[cov*sp]u
370 .       cov*au-div!\\n[cov*i]
371 .       ie d cov*ai-div!\\n[cov*i] \{\
372 .               sp .5v  
373 .               cov*ai-div!\\n[cov*i]
374 .               nr cov*sp 1v
375 .       \}
376 .       el .nr cov*sp .5v
377 .       nr cov*i +1
379 .ce 0
381 .nr cov*fn-height 0
382 .nr cov*in-fn 0
383 .\" start of footnote on cover
384 .de cov*FS
385 .if \\n[cov*in-fn] \{\
386 .       @error nested FS
387 .       FE
389 .nr cov*in-fn 1
390 .ev fn
391 .par@reset-env
392 .da cov*fn-div
393 .if !\\n[cov*fn-height] .ns
394 .ie \\n[.$] .FP "\\$1" no
395 .el .@LP
397 .de @div-end!cov*fn-div
398 .cov*FE
400 .\" end of footnote on cover
401 .de cov*FE
402 .ie '\\n(.z'cov*fn-div' \{\
403 .       br
404 .       ev
405 .       di
406 .       nr cov*in-fn 0
407 .       nr cov*fn-height +\\n[dn]
409 .el .@error FE without matching FS
411 .\" ***************************
412 .\" ******** module pg ********
413 .\" ***************************
414 .\" Page-level formatting.
415 .\" > 0 if we have a footnote on the current page
416 .nr pg@fn-flag 0
417 .nr pg@colw 0
418 .nr pg@fn-colw 0
419 .nr HM 1i
420 .nr FM 1i
421 .ds LF
422 .ds CF
423 .ds RF
424 .ds LH
425 .ds CH -\\n[PN]-
426 .ds RH
427 .ds pg*OH '\\*[LH]'\\*[CH]'\\*[RH]'
428 .ds pg*EH '\\*[LH]'\\*[CH]'\\*[RH]'
429 .ds pg*OF '\\*[LF]'\\*[CF]'\\*[RF]'
430 .ds pg*EF '\\*[LF]'\\*[CF]'\\*[RF]'
431 .de OH
432 .ds pg*\\$0 "\\$*
434 .als EH OH
435 .als OF OH
436 .als EF OH
437 .de PT
438 .ie \\n%=1 .if \\n[pg*P1] .tl \\*[pg*OH]
439 .el \{\
440 .       ie o .tl \\*[pg*OH]
441 .       el .tl \\*[pg*EH]
444 .de BT
445 .ie o .tl \\*[pg*OF]
446 .el .tl \\*[pg*EF]
448 .nr pg*P1 0
449 .de P1
450 .nr pg*P1 1
452 .wh -\n[FM]u pg@bottom
453 .wh -\n[FM]u/2u pg*footer
454 .nr MINGW 2n
455 .nr pg@ncols 1
456 .de @MC
457 .if !'\\n(.z'' .error-recover MC while diversion open
459 .ie \\n[pg@ncols]>1 .pg@super-eject
460 .el \{\
461 .       \" flush out any floating keeps
462 .       while \\n[kp@tail]>\\n[kp@head] \{\
463 .               rs
464 .               bp
465 .       \}
467 .ie !\\n(.$ \{\
468 .       nr pg@colw \\n[LL]*7/15
469 .       nr pg*gutw \\n[LL]-(2*\\n[pg@colw])
470 .       nr pg@ncols 2
472 .el \{\
473 .       nr pg@colw (n;\\$1)<?\\n[LL]
474 .       ie \\n[.$]<2 .nr pg*gutw \\n[MINGW]
475 .       el .nr pg*gutw (n;\\$2)
476 .       nr pg@ncols \\n[LL]-\\n[pg@colw]/(\\n[pg@colw]+\\n[pg*gutw])+1
477 .       ie \\n[pg@ncols]>1 \
478 .               nr pg*gutw \\n[LL]-(\\n[pg@ncols]*\\n[pg@colw])/(\\n[pg@ncols]-1)
479 .       el .nr pg*gutw 0
481 .HTML-TAG ".mc \\n[pg@ncols] \\n[pg@colw] \\n[pg*gutw]"
482 .mk pg*col-top
484 .nr pg*col-num 0
485 .nr pg@fn-colw \\n[pg@colw]*5/6
486 .par@reset
488 .de 2C
491 .de 1C
492 .MC \\n[LL]u
494 .\" top of page macro
495 .de pg@top
496 .ch pg*footer -\\n[FM]u/2u
497 .nr PN \\n%
498 .nr pg*col-num 0
499 .nr pg@fn-bottom-margin 0
500 .nr pg*saved-po \\n[PO]
501 .po \\n[PO]u
502 .ev h
503 .par@reset
504 .sp (u;\\n[HM]/2)
506 .sp |\\n[HM]u
507 .if d HD .HD
508 .mk pg@header-bottom
510 .mk pg*col-top
511 .pg*start-col
513 .de pg*start-col
514 .\" Handle footnote overflow before floating keeps, because the keep
515 .\" might contain an embedded footnote.
516 .fn@top-hook
517 .kp@top-hook
518 .tbl@top-hook
521 .de pg@cs-top
522 .sp \\n[HM]u
523 .\" move pg@bottom and pg*footer out of the way
524 .ch pg@bottom \\n[.p]u*2u
525 .ch pg*footer \\n[.p]u*2u
528 .de pg@bottom
529 .tbl@bottom-hook
530 .if \\n[pg@fn-flag] .fn@bottom-hook
531 .nr pg*col-num +1
532 .ie \\n[pg*col-num]<\\n[pg@ncols] .pg*end-col
533 .el .pg*end-page
535 .de pg*end-col
536 'sp |\\n[pg*col-top]u
537 .po (u;\\n[pg*saved-po]+(\\n[pg@colw]+\\n[pg*gutw]*\\n[pg*col-num]))
538 .\"po +(u;\\n[pg@colw]+\\n[pg*gutw])
539 .pg*start-col
541 .de pg*end-page
542 .po \\n[pg*saved-po]u
543 .\" Make sure we don't exit if there are still floats or footnotes left-over.
544 .ie \\n[kp@head]<\\n[kp@tail]:\\n[fn@have-overflow] \{\
545 .       \" Switching environments ensures that we don't get an unnecessary
546 .       \" blank line at the top of the page.
547 .       ev ne
548 '       bp
549 .       ev
551 .el \{\
552 .       \" If the text has ended and there are no more footnotes or keeps, exit.
553 .       if \\n[pg@text-ended] .ex
554 .       if r pg*next-number \{\
555 .               pn \\n[pg*next-number]
556 .               rr pg*next-number
557 .               if d pg*next-format \{\
558 .                       af PN \\*[pg*next-format]
559 .                       rm pg*next-format
560 .               \}
561 .       \}
562 '       bp
565 .\" pg@begin number format
566 .de pg@begin
567 .ie \\n[.$]>0 \{\
568 .       nr pg*next-number (;\\$1)
569 .       ie \\n[.$]>1 .ds pg*next-format \\$2
570 .       el .rm pg*next-format
572 .el .rr pg*next-number
573 .pg@super-eject
575 .\" print the footer line
576 .de pg*footer
577 .ev h
578 .par@reset
582 .\" flush out any keeps or footnotes
583 .de pg@super-eject
585 .if !'\\n(.z'' .@error-recover diversion open while ejecting page
586 .\" Make sure we stay in the end macro while there is still footnote overflow
587 .\" left, or floating keeps.
588 .while \\n[kp@tail]>\\n[kp@head]:\\n[pg@fn-flag] \{\
589 .       rs
590 .       bp
594 .nr pg@text-ended 0
595 .de pg@end-text
597 .nr pg@text-ended 1
598 .pg@super-eject
600 .em pg@end-text
601 .\" ***************************
602 .\" ******** module fn ********
603 .\" ***************************
604 .\" Footnotes.
605 .nr fn@sep-dist 8p
606 .ev fn
607 .\" Round it vertically
608 .vs \n[fn@sep-dist]u
609 .nr fn@sep-dist \n[.v]
611 .nr fn*text-num 0 1
612 .nr fn*note-num 0 1
613 .ds * \\*[par@sup-start]\En+[fn*text-num]\\*[par@sup-end]
614 .nr fn*open 0
615 .\" normal FS
616 .de @FS
617 .ie \\n[.$] .fn*do-FS "\\$1" no
618 .el \{\
619 .       ie \\n[fn*text-num]>\\n[fn*note-num] .fn*do-FS \\n+[fn*note-num]
620 .       el .fn*do-FS
623 .\" Second argument of `no' means don't embellish the first argument.
624 .de fn*do-FS
625 .if \\n[fn*open] .@error-recover nested FS
626 .nr fn*open 1
627 .if \\n[.u] \{\
628 .       \" Ensure that the first line of the footnote is on the same page
629 .       \" as the reference.  I think this is minimal.
630 .       ev fn
631 .       nr fn*need 1v
632 .       ev
633 .       ie \\n[pg@fn-flag] .nr fn*need +\\n[fn:PD]
634 .       el .nr fn*need +\\n[fn@sep-dist]
635 .       ne \\n[fn*need]u+\\n[.V]u>?0
637 .ev fn
638 .par@reset-env
639 .fn*start-div
640 .par@reset
641 .ie \\n[.$] .FP \\$@
642 .el .@LP
644 .de @FE
645 .ie !\\n[fn*open] .@error FE without FS
646 .el \{\
647 .       nr fn*open 0
648 .       br
649 .       ev
650 .       fn*end-div
653 .nr fn@have-overflow 0
654 .\" called at the top of each column
655 .de fn@top-hook
656 .nr fn*max-width 0
657 .nr fn*page-bottom-pos 0-\\n[FM]-\\n[pg@fn-bottom-margin]
658 .ch pg@bottom \\n[fn*page-bottom-pos]u
659 .if \\n[fn@have-overflow] \{\
660 .       nr fn@have-overflow 0
661 .       fn*start-div
662 .       ev nf
663 .       fn@overflow-div
664 .       ev
665 .       fn*end-div
668 .\" This is called at the bottom of the column if pg@fn-flag is set.
669 .de fn@bottom-hook
670 .nr pg@fn-flag 0
671 .nr fn@have-overflow 0
672 .nr fn@bottom-pos \\n[.p]-\\n[FM]-\\n[pg@fn-bottom-margin]+\\n[.v]
673 .ev fn
674 .nr fn@bottom-pos -\\n[.v]
676 .ie \\n[nl]+\\n[fn@sep-dist]+\n[.V]>\\n[fn@bottom-pos] \{\
677 .       rn fn@div fn@overflow-div
678 .       nr fn@have-overflow 1
680 .el \{\
681 .       if \\n[pg@ncols]>1 \
682 .               if \\n[fn*max-width]>\\n[pg@fn-colw] \
683 .                       nr pg@fn-bottom-margin \\n[.p]-\\n[FM]-\\n[nl]+1v
684 .       wh \\n[fn@bottom-pos]u fn*catch-overflow
685 .       fn@print-sep
686 .       ev nf
687 .       fn@div
688 .       rm fn@div
689 .       ev
690 .       if '\\n(.z'fn@overflow-div' \{\
691 .               di
692 .               nr fn@have-overflow \\n[dn]>0
693 .       \}
694 .       ch fn*catch-overflow
697 .de fn*catch-overflow
698 .di fn@overflow-div
700 .nr fn*embed-count 0
701 .de @div-end!fn@div
703 .if '\\n[.ev]'fn' .ev
704 .fn*end-div
705 .nr fn*open 0
707 .als @div-end!fn*embed-div @div-end!fn@div
708 .de fn*start-div
709 .ie '\\n(.z'' \{\
710 .       da fn@div
711 .       if !\\n[pg@fn-flag] .ns
713 .el .di fn*embed-div
715 .de fn*end-div
716 .ie '\\n(.z'fn@div' \{\
717 .       di
718 .       nr fn*page-bottom-pos -\\n[dn]
719 .       nr fn*max-width \\n[fn*max-width]>?\\n[dl]
720 .       if !\\n[pg@fn-flag] .nr fn*page-bottom-pos -\\n[fn@sep-dist]
721 .       nr pg@fn-flag 1
722 .       nr fn*page-bottom-pos \\n[nl]-\\n[.p]+\n[.V]>?\\n[fn*page-bottom-pos]
723 .       ch pg@bottom \\n[fn*page-bottom-pos]u
725 .el \{\
726 .       ie '\\n(.z'fn*embed-div' \{\
727 .       di
728 .               rn fn*embed-div fn*embed-div!\\n[fn*embed-count]
729 \!.             fn*embed-start \\n[fn*embed-count]
730 .               rs
731 '               sp (u;\\n[dn]+\\n[fn@sep-dist]+\\n[.V])
732 \!.             fn*embed-end
733 .               nr fn*embed-count +1
734 .       \}
735 .       el \{\
736 .               ev fn
737 .               @error-recover unclosed diversion within footnote
738 .       \}
741 .de fn*embed-start
742 .ie '\\n(.z'' \{\
743 .       fn*start-div
744 .       ev nf
745 .       fn*embed-div!\\$1
746 .       rm fn*embed-div!\\$1
747 .       ev
748 .       fn*end-div
749 .       di fn*null
751 .el \{\
752 \!.     fn*embed-start \\$1
753 .       rs
756 .de fn*embed-end
757 .ie '\\n(.z'fn*null' \{\
758 .       di
759 .       rm fn*null
761 .el \!.fn*embed-end
763 .\" It's important that fn@print-sep use up exactly fn@sep-dist vertical space.
764 .de fn@print-sep
765 .ev fn
766 .in 0
767 .vs \\n[fn@sep-dist]u
768 \D'l 1i 0'
772 .\" ***************************
773 .\" ******** module kp ********
774 .\" ***************************
775 .\" Keeps.
776 .de KS
778 .di kp*div
780 .de KF
781 .if !'\\n(.z'' .@error-recover KF while open diversion
782 .di kp*fdiv
783 .ev k
784 .par@reset-env
785 .par@reset
787 .de KE
788 .ie '\\n(.z'kp*div' .kp*end
789 .el \{\
790 .       ie '\\n(.z'kp*fdiv' .kp*fend
791 .       el .@error KE without KS or KF
794 .de @div-end!kp*div
795 .kp*end
797 .de @div-end!kp*fdiv
798 .kp*fend
800 .de kp*need
801 .ie '\\n(.z'' .ds@need \\$1
802 .el \!.kp*need \\$1
804 .\" end non-floating keep
805 .de kp*end
808 .kp*need \\n[dn]
809 .ev nf
810 .kp*div
812 .rm kp*div
814 .\" Floating keeps.
815 .nr kp@head 0
816 .nr kp@tail 0
817 .\" end floating keep
818 .de kp*fend
822 .ie \\n[.t]-(\\n[.k]>0*1v)>\\n[dn] \{\
823 .       br
824 .       ev nf
825 .       kp*fdiv
826 .       rm kp*fdiv
827 .       ev
829 .el \{\
830 .       rn kp*fdiv kp*div!\\n[kp@tail]
831 .       nr kp*ht!\\n[kp@tail] 0\\n[dn]
832 .       nr kp@tail +1
835 .\" top of page processing for KF
836 .nr kp*doing-top 0
837 .de kp@top-hook
838 .if !\\n[kp*doing-top] \{\
839 .       nr kp*doing-top 1
840 .       kp*do-top
841 .       nr kp*doing-top 0
844 .de kp*do-top
845 .\" If the first keep won't fit, only force it out if we haven't had a footnote
846 .\" and we're at the top of the page.
847 .nr kp*force \\n[pg@fn-flag]=0&(\\n[nl]<=\\n[pg@header-bottom])
848 .nr kp*fits 1
849 .while \\n[kp@tail]>\\n[kp@head]&\\n[kp*fits] \{\
850 .       ie \\n[.t]>\\n[kp*ht!\\n[kp@head]]:\\n[kp*force] \{\
851 .               nr kp*force 0
852 .               \" It's important to advance kp@head before bringing
853 .               \" back the keep, so that if the last line of the
854 .               \" last keep springs the bottom of page trap, a new
855 .               \" page will not be started unnecessarily.
856 .               rn kp*div!\\n[kp@head] kp*temp
857 .               nr kp@head +1
858 .               ev nf
859 .               kp*temp
860 .               ev
861 .               rm kp*temp
862 .       \}
863 .       el .nr kp*fits 0
866 .\" ***************************
867 .\" ******** module ds ********
868 .\" ***************************
869 .\" Displays and non-floating keeps.
870 .de DE
871 .ds*end!\\n[\\n[.ev]:ds-type]
872 .nr \\n[.ev]:ds-type 0
874 .de ds@auto-end
875 .if \\n[\\n[.ev]:ds-type] \{\
876 .       @error automatically terminating display
877 .       DE
880 .de @div-end!ds*div
881 .ie \\n[\\n[.ev]:ds-type] .DE
882 .el .ds*end!2
884 .de ds*end!0
885 .@error DE without DS, ID, CD, LD or BD
887 .de LD
889 .nr \\n[.ev]:ds-type 1
890 .par@reset
892 .sp \\n[DD]u
894 .de ID
896 .ie \\n[.$] .in +(n;\\$1)
897 .el .in +\\n[DI]u
899 .de CD
901 .ce 9999
903 .de RD
905 .rj 9999
907 .de ds*common-end
908 .par@reset
909 .sp \\n[DD]u
911 .als ds*end!1 ds*common-end
912 .de BD
914 .nr \\n[.ev]:ds-type 2
915 .di ds*div
917 .de ds*end!2
919 .ie '\\n(.z'ds*div' \{\
920 .       di
921 .       nf
922 .       in (u;\\n[.l]-\\n[dl]/2>?0)
923 .       ds*div
924 .       rm ds*div
925 .       ds*common-end
927 .el .@error-recover mismatched DE
929 .de DS
931 .di ds*div
932 .ie '\\$1'B' \{\
933 .       LD
934 .       nr \\n[.ev]:ds-type 4
936 .el \{\
937 .       ie '\\$1'L' .LD
938 .       el \{\
939 .               ie '\\$1'C' .CD
940 .               el \{\
941 .                       ie '\\$1'R' .RD
942 .                       el \{\
943 .                               ie '\\$1'I' .ID \\$2
944 .                               el .ID \\$1
945 .                       \}
946 .               \}
947 .       \}
948 .       nr \\n[.ev]:ds-type 3
951 .de ds@need
952 .if '\\n(.z'' \{\
953 .       while \\n[.t]<=(\\$1)&(\\n[nl]>\\n[pg@header-bottom]) \{\
954 .               rs
955 '               sp \\n[.t]u
956 .       \}
959 .de ds*end!3
961 .ie '\\n(.z'ds*div' \{\
962 .       di
963 .       ds@need \\n[dn]
964 .       ev nf
965 .       ds*div
966 .       ev
967 .       rm ds*div
968 .       ds*common-end
970 .el .@error-recover mismatched DE
972 .de ds*end!4
973 .ie '\\n(.z'ds*div' \{\
974 .       br
975 .       di
976 .       nf
977 .       in (u;\\n[.l]-\\n[dl]/2>?0)
978 .       ds@need \\n[dn]
979 .       ds*div
980 .       rm ds*div
981 .       ds*common-end
983 .el .@error-recover mismatched DE
985 .\" ****************************
986 .\" ******** module par ********
987 .\" ****************************
988 .\" Paragraph-level formatting.
989 .\" Load time initialization.
990 .de par@load-init
991 .\" PS and VS might have been set on the command-line
992 .if !rPS .nr PS 10
993 .if !rLL .nr LL 6i
994 .ll \\n[LL]u
995 .\" don't set LT so that it can be defaulted from LL
996 .ie rLT .lt \\n[LT]u
997 .el .lt \\n[LL]u
998 .ps \\n[PS]
999 .\" don't set VS so that it can be defaulted from PS
1000 .ie rVS .par*vs \\n[VS]
1001 .el .par*vs \\n[PS]+2
1002 .if dFAM .fam \\*[FAM]
1003 .if !rHY .nr HY 14
1004 .hy \\n[HY]
1006 .CHECK-FOOTER-AND-KEEP
1008 .de par*vs
1009 .\" If it's too big to be in points, treat it as units.
1010 .ie (p;\\$1)>=40p .vs (u;\\$1)
1011 .el .vs (p;\\$1)
1013 .de par@ab-indent
1014 .nr 0:li (u;\\n[LL]/12)
1015 .nr 0:ri \\n[0:li]
1017 .de par*env-init
1018 .aln \\n[.ev]:PS PS
1019 .aln \\n[.ev]:VS VS
1020 .aln \\n[.ev]:LL LL
1021 .aln \\n[.ev]:MCLL LL
1022 .aln \\n[.ev]:LT LT
1023 .aln \\n[.ev]:MCLT LT
1024 .aln \\n[.ev]:PI PI
1025 .aln \\n[.ev]:PD PD
1026 .ad \\n[par*adj]
1027 .par@reset-env
1029 .\" happens when the first page begins
1030 .de par@init
1031 .if !rLT .nr LT \\n[LL]
1032 .if !rFL .nr FL \\n[LL]*5/6
1033 .if !rVS .nr VS \\n[PS]+2
1034 .if !rDI .nr DI .5i
1035 .if !rFPS .nr FPS \\n[PS]-2
1036 .if !rFVS .nr FVS \\n[FPS]+2
1037 .\" don't change environment 0
1038 .ev h
1039 .ps \\n[PS]
1040 .if !rQI .nr QI 5n
1041 .if !rPI .nr PI 5n
1042 .par*vs \\n[VS]
1043 .if !rPD .nr PD .3v>?\n(.V
1044 .if !rDD .nr DD .5v>?\n(.V
1045 .if !rFI .nr FI 2n
1046 .if !rFPD .nr FPD \\n[PD]/2
1048 .if !dFAM .ds FAM \\n[.fam]
1049 .nr par*adj \\n[.j]
1050 .par*env-init
1051 .ev h
1052 .par*env-init
1054 .ev fn
1055 .par*env-init
1057 .ev k
1058 .par*env-init
1060 .aln 0:MCLL pg@colw
1061 .aln 0:MCLT pg@colw
1062 .aln k:MCLL pg@colw
1063 .aln k:MCLT pg@colw
1064 .aln fn:PS FPS
1065 .aln fn:VS FVS
1066 .aln fn:LL FL
1067 .aln fn:LT FL
1068 .aln fn:PI FI
1069 .aln fn:PD FPD
1070 .aln fn:MCLL pg@fn-colw
1071 .aln fn:MCLT pg@fn-colw
1073 .de par@reset-env
1074 .nr \\n[.ev]:il 0
1075 .nr \\n[.ev]:li 0
1076 .nr \\n[.ev]:ri 0
1077 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1078 .nr \\n[.ev]:pli 0
1079 .nr \\n[.ev]:pri 0
1080 .nr \\n[.ev]:ds-type 0
1082 .\" par@reset
1083 .de par@reset
1085 .ce 0
1086 .rj 0
1087 .ul 0
1089 .ie \\n[pg@ncols]>1 \{\
1090 .       ll (u;\\n[\\n[.ev]:MCLL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1091 .       lt \\n[\\n[.ev]:MCLT]u
1093 .el \{\
1094 .       ll (u;\\n[\\n[.ev]:LL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1095 .       lt \\n[\\n[.ev]:LT]u
1097 .in (u;\\n[\\n[.ev]:li]+\\n[\\n[.ev]:pli])
1098 .ft 1
1099 .fam \\*[FAM]
1100 .ps \\n[\\n[.ev]:PS]
1101 .par*vs \\n[\\n[.ev]:VS]
1102 .ls 1
1104 .hy \\n[HY]
1106 .de @RT
1107 .nr \\n[.ev]:pli 0
1108 .nr \\n[.ev]:pri 0
1109 .par@reset
1111 .\" This can be redefined by the user.
1112 .de TA
1113 .ta T 5n
1115 .de par*start
1116 .ds@auto-end
1117 .nr \\n[.ev]:pli \\$1
1118 .nr \\n[.ev]:pri \\$2
1119 .par@reset
1120 .sp \\n[\\n[.ev]:PD]u
1121 .ne 1v+\\n(.Vu
1123 .de par@finish
1124 .nr \\n[.ev]:pli 0
1125 .nr \\n[.ev]:pri 0
1126 .par@reset
1128 .\" normal LP
1129 .de @LP
1130 .par*start 0 0
1131 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1133 .de @PP
1134 .par*start 0 0
1135 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1136 .if !'\*(.T'html' .ti +\\n[\\n[.ev]:ai]u
1138 .de @QP
1139 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1140 .par*start \\n[QI] \\n[QI]
1142 .de @XP
1143 .par*start \\n[\\n[.ev]:PI] 0
1144 .ti -\\n[\\n[.ev]:PI]u
1146 .de @IP
1147 .if \\n[.$]>1 .nr \\n[.ev]:ai (n;\\$2)
1148 .par*start \\n[\\n[.ev]:ai] 0
1149 .if !'\\$1'' \{\
1150 .       \" Divert the label so as to freeze any spaces.
1151 .       di par*label
1152 .       par*push-tag-env
1153 \&\\$1
1154 .       par*pop-tag-env
1155 .       di
1156 .       chop par*label
1157 .       ie '\*(.T'html' \{\
1158 .               if \\n[dl]+1n<=\\n[\\n[.ev]:ai] .HTML-TAG ".ip"
1159 .               ti 0
1160 \&\\$1
1161 .               br
1162 .       \}
1163 .       el \{\
1164 .               ti -\\n[\\n[.ev]:ai]u
1165 .               ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \\*[par*label]\h'|\\n[\\n[.ev]:ai]u'\c
1166 .               el \{\
1167 \\*[par*label]
1168 .                       br
1169 .               \}
1170 .       \}
1171 .       rm par*label
1174 .\" We don't want margin characters to be attached when we divert
1175 .\" the tag.  Since there's no way to save and restore the current
1176 .\" margin character, we have to switch to a new environment, taking
1177 .\" what we need of the old environment with us.
1178 .de par*push-tag-env
1179 .nr par*saved-font \\n[.f]
1180 .nr par*saved-size \\n[.s]z
1181 .nr par*saved-ss \\n[.ss]
1182 .ds par*saved-fam \\n[.fam]
1183 .ev par
1186 .ft \\n[par*saved-font]
1187 .ps \\n[par*saved-size]u
1188 .ss \\n[par*saved-ss]
1189 .fam \\*[par*saved-fam]
1191 .de par*pop-tag-env
1194 .de @RS
1196 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1197 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1198 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1199 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1200 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1201 .nr \\n[.ev]:il +1
1202 .nr \\n[.ev]:li +\\n[\\n[.ev]:ai]
1203 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1204 .par@reset
1206 .de @RE
1208 .ie \\n[\\n[.ev]:il] \{\
1209 .       nr \\n[.ev]:il -1
1210 .       nr \\n[.ev]:ai \\n[\\n[.ev]:ai!\\n[\\n[.ev]:il]]
1211 .       nr \\n[.ev]:li \\n[\\n[.ev]:li!\\n[\\n[.ev]:il]]
1212 .       nr \\n[.ev]:ri \\n[\\n[.ev]:ri!\\n[\\n[.ev]:il]]
1213 .       nr \\n[.ev]:pli \\n[\\n[.ev]:pli!\\n[\\n[.ev]:il]]
1214 .       nr \\n[.ev]:pri \\n[\\n[.ev]:pri!\\n[\\n[.ev]:il]]
1216 .el .@error unbalanced \\$0
1217 .par@reset
1219 .de @QS
1221 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1222 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1223 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1224 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1225 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1226 .nr \\n[.ev]:il +1
1227 .nr \\n[.ev]:li +\\n[QI]
1228 .nr \\n[.ev]:ri +\\n[QI]
1229 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1230 .par@reset
1232 .als @QE @RE
1233 .\" start boxed text
1234 .de B1
1236 .HTML-IMAGE
1237 .di par*box-div
1238 .nr \\n[.ev]:li +1n
1239 .nr \\n[.ev]:ri +1n
1240 .nr par*box-in \\n[.in]
1241 .\" remember what 1n is, just in case the point size changes
1242 .nr par*box-n 1n
1243 .in +1n
1244 .ll -1n
1245 .lt -1n
1246 .ti \\n[par*box-in]u+1n
1248 .de @div-end!par*box-div
1251 .\" end boxed text
1252 .\" Postpone the drawing of the box until we're in the top-level diversion,
1253 .\" in case there's a footnote inside the box.
1254 .de B2
1255 .ie '\\n(.z'par*box-div' \{\
1256 .       br
1257 .       if \n[.V]>.25m .sp
1258 .       di
1259 .       if \n[.V]>.25m .sp
1260 .       ds@need \\n[dn]
1261 .       par*box-mark-top
1262 .       ev nf
1263 .       par*box-div
1264 .       ev
1265 .       nr \\n[.ev]:ri -\\n[par*box-n]
1266 .       nr \\n[.ev]:li -\\n[par*box-n]
1267 .       in -\\n[par*box-n]u
1268 .       ll +\\n[par*box-n]u
1269 .       lt +\\n[par*box-n]u
1270 .       par*box-draw \\n[.i]u \\n[.l]u-(\\n[.H]u==1n*1n)
1272 .el .@error B2 without B1
1273 .HTML-IMAGE-END
1275 .de par*box-mark-top
1276 .ie '\\n[.z]'' \{\
1277 .       rs
1278 .       mk par*box-top
1280 .el \!.par*box-mark-top
1282 .de par*box-draw
1283 .ie '\\n[.z]'' \{\
1284 .       nr par*box-in \\n[.i]
1285 .       nr par*box-ll \\n[.l]
1286 .       nr par*box-vpt \\n[.vpt]
1287 .       nr par*box-ad \\n[.j]
1288 .       ad l
1289 .       vpt 0
1290 .       in \\$1
1291 .       ll \\$2
1292 \v'-1v+.25m'\
1293 \D'l (u;\\n[.l]-\\n[.i]) 0'\
1294 \D'l 0 |\\n[par*box-top]u'\
1295 \D'l -(u;\\n[.l]-\\n[.i]) 0'\
1296 \D'l 0 -|\\n[par*box-top]u'
1297 .       br
1298 .       sp -1
1299 .       in \\n[par*box-in]u
1300 .       ll \\n[par*box-ll]u
1301 .       vpt \\n[par*box-vpt]
1302 .       ad \\n[par*box-ad]
1304 .el \!.par*box-draw \\$1 \\$2
1306 .de @SH
1307 .par@finish
1308 .\" Keep together the heading and the first two lines of the next paragraph.
1309 .ne 3v+\\n[\\n[.ev]:PD]u+\\n(.Vu
1310 .sp 1
1311 .ft B
1312 .HTML-TAG ".SH 1"
1314 .\" TL, AU, and AI are aliased to these in cov*ab-init.
1315 .de par@TL
1316 .par@finish
1317 .sp 1
1318 .ft B
1319 .ps +2
1320 .vs +3p
1321 .ce 9999
1322 .HTML-TAG ".tl"
1324 .de par@AU
1325 .par@finish
1326 .sp 1
1327 .ft I
1328 .ce 9999
1330 .de par@AI
1331 .par@finish
1332 .sp .5
1333 .ce 9999
1335 .\" In paragraph macros.
1336 .de NL
1337 .ps \\n[\\n[.ev]:PS]
1339 .de SM
1340 .ps -2
1342 .de LG
1343 .ps +2
1345 .de R
1346 .ft R
1348 .\" par*define-font-macro macro font
1349 .de par*define-font-macro
1350 .de \\$1
1351 .ie \\\\n[.$] \{\
1352 .       nr par*prev-font \\\\n[.f]
1353 \&\\\\$3\f[\\$2]\\\\$1\f[\\\\n[par*prev-font]]\\\\$2
1355 .el .ft \\$2
1356 \\..
1358 .par*define-font-macro B B
1359 .par*define-font-macro I I
1360 .par*define-font-macro BI BI
1361 .par*define-font-macro CW CR
1362 .\" underline a word
1363 .de UL
1364 \Z'\\$1'\v'.25m'\D'l \w'\\$1'u 0'\v'-.25m'\\$2
1366 .\" box a word
1367 .de BX
1368 .nr par*bxw \w'\\$1'+.4m
1369 \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''\
1370 \Z'\h'.2m'\\$1'\
1371 \h'\\n[par*bxw]u'
1373 .\" The first time UX is used, put a registered mark after it.
1374 .ds par*ux-rg \(rg
1375 .de UX
1376 \s[\\n[.s]*8u/10u]UNIX\s0\\$1\\*[par*ux-rg]
1377 .ds par*ux-rg
1379 .ds par@sup-start \v'-.9m\s'\En[.s]*7u/10u'+.7m'
1380 .als { par@sup-start
1381 .ds par@sup-end \v'-.7m\s0+.9m'
1382 .als } par@sup-end
1383 .\" footnote paragraphs
1384 .\" FF is the footnote format
1385 .nr FF 0
1386 .\" This can be redefined. It gets a second argument of `no' if the first
1387 .\" argument was supplied by the user, rather than automatically.
1388 .de FP
1390 .if !d par*fp!\\n[FF] \{\
1391 .       @error unknown footnote format `\\n[FF]'
1392 .       nr FF 0
1394 .ie '\\$2'no' .par*fp!\\n[FF]-no "\\$1"
1395 .el .par*fp!\\n[FF] "\\$1"
1397 .de par*fp!0
1398 .@PP
1399 \&\\*[par@sup-start]\\$1\\*[par@sup-end]\ \c
1401 .de par*fp!0-no
1402 .@PP
1403 \&\\$1\ \c
1405 .de par*fp!1
1406 .@PP
1407 \&\\$1.\ \c
1409 .de par*fp!1-no
1410 .@PP
1411 \&\\$1\ \c
1413 .de par*fp!2
1414 .@LP
1415 \&\\$1.\ \c
1417 .de par*fp!2-no
1418 .@LP
1419 \&\\$1\ \c
1421 .de par*fp!3
1422 .@IP "\\$1." (u;\\n[\\n[.ev]:PI]*2)
1424 .de par*fp!3-no
1425 .@IP "\\$1" (u;\\n[\\n[.ev]:PI]*2)
1427 .\" ***************************
1428 .\" ******** module nh ********
1429 .\" ***************************
1430 .\" Numbered headings.
1431 .\" nh*hl is the level of the last heading
1432 .nr nh*hl 0
1433 .\" numbered heading
1434 .de @NH
1435 .HTML-TAG ".NH \\$1"
1436 .ie '\\$1'S' \{\
1437 .       shift
1438 .       nr nh*hl 0
1439 .       while \\n[.$] \{\
1440 .               nr nh*hl +1
1441 .               nr H\\n[nh*hl] 0\\$1
1442 .               shift
1443 .       \}
1444 .       if !\\n[nh*hl] \{\
1445 .               nr H1 1
1446 .               nr nh*hl 1
1447 .               @error missing arguments to .NH S
1448 .       \}
1450 .el \{\
1451 .       nr nh*ohl \\n[nh*hl]
1452 .       ie \\n[.$] \{\
1453 .               nr nh*hl 0\\$1
1454 .               ie \\n[nh*hl]<=0 \{\
1455 .                       nr nh*ohl 0
1456 .                       nr nh*hl 1
1457 .               \}
1458 .               el \{\
1459 .                       if \\n[nh*hl]-\\n[nh*ohl]>1 \
1460 .                               @warning .NH \\n[nh*ohl] followed by .NH \\n[nh*hl]
1461 .               \}
1462 .       \}
1463 .       el .nr nh*hl 1
1464 .       while \\n[nh*hl]>\\n[nh*ohl] \{\
1465 .               nr nh*ohl +1
1466 .               nr H\\n[nh*ohl] 0
1467 .       \}
1468 .       nr H\\n[nh*hl] +1
1470 .ds SN
1471 .nr nh*i 0
1472 .while \\n[nh*i]<\\n[nh*hl] \{\
1473 .       nr nh*i +1
1474 .       as SN \\n[H\\n[nh*i]].
1477 \\*[SN]
1479 .\" ****************************
1480 .\" ******** module toc ********
1481 .\" ****************************
1482 .\" Table of contents generation.
1483 .de @XS
1484 .da toc*div
1485 .ev h
1486 .ie \\n[.$] .XA "\\$1"
1487 .el .XA
1489 .de @div-end!toc*div
1492 .de XA
1493 .ie '\\n(.z'toc*div' \{\
1494 .       if d toc*num .toc*end-entry
1495 .       ie \\n[.$] \{\
1496 .               ie '\\$1'no' .ds toc*num
1497 .               el .ds toc*num "\\$1
1498 .       \}
1499 .       el .ds toc*num \\n[PN]
1500 .       br
1501 .       par@reset
1502 .       na
1503 .       ll -8n
1504 .       in (n;0\\$2)
1506 .el .@error XA without XS
1508 .de XE
1509 .ie '\\n(.z'toc*div' \{\
1510 .       if d toc*num .toc*end-entry
1511 .       ev
1512 .       di
1514 .el .@error XS without XE
1516 .de toc*end-entry
1517 \\a\\t\\*[toc*num]
1519 .rm toc*num
1521 .de PX
1523 .if !'\\$1'no' \{\
1524 .       ce 1
1525 .       ps \\n[PS]+2
1526 .       ft B
1527 \\*[TOC]
1528 .       ft
1529 .       ps
1532 .char \[toc*leader-char] .\h'1m'
1533 .lc \[toc*leader-char]
1534 .ta (u;\\n[.l]-\\n[.i]-\w'000') (u;\\n[.l]-\\n[.i])R
1535 .sp 2
1536 .toc*div
1537 .par@reset
1539 .\" print the table of contents on page i
1540 .de TC
1542 .pg@begin 1 i
1543 .PX \\$1
1545 .\" ****************************
1546 .\" ******** module eqn ********
1547 .\" ****************************
1548 .\" Eqn support.
1549 .de EQ
1551 .de EN
1553 .de @EQ
1555 .ds eqn*num "\\$2
1556 .ie '\\$1'L' .nr eqn*type 0
1557 .el \{\
1558 .       ie '\\$1'I' .nr eqn*type 1
1559 .       el \{\
1560 .               nr eqn*type 2
1561 .               if !'\\$1'C' .ds eqn*num "\\$1
1562 .       \}
1564 .di eqn*div
1565 .in 0
1566 .if \\n[eqn*type]=0 .HTML-IMAGE-LEFT
1567 .if \\n[eqn*type]=1 \{\
1568 .   if '\*(.T'html' .RS
1569 .   HTML-IMAGE-INLINE
1571 .if \\n[eqn*type]=2 .HTML-IMAGE
1572 .if !'\*(.T'html' .nf
1574 .de @div-end!eqn*div
1575 .@EN
1577 .\" Note that geqn mark and lineup work correctly in centered equations.
1578 .de @EN
1579 .ie !'\\n(.z'eqn*div' .@error-recover mismatched EN
1580 .el \{\
1581 .       br
1582 .       di
1583 .       nr eqn*have-num 0
1584 .       if !'\\*[eqn*num]'' .nr eqn*have-num 1
1585 .       ie \\n[dl]:\\n[eqn*have-num] \{\
1586 .               if !'\*(.T'html' .sp \\n[DD]u
1587 .               par@reset
1588 .               ds eqn*tabs \\n[.tabs]
1589 .               nf
1590 .               ie \\n[dl] \{\
1591 .\"                     --fixme-- this really should not be necessary
1592 .\"                     and indicates that there is extra space creeping into
1593 .\"                     an equation when ps4html is enabled..
1594 .                       ie r ps4html .ds@need \\n[dn]u-1v+\n[.V]u+1i
1595 .                       el .ds@need \\n[dn]u-1v+\n[.V]u
1596 .                       chop eqn*div
1597 .                       ie \\n[eqn*type]=0 \{\
1598 .                               ta (u;\\n[.l]-\\n[.i])R
1599 \\*[eqn*div]\t\\*[eqn*num]
1600 .                       \}
1601 .                       el \{\
1602 .                               ie \\n[eqn*type]=1 .ta \\n[DI]u \
1603 (u;\\n[.l]-\\n[.i])R
1604 .                               el .ta (u;\\n[.l]-\\n[.i]/2)C \
1605 (u;\\n[.l]-\\n[.i])R
1606 \t\\*[eqn*div]\t\\*[eqn*num]
1607 .                       \}
1608 .               \}
1609 .               el \{\
1610 .                       ta (u;\\n[.l]-\\n[.i])R
1611 \t\\*[eqn*num]
1612 .               \}
1613 .               if !'\*(.T'html' .sp \\n[DD]u
1614 .               ta \\*[eqn*tabs]
1615 .       \}
1616 .       el \{
1617 .\" must terminate empty equations in html and ps4html as they contain
1618 .\" the HTML-IMAGE-END suppression nodes
1619 .               if \\n[dl] .chop eqn*div
1620 .               if '\*(.T'html' \\*[eqn*div]
1621 .               if r ps4html    \\*[eqn*div]
1622 .       \}
1623 .       if !'\*(.T'html' .fi
1624 .       if \\n[eqn*type]=0 .HTML-IMAGE-END
1625 .       if \\n[eqn*type]=1 \{\
1626 .               HTML-IMAGE-END
1627 .               if '\*(.T'html' .RE
1628 .       \}
1629 .       if \\n[eqn*type]=2 .HTML-IMAGE-END
1632 .\" ****************************
1633 .\" ******** module tbl ********
1634 .\" ****************************
1635 .\" Tbl support.
1636 .nr tbl*have-header 0
1637 .\" This gets called if TS occurs before the first paragraph.
1638 .de TS
1640 .\" cov*ab-init aliases TS to @TS
1641 \\*[TS]\\
1643 .de @TS
1644 .sp \\n[DD]u
1645 .\" .if !'\*(.T'html' .sp \\n[DD]u
1646 .if '\\$1'H' .di tbl*header-div
1647 .HTML-IMAGE
1649 .de tbl@top-hook
1650 .if \\n[tbl*have-header] \{\
1651 .       ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl*print-header
1652 .       el .sp \\n[.t]u
1655 .de tbl*print-header
1656 .ev nf
1657 .tbl*header-div
1659 .mk #T
1661 .de TH
1662 .ie '\\n[.z]'tbl*header-div' \{\
1663 .       nr T. 0
1664 .       T#
1665 .       br
1666 .       di
1667 .       ie \\n[dn]+\\n[FM]+\\n[HM]+2v>=\\n[.p] \{\
1668 .               @error ridiculously long table header
1669 .               ds@need \\n[dn]
1670 .               tbl*print-header
1671 .       \}
1672 .       el \{\
1673 .               nr tbl*header-ht \\n[dn]
1674 .               ds@need \\n[dn]u+1v
1675 .               tbl*print-header
1676 .               nr tbl*have-header 1
1677 .       \}
1679 .el .@error-recover .TH without .TS H
1681 .de @div-end!tbl*header-div
1685 .de TE
1686 .ie '\\n(.z'tbl*header-div' .@error-recover .TS H but no .TH before .TE
1687 .el \{\
1688 .       nr tbl*have-header 0
1689 .       if !'\*(.T'html' .sp \\n[DD]u
1691 .       HTML-IMAGE-END
1692 .\" reset tabs
1695 .de tbl@bottom-hook
1696 .if \\n[tbl*have-header] \{\
1697 .       nr T. 1
1698 .       T#
1701 .de T&
1703 .\" ****************************
1704 .\" ******** module pic ********
1705 .\" ****************************
1706 .\" Pic support.
1707 .\" PS height width
1708 .de PS
1710 .sp \\n[DD]u
1711 .ie \\n[.$]<2 .@error bad arguments to PS (not preprocessed with pic?)
1712 .el \{\
1713 .       ds@need (u;\\$1)+1v
1714 .       in +(u;\\n[.l]-\\n[.i]-\\$2/2>?0)
1716 .HTML-IMAGE
1718 .de PE
1719 .HTML-IMAGE-END
1720 .par@reset
1721 .sp \\n[DD]u+.5m
1723 .\" ****************************
1724 .\" ******** module ref ********
1725 .\" ****************************
1726 .\" Refer support.
1727 .de ]-
1728 .rm [A [B [C [D [E [G [I [J [N [O [P [Q [R [S [T [V
1729 .rm ref*string
1731 .\" Other
1732 .ds ref*spec!0 Q A T1 S V N P I C D O
1733 .\" Journal article
1734 .ds ref*spec!1 Q A T2 J S V N P I C D O
1735 .\" Book
1736 .ds ref*spec!2 Q A T1 S V P I C D O
1737 .\" Article within book
1738 .ds ref*spec!3 Q A T2 B E S V P I C D O
1739 .\" Tech report
1740 .ds ref*spec!4 Q A T2 R G P I C D O
1741 .\" ][ type
1742 .de ][
1743 .if r [T \{\
1744 .       als [T1 [T
1745 .       als [T2 [T
1747 .ie d ref*spec!\\$1 .ref*build \\*[ref*spec!\\$1]
1748 .el \{\
1749 .       @error unknown reference type `\\$1'
1750 .       ref*build \\*[ref*spec!0]
1752 .ref*print
1753 .rm ref*string
1754 .rm [F [T1 [T2
1756 .\" start of reference number
1757 .ds [. \\*[par@sup-start]
1758 .\" end of reference number
1759 .ds .] \\*[par@sup-end]
1760 .\" period before reference
1761 .ds <. .
1762 .\" period after reference
1763 .ds >. \" empty
1764 .\" comma before reference
1765 .ds <, ,
1766 .\" comma after reference
1767 .ds >, \" empty
1768 .\" start collected references
1769 .de ]<
1770 .als ref*print ref*end-print
1772 \&\\*[REFERENCES]
1773 .par@reset
1775 .\" end collected references
1776 .de ]>
1777 .par@finish
1778 .als ref*print ref*normal-print
1780 .de ref*normal-print
1781 .ie d [F .FS "\\*([.\\*([F\\*(.]"
1782 .el .FS \&
1783 \\*[ref*string]
1786 .de ref*end-print
1787 .ie d [F .IP "\\*([F."
1788 .el .XP
1789 \\*[ref*string]
1791 .als ref*print ref*normal-print
1792 .de ref*build
1793 .rm ref*string ref*post-punct
1794 .nr ref*suppress-period 1
1795 .while \\n[.$] \{\
1796 .       if d [\\$1 \{\
1797 .               ie d ref*add-\\$1 .ref*add-\\$1
1798 .               el .ref*add-dflt \\$1
1799 .       \}
1800 .       shift
1802 .\" now add a final period
1803 .ie d ref*string \{\
1804 .       if !\\n[ref*suppress-period] .as ref*string .
1805 .       if d ref*post-punct \{\
1806 .               as ref*string "\\*[ref*post-punct]
1807 .               rm ref*post-punct
1808 .       \}
1810 .el .ds ref*string
1812 .de ref*add-T1
1813 .ref*field T , "\fI" "" "\fP"
1814 .if r [T .nr ref*suppress-period \\n([T
1816 .de ref*add-T2
1817 .ref*field T , "\\*Q" "" "\\*U"
1818 .if r [T .nr ref*suppress-period \\n([T
1820 .de ref*add-P
1821 .ie \\n([P>0 .ref*field P , "pp. "
1822 .el .ref*field P , "p. "
1824 .de ref*add-J
1825 .ref*field J , \fI "" \fP
1827 .de ref*add-D
1828 .ref*field D "" ( )
1830 .de ref*add-E
1831 .ref*field E , "ed. "
1833 .de ref*add-G
1834 .ref*field G "" ( )
1836 .de ref*add-B
1837 .ref*field B "" "in \fI" "" \fP
1839 .de ref*add-O
1840 .ref*field O .
1841 .ie r [O .nr ref*suppress-period \\n([O
1842 .el .nr ref*suppress-period 1
1844 .de ref*add-A
1845 .ref*field A ,
1846 .if r [A .nr ref*suppress-period \\n([A
1848 .de ref*add-dflt
1849 .ref*field \\$1 ,
1851 .\" First argument is the field letter.
1852 .\" Second argument is the punctuation character to use to separate this field
1853 .\" from the previous field.
1854 .\" Third argument is a string with which to prefix this field.
1855 .\" Fourth argument is a string with which to postfix this field.
1856 .\" Fifth argument is a string to add after the punctuation character supplied
1857 .\" by the next field.
1858 .de ref*field
1859 .if d ref*string \{\
1860 .       ie d ref*post-punct \{\
1861 .               as ref*string "\\$2\\*[ref*post-punct] \"
1862 .               rm ref*post-punct
1863 .       \}
1864 .       el .as ref*string "\\$2 \"
1866 .as ref*string "\\$3\\*([\\$1\\$4
1867 .if \\n[.$]>4 .ds ref*post-punct "\\$5
1868 .nr ref*suppress-period 0
1870 .\" ****************************
1871 .\" ******** module acc ********
1872 .\" ****************************
1873 .\" Accents and special characters.
1874 .ds Q \(lq
1875 .ds U \(rq
1876 .ds - \(em
1877 .\" Characters
1878 .\" The idea of this definition is for the top of the 3 to be at the x-height.
1879 .if !c\[yogh] .char \[yogh] \Z'\v'\w'x'*0-\En[rst]u'\s[\En[.s]*8u/10u]\
1880 \v'\w'3'*0+\En[rst]u'3\s0'\h'\w'\s[\En[.s]*8u/10u]3'u'
1881 .\" Accents
1882 .de acc*over-def
1883 .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
1884 \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
1886 .de acc*under-def
1887 .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
1889 .de acc*slash-def
1890 .ds \\$1 \Z'\h'(u;-\En[.w]-\w'\\$2'/2)'\
1891 \v'(u;\En[.cdp]-\En[.cht]+\En[rst]+\En[rsb]/2)'\\$2'
1893 .de acc*prefix-def
1894 .ds \\$1 \Z'\h'(u;\w'x'-\w'\\$2'/2)'\\$2'
1896 .acc*prefix-def ' \'
1897 .acc*prefix-def ` \`
1898 .acc*prefix-def ^ ^
1899 .acc*prefix-def , \(ac
1900 .acc*prefix-def : \(ad
1901 .acc*prefix-def ~ ~
1902 .\" improved accent marks
1903 .de AM
1904 .acc*over-def ' \'
1905 .acc*over-def ` \`
1906 .acc*over-def ^ ^
1907 .acc*over-def ~ ~
1908 .acc*over-def : \(ad
1909 .acc*over-def v \(ah
1910 .acc*over-def _ \(a-
1911 .acc*over-def o \(ao
1912 .acc*under-def , \(ac
1913 .acc*under-def . \s[\En[.s]*8u/10u]\v'.2m'.\v'-.2m'\s0
1914 .acc*under-def hook \(ho
1915 .acc*slash-def / /
1916 .char \[hooko] o\\\\*[hook]
1917 .ds q \[hooko]
1918 .ds 3 \[yogh]
1919 .ds D- \(-D\"                   Icelandic uppercase eth
1920 .ds d- \(Sd\"                   Icelandic lowercase eth
1921 .ds Th \(TP\"                   Icelandic uppercase thorn
1922 .ds th \(Tp\"                   Icelandic lowercase thorn
1923 .ds 8 \(ss\"                    German double s
1924 .ds Ae \(AE\"                   AE ligature
1925 .ds ae \(ae\"                   ae ligature
1926 .ds Oe \(OE\"                   OE ligature
1927 .ds oe \(oe\"                   oe ligature
1928 .ds ? \(r?\"                    upside down ?
1929 .ds ! \(r!\"                    upside down !
1931 .de CHECK-FOOTER-AND-KEEP
1932 .\" it might be better to als FS -> B1 and FE -> B2
1933 .\" however this produced wierd results, so I've moved back to a more reliable
1934 .\" but less interesting solution --fixme--
1935 .   if '\*(.T'html' \{\
1936 .       rm KF
1937 .       als KF KS
1938 .       rm FS
1939 .       de FS
1940 .               br
1941 .               HTML-IMAGE
1942 \\..
1943 .       rm FE
1944 .       de FE
1945 .               br
1946 .               HTML-IMAGE-END
1947 \\..
1948 .   \}
1949 .   if r ps4html \{\
1950 .       rm FS
1951 .       de FS
1952 .               br
1953 .               HTML-IMAGE
1954 \\..
1955 .       rm FE
1956 .       de FE
1957 .               br
1958 .               HTML-IMAGE-END
1959 \\..
1960 .   \}
1962 .par@load-init
1963 .\" Make sure that no blank lines creep in at the end of this file.