Update to groffer 0.9.7.
[s-roff.git] / tmac / s.tmac
blobb0aff21f5853a75c68c10b182d807ef1f2f9d6dd
1 .\" -*- nroff -*-
2 .ig
4 s.tmac
6 Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003, 2004
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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 .nr GS 1
35 .de @error
36 .tm \\n(.F:\\n(.c: macro error: \\$*
38 .de @warning
39 .tm \\n(.F:\\n(.c: macro warning: \\$*
41 .de @fatal
42 .ab \\n(.F:\\n(.c: fatal macro error: \\$*
44 .de @not-implemented
45 .@error sorry, \\$0 not implemented
46 .als \\$0 @nop
48 .als TM @not-implemented
49 .als CT @not-implemented
50 .de @nop
52 .de @init
53 .if !rPO .nr PO \\n(.o
54 .\" a non-empty environment
55 .ev ne
57 .ev
58 .ev nf
59 'nf
60 .ev
62 .ds REFERENCES References
63 .ds ABSTRACT ABSTRACT
64 .ds TOC Table of Contents
65 .ds MONTH1 January
66 .ds MONTH2 February
67 .ds MONTH3 March
68 .ds MONTH4 April
69 .ds MONTH5 May
70 .ds MONTH6 June
71 .ds MONTH7 July
72 .ds MONTH8 August
73 .ds MONTH9 September
74 .ds MONTH10 October
75 .ds MONTH11 November
76 .ds MONTH12 December
77 .ds MO \\*[MONTH\n[mo]]
78 .ds DY \n[dy] \*[MO] \n[year]
79 .de ND
80 .if \\n[.$] .ds DY "\\$*
82 .de DA
83 .if \\n[.$] .ds DY "\\$*
84 .ds CF \\*[DY]
86 .\" indexing
87 .de IX
88 .tm \\$1\t\\$2\t\\$3\t\\$4 ... \\n[PN]
90 .\" print an error message and then try to recover
91 .de @error-recover
92 .@error \\$@ (recovering)
93 .nr *pop-count 0
94 .while !'\\n(.z'' \{\
95 .       \"@warning automatically terminating diversion \\n(.z
96 .       ie d @div-end!\\n(.z .@div-end!\\n(.z
97 .       el .*div-end-default
98 .       nr *pop-count +1
99 .       \" ensure that we don't loop forever
100 .       if \\n[*pop-count]>20 .@fatal recovery failed
102 .while !'\\n[.ev]'0' .ev
103 .par@reset-env
104 .par@reset
106 .de *div-end-default
107 .ds *last-div \\n(.z
110 .ev nf
111 .\\*[*last-div]
114 .\" ****************************
115 .\" ******** module cov ********
116 .\" ****************************
117 .\" Cover sheet and first page.
118 .de cov*err-not-after-first-page
119 .@error \\$0 is not allowed after the first page has started
121 .de cov*err-not-before-tl
122 .@error \\$0 is not allowed before TL
124 .de cov*err-not-again
125 .@error \\$0 is not allowed more than once
127 .de cov*err-not-after-ab
128 .@error \\$0 is not allowed after first AB, LP, PP, IP, SH or NH
130 .als AU cov*err-not-before-tl
131 .als AI cov*err-not-before-tl
132 .als AB cov*err-not-before-tl
133 .de cov*first-page-init
134 .rm cov*first-page-init
135 .par@init
136 .als RP cov*err-not-after-first-page
137 .@init
138 .ie \\n[cov*rp-format] \{\
139 .       pg@cs-top
140 .       als FS cov*FS
141 .       als FE cov*FE
143 .el \{\
144 .       pg@top
145 .       als FS @FS
146 .       als FE @FE
148 .wh 0 pg@top
149 .CHECK-FOOTER-AND-KEEP
151 .wh 0 cov*first-page-init
152 .\" This handles the case where FS occurs before TL or LP.
153 .de FS
155 \\*[FS]\\
157 .nr cov*rp-format 0
158 .nr cov*rp-no 0
159 .\" released paper format
160 .de RP
161 .nr cov*rp-format 1
162 .if \\n[.$] .if '\\$1'no' .nr cov*rp-no 1
163 .if rPO .po \\n(POu
164 .pn 0
166 .de TL
168 .als TL cov*err-not-again
169 .rn @AB AB
170 .rn @AU AU
171 .rn @AI AI
172 .if !'\*(.T'html' .di cov*tl-div
173 .par@reset
174 .ft B
175 .ps +2
176 .vs +3p
177 .ll (u;\\n[LL]*5/6)
178 .nr cov*n-au 0
179 .HTML-TAG ".tl"
181 .de @AU
182 .par@reset
183 .if !'\\n(.z'' \{\
184 .       br
185 .       di
187 .nr cov*n-au +1
188 .di cov*au-div!\\n[cov*n-au]
190 .ft I
191 .ps \\n[PS]
193 .de @AI
194 .if !'\*(.T'html' .par@reset
195 .if !'\\n(.z'' \{\
196 .       br
197 .       di
199 .ie !\\n[cov*n-au] .@error AI before AU
200 .el \{\
201 .       di cov*ai-div!\\n[cov*n-au]
202 .       nf
203 .       ft R
204 .       ps \\n[PS]
207 .de LP
208 .if !'\\n[.z]'' \{\
209 .       br
210 .       di
213 .cov*ab-init
214 .cov*print
215 \\*[\\$0]\\
217 .als IP LP
218 .als PP LP
219 .als XP LP
220 .als QP LP
221 .als RS LP
222 .als NH LP
223 .als SH LP
224 .als MC LP
225 .als RT LP
226 .als XS LP
227 .de cov*ab-init
228 .als cov*ab-init @nop
229 .als LP @LP
230 .als IP @IP
231 .als PP @PP
232 .als XP @XP
233 .als RT @RT
234 .als XS @XS
235 .als SH @SH
236 .als NH @NH
237 .als QP @QP
238 .als RS @RS
239 .als RE @RE
240 .als QS @QS
241 .als QE @QE
242 .als MC @MC
243 .als EQ @EQ
244 .als EN @EN
245 .als TS @TS
246 .als AB cov*err-not-after-ab
247 .als AU par@AU
248 .als AI par@AI
249 .als TL par@TL
251 .de @AB
252 .if !'\\n(.z'' \{\
253 .       br
254 .       di
256 .cov*ab-init
257 .if !'\*(.T'html' .di cov*ab-div
258 .par@ab-indent
259 .par@reset
260 .if !'\\$1'no' \{\
261 .       ft I
262 .       ce 1
263 \\*[ABSTRACT]
264 .       sp
265 .       ft R
268 .@PP
269 .if '\*(.T'html' \{\
270 .       cov*tl-au-print
271 .       als cov*tl-au-print @nop
272 .       par@reset-env
273 .       par@reset
274 .       cov*print
277 .de AE
278 .ie '\*(.T'html' \{\
279 .       als AE cov*err-not-again
281 .el \{\
282 .  ie '\\n(.z'cov*ab-div' \{\
283 .       als AE cov*err-not-again
284 .       br
285 .       di
286 .\"     nr cov*ab-height \\n[dn]
287 .       par@reset-env
288 .       par@reset
289 .       cov*print
290 .  \}
291 .  el .@error AE without AB
294 .de @div-end!cov*ab-div
297 .de cov*print
298 .als cov*print @nop
299 .ie d cov*tl-div \{\
300 .       ie \\n[cov*rp-format] .cov*rp-print
301 .       el .cov*draft-print
303 .el \{\
304 .       if \\n[cov*rp-format] \{\
305 .               @warning RP format but no TL
306 .               bp 1
307 .               als FS @FS
308 .               als FE @FE
309 .               CHECK-FOOTER-AND-KEEP
310 .       \}
311 .       br
314 .de cov*rp-print
315 .nr cov*page-length \\n[.p]
316 .pl 1000i
317 .cov*tl-au-print
318 .sp 3
319 .if d cov*ab-div \{\
320 .  if !'\*(.T'html'  .  nf
321 .       cov*ab-div
323 .sp 3
324 .par@reset
325 \\*[DY]
327 .if \\n[cov*fn-height] \{\
328 .       sp |(u;\\n[cov*page-length]-\\n[FM]\
329 -\\n[cov*fn-height]-\\n[fn@sep-dist]>?\\n[nl])
330 .       fn@print-sep
331 .       ev nf
332 .       cov*fn-div
333 .       ev
334 .       ie \\n[cov*rp-no] .rm cov*fn-div
335 .       el \{\
336 .               rn cov*fn-div fn@overflow-div
337 .               nr fn@have-overflow 1
338 .       \}
340 .als FS @FS
341 .als FE @FE
342 .CHECK-FOOTER-AND-KEEP
343 .\" If anything was printed below where the footer line is normally printed,
344 .\" then that's an overflow.
345 .if -\\n[FM]/2+1v+\\n[cov*page-length]<\\n[nl] .@error cover sheet overflow
346 .pl \\n[cov*page-length]u
347 .bp 1
348 .if !\\n[cov*rp-no] .cov*tl-au-print
350 .sp 1
352 .de cov*draft-print
353 .cov*tl-au-print
354 .if d cov*ab-div \{\
355 .       nf
356 .       sp 2
357 .       cov*ab-div
359 .sp 1
361 .de cov*tl-au-print
362 .par@reset
365 .sp 3
366 .ce 9999
367 .if d cov*tl-div .cov*tl-div
368 .nr cov*i 1
369 .nr cov*sp 1v
370 .while \\n[cov*i]<=\\n[cov*n-au] \{\
371 .       sp \\n[cov*sp]u
372 .       cov*au-div!\\n[cov*i]
373 .       ie d cov*ai-div!\\n[cov*i] \{\
374 .               sp .5v  
375 .               cov*ai-div!\\n[cov*i]
376 .               nr cov*sp 1v
377 .       \}
378 .       el .nr cov*sp .5v
379 .       nr cov*i +1
381 .ce 0
383 .nr cov*fn-height 0
384 .nr cov*in-fn 0
385 .\" start of footnote on cover
386 .de cov*FS
387 .if \\n[cov*in-fn] \{\
388 .       @error nested FS
389 .       FE
391 .nr cov*in-fn 1
392 .ev fn
393 .par@reset-env
394 .da cov*fn-div
395 .if !\\n[cov*fn-height] .ns
396 .ie \\n[.$] .FP "\\$1" no
397 .el .@LP
399 .de @div-end!cov*fn-div
400 .cov*FE
402 .\" end of footnote on cover
403 .de cov*FE
404 .ie '\\n(.z'cov*fn-div' \{\
405 .       br
406 .       ev
407 .       di
408 .       nr cov*in-fn 0
409 .       nr cov*fn-height +\\n[dn]
411 .el .@error FE without matching FS
413 .\" ***************************
414 .\" ******** module pg ********
415 .\" ***************************
416 .\" Page-level formatting.
417 .\" > 0 if we have a footnote on the current page
418 .nr pg@fn-flag 0
419 .nr pg@colw 0
420 .nr pg@fn-colw 0
421 .nr HM 1i
422 .nr FM 1i
423 .ds LF
424 .ds CF
425 .ds RF
426 .ds LH
427 .ds CH -\\n[PN]-
428 .ds RH
429 .ds pg*OH '\\*[LH]'\\*[CH]'\\*[RH]'
430 .ds pg*EH '\\*[LH]'\\*[CH]'\\*[RH]'
431 .ds pg*OF '\\*[LF]'\\*[CF]'\\*[RF]'
432 .ds pg*EF '\\*[LF]'\\*[CF]'\\*[RF]'
433 .de OH
434 .ds pg*\\$0 "\\$*
436 .als EH OH
437 .als OF OH
438 .als EF OH
439 .de PT
440 .ie \\n%=1 .if \\n[pg*P1] .tl \\*[pg*OH]
441 .el \{\
442 .       ie o .tl \\*[pg*OH]
443 .       el .tl \\*[pg*EH]
446 .de BT
447 .ie o .tl \\*[pg*OF]
448 .el .tl \\*[pg*EF]
450 .nr pg*P1 0
451 .de P1
452 .nr pg*P1 1
454 .wh -\n[FM]u pg@bottom
455 .wh -\n[FM]u/2u pg*footer
456 .nr MINGW 2n
457 .nr pg@ncols 1
458 .de @MC
459 .if !'\\n(.z'' .error-recover MC while diversion open
461 .ie \\n[pg@ncols]>1 .pg@super-eject
462 .el \{\
463 .       \" flush out any floating keeps
464 .       while \\n[kp@tail]>\\n[kp@head] \{\
465 .               rs
466 .               bp
467 .       \}
469 .ie !\\n(.$ \{\
470 .       nr pg@colw \\n[LL]*7/15
471 .       nr pg*gutw \\n[LL]-(2*\\n[pg@colw])
472 .       nr pg@ncols 2
474 .el \{\
475 .       nr pg@colw (n;\\$1)<?\\n[LL]
476 .       ie \\n[.$]<2 .nr pg*gutw \\n[MINGW]
477 .       el .nr pg*gutw (n;\\$2)
478 .       nr pg@ncols \\n[LL]-\\n[pg@colw]/(\\n[pg@colw]+\\n[pg*gutw])+1
479 .       ie \\n[pg@ncols]>1 \
480 .               nr pg*gutw \\n[LL]-(\\n[pg@ncols]*\\n[pg@colw])/(\\n[pg@ncols]-1)
481 .       el .nr pg*gutw 0
483 .HTML-TAG ".mc \\n[pg@ncols] \\n[pg@colw] \\n[pg*gutw]"
484 .mk pg*col-top
486 .nr pg*col-num 0
487 .nr pg@fn-colw \\n[pg@colw]*5/6
488 .par@reset
490 .de 2C
493 .de 1C
494 .MC \\n[LL]u
496 .\" top of page macro
497 .de pg@top
498 .ch pg*footer -\\n[FM]u/2u
499 .nr PN \\n%
500 .nr pg*col-num 0
501 .nr pg@fn-bottom-margin 0
502 .nr pg*saved-po \\n[PO]
503 .po \\n[PO]u
504 .ev h
505 .par@reset
506 .sp (u;\\n[HM]/2)
508 .sp |\\n[HM]u
509 .if d HD .HD
510 .mk pg@header-bottom
512 .mk pg*col-top
513 .pg*start-col
515 .de pg*start-col
516 .\" Handle footnote overflow before floating keeps, because the keep
517 .\" might contain an embedded footnote.
518 .fn@top-hook
519 .kp@top-hook
520 .tbl@top-hook
523 .de pg@cs-top
524 .sp \\n[HM]u
525 .\" move pg@bottom and pg*footer out of the way
526 .ch pg@bottom \\n[.p]u*2u
527 .ch pg*footer \\n[.p]u*2u
530 .de pg@bottom
531 .tbl@bottom-hook
532 .if \\n[pg@fn-flag] .fn@bottom-hook
533 .nr pg*col-num +1
534 .ie \\n[pg*col-num]<\\n[pg@ncols] .pg*end-col
535 .el .pg*end-page
537 .de pg*end-col
538 'sp |\\n[pg*col-top]u
539 .po (u;\\n[pg*saved-po]+(\\n[pg@colw]+\\n[pg*gutw]*\\n[pg*col-num]))
540 .\"po +(u;\\n[pg@colw]+\\n[pg*gutw])
541 .pg*start-col
543 .de pg*end-page
544 .po \\n[pg*saved-po]u
545 .\" Make sure we don't exit if there are still floats or footnotes left-over.
546 .ie \\n[kp@head]<\\n[kp@tail]:\\n[fn@have-overflow] \{\
547 .       \" Switching environments ensures that we don't get an unnecessary
548 .       \" blank line at the top of the page.
549 .       ev ne
550 '       bp
551 .       ev
553 .el \{\
554 .       \" If the text has ended and there are no more footnotes or keeps, exit.
555 .       if \\n[pg@text-ended] .ex
556 .       if r pg*next-number \{\
557 .               pn \\n[pg*next-number]
558 .               rr pg*next-number
559 .               if d pg*next-format \{\
560 .                       af PN \\*[pg*next-format]
561 .                       rm pg*next-format
562 .               \}
563 .       \}
564 '       bp
567 .\" pg@begin number format
568 .de pg@begin
569 .ie \\n[.$]>0 \{\
570 .       nr pg*next-number (;\\$1)
571 .       ie \\n[.$]>1 .ds pg*next-format \\$2
572 .       el .rm pg*next-format
574 .el .rr pg*next-number
575 .pg@super-eject
577 .\" print the footer line
578 .de pg*footer
579 .ev h
580 .par@reset
584 .\" flush out any keeps or footnotes
585 .de pg@super-eject
587 .if !'\\n(.z'' .@error-recover diversion open while ejecting page
588 .\" Make sure we stay in the end macro while there is still footnote overflow
589 .\" left, or floating keeps.
590 .while \\n[kp@tail]>\\n[kp@head]:\\n[pg@fn-flag] \{\
591 .       rs
592 .       bp
596 .nr pg@text-ended 0
597 .de pg@end-text
599 .nr pg@text-ended 1
600 .pg@super-eject
602 .em pg@end-text
603 .\" ***************************
604 .\" ******** module fn ********
605 .\" ***************************
606 .\" Footnotes.
607 .nr fn@sep-dist 8p
608 .ev fn
609 .\" Round it vertically
610 .vs \n[fn@sep-dist]u
611 .nr fn@sep-dist \n[.v]
613 .nr fn*text-num 0 1
614 .nr fn*note-num 0 1
615 .ds * \\*[par@sup-start]\En+[fn*text-num]\\*[par@sup-end]
616 .nr fn*open 0
617 .\" normal FS
618 .de @FS
619 .ie \\n[.$] .fn*do-FS "\\$1" no
620 .el \{\
621 .       ie \\n[fn*text-num]>\\n[fn*note-num] .fn*do-FS \\n+[fn*note-num]
622 .       el .fn*do-FS
625 .\" Second argument of `no' means don't embellish the first argument.
626 .de fn*do-FS
627 .if \\n[fn*open] .@error-recover nested FS
628 .nr fn*open 1
629 .if \\n[.u] \{\
630 .       \" Ensure that the first line of the footnote is on the same page
631 .       \" as the reference.  I think this is minimal.
632 .       ev fn
633 .       nr fn*need 1v
634 .       ev
635 .       ie \\n[pg@fn-flag] .nr fn*need +\\n[fn:PD]
636 .       el .nr fn*need +\\n[fn@sep-dist]
637 .       ne \\n[fn*need]u+\\n[.V]u>?0
639 .ev fn
640 .par@reset-env
641 .fn*start-div
642 .par@reset
643 .ie \\n[.$] .FP \\$@
644 .el .@LP
646 .de @FE
647 .ie !\\n[fn*open] .@error FE without FS
648 .el \{\
649 .       nr fn*open 0
650 .       br
651 .       ev
652 .       fn*end-div
655 .nr fn@have-overflow 0
656 .\" called at the top of each column
657 .de fn@top-hook
658 .nr fn*max-width 0
659 .nr fn*page-bottom-pos 0-\\n[FM]-\\n[pg@fn-bottom-margin]
660 .ch pg@bottom \\n[fn*page-bottom-pos]u
661 .if \\n[fn@have-overflow] \{\
662 .       nr fn@have-overflow 0
663 .       fn*start-div
664 .       ev nf
665 .       fn@overflow-div
666 .       ev
667 .       fn*end-div
670 .\" This is called at the bottom of the column if pg@fn-flag is set.
671 .de fn@bottom-hook
672 .nr pg@fn-flag 0
673 .nr fn@have-overflow 0
674 .nr fn@bottom-pos \\n[.p]-\\n[FM]-\\n[pg@fn-bottom-margin]+\\n[.v]
675 .ev fn
676 .nr fn@bottom-pos -\\n[.v]
678 .ie \\n[nl]+\\n[fn@sep-dist]+\n[.V]>\\n[fn@bottom-pos] \{\
679 .       rn fn@div fn@overflow-div
680 .       nr fn@have-overflow 1
682 .el \{\
683 .       if \\n[pg@ncols]>1 \
684 .               if \\n[fn*max-width]>\\n[pg@fn-colw] \
685 .                       nr pg@fn-bottom-margin \\n[.p]-\\n[FM]-\\n[nl]+1v
686 .       wh \\n[fn@bottom-pos]u fn*catch-overflow
687 .       fn@print-sep
688 .       ev nf
689 .       fn@div
690 .       rm fn@div
691 .       ev
692 .       if '\\n(.z'fn@overflow-div' \{\
693 .               di
694 .               nr fn@have-overflow \\n[dn]>0
695 .       \}
696 .       ch fn*catch-overflow
699 .de fn*catch-overflow
700 .di fn@overflow-div
702 .nr fn*embed-count 0
703 .de @div-end!fn@div
705 .if '\\n[.ev]'fn' .ev
706 .fn*end-div
707 .nr fn*open 0
709 .als @div-end!fn*embed-div @div-end!fn@div
710 .de fn*start-div
711 .ie '\\n(.z'' \{\
712 .       da fn@div
713 .       if !\\n[pg@fn-flag] .ns
715 .el .di fn*embed-div
717 .de fn*end-div
718 .ie '\\n(.z'fn@div' \{\
719 .       di
720 .       nr fn*page-bottom-pos -\\n[dn]
721 .       nr fn*max-width \\n[fn*max-width]>?\\n[dl]
722 .       if !\\n[pg@fn-flag] .nr fn*page-bottom-pos -\\n[fn@sep-dist]
723 .       nr pg@fn-flag 1
724 .       nr fn*page-bottom-pos \\n[nl]-\\n[.p]+\n[.V]>?\\n[fn*page-bottom-pos]
725 .       ch pg@bottom \\n[fn*page-bottom-pos]u
727 .el \{\
728 .       ie '\\n(.z'fn*embed-div' \{\
729 .       di
730 .               rn fn*embed-div fn*embed-div!\\n[fn*embed-count]
731 \!.             fn*embed-start \\n[fn*embed-count]
732 .               rs
733 '               sp (u;\\n[dn]+\\n[fn@sep-dist]+\\n[.V])
734 \!.             fn*embed-end
735 .               nr fn*embed-count +1
736 .       \}
737 .       el \{\
738 .               ev fn
739 .               @error-recover unclosed diversion within footnote
740 .       \}
743 .de fn*embed-start
744 .ie '\\n(.z'' \{\
745 .       fn*start-div
746 .       ev nf
747 .       fn*embed-div!\\$1
748 .       rm fn*embed-div!\\$1
749 .       ev
750 .       fn*end-div
751 .       di fn*null
753 .el \{\
754 \!.     fn*embed-start \\$1
755 .       rs
758 .de fn*embed-end
759 .ie '\\n(.z'fn*null' \{\
760 .       di
761 .       rm fn*null
763 .el \!.fn*embed-end
765 .\" It's important that fn@print-sep use up exactly fn@sep-dist vertical space.
766 .de fn@print-sep
767 .ev fn
768 .in 0
769 .vs \\n[fn@sep-dist]u
770 \D'l 1i 0'
774 .\" ***************************
775 .\" ******** module kp ********
776 .\" ***************************
777 .\" Keeps.
778 .de KS
780 .di kp*div
782 .de KF
783 .if !'\\n(.z'' .@error-recover KF while open diversion
784 .di kp*fdiv
785 .ev k
786 .par@reset-env
787 .par@reset
789 .de KE
790 .ie '\\n(.z'kp*div' .kp*end
791 .el \{\
792 .       ie '\\n(.z'kp*fdiv' .kp*fend
793 .       el .@error KE without KS or KF
796 .de @div-end!kp*div
797 .kp*end
799 .de @div-end!kp*fdiv
800 .kp*fend
802 .de kp*need
803 .ie '\\n(.z'' .ds@need \\$1
804 .el \!.kp*need \\$1
806 .\" end non-floating keep
807 .de kp*end
810 .kp*need \\n[dn]
811 .ev nf
812 .kp*div
814 .rm kp*div
816 .\" Floating keeps.
817 .nr kp@head 0
818 .nr kp@tail 0
819 .\" end floating keep
820 .de kp*fend
824 .ie \\n[.t]-(\\n[.k]>0*1v)>\\n[dn] \{\
825 .       br
826 .       ev nf
827 .       kp*fdiv
828 .       rm kp*fdiv
829 .       ev
831 .el \{\
832 .       rn kp*fdiv kp*div!\\n[kp@tail]
833 .       nr kp*ht!\\n[kp@tail] 0\\n[dn]
834 .       nr kp@tail +1
837 .\" top of page processing for KF
838 .nr kp*doing-top 0
839 .de kp@top-hook
840 .if !\\n[kp*doing-top] \{\
841 .       nr kp*doing-top 1
842 .       kp*do-top
843 .       nr kp*doing-top 0
846 .de kp*do-top
847 .\" If the first keep won't fit, only force it out if we haven't had a footnote
848 .\" and we're at the top of the page.
849 .nr kp*force \\n[pg@fn-flag]=0&(\\n[nl]<=\\n[pg@header-bottom])
850 .nr kp*fits 1
851 .while \\n[kp@tail]>\\n[kp@head]&\\n[kp*fits] \{\
852 .       ie \\n[.t]>\\n[kp*ht!\\n[kp@head]]:\\n[kp*force] \{\
853 .               nr kp*force 0
854 .               \" It's important to advance kp@head before bringing
855 .               \" back the keep, so that if the last line of the
856 .               \" last keep springs the bottom of page trap, a new
857 .               \" page will not be started unnecessarily.
858 .               rn kp*div!\\n[kp@head] kp*temp
859 .               nr kp@head +1
860 .               ev nf
861 .               kp*temp
862 .               ev
863 .               rm kp*temp
864 .       \}
865 .       el .nr kp*fits 0
868 .\" ***************************
869 .\" ******** module ds ********
870 .\" ***************************
871 .\" Displays and non-floating keeps.
872 .de DE
873 .ds*end!\\n[\\n[.ev]:ds-type]
874 .nr \\n[.ev]:ds-type 0
876 .als De DE
877 .de ds@auto-end
878 .if \\n[\\n[.ev]:ds-type] \{\
879 .       @error automatically terminating display
880 .       DE
883 .de @div-end!ds*div
884 .ie \\n[\\n[.ev]:ds-type] .DE
885 .el .ds*end!2
887 .de ds*end!0
888 .@error DE without DS, ID, CD, LD or BD
890 .de LD
892 .nr \\n[.ev]:ds-type 1
893 .par@reset
895 .sp \\n[DD]u
897 .de ID
899 .ie \\n[.$] .in +(n;\\$1)
900 .el .in +\\n[DI]u
902 .de CD
904 .ce 9999
906 .de RD
908 .rj 9999
910 .de ds*common-end
911 .par@reset
912 .sp \\n[DD]u
914 .als ds*end!1 ds*common-end
915 .de BD
917 .nr \\n[.ev]:ds-type 2
918 .di ds*div
920 .de ds*end!2
922 .ie '\\n(.z'ds*div' \{\
923 .       di
924 .       nf
925 .       in (u;\\n[.l]-\\n[dl]/2>?0)
926 .       ds*div
927 .       rm ds*div
928 .       ds*common-end
930 .el .@error-recover mismatched DE
932 .de DS
934 .di ds*div
935 .ie '\\$1'B' \{\
936 .       LD
937 .       nr \\n[.ev]:ds-type 4
939 .el \{\
940 .       ie '\\$1'L' .LD
941 .       el \{\
942 .               ie '\\$1'C' .CD
943 .               el \{\
944 .                       ie '\\$1'R' .RD
945 .                       el \{\
946 .                               ie '\\$1'I' .ID \\$2
947 .                               el .ID \\$1
948 .                       \}
949 .               \}
950 .       \}
951 .       nr \\n[.ev]:ds-type 3
954 .als Ds DS
955 .de ds@need
956 .if '\\n(.z'' \{\
957 .       while \\n[.t]<=(\\$1)&(\\n[nl]>\\n[pg@header-bottom]) \{\
958 .               rs
959 '               sp \\n[.t]u
960 .       \}
963 .de ds*end!3
965 .ie '\\n(.z'ds*div' \{\
966 .       di
967 .       ds@need \\n[dn]
968 .       ev nf
969 .       ds*div
970 .       ev
971 .       rm ds*div
972 .       ds*common-end
974 .el .@error-recover mismatched DE
976 .de ds*end!4
977 .ie '\\n(.z'ds*div' \{\
978 .       br
979 .       di
980 .       nf
981 .       in (u;\\n[.l]-\\n[dl]/2>?0)
982 .       ds@need \\n[dn]
983 .       ds*div
984 .       rm ds*div
985 .       ds*common-end
987 .el .@error-recover mismatched DE
989 .\" ****************************
990 .\" ******** module par ********
991 .\" ****************************
992 .\" Paragraph-level formatting.
993 .\" Load time initialization.
994 .de par@load-init
995 .\" PS and VS might have been set on the command-line
996 .if !rPS .nr PS 10
997 .if !rLL .nr LL 6i
998 .ll \\n[LL]u
999 .\" don't set LT so that it can be defaulted from LL
1000 .ie rLT .lt \\n[LT]u
1001 .el .lt \\n[LL]u
1002 .ps \\n[PS]
1003 .\" don't set VS so that it can be defaulted from PS
1004 .ie rVS .par*vs \\n[VS]
1005 .el .par*vs \\n[PS]+2
1006 .if dFAM .fam \\*[FAM]
1007 .if !rHY .nr HY 14
1008 .hy \\n[HY]
1010 .CHECK-FOOTER-AND-KEEP
1012 .de par*vs
1013 .\" If it's too big to be in points, treat it as units.
1014 .ie (p;\\$1)>=40p .vs (u;\\$1)
1015 .el .vs (p;\\$1)
1017 .de par@ab-indent
1018 .nr 0:li (u;\\n[LL]/12)
1019 .nr 0:ri \\n[0:li]
1021 .de par*env-init
1022 .aln \\n[.ev]:PS PS
1023 .aln \\n[.ev]:VS VS
1024 .aln \\n[.ev]:LL LL
1025 .aln \\n[.ev]:MCLL LL
1026 .aln \\n[.ev]:LT LT
1027 .aln \\n[.ev]:MCLT LT
1028 .aln \\n[.ev]:PI PI
1029 .aln \\n[.ev]:PD PD
1030 .ad \\n[par*adj]
1031 .par@reset-env
1033 .\" happens when the first page begins
1034 .de par@init
1035 .if !rLT .nr LT \\n[LL]
1036 .if !rFL .nr FL \\n[LL]*5/6
1037 .if !rVS .nr VS \\n[PS]+2
1038 .if !rDI .nr DI .5i
1039 .if !rFPS .nr FPS \\n[PS]-2
1040 .if !rFVS .nr FVS \\n[FPS]+2
1041 .\" don't change environment 0
1042 .ev h
1043 .ps \\n[PS]
1044 .if !rQI .nr QI 5n
1045 .if !rPI .nr PI 5n
1046 .par*vs \\n[VS]
1047 .if !rPD .nr PD .3v>?\n(.V
1048 .if !rDD .nr DD .5v>?\n(.V
1049 .if !rFI .nr FI 2n
1050 .if !rFPD .nr FPD \\n[PD]/2
1052 .if !dFAM .ds FAM \\n[.fam]
1053 .nr par*adj \\n[.j]
1054 .par*env-init
1055 .ev h
1056 .par*env-init
1058 .ev fn
1059 .par*env-init
1061 .ev k
1062 .par*env-init
1064 .aln 0:MCLL pg@colw
1065 .aln 0:MCLT pg@colw
1066 .aln k:MCLL pg@colw
1067 .aln k:MCLT pg@colw
1068 .aln fn:PS FPS
1069 .aln fn:VS FVS
1070 .aln fn:LL FL
1071 .aln fn:LT FL
1072 .aln fn:PI FI
1073 .aln fn:PD FPD
1074 .aln fn:MCLL pg@fn-colw
1075 .aln fn:MCLT pg@fn-colw
1077 .de par@reset-env
1078 .nr \\n[.ev]:il 0
1079 .nr \\n[.ev]:li 0
1080 .nr \\n[.ev]:ri 0
1081 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1082 .nr \\n[.ev]:pli 0
1083 .nr \\n[.ev]:pri 0
1084 .nr \\n[.ev]:ds-type 0
1086 .\" par@reset
1087 .de par@reset
1089 .ce 0
1090 .rj 0
1091 .ul 0
1093 .ie \\n[pg@ncols]>1 \{\
1094 .       ll (u;\\n[\\n[.ev]:MCLL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1095 .       lt \\n[\\n[.ev]:MCLT]u
1097 .el \{\
1098 .       ll (u;\\n[\\n[.ev]:LL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1099 .       lt \\n[\\n[.ev]:LT]u
1101 .in (u;\\n[\\n[.ev]:li]+\\n[\\n[.ev]:pli])
1102 .ft 1
1103 .fam \\*[FAM]
1104 .ps \\n[\\n[.ev]:PS]
1105 .par*vs \\n[\\n[.ev]:VS]
1106 .ls 1
1108 .hy \\n[HY]
1110 .de @RT
1111 .nr \\n[.ev]:pli 0
1112 .nr \\n[.ev]:pri 0
1113 .par@reset
1115 .\" This can be redefined by the user.
1116 .de TA
1117 .ta T 5n
1119 .de par*start
1120 .ds@auto-end
1121 .nr \\n[.ev]:pli \\$1
1122 .nr \\n[.ev]:pri \\$2
1123 .par@reset
1124 .sp \\n[\\n[.ev]:PD]u
1125 .ne 1v+\\n(.Vu
1127 .de par@finish
1128 .nr \\n[.ev]:pli 0
1129 .nr \\n[.ev]:pri 0
1130 .par@reset
1132 .\" normal LP
1133 .de @LP
1134 .par*start 0 0
1135 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1137 .de @PP
1138 .par*start 0 0
1139 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1140 .if !'\*(.T'html' .ti +\\n[\\n[.ev]:ai]u
1142 .de @QP
1143 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1144 .par*start \\n[QI] \\n[QI]
1146 .de @XP
1147 .par*start \\n[\\n[.ev]:PI] 0
1148 .ti -\\n[\\n[.ev]:PI]u
1150 .de @IP
1151 .if \\n[.$]>1 .nr \\n[.ev]:ai (n;\\$2)
1152 .par*start \\n[\\n[.ev]:ai] 0
1153 .if !'\\$1'' \{\
1154 .       \" Divert the label so as to freeze any spaces.
1155 .       di par*label
1156 .       par*push-tag-env
1157 \&\\$1
1158 .       par*pop-tag-env
1159 .       di
1160 .       chop par*label
1161 .       ti -\\n[\\n[.ev]:ai]u
1162 .       ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \\*[par*label]\h'|\\n[\\n[.ev]:ai]u'\c
1163 .       el \{\
1164 \\*[par*label]
1165 .               br
1166 .       \}
1167 .       rm par*label
1170 .de @IP-html
1171 .if \\n[.$]>1 .nr \\n[.ev]:ai (n;\\$2)
1172 .par*start \\n[\\n[.ev]:ai] 0
1173 .if !'\\$1'' \{\
1174 .       \" Divert the label so as to freeze any spaces.
1175 .       di par*label
1176 .       par*push-tag-env
1177 \&\\$1
1178 .       par*pop-tag-env
1179 .       di
1180 .       chop par*label
1181 .       ti -\\n[\\n[.ev]:ai]u
1182 .       ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \{\
1183 .               HTML-TAG-NS ".col 1"
1184 \\$1\h'|\\n[\\n[.ev]:ai]u'\c
1185 .               HTML-TAG-NS ".col 2"
1186 .       \}
1187 .       el \{\
1188 \\$1
1189 .               br
1190 .       \}
1191 .       rm par*label
1194 .\" We don't want margin characters to be attached when we divert
1195 .\" the tag.  Since there's no way to save and restore the current
1196 .\" margin character, we have to switch to a new environment, taking
1197 .\" what we need of the old environment with us.
1198 .de par*push-tag-env
1199 .nr par*saved-font \\n[.f]
1200 .nr par*saved-size \\n[.s]z
1201 .nr par*saved-ss \\n[.ss]
1202 .ds par*saved-fam \\n[.fam]
1203 .ev par
1206 .ft \\n[par*saved-font]
1207 .ps \\n[par*saved-size]u
1208 .ss \\n[par*saved-ss]
1209 .fam \\*[par*saved-fam]
1211 .de par*pop-tag-env
1214 .de @RS
1216 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1217 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1218 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1219 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1220 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1221 .nr \\n[.ev]:il +1
1222 .nr \\n[.ev]:li +\\n[\\n[.ev]:ai]
1223 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1224 .par@reset
1226 .de @RE
1228 .ie \\n[\\n[.ev]:il] \{\
1229 .       nr \\n[.ev]:il -1
1230 .       nr \\n[.ev]:ai \\n[\\n[.ev]:ai!\\n[\\n[.ev]:il]]
1231 .       nr \\n[.ev]:li \\n[\\n[.ev]:li!\\n[\\n[.ev]:il]]
1232 .       nr \\n[.ev]:ri \\n[\\n[.ev]:ri!\\n[\\n[.ev]:il]]
1233 .       nr \\n[.ev]:pli \\n[\\n[.ev]:pli!\\n[\\n[.ev]:il]]
1234 .       nr \\n[.ev]:pri \\n[\\n[.ev]:pri!\\n[\\n[.ev]:il]]
1236 .el .@error unbalanced \\$0
1237 .par@reset
1239 .de @QS
1241 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1242 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1243 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1244 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1245 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1246 .nr \\n[.ev]:il +1
1247 .nr \\n[.ev]:li +\\n[QI]
1248 .nr \\n[.ev]:ri +\\n[QI]
1249 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1250 .par@reset
1252 .als @QE @RE
1253 .\" start boxed text
1254 .de B1
1256 .HTML-IMAGE
1257 .di par*box-div
1258 .nr \\n[.ev]:li +1n
1259 .nr \\n[.ev]:ri +1n
1260 .nr par*box-in \\n[.in]
1261 .\" remember what 1n is, just in case the point size changes
1262 .nr par*box-n 1n
1263 .in +1n
1264 .ll -1n
1265 .lt -1n
1266 .ti \\n[par*box-in]u+1n
1268 .de @div-end!par*box-div
1271 .\" end boxed text
1272 .\" Postpone the drawing of the box until we're in the top-level diversion,
1273 .\" in case there's a footnote inside the box.
1274 .de B2
1275 .ie '\\n(.z'par*box-div' \{\
1276 .       br
1277 .       if \n[.V]>.25m .sp
1278 .       di
1279 .       if \n[.V]>.25m .sp
1280 .       ds@need \\n[dn]
1281 .       par*box-mark-top
1282 .       ev nf
1283 .       par*box-div
1284 .       ev
1285 .       nr \\n[.ev]:ri -\\n[par*box-n]
1286 .       nr \\n[.ev]:li -\\n[par*box-n]
1287 .       in -\\n[par*box-n]u
1288 .       ll +\\n[par*box-n]u
1289 .       lt +\\n[par*box-n]u
1290 .       par*box-draw \\n[.i]u \\n[.l]u-(\\n[.H]u==1n*1n)
1292 .el .@error B2 without B1
1293 .HTML-IMAGE-END
1295 .de par*box-mark-top
1296 .ie '\\n[.z]'' \{\
1297 .       rs
1298 .       mk par*box-top
1300 .el \!.par*box-mark-top
1302 .de par*box-draw
1303 .ie '\\n[.z]'' \{\
1304 .       nr par*box-in \\n[.i]
1305 .       nr par*box-ll \\n[.l]
1306 .       nr par*box-vpt \\n[.vpt]
1307 .       nr par*box-ad \\n[.j]
1308 .       ad l
1309 .       vpt 0
1310 .       in \\$1
1311 .       ll \\$2
1312 \v'-1v+.25m'\
1313 \D'l (u;\\n[.l]-\\n[.i]) 0'\
1314 \D'l 0 |\\n[par*box-top]u'\
1315 \D'l -(u;\\n[.l]-\\n[.i]) 0'\
1316 \D'l 0 -|\\n[par*box-top]u'
1317 .       br
1318 .       sp -1
1319 .       in \\n[par*box-in]u
1320 .       ll \\n[par*box-ll]u
1321 .       vpt \\n[par*box-vpt]
1322 .       ad \\n[par*box-ad]
1324 .el \!.par*box-draw \\$1 \\$2
1326 .de SH-NO-TAG
1327 .par@finish
1328 .\" Keep together the heading and the first two lines of the next paragraph.
1329 .ne 3v+\\n[\\n[.ev]:PD]u+\\n(.Vu
1330 .sp 1
1331 .ft B
1333 .de @SH
1334 .  SH-NO-TAG
1335 .  HTML-TAG ".SH 1"
1337 .\" TL, AU, and AI are aliased to these in cov*ab-init.
1338 .de par@TL
1339 .par@finish
1340 .sp 1
1341 .ft B
1342 .ps +2
1343 .vs +3p
1344 .ce 9999
1345 .HTML-TAG ".tl"
1347 .de par@AU
1348 .par@finish
1349 .sp 1
1350 .ft I
1351 .ce 9999
1353 .de par@AI
1354 .par@finish
1355 .sp .5
1356 .ce 9999
1358 .\" In paragraph macros.
1359 .de NL
1360 .ps \\n[\\n[.ev]:PS]
1362 .de SM
1363 .ps -2
1365 .de LG
1366 .ps +2
1368 .de R
1369 .ft R
1371 .\" par*define-font-macro macro font
1372 .de par*define-font-macro
1373 .de \\$1
1374 .ie \\\\n[.$] \{\
1375 .       nr par*prev-font \\\\n[.f]
1376 \&\\\\$3\f[\\$2]\\\\$1\f[\\\\n[par*prev-font]]\\\\$2
1378 .el .ft \\$2
1379 \\..
1381 .par*define-font-macro B B
1382 .par*define-font-macro I I
1383 .par*define-font-macro BI BI
1384 .par*define-font-macro CW CR
1385 .\" underline a word
1386 .de UL
1387 \Z'\\$1'\v'.25m'\D'l \w'\\$1'u 0'\v'-.25m'\\$2
1389 .\" box a word
1390 .de BX
1391 .nr par*bxw \w'\\$1'+.4m
1392 \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''\
1393 \Z'\h'.2m'\\$1'\
1394 \h'\\n[par*bxw]u'
1396 .\" The first time UX is used, put a registered mark after it.
1397 .ds par*ux-rg \(rg
1398 .de UX
1399 \s[\\n[.s]*8u/10u]UNIX\s0\\$1\\*[par*ux-rg]
1400 .ds par*ux-rg
1402 .ds par@sup-start \v'-.9m\s'\En[.s]*7u/10u'+.7m'
1403 .als { par@sup-start
1404 .ds par@sup-end \v'-.7m\s0+.9m'
1405 .als } par@sup-end
1406 .\" footnote paragraphs
1407 .\" FF is the footnote format
1408 .nr FF 0
1409 .\" This can be redefined. It gets a second argument of `no' if the first
1410 .\" argument was supplied by the user, rather than automatically.
1411 .de FP
1413 .if !d par*fp!\\n[FF] \{\
1414 .       @error unknown footnote format `\\n[FF]'
1415 .       nr FF 0
1417 .ie '\\$2'no' .par*fp!\\n[FF]-no "\\$1"
1418 .el .par*fp!\\n[FF] "\\$1"
1420 .de par*fp!0
1421 .@PP
1422 \&\\*[par@sup-start]\\$1\\*[par@sup-end]\ \c
1424 .de par*fp!0-no
1425 .@PP
1426 \&\\$1\ \c
1428 .de par*fp!1
1429 .@PP
1430 \&\\$1.\ \c
1432 .de par*fp!1-no
1433 .@PP
1434 \&\\$1\ \c
1436 .de par*fp!2
1437 .@LP
1438 \&\\$1.\ \c
1440 .de par*fp!2-no
1441 .@LP
1442 \&\\$1\ \c
1444 .de par*fp!3
1445 .@IP "\\$1." (u;\\n[\\n[.ev]:PI]*2)
1447 .de par*fp!3-no
1448 .@IP "\\$1" (u;\\n[\\n[.ev]:PI]*2)
1450 .\" ***************************
1451 .\" ******** module nh ********
1452 .\" ***************************
1453 .\" Numbered headings.
1454 .\" nh*hl is the level of the last heading
1455 .nr nh*hl 0
1456 .\" numbered heading
1457 .de @NH
1458 .ie '\\$1'S' \{\
1459 .       shift
1460 .       nr nh*hl 0
1461 .       while \\n[.$] \{\
1462 .               nr nh*hl +1
1463 .               nr H\\n[nh*hl] 0\\$1
1464 .               shift
1465 .       \}
1466 .       if !\\n[nh*hl] \{\
1467 .               nr H1 1
1468 .               nr nh*hl 1
1469 .               @error missing arguments to .NH S
1470 .       \}
1472 .el \{\
1473 .       nr nh*ohl \\n[nh*hl]
1474 .       ie \\n[.$] \{\
1475 .               nr nh*hl 0\\$1
1476 .               ie \\n[nh*hl]<=0 \{\
1477 .                       nr nh*ohl 0
1478 .                       nr nh*hl 1
1479 .               \}
1480 .               el \{\
1481 .                       if \\n[nh*hl]-\\n[nh*ohl]>1 \
1482 .                               @warning .NH \\n[nh*ohl] followed by .NH \\n[nh*hl]
1483 .               \}
1484 .       \}
1485 .       el .nr nh*hl 1
1486 .       while \\n[nh*hl]>\\n[nh*ohl] \{\
1487 .               nr nh*ohl +1
1488 .               nr H\\n[nh*ohl] 0
1489 .       \}
1490 .       nr H\\n[nh*hl] +1
1492 .ds SN
1493 .nr nh*i 0
1494 .while \\n[nh*i]<\\n[nh*hl] \{\
1495 .       nr nh*i +1
1496 .       as SN \\n[H\\n[nh*i]].
1498 .SH-NO-TAG
1499 .HTML-TAG ".NH \\$1"
1500 \\*[SN]
1502 .\" ****************************
1503 .\" ******** module toc ********
1504 .\" ****************************
1505 .\" Table of contents generation.
1506 .de @XS
1507 .da toc*div
1508 .ev h
1509 .ie \\n[.$] .XA "\\$1"
1510 .el .XA
1512 .de @div-end!toc*div
1515 .de XA
1516 .ie '\\n(.z'toc*div' \{\
1517 .       if d toc*num .toc*end-entry
1518 .       ie \\n[.$] \{\
1519 .               ie '\\$1'no' .ds toc*num
1520 .               el .ds toc*num "\\$1
1521 .       \}
1522 .       el .ds toc*num \\n[PN]
1523 .       br
1524 .       par@reset
1525 .       na
1526 .       ll -8n
1527 .       in (n;0\\$2)
1529 .el .@error XA without XS
1531 .de XE
1532 .ie '\\n(.z'toc*div' \{\
1533 .       if d toc*num .toc*end-entry
1534 .       ev
1535 .       di
1537 .el .@error XE without XS
1539 .de toc*end-entry
1540 \\a\\t\\*[toc*num]
1542 .rm toc*num
1544 .de PX
1546 .if !'\\$1'no' \{\
1547 .       ce 1
1548 .       ps \\n[PS]+2
1549 .       ft B
1550 \\*[TOC]
1551 .       ft
1552 .       ps
1555 .char \[toc*leader-char] .\h'1m'
1556 .lc \[toc*leader-char]
1557 .ta (u;\\n[.l]-\\n[.i]-\w'000') (u;\\n[.l]-\\n[.i])R
1558 .sp 2
1559 .toc*div
1560 .par@reset
1562 .\" print the table of contents on page i
1563 .de TC
1565 .pg@begin 1 i
1566 .PX \\$1
1568 .\" ****************************
1569 .\" ******** module eqn ********
1570 .\" ****************************
1571 .\" Eqn support.
1572 .de EQ
1574 .de EN
1576 .de @EQ
1578 .ds eqn*num "\\$2
1579 .ie '\\$1'L' .nr eqn*type 0
1580 .el \{\
1581 .       ie '\\$1'I' .nr eqn*type 1
1582 .       el \{\
1583 .               nr eqn*type 2
1584 .               if !'\\$1'C' .ds eqn*num "\\$1
1585 .       \}
1587 .di eqn*div
1588 .in 0
1589 .if \\n[eqn*type]=0 .HTML-IMAGE-LEFT
1590 .if \\n[eqn*type]=1 \{\
1591 .   if '\*(.T'html' .RS
1592 .   HTML-IMAGE-INLINE
1594 .if \\n[eqn*type]=2 .HTML-IMAGE
1595 .if !'\*(.T'html' .nf
1597 .de @div-end!eqn*div
1598 .@EN
1600 .\" Note that geqn mark and lineup work correctly in centered equations.
1601 .de @EN
1602 .ie !'\\n(.z'eqn*div' .@error-recover mismatched EN
1603 .el \{\
1604 .       br
1605 .       di
1606 .       nr eqn*have-num 0
1607 .       if !'\\*[eqn*num]'' .nr eqn*have-num 1
1608 .       ie \\n[dl]:\\n[eqn*have-num] \{\
1609 .               if !'\*(.T'html' .sp \\n[DD]u
1610 .               par@reset
1611 .               ds eqn*tabs \\n[.tabs]
1612 .               nf
1613 .               ie \\n[dl] \{\
1614 .\"                     --fixme-- this really should not be necessary
1615 .\"                     and indicates that there is extra space creeping into
1616 .\"                     an equation when ps4html is enabled..
1617 .                       ie r ps4html .ds@need \\n[dn]u-1v+\n[.V]u+1i
1618 .                       el .ds@need \\n[dn]u-1v+\n[.V]u
1619 .                       chop eqn*div
1620 .                       ie \\n[eqn*type]=0 \{\
1621 .                               ta (u;\\n[.l]-\\n[.i])R
1622 \\*[eqn*div]\t\\*[eqn*num]
1623 .                       \}
1624 .                       el \{\
1625 .                               ie \\n[eqn*type]=1 .ta \\n[DI]u \
1626 (u;\\n[.l]-\\n[.i])R
1627 .                               el .ta (u;\\n[.l]-\\n[.i]/2)C \
1628 (u;\\n[.l]-\\n[.i])R
1629 \t\\*[eqn*div]\t\\*[eqn*num]
1630 .                       \}
1631 .               \}
1632 .               el \{\
1633 .                       ta (u;\\n[.l]-\\n[.i])R
1634 \t\\*[eqn*num]
1635 .               \}
1636 .               if !'\*(.T'html' .sp \\n[DD]u
1637 .               ta \\*[eqn*tabs]
1638 .       \}
1639 .       el \{
1640 .\" must terminate empty equations in html and ps4html as they contain
1641 .\" the HTML-IMAGE-END suppression nodes
1642 .               if \\n[dl] .chop eqn*div
1643 .               if '\*(.T'html' \\*[eqn*div]
1644 .               if r ps4html    \\*[eqn*div]
1645 .       \}
1646 .       if !'\*(.T'html' .fi
1647 .       if \\n[eqn*type]=0 .HTML-IMAGE-END
1648 .       if \\n[eqn*type]=1 \{\
1649 .               HTML-IMAGE-END
1650 .               if '\*(.T'html' .RE
1651 .       \}
1652 .       if \\n[eqn*type]=2 .HTML-IMAGE-END
1655 .\" ****************************
1656 .\" ******** module tbl ********
1657 .\" ****************************
1658 .\" Tbl support.
1659 .nr tbl*have-header 0
1660 .\" This gets called if TS occurs before the first paragraph.
1661 .de TS
1663 .\" cov*ab-init aliases TS to @TS
1664 \\*[TS]\\
1666 .de @TS
1667 .sp \\n[DD]u
1668 .\" .if !'\*(.T'html' .sp \\n[DD]u
1669 .if '\\$1'H' .di tbl*header-div
1670 .HTML-IMAGE
1672 .de tbl@top-hook
1673 .if \\n[tbl*have-header] \{\
1674 .       ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl*print-header
1675 .       el .sp \\n[.t]u
1678 .de tbl*print-header
1679 .ev nf
1680 .tbl*header-div
1682 .mk #T
1684 .de TH
1685 .ie '\\n[.z]'tbl*header-div' \{\
1686 .       nr T. 0
1687 .       T#
1688 .       br
1689 .       di
1690 .       ie \\n[dn]+\\n[FM]+\\n[HM]+2v>=\\n[.p] \{\
1691 .               @error ridiculously long table header
1692 .               ds@need \\n[dn]
1693 .               tbl*print-header
1694 .       \}
1695 .       el \{\
1696 .               nr tbl*header-ht \\n[dn]
1697 .               ds@need \\n[dn]u+1v
1698 .               tbl*print-header
1699 .               nr tbl*have-header 1
1700 .       \}
1702 .el .@error-recover .TH without .TS H
1704 .de @div-end!tbl*header-div
1708 .de TE
1709 .ie '\\n(.z'tbl*header-div' .@error-recover .TS H but no .TH before .TE
1710 .el \{\
1711 .       nr tbl*have-header 0
1712 .       if !'\*(.T'html' .sp \\n[DD]u
1714 .       HTML-IMAGE-END
1715 .\" reset tabs
1718 .de tbl@bottom-hook
1719 .if \\n[tbl*have-header] \{\
1720 .       nr T. 1
1721 .       T#
1724 .de T&
1726 .\" ****************************
1727 .\" ******** module pic ********
1728 .\" ****************************
1729 .\" Pic support.
1730 .\" PS height width
1731 .de PS
1733 .sp \\n[DD]u
1734 .ie \\n[.$]<2 .@error bad arguments to PS (not preprocessed with pic?)
1735 .el \{\
1736 .       ds@need (u;\\$1)+1v
1737 .       in +(u;\\n[.l]-\\n[.i]-\\$2/2>?0)
1739 .HTML-IMAGE
1741 .de PE
1742 .HTML-IMAGE-END
1743 .par@reset
1744 .sp \\n[DD]u+.5m
1746 .\" ****************************
1747 .\" ******** module ref ********
1748 .\" ****************************
1749 .\" Refer support.
1750 .de ]-
1751 .rm [A [B [C [D [E [G [I [J [N [O [P [Q [R [S [T [V
1752 .rm ref*string
1754 .\" Other
1755 .ds ref*spec!0 Q A T1 S V N P I C D O
1756 .\" Journal article
1757 .ds ref*spec!1 Q A T2 J S V N P I C D O
1758 .\" Book
1759 .ds ref*spec!2 Q A T1 S V P I C D O
1760 .\" Article within book
1761 .ds ref*spec!3 Q A T2 B E S V P I C D O
1762 .\" Tech report
1763 .ds ref*spec!4 Q A T2 R G P I C D O
1764 .\" ][ type
1765 .de ][
1766 .if r [T \{\
1767 .       als [T1 [T
1768 .       als [T2 [T
1770 .ie d ref*spec!\\$1 .ref*build \\*[ref*spec!\\$1]
1771 .el \{\
1772 .       @error unknown reference type `\\$1'
1773 .       ref*build \\*[ref*spec!0]
1775 .ref*print
1776 .rm ref*string
1777 .rm [F [T1 [T2
1779 .\" start of reference number
1780 .ds [. \\*[par@sup-start]
1781 .\" end of reference number
1782 .ds .] \\*[par@sup-end]
1783 .\" period before reference
1784 .ds <. .
1785 .\" period after reference
1786 .ds >. \" empty
1787 .\" comma before reference
1788 .ds <, ,
1789 .\" comma after reference
1790 .ds >, \" empty
1791 .\" start collected references
1792 .de ]<
1793 .als ref*print ref*end-print
1795 \&\\*[REFERENCES]
1796 .par@reset
1798 .\" end collected references
1799 .de ]>
1800 .par@finish
1801 .als ref*print ref*normal-print
1803 .de ref*normal-print
1804 .ie d [F .FS "\\*([.\\*([F\\*(.]"
1805 .el .FS \&
1806 \\*[ref*string]
1809 .de ref*end-print
1810 .ie d [F .IP "\\*([F."
1811 .el .XP
1812 \\*[ref*string]
1814 .als ref*print ref*normal-print
1815 .de ref*build
1816 .rm ref*string ref*post-punct
1817 .nr ref*suppress-period 1
1818 .while \\n[.$] \{\
1819 .       if d [\\$1 \{\
1820 .               ie d ref*add-\\$1 .ref*add-\\$1
1821 .               el .ref*add-dflt \\$1
1822 .       \}
1823 .       shift
1825 .\" now add a final period
1826 .ie d ref*string \{\
1827 .       if !\\n[ref*suppress-period] .as ref*string .
1828 .       if d ref*post-punct \{\
1829 .               as ref*string "\\*[ref*post-punct]
1830 .               rm ref*post-punct
1831 .       \}
1833 .el .ds ref*string
1835 .de ref*add-T1
1836 .ref*field T , "\fI" "" "\fP"
1837 .if r [T .nr ref*suppress-period \\n([T
1839 .de ref*add-T2
1840 .ref*field T , "\\*Q" "" "\\*U"
1841 .if r [T .nr ref*suppress-period \\n([T
1843 .de ref*add-P
1844 .ie \\n([P>0 .ref*field P , "pp. "
1845 .el .ref*field P , "p. "
1847 .de ref*add-J
1848 .ref*field J , \fI "" \fP
1850 .de ref*add-D
1851 .ref*field D "" ( )
1853 .de ref*add-E
1854 .ref*field E , "ed. "
1856 .de ref*add-G
1857 .ref*field G "" ( )
1859 .de ref*add-B
1860 .ref*field B "" "in \fI" "" \fP
1862 .de ref*add-O
1863 .ref*field O .
1864 .ie r [O .nr ref*suppress-period \\n([O
1865 .el .nr ref*suppress-period 1
1867 .de ref*add-A
1868 .ref*field A ,
1869 .if r [A .nr ref*suppress-period \\n([A
1871 .de ref*add-dflt
1872 .ref*field \\$1 ,
1874 .\" First argument is the field letter.
1875 .\" Second argument is the punctuation character to use to separate this field
1876 .\" from the previous field.
1877 .\" Third argument is a string with which to prefix this field.
1878 .\" Fourth argument is a string with which to postfix this field.
1879 .\" Fifth argument is a string to add after the punctuation character supplied
1880 .\" by the next field.
1881 .de ref*field
1882 .if d ref*string \{\
1883 .       ie d ref*post-punct \{\
1884 .               as ref*string "\\$2\\*[ref*post-punct] \"
1885 .               rm ref*post-punct
1886 .       \}
1887 .       el .as ref*string "\\$2 \"
1889 .as ref*string "\\$3\\*([\\$1\\$4
1890 .if \\n[.$]>4 .ds ref*post-punct "\\$5
1891 .nr ref*suppress-period 0
1893 .\" ****************************
1894 .\" ******** module acc ********
1895 .\" ****************************
1896 .\" Accents and special characters.
1897 .ds Q \(lq
1898 .ds U \(rq
1899 .ds - \(em
1900 .\" Characters
1901 .\" The idea of this definition is for the top of the 3 to be at the x-height.
1902 .if !c\[yogh] .char \[yogh] \Z'\v'\w'x'*0-\En[rst]u'\s[\En[.s]*8u/10u]\
1903 \v'\w'3'*0+\En[rst]u'3\s0'\h'\w'\s[\En[.s]*8u/10u]3'u'
1904 .\" Accents
1905 .de acc*over-def
1906 .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
1907 \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
1909 .de acc*under-def
1910 .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
1912 .de acc*slash-def
1913 .ds \\$1 \Z'\h'(u;-\En[.w]-\w'\\$2'/2)'\
1914 \v'(u;\En[.cdp]-\En[.cht]+\En[rst]+\En[rsb]/2)'\\$2'
1916 .de acc*prefix-def
1917 .ds \\$1 \Z'\h'(u;\w'x'-\w'\\$2'/2)'\\$2'
1919 .acc*prefix-def ' \'
1920 .acc*prefix-def ` \`
1921 .acc*prefix-def ^ ^
1922 .acc*prefix-def , \(ac
1923 .acc*prefix-def : \(ad
1924 .acc*prefix-def ~ ~
1925 .\" improved accent marks
1926 .de AM
1927 .acc*over-def ' \'
1928 .acc*over-def ` \`
1929 .acc*over-def ^ ^
1930 .acc*over-def ~ ~
1931 .acc*over-def : \(ad
1932 .acc*over-def v \(ah
1933 .acc*over-def _ \(a-
1934 .acc*over-def o \(ao
1935 .acc*under-def , \(ac
1936 .acc*under-def . \s[\En[.s]*8u/10u]\v'.2m'.\v'-.2m'\s0
1937 .acc*under-def hook \(ho
1938 .acc*slash-def / /
1939 .char \[hooko] o\\\\*[hook]
1940 .ds q \[hooko]
1941 .ds 3 \[yogh]
1942 .ds D- \(-D\"                   Icelandic uppercase eth
1943 .ds d- \(Sd\"                   Icelandic lowercase eth
1944 .ds Th \(TP\"                   Icelandic uppercase thorn
1945 .ds th \(Tp\"                   Icelandic lowercase thorn
1946 .ds 8 \(ss\"                    German double s
1947 .ds Ae \(AE\"                   AE ligature
1948 .ds ae \(ae\"                   ae ligature
1949 .ds Oe \(OE\"                   OE ligature
1950 .ds oe \(oe\"                   oe ligature
1951 .ds ? \(r?\"                    upside down ?
1952 .ds ! \(r!\"                    upside down !
1954 .de CHECK-FOOTER-AND-KEEP
1955 .\" it might be better to als FS -> B1 and FE -> B2
1956 .\" however this produced wierd results, so I've moved back to a more reliable
1957 .\" but less interesting solution --fixme--
1958 .   if '\*(.T'html' \{\
1959 .       rm KF
1960 .       als KF KS
1961 .       rm FS
1962 .       de FS
1963 .               br
1964 .               HTML-IMAGE
1965 \\..
1966 .       rm FE
1967 .       de FE
1968 .               br
1969 .               HTML-IMAGE-END
1970 \\..
1971 .   \}
1972 .   if r ps4html \{\
1973 .       rm FS
1974 .       de FS
1975 .               br
1976 .               HTML-IMAGE
1977 \\..
1978 .       rm FE
1979 .       de FE
1980 .               br
1981 .               HTML-IMAGE-END
1982 \\..
1983 .   \}
1985 .par@load-init
1986 .if '\*(.T'html' \{\
1987 .  rm @IP
1988 .  als @IP @IP-html
1990 .\" Make sure that no blank lines creep in at the end of this file.