Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / groff / tmac / s.tmac
1 .\" -*- nroff -*-
2 .ig
3
4 s.tmac
5
6 Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002
7   Free Software Foundation, Inc.
8      Written by James Clark (jjc@jclark.com)
9
10 This file is part of groff.
11
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.
16
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.
21
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.
25 ..
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: \\$*
37 ..
38 .de @warning
39 .tm \\n(.F:\\n(.c: macro warning: \\$*
40 ..
41 .de @fatal
42 .ab \\n(.F:\\n(.c: fatal macro error: \\$*
43 ..
44 .de @not-implemented
45 .@error sorry, \\$0 not implemented
46 .als \\$0 @nop
47 ..
48 .als TM @not-implemented
49 .als CT @not-implemented
50 .de @nop
51 ..
52 .de @init
53 .nr PO \\n(.o
54 .\" a non-empty environment
55 .ev ne
56 \c
57 .ev
58 .ev nf
59 'nf
60 .ev
61 ..
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 "\\$*
81 ..
82 .de DA
83 .if \\n[.$] .ds DY "\\$*
84 .ds CF \\*[DY]
85 ..
86 .\" indexing
87 .de IX
88 .tm \\$1\t\\$2\t\\$3\t\\$4 ... \\n[PN]
89 ..
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
101 .\}
102 .while !'\\n[.ev]'0' .ev
103 .par@reset-env
104 .par@reset
105 ..
106 .de *div-end-default
107 .ds *last-div \\n(.z
108 .br
109 .di
110 .ev nf
111 .\\*[*last-div]
112 .ev
113 ..
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
120 ..
121 .de cov*err-not-before-tl
122 .@error \\$0 is not allowed before TL
123 ..
124 .de cov*err-not-again
125 .@error \\$0 is not allowed more than once
126 ..
127 .de cov*err-not-after-ab
128 .@error \\$0 is not allowed after first AB, LP, PP, IP, SH or NH
129 ..
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
142 .\}
143 .el \{\
144 .       pg@top
145 .       als FS @FS
146 .       als FE @FE
147 .\}
148 .wh 0 pg@top
149 .CHECK-FOOTER-AND-KEEP
150 ..
151 .wh 0 cov*first-page-init
152 .\" This handles the case where FS occurs before TL or LP.
153 .de FS
154 .br
155 \\*[FS]\\
156 ..
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
164 ..
165 .de TL
166 .br
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"
179 ..
180 .de @AU
181 .par@reset
182 .if !'\\n(.z'' \{\
183 .       br
184 .       di
185 .\}
186 .nr cov*n-au +1
187 .di cov*au-div!\\n[cov*n-au]
188 .nf
189 .ft I
190 .ps \\n[PS]
191 ..
192 .de @AI
193 .if !'\*(.T'html' .par@reset
194 .if !'\\n(.z'' \{\
195 .       br
196 .       di
197 .\}
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]
204 .\}
205 ..
206 .de LP
207 .if !'\\n[.z]'' \{\
208 .       br
209 .       di
210 .\}
211 .br
212 .cov*ab-init
213 .cov*print
214 \\*[\\$0]\\
215 ..
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
249 ..
250 .de @AB
251 .if !'\\n(.z'' \{\
252 .       br
253 .       di
254 .\}
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
265 .\}
266 .ns
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
274 .\}
275 ..
276 .de AE
277 .ie '\*(.T'html' \{\
278 .       als AE cov*err-not-again
279 .\}
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
291 .\}
292 ..
293 .de @div-end!cov*ab-div
294 .AE
295 ..
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
301 .\}
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
311 .\}
312 ..
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
321 .\}
322 .sp 3
323 .par@reset
324 \\*[DY]
325 .br
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 .       \}
338 .\}
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
348 .rs
349 .sp 1
350 ..
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
357 .\}
358 .sp 1
359 ..
360 .de cov*tl-au-print
361 .par@reset
362 .nf
363 .rs
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
379 .\}
380 .ce 0
381 ..
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
389 .\}
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
397 ..
398 .de @div-end!cov*fn-div
399 .cov*FE
400 ..
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]
409 .\}
410 .el .@error FE without matching FS
411 ..
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 "\\$*
434 ..
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]
443 .\}
444 ..
445 .de BT
446 .ie o .tl \\*[pg*OF]
447 .el .tl \\*[pg*EF]
448 ..
449 .nr pg*P1 0
450 .de P1
451 .nr pg*P1 1
452 ..
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
459 .br
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 .       \}
467 .\}
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
472 .\}
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
481 .\}
482 .HTML-TAG ".mc \\n[pg@ncols] \\n[pg@colw] \\n[pg*gutw]"
483 .mk pg*col-top
484 .ns
485 .nr pg*col-num 0
486 .nr pg@fn-colw \\n[pg@colw]*5/6
487 .par@reset
488 ..
489 .de 2C
490 .MC
491 ..
492 .de 1C
493 .MC \\n[LL]u
494 ..
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)
506 .PT
507 .sp |\\n[HM]u
508 .if d HD .HD
509 .mk pg@header-bottom
510 .ev
511 .mk pg*col-top
512 .pg*start-col
513 ..
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
520 .ns
521 ..
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
527 .ns
528 ..
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
535 ..
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
541 ..
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
551 .\}
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
564 .\}
565 ..
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
572 .\}
573 .el .rr pg*next-number
574 .pg@super-eject
575 ..
576 .\" print the footer line
577 .de pg*footer
578 .ev h
579 .par@reset
580 .BT
581 .ev
582 ..
583 .\" flush out any keeps or footnotes
584 .de pg@super-eject
585 .br
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
592 .\}
593 .bp
594 ..
595 .nr pg@text-ended 0
596 .de pg@end-text
597 .br
598 .nr pg@text-ended 1
599 .pg@super-eject
600 ..
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]
611 .ev
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
622 .\}
623 ..
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
637 .\}
638 .ev fn
639 .par@reset-env
640 .fn*start-div
641 .par@reset
642 .ie \\n[.$] .FP \\$@
643 .el .@LP
644 ..
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
652 .\}
653 ..
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
667 .\}
668 ..
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]
676 .ev
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
680 .\}
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
696 .\}
697 ..
698 .de fn*catch-overflow
699 .di fn@overflow-div
700 ..
701 .nr fn*embed-count 0
702 .de @div-end!fn@div
703 .br
704 .if '\\n[.ev]'fn' .ev
705 .fn*end-div
706 .nr fn*open 0
707 ..
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
713 .\}
714 .el .di fn*embed-div
715 ..
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
725 .\}
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 .       \}
740 .\}
741 ..
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
751 .\}
752 .el \{\
753 \!.     fn*embed-start \\$1
754 .       rs
755 .\}
756 ..
757 .de fn*embed-end
758 .ie '\\n(.z'fn*null' \{\
759 .       di
760 .       rm fn*null
761 .\}
762 .el \!.fn*embed-end
763 ..
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'
770 .br
771 .ev
772 ..
773 .\" ***************************
774 .\" ******** module kp ********
775 .\" ***************************
776 .\" Keeps.
777 .de KS
778 .br
779 .di kp*div
780 ..
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
787 ..
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
793 .\}
794 ..
795 .de @div-end!kp*div
796 .kp*end
797 ..
798 .de @div-end!kp*fdiv
799 .kp*fend
800 ..
801 .de kp*need
802 .ie '\\n(.z'' .ds@need \\$1
803 .el \!.kp*need \\$1
804 ..
805 .\" end non-floating keep
806 .de kp*end
807 .br
808 .di
809 .kp*need \\n[dn]
810 .ev nf
811 .kp*div
812 .ev
813 .rm kp*div
814 ..
815 .\" Floating keeps.
816 .nr kp@head 0
817 .nr kp@tail 0
818 .\" end floating keep
819 .de kp*fend
820 .br
821 .ev
822 .di
823 .ie \\n[.t]-(\\n[.k]>0*1v)>\\n[dn] \{\
824 .       br
825 .       ev nf
826 .       kp*fdiv
827 .       rm kp*fdiv
828 .       ev
829 .\}
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
834 .\}
835 ..
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
843 .\}
844 ..
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
865 .\}
866 ..
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
874 ..
875 .de ds@auto-end
876 .if \\n[\\n[.ev]:ds-type] \{\
877 .       @error automatically terminating display
878 .       DE
879 .\}
880 ..
881 .de @div-end!ds*div
882 .ie \\n[\\n[.ev]:ds-type] .DE
883 .el .ds*end!2
884 ..
885 .de ds*end!0
886 .@error DE without DS, ID, CD, LD or BD
887 ..
888 .de LD
889 .br
890 .nr \\n[.ev]:ds-type 1
891 .par@reset
892 .nf
893 .sp \\n[DD]u
894 ..
895 .de ID
896 .LD
897 .ie \\n[.$] .in +(n;\\$1)
898 .el .in +\\n[DI]u
899 ..
900 .de CD
901 .LD
902 .ce 9999
903 ..
904 .de RD
905 .LD
906 .rj 9999
907 ..
908 .de ds*common-end
909 .par@reset
910 .sp \\n[DD]u
911 ..
912 .als ds*end!1 ds*common-end
913 .de BD
914 .LD
915 .nr \\n[.ev]:ds-type 2
916 .di ds*div
917 ..
918 .de ds*end!2
919 .br
920 .ie '\\n(.z'ds*div' \{\
921 .       di
922 .       nf
923 .       in (u;\\n[.l]-\\n[dl]/2>?0)
924 .       ds*div
925 .       rm ds*div
926 .       ds*common-end
927 .\}
928 .el .@error-recover mismatched DE
929 ..
930 .de DS
931 .br
932 .di ds*div
933 .ie '\\$1'B' \{\
934 .       LD
935 .       nr \\n[.ev]:ds-type 4
936 .\}
937 .el \{\
938 .       ie '\\$1'L' .LD
939 .       el \{\
940 .               ie '\\$1'C' .CD
941 .               el \{\
942 .                       ie '\\$1'R' .RD
943 .                       el \{\
944 .                               ie '\\$1'I' .ID \\$2
945 .                               el .ID \\$1
946 .                       \}
947 .               \}
948 .       \}
949 .       nr \\n[.ev]:ds-type 3
950 .\}
951 ..
952 .de ds@need
953 .if '\\n(.z'' \{\
954 .       while \\n[.t]<=(\\$1)&(\\n[nl]>\\n[pg@header-bottom]) \{\
955 .               rs
956 '               sp \\n[.t]u
957 .       \}
958 .\}
959 ..
960 .de ds*end!3
961 .br
962 .ie '\\n(.z'ds*div' \{\
963 .       di
964 .       ds@need \\n[dn]
965 .       ev nf
966 .       ds*div
967 .       ev
968 .       rm ds*div
969 .       ds*common-end
970 .\}
971 .el .@error-recover mismatched DE
972 ..
973 .de ds*end!4
974 .ie '\\n(.z'ds*div' \{\
975 .       br
976 .       di
977 .       nf
978 .       in (u;\\n[.l]-\\n[dl]/2>?0)
979 .       ds@need \\n[dn]
980 .       ds*div
981 .       rm ds*div
982 .       ds*common-end
983 .\}
984 .el .@error-recover mismatched DE
985 ..
986 .\" ****************************
987 .\" ******** module par ********
988 .\" ****************************
989 .\" Paragraph-level formatting.
990 .\" Load time initialization.
991 .de par@load-init
992 .\" PS and VS might have been set on the command-line
993 .if !rPS .nr PS 10
994 .if !rLL .nr LL 6i
995 .ll \\n[LL]u
996 .\" don't set LT so that it can be defaulted from LL
997 .ie rLT .lt \\n[LT]u
998 .el .lt \\n[LL]u
999 .ps \\n[PS]
1000 .\" don't set VS so that it can be defaulted from PS
1001 .ie rVS .par*vs \\n[VS]
1002 .el .par*vs \\n[PS]+2
1003 .if dFAM .fam \\*[FAM]
1004 .if !rHY .nr HY 14
1005 .hy \\n[HY]
1006 .TA
1007 .CHECK-FOOTER-AND-KEEP
1008 ..
1009 .de par*vs
1010 .\" If it's too big to be in points, treat it as units.
1011 .ie (p;\\$1)>=40p .vs (u;\\$1)
1012 .el .vs (p;\\$1)
1013 ..
1014 .de par@ab-indent
1015 .nr 0:li (u;\\n[LL]/12)
1016 .nr 0:ri \\n[0:li]
1017 ..
1018 .de par*env-init
1019 .aln \\n[.ev]:PS PS
1020 .aln \\n[.ev]:VS VS
1021 .aln \\n[.ev]:LL LL
1022 .aln \\n[.ev]:MCLL LL
1023 .aln \\n[.ev]:LT LT
1024 .aln \\n[.ev]:MCLT LT
1025 .aln \\n[.ev]:PI PI
1026 .aln \\n[.ev]:PD PD
1027 .ad \\n[par*adj]
1028 .par@reset-env
1029 ..
1030 .\" happens when the first page begins
1031 .de par@init
1032 .if !rLT .nr LT \\n[LL]
1033 .if !rFL .nr FL \\n[LL]*5/6
1034 .if !rVS .nr VS \\n[PS]+2
1035 .if !rDI .nr DI .5i
1036 .if !rFPS .nr FPS \\n[PS]-2
1037 .if !rFVS .nr FVS \\n[FPS]+2
1038 .\" don't change environment 0
1039 .ev h
1040 .ps \\n[PS]
1041 .if !rQI .nr QI 5n
1042 .if !rPI .nr PI 5n
1043 .par*vs \\n[VS]
1044 .if !rPD .nr PD .3v>?\n(.V
1045 .if !rDD .nr DD .5v>?\n(.V
1046 .if !rFI .nr FI 2n
1047 .if !rFPD .nr FPD \\n[PD]/2
1048 .ev
1049 .if !dFAM .ds FAM \\n[.fam]
1050 .nr par*adj \\n[.j]
1051 .par*env-init
1052 .ev h
1053 .par*env-init
1054 .ev
1055 .ev fn
1056 .par*env-init
1057 .ev
1058 .ev k
1059 .par*env-init
1060 .ev
1061 .aln 0:MCLL pg@colw
1062 .aln 0:MCLT pg@colw
1063 .aln k:MCLL pg@colw
1064 .aln k:MCLT pg@colw
1065 .aln fn:PS FPS
1066 .aln fn:VS FVS
1067 .aln fn:LL FL
1068 .aln fn:LT FL
1069 .aln fn:PI FI
1070 .aln fn:PD FPD
1071 .aln fn:MCLL pg@fn-colw
1072 .aln fn:MCLT pg@fn-colw
1073 ..
1074 .de par@reset-env
1075 .nr \\n[.ev]:il 0
1076 .nr \\n[.ev]:li 0
1077 .nr \\n[.ev]:ri 0
1078 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1079 .nr \\n[.ev]:pli 0
1080 .nr \\n[.ev]:pri 0
1081 .nr \\n[.ev]:ds-type 0
1082 ..
1083 .\" par@reset
1084 .de par@reset
1085 .br
1086 .ce 0
1087 .rj 0
1088 .ul 0
1089 .fi
1090 .ie \\n[pg@ncols]>1 \{\
1091 .       ll (u;\\n[\\n[.ev]:MCLL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1092 .       lt \\n[\\n[.ev]:MCLT]u
1093 .\}
1094 .el \{\
1095 .       ll (u;\\n[\\n[.ev]:LL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1096 .       lt \\n[\\n[.ev]:LT]u
1097 .\}
1098 .in (u;\\n[\\n[.ev]:li]+\\n[\\n[.ev]:pli])
1099 .ft 1
1100 .fam \\*[FAM]
1101 .ps \\n[\\n[.ev]:PS]
1102 .par*vs \\n[\\n[.ev]:VS]
1103 .ls 1
1104 .TA
1105 .hy \\n[HY]
1106 ..
1107 .de @RT
1108 .nr \\n[.ev]:pli 0
1109 .nr \\n[.ev]:pri 0
1110 .par@reset
1111 ..
1112 .\" This can be redefined by the user.
1113 .de TA
1114 .ta T 5n
1115 ..
1116 .de par*start
1117 .ds@auto-end
1118 .nr \\n[.ev]:pli \\$1
1119 .nr \\n[.ev]:pri \\$2
1120 .par@reset
1121 .sp \\n[\\n[.ev]:PD]u
1122 .ne 1v+\\n(.Vu
1123 ..
1124 .de par@finish
1125 .nr \\n[.ev]:pli 0
1126 .nr \\n[.ev]:pri 0
1127 .par@reset
1128 ..
1129 .\" normal LP
1130 .de @LP
1131 .par*start 0 0
1132 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1133 ..
1134 .de @PP
1135 .par*start 0 0
1136 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1137 .if !'\*(.T'html' .ti +\\n[\\n[.ev]:ai]u
1138 ..
1139 .de @QP
1140 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1141 .par*start \\n[QI] \\n[QI]
1142 ..
1143 .de @XP
1144 .par*start \\n[\\n[.ev]:PI] 0
1145 .ti -\\n[\\n[.ev]:PI]u
1146 ..
1147 .de @IP
1148 .if \\n[.$]>1 .nr \\n[.ev]:ai (n;\\$2)
1149 .par*start \\n[\\n[.ev]:ai] 0
1150 .if !'\\$1'' \{\
1151 .       \" Divert the label so as to freeze any spaces.
1152 .       di par*label
1153 .       par*push-tag-env
1154 \&\\$1
1155 .       par*pop-tag-env
1156 .       di
1157 .       chop par*label
1158 .       ti -\\n[\\n[.ev]:ai]u
1159 .       ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \\*[par*label]\h'|\\n[\\n[.ev]:ai]u'\c
1160 .       el \{\
1161 \\*[par*label]
1162 .               br
1163 .       \}
1164 .       rm par*label
1165 .\}
1166 ..
1167 .de @IP-html
1168 .if \\n[.$]>1 .nr \\n[.ev]:ai (n;\\$2)
1169 .par*start \\n[\\n[.ev]:ai] 0
1170 .if !'\\$1'' \{\
1171 .       \" Divert the label so as to freeze any spaces.
1172 .       di par*label
1173 .       par*push-tag-env
1174 \&\\$1
1175 .       par*pop-tag-env
1176 .       di
1177 .       chop par*label
1178 .       ti -\\n[\\n[.ev]:ai]u
1179 .       ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \{\
1180 .               HTML-TAG-NS ".col 1"
1181 \\$1\h'|\\n[\\n[.ev]:ai]u'\c
1182 .               HTML-TAG-NS ".col 2"
1183 .       \}
1184 .       el \{\
1185 \\$1
1186 .               br
1187 .       \}
1188 .       rm par*label
1189 .\}
1190 ..
1191 .\" We don't want margin characters to be attached when we divert
1192 .\" the tag.  Since there's no way to save and restore the current
1193 .\" margin character, we have to switch to a new environment, taking
1194 .\" what we need of the old environment with us.
1195 .de par*push-tag-env
1196 .nr par*saved-font \\n[.f]
1197 .nr par*saved-size \\n[.s]z
1198 .nr par*saved-ss \\n[.ss]
1199 .ds par*saved-fam \\n[.fam]
1200 .ev par
1201 .nf
1202 .TA
1203 .ft \\n[par*saved-font]
1204 .ps \\n[par*saved-size]u
1205 .ss \\n[par*saved-ss]
1206 .fam \\*[par*saved-fam]
1207 ..
1208 .de par*pop-tag-env
1209 .ev
1210 ..
1211 .de @RS
1212 .br
1213 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1214 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1215 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1216 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1217 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1218 .nr \\n[.ev]:il +1
1219 .nr \\n[.ev]:li +\\n[\\n[.ev]:ai]
1220 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1221 .par@reset
1222 ..
1223 .de @RE
1224 .br
1225 .ie \\n[\\n[.ev]:il] \{\
1226 .       nr \\n[.ev]:il -1
1227 .       nr \\n[.ev]:ai \\n[\\n[.ev]:ai!\\n[\\n[.ev]:il]]
1228 .       nr \\n[.ev]:li \\n[\\n[.ev]:li!\\n[\\n[.ev]:il]]
1229 .       nr \\n[.ev]:ri \\n[\\n[.ev]:ri!\\n[\\n[.ev]:il]]
1230 .       nr \\n[.ev]:pli \\n[\\n[.ev]:pli!\\n[\\n[.ev]:il]]
1231 .       nr \\n[.ev]:pri \\n[\\n[.ev]:pri!\\n[\\n[.ev]:il]]
1232 .\}
1233 .el .@error unbalanced \\$0
1234 .par@reset
1235 ..
1236 .de @QS
1237 .br
1238 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1239 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1240 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1241 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1242 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1243 .nr \\n[.ev]:il +1
1244 .nr \\n[.ev]:li +\\n[QI]
1245 .nr \\n[.ev]:ri +\\n[QI]
1246 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1247 .par@reset
1248 ..
1249 .als @QE @RE
1250 .\" start boxed text
1251 .de B1
1252 .br
1253 .HTML-IMAGE
1254 .di par*box-div
1255 .nr \\n[.ev]:li +1n
1256 .nr \\n[.ev]:ri +1n
1257 .nr par*box-in \\n[.in]
1258 .\" remember what 1n is, just in case the point size changes
1259 .nr par*box-n 1n
1260 .in +1n
1261 .ll -1n
1262 .lt -1n
1263 .ti \\n[par*box-in]u+1n
1264 ..
1265 .de @div-end!par*box-div
1266 .B2
1267 ..
1268 .\" end boxed text
1269 .\" Postpone the drawing of the box until we're in the top-level diversion,
1270 .\" in case there's a footnote inside the box.
1271 .de B2
1272 .ie '\\n(.z'par*box-div' \{\
1273 .       br
1274 .       if \n[.V]>.25m .sp
1275 .       di
1276 .       if \n[.V]>.25m .sp
1277 .       ds@need \\n[dn]
1278 .       par*box-mark-top
1279 .       ev nf
1280 .       par*box-div
1281 .       ev
1282 .       nr \\n[.ev]:ri -\\n[par*box-n]
1283 .       nr \\n[.ev]:li -\\n[par*box-n]
1284 .       in -\\n[par*box-n]u
1285 .       ll +\\n[par*box-n]u
1286 .       lt +\\n[par*box-n]u
1287 .       par*box-draw \\n[.i]u \\n[.l]u-(\\n[.H]u==1n*1n)
1288 .\}
1289 .el .@error B2 without B1
1290 .HTML-IMAGE-END
1291 ..
1292 .de par*box-mark-top
1293 .ie '\\n[.z]'' \{\
1294 .       rs
1295 .       mk par*box-top
1296 .\}
1297 .el \!.par*box-mark-top
1298 ..
1299 .de par*box-draw
1300 .ie '\\n[.z]'' \{\
1301 .       nr par*box-in \\n[.i]
1302 .       nr par*box-ll \\n[.l]
1303 .       nr par*box-vpt \\n[.vpt]
1304 .       nr par*box-ad \\n[.j]
1305 .       ad l
1306 .       vpt 0
1307 .       in \\$1
1308 .       ll \\$2
1309 \v'-1v+.25m'\
1310 \D'l (u;\\n[.l]-\\n[.i]) 0'\
1311 \D'l 0 |\\n[par*box-top]u'\
1312 \D'l -(u;\\n[.l]-\\n[.i]) 0'\
1313 \D'l 0 -|\\n[par*box-top]u'
1314 .       br
1315 .       sp -1
1316 .       in \\n[par*box-in]u
1317 .       ll \\n[par*box-ll]u
1318 .       vpt \\n[par*box-vpt]
1319 .       ad \\n[par*box-ad]
1320 .\}
1321 .el \!.par*box-draw \\$1 \\$2
1322 ..
1323 .de @SH
1324 .par@finish
1325 .\" Keep together the heading and the first two lines of the next paragraph.
1326 .ne 3v+\\n[\\n[.ev]:PD]u+\\n(.Vu
1327 .sp 1
1328 .ft B
1329 .HTML-TAG ".SH 1"
1330 ..
1331 .\" TL, AU, and AI are aliased to these in cov*ab-init.
1332 .de par@TL
1333 .par@finish
1334 .sp 1
1335 .ft B
1336 .ps +2
1337 .vs +3p
1338 .ce 9999
1339 .HTML-TAG ".tl"
1340 ..
1341 .de par@AU
1342 .par@finish
1343 .sp 1
1344 .ft I
1345 .ce 9999
1346 ..
1347 .de par@AI
1348 .par@finish
1349 .sp .5
1350 .ce 9999
1351 ..
1352 .\" In paragraph macros.
1353 .de NL
1354 .ps \\n[\\n[.ev]:PS]
1355 ..
1356 .de SM
1357 .ps -2
1358 ..
1359 .de LG
1360 .ps +2
1361 ..
1362 .de R
1363 .ft R
1364 ..
1365 .\" par*define-font-macro macro font
1366 .de par*define-font-macro
1367 .de \\$1
1368 .ie \\\\n[.$] \{\
1369 .       nr par*prev-font \\\\n[.f]
1370 \&\\\\$3\f[\\$2]\\\\$1\f[\\\\n[par*prev-font]]\\\\$2
1371 .\}
1372 .el .ft \\$2
1373 \\..
1374 ..
1375 .par*define-font-macro B B
1376 .par*define-font-macro I I
1377 .par*define-font-macro BI BI
1378 .par*define-font-macro CW CR
1379 .\" underline a word
1380 .de UL
1381 \Z'\\$1'\v'.25m'\D'l \w'\\$1'u 0'\v'-.25m'\\$2
1382 ..
1383 .\" box a word
1384 .de BX
1385 .nr par*bxw \w'\\$1'+.4m
1386 \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''\
1387 \Z'\h'.2m'\\$1'\
1388 \h'\\n[par*bxw]u'
1389 ..
1390 .\" The first time UX is used, put a registered mark after it.
1391 .ds par*ux-rg \(rg
1392 .de UX
1393 \s[\\n[.s]*8u/10u]UNIX\s0\\$1\\*[par*ux-rg]
1394 .ds par*ux-rg
1395 ..
1396 .ds par@sup-start \v'-.9m\s'\En[.s]*7u/10u'+.7m'
1397 .als { par@sup-start
1398 .ds par@sup-end \v'-.7m\s0+.9m'
1399 .als } par@sup-end
1400 .\" footnote paragraphs
1401 .\" FF is the footnote format
1402 .nr FF 0
1403 .\" This can be redefined. It gets a second argument of `no' if the first
1404 .\" argument was supplied by the user, rather than automatically.
1405 .de FP
1406 .br
1407 .if !d par*fp!\\n[FF] \{\
1408 .       @error unknown footnote format `\\n[FF]'
1409 .       nr FF 0
1410 .\}
1411 .ie '\\$2'no' .par*fp!\\n[FF]-no "\\$1"
1412 .el .par*fp!\\n[FF] "\\$1"
1413 ..
1414 .de par*fp!0
1415 .@PP
1416 \&\\*[par@sup-start]\\$1\\*[par@sup-end]\ \c
1417 ..
1418 .de par*fp!0-no
1419 .@PP
1420 \&\\$1\ \c
1421 ..
1422 .de par*fp!1
1423 .@PP
1424 \&\\$1.\ \c
1425 ..
1426 .de par*fp!1-no
1427 .@PP
1428 \&\\$1\ \c
1429 ..
1430 .de par*fp!2
1431 .@LP
1432 \&\\$1.\ \c
1433 ..
1434 .de par*fp!2-no
1435 .@LP
1436 \&\\$1\ \c
1437 ..
1438 .de par*fp!3
1439 .@IP "\\$1." (u;\\n[\\n[.ev]:PI]*2)
1440 ..
1441 .de par*fp!3-no
1442 .@IP "\\$1" (u;\\n[\\n[.ev]:PI]*2)
1443 ..
1444 .\" ***************************
1445 .\" ******** module nh ********
1446 .\" ***************************
1447 .\" Numbered headings.
1448 .\" nh*hl is the level of the last heading
1449 .nr nh*hl 0
1450 .\" numbered heading
1451 .de @NH
1452 .HTML-TAG ".NH \\$1"
1453 .ie '\\$1'S' \{\
1454 .       shift
1455 .       nr nh*hl 0
1456 .       while \\n[.$] \{\
1457 .               nr nh*hl +1
1458 .               nr H\\n[nh*hl] 0\\$1
1459 .               shift
1460 .       \}
1461 .       if !\\n[nh*hl] \{\
1462 .               nr H1 1
1463 .               nr nh*hl 1
1464 .               @error missing arguments to .NH S
1465 .       \}
1466 .\}
1467 .el \{\
1468 .       nr nh*ohl \\n[nh*hl]
1469 .       ie \\n[.$] \{\
1470 .               nr nh*hl 0\\$1
1471 .               ie \\n[nh*hl]<=0 \{\
1472 .                       nr nh*ohl 0
1473 .                       nr nh*hl 1
1474 .               \}
1475 .               el \{\
1476 .                       if \\n[nh*hl]-\\n[nh*ohl]>1 \
1477 .                               @warning .NH \\n[nh*ohl] followed by .NH \\n[nh*hl]
1478 .               \}
1479 .       \}
1480 .       el .nr nh*hl 1
1481 .       while \\n[nh*hl]>\\n[nh*ohl] \{\
1482 .               nr nh*ohl +1
1483 .               nr H\\n[nh*ohl] 0
1484 .       \}
1485 .       nr H\\n[nh*hl] +1
1486 .\}
1487 .ds SN
1488 .nr nh*i 0
1489 .while \\n[nh*i]<\\n[nh*hl] \{\
1490 .       nr nh*i +1
1491 .       as SN \\n[H\\n[nh*i]].
1492 .\}
1493 .SH
1494 \\*[SN]
1495 ..
1496 .\" ****************************
1497 .\" ******** module toc ********
1498 .\" ****************************
1499 .\" Table of contents generation.
1500 .de @XS
1501 .da toc*div
1502 .ev h
1503 .ie \\n[.$] .XA "\\$1"
1504 .el .XA
1505 ..
1506 .de @div-end!toc*div
1507 .XE
1508 ..
1509 .de XA
1510 .ie '\\n(.z'toc*div' \{\
1511 .       if d toc*num .toc*end-entry
1512 .       ie \\n[.$] \{\
1513 .               ie '\\$1'no' .ds toc*num
1514 .               el .ds toc*num "\\$1
1515 .       \}
1516 .       el .ds toc*num \\n[PN]
1517 .       br
1518 .       par@reset
1519 .       na
1520 .       ll -8n
1521 .       in (n;0\\$2)
1522 .\}
1523 .el .@error XA without XS
1524 ..
1525 .de XE
1526 .ie '\\n(.z'toc*div' \{\
1527 .       if d toc*num .toc*end-entry
1528 .       ev
1529 .       di
1530 .\}
1531 .el .@error XS without XE
1532 ..
1533 .de toc*end-entry
1534 \\a\\t\\*[toc*num]
1535 .br
1536 .rm toc*num
1537 ..
1538 .de PX
1539 .1C
1540 .if !'\\$1'no' \{\
1541 .       ce 1
1542 .       ps \\n[PS]+2
1543 .       ft B
1544 \\*[TOC]
1545 .       ft
1546 .       ps
1547 .\}
1548 .nf
1549 .char \[toc*leader-char] .\h'1m'
1550 .lc \[toc*leader-char]
1551 .ta (u;\\n[.l]-\\n[.i]-\w'000') (u;\\n[.l]-\\n[.i])R
1552 .sp 2
1553 .toc*div
1554 .par@reset
1555 ..
1556 .\" print the table of contents on page i
1557 .de TC
1558 .P1
1559 .pg@begin 1 i
1560 .PX \\$1
1561 ..
1562 .\" ****************************
1563 .\" ******** module eqn ********
1564 .\" ****************************
1565 .\" Eqn support.
1566 .de EQ
1567 ..
1568 .de EN
1569 ..
1570 .de @EQ
1571 .br
1572 .ds eqn*num "\\$2
1573 .ie '\\$1'L' .nr eqn*type 0
1574 .el \{\
1575 .       ie '\\$1'I' .nr eqn*type 1
1576 .       el \{\
1577 .               nr eqn*type 2
1578 .               if !'\\$1'C' .ds eqn*num "\\$1
1579 .       \}
1580 .\}
1581 .di eqn*div
1582 .in 0
1583 .if \\n[eqn*type]=0 .HTML-IMAGE-LEFT
1584 .if \\n[eqn*type]=1 \{\
1585 .   if '\*(.T'html' .RS
1586 .   HTML-IMAGE-INLINE
1587 .\}
1588 .if \\n[eqn*type]=2 .HTML-IMAGE
1589 .if !'\*(.T'html' .nf
1590 ..
1591 .de @div-end!eqn*div
1592 .@EN
1593 ..
1594 .\" Note that geqn mark and lineup work correctly in centered equations.
1595 .de @EN
1596 .ie !'\\n(.z'eqn*div' .@error-recover mismatched EN
1597 .el \{\
1598 .       br
1599 .       di
1600 .       nr eqn*have-num 0
1601 .       if !'\\*[eqn*num]'' .nr eqn*have-num 1
1602 .       ie \\n[dl]:\\n[eqn*have-num] \{\
1603 .               if !'\*(.T'html' .sp \\n[DD]u
1604 .               par@reset
1605 .               ds eqn*tabs \\n[.tabs]
1606 .               nf
1607 .               ie \\n[dl] \{\
1608 .\"                     --fixme-- this really should not be necessary
1609 .\"                     and indicates that there is extra space creeping into
1610 .\"                     an equation when ps4html is enabled..
1611 .                       ie r ps4html .ds@need \\n[dn]u-1v+\n[.V]u+1i
1612 .                       el .ds@need \\n[dn]u-1v+\n[.V]u
1613 .                       chop eqn*div
1614 .                       ie \\n[eqn*type]=0 \{\
1615 .                               ta (u;\\n[.l]-\\n[.i])R
1616 \\*[eqn*div]\t\\*[eqn*num]
1617 .                       \}
1618 .                       el \{\
1619 .                               ie \\n[eqn*type]=1 .ta \\n[DI]u \
1620 (u;\\n[.l]-\\n[.i])R
1621 .                               el .ta (u;\\n[.l]-\\n[.i]/2)C \
1622 (u;\\n[.l]-\\n[.i])R
1623 \t\\*[eqn*div]\t\\*[eqn*num]
1624 .                       \}
1625 .               \}
1626 .               el \{\
1627 .                       ta (u;\\n[.l]-\\n[.i])R
1628 \t\\*[eqn*num]
1629 .               \}
1630 .               if !'\*(.T'html' .sp \\n[DD]u
1631 .               ta \\*[eqn*tabs]
1632 .       \}
1633 .       el \{
1634 .\" must terminate empty equations in html and ps4html as they contain
1635 .\" the HTML-IMAGE-END suppression nodes
1636 .               if \\n[dl] .chop eqn*div
1637 .               if '\*(.T'html' \\*[eqn*div]
1638 .               if r ps4html    \\*[eqn*div]
1639 .       \}
1640 .       if !'\*(.T'html' .fi
1641 .       if \\n[eqn*type]=0 .HTML-IMAGE-END
1642 .       if \\n[eqn*type]=1 \{\
1643 .               HTML-IMAGE-END
1644 .               if '\*(.T'html' .RE
1645 .       \}
1646 .       if \\n[eqn*type]=2 .HTML-IMAGE-END
1647 .\}
1648 ..
1649 .\" ****************************
1650 .\" ******** module tbl ********
1651 .\" ****************************
1652 .\" Tbl support.
1653 .nr tbl*have-header 0
1654 .\" This gets called if TS occurs before the first paragraph.
1655 .de TS
1656 .LP
1657 .\" cov*ab-init aliases TS to @TS
1658 \\*[TS]\\
1659 ..
1660 .de @TS
1661 .sp \\n[DD]u
1662 .\" .if !'\*(.T'html' .sp \\n[DD]u
1663 .if '\\$1'H' .di tbl*header-div
1664 .HTML-IMAGE
1665 ..
1666 .de tbl@top-hook
1667 .if \\n[tbl*have-header] \{\
1668 .       ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl*print-header
1669 .       el .sp \\n[.t]u
1670 .\}
1671 ..
1672 .de tbl*print-header
1673 .ev nf
1674 .tbl*header-div
1675 .ev
1676 .mk #T
1677 ..
1678 .de TH
1679 .ie '\\n[.z]'tbl*header-div' \{\
1680 .       nr T. 0
1681 .       T#
1682 .       br
1683 .       di
1684 .       ie \\n[dn]+\\n[FM]+\\n[HM]+2v>=\\n[.p] \{\
1685 .               @error ridiculously long table header
1686 .               ds@need \\n[dn]
1687 .               tbl*print-header
1688 .       \}
1689 .       el \{\
1690 .               nr tbl*header-ht \\n[dn]
1691 .               ds@need \\n[dn]u+1v
1692 .               tbl*print-header
1693 .               nr tbl*have-header 1
1694 .       \}
1695 .\}
1696 .el .@error-recover .TH without .TS H
1697 ..
1698 .de @div-end!tbl*header-div
1699 .TH
1700 .TE
1701 ..
1702 .de TE
1703 .ie '\\n(.z'tbl*header-div' .@error-recover .TS H but no .TH before .TE
1704 .el \{\
1705 .       nr tbl*have-header 0
1706 .       if !'\*(.T'html' .sp \\n[DD]u
1707 .\}
1708 .       HTML-IMAGE-END
1709 .\" reset tabs
1710 .TA
1711 ..
1712 .de tbl@bottom-hook
1713 .if \\n[tbl*have-header] \{\
1714 .       nr T. 1
1715 .       T#
1716 .\}
1717 ..
1718 .de T&
1719 ..
1720 .\" ****************************
1721 .\" ******** module pic ********
1722 .\" ****************************
1723 .\" Pic support.
1724 .\" PS height width
1725 .de PS
1726 .br
1727 .sp \\n[DD]u
1728 .ie \\n[.$]<2 .@error bad arguments to PS (not preprocessed with pic?)
1729 .el \{\
1730 .       ds@need (u;\\$1)+1v
1731 .       in +(u;\\n[.l]-\\n[.i]-\\$2/2>?0)
1732 .\}
1733 .HTML-IMAGE
1734 ..
1735 .de PE
1736 .HTML-IMAGE-END
1737 .par@reset
1738 .sp \\n[DD]u+.5m
1739 ..
1740 .\" ****************************
1741 .\" ******** module ref ********
1742 .\" ****************************
1743 .\" Refer support.
1744 .de ]-
1745 .rm [A [B [C [D [E [G [I [J [N [O [P [Q [R [S [T [V
1746 .rm ref*string
1747 ..
1748 .\" Other
1749 .ds ref*spec!0 Q A T1 S V N P I C D O
1750 .\" Journal article
1751 .ds ref*spec!1 Q A T2 J S V N P I C D O
1752 .\" Book
1753 .ds ref*spec!2 Q A T1 S V P I C D O
1754 .\" Article within book
1755 .ds ref*spec!3 Q A T2 B E S V P I C D O
1756 .\" Tech report
1757 .ds ref*spec!4 Q A T2 R G P I C D O
1758 .\" ][ type
1759 .de ][
1760 .if r [T \{\
1761 .       als [T1 [T
1762 .       als [T2 [T
1763 .\}
1764 .ie d ref*spec!\\$1 .ref*build \\*[ref*spec!\\$1]
1765 .el \{\
1766 .       @error unknown reference type `\\$1'
1767 .       ref*build \\*[ref*spec!0]
1768 .\}
1769 .ref*print
1770 .rm ref*string
1771 .rm [F [T1 [T2
1772 ..
1773 .\" start of reference number
1774 .ds [. \\*[par@sup-start]
1775 .\" end of reference number
1776 .ds .] \\*[par@sup-end]
1777 .\" period before reference
1778 .ds <. .
1779 .\" period after reference
1780 .ds >. \" empty
1781 .\" comma before reference
1782 .ds <, ,
1783 .\" comma after reference
1784 .ds >, \" empty
1785 .\" start collected references
1786 .de ]<
1787 .als ref*print ref*end-print
1788 .SH
1789 \&\\*[REFERENCES]
1790 .par@reset
1791 ..
1792 .\" end collected references
1793 .de ]>
1794 .par@finish
1795 .als ref*print ref*normal-print
1796 ..
1797 .de ref*normal-print
1798 .ie d [F .FS "\\*([.\\*([F\\*(.]"
1799 .el .FS \&
1800 \\*[ref*string]
1801 .FE
1802 ..
1803 .de ref*end-print
1804 .ie d [F .IP "\\*([F."
1805 .el .XP
1806 \\*[ref*string]
1807 ..
1808 .als ref*print ref*normal-print
1809 .de ref*build
1810 .rm ref*string ref*post-punct
1811 .nr ref*suppress-period 1
1812 .while \\n[.$] \{\
1813 .       if d [\\$1 \{\
1814 .               ie d ref*add-\\$1 .ref*add-\\$1
1815 .               el .ref*add-dflt \\$1
1816 .       \}
1817 .       shift
1818 .\}
1819 .\" now add a final period
1820 .ie d ref*string \{\
1821 .       if !\\n[ref*suppress-period] .as ref*string .
1822 .       if d ref*post-punct \{\
1823 .               as ref*string "\\*[ref*post-punct]
1824 .               rm ref*post-punct
1825 .       \}
1826 .\}
1827 .el .ds ref*string
1828 ..
1829 .de ref*add-T1
1830 .ref*field T , "\fI" "" "\fP"
1831 .if r [T .nr ref*suppress-period \\n([T
1832 ..
1833 .de ref*add-T2
1834 .ref*field T , "\\*Q" "" "\\*U"
1835 .if r [T .nr ref*suppress-period \\n([T
1836 ..
1837 .de ref*add-P
1838 .ie \\n([P>0 .ref*field P , "pp. "
1839 .el .ref*field P , "p. "
1840 ..
1841 .de ref*add-J
1842 .ref*field J , \fI "" \fP
1843 ..
1844 .de ref*add-D
1845 .ref*field D "" ( )
1846 ..
1847 .de ref*add-E
1848 .ref*field E , "ed. "
1849 ..
1850 .de ref*add-G
1851 .ref*field G "" ( )
1852 ..
1853 .de ref*add-B
1854 .ref*field B "" "in \fI" "" \fP
1855 ..
1856 .de ref*add-O
1857 .ref*field O .
1858 .ie r [O .nr ref*suppress-period \\n([O
1859 .el .nr ref*suppress-period 1
1860 ..
1861 .de ref*add-A
1862 .ref*field A ,
1863 .if r [A .nr ref*suppress-period \\n([A
1864 ..
1865 .de ref*add-dflt
1866 .ref*field \\$1 ,
1867 ..
1868 .\" First argument is the field letter.
1869 .\" Second argument is the punctuation character to use to separate this field
1870 .\" from the previous field.
1871 .\" Third argument is a string with which to prefix this field.
1872 .\" Fourth argument is a string with which to postfix this field.
1873 .\" Fifth argument is a string to add after the punctuation character supplied
1874 .\" by the next field.
1875 .de ref*field
1876 .if d ref*string \{\
1877 .       ie d ref*post-punct \{\
1878 .               as ref*string "\\$2\\*[ref*post-punct] \"
1879 .               rm ref*post-punct
1880 .       \}
1881 .       el .as ref*string "\\$2 \"
1882 .\}
1883 .as ref*string "\\$3\\*([\\$1\\$4
1884 .if \\n[.$]>4 .ds ref*post-punct "\\$5
1885 .nr ref*suppress-period 0
1886 ..
1887 .\" ****************************
1888 .\" ******** module acc ********
1889 .\" ****************************
1890 .\" Accents and special characters.
1891 .ds Q \(lq
1892 .ds U \(rq
1893 .ds - \(em
1894 .\" Characters
1895 .\" The idea of this definition is for the top of the 3 to be at the x-height.
1896 .if !c\[yogh] .char \[yogh] \Z'\v'\w'x'*0-\En[rst]u'\s[\En[.s]*8u/10u]\
1897 \v'\w'3'*0+\En[rst]u'3\s0'\h'\w'\s[\En[.s]*8u/10u]3'u'
1898 .\" Accents
1899 .de acc*over-def
1900 .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
1901 \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
1902 ..
1903 .de acc*under-def
1904 .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
1905 ..
1906 .de acc*slash-def
1907 .ds \\$1 \Z'\h'(u;-\En[.w]-\w'\\$2'/2)'\
1908 \v'(u;\En[.cdp]-\En[.cht]+\En[rst]+\En[rsb]/2)'\\$2'
1909 ..
1910 .de acc*prefix-def
1911 .ds \\$1 \Z'\h'(u;\w'x'-\w'\\$2'/2)'\\$2'
1912 ..
1913 .acc*prefix-def ' \'
1914 .acc*prefix-def ` \`
1915 .acc*prefix-def ^ ^
1916 .acc*prefix-def , \(ac
1917 .acc*prefix-def : \(ad
1918 .acc*prefix-def ~ ~
1919 .\" improved accent marks
1920 .de AM
1921 .acc*over-def ' \'
1922 .acc*over-def ` \`
1923 .acc*over-def ^ ^
1924 .acc*over-def ~ ~
1925 .acc*over-def : \(ad
1926 .acc*over-def v \(ah
1927 .acc*over-def _ \(a-
1928 .acc*over-def o \(ao
1929 .acc*under-def , \(ac
1930 .acc*under-def . \s[\En[.s]*8u/10u]\v'.2m'.\v'-.2m'\s0
1931 .acc*under-def hook \(ho
1932 .acc*slash-def / /
1933 .char \[hooko] o\\\\*[hook]
1934 .ds q \[hooko]
1935 .ds 3 \[yogh]
1936 .ds D- \(-D\"                   Icelandic uppercase eth
1937 .ds d- \(Sd\"                   Icelandic lowercase eth
1938 .ds Th \(TP\"                   Icelandic uppercase thorn
1939 .ds th \(Tp\"                   Icelandic lowercase thorn
1940 .ds 8 \(ss\"                    German double s
1941 .ds Ae \(AE\"                   AE ligature
1942 .ds ae \(ae\"                   ae ligature
1943 .ds Oe \(OE\"                   OE ligature
1944 .ds oe \(oe\"                   oe ligature
1945 .ds ? \(r?\"                    upside down ?
1946 .ds ! \(r!\"                    upside down !
1947 ..
1948 .de CHECK-FOOTER-AND-KEEP
1949 .\" it might be better to als FS -> B1 and FE -> B2
1950 .\" however this produced wierd results, so I've moved back to a more reliable
1951 .\" but less interesting solution --fixme--
1952 .   if '\*(.T'html' \{\
1953 .       rm KF
1954 .       als KF KS
1955 .       rm FS
1956 .       de FS
1957 .               br
1958 .               HTML-IMAGE
1959 \\..
1960 .       rm FE
1961 .       de FE
1962 .               br
1963 .               HTML-IMAGE-END
1964 \\..
1965 .   \}
1966 .   if r ps4html \{\
1967 .       rm FS
1968 .       de FS
1969 .               br
1970 .               HTML-IMAGE
1971 \\..
1972 .       rm FE
1973 .       de FE
1974 .               br
1975 .               HTML-IMAGE-END
1976 \\..
1977 .   \}
1978 ..
1979 .par@load-init
1980 .if '\*(.T'html' \{\
1981 .  rm @IP
1982 .  als @IP @IP-html
1983 .\}
1984 .\" Make sure that no blank lines creep in at the end of this file.