* font/devhtml/R.proto: Add u00{47,67}_0306, u00{53,73}_0327,
[s-roff.git] / tmac / s.tmac
blob9de28e883755dc092c70aa84aeaa9b194779dbeb
1 .\" -*- nroff -*-
2 .ig
4 s.tmac
6 Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002
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 .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 .pn 0
165 .de TL
167 .als TL cov*err-not-again
168 .rn @AB AB
169 .rn @AU AU
170 .rn @AI AI
171 .if !'\*(.T'html' .di cov*tl-div
172 .par@reset
173 .ft B
174 .ps +2
175 .vs +3p
176 .ll (u;\\n[LL]*5/6)
177 .nr cov*n-au 0
178 .HTML-TAG ".tl"
180 .de @AU
181 .par@reset
182 .if !'\\n(.z'' \{\
183 .       br
184 .       di
186 .nr cov*n-au +1
187 .di cov*au-div!\\n[cov*n-au]
189 .ft I
190 .ps \\n[PS]
192 .de @AI
193 .if !'\*(.T'html' .par@reset
194 .if !'\\n(.z'' \{\
195 .       br
196 .       di
198 .ie !\\n[cov*n-au] .@error AI before AU
199 .el \{\
200 .       di cov*ai-div!\\n[cov*n-au]
201 .       nf
202 .       ft R
203 .       ps \\n[PS]
206 .de LP
207 .if !'\\n[.z]'' \{\
208 .       br
209 .       di
212 .cov*ab-init
213 .cov*print
214 \\*[\\$0]\\
216 .als IP LP
217 .als PP LP
218 .als XP LP
219 .als QP LP
220 .als RS LP
221 .als NH LP
222 .als SH LP
223 .als MC LP
224 .als RT LP
225 .als XS LP
226 .de cov*ab-init
227 .als cov*ab-init @nop
228 .als LP @LP
229 .als IP @IP
230 .als PP @PP
231 .als XP @XP
232 .als RT @RT
233 .als XS @XS
234 .als SH @SH
235 .als NH @NH
236 .als QP @QP
237 .als RS @RS
238 .als RE @RE
239 .als QS @QS
240 .als QE @QE
241 .als MC @MC
242 .als EQ @EQ
243 .als EN @EN
244 .als TS @TS
245 .als AB cov*err-not-after-ab
246 .als AU par@AU
247 .als AI par@AI
248 .als TL par@TL
250 .de @AB
251 .if !'\\n(.z'' \{\
252 .       br
253 .       di
255 .cov*ab-init
256 .if !'\*(.T'html' .di cov*ab-div
257 .par@ab-indent
258 .par@reset
259 .if !'\\$1'no' \{\
260 .       ft I
261 .       ce 1
262 \\*[ABSTRACT]
263 .       sp
264 .       ft R
267 .@PP
268 .if '\*(.T'html' \{\
269 .       cov*tl-au-print
270 .       als cov*tl-au-print @nop
271 .       par@reset-env
272 .       par@reset
273 .       cov*print
276 .de AE
277 .ie '\*(.T'html' \{\
278 .       als AE cov*err-not-again
280 .el \{\
281 .  ie '\\n(.z'cov*ab-div' \{\
282 .       als AE cov*err-not-again
283 .       br
284 .       di
285 .\"     nr cov*ab-height \\n[dn]
286 .       par@reset-env
287 .       par@reset
288 .       cov*print
289 .  \}
290 .  el .@error AE without AB
293 .de @div-end!cov*ab-div
296 .de cov*print
297 .als cov*print @nop
298 .ie d cov*tl-div \{\
299 .       ie \\n[cov*rp-format] .cov*rp-print
300 .       el .cov*draft-print
302 .el \{\
303 .       if \\n[cov*rp-format] \{\
304 .               @warning RP format but no TL
305 .               bp 1
306 .               als FS @FS
307 .               als FE @FE
308 .               CHECK-FOOTER-AND-KEEP
309 .       \}
310 .       br
313 .de cov*rp-print
314 .nr cov*page-length \\n[.p]
315 .pl 1000i
316 .cov*tl-au-print
317 .sp 3
318 .if d cov*ab-div \{\
319 .  if !'\*(.T'html'  .  nf
320 .       cov*ab-div
322 .sp 3
323 .par@reset
324 \\*[DY]
326 .if \\n[cov*fn-height] \{\
327 .       sp |(u;\\n[cov*page-length]-\\n[FM]\
328 -\\n[cov*fn-height]-\\n[fn@sep-dist]>?\\n[nl])
329 .       fn@print-sep
330 .       ev nf
331 .       cov*fn-div
332 .       ev
333 .       ie \\n[cov*rp-no] .rm cov*fn-div
334 .       el \{\
335 .               rn cov*fn-div fn@overflow-div
336 .               nr fn@have-overflow 1
337 .       \}
339 .als FS @FS
340 .als FE @FE
341 .CHECK-FOOTER-AND-KEEP
342 .\" If anything was printed below where the footer line is normally printed,
343 .\" then that's an overflow.
344 .if -\\n[FM]/2+1v+\\n[cov*page-length]<\\n[nl] .@error cover sheet overflow
345 .pl \\n[cov*page-length]u
346 .bp 1
347 .if !\\n[cov*rp-no] .cov*tl-au-print
349 .sp 1
351 .de cov*draft-print
352 .cov*tl-au-print
353 .if d cov*ab-div \{\
354 .       nf
355 .       sp 2
356 .       cov*ab-div
358 .sp 1
360 .de cov*tl-au-print
361 .par@reset
364 .sp 3
365 .ce 9999
366 .if d cov*tl-div .cov*tl-div
367 .nr cov*i 1
368 .nr cov*sp 1v
369 .while \\n[cov*i]<=\\n[cov*n-au] \{\
370 .       sp \\n[cov*sp]u
371 .       cov*au-div!\\n[cov*i]
372 .       ie d cov*ai-div!\\n[cov*i] \{\
373 .               sp .5v  
374 .               cov*ai-div!\\n[cov*i]
375 .               nr cov*sp 1v
376 .       \}
377 .       el .nr cov*sp .5v
378 .       nr cov*i +1
380 .ce 0
382 .nr cov*fn-height 0
383 .nr cov*in-fn 0
384 .\" start of footnote on cover
385 .de cov*FS
386 .if \\n[cov*in-fn] \{\
387 .       @error nested FS
388 .       FE
390 .nr cov*in-fn 1
391 .ev fn
392 .par@reset-env
393 .da cov*fn-div
394 .if !\\n[cov*fn-height] .ns
395 .ie \\n[.$] .FP "\\$1" no
396 .el .@LP
398 .de @div-end!cov*fn-div
399 .cov*FE
401 .\" end of footnote on cover
402 .de cov*FE
403 .ie '\\n(.z'cov*fn-div' \{\
404 .       br
405 .       ev
406 .       di
407 .       nr cov*in-fn 0
408 .       nr cov*fn-height +\\n[dn]
410 .el .@error FE without matching FS
412 .\" ***************************
413 .\" ******** module pg ********
414 .\" ***************************
415 .\" Page-level formatting.
416 .\" > 0 if we have a footnote on the current page
417 .nr pg@fn-flag 0
418 .nr pg@colw 0
419 .nr pg@fn-colw 0
420 .nr HM 1i
421 .nr FM 1i
422 .ds LF
423 .ds CF
424 .ds RF
425 .ds LH
426 .ds CH -\\n[PN]-
427 .ds RH
428 .ds pg*OH '\\*[LH]'\\*[CH]'\\*[RH]'
429 .ds pg*EH '\\*[LH]'\\*[CH]'\\*[RH]'
430 .ds pg*OF '\\*[LF]'\\*[CF]'\\*[RF]'
431 .ds pg*EF '\\*[LF]'\\*[CF]'\\*[RF]'
432 .de OH
433 .ds pg*\\$0 "\\$*
435 .als EH OH
436 .als OF OH
437 .als EF OH
438 .de PT
439 .ie \\n%=1 .if \\n[pg*P1] .tl \\*[pg*OH]
440 .el \{\
441 .       ie o .tl \\*[pg*OH]
442 .       el .tl \\*[pg*EH]
445 .de BT
446 .ie o .tl \\*[pg*OF]
447 .el .tl \\*[pg*EF]
449 .nr pg*P1 0
450 .de P1
451 .nr pg*P1 1
453 .wh -\n[FM]u pg@bottom
454 .wh -\n[FM]u/2u pg*footer
455 .nr MINGW 2n
456 .nr pg@ncols 1
457 .de @MC
458 .if !'\\n(.z'' .error-recover MC while diversion open
460 .ie \\n[pg@ncols]>1 .pg@super-eject
461 .el \{\
462 .       \" flush out any floating keeps
463 .       while \\n[kp@tail]>\\n[kp@head] \{\
464 .               rs
465 .               bp
466 .       \}
468 .ie !\\n(.$ \{\
469 .       nr pg@colw \\n[LL]*7/15
470 .       nr pg*gutw \\n[LL]-(2*\\n[pg@colw])
471 .       nr pg@ncols 2
473 .el \{\
474 .       nr pg@colw (n;\\$1)<?\\n[LL]
475 .       ie \\n[.$]<2 .nr pg*gutw \\n[MINGW]
476 .       el .nr pg*gutw (n;\\$2)
477 .       nr pg@ncols \\n[LL]-\\n[pg@colw]/(\\n[pg@colw]+\\n[pg*gutw])+1
478 .       ie \\n[pg@ncols]>1 \
479 .               nr pg*gutw \\n[LL]-(\\n[pg@ncols]*\\n[pg@colw])/(\\n[pg@ncols]-1)
480 .       el .nr pg*gutw 0
482 .HTML-TAG ".mc \\n[pg@ncols] \\n[pg@colw] \\n[pg*gutw]"
483 .mk pg*col-top
485 .nr pg*col-num 0
486 .nr pg@fn-colw \\n[pg@colw]*5/6
487 .par@reset
489 .de 2C
492 .de 1C
493 .MC \\n[LL]u
495 .\" top of page macro
496 .de pg@top
497 .ch pg*footer -\\n[FM]u/2u
498 .nr PN \\n%
499 .nr pg*col-num 0
500 .nr pg@fn-bottom-margin 0
501 .nr pg*saved-po \\n[PO]
502 .po \\n[PO]u
503 .ev h
504 .par@reset
505 .sp (u;\\n[HM]/2)
507 .sp |\\n[HM]u
508 .if d HD .HD
509 .mk pg@header-bottom
511 .mk pg*col-top
512 .pg*start-col
514 .de pg*start-col
515 .\" Handle footnote overflow before floating keeps, because the keep
516 .\" might contain an embedded footnote.
517 .fn@top-hook
518 .kp@top-hook
519 .tbl@top-hook
522 .de pg@cs-top
523 .sp \\n[HM]u
524 .\" move pg@bottom and pg*footer out of the way
525 .ch pg@bottom \\n[.p]u*2u
526 .ch pg*footer \\n[.p]u*2u
529 .de pg@bottom
530 .tbl@bottom-hook
531 .if \\n[pg@fn-flag] .fn@bottom-hook
532 .nr pg*col-num +1
533 .ie \\n[pg*col-num]<\\n[pg@ncols] .pg*end-col
534 .el .pg*end-page
536 .de pg*end-col
537 'sp |\\n[pg*col-top]u
538 .po (u;\\n[pg*saved-po]+(\\n[pg@colw]+\\n[pg*gutw]*\\n[pg*col-num]))
539 .\"po +(u;\\n[pg@colw]+\\n[pg*gutw])
540 .pg*start-col
542 .de pg*end-page
543 .po \\n[pg*saved-po]u
544 .\" Make sure we don't exit if there are still floats or footnotes left-over.
545 .ie \\n[kp@head]<\\n[kp@tail]:\\n[fn@have-overflow] \{\
546 .       \" Switching environments ensures that we don't get an unnecessary
547 .       \" blank line at the top of the page.
548 .       ev ne
549 '       bp
550 .       ev
552 .el \{\
553 .       \" If the text has ended and there are no more footnotes or keeps, exit.
554 .       if \\n[pg@text-ended] .ex
555 .       if r pg*next-number \{\
556 .               pn \\n[pg*next-number]
557 .               rr pg*next-number
558 .               if d pg*next-format \{\
559 .                       af PN \\*[pg*next-format]
560 .                       rm pg*next-format
561 .               \}
562 .       \}
563 '       bp
566 .\" pg@begin number format
567 .de pg@begin
568 .ie \\n[.$]>0 \{\
569 .       nr pg*next-number (;\\$1)
570 .       ie \\n[.$]>1 .ds pg*next-format \\$2
571 .       el .rm pg*next-format
573 .el .rr pg*next-number
574 .pg@super-eject
576 .\" print the footer line
577 .de pg*footer
578 .ev h
579 .par@reset
583 .\" flush out any keeps or footnotes
584 .de pg@super-eject
586 .if !'\\n(.z'' .@error-recover diversion open while ejecting page
587 .\" Make sure we stay in the end macro while there is still footnote overflow
588 .\" left, or floating keeps.
589 .while \\n[kp@tail]>\\n[kp@head]:\\n[pg@fn-flag] \{\
590 .       rs
591 .       bp
595 .nr pg@text-ended 0
596 .de pg@end-text
598 .nr pg@text-ended 1
599 .pg@super-eject
601 .em pg@end-text
602 .\" ***************************
603 .\" ******** module fn ********
604 .\" ***************************
605 .\" Footnotes.
606 .nr fn@sep-dist 8p
607 .ev fn
608 .\" Round it vertically
609 .vs \n[fn@sep-dist]u
610 .nr fn@sep-dist \n[.v]
612 .nr fn*text-num 0 1
613 .nr fn*note-num 0 1
614 .ds * \\*[par@sup-start]\En+[fn*text-num]\\*[par@sup-end]
615 .nr fn*open 0
616 .\" normal FS
617 .de @FS
618 .ie \\n[.$] .fn*do-FS "\\$1" no
619 .el \{\
620 .       ie \\n[fn*text-num]>\\n[fn*note-num] .fn*do-FS \\n+[fn*note-num]
621 .       el .fn*do-FS
624 .\" Second argument of `no' means don't embellish the first argument.
625 .de fn*do-FS
626 .if \\n[fn*open] .@error-recover nested FS
627 .nr fn*open 1
628 .if \\n[.u] \{\
629 .       \" Ensure that the first line of the footnote is on the same page
630 .       \" as the reference.  I think this is minimal.
631 .       ev fn
632 .       nr fn*need 1v
633 .       ev
634 .       ie \\n[pg@fn-flag] .nr fn*need +\\n[fn:PD]
635 .       el .nr fn*need +\\n[fn@sep-dist]
636 .       ne \\n[fn*need]u+\\n[.V]u>?0
638 .ev fn
639 .par@reset-env
640 .fn*start-div
641 .par@reset
642 .ie \\n[.$] .FP \\$@
643 .el .@LP
645 .de @FE
646 .ie !\\n[fn*open] .@error FE without FS
647 .el \{\
648 .       nr fn*open 0
649 .       br
650 .       ev
651 .       fn*end-div
654 .nr fn@have-overflow 0
655 .\" called at the top of each column
656 .de fn@top-hook
657 .nr fn*max-width 0
658 .nr fn*page-bottom-pos 0-\\n[FM]-\\n[pg@fn-bottom-margin]
659 .ch pg@bottom \\n[fn*page-bottom-pos]u
660 .if \\n[fn@have-overflow] \{\
661 .       nr fn@have-overflow 0
662 .       fn*start-div
663 .       ev nf
664 .       fn@overflow-div
665 .       ev
666 .       fn*end-div
669 .\" This is called at the bottom of the column if pg@fn-flag is set.
670 .de fn@bottom-hook
671 .nr pg@fn-flag 0
672 .nr fn@have-overflow 0
673 .nr fn@bottom-pos \\n[.p]-\\n[FM]-\\n[pg@fn-bottom-margin]+\\n[.v]
674 .ev fn
675 .nr fn@bottom-pos -\\n[.v]
677 .ie \\n[nl]+\\n[fn@sep-dist]+\n[.V]>\\n[fn@bottom-pos] \{\
678 .       rn fn@div fn@overflow-div
679 .       nr fn@have-overflow 1
681 .el \{\
682 .       if \\n[pg@ncols]>1 \
683 .               if \\n[fn*max-width]>\\n[pg@fn-colw] \
684 .                       nr pg@fn-bottom-margin \\n[.p]-\\n[FM]-\\n[nl]+1v
685 .       wh \\n[fn@bottom-pos]u fn*catch-overflow
686 .       fn@print-sep
687 .       ev nf
688 .       fn@div
689 .       rm fn@div
690 .       ev
691 .       if '\\n(.z'fn@overflow-div' \{\
692 .               di
693 .               nr fn@have-overflow \\n[dn]>0
694 .       \}
695 .       ch fn*catch-overflow
698 .de fn*catch-overflow
699 .di fn@overflow-div
701 .nr fn*embed-count 0
702 .de @div-end!fn@div
704 .if '\\n[.ev]'fn' .ev
705 .fn*end-div
706 .nr fn*open 0
708 .als @div-end!fn*embed-div @div-end!fn@div
709 .de fn*start-div
710 .ie '\\n(.z'' \{\
711 .       da fn@div
712 .       if !\\n[pg@fn-flag] .ns
714 .el .di fn*embed-div
716 .de fn*end-div
717 .ie '\\n(.z'fn@div' \{\
718 .       di
719 .       nr fn*page-bottom-pos -\\n[dn]
720 .       nr fn*max-width \\n[fn*max-width]>?\\n[dl]
721 .       if !\\n[pg@fn-flag] .nr fn*page-bottom-pos -\\n[fn@sep-dist]
722 .       nr pg@fn-flag 1
723 .       nr fn*page-bottom-pos \\n[nl]-\\n[.p]+\n[.V]>?\\n[fn*page-bottom-pos]
724 .       ch pg@bottom \\n[fn*page-bottom-pos]u
726 .el \{\
727 .       ie '\\n(.z'fn*embed-div' \{\
728 .       di
729 .               rn fn*embed-div fn*embed-div!\\n[fn*embed-count]
730 \!.             fn*embed-start \\n[fn*embed-count]
731 .               rs
732 '               sp (u;\\n[dn]+\\n[fn@sep-dist]+\\n[.V])
733 \!.             fn*embed-end
734 .               nr fn*embed-count +1
735 .       \}
736 .       el \{\
737 .               ev fn
738 .               @error-recover unclosed diversion within footnote
739 .       \}
742 .de fn*embed-start
743 .ie '\\n(.z'' \{\
744 .       fn*start-div
745 .       ev nf
746 .       fn*embed-div!\\$1
747 .       rm fn*embed-div!\\$1
748 .       ev
749 .       fn*end-div
750 .       di fn*null
752 .el \{\
753 \!.     fn*embed-start \\$1
754 .       rs
757 .de fn*embed-end
758 .ie '\\n(.z'fn*null' \{\
759 .       di
760 .       rm fn*null
762 .el \!.fn*embed-end
764 .\" It's important that fn@print-sep use up exactly fn@sep-dist vertical space.
765 .de fn@print-sep
766 .ev fn
767 .in 0
768 .vs \\n[fn@sep-dist]u
769 \D'l 1i 0'
773 .\" ***************************
774 .\" ******** module kp ********
775 .\" ***************************
776 .\" Keeps.
777 .de KS
779 .di kp*div
781 .de KF
782 .if !'\\n(.z'' .@error-recover KF while open diversion
783 .di kp*fdiv
784 .ev k
785 .par@reset-env
786 .par@reset
788 .de KE
789 .ie '\\n(.z'kp*div' .kp*end
790 .el \{\
791 .       ie '\\n(.z'kp*fdiv' .kp*fend
792 .       el .@error KE without KS or KF
795 .de @div-end!kp*div
796 .kp*end
798 .de @div-end!kp*fdiv
799 .kp*fend
801 .de kp*need
802 .ie '\\n(.z'' .ds@need \\$1
803 .el \!.kp*need \\$1
805 .\" end non-floating keep
806 .de kp*end
809 .kp*need \\n[dn]
810 .ev nf
811 .kp*div
813 .rm kp*div
815 .\" Floating keeps.
816 .nr kp@head 0
817 .nr kp@tail 0
818 .\" end floating keep
819 .de kp*fend
823 .ie \\n[.t]-(\\n[.k]>0*1v)>\\n[dn] \{\
824 .       br
825 .       ev nf
826 .       kp*fdiv
827 .       rm kp*fdiv
828 .       ev
830 .el \{\
831 .       rn kp*fdiv kp*div!\\n[kp@tail]
832 .       nr kp*ht!\\n[kp@tail] 0\\n[dn]
833 .       nr kp@tail +1
836 .\" top of page processing for KF
837 .nr kp*doing-top 0
838 .de kp@top-hook
839 .if !\\n[kp*doing-top] \{\
840 .       nr kp*doing-top 1
841 .       kp*do-top
842 .       nr kp*doing-top 0
845 .de kp*do-top
846 .\" If the first keep won't fit, only force it out if we haven't had a footnote
847 .\" and we're at the top of the page.
848 .nr kp*force \\n[pg@fn-flag]=0&(\\n[nl]<=\\n[pg@header-bottom])
849 .nr kp*fits 1
850 .while \\n[kp@tail]>\\n[kp@head]&\\n[kp*fits] \{\
851 .       ie \\n[.t]>\\n[kp*ht!\\n[kp@head]]:\\n[kp*force] \{\
852 .               nr kp*force 0
853 .               \" It's important to advance kp@head before bringing
854 .               \" back the keep, so that if the last line of the
855 .               \" last keep springs the bottom of page trap, a new
856 .               \" page will not be started unnecessarily.
857 .               rn kp*div!\\n[kp@head] kp*temp
858 .               nr kp@head +1
859 .               ev nf
860 .               kp*temp
861 .               ev
862 .               rm kp*temp
863 .       \}
864 .       el .nr kp*fits 0
867 .\" ***************************
868 .\" ******** module ds ********
869 .\" ***************************
870 .\" Displays and non-floating keeps.
871 .de DE
872 .ds*end!\\n[\\n[.ev]:ds-type]
873 .nr \\n[.ev]:ds-type 0
875 .als De DE
876 .de ds@auto-end
877 .if \\n[\\n[.ev]:ds-type] \{\
878 .       @error automatically terminating display
879 .       DE
882 .de @div-end!ds*div
883 .ie \\n[\\n[.ev]:ds-type] .DE
884 .el .ds*end!2
886 .de ds*end!0
887 .@error DE without DS, ID, CD, LD or BD
889 .de LD
891 .nr \\n[.ev]:ds-type 1
892 .par@reset
894 .sp \\n[DD]u
896 .de ID
898 .ie \\n[.$] .in +(n;\\$1)
899 .el .in +\\n[DI]u
901 .de CD
903 .ce 9999
905 .de RD
907 .rj 9999
909 .de ds*common-end
910 .par@reset
911 .sp \\n[DD]u
913 .als ds*end!1 ds*common-end
914 .de BD
916 .nr \\n[.ev]:ds-type 2
917 .di ds*div
919 .de ds*end!2
921 .ie '\\n(.z'ds*div' \{\
922 .       di
923 .       nf
924 .       in (u;\\n[.l]-\\n[dl]/2>?0)
925 .       ds*div
926 .       rm ds*div
927 .       ds*common-end
929 .el .@error-recover mismatched DE
931 .de DS
933 .di ds*div
934 .ie '\\$1'B' \{\
935 .       LD
936 .       nr \\n[.ev]:ds-type 4
938 .el \{\
939 .       ie '\\$1'L' .LD
940 .       el \{\
941 .               ie '\\$1'C' .CD
942 .               el \{\
943 .                       ie '\\$1'R' .RD
944 .                       el \{\
945 .                               ie '\\$1'I' .ID \\$2
946 .                               el .ID \\$1
947 .                       \}
948 .               \}
949 .       \}
950 .       nr \\n[.ev]:ds-type 3
953 .als Ds DS
954 .de ds@need
955 .if '\\n(.z'' \{\
956 .       while \\n[.t]<=(\\$1)&(\\n[nl]>\\n[pg@header-bottom]) \{\
957 .               rs
958 '               sp \\n[.t]u
959 .       \}
962 .de ds*end!3
964 .ie '\\n(.z'ds*div' \{\
965 .       di
966 .       ds@need \\n[dn]
967 .       ev nf
968 .       ds*div
969 .       ev
970 .       rm ds*div
971 .       ds*common-end
973 .el .@error-recover mismatched DE
975 .de ds*end!4
976 .ie '\\n(.z'ds*div' \{\
977 .       br
978 .       di
979 .       nf
980 .       in (u;\\n[.l]-\\n[dl]/2>?0)
981 .       ds@need \\n[dn]
982 .       ds*div
983 .       rm ds*div
984 .       ds*common-end
986 .el .@error-recover mismatched DE
988 .\" ****************************
989 .\" ******** module par ********
990 .\" ****************************
991 .\" Paragraph-level formatting.
992 .\" Load time initialization.
993 .de par@load-init
994 .\" PS and VS might have been set on the command-line
995 .if !rPS .nr PS 10
996 .if !rLL .nr LL 6i
997 .ll \\n[LL]u
998 .\" don't set LT so that it can be defaulted from LL
999 .ie rLT .lt \\n[LT]u
1000 .el .lt \\n[LL]u
1001 .ps \\n[PS]
1002 .\" don't set VS so that it can be defaulted from PS
1003 .ie rVS .par*vs \\n[VS]
1004 .el .par*vs \\n[PS]+2
1005 .if dFAM .fam \\*[FAM]
1006 .if !rHY .nr HY 14
1007 .hy \\n[HY]
1009 .CHECK-FOOTER-AND-KEEP
1011 .de par*vs
1012 .\" If it's too big to be in points, treat it as units.
1013 .ie (p;\\$1)>=40p .vs (u;\\$1)
1014 .el .vs (p;\\$1)
1016 .de par@ab-indent
1017 .nr 0:li (u;\\n[LL]/12)
1018 .nr 0:ri \\n[0:li]
1020 .de par*env-init
1021 .aln \\n[.ev]:PS PS
1022 .aln \\n[.ev]:VS VS
1023 .aln \\n[.ev]:LL LL
1024 .aln \\n[.ev]:MCLL LL
1025 .aln \\n[.ev]:LT LT
1026 .aln \\n[.ev]:MCLT LT
1027 .aln \\n[.ev]:PI PI
1028 .aln \\n[.ev]:PD PD
1029 .ad \\n[par*adj]
1030 .par@reset-env
1032 .\" happens when the first page begins
1033 .de par@init
1034 .if !rLT .nr LT \\n[LL]
1035 .if !rFL .nr FL \\n[LL]*5/6
1036 .if !rVS .nr VS \\n[PS]+2
1037 .if !rDI .nr DI .5i
1038 .if !rFPS .nr FPS \\n[PS]-2
1039 .if !rFVS .nr FVS \\n[FPS]+2
1040 .\" don't change environment 0
1041 .ev h
1042 .ps \\n[PS]
1043 .if !rQI .nr QI 5n
1044 .if !rPI .nr PI 5n
1045 .par*vs \\n[VS]
1046 .if !rPD .nr PD .3v>?\n(.V
1047 .if !rDD .nr DD .5v>?\n(.V
1048 .if !rFI .nr FI 2n
1049 .if !rFPD .nr FPD \\n[PD]/2
1051 .if !dFAM .ds FAM \\n[.fam]
1052 .nr par*adj \\n[.j]
1053 .par*env-init
1054 .ev h
1055 .par*env-init
1057 .ev fn
1058 .par*env-init
1060 .ev k
1061 .par*env-init
1063 .aln 0:MCLL pg@colw
1064 .aln 0:MCLT pg@colw
1065 .aln k:MCLL pg@colw
1066 .aln k:MCLT pg@colw
1067 .aln fn:PS FPS
1068 .aln fn:VS FVS
1069 .aln fn:LL FL
1070 .aln fn:LT FL
1071 .aln fn:PI FI
1072 .aln fn:PD FPD
1073 .aln fn:MCLL pg@fn-colw
1074 .aln fn:MCLT pg@fn-colw
1076 .de par@reset-env
1077 .nr \\n[.ev]:il 0
1078 .nr \\n[.ev]:li 0
1079 .nr \\n[.ev]:ri 0
1080 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1081 .nr \\n[.ev]:pli 0
1082 .nr \\n[.ev]:pri 0
1083 .nr \\n[.ev]:ds-type 0
1085 .\" par@reset
1086 .de par@reset
1088 .ce 0
1089 .rj 0
1090 .ul 0
1092 .ie \\n[pg@ncols]>1 \{\
1093 .       ll (u;\\n[\\n[.ev]:MCLL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1094 .       lt \\n[\\n[.ev]:MCLT]u
1096 .el \{\
1097 .       ll (u;\\n[\\n[.ev]:LL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1098 .       lt \\n[\\n[.ev]:LT]u
1100 .in (u;\\n[\\n[.ev]:li]+\\n[\\n[.ev]:pli])
1101 .ft 1
1102 .fam \\*[FAM]
1103 .ps \\n[\\n[.ev]:PS]
1104 .par*vs \\n[\\n[.ev]:VS]
1105 .ls 1
1107 .hy \\n[HY]
1109 .de @RT
1110 .nr \\n[.ev]:pli 0
1111 .nr \\n[.ev]:pri 0
1112 .par@reset
1114 .\" This can be redefined by the user.
1115 .de TA
1116 .ta T 5n
1118 .de par*start
1119 .ds@auto-end
1120 .nr \\n[.ev]:pli \\$1
1121 .nr \\n[.ev]:pri \\$2
1122 .par@reset
1123 .sp \\n[\\n[.ev]:PD]u
1124 .ne 1v+\\n(.Vu
1126 .de par@finish
1127 .nr \\n[.ev]:pli 0
1128 .nr \\n[.ev]:pri 0
1129 .par@reset
1131 .\" normal LP
1132 .de @LP
1133 .par*start 0 0
1134 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1136 .de @PP
1137 .par*start 0 0
1138 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1139 .if !'\*(.T'html' .ti +\\n[\\n[.ev]:ai]u
1141 .de @QP
1142 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1143 .par*start \\n[QI] \\n[QI]
1145 .de @XP
1146 .par*start \\n[\\n[.ev]:PI] 0
1147 .ti -\\n[\\n[.ev]:PI]u
1149 .de @IP
1150 .if \\n[.$]>1 .nr \\n[.ev]:ai (n;\\$2)
1151 .par*start \\n[\\n[.ev]:ai] 0
1152 .if !'\\$1'' \{\
1153 .       \" Divert the label so as to freeze any spaces.
1154 .       di par*label
1155 .       par*push-tag-env
1156 \&\\$1
1157 .       par*pop-tag-env
1158 .       di
1159 .       chop par*label
1160 .       ti -\\n[\\n[.ev]:ai]u
1161 .       ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \\*[par*label]\h'|\\n[\\n[.ev]:ai]u'\c
1162 .       el \{\
1163 \\*[par*label]
1164 .               br
1165 .       \}
1166 .       rm par*label
1169 .de @IP-html
1170 .if \\n[.$]>1 .nr \\n[.ev]:ai (n;\\$2)
1171 .par*start \\n[\\n[.ev]:ai] 0
1172 .if !'\\$1'' \{\
1173 .       \" Divert the label so as to freeze any spaces.
1174 .       di par*label
1175 .       par*push-tag-env
1176 \&\\$1
1177 .       par*pop-tag-env
1178 .       di
1179 .       chop par*label
1180 .       ti -\\n[\\n[.ev]:ai]u
1181 .       ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \{\
1182 .               HTML-TAG-NS ".col 1"
1183 \\$1\h'|\\n[\\n[.ev]:ai]u'\c
1184 .               HTML-TAG-NS ".col 2"
1185 .       \}
1186 .       el \{\
1187 \\$1
1188 .               br
1189 .       \}
1190 .       rm par*label
1193 .\" We don't want margin characters to be attached when we divert
1194 .\" the tag.  Since there's no way to save and restore the current
1195 .\" margin character, we have to switch to a new environment, taking
1196 .\" what we need of the old environment with us.
1197 .de par*push-tag-env
1198 .nr par*saved-font \\n[.f]
1199 .nr par*saved-size \\n[.s]z
1200 .nr par*saved-ss \\n[.ss]
1201 .ds par*saved-fam \\n[.fam]
1202 .ev par
1205 .ft \\n[par*saved-font]
1206 .ps \\n[par*saved-size]u
1207 .ss \\n[par*saved-ss]
1208 .fam \\*[par*saved-fam]
1210 .de par*pop-tag-env
1213 .de @RS
1215 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1216 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1217 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1218 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1219 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1220 .nr \\n[.ev]:il +1
1221 .nr \\n[.ev]:li +\\n[\\n[.ev]:ai]
1222 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1223 .par@reset
1225 .de @RE
1227 .ie \\n[\\n[.ev]:il] \{\
1228 .       nr \\n[.ev]:il -1
1229 .       nr \\n[.ev]:ai \\n[\\n[.ev]:ai!\\n[\\n[.ev]:il]]
1230 .       nr \\n[.ev]:li \\n[\\n[.ev]:li!\\n[\\n[.ev]:il]]
1231 .       nr \\n[.ev]:ri \\n[\\n[.ev]:ri!\\n[\\n[.ev]:il]]
1232 .       nr \\n[.ev]:pli \\n[\\n[.ev]:pli!\\n[\\n[.ev]:il]]
1233 .       nr \\n[.ev]:pri \\n[\\n[.ev]:pri!\\n[\\n[.ev]:il]]
1235 .el .@error unbalanced \\$0
1236 .par@reset
1238 .de @QS
1240 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1241 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1242 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1243 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1244 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1245 .nr \\n[.ev]:il +1
1246 .nr \\n[.ev]:li +\\n[QI]
1247 .nr \\n[.ev]:ri +\\n[QI]
1248 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1249 .par@reset
1251 .als @QE @RE
1252 .\" start boxed text
1253 .de B1
1255 .HTML-IMAGE
1256 .di par*box-div
1257 .nr \\n[.ev]:li +1n
1258 .nr \\n[.ev]:ri +1n
1259 .nr par*box-in \\n[.in]
1260 .\" remember what 1n is, just in case the point size changes
1261 .nr par*box-n 1n
1262 .in +1n
1263 .ll -1n
1264 .lt -1n
1265 .ti \\n[par*box-in]u+1n
1267 .de @div-end!par*box-div
1270 .\" end boxed text
1271 .\" Postpone the drawing of the box until we're in the top-level diversion,
1272 .\" in case there's a footnote inside the box.
1273 .de B2
1274 .ie '\\n(.z'par*box-div' \{\
1275 .       br
1276 .       if \n[.V]>.25m .sp
1277 .       di
1278 .       if \n[.V]>.25m .sp
1279 .       ds@need \\n[dn]
1280 .       par*box-mark-top
1281 .       ev nf
1282 .       par*box-div
1283 .       ev
1284 .       nr \\n[.ev]:ri -\\n[par*box-n]
1285 .       nr \\n[.ev]:li -\\n[par*box-n]
1286 .       in -\\n[par*box-n]u
1287 .       ll +\\n[par*box-n]u
1288 .       lt +\\n[par*box-n]u
1289 .       par*box-draw \\n[.i]u \\n[.l]u-(\\n[.H]u==1n*1n)
1291 .el .@error B2 without B1
1292 .HTML-IMAGE-END
1294 .de par*box-mark-top
1295 .ie '\\n[.z]'' \{\
1296 .       rs
1297 .       mk par*box-top
1299 .el \!.par*box-mark-top
1301 .de par*box-draw
1302 .ie '\\n[.z]'' \{\
1303 .       nr par*box-in \\n[.i]
1304 .       nr par*box-ll \\n[.l]
1305 .       nr par*box-vpt \\n[.vpt]
1306 .       nr par*box-ad \\n[.j]
1307 .       ad l
1308 .       vpt 0
1309 .       in \\$1
1310 .       ll \\$2
1311 \v'-1v+.25m'\
1312 \D'l (u;\\n[.l]-\\n[.i]) 0'\
1313 \D'l 0 |\\n[par*box-top]u'\
1314 \D'l -(u;\\n[.l]-\\n[.i]) 0'\
1315 \D'l 0 -|\\n[par*box-top]u'
1316 .       br
1317 .       sp -1
1318 .       in \\n[par*box-in]u
1319 .       ll \\n[par*box-ll]u
1320 .       vpt \\n[par*box-vpt]
1321 .       ad \\n[par*box-ad]
1323 .el \!.par*box-draw \\$1 \\$2
1325 .de SH-NO-TAG
1326 .par@finish
1327 .\" Keep together the heading and the first two lines of the next paragraph.
1328 .ne 3v+\\n[\\n[.ev]:PD]u+\\n(.Vu
1329 .sp 1
1330 .ft B
1332 .de @SH
1333 .  SH-NO-TAG
1334 .  HTML-TAG ".SH 1"
1336 .\" TL, AU, and AI are aliased to these in cov*ab-init.
1337 .de par@TL
1338 .par@finish
1339 .sp 1
1340 .ft B
1341 .ps +2
1342 .vs +3p
1343 .ce 9999
1344 .HTML-TAG ".tl"
1346 .de par@AU
1347 .par@finish
1348 .sp 1
1349 .ft I
1350 .ce 9999
1352 .de par@AI
1353 .par@finish
1354 .sp .5
1355 .ce 9999
1357 .\" In paragraph macros.
1358 .de NL
1359 .ps \\n[\\n[.ev]:PS]
1361 .de SM
1362 .ps -2
1364 .de LG
1365 .ps +2
1367 .de R
1368 .ft R
1370 .\" par*define-font-macro macro font
1371 .de par*define-font-macro
1372 .de \\$1
1373 .ie \\\\n[.$] \{\
1374 .       nr par*prev-font \\\\n[.f]
1375 \&\\\\$3\f[\\$2]\\\\$1\f[\\\\n[par*prev-font]]\\\\$2
1377 .el .ft \\$2
1378 \\..
1380 .par*define-font-macro B B
1381 .par*define-font-macro I I
1382 .par*define-font-macro BI BI
1383 .par*define-font-macro CW CR
1384 .\" underline a word
1385 .de UL
1386 \Z'\\$1'\v'.25m'\D'l \w'\\$1'u 0'\v'-.25m'\\$2
1388 .\" box a word
1389 .de BX
1390 .nr par*bxw \w'\\$1'+.4m
1391 \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''\
1392 \Z'\h'.2m'\\$1'\
1393 \h'\\n[par*bxw]u'
1395 .\" The first time UX is used, put a registered mark after it.
1396 .ds par*ux-rg \(rg
1397 .de UX
1398 \s[\\n[.s]*8u/10u]UNIX\s0\\$1\\*[par*ux-rg]
1399 .ds par*ux-rg
1401 .ds par@sup-start \v'-.9m\s'\En[.s]*7u/10u'+.7m'
1402 .als { par@sup-start
1403 .ds par@sup-end \v'-.7m\s0+.9m'
1404 .als } par@sup-end
1405 .\" footnote paragraphs
1406 .\" FF is the footnote format
1407 .nr FF 0
1408 .\" This can be redefined. It gets a second argument of `no' if the first
1409 .\" argument was supplied by the user, rather than automatically.
1410 .de FP
1412 .if !d par*fp!\\n[FF] \{\
1413 .       @error unknown footnote format `\\n[FF]'
1414 .       nr FF 0
1416 .ie '\\$2'no' .par*fp!\\n[FF]-no "\\$1"
1417 .el .par*fp!\\n[FF] "\\$1"
1419 .de par*fp!0
1420 .@PP
1421 \&\\*[par@sup-start]\\$1\\*[par@sup-end]\ \c
1423 .de par*fp!0-no
1424 .@PP
1425 \&\\$1\ \c
1427 .de par*fp!1
1428 .@PP
1429 \&\\$1.\ \c
1431 .de par*fp!1-no
1432 .@PP
1433 \&\\$1\ \c
1435 .de par*fp!2
1436 .@LP
1437 \&\\$1.\ \c
1439 .de par*fp!2-no
1440 .@LP
1441 \&\\$1\ \c
1443 .de par*fp!3
1444 .@IP "\\$1." (u;\\n[\\n[.ev]:PI]*2)
1446 .de par*fp!3-no
1447 .@IP "\\$1" (u;\\n[\\n[.ev]:PI]*2)
1449 .\" ***************************
1450 .\" ******** module nh ********
1451 .\" ***************************
1452 .\" Numbered headings.
1453 .\" nh*hl is the level of the last heading
1454 .nr nh*hl 0
1455 .\" numbered heading
1456 .de @NH
1457 .ie '\\$1'S' \{\
1458 .       shift
1459 .       nr nh*hl 0
1460 .       while \\n[.$] \{\
1461 .               nr nh*hl +1
1462 .               nr H\\n[nh*hl] 0\\$1
1463 .               shift
1464 .       \}
1465 .       if !\\n[nh*hl] \{\
1466 .               nr H1 1
1467 .               nr nh*hl 1
1468 .               @error missing arguments to .NH S
1469 .       \}
1471 .el \{\
1472 .       nr nh*ohl \\n[nh*hl]
1473 .       ie \\n[.$] \{\
1474 .               nr nh*hl 0\\$1
1475 .               ie \\n[nh*hl]<=0 \{\
1476 .                       nr nh*ohl 0
1477 .                       nr nh*hl 1
1478 .               \}
1479 .               el \{\
1480 .                       if \\n[nh*hl]-\\n[nh*ohl]>1 \
1481 .                               @warning .NH \\n[nh*ohl] followed by .NH \\n[nh*hl]
1482 .               \}
1483 .       \}
1484 .       el .nr nh*hl 1
1485 .       while \\n[nh*hl]>\\n[nh*ohl] \{\
1486 .               nr nh*ohl +1
1487 .               nr H\\n[nh*ohl] 0
1488 .       \}
1489 .       nr H\\n[nh*hl] +1
1491 .ds SN
1492 .nr nh*i 0
1493 .while \\n[nh*i]<\\n[nh*hl] \{\
1494 .       nr nh*i +1
1495 .       as SN \\n[H\\n[nh*i]].
1497 .SH-NO-TAG
1498 .HTML-TAG ".NH \\$1"
1499 \\*[SN]
1501 .\" ****************************
1502 .\" ******** module toc ********
1503 .\" ****************************
1504 .\" Table of contents generation.
1505 .de @XS
1506 .da toc*div
1507 .ev h
1508 .ie \\n[.$] .XA "\\$1"
1509 .el .XA
1511 .de @div-end!toc*div
1514 .de XA
1515 .ie '\\n(.z'toc*div' \{\
1516 .       if d toc*num .toc*end-entry
1517 .       ie \\n[.$] \{\
1518 .               ie '\\$1'no' .ds toc*num
1519 .               el .ds toc*num "\\$1
1520 .       \}
1521 .       el .ds toc*num \\n[PN]
1522 .       br
1523 .       par@reset
1524 .       na
1525 .       ll -8n
1526 .       in (n;0\\$2)
1528 .el .@error XA without XS
1530 .de XE
1531 .ie '\\n(.z'toc*div' \{\
1532 .       if d toc*num .toc*end-entry
1533 .       ev
1534 .       di
1536 .el .@error XS without XE
1538 .de toc*end-entry
1539 \\a\\t\\*[toc*num]
1541 .rm toc*num
1543 .de PX
1545 .if !'\\$1'no' \{\
1546 .       ce 1
1547 .       ps \\n[PS]+2
1548 .       ft B
1549 \\*[TOC]
1550 .       ft
1551 .       ps
1554 .char \[toc*leader-char] .\h'1m'
1555 .lc \[toc*leader-char]
1556 .ta (u;\\n[.l]-\\n[.i]-\w'000') (u;\\n[.l]-\\n[.i])R
1557 .sp 2
1558 .toc*div
1559 .par@reset
1561 .\" print the table of contents on page i
1562 .de TC
1564 .pg@begin 1 i
1565 .PX \\$1
1567 .\" ****************************
1568 .\" ******** module eqn ********
1569 .\" ****************************
1570 .\" Eqn support.
1571 .de EQ
1573 .de EN
1575 .de @EQ
1577 .ds eqn*num "\\$2
1578 .ie '\\$1'L' .nr eqn*type 0
1579 .el \{\
1580 .       ie '\\$1'I' .nr eqn*type 1
1581 .       el \{\
1582 .               nr eqn*type 2
1583 .               if !'\\$1'C' .ds eqn*num "\\$1
1584 .       \}
1586 .di eqn*div
1587 .in 0
1588 .if \\n[eqn*type]=0 .HTML-IMAGE-LEFT
1589 .if \\n[eqn*type]=1 \{\
1590 .   if '\*(.T'html' .RS
1591 .   HTML-IMAGE-INLINE
1593 .if \\n[eqn*type]=2 .HTML-IMAGE
1594 .if !'\*(.T'html' .nf
1596 .de @div-end!eqn*div
1597 .@EN
1599 .\" Note that geqn mark and lineup work correctly in centered equations.
1600 .de @EN
1601 .ie !'\\n(.z'eqn*div' .@error-recover mismatched EN
1602 .el \{\
1603 .       br
1604 .       di
1605 .       nr eqn*have-num 0
1606 .       if !'\\*[eqn*num]'' .nr eqn*have-num 1
1607 .       ie \\n[dl]:\\n[eqn*have-num] \{\
1608 .               if !'\*(.T'html' .sp \\n[DD]u
1609 .               par@reset
1610 .               ds eqn*tabs \\n[.tabs]
1611 .               nf
1612 .               ie \\n[dl] \{\
1613 .\"                     --fixme-- this really should not be necessary
1614 .\"                     and indicates that there is extra space creeping into
1615 .\"                     an equation when ps4html is enabled..
1616 .                       ie r ps4html .ds@need \\n[dn]u-1v+\n[.V]u+1i
1617 .                       el .ds@need \\n[dn]u-1v+\n[.V]u
1618 .                       chop eqn*div
1619 .                       ie \\n[eqn*type]=0 \{\
1620 .                               ta (u;\\n[.l]-\\n[.i])R
1621 \\*[eqn*div]\t\\*[eqn*num]
1622 .                       \}
1623 .                       el \{\
1624 .                               ie \\n[eqn*type]=1 .ta \\n[DI]u \
1625 (u;\\n[.l]-\\n[.i])R
1626 .                               el .ta (u;\\n[.l]-\\n[.i]/2)C \
1627 (u;\\n[.l]-\\n[.i])R
1628 \t\\*[eqn*div]\t\\*[eqn*num]
1629 .                       \}
1630 .               \}
1631 .               el \{\
1632 .                       ta (u;\\n[.l]-\\n[.i])R
1633 \t\\*[eqn*num]
1634 .               \}
1635 .               if !'\*(.T'html' .sp \\n[DD]u
1636 .               ta \\*[eqn*tabs]
1637 .       \}
1638 .       el \{
1639 .\" must terminate empty equations in html and ps4html as they contain
1640 .\" the HTML-IMAGE-END suppression nodes
1641 .               if \\n[dl] .chop eqn*div
1642 .               if '\*(.T'html' \\*[eqn*div]
1643 .               if r ps4html    \\*[eqn*div]
1644 .       \}
1645 .       if !'\*(.T'html' .fi
1646 .       if \\n[eqn*type]=0 .HTML-IMAGE-END
1647 .       if \\n[eqn*type]=1 \{\
1648 .               HTML-IMAGE-END
1649 .               if '\*(.T'html' .RE
1650 .       \}
1651 .       if \\n[eqn*type]=2 .HTML-IMAGE-END
1654 .\" ****************************
1655 .\" ******** module tbl ********
1656 .\" ****************************
1657 .\" Tbl support.
1658 .nr tbl*have-header 0
1659 .\" This gets called if TS occurs before the first paragraph.
1660 .de TS
1662 .\" cov*ab-init aliases TS to @TS
1663 \\*[TS]\\
1665 .de @TS
1666 .sp \\n[DD]u
1667 .\" .if !'\*(.T'html' .sp \\n[DD]u
1668 .if '\\$1'H' .di tbl*header-div
1669 .HTML-IMAGE
1671 .de tbl@top-hook
1672 .if \\n[tbl*have-header] \{\
1673 .       ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl*print-header
1674 .       el .sp \\n[.t]u
1677 .de tbl*print-header
1678 .ev nf
1679 .tbl*header-div
1681 .mk #T
1683 .de TH
1684 .ie '\\n[.z]'tbl*header-div' \{\
1685 .       nr T. 0
1686 .       T#
1687 .       br
1688 .       di
1689 .       ie \\n[dn]+\\n[FM]+\\n[HM]+2v>=\\n[.p] \{\
1690 .               @error ridiculously long table header
1691 .               ds@need \\n[dn]
1692 .               tbl*print-header
1693 .       \}
1694 .       el \{\
1695 .               nr tbl*header-ht \\n[dn]
1696 .               ds@need \\n[dn]u+1v
1697 .               tbl*print-header
1698 .               nr tbl*have-header 1
1699 .       \}
1701 .el .@error-recover .TH without .TS H
1703 .de @div-end!tbl*header-div
1707 .de TE
1708 .ie '\\n(.z'tbl*header-div' .@error-recover .TS H but no .TH before .TE
1709 .el \{\
1710 .       nr tbl*have-header 0
1711 .       if !'\*(.T'html' .sp \\n[DD]u
1713 .       HTML-IMAGE-END
1714 .\" reset tabs
1717 .de tbl@bottom-hook
1718 .if \\n[tbl*have-header] \{\
1719 .       nr T. 1
1720 .       T#
1723 .de T&
1725 .\" ****************************
1726 .\" ******** module pic ********
1727 .\" ****************************
1728 .\" Pic support.
1729 .\" PS height width
1730 .de PS
1732 .sp \\n[DD]u
1733 .ie \\n[.$]<2 .@error bad arguments to PS (not preprocessed with pic?)
1734 .el \{\
1735 .       ds@need (u;\\$1)+1v
1736 .       in +(u;\\n[.l]-\\n[.i]-\\$2/2>?0)
1738 .HTML-IMAGE
1740 .de PE
1741 .HTML-IMAGE-END
1742 .par@reset
1743 .sp \\n[DD]u+.5m
1745 .\" ****************************
1746 .\" ******** module ref ********
1747 .\" ****************************
1748 .\" Refer support.
1749 .de ]-
1750 .rm [A [B [C [D [E [G [I [J [N [O [P [Q [R [S [T [V
1751 .rm ref*string
1753 .\" Other
1754 .ds ref*spec!0 Q A T1 S V N P I C D O
1755 .\" Journal article
1756 .ds ref*spec!1 Q A T2 J S V N P I C D O
1757 .\" Book
1758 .ds ref*spec!2 Q A T1 S V P I C D O
1759 .\" Article within book
1760 .ds ref*spec!3 Q A T2 B E S V P I C D O
1761 .\" Tech report
1762 .ds ref*spec!4 Q A T2 R G P I C D O
1763 .\" ][ type
1764 .de ][
1765 .if r [T \{\
1766 .       als [T1 [T
1767 .       als [T2 [T
1769 .ie d ref*spec!\\$1 .ref*build \\*[ref*spec!\\$1]
1770 .el \{\
1771 .       @error unknown reference type `\\$1'
1772 .       ref*build \\*[ref*spec!0]
1774 .ref*print
1775 .rm ref*string
1776 .rm [F [T1 [T2
1778 .\" start of reference number
1779 .ds [. \\*[par@sup-start]
1780 .\" end of reference number
1781 .ds .] \\*[par@sup-end]
1782 .\" period before reference
1783 .ds <. .
1784 .\" period after reference
1785 .ds >. \" empty
1786 .\" comma before reference
1787 .ds <, ,
1788 .\" comma after reference
1789 .ds >, \" empty
1790 .\" start collected references
1791 .de ]<
1792 .als ref*print ref*end-print
1794 \&\\*[REFERENCES]
1795 .par@reset
1797 .\" end collected references
1798 .de ]>
1799 .par@finish
1800 .als ref*print ref*normal-print
1802 .de ref*normal-print
1803 .ie d [F .FS "\\*([.\\*([F\\*(.]"
1804 .el .FS \&
1805 \\*[ref*string]
1808 .de ref*end-print
1809 .ie d [F .IP "\\*([F."
1810 .el .XP
1811 \\*[ref*string]
1813 .als ref*print ref*normal-print
1814 .de ref*build
1815 .rm ref*string ref*post-punct
1816 .nr ref*suppress-period 1
1817 .while \\n[.$] \{\
1818 .       if d [\\$1 \{\
1819 .               ie d ref*add-\\$1 .ref*add-\\$1
1820 .               el .ref*add-dflt \\$1
1821 .       \}
1822 .       shift
1824 .\" now add a final period
1825 .ie d ref*string \{\
1826 .       if !\\n[ref*suppress-period] .as ref*string .
1827 .       if d ref*post-punct \{\
1828 .               as ref*string "\\*[ref*post-punct]
1829 .               rm ref*post-punct
1830 .       \}
1832 .el .ds ref*string
1834 .de ref*add-T1
1835 .ref*field T , "\fI" "" "\fP"
1836 .if r [T .nr ref*suppress-period \\n([T
1838 .de ref*add-T2
1839 .ref*field T , "\\*Q" "" "\\*U"
1840 .if r [T .nr ref*suppress-period \\n([T
1842 .de ref*add-P
1843 .ie \\n([P>0 .ref*field P , "pp. "
1844 .el .ref*field P , "p. "
1846 .de ref*add-J
1847 .ref*field J , \fI "" \fP
1849 .de ref*add-D
1850 .ref*field D "" ( )
1852 .de ref*add-E
1853 .ref*field E , "ed. "
1855 .de ref*add-G
1856 .ref*field G "" ( )
1858 .de ref*add-B
1859 .ref*field B "" "in \fI" "" \fP
1861 .de ref*add-O
1862 .ref*field O .
1863 .ie r [O .nr ref*suppress-period \\n([O
1864 .el .nr ref*suppress-period 1
1866 .de ref*add-A
1867 .ref*field A ,
1868 .if r [A .nr ref*suppress-period \\n([A
1870 .de ref*add-dflt
1871 .ref*field \\$1 ,
1873 .\" First argument is the field letter.
1874 .\" Second argument is the punctuation character to use to separate this field
1875 .\" from the previous field.
1876 .\" Third argument is a string with which to prefix this field.
1877 .\" Fourth argument is a string with which to postfix this field.
1878 .\" Fifth argument is a string to add after the punctuation character supplied
1879 .\" by the next field.
1880 .de ref*field
1881 .if d ref*string \{\
1882 .       ie d ref*post-punct \{\
1883 .               as ref*string "\\$2\\*[ref*post-punct] \"
1884 .               rm ref*post-punct
1885 .       \}
1886 .       el .as ref*string "\\$2 \"
1888 .as ref*string "\\$3\\*([\\$1\\$4
1889 .if \\n[.$]>4 .ds ref*post-punct "\\$5
1890 .nr ref*suppress-period 0
1892 .\" ****************************
1893 .\" ******** module acc ********
1894 .\" ****************************
1895 .\" Accents and special characters.
1896 .ds Q \(lq
1897 .ds U \(rq
1898 .ds - \(em
1899 .\" Characters
1900 .\" The idea of this definition is for the top of the 3 to be at the x-height.
1901 .if !c\[yogh] .char \[yogh] \Z'\v'\w'x'*0-\En[rst]u'\s[\En[.s]*8u/10u]\
1902 \v'\w'3'*0+\En[rst]u'3\s0'\h'\w'\s[\En[.s]*8u/10u]3'u'
1903 .\" Accents
1904 .de acc*over-def
1905 .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
1906 \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
1908 .de acc*under-def
1909 .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
1911 .de acc*slash-def
1912 .ds \\$1 \Z'\h'(u;-\En[.w]-\w'\\$2'/2)'\
1913 \v'(u;\En[.cdp]-\En[.cht]+\En[rst]+\En[rsb]/2)'\\$2'
1915 .de acc*prefix-def
1916 .ds \\$1 \Z'\h'(u;\w'x'-\w'\\$2'/2)'\\$2'
1918 .acc*prefix-def ' \'
1919 .acc*prefix-def ` \`
1920 .acc*prefix-def ^ ^
1921 .acc*prefix-def , \(ac
1922 .acc*prefix-def : \(ad
1923 .acc*prefix-def ~ ~
1924 .\" improved accent marks
1925 .de AM
1926 .acc*over-def ' \'
1927 .acc*over-def ` \`
1928 .acc*over-def ^ ^
1929 .acc*over-def ~ ~
1930 .acc*over-def : \(ad
1931 .acc*over-def v \(ah
1932 .acc*over-def _ \(a-
1933 .acc*over-def o \(ao
1934 .acc*under-def , \(ac
1935 .acc*under-def . \s[\En[.s]*8u/10u]\v'.2m'.\v'-.2m'\s0
1936 .acc*under-def hook \(ho
1937 .acc*slash-def / /
1938 .char \[hooko] o\\\\*[hook]
1939 .ds q \[hooko]
1940 .ds 3 \[yogh]
1941 .ds D- \(-D\"                   Icelandic uppercase eth
1942 .ds d- \(Sd\"                   Icelandic lowercase eth
1943 .ds Th \(TP\"                   Icelandic uppercase thorn
1944 .ds th \(Tp\"                   Icelandic lowercase thorn
1945 .ds 8 \(ss\"                    German double s
1946 .ds Ae \(AE\"                   AE ligature
1947 .ds ae \(ae\"                   ae ligature
1948 .ds Oe \(OE\"                   OE ligature
1949 .ds oe \(oe\"                   oe ligature
1950 .ds ? \(r?\"                    upside down ?
1951 .ds ! \(r!\"                    upside down !
1953 .de CHECK-FOOTER-AND-KEEP
1954 .\" it might be better to als FS -> B1 and FE -> B2
1955 .\" however this produced wierd results, so I've moved back to a more reliable
1956 .\" but less interesting solution --fixme--
1957 .   if '\*(.T'html' \{\
1958 .       rm KF
1959 .       als KF KS
1960 .       rm FS
1961 .       de FS
1962 .               br
1963 .               HTML-IMAGE
1964 \\..
1965 .       rm FE
1966 .       de FE
1967 .               br
1968 .               HTML-IMAGE-END
1969 \\..
1970 .   \}
1971 .   if r ps4html \{\
1972 .       rm FS
1973 .       de FS
1974 .               br
1975 .               HTML-IMAGE
1976 \\..
1977 .       rm FE
1978 .       de FE
1979 .               br
1980 .               HTML-IMAGE-END
1981 \\..
1982 .   \}
1984 .par@load-init
1985 .if '\*(.T'html' \{\
1986 .  rm @IP
1987 .  als @IP @IP-html
1989 .\" Make sure that no blank lines creep in at the end of this file.