groff before CVS: release 1.07
[s-roff.git] / tmac / tmac.s
blob9afb7e6f0bfb043b3add3a28398bb72b0805d8ce
1 .ig
2 Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
3 Written by James Clark (jjc@jclark.com)
5 This file is part of groff.
7 groff is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
10 version.
12 groff is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License along
18 with groff; see the file COPYING. If not, write to the Free Software
19 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 .if !\n(.g .ab These ms macros require groff.
22 .if \n(.C \
23 . ab The groff ms macros do not work in compatibility mode.
24 .\" Enable warnings. You can delete this if you want.
25 .warn
26 .\" See if already loaded.
27 .if r GS .nx
28 .nr GS 1
29 .de @error
30 .tm \\n(.F:\\n(.c: macro error: \\$*
32 .de @warning
33 .tm \\n(.F:\\n(.c: macro warning: \\$*
35 .de @fatal
36 .ab \\n(.F:\\n(.c: fatal macro error: \\$*
38 .de @not-implemented
39 .@error sorry, \\$0 not implemented
40 .als \\$0 @nop
42 .als TM @not-implemented
43 .als CT @not-implemented
44 .de @nop
46 .de @init
47 .\" a non-empty environment
48 .ev ne
50 .ev
51 .ev nf
52 'nf
53 .ev
55 .ds REFERENCES References
56 .ds ABSTRACT ABSTRACT
57 .ds TOC Table of Contents
58 .ds MONTH1 January
59 .ds MONTH2 February
60 .ds MONTH3 March
61 .ds MONTH4 April
62 .ds MONTH5 May
63 .ds MONTH6 June
64 .ds MONTH7 July
65 .ds MONTH8 August
66 .ds MONTH9 September
67 .ds MONTH10 October
68 .ds MONTH11 November
69 .ds MONTH12 December
70 .ds MO \\*[MONTH\n[mo]]
71 .nr *year \n[yr]+1900
72 .ds DY \n[dy] \*[MO] \n[*year]
73 .de ND
74 .if \\n[.$] .ds DY "\\$*
76 .de DA
77 .if \\n[.$] .ds DY "\\$*
78 .ds CF \\*[DY]
80 .\" indexing
81 .de IX
82 .tm \\$1\t\\$2\t\\$3\t\\$4 ... \\n[PN]
84 .\" print an error message and then try to recover
85 .de @error-recover
86 .@error \\$@ (recovering)
87 .nr *pop-count 0
88 .while !'\\n(.z'' \{\
89 . \"@warning automatically terminating diversion \\n(.z
90 . ie d @div-end!\\n(.z .@div-end!\\n(.z
91 . el .*div-end-default
92 . nr *pop-count +1
93 . \" ensure that we don't loop forever
94 . if \\n[*pop-count]>20 .@fatal recovery failed
95 .\}
96 .while !'\\n[.ev]'0' .ev
97 .par@reset-env
98 .par@reset
100 .de *div-end-default
101 .ds *last-div \\n(.z
104 .ev nf
105 .\\*[*last-div]
108 .\" ****************************
109 .\" ******** module cov ********
110 .\" ****************************
111 .\" Cover sheet and first page.
112 .de cov*err-not-after-first-page
113 .@error \\$0 is not allowed after the first page has started
115 .de cov*err-not-before-tl
116 .@error \\$0 is not allowed before TL
118 .de cov*err-not-again
119 .@error \\$0 is not allowed more than once
121 .de cov*err-not-after-ab
122 .@error \\$0 is not allowed after first AB, LP, PP, IP, SH or NH
124 .als AU cov*err-not-before-tl
125 .als AI cov*err-not-before-tl
126 .als AB cov*err-not-before-tl
127 .de cov*first-page-init
128 .rm cov*first-page-init
129 .par@init
130 .als RP cov*err-not-after-first-page
131 .@init
132 .ie \\n[cov*rp-format] \{\
133 . pg@cs-top
134 . als FS cov*FS
135 . als FE cov*FE
137 .el \{\
138 . pg@top
139 . als FS @FS
140 . als FE @FE
142 .wh 0 pg@top
144 .wh 0 cov*first-page-init
145 .\" This handles the case where FS occurs before TL or LP.
146 .de FS
148 \\*[FS]\\
150 .nr cov*rp-format 0
151 .nr cov*rp-no 0
152 .\" released paper format
153 .de RP
154 .nr cov*rp-format 1
155 .if \\n[.$] .if '\\$1'no' .nr cov*rp-no 1
156 .pn 0
158 .de TL
160 .als TL cov*err-not-again
161 .rn @AB AB
162 .rn @AU AU
163 .rn @AI AI
164 .di cov*tl-div
165 .par@reset
166 .ft B
167 .ps +2
168 .vs +3p
169 .ll (u;\\n[LL]*5/6)
170 .nr cov*n-au 0
172 .de @AU
173 .par@reset
174 .if !'\\n(.z'' \{\
175 . br
176 . di
178 .nr cov*n-au +1
179 .di cov*au-div!\\n[cov*n-au]
181 .ft I
182 .ps \\n[PS]
184 .de @AI
185 .par@reset
186 .if !'\\n(.z'' \{\
187 . br
188 . di
190 .ie !\\n[cov*n-au] .@error AI before AU
191 .el \{\
192 . di cov*ai-div!\\n[cov*n-au]
193 . nf
194 . ft R
195 . ps \\n[PS]
198 .de LP
199 .if !'\\n[.z]'' \{\
200 . br
201 . di
204 .cov*ab-init
205 .cov*print
206 \\*[\\$0]\\
208 .als IP LP
209 .als PP LP
210 .als XP LP
211 .als NH LP
212 .als SH LP
213 .als MC LP
214 .als RT LP
215 .als XS LP
216 .de cov*ab-init
217 .als cov*ab-init @nop
218 .als LP @LP
219 .als IP @IP
220 .als PP @PP
221 .als XP @XP
222 .als RT @RT
223 .als XS @XS
224 .als SH @SH
225 .als NH @NH
226 .als QP @QP
227 .als RS @RS
228 .als RE @RE
229 .als QS @QS
230 .als QE @QE
231 .als MC @MC
232 .als EQ @EQ
233 .als EN @EN
234 .als AB cov*err-not-after-ab
235 .als AU par@AU
236 .als AI par@AI
237 .als TL par@TL
239 .de @AB
240 .if !'\\n(.z'' \{\
241 . br
242 . di
244 .cov*ab-init
245 .di cov*ab-div
246 .par@ab-indent
247 .par@reset
248 .if !'\\$1'no' \{\
249 . ft I
250 . ce 1
251 \\*[ABSTRACT]
252 . sp
253 . ft R
256 .@PP
258 .de AE
259 .ie '\\n(.z'cov*ab-div' \{\
260 . als AE cov*err-not-again
261 . br
262 . di
263 .\" nr cov*ab-height \\n[dn]
264 . par@reset-env
265 . par@reset
266 . cov*print
268 .el .@error AE without AB
270 .de @div-end!cov*ab-div
273 .de cov*print
274 .als cov*print @nop
275 .ie d cov*tl-div \{\
276 . ie \\n[cov*rp-format] .cov*rp-print
277 . el .cov*draft-print
279 .el \{\
280 . if \\n[cov*rp-format] \{\
281 . @warning RP format but no TL
282 . bp 1
283 . als FS @FS
284 . als FE @FE
285 . \}
286 . br
289 .de cov*rp-print
290 .nr cov*page-length \\n[.p]
291 .pl 1000i
292 .cov*tl-au-print
293 .sp 3
294 .if d cov*ab-div \{\
295 . nf
296 . cov*ab-div
298 .sp 3
299 .par@reset
300 \\*[DY]
302 .if \\n[cov*fn-height] \{\
303 . sp |(u;\\n[cov*page-length]-\\n[FM]\
304 -\\n[cov*fn-height]-\\n[fn@sep-dist]>?\\n[nl])
305 . fn@print-sep
306 . ev nf
307 . cov*fn-div
308 . ev
309 . ie \\n[cov*rp-no] .rm cov*fn-div
310 . el \{\
311 . rn cov*fn-div fn@overflow-div
312 . nr fn@have-overflow 1
313 . \}
315 .als FS @FS
316 .als FE @FE
317 .\" If anything was printed below where the footer line is normally printed,
318 .\" then that's an overflow.
319 .if -\\n[FM]/2+1v+\\n[cov*page-length]<\\n[nl] .@error cover sheet overflow
320 .pl \\n[cov*page-length]u
321 .bp 1
322 .if !\\n[cov*rp-no] .cov*tl-au-print
324 .sp 1
326 .de cov*draft-print
327 .cov*tl-au-print
328 .if d cov*ab-div \{\
329 . nf
330 . sp 2
331 . cov*ab-div
333 .sp 1
335 .de cov*tl-au-print
336 .par@reset
339 .sp 3
340 .ce 9999
341 .cov*tl-div
342 .nr cov*i 1
343 .nr cov*sp 1v
344 .while \\n[cov*i]<=\\n[cov*n-au] \{\
345 . sp \\n[cov*sp]u
346 . cov*au-div!\\n[cov*i]
347 . ie d cov*ai-div!\\n[cov*i] \{\
348 . sp .5v
349 . cov*ai-div!\\n[cov*i]
350 . nr cov*sp 1v
351 . \}
352 . el .nr cov*sp .5v
353 . nr cov*i +1
355 .ce 0
357 .nr cov*fn-height 0
358 .nr cov*in-fn 0
359 .\" start of footnote on cover
360 .de cov*FS
361 .if \\n[cov*in-fn] \{\
362 . @error nested FS
363 . FE
365 .nr cov*in-fn 1
366 .ev fn
367 .par@reset-env
368 .da cov*fn-div
369 .if !\\n[cov*fn-height] .ns
370 .ie \\n[.$] .FP "\\$1" no
371 .el .@LP
373 .de @div-end!cov*fn-div
374 .cov*FE
376 .\" end of footnote on cover
377 .de cov*FE
378 .ie '\\n(.z'cov*fn-div' \{\
379 . br
380 . ev
381 . di
382 . nr cov*in-fn 0
383 . nr cov*fn-height +\\n[dn]
385 .el .@error FE without matching FS
387 .\" ***************************
388 .\" ******** module pg ********
389 .\" ***************************
390 .\" Page-level formatting.
391 .\" > 0 if we have a footnote on the current page
392 .nr pg@fn-flag 0
393 .nr pg@colw 0
394 .nr pg@fn-colw 0
395 .nr HM 1i
396 .nr FM 1i
397 .nr PO 1i
398 .ds LF
399 .ds CF
400 .ds RF
401 .ds LH
402 .ds CH -\\n[PN]-
403 .ds RH
404 .ds pg*OH '\\*[LH]'\\*[CH]'\\*[RH]'
405 .ds pg*EH '\\*[LH]'\\*[CH]'\\*[RH]'
406 .ds pg*OF '\\*[LF]'\\*[CF]'\\*[RF]'
407 .ds pg*EF '\\*[LF]'\\*[CF]'\\*[RF]'
408 .de OH
409 .ds pg*\\$0 "\\$*
411 .als EH OH
412 .als OF OH
413 .als EF OH
414 .de PT
415 .ie \\n%=1 .if \\n[pg*P1] .tl \\*[pg*OH]
416 .el \{\
417 . ie o .tl \\*[pg*OH]
418 . el .tl \\*[pg*EH]
421 .de BT
422 .ie o .tl \\*[pg*OF]
423 .el .tl \\*[pg*EF]
425 .nr pg*P1 0
426 .de P1
427 .nr pg*P1 1
429 .wh -\n[FM]u pg@bottom
430 .wh -\n[FM]u/2u pg*footer
431 .nr MINGW 2n
432 .nr pg@ncols 1
433 .de @MC
434 .if !'\\n(.z'' .error-recover MC while diversion open
436 .ie \\n[pg@ncols]>1 .pg@super-eject
437 .el \{\
438 . \" flush out any floating keeps
439 . while \\n[kp@tail]>\\n[kp@head] \{\
440 . rs
441 . bp
442 . \}
444 .ie !\\n(.$ \{\
445 . nr pg@colw \\n[LL]*7/15
446 . nr pg*gutw \\n[LL]-(2*\\n[pg@colw])
447 . nr pg@ncols 2
449 .el \{\
450 . nr pg@colw (n;\\$1)<?\\n[LL]
451 . ie \\n[.$]<2 .nr pg*gutw \\n[MINGW]
452 . el .nr pg*gutw (n;\\$2)
453 . nr pg@ncols \\n[LL]-\\n[pg@colw]/(\\n[pg@colw]+\\n[pg*gutw])+1
454 . ie \\n[pg@ncols]>1 \
455 . nr pg*gutw \\n[LL]-(\\n[pg@ncols]*\\n[pg@colw])/(\\n[pg@ncols]-1)
456 . el .nr pg*gutw 0
458 .mk pg*col-top
460 .nr pg*col-num 0
461 .nr pg@fn-colw \\n[pg@colw]*5/6
462 .par@reset
464 .de 2C
467 .de 1C
468 .MC \\n[LL]u
470 .\" top of page macro
471 .de pg@top
472 .ch pg*footer -\\n[FM]u/2u
473 .nr PN \\n%
474 .nr pg*col-num 0
475 .nr pg@fn-bottom-margin 0
476 .nr pg*saved-po \\n[PO]
477 .po \\n[PO]u
478 .ev h
479 .par@reset
480 .sp (u;\\n[HM]/2)
482 .sp |\\n[HM]u
483 .if d HD .HD
484 .mk pg@header-bottom
486 .mk pg*col-top
487 .pg*start-col
489 .de pg*start-col
490 .\" Handle footnote overflow before floating keeps, because the keep
491 .\" might contain an embedded footnote.
492 .fn@top-hook
493 .kp@top-hook
494 .tbl@top-hook
497 .de pg@cs-top
498 .sp \\n[HM]u
499 .\" move pg@bottom and pg*footer out of the way
500 .ch pg@bottom \\n[.p]u*2u
501 .ch pg*footer \\n[.p]u*2u
504 .de pg@bottom
505 .tbl@bottom-hook
506 .if \\n[pg@fn-flag] .fn@bottom-hook
507 .nr pg*col-num +1
508 .ie \\n[pg*col-num]<\\n[pg@ncols] .pg*end-col
509 .el .pg*end-page
511 .de pg*end-col
512 'sp |\\n[pg*col-top]u
513 .po (u;\\n[pg*saved-po]+(\\n[pg@colw]+\\n[pg*gutw]*\\n[pg*col-num]))
514 .\"po +(u;\\n[pg@colw]+\\n[pg*gutw])
515 .pg*start-col
517 .de pg*end-page
518 .po \\n[pg*saved-po]u
519 .\" Make sure we don't exit if there are still floats or footnotes left-over.
520 .ie \\n[kp@head]<\\n[kp@tail]:\\n[fn@have-overflow] \{\
521 . \" Switching environments ensures that we don't get an unnecessary
522 . \" blank line at the top of the page.
523 . ev ne
524 ' bp
525 . ev
527 .el \{\
528 . \" If the text has ended and there are no more footnotes or keeps, exit.
529 . if \\n[pg@text-ended] .ex
530 . if r pg*next-number \{\
531 . pn \\n[pg*next-number]
532 . rr pg*next-number
533 . if d pg*next-format \{\
534 . af PN \\*[pg*next-format]
535 . rm pg*next-format
536 . \}
537 . \}
538 ' bp
541 .\" pg@begin number format
542 .de pg@begin
543 .ie \\n[.$]>0 \{\
544 . nr pg*next-number (;\\$1)
545 . ie \\n[.$]>1 .ds pg*next-format \\$2
546 . el .rm pg*next-format
548 .el .rr pg*next-number
549 .pg@super-eject
551 .\" print the footer line
552 .de pg*footer
553 .ev h
554 .par@reset
558 .\" flush out any keeps or footnotes
559 .de pg@super-eject
561 .if !'\\n(.z'' .@error-recover diversion open while ejecting page
562 .\" Make sure we stay in the end macro while there is still footnote overflow
563 .\" left, or floating keeps.
564 .while \\n[kp@tail]>\\n[kp@head]:\\n[pg@fn-flag] \{\
565 . rs
566 . bp
570 .nr pg@text-ended 0
571 .de pg@end-text
573 .nr pg@text-ended 1
574 .pg@super-eject
576 .em pg@end-text
577 .\" ***************************
578 .\" ******** module fn ********
579 .\" ***************************
580 .\" Footnotes.
581 .nr fn@sep-dist 8p
582 .ev fn
583 .\" Round it vertically
584 .vs \n[fn@sep-dist]u
585 .nr fn@sep-dist \n[.v]
587 .nr fn*text-num 0 1
588 .nr fn*note-num 0 1
589 .ds * \\*[par@sup-start]\En+[fn*text-num]\\*[par@sup-end]
590 .nr fn*open 0
591 .\" normal FS
592 .de @FS
593 .ie \\n[.$] .fn*do-FS "\\$1" no
594 .el \{\
595 . ie \\n[fn*text-num]>\\n[fn*note-num] .fn*do-FS \\n+[fn*note-num]
596 . el .fn*do-FS
599 .\" Second argument of `no' means don't embellish the first argument.
600 .de fn*do-FS
601 .if \\n[fn*open] .@error-recover nested FS
602 .nr fn*open 1
603 .if \\n[.u] \{\
604 . \" Ensure that the first line of the footnote is on the same page
605 . \" as the reference. I think this is minimal.
606 . ev fn
607 . nr fn*need 1v
608 . ev
609 . ie \\n[pg@fn-flag] .nr fn*need +\\n[fn:PD]
610 . el .nr fn*need +\\n[fn@sep-dist]
611 . ne \\n[fn*need]u+\\n[.V]u>?0
613 .ev fn
614 .par@reset-env
615 .fn*start-div
616 .par@reset
617 .ie \\n[.$] .FP \\$@
618 .el .@LP
620 .de @FE
621 .ie !\\n[fn*open] .@error FE without FS
622 .el \{\
623 . nr fn*open 0
624 . br
625 . ev
626 . fn*end-div
629 .nr fn@have-overflow 0
630 .\" called at the top of each column
631 .de fn@top-hook
632 .nr fn*max-width 0
633 .nr fn*page-bottom-pos 0-\\n[FM]-\\n[pg@fn-bottom-margin]
634 .ch pg@bottom \\n[fn*page-bottom-pos]u
635 .if \\n[fn@have-overflow] \{\
636 . nr fn@have-overflow 0
637 . fn*start-div
638 . ev nf
639 . fn@overflow-div
640 . ev
641 . fn*end-div
644 .\" This is called at the bottom of the column if pg@fn-flag is set.
645 .de fn@bottom-hook
646 .nr pg@fn-flag 0
647 .nr fn@have-overflow 0
648 .nr fn@bottom-pos \\n[.p]-\\n[FM]-\\n[pg@fn-bottom-margin]+\\n[.v]
649 .ev fn
650 .nr fn@bottom-pos -\\n[.v]
652 .ie \\n[nl]+\\n[fn@sep-dist]+\n[.V]>\\n[fn@bottom-pos] \{\
653 . rn fn@div fn@overflow-div
654 . nr fn@have-overflow 1
656 .el \{\
657 . if \\n[pg@ncols]>1 \
658 . if \\n[fn*max-width]>\\n[pg@fn-colw] \
659 . nr pg@fn-bottom-margin \\n[.p]-\\n[FM]-\\n[nl]+1v
660 . wh \\n[fn@bottom-pos]u fn*catch-overflow
661 . fn@print-sep
662 . ev nf
663 . fn@div
664 . rm fn@div
665 . ev
666 . if '\\n(.z'fn@overflow-div' \{\
667 . di
668 . nr fn@have-overflow \\n[dn]>0
669 . \}
670 . ch fn*catch-overflow
673 .de fn*catch-overflow
674 .di fn@overflow-div
676 .nr fn*embed-count 0
677 .de @div-end!fn@div
679 .if '\\n[.ev]'fn' .ev
680 .fn*end-div
681 .nr fn*open 0
683 .als @div-end!fn*embed-div @div-end!fn@div
684 .de fn*start-div
685 .ie '\\n(.z'' \{\
686 . da fn@div
687 . if !\\n[pg@fn-flag] .ns
689 .el .di fn*embed-div
691 .de fn*end-div
692 .ie '\\n(.z'fn@div' \{\
693 . di
694 . nr fn*page-bottom-pos -\\n[dn]
695 . nr fn*max-width \\n[fn*max-width]>?\\n[dl]
696 . if !\\n[pg@fn-flag] .nr fn*page-bottom-pos -\\n[fn@sep-dist]
697 . nr pg@fn-flag 1
698 . nr fn*page-bottom-pos \\n[nl]-\\n[.p]+\n[.V]>?\\n[fn*page-bottom-pos]
699 . ch pg@bottom \\n[fn*page-bottom-pos]u
701 .el \{\
702 . ie '\\n(.z'fn*embed-div' \{\
703 . di
704 . rn fn*embed-div fn*embed-div!\\n[fn*embed-count]
705 \!. fn*embed-start \\n[fn*embed-count]
706 . rs
707 ' sp (u;\\n[dn]+\\n[fn@sep-dist]+\\n[.V])
708 \!. fn*embed-end
709 . nr fn*embed-count +1
710 . \}
711 . el \{\
712 . ev fn
713 . @error-recover unclosed diversion within footnote
714 . \}
717 .de fn*embed-start
718 .ie '\\n(.z'' \{\
719 . fn*start-div
720 . ev nf
721 . fn*embed-div!\\$1
722 . rm fn*embed-div!\\$1
723 . ev
724 . fn*end-div
725 . di fn*null
727 .el \{\
728 \!. fn*embed-start \\$1
729 . rs
732 .de fn*embed-end
733 .ie '\\n(.z'fn*null' \{\
734 . di
735 . rm fn*null
737 .el \!.fn*embed-end
739 .\" It's important that fn@print-sep use up exactly fn@sep-dist vertical space.
740 .de fn@print-sep
741 .ev fn
742 .in 0
743 .vs \\n[fn@sep-dist]u
744 \D'l 1i 0'
748 .\" ***************************
749 .\" ******** module kp ********
750 .\" ***************************
751 .\" Keeps.
752 .de KS
754 .di kp*div
756 .de KF
757 .if !'\\n(.z'' .@error-recover KF while open diversion
758 .di kp*fdiv
759 .ev k
760 .par@reset-env
761 .par@reset
763 .de KE
764 .ie '\\n(.z'kp*div' .kp*end
765 .el \{\
766 . ie '\\n(.z'kp*fdiv' .kp*fend
767 . el .@error KE without KS or KF
770 .de @div-end!kp*div
771 .kp*end
773 .de @div-end!kp*fdiv
774 .kp*fend
776 .de kp*need
777 .ie '\\n(.z'' .ds@need \\$1
778 .el \!.kp*need \\$1
780 .\" end non-floating keep
781 .de kp*end
784 .kp*need \\n[dn]
785 .ev nf
786 .kp*div
788 .rm kp*div
790 .\" Floating keeps.
791 .nr kp@head 0
792 .nr kp@tail 0
793 .\" end floating keep
794 .de kp*fend
798 .ie \\n[.t]-(\\n[.k]>0*1v)>\\n[dn] \{\
799 . br
800 . ev nf
801 . kp*fdiv
802 . rm kp*fdiv
803 . ev
805 .el \{\
806 . rn kp*fdiv kp*div!\\n[kp@tail]
807 . nr kp*ht!\\n[kp@tail] 0\\n[dn]
808 . nr kp@tail +1
811 .\" top of page processing for KF
812 .nr kp*doing-top 0
813 .de kp@top-hook
814 .if !\\n[kp*doing-top] \{\
815 . nr kp*doing-top 1
816 . kp*do-top
817 . nr kp*doing-top 0
820 .de kp*do-top
821 .\" If the first keep won't fit, only force it out if we haven't had a footnote
822 .\" and we're at the top of the page.
823 .nr kp*force \\n[pg@fn-flag]=0&(\\n[nl]<=\\n[pg@header-bottom])
824 .nr kp*fits 1
825 .while \\n[kp@tail]>\\n[kp@head]&\\n[kp*fits] \{\
826 . ie \\n[.t]>\\n[kp*ht!\\n[kp@head]]:\\n[kp*force] \{\
827 . nr kp*force 0
828 . \" It's important to advance kp@head before bringing
829 . \" back the keep, so that if the last line of the
830 . \" last keep springs the bottom of page trap, a new
831 . \" page will not be started unnecessarily.
832 . rn kp*div!\\n[kp@head] kp*temp
833 . nr kp@head +1
834 . ev nf
835 . kp*temp
836 . ev
837 . rm kp*temp
838 . \}
839 . el .nr kp*fits 0
842 .\" ***************************
843 .\" ******** module ds ********
844 .\" ***************************
845 .\" Displays and non-floating keeps.
846 .de DE
847 .ds*end!\\n[\\n[.ev]:ds-type]
848 .nr \\n[.ev]:ds-type 0
850 .de ds@auto-end
851 .if \\n[\\n[.ev]:ds-type] \{\
852 . @error automatically terminating display
853 . DE
856 .de @div-end!ds*div
857 .ie \\n[\\n[.ev]:ds-type] .DE
858 .el .ds*end!2
860 .de ds*end!0
861 .@error DE without DS, ID, CD, LD or BD
863 .de LD
865 .nr \\n[.ev]:ds-type 1
866 .par@reset
868 .sp \\n[DD]u
870 .de ID
872 .ie \\n[.$] .in +(n;\\$1)
873 .el .in +\\n[DI]u
875 .de CD
877 .ce 9999
879 .de RD
881 .rj 9999
883 .de ds*common-end
884 .par@reset
885 .sp \\n[DD]u
887 .als ds*end!1 ds*common-end
888 .de BD
890 .nr \\n[.ev]:ds-type 2
891 .di ds*div
893 .de ds*end!2
895 .ie '\\n(.z'ds*div' \{\
896 . di
897 . nf
898 . in (u;\\n[.l]-\\n[dl]/2)
899 . ds*div
900 . rm ds*div
901 . ds*common-end
903 .el .@error-recover mismatched DE
905 .de DS
907 .di ds*div
908 .ie '\\$1'B' \{\
909 . LD
910 . nr \\n[.ev]:ds-type 4
912 .el \{\
913 . ie '\\$1'L' .LD
914 . el \{\
915 . ie '\\$1'C' .CD
916 . el \{\
917 . ie '\\$1'R' .RD
918 . el \{\
919 . ie '\\$1'I' .ID \\$2
920 . el .ID \\$1
921 . \}
922 . \}
923 . \}
924 . nr \\n[.ev]:ds-type 3
927 .de ds@need
928 .if '\\n(.z'' \{\
929 . while \\n[.t]<=(\\$1)&(\\n[nl]>\\n[pg@header-bottom]) \{\
930 . rs
931 ' sp \\n[.t]u
932 . \}
935 .de ds*end!3
937 .ie '\\n(.z'ds*div' \{\
938 . di
939 . ds@need \\n[dn]
940 . ev nf
941 . ds*div
942 . ev
943 . rm ds*div
944 . ds*common-end
946 .el .@error-recover mismatched DE
948 .de ds*end!4
949 .ie '\\n(.z'ds*div' \{\
950 . br
951 . di
952 . nf
953 . in (u;\\n[.l]-\\n[dl]/2)
954 . ds@need \\n[dn]
955 . ds*div
956 . rm ds*div
957 . ds*common-end
959 .el .@error-recover mismatched DE
961 .\" ****************************
962 .\" ******** module par ********
963 .\" ****************************
964 .\" Paragraph-level formatting.
965 .nr PS 10
966 .nr LL 6i
967 .de par*vs
968 .\" If it's too big to be in points, treat it as units.
969 .ie (p;\\$1)>=40p .vs (u;\\$1)
970 .el .vs (p;\\$1)
972 .de par@ab-indent
973 .nr 0:li (u;\\n[LL]/12)
974 .nr 0:ri \\n[0:li]
976 .de par*env-init
977 .aln \\n[.ev]:PS PS
978 .aln \\n[.ev]:VS VS
979 .aln \\n[.ev]:LL LL
980 .aln \\n[.ev]:MCLL LL
981 .aln \\n[.ev]:LT LT
982 .aln \\n[.ev]:MCLT LT
983 .aln \\n[.ev]:PI PI
984 .aln \\n[.ev]:PD PD
985 .ad \\n[par*adj]
986 .par@reset-env
988 .\" happens when the first page begins
989 .de par@init
990 .if !rLT .nr LT \\n[LL]
991 .if !rFL .nr FL \\n[LL]*5/6
992 .if !rVS .nr VS \\n[PS]+2
993 .ps \\n[PS]
994 .if !rDI .nr DI .5i
995 .if !rQI .nr QI 5n
996 .if !rPI .nr PI 5n
997 .par*vs \\n[VS]
998 .if !rPD .nr PD .3v>?\n(.V
999 .if !rDD .nr DD .5v>?\n(.V
1000 .if !dFAM .ds FAM \\n[.fam]
1001 .nr par*adj \\n[.j]
1002 .par*env-init
1003 .ev h
1004 .par*env-init
1006 .ev fn
1007 .par*env-init
1009 .ev k
1010 .par*env-init
1012 .aln 0:MCLL pg@colw
1013 .aln 0:MCLT pg@colw
1014 .aln k:MCLL pg@colw
1015 .aln k:MCLT pg@colw
1016 .if !rFPS .nr FPS \\n[PS]-2
1017 .if !rFVS .nr FVS \\n[FPS]+2
1018 .if !rFI .nr FI 2n
1019 .if !rFPD .nr FPD \\n[PD]/2
1020 .aln fn:PS FPS
1021 .aln fn:VS FVS
1022 .aln fn:LL FL
1023 .aln fn:LT FL
1024 .aln fn:PI FI
1025 .aln fn:PD FPD
1026 .aln fn:MCLL pg@fn-colw
1027 .aln fn:MCLT pg@fn-colw
1029 .de par@reset-env
1030 .nr \\n[.ev]:il 0
1031 .nr \\n[.ev]:li 0
1032 .nr \\n[.ev]:ri 0
1033 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1034 .nr \\n[.ev]:pli 0
1035 .nr \\n[.ev]:pri 0
1036 .nr \\n[.ev]:ds-type 0
1038 .\" par@reset
1039 .de par@reset
1041 .ce 0
1042 .rj 0
1043 .ul 0
1045 .ie \\n[pg@ncols]>1 \{\
1046 . ll (u;\\n[\\n[.ev]:MCLL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1047 . lt \\n[\\n[.ev]:MCLT]u
1049 .el \{\
1050 . ll (u;\\n[\\n[.ev]:LL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1051 . lt \\n[\\n[.ev]:LT]u
1053 .in (u;\\n[\\n[.ev]:li]+\\n[\\n[.ev]:pli])
1054 .ft 1
1055 .fam \\*[FAM]
1056 .ps \\n[\\n[.ev]:PS]
1057 .par*vs \\n[\\n[.ev]:VS]
1058 .ls 1
1060 .hy 14
1062 .als @RT par@reset
1063 .\" This can be redefined by the user.
1064 .de TA
1065 .ta T 5n
1067 .de par*start
1068 .ds@auto-end
1069 .nr \\n[.ev]:pli \\$1
1070 .nr \\n[.ev]:pri \\$2
1071 .par@reset
1072 .sp \\n[\\n[.ev]:PD]u
1073 .ne 1v+\\n(.Vu
1075 .de par@finish
1076 .nr \\n[.ev]:pli 0
1077 .nr \\n[.ev]:pri 0
1078 .par@reset
1080 .\" normal LP
1081 .de @LP
1082 .par*start 0 0
1083 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1085 .de @PP
1086 .par*start 0 0
1087 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1088 .ti +\\n[\\n[.ev]:ai]u
1090 .de @QP
1091 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1092 .par*start \\n[QI] \\n[QI]
1094 .de @XP
1095 .par*start \\n[\\n[.ev]:PI] 0
1096 .ti -\\n[\\n[.ev]:PI]u
1098 .de @IP
1099 .if \\n[.$]>1 .nr \\n[.ev]:ai (n;\\$2)
1100 .par*start \\n[\\n[.ev]:ai] 0
1101 .if !'\\$1'' \{\
1102 . \" Divert the label so as to freeze any spaces.
1103 . di par*label
1104 . in 0
1105 . nf
1106 \&\\$1
1107 . di
1108 . in
1109 . fi
1110 . chop par*label
1111 . ti -\\n[\\n[.ev]:ai]u
1112 . ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \\*[par*label]\h'|\\n[\\n[.ev]:ai]u'\c
1113 . el \{\
1114 \\*[par*label]
1115 . br
1116 . \}
1117 . rm par*label
1120 .de @RS
1122 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1123 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1124 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1125 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1126 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1127 .nr \\n[.ev]:il +1
1128 .nr \\n[.ev]:li +\\n[\\n[.ev]:ai]
1129 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1130 .par@reset
1132 .de @RE
1134 .ie \\n[\\n[.ev]:il] \{\
1135 . nr \\n[.ev]:il -1
1136 . nr \\n[.ev]:ai \\n[\\n[.ev]:ai!\\n[\\n[.ev]:il]]
1137 . nr \\n[.ev]:li \\n[\\n[.ev]:li!\\n[\\n[.ev]:il]]
1138 . nr \\n[.ev]:ri \\n[\\n[.ev]:ri!\\n[\\n[.ev]:il]]
1139 . nr \\n[.ev]:pli \\n[\\n[.ev]:pli!\\n[\\n[.ev]:il]]
1140 . nr \\n[.ev]:pri \\n[\\n[.ev]:pri!\\n[\\n[.ev]:il]]
1142 .el .@error unbalanced \\$0
1143 .par@reset
1145 .de @QS
1147 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1148 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1149 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1150 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1151 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1152 .nr \\n[.ev]:il +1
1153 .nr \\n[.ev]:li +\\n[QI]
1154 .nr \\n[.ev]:ri +\\n[QI]
1155 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1156 .par@reset
1158 .als @QE @RE
1159 .\" start boxed text
1160 .de B1
1162 .di par*box-div
1163 .nr \\n[.ev]:li +1n
1164 .nr \\n[.ev]:ri +1n
1165 .par@reset
1167 .de @div-end!par*box-div
1170 .\" end boxed text
1171 .\" Postpone the drawing of the box until we're in the top-level diversion,
1172 .\" in case there's a footnote inside the box.
1173 .de B2
1174 .ie '\\n(.z'par*box-div' \{\
1175 . br
1176 . di
1177 . ds@need \\n[dn]
1178 . par*box-mark-top
1179 . ev nf
1180 . par*box-div
1181 . ev
1182 . nr \\n[.ev]:ri -1n
1183 . nr \\n[.ev]:li -1n
1184 . par@finish
1185 . par*box-draw \\n[.i]u \\n[.l]u
1187 .el .@error B2 without B1
1189 .de par*box-mark-top
1190 .ie '\\n[.z]'' .mk par*box-top
1191 .el \!.par*box-mark-top
1193 .de par*box-draw
1194 .ie '\\n[.z]'' \{\
1195 . nr par*box-in \\n[.i]
1196 . nr par*box-ll \\n[.l]
1197 . nr par*box-vpt \\n[.vpt]
1198 . vpt 0
1199 . in \\$1
1200 . ll \\$2
1201 \v'-1v+.25m'\
1202 \D'l (u;\\n[.l]-\\n[.i]) 0'\
1203 \D'l 0 |\\n[par*box-top]u'\
1204 \D'l -(u;\\n[.l]-\\n[.i]) 0'\
1205 \D'l 0 -|\\n[par*box-top]u'
1206 . br
1207 . sp -1
1208 . in \\n[par*box-in]u
1209 . ll \\n[par*box-ll]u
1210 . vpt \\n[par*box-vpt]
1212 .el \!.par*box-draw \\$1 \\$2
1214 .de @SH
1215 .par@finish
1216 .\" Keep together the heading and the first two lines of the next paragraph.
1217 .ne 3v+\\n[\\n[.ev]:PD]u+\\n(.Vu
1218 .sp 1
1219 .ft B
1221 .\" TL, AU, and AI are aliased to these in cov*ab-init.
1222 .de par@TL
1223 .par@finish
1224 .sp 1
1225 .ft B
1226 .ps +2
1227 .vs +3p
1228 .ce 9999
1230 .de par@AU
1231 .par@finish
1232 .sp 1
1233 .ft I
1234 .ce 9999
1236 .de par@AI
1237 .par@finish
1238 .sp .5
1239 .ce 9999
1241 .\" In paragraph macros.
1242 .de NL
1243 .ps \\n[\\n[.ev]:PS]
1245 .de SM
1246 .ps -2
1248 .de LG
1249 .ps +2
1251 .de R
1252 .ft R
1254 .\" par*define-font-macro macro font
1255 .de par*define-font-macro
1256 .de \\$1
1257 .ie \\\\n[.$] \{\
1258 . nr par*prev-font \\\\n[.f]
1259 \&\\\\$3\f[\\$2]\\\\$1\f[\\\\n[par*prev-font]]\\\\$2
1261 .el .ft \\$2
1262 \\..
1264 .par*define-font-macro B B
1265 .par*define-font-macro I I
1266 .par*define-font-macro BI BI
1267 .par*define-font-macro CW CR
1268 .\" underline a word
1269 .de UL
1270 \Z'\\$1'\v'.25m'\D'l \w'\\$1'u 0'\v'-.25m'\\$2
1272 .\" box a word
1273 .de BX
1274 .nr par*bxw \w'\\$1'+.4m
1275 \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''\
1276 \Z'\h'.2m'\\$1'\
1277 \h'\\n[par*bxw]u'
1279 .\" The first time UX is used, put a registered mark after it.
1280 .ds par*ux-rg \(rg
1281 .de UX
1282 \s[\\n[.s]*8u/10u]UNIX\s0\\$1\\*[par*ux-rg]
1283 .ds par*ux-rg
1285 .ds par@sup-start \v'-.9m\s'\En[.s]*7u/10u'+.7m'
1286 .als { par@sup-start
1287 .ds par@sup-end \v'-.7m\s0+.9m'
1288 .als } par@sup-end
1289 .\" footnote paragraphs
1290 .\" FF is the footnote format
1291 .nr FF 0
1292 .\" This can be redefined. It gets a second argument of `no' if the first
1293 .\" argument was supplied by the user, rather than automatically.
1294 .de FP
1296 .if !d par*fp!\\n[FF] \{\
1297 . @error unknown footnote format `\\n[FF]'
1298 . nr FF 0
1300 .ie '\\$2'no' .par*fp!\\n[FF]-no "\\$1"
1301 .el .par*fp!\\n[FF] "\\$1"
1303 .de par*fp!0
1304 .@PP
1305 \&\\*[par@sup-start]\\$1\\*[par@sup-end]\ \c
1307 .de par*fp!0-no
1308 .@PP
1309 \&\\$1\ \c
1311 .de par*fp!1
1312 .@PP
1313 \&\\$1.\ \c
1315 .de par*fp!1-no
1316 .@PP
1317 \&\\$1\ \c
1319 .de par*fp!2
1320 .@LP
1321 \&\\$1.\ \c
1323 .de par*fp!2-no
1324 .@LP
1325 \&\\$1\ \c
1327 .de par*fp!3
1328 .@IP "\\$1." (u;\\n[\\n[.ev]:PI]*2)
1330 .de par*fp!3-no
1331 .@IP "\\$1" (u;\\n[\\n[.ev]:PI]*2)
1333 .\" ***************************
1334 .\" ******** module nh ********
1335 .\" ***************************
1336 .\" Numbered headings.
1337 .\" nh*hl is the level of the last heading
1338 .nr nh*hl 0
1339 .\" numbered heading
1340 .de @NH
1341 .ie '\\$1'S' \{\
1342 . shift
1343 . nr nh*hl 0
1344 . while \\n[.$] \{\
1345 . nr nh*hl +1
1346 . nr H\\n[nh*hl] 0\\$1
1347 . shift
1348 . \}
1349 . if !\\n[nh*hl] \{\
1350 . nr H1 1
1351 . nr nh*hl 1
1352 . @error missing arguments to .NH S
1353 . \}
1355 .el \{\
1356 . nr nh*ohl \\n[nh*hl]
1357 . ie \\n[.$] \{\
1358 . nr nh*hl 0\\$1
1359 . ie \\n[nh*hl]<=0 \{\
1360 . nr nh*ohl 0
1361 . nr nh*hl 1
1362 . \}
1363 . el \{\
1364 . if \\n[nh*hl]-\\n[nh*ohl]>1 \
1365 . @warning .NH \\n[nh*ohl] followed by .NH \\n[nh*hl]
1366 . \}
1367 . \}
1368 . el .nr nh*hl 1
1369 . while \\n[nh*hl]>\\n[nh*ohl] \{\
1370 . nr nh*ohl +1
1371 . nr H\\n[nh*ohl] 0
1372 . \}
1373 . nr H\\n[nh*hl] +1
1375 .ds SN
1376 .nr nh*i 0
1377 .while \\n[nh*i]<\\n[nh*hl] \{\
1378 . nr nh*i +1
1379 . as SN \\n[H\\n[nh*i]].
1382 \\*[SN]
1384 .\" ****************************
1385 .\" ******** module toc ********
1386 .\" ****************************
1387 .\" Table of contents generation.
1388 .de @XS
1389 .da toc*div
1390 .ev h
1391 .ie \\n[.$] .XA "\\$1"
1392 .el .XA
1394 .de @div-end!toc*div
1397 .de XA
1398 .ie '\\n(.z'toc*div' \{\
1399 . if d toc*num .toc*end-entry
1400 . ie \\n[.$] \{\
1401 . ie '\\$1'no' .ds toc*num
1402 . el .ds toc*num "\\$1
1403 . \}
1404 . el .ds toc*num \\n[PN]
1405 . LP
1406 . na
1407 . ll -8n
1408 . in (n;0\\$2)
1410 .el .@error XA without XS
1412 .de XE
1413 .ie '\\n(.z'toc*div' \{\
1414 . if d toc*num .toc*end-entry
1415 . ev
1416 . di
1418 .el .@error XS without XE
1420 .de toc*end-entry
1421 \\a\\t\\*[toc*num]
1423 .rm toc*num
1425 .de PX
1427 .if !'\\$1'no' \{\
1428 . ce 1
1429 . ps \\n[PS]+2
1430 . ft B
1431 \\*[TOC]
1432 . ft
1433 . ps
1436 .char \[toc*leader-char] .\h'1m'
1437 .lc \[toc*leader-char]
1438 .ta (u;\\n[.l]-\\n[.i]-\w'000') (u;\\n[.l]-\\n[.i])R
1439 .sp 2
1440 .toc*div
1441 .par@reset
1443 .\" print the table of contents on page i
1444 .de TC
1446 .pg@begin 1 i
1447 .PX \\$1
1449 .\" ****************************
1450 .\" ******** module eqn ********
1451 .\" ****************************
1452 .\" Eqn support.
1453 .de EQ
1455 .de EN
1457 .de @EQ
1459 .ds eqn*num "\\$2
1460 .ie '\\$1'L' .nr eqn*type 0
1461 .el \{\
1462 . ie '\\$1'I' .nr eqn*type 1
1463 . el \{\
1464 . nr eqn*type 2
1465 . if !'\\$1'C' .ds eqn*num "\\$1
1466 . \}
1468 .di eqn*div
1469 .in 0
1472 .de @div-end!eqn*div
1473 .@EN
1475 .\" Note that geqn mark and lineup work correctly in centered equations.
1476 .de @EN
1477 .ie !'\\n(.z'eqn*div' .@error-recover mismatched EN
1478 .el \{\
1479 . br
1480 . di
1481 . nr eqn*have-num 0
1482 . if !'\\*[eqn*num]'' .nr eqn*have-num 1
1483 . if \\n[dl]:\\n[eqn*have-num] \{\
1484 . sp \\n[DD]u
1485 . par@reset
1486 . ds eqn*tabs \\n[.tabs]
1487 . nf
1488 . ie \\n[dl] \{\
1489 . ds@need \\n[dn]u-1v+\n[.V]u
1490 . chop eqn*div
1491 . ie \\n[eqn*type]=0 \{\
1492 . ta (u;\\n[.l]-\\n[.i])R
1493 \\*[eqn*div]\t\\*[eqn*num]
1494 . \}
1495 . el \{\
1496 . ie \\n[eqn*type]=1 .ta \\n[DI]u \
1497 (u;\\n[.l]-\\n[.i])R
1498 . el .ta (u;\\n[.l]-\\n[.i]/2)C \
1499 (u;\\n[.l]-\\n[.i])R
1500 \t\\*[eqn*div]\t\\*[eqn*num]
1501 . \}
1502 . \}
1503 . el \{\
1504 . ta (u;\\n[.l]-\\n[.i])R
1505 \t\\*[eqn*num]
1506 . \}
1507 . sp \\n[DD]u
1508 . fi
1509 . ta \\*[eqn*tabs]
1510 . \}
1513 .\" ****************************
1514 .\" ******** module tbl ********
1515 .\" ****************************
1516 .\" Tbl support.
1517 .nr tbl*have-header 0
1518 .de TS
1519 .\" The break is necessary in the case where the first page has not yet begun.
1521 .sp \\n[DD]u
1522 .if '\\$1'H' .di tbl*header-div
1524 .de tbl@top-hook
1525 .if \\n[tbl*have-header] \{\
1526 . ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl*print-header
1527 . el .sp \\n[.t]u
1530 .de tbl*print-header
1531 .ev nf
1532 .tbl*header-div
1534 .mk #T
1536 .de TH
1537 .ie '\\n[.z]'tbl*header-div' \{\
1538 . nr T. 0
1539 . T#
1540 . br
1541 . di
1542 . ie \\n[dn]+\\n[FM]+\\n[HM]+2v>=\\n[.p] \{\
1543 . @error ridiculously long table header
1544 . ds@need \\n[dn]
1545 . tbl*print-header
1546 . \}
1547 . el \{\
1548 . nr tbl*header-ht \\n[dn]
1549 . ds@need \\n[dn]u+1v
1550 . tbl*print-header
1551 . nr tbl*have-header 1
1552 . \}
1554 .el .@error-recover .TH without .TS H
1556 .de @div-end!tbl*header-div
1560 .de TE
1561 .ie '\\n(.z'tbl*header-div' .@error-recover .TS H but no .TH before .TE
1562 .el \{\
1563 . nr tbl*have-header 0
1564 . sp \\n[DD]u
1566 .\" reset tabs
1569 .de tbl@bottom-hook
1570 .if \\n[tbl*have-header] \{\
1571 . nr T. 1
1572 . T#
1575 .de T&
1577 .\" ****************************
1578 .\" ******** module pic ********
1579 .\" ****************************
1580 .\" Pic support.
1581 .\" PS height width
1582 .de PS
1584 .sp \\n[DD]u
1585 .ie \\n[.$]<2 .@error bad arguments to PS (not preprocessed with pic?)
1586 .el \{\
1587 . ds@need (u;\\$1)+1v
1588 . in +(u;\\n[.l]-\\n[.i]-\\$2/2>?0)
1591 .de PE
1592 .par@reset
1593 .sp \\n[DD]u+.5m
1595 .\" ****************************
1596 .\" ******** module ref ********
1597 .\" ****************************
1598 .\" Refer support.
1599 .de ]-
1600 .rm [A [B [C [D [E [G [I [J [N [O [P [Q [R [S [T [V
1601 .rm ref*string
1603 .\" Other
1604 .ds ref*spec!0 Q A T1 S V N P I C D O
1605 .\" Journal article
1606 .ds ref*spec!1 Q A T2 J S V N P I C D O
1607 .\" Book
1608 .ds ref*spec!2 Q A T1 S V P I C D O
1609 .\" Article within book
1610 .ds ref*spec!3 Q A T2 B E S V P I C D O
1611 .\" Tech report
1612 .ds ref*spec!4 Q A T2 R G P I C D O
1613 .\" ][ type
1614 .de ][
1615 .if r [T \{\
1616 . als [T1 [T
1617 . als [T2 [T
1619 .ie d ref*spec!\\$1 .ref*build \\*[ref*spec!\\$1]
1620 .el \{\
1621 . @error unknown reference type `\\$1'
1622 . ref*build \\*[ref*spec!0]
1624 .ref*print
1625 .rm ref*string
1626 .rm [F [T1 [T2
1628 .\" start of reference number
1629 .ds [. \\*[par@sup-start]
1630 .\" end of reference number
1631 .ds .] \\*[par@sup-end]
1632 .\" period before reference
1633 .ds <. .
1634 .\" period after reference
1635 .ds >. \" empty
1636 .\" comma before reference
1637 .ds <, ,
1638 .\" comma after reference
1639 .ds >, \" empty
1640 .\" start collected references
1641 .de ]<
1642 .als ref*print ref*end-print
1644 \&\\*[REFERENCES]
1645 .par@reset
1647 .\" end collected references
1648 .de ]>
1649 .par@finish
1650 .als ref*print ref*normal-print
1652 .de ref*normal-print
1653 .ie d [F .FS "\\*([.\\*([F\\*(.]"
1654 .el .FS \&
1655 \\*[ref*string]
1658 .de ref*end-print
1659 .ie d [F .IP "\\*([F."
1660 .el .XP
1661 \\*[ref*string]
1663 .als ref*print ref*normal-print
1664 .de ref*build
1665 .rm ref*string ref*post-punct
1666 .nr ref*suppress-period 1
1667 .while \\n[.$] \{\
1668 . if d [\\$1 \{\
1669 . ie d ref*add-\\$1 .ref*add-\\$1
1670 . el .ref*add-dflt \\$1
1671 . \}
1672 . shift
1674 .\" now add a final period
1675 .ie d ref*string \{\
1676 . if !\\n[ref*suppress-period] .as ref*string .
1677 . if d ref*post-punct \{\
1678 . as ref*string "\\*[ref*post-punct]
1679 . rm ref*post-punct
1680 . \}
1682 .el .ds ref*string
1684 .de ref*add-T1
1685 .ref*field T , "\fI" "" "\fP"
1686 .if r [T .nr ref*suppress-period \\n([T
1688 .de ref*add-T2
1689 .ref*field T , "\\*Q" "" "\\*U"
1690 .if r [T .nr ref*suppress-period \\n([T
1692 .de ref*add-P
1693 .ie \\n([P>0 .ref*field P , "pp. "
1694 .el .ref*field P , "p. "
1696 .de ref*add-J
1697 .ref*field J , \fI "" \fP
1699 .de ref*add-D
1700 .ref*field D "" ( )
1702 .de ref*add-E
1703 .ref*field E , "ed. "
1705 .de ref*add-G
1706 .ref*field G "" ( )
1708 .de ref*add-B
1709 .ref*field B "" "in \fI" "" \fP
1711 .de ref*add-O
1712 .ref*field O .
1713 .ie r [O .nr ref*suppress-period \\n([O
1714 .el .nr ref*suppress-period 1
1716 .de ref*add-A
1717 .ref*field A ,
1718 .if r [A .nr ref*suppress-period \\n([A
1720 .de ref*add-dflt
1721 .ref*field \\$1 ,
1723 .\" First argument is the field letter.
1724 .\" Second argument is the punctuation character to use to separate this field
1725 .\" from the previous field.
1726 .\" Third argument is a string with which to prefix this field.
1727 .\" Fourth argument is a string with which to postfix this field.
1728 .\" Fifth argument is a string to add after the punctuation character supplied
1729 .\" by the next field.
1730 .de ref*field
1731 .if d ref*string \{\
1732 . ie d ref*post-punct \{\
1733 . as ref*string "\\$2\\*[ref*post-punct] \"
1734 . rm ref*post-punct
1735 . \}
1736 . el .as ref*string "\\$2 \"
1738 .as ref*string "\\$3\\*([\\$1\\$4
1739 .if \\n[.$]>4 .ds ref*post-punct "\\$5
1740 .nr ref*suppress-period 0
1742 .\" ****************************
1743 .\" ******** module acc ********
1744 .\" ****************************
1745 .\" Accents and special characters.
1746 .ds Q \(lq
1747 .ds U \(rq
1748 .ds - \(em
1749 .\" Characters
1750 .\" The idea of this definition is for the top of the 3 to be at the x-height.
1751 .if !c\[yogh] .char \[yogh] \Z'\v'\w'x'*0-\En[rst]u'\s[\En[.s]*8u/10u]\
1752 \v'\w'3'*0+\En[rst]u'3\s0'\h'\w'\s[\En[.s]*8u/10u]3'u'
1753 .\" Accents
1754 .de acc*over-def
1755 .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
1756 \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
1758 .de acc*under-def
1759 .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
1761 .de acc*slash-def
1762 .ds \\$1 \Z'\h'(u;-\En[.w]-\w'\\$2'/2)'\
1763 \v'(u;\En[.cdp]-\En[.cht]+\En[rst]+\En[rsb]/2)'\\$2'
1765 .de acc*prefix-def
1766 .ds \\$1 \Z'\h'(u;\w'x'-\w'\\$2'/2)'\\$2'
1768 .acc*prefix-def ' \'
1769 .acc*prefix-def ` \`
1770 .acc*prefix-def ^ ^
1771 .acc*prefix-def , \(ac
1772 .acc*prefix-def : \(ad
1773 .acc*prefix-def ~ ~
1774 .\" improved accent marks
1775 .de AM
1776 .acc*over-def ' \'
1777 .acc*over-def ` \`
1778 .acc*over-def ^ ^
1779 .acc*over-def ~ ~
1780 .acc*over-def : \(ad
1781 .acc*over-def v \(ah
1782 .acc*over-def _ \(a-
1783 .acc*over-def o \(ao
1784 .acc*under-def , \(ac
1785 .acc*under-def . \s[\En[.s]*8u/10u]\v'.2m'.\v'-.2m'\s0
1786 .acc*under-def hook \(ho
1787 .acc*slash-def / /
1788 .char \[hooko] o\\\\*[hook]
1789 .ds q \[hooko]
1790 .ds 3 \[yogh]
1791 .ds D- \(-D\" Icelandic uppercase eth
1792 .ds d- \(Sd\" Icelandic lowercase eth
1793 .ds Th \(TP\" Icelandic uppercase thorn
1794 .ds th \(Tp\" Icelandic lowercase thorn
1795 .ds 8 \(ss\" German double s
1796 .ds Ae \(AE\" AE ligature
1797 .ds ae \(ae\" ae ligature
1798 .ds Oe \(OE\" OE ligature
1799 .ds oe \(oe\" oe ligature
1800 .ds ? \(r?\" upside down ?
1801 .ds ! \(r!\" upside down !
1803 .\" Make sure that no blank lines creep in at the end of this file.