groff before CVS: release 1.05
[s-roff.git] / macros / tmac.s
blobd6f329226444523eb5dbea8a90e50254847239f6
1 .ig
2 Copyright (C) 1990, 1991 Free Software Foundation, Inc.
3 Written by James Clark (jjc@jclark.uucp)
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 1, 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 LICENSE. 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 /dev/null
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 .de cov*ab-init
216 .als cov*ab-init @nop
217 .als LP @LP
218 .als IP @IP
219 .als PP @PP
220 .als XP @XP
221 .als RT @RT
222 .als SH @SH
223 .als NH @NH
224 .als QP @QP
225 .als RS @RS
226 .als RE @RE
227 .als QS @QS
228 .als QE @QE
229 .als MC @MC
230 .als EQ @EQ
231 .als EN @EN
232 .als AB cov*err-not-after-ab
233 .als AU par@AU
234 .als AI par@AI
235 .als TL par@TL
237 .de @AB
238 .if !'\\n(.z'' \{\
239 . br
240 . di
242 .cov*ab-init
243 .di cov*ab-div
244 .par@ab-indent
245 .par@reset
246 .if !'\\$1'no' \{\
247 . ft I
248 . ce 1
249 \\*[ABSTRACT]
250 . sp
251 . ft R
254 .@PP
256 .de AE
257 .ie '\\n(.z'cov*ab-div' \{\
258 . als AE cov*err-not-again
259 . br
260 . di
261 .\" nr cov*ab-height \\n[dn]
262 . par@reset-env
263 . par@reset
264 . cov*print
266 .el .@error AE without AB
268 .de @div-end!cov*ab-div
271 .de cov*print
272 .als cov*print @nop
273 .ie d cov*tl-div \{\
274 . ie \\n[cov*rp-format] .cov*rp-print
275 . el .cov*draft-print
277 .el \{\
278 . if \\n[cov*rp-format] \{\
279 . @warning RP format but no TL
280 . bp 1
281 . als FS @FS
282 . als FE @FE
283 . \}
284 . br
287 .de cov*rp-print
288 .nr cov*page-length \\n[.p]
289 .pl 1000i
290 .cov*tl-au-print
291 .sp 3
292 .if d cov*ab-div \{\
293 . nf
294 . cov*ab-div
296 .sp 3
297 .par@reset
298 \\*[DY]
300 .if \\n[cov*fn-height] \{\
301 . sp |(u;\\n[cov*page-length]-\\n[FM]\
302 -\\n[cov*fn-height]-\\n[fn@sep-dist]>?\\n[nl])
303 . fn@print-sep
304 . ev nf
305 . cov*fn-div
306 . ev
307 . ie \\n[cov*rp-no] .rm cov*fn-div
308 . el \{\
309 . rn cov*fn-div fn@overflow-div
310 . nr fn@have-overflow 1
311 . \}
313 .als FS @FS
314 .als FE @FE
315 .\" If anything was printed below where the footer line is normally printed,
316 .\" then that's an overflow.
317 .if -\\n[FM]/2+1v+\\n[cov*page-length]<\\n[nl] .@error cover sheet overflow
318 .pl \\n[cov*page-length]u
319 .bp 1
320 .if !\\n[cov*rp-no] .cov*tl-au-print
322 .sp 1
324 .de cov*draft-print
325 .cov*tl-au-print
326 .if d cov*ab-div \{\
327 . nf
328 . sp 2
329 . cov*ab-div
331 .sp 1
333 .de cov*tl-au-print
334 .par@reset
337 .sp 3
338 .ce 9999
339 .cov*tl-div
340 .nr cov*i 1
341 .nr cov*sp 1v
342 .while \\n[cov*i]<=\\n[cov*n-au] \{\
343 . sp \\n[cov*sp]u
344 . cov*au-div!\\n[cov*i]
345 . ie d cov*ai-div!\\n[cov*i] \{\
346 . sp .5v
347 . cov*ai-div!\\n[cov*i]
348 . nr cov*sp 1v
349 . \}
350 . el .nr cov*sp .5v
351 . nr cov*i +1
353 .ce 0
355 .nr cov*fn-height 0
356 .nr cov*in-fn 0
357 .\" start of footnote on cover
358 .de cov*FS
359 .if \\n[cov*in-fn] \{\
360 . @error nested FS
361 . FE
363 .nr cov*in-fn 1
364 .ev fn
365 .par@reset-env
366 .da cov*fn-div
367 .if !\\n[cov*fn-height] .ns
368 .ie \\n[.$] .FP "\\$1" no
369 .el .@LP
371 .de @div-end!cov*fn-div
372 .cov*FE
374 .\" end of footnote on cover
375 .de cov*FE
376 .ie '\\n(.z'cov*fn-div' \{\
377 . br
378 . ev
379 . di
380 . nr cov*in-fn 0
381 . nr cov*fn-height +\\n[dn]
383 .el .@error FE without matching FS
385 .\" ***************************
386 .\" ******** module pg ********
387 .\" ***************************
388 .\" Page-level formatting.
389 .\" > 0 if we have a footnote on the current page
390 .nr pg@fn-flag 0
391 .nr pg@colw 0
392 .nr pg@fn-colw 0
393 .nr HM 1i
394 .nr FM 1i
395 .nr PO 1i
396 .ds LF
397 .ds CF
398 .ds RF
399 .ds LH
400 .ds CH -\\n[PN]-
401 .ds RH
402 .ds pg*OH '\\*[LH]'\\*[CH]'\\*[RH]'
403 .ds pg*EH '\\*[LH]'\\*[CH]'\\*[RH]'
404 .ds pg*OF '\\*[LF]'\\*[CF]'\\*[RF]'
405 .ds pg*EF '\\*[LF]'\\*[CF]'\\*[RF]'
406 .de OH
407 .ds pg*\\$0 "\\$*
409 .als EH OH
410 .als OF OH
411 .als EF OH
412 .de PT
413 .ie \\n%=1 .if \\n[pg*P1] .tl \\*[pg*OH]
414 .el \{\
415 . ie o .tl \\*[pg*OH]
416 . el .tl \\*[pg*EH]
419 .de BT
420 .ie o .tl \\*[pg*OF]
421 .el .tl \\*[pg*EF]
423 .nr pg*P1 0
424 .de P1
425 .nr pg*P1 1
427 .wh -\n[FM]u pg@bottom
428 .wh -\n[FM]u/2u pg*footer
429 .nr MINGW 2n
430 .nr pg@ncols 1
431 .de @MC
432 .if !'\\n(.z'' .error-recover MC while diversion open
434 .ie \\n[pg@ncols]>1 .pg@super-eject
435 .el \{\
436 . \" flush out any floating keeps
437 . while \\n[kp@tail]>\\n[kp@head] \{\
438 . rs
439 . bp
440 . \}
442 .ie !\\n(.$ \{\
443 . nr pg@colw \\n[LL]*7/15
444 . nr pg*gutw \\n[LL]-(2*\\n[pg@colw])
445 . nr pg@ncols 2
447 .el \{\
448 . nr pg@colw (n;\\$1)<?\\n[LL]
449 . ie \\n[.$]<2 .nr pg*gutw \\n[MINGW]
450 . el .nr pg*gutw (n;\\$2)
451 . nr pg@ncols \\n[LL]-\\n[pg@colw]/(\\n[pg@colw]+\\n[pg*gutw])+1
452 . ie \\n[pg@ncols]>1 \
453 . nr pg*gutw \\n[LL]-(\\n[pg@ncols]*\\n[pg@colw])/(\\n[pg@ncols]-1)
454 . el .nr pg*gutw 0
456 .mk pg*col-top
458 .nr pg*col-num 0
459 .nr pg@fn-colw \\n[pg@colw]*5/6
460 .par@reset
462 .de 2C
465 .de 1C
466 .MC \\n[LL]u
468 .\" top of page macro
469 .de pg@top
470 .ch pg*footer -\\n[FM]u/2u
471 .nr PN \\n%
472 .nr pg*col-num 0
473 .nr pg@fn-bottom-margin 0
474 .nr pg*saved-po \\n[PO]
475 .po \\n[PO]u
476 .ev h
477 .par@reset
478 .sp (u;\\n[HM]/2)
480 .sp |\\n[HM]u
481 .if d HD .HD
482 .mk pg@header-bottom
484 .mk pg*col-top
485 .pg*start-col
487 .de pg*start-col
488 .\" Handle footnote overflow before floating keeps, because the keep
489 .\" might contain an embedded footnote.
490 .fn@top-hook
491 .kp@top-hook
492 .tbl@top-hook
495 .de pg@cs-top
496 .sp \\n[HM]u
497 .\" move pg@bottom and pg*footer out of the way
498 .ch pg@bottom \\n[.p]u*2u
499 .ch pg*footer \\n[.p]u*2u
502 .de pg@bottom
503 .tbl@bottom-hook
504 .if \\n[pg@fn-flag] .fn@bottom-hook
505 .nr pg*col-num +1
506 .ie \\n[pg*col-num]<\\n[pg@ncols] .pg*end-col
507 .el .pg*end-page
509 .de pg*end-col
510 'sp |\\n[pg*col-top]u
511 .po (u;\\n[pg*saved-po]+(\\n[pg@colw]+\\n[pg*gutw]*\\n[pg*col-num]))
512 .\"po +(u;\\n[pg@colw]+\\n[pg*gutw])
513 .pg*start-col
515 .de pg*end-page
516 .po \\n[pg*saved-po]u
517 .\" Make sure we don't exit if there are still floats or footnotes left-over.
518 .ie \\n[kp@head]<\\n[kp@tail]:\\n[fn@have-overflow] \{\
519 . \" Switching environments ensures that we don't get an unnecessary
520 . \" blank line at the top of the page.
521 . ev ne
522 ' bp
523 . ev
525 .el \{\
526 . if r pg*next-number \{\
527 . pn \\n[pg*next-number]
528 . rr pg*next-number
529 . if d pg*next-format \{\
530 . af PN \\*[pg*next-format]
531 . rm pg*next-format
532 . \}
533 . \}
534 ' bp
537 .\" pg@begin number format
538 .de pg@begin
539 .ie \\n[.$]>0 \{\
540 . nr pg*next-number (;\\$1)
541 . ie \\n[.$]>1 .ds pg*next-format \\$2
542 . el .rm pg*next-format
544 .el .rr pg*next-number
545 .pg@super-eject
547 .\" print the footer line
548 .de pg*footer
549 .ev h
550 .par@reset
554 .\" flush out any keeps or footnotes
555 .de pg@super-eject
557 .if !'\\n(.z'' .@error-recover diversion open while ejecting page
558 .\" Make sure we stay in the end macro while there is still footnote overflow
559 .\" left, or floating keeps.
560 .while \\n[kp@tail]>\\n[kp@head]:\\n[pg@fn-flag] \{\
561 . rs
562 . bp
566 .em pg@super-eject
567 .\" ***************************
568 .\" ******** module fn ********
569 .\" ***************************
570 .\" Footnotes.
571 .nr fn@sep-dist 8p
572 .ev fn
573 .\" Round it vertically
574 .vs \n[fn@sep-dist]u
575 .nr fn@sep-dist \n[.v]
577 .nr fn*text-num 0 1
578 .nr fn*note-num 0 1
579 .ds * \\*[par@sup-start]\En+[fn*text-num]\\*[par@sup-end]
580 .nr fn*open 0
581 .\" normal FS
582 .de @FS
583 .ie \\n[.$] .fn*do-FS "\\$1" no
584 .el \{\
585 . ie \\n[fn*text-num]>\\n[fn*note-num] .fn*do-FS \\n+[fn*note-num]
586 . el .fn*do-FS
589 .\" Second argument of `no' means don't embellish the first argument.
590 .de fn*do-FS
591 .if \\n[fn*open] .@error-recover nested FS
592 .nr fn*open 1
593 .if \\n[.u] \{\
594 . \" Ensure that the first line of the footnote is on the same page
595 . \" as the reference. I think this is minimal.
596 . ev fn
597 . nr fn*need 1v
598 . ev
599 . ie \\n[pg@fn-flag] .nr fn*need +\\n[fn:PD]
600 . el .nr fn*need +\\n[fn@sep-dist]
601 . ne \\n[fn*need]u+\\n[.V]u>?0
603 .ev fn
604 .par@reset-env
605 .fn*start-div
606 .par@reset
607 .ie \\n[.$] .FP \\$@
608 .el .@LP
610 .de @FE
611 .ie !\\n[fn*open] .@error FE without FS
612 .el \{\
613 . nr fn*open 0
614 . br
615 . ev
616 . fn*end-div
619 .nr fn@have-overflow 0
620 .\" called at the top of each column
621 .de fn@top-hook
622 .nr fn*max-width 0
623 .nr fn*page-bottom-pos 0-\\n[FM]-\\n[pg@fn-bottom-margin]
624 .ch pg@bottom \\n[fn*page-bottom-pos]u
625 .if \\n[fn@have-overflow] \{\
626 . nr fn@have-overflow 0
627 . fn*start-div
628 . ev nf
629 . fn@overflow-div
630 . ev
631 . fn*end-div
634 .\" This is called at the bottom of the column if pg@fn-flag is set.
635 .de fn@bottom-hook
636 .nr pg@fn-flag 0
637 .nr fn@have-overflow 0
638 .nr fn@bottom-pos \\n[.p]-\\n[FM]-\\n[pg@fn-bottom-margin]+\\n[.v]
639 .ev fn
640 .nr fn@bottom-pos -\\n[.v]
642 .ie \\n[nl]+\\n[fn@sep-dist]+\n[.V]>\\n[fn@bottom-pos] \{\
643 . rn fn@div fn@overflow-div
644 . nr fn@have-overflow 1
646 .el \{\
647 . if \\n[pg@ncols]>1 \
648 . if \\n[fn*max-width]>\\n[pg@fn-colw] \
649 . nr pg@fn-bottom-margin \\n[.p]-\\n[FM]-\\n[nl]+1v
650 . wh \\n[fn@bottom-pos]u fn*catch-overflow
651 . fn@print-sep
652 . ev nf
653 . fn@div
654 . rm fn@div
655 . ev
656 . if '\\n(.z'fn@overflow-div' \{\
657 . di
658 . nr fn@have-overflow \\n[dn]>0
659 . \}
660 . ch fn*catch-overflow
663 .de fn*catch-overflow
664 .di fn@overflow-div
666 .nr fn*embed-count 0
667 .de @div-end!fn@div
669 .if '\\n[.ev]'fn' .ev
670 .fn*end-div
671 .nr fn*open 0
673 .als @div-end!fn*embed-div @div-end!fn@div
674 .de fn*start-div
675 .ie '\\n(.z'' \{\
676 . da fn@div
677 . if !\\n[pg@fn-flag] .ns
679 .el .di fn*embed-div
681 .de fn*end-div
682 .ie '\\n(.z'fn@div' \{\
683 . di
684 . nr fn*page-bottom-pos -\\n[dn]
685 . nr fn*max-width \\n[fn*max-width]>?\\n[dl]
686 . if !\\n[pg@fn-flag] .nr fn*page-bottom-pos -\\n[fn@sep-dist]
687 . nr pg@fn-flag 1
688 . nr fn*page-bottom-pos \\n[nl]-\\n[.p]+\n[.V]>?\\n[fn*page-bottom-pos]
689 . ch pg@bottom \\n[fn*page-bottom-pos]u
691 .el \{\
692 . ie '\\n(.z'fn*embed-div' \{\
693 . di
694 . rn fn*embed-div fn*embed-div!\\n[fn*embed-count]
695 \!. fn*embed-start \\n[fn*embed-count]
696 . rs
697 ' sp (u;\\n[dn]+\\n[fn@sep-dist]+\\n[.V])
698 \!. fn*embed-end
699 . nr fn*embed-count +1
700 . \}
701 . el \{\
702 . ev fn
703 . @error-recover unclosed diversion within footnote
704 . \}
707 .de fn*embed-start
708 .ie '\\n(.z'' \{\
709 . fn*start-div
710 . ev nf
711 . fn*embed-div!\\$1
712 . rm fn*embed-div!\\$1
713 . ev
714 . fn*end-div
715 . di fn*null
717 .el \{\
718 \!. fn*embed-start \\$1
719 . rs
722 .de fn*embed-end
723 .ie '\\n(.z'fn*null' \{\
724 . di
725 . rm fn*null
727 .el \!.fn*embed-end
729 .\" It's important that fn@print-sep use up exactly fn@sep-dist vertical space.
730 .de fn@print-sep
731 .ev fn
732 .in 0
733 .vs \\n[fn@sep-dist]u
734 \D'l 1i 0'
738 .\" ***************************
739 .\" ******** module kp ********
740 .\" ***************************
741 .\" Keeps.
742 .de KS
744 .di kp*div
746 .de KF
747 .if !'\\n(.z'' .@error-recover KF while open diversion
748 .di kp*fdiv
749 .ev k
750 .par@reset-env
751 .par@reset
753 .de KE
754 .ie '\\n(.z'kp*div' .kp*end
755 .el \{\
756 . ie '\\n(.z'kp*fdiv' .kp*fend
757 . el .@error KE without KS or KF
760 .de @div-end!kp*div
761 .kp*end
763 .de @div-end!kp*fdiv
764 .kp*fend
766 .de kp*need
767 .ie '\\n(.z'' .ds@need \\$1
768 .el \!.kp*need \\$1
770 .\" end non-floating keep
771 .de kp*end
774 .kp*need \\n[dn]
775 .ev nf
776 .kp*div
778 .rm kp*div
780 .\" Floating keeps.
781 .nr kp@head 0
782 .nr kp@tail 0
783 .\" end floating keep
784 .de kp*fend
788 .ie \\n[.t]-(\\n[.k]>0*1v)>\\n[dn] \{\
789 . br
790 . ev nf
791 . kp*fdiv
792 . rm kp*fdiv
793 . ev
795 .el \{\
796 . rn kp*fdiv kp*div!\\n[kp@tail]
797 . nr kp*ht!\\n[kp@tail] 0\\n[dn]
798 . nr kp@tail +1
801 .\" top of page processing for KF
802 .nr kp*doing-top 0
803 .de kp@top-hook
804 .if !\\n[kp*doing-top] \{\
805 . nr kp*doing-top 1
806 . kp*do-top
807 . nr kp*doing-top 0
810 .de kp*do-top
811 .\" If the first keep won't fit, only force it out if we haven't had a footnote
812 .\" and we're at the top of the page.
813 .nr kp*force \\n[pg@fn-flag]=0&(\\n[nl]<=\\n[pg@header-bottom])
814 .nr kp*fits 1
815 .while \\n[kp@tail]>\\n[kp@head]&\\n[kp*fits] \{\
816 . ie \\n[.t]>\\n[kp*ht!\\n[kp@head]]:\\n[kp*force] \{\
817 . nr kp*force 0
818 . \" It's important to advance kp@head before bringing
819 . \" back the keep, so that if the last line of the
820 . \" last keep springs the bottom of page trap, a new
821 . \" page will not be started unnecessarily.
822 . rn kp*div!\\n[kp@head] kp*temp
823 . nr kp@head +1
824 . ev nf
825 . kp*temp
826 . ev
827 . rm kp*temp
828 . \}
829 . el .nr kp*fits 0
832 .\" ***************************
833 .\" ******** module ds ********
834 .\" ***************************
835 .\" Displays and non-floating keeps.
836 .de DE
837 .ds*end!\\n[\\n[.ev]:ds-type]
838 .nr \\n[.ev]:ds-type 0
840 .de ds@auto-end
841 .if \\n[\\n[.ev]:ds-type] \{\
842 . @error automatically terminating display
843 . DE
846 .de @div-end!ds*div
847 .ie \\n[\\n[.ev]:ds-type] .DE
848 .el .ds*end!2
850 .de ds*end!0
851 .@error DE without DS, ID, CD, LD or BD
853 .de LD
855 .nr \\n[.ev]:ds-type 1
856 .par@reset
858 .sp \\n[DD]u
860 .de ID
862 .ie \\n[.$] .in +(n;\\$1)
863 .el .in +\\n[DI]u
865 .de CD
867 .ce 9999
869 .de RD
871 .rj 9999
873 .de ds*common-end
874 .par@reset
875 .sp \\n[DD]u
877 .als ds*end!1 ds*common-end
878 .de BD
880 .nr \\n[.ev]:ds-type 2
881 .di ds*div
883 .de ds*end!2
885 .ie '\\n(.z'ds*div' \{\
886 . di
887 . nf
888 . in (u;\\n[.l]-\\n[dl]/2)
889 . ds*div
890 . rm ds*div
891 . ds*common-end
893 .el .@error-recover mismatched DE
895 .de DS
897 .di ds*div
898 .ie '\\$1'B' \{\
899 . LD
900 . nr \\n[.ev]:ds-type 4
902 .el \{\
903 . ie '\\$1'L' .LD
904 . el \{\
905 . ie '\\$1'C' .CD
906 . el \{\
907 . ie '\\$1'R' .RD
908 . el \{\
909 . ie '\\$1'I' .ID \\$2
910 . el .ID \\$1
911 . \}
912 . \}
913 . \}
914 . nr \\n[.ev]:ds-type 3
917 .de ds@need
918 .if '\\n(.z'' \{\
919 . while \\n[.t]<=(\\$1)&(\\n[nl]>\\n[pg@header-bottom]) \{\
920 . rs
921 ' sp \\n[.t]u
922 . \}
925 .de ds*end!3
927 .ie '\\n(.z'ds*div' \{\
928 . di
929 . ds@need \\n[dn]
930 . ev nf
931 . ds*div
932 . ev
933 . rm ds*div
934 . ds*common-end
936 .el .@error-recover mismatched DE
938 .de ds*end!4
939 .ie '\\n(.z'ds*div' \{\
940 . br
941 . di
942 . nf
943 . in (u;\\n[.l]-\\n[dl]/2)
944 . ds@need \\n[dn]
945 . ds*div
946 . rm ds*div
947 . ds*common-end
949 .el .@error-recover mismatched DE
951 .\" ****************************
952 .\" ******** module par ********
953 .\" ****************************
954 .\" Paragraph-level formatting.
955 .nr PS 10
956 .nr LL 6i
957 .de par*vs
958 .\" If it's too big to be in points, treat it as units.
959 .ie (p;\\$1)>=40p .vs (u;\\$1)
960 .el .vs (p;\\$1)
962 .de par@ab-indent
963 .nr 0:li (u;\\n[LL]/12)
964 .nr 0:ri \\n[0:li]
966 .de par*env-init
967 .aln \\n[.ev]:PS PS
968 .aln \\n[.ev]:VS VS
969 .aln \\n[.ev]:LL LL
970 .aln \\n[.ev]:MCLL LL
971 .aln \\n[.ev]:LT LT
972 .aln \\n[.ev]:MCLT LT
973 .aln \\n[.ev]:PI PI
974 .aln \\n[.ev]:PD PD
975 .par@reset-env
977 .\" happens when the first page begins
978 .de par@init
979 .if !rLT .nr LT \\n[LL]
980 .if !rFL .nr FL \\n[LL]*5/6
981 .if !rVS .nr VS \\n[PS]+2
982 .ps \\n[PS]
983 .if !rDI .nr DI .5i
984 .if !rQI .nr QI 5n
985 .if !rPI .nr PI 5n
986 .par*vs \\n[VS]
987 .if !rPD .nr PD .3v
988 .if !rDD .nr DD .5v
989 .if !dFAM .ds FAM \\n[.fam]
990 .nr par*adj \\n[.j]
991 .par*env-init
992 .ev h
993 .par*env-init
995 .ev fn
996 .par*env-init
998 .ev k
999 .par*env-init
1001 .aln 0:MCLL pg@colw
1002 .aln 0:MCLT pg@colw
1003 .aln k:MCLL pg@colw
1004 .aln k:MCLT pg@colw
1005 .if !rFPS .nr FPS \\n[PS]-2
1006 .if !rFVS .nr FVS (p;\\n[FPS]+2)
1007 .if !rFI .nr FI 2n
1008 .if !rFPD .nr FPD \\n[PD]/2
1009 .aln fn:PS FPS
1010 .aln fn:VS FVS
1011 .aln fn:LL FL
1012 .aln fn:LT FL
1013 .aln fn:PI FI
1014 .aln fn:PD FPD
1015 .aln fn:MCLL pg@fn-colw
1016 .aln fn:MCLT pg@fn-colw
1018 .de par@reset-env
1019 .nr \\n[.ev]:il 0
1020 .nr \\n[.ev]:li 0
1021 .nr \\n[.ev]:ri 0
1022 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1023 .nr \\n[.ev]:pli 0
1024 .nr \\n[.ev]:pri 0
1025 .nr \\n[.ev]:ds-type 0
1027 .\" par@reset
1028 .de par@reset
1030 .ce 0
1031 .rj 0
1032 .ul 0
1034 .ad \\n[par*adj]
1035 .ie \\n[pg@ncols]>1 \{\
1036 . ll (u;\\n[\\n[.ev]:MCLL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1037 . lt \\n[\\n[.ev]:MCLT]u
1039 .el \{\
1040 . ll (u;\\n[\\n[.ev]:LL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1041 . lt \\n[\\n[.ev]:LT]u
1043 .in (u;\\n[\\n[.ev]:li]+\\n[\\n[.ev]:pli])
1044 .ft 1
1045 .fam \\*[FAM]
1046 .ps \\n[\\n[.ev]:PS]
1047 .par*vs \\n[\\n[.ev]:VS]
1048 .ls 1
1050 .hy 14
1052 .als @RT par@reset
1053 .\" This can be redefined by the user.
1054 .de TA
1055 .ta T 5n
1057 .de par*start
1058 .ds@auto-end
1059 .nr \\n[.ev]:pli \\$1
1060 .nr \\n[.ev]:pri \\$2
1061 .par@reset
1062 .sp \\n[\\n[.ev]:PD]u
1063 .ne 1v+\\n(.Vu
1065 .de par@finish
1066 .nr \\n[.ev]:pli 0
1067 .nr \\n[.ev]:pri 0
1068 .par@reset
1070 .\" normal LP
1071 .de @LP
1072 .par*start 0 0
1073 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1075 .de @PP
1076 .par*start 0 0
1077 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1078 .ti +\\n[\\n[.ev]:ai]u
1080 .de @QP
1081 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1082 .par*start \\n[QI] \\n[QI]
1084 .de @XP
1085 .par*start \\n[\\n[.ev]:PI] 0
1086 .ti -\\n[\\n[.ev]:PI]u
1088 .de @IP
1089 .if \\n[.$]>1 .nr \\n[.ev]:ai (n;\\$2)
1090 .par*start \\n[\\n[.ev]:ai] 0
1091 .if !'\\$1'' \{\
1092 . \" Divert the label so as to freeze any spaces.
1093 . di par*label
1094 . in 0
1095 . nf
1096 \&\\$1
1097 . di
1098 . in
1099 . fi
1100 . chop par*label
1101 . ti -\\n[\\n[.ev]:ai]u
1102 . ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \\*[par*label]\h'|\\n[\\n[.ev]:ai]u'\c
1103 . el \{\
1104 \\*[par*label]
1105 . br
1106 . \}
1107 . rm par*label
1110 .de @RS
1112 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1113 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1114 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1115 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1116 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1117 .nr \\n[.ev]:il +1
1118 .nr \\n[.ev]:li +\\n[\\n[.ev]:ai]
1119 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1120 .par@reset
1122 .de @RE
1124 .ie \\n[\\n[.ev]:il] \{\
1125 . nr \\n[.ev]:il -1
1126 . nr \\n[.ev]:ai \\n[\\n[.ev]:ai!\\n[\\n[.ev]:il]]
1127 . nr \\n[.ev]:li \\n[\\n[.ev]:li!\\n[\\n[.ev]:il]]
1128 . nr \\n[.ev]:ri \\n[\\n[.ev]:ri!\\n[\\n[.ev]:il]]
1129 . nr \\n[.ev]:pli \\n[\\n[.ev]:pli!\\n[\\n[.ev]:il]]
1130 . nr \\n[.ev]:pri \\n[\\n[.ev]:pri!\\n[\\n[.ev]:il]]
1132 .el .@error unbalanced \\$0
1133 .par@reset
1135 .de @QS
1137 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1138 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1139 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1140 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1141 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1142 .nr \\n[.ev]:il +1
1143 .nr \\n[.ev]:li +\\n[QI]
1144 .nr \\n[.ev]:ri +\\n[QI]
1145 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1146 .par@reset
1148 .als @QE @RE
1149 .\" start boxed text
1150 .de B1
1152 .di par*box-div
1153 .nr \\n[.ev]:li +1n
1154 .nr \\n[.ev]:ri +1n
1155 .par@reset
1157 .de @div-end!par*box-div
1160 .\" end boxed text
1161 .\" Postpone the drawing of the box until we're in the top-level diversion,
1162 .\" in case there's a footnote inside the box.
1163 .de B2
1164 .ie '\\n(.z'par*box-div' \{\
1165 . br
1166 . di
1167 . ds@need \\n[dn]
1168 . par*box-mark-top
1169 . ev nf
1170 . par*box-div
1171 . ev
1172 . nr \\n[.ev]:ri -1n
1173 . nr \\n[.ev]:li -1n
1174 . par@finish
1175 . par*box-draw \\n[.i]u \\n[.l]u
1177 .el .@error B2 without B1
1179 .de par*box-mark-top
1180 .ie '\\n[.z]'' .mk par*box-top
1181 .el \!.par*box-mark-top
1183 .de par*box-draw
1184 .ie '\\n[.z]'' \{\
1185 . nr par*box-in \\n[.i]
1186 . nr par*box-ll \\n[.l]
1187 . nr par*box-vpt \\n[.vpt]
1188 . vpt 0
1189 . in \\$1
1190 . ll \\$2
1191 \v'-1v+.25m'\
1192 \D'l (u;\\n[.l]-\\n[.i]) 0'\
1193 \D'l 0 |\\n[par*box-top]u'\
1194 \D'l -(u;\\n[.l]-\\n[.i]) 0'\
1195 \D'l 0 -|\\n[par*box-top]u'
1196 . br
1197 . sp -1
1198 . in \\n[par*box-in]u
1199 . ll \\n[par*box-ll]u
1200 . vpt \\n[par*box-vpt]
1202 .el \!.par*box-draw \\$1 \\$2
1204 .de @SH
1205 .par@finish
1206 .\" Keep together the heading and the first two lines of the next paragraph.
1207 .ne 3v+\\n[\\n[.ev]:PD]u+\\n(.Vu
1208 .sp 1
1209 .ft B
1211 .\" TL, AU, and AI are aliased to these in cov*ab-init.
1212 .de par@TL
1213 .par@finish
1214 .sp 1
1215 .ft B
1216 .ps +2
1217 .vs +3p
1218 .ce 9999
1220 .de par@AU
1221 .par@finish
1222 .sp 1
1223 .ft I
1224 .ce 9999
1226 .de par@AI
1227 .par@finish
1228 .sp .5
1229 .ce 9999
1231 .\" In paragraph macros.
1232 .de NL
1233 .ps \\n[\\n[.ev]:PS]
1235 .de SM
1236 .ps -2
1238 .de LG
1239 .ps +2
1241 .de R
1242 .ft R
1244 .de par*set-font
1245 .ie \\n[.$] \{\
1246 . nr par*prev-font \\n[.f]
1247 \&\\$3\f[\\*[par*font-name!\\$0]]\\$1\f[\\n[par*prev-font]]\\$2
1249 .el .ft \\*[par*font-name!\\$0]
1251 .ds par*font-name!B B
1252 .ds par*font-name!I I
1253 .ds par*font-name!BI BI
1254 .ds par*font-name!CW CR
1255 .als B par*set-font
1256 .als I par*set-font
1257 .als BI par*set-font
1258 .als CW par*set-font
1259 .\" underline a word
1260 .de UL
1261 \Z'\\$1'\v'.25m'\D'l \w'\\$1'u 0'\v'-.25m'\\$2
1263 .\" box a word
1264 .de BX
1265 .nr par*bxw \w'\\$1'+.4m
1266 \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''\
1267 \Z'\h'.2m'\\$1'\
1268 \h'\\n[par*bxw]u'
1270 .\" The first time UX is used, put a registered mark after it.
1271 .ds par*ux-rg \(rg
1272 .de UX
1273 \s[\\n[.s]*8u/10u]UNIX\s0\\$1\\*[par*ux-rg]
1274 .ds par*ux-rg
1276 .ds par@sup-start \v'-.9m\s'\En[.s]*7u/10u'+.7m'
1277 .als { par@sup-start
1278 .ds par@sup-end \v'-.7m\s0+.9m'
1279 .als } par@sup-end
1280 .\" footnote paragraphs
1281 .\" FF is the footnote format
1282 .nr FF 0
1283 .\" This can be redefined. It gets a second argument of `no' if the first
1284 .\" argument was supplied by the user, rather than automatically.
1285 .de FP
1287 .if !d par*fp!\\n[FF] \{\
1288 . @error unknown footnote format `\\n[FF]'
1289 . nr FF 0
1291 .ie '\\$2'no' .par*fp!\\n[FF]-no "\\$1"
1292 .el .par*fp!\\n[FF] "\\$1"
1294 .de par*fp!0
1295 .@PP
1296 \&\\*[par@sup-start]\\$1\\*[par@sup-end]\ \c
1298 .de par*fp!0-no
1299 .@PP
1300 \&\\$1\ \c
1302 .de par*fp!1
1303 .@PP
1304 \&\\$1.\ \c
1306 .de par*fp!1-no
1307 .@PP
1308 \&\\$1\ \c
1310 .de par*fp!2
1311 .@LP
1312 \&\\$1.\ \c
1314 .de par*fp!2-no
1315 .@LP
1316 \&\\$1\ \c
1318 .de par*fp!3
1319 .@IP "\\$1." (u;\\n[\\n[.ev]:PI]*2)
1321 .de par*fp!3-no
1322 .@IP "\\$1" (u;\\n[\\n[.ev]:PI]*2)
1324 .\" ***************************
1325 .\" ******** module nh ********
1326 .\" ***************************
1327 .\" Numbered headings.
1328 .\" nh*hl is the level of the last heading
1329 .nr nh*hl 0
1330 .\" numbered heading
1331 .de @NH
1332 .ie '\\$1'S' \{\
1333 . shift
1334 . nr nh*hl 0
1335 . while \\n[.$] \{\
1336 . nr nh*hl +1
1337 . nr H\\n[nh*hl] 0\\$1
1338 . shift
1339 . \}
1340 . if !\\n[nh*hl] \{\
1341 . nr H1 1
1342 . nr nh*hl 1
1343 . @error missing arguments to .NH S
1344 . \}
1346 .el \{\
1347 . nr nh*ohl \\n[nh*hl]
1348 . ie \\n[.$] \{\
1349 . nr nh*hl 0\\$1
1350 . ie \\n[nh*hl]<=0 \{\
1351 . nr nh*ohl 0
1352 . nr nh*hl 1
1353 . \}
1354 . el \{\
1355 . if \\n[nh*hl]-\\n[nh*ohl]>1 \
1356 . @warning .NH \\n[nh*ohl] followed by .NH \\n[nh*hl]
1357 . \}
1358 . \}
1359 . el .nr nh*hl 1
1360 . while \\n[nh*hl]>\\n[nh*ohl] \{\
1361 . nr nh*ohl +1
1362 . nr H\\n[nh*ohl] 0
1363 . \}
1364 . nr H\\n[nh*hl] +1
1366 .ds SN
1367 .nr nh*i 0
1368 .while \\n[nh*i]<\\n[nh*hl] \{\
1369 . nr nh*i +1
1370 . as SN \\n[H\\n[nh*i]].
1373 \\*[SN]
1375 .\" ****************************
1376 .\" ******** module toc ********
1377 .\" ****************************
1378 .\" Table of contents generation.
1379 .de XS
1380 .da toc*div
1381 .ev h
1382 .par@reset
1384 .ie \\n[.$] .XA "\\$1"
1385 .el .XA
1387 .de @div-end!toc*div
1390 .de XA
1391 .ie '\\n(.z'toc*div' \{\
1392 . if d toc*num .toc*end-entry
1393 . ie \\n[.$] \{\
1394 . ie '\\$1'no' .ds toc*num
1395 . el .ds toc*num "\\$1
1396 . \}
1397 . el .ds toc*num \\n[PN]
1398 . in (n;0\\$2)
1400 .el .@error XA without XS
1402 .de XE
1403 .ie '\\n(.z'toc*div' \{\
1404 . if d toc*num .toc*end-entry
1405 . ev
1406 . di
1408 .el .@error XS without XE
1410 .de toc*end-entry
1411 \\a\\t\\*[toc*num]
1413 .rm toc*num
1415 .de PX
1417 .if !'\\$1'no' \{\
1418 . ce 1
1419 . ps \\n[PS]+2
1420 . ft B
1421 \\*[TOC]
1422 . ft
1423 . ps
1426 .char \[toc*leader-char] .\h'1m'
1427 .lc \[toc*leader-char]
1428 .ta (u;\\n[.l]-\\n[.i]-\w'000') (u;\\n[.l]-\\n[.i])R
1429 .sp 2
1430 .toc*div
1431 .par@reset
1433 .\" print the table of contents on page i
1434 .de TC
1436 .pg@begin 1 i
1437 .PX \\$1
1439 .\" ****************************
1440 .\" ******** module eqn ********
1441 .\" ****************************
1442 .\" Eqn support.
1443 .de EQ
1445 .de EN
1447 .de @EQ
1449 .ds eqn*num "\\$2
1450 .ie '\\$1'L' .nr eqn*type 0
1451 .el \{\
1452 . ie '\\$1'I' .nr eqn*type 1
1453 . el \{\
1454 . nr eqn*type 2
1455 . if !'\\$1'C' .ds eqn*num "\\$1
1456 . \}
1458 .di eqn*div
1459 .in 0
1462 .de @div-end!eqn*div
1463 .@EN
1465 .\" Note that geqn mark and lineup work correctly in centered equations.
1466 .de @EN
1467 .ie !'\\n(.z'eqn*div' .@error-recover mismatched EN
1468 .el \{\
1469 . br
1470 . di
1471 . nr eqn*have-num 0
1472 . if !'\\*[eqn*num]'' .nr eqn*have-num 1
1473 . if \\n[dl]:\\n[eqn*have-num] \{\
1474 . sp \\n[DD]u
1475 . par@reset
1476 . ds eqn*tabs \\n[.tabs]
1477 . nf
1478 . ie \\n[dl] \{\
1479 . ds@need \\n[dn]u-1v+\n[.V]u
1480 . chop eqn*div
1481 . ie \\n[eqn*type]=0 \{\
1482 . ta (u;\\n[.l]-\\n[.i])R
1483 \\*[eqn*div]\t\\*[eqn*num]
1484 . \}
1485 . el \{\
1486 . ie \\n[eqn*type]=1 .ta \\n[DI]u \
1487 (u;\\n[.l]-\\n[.i])R
1488 . el .ta (u;\\n[.l]-\\n[.i]/2)C \
1489 (u;\\n[.l]-\\n[.i])R
1490 \t\\*[eqn*div]\t\\*[eqn*num]
1491 . \}
1492 . \}
1493 . el \{\
1494 . ta (u;\\n[.l]-\\n[.i])R
1495 \t\\*[eqn*num]
1496 . \}
1497 . sp \\n[DD]u
1498 . fi
1499 . ta \\*[eqn*tabs]
1500 . \}
1503 .\" ****************************
1504 .\" ******** module tbl ********
1505 .\" ****************************
1506 .\" Tbl support.
1507 .nr tbl*have-header 0
1508 .de TS
1509 .\" The break is necessary in the case where the first page has not yet begun.
1511 .sp \\n[DD]u
1512 .if '\\$1'H' .di tbl*header-div
1514 .de tbl@top-hook
1515 .if \\n[tbl*have-header] \{\
1516 . ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl*print-header
1517 . el .sp \\n[.t]u
1520 .de tbl*print-header
1521 .ev nf
1522 .tbl*header-div
1524 .mk #T
1526 .de TH
1527 .ie '\\n[.z]'tbl*header-div' \{\
1528 . nr T. 0
1529 . T#
1530 . br
1531 . di
1532 . ie \\n[dn]+\\n[FM]+\\n[HM]+2v>=\\n[.p] \{\
1533 . @error ridiculously long table header
1534 . ds@need \\n[dn]
1535 . tbl*print-header
1536 . \}
1537 . el \{\
1538 . nr tbl*header-ht \\n[dn]
1539 . ds@need \\n[dn]u+1v
1540 . tbl*print-header
1541 . nr tbl*have-header 1
1542 . \}
1544 .el .@error-recover .TH without .TS H
1546 .de @div-end!tbl*header-div
1550 .de TE
1551 .ie '\\n(.z'tbl*header-div' .@error-recover .TS H but no .TH before .TE
1552 .el \{\
1553 . nr tbl*have-header 0
1554 . sp \\n[DD]u
1556 .\" reset tabs
1559 .de tbl@bottom-hook
1560 .if \\n[tbl*have-header] \{\
1561 . nr T. 1
1562 . T#
1565 .de T&
1567 .\" ****************************
1568 .\" ******** module pic ********
1569 .\" ****************************
1570 .\" Pic support.
1571 .\" PS height width
1572 .de PS
1574 .sp \\n[DD]u
1575 .ie \\n[.$]<2 .@error bad arguments to PS (not preprocessed with pic?)
1576 .el \{\
1577 . ds@need (u;\\$1)+1v
1578 . in +(u;\\n[.l]-\\n[.i]-\\$2/2>?0)
1581 .de PE
1582 .par@reset
1583 .sp \\n[DD]u+.5m
1585 .\" ****************************
1586 .\" ******** module ref ********
1587 .\" ****************************
1588 .\" Refer support.
1589 .de ]-
1590 .rm [A [B [C [D [E [G [I [J [N [O [P [Q [R [S [T [V
1591 .rm ref*string
1593 .\" Other
1594 .ds ref*spec!0 Q A T S V N P I C D O
1595 .\" Journal article
1596 .ds ref*spec!1 Q A T J S V N P I C D O
1597 .\" Book
1598 .ds ref*spec!2 Q A T S V P I C D O
1599 .\" Article within book
1600 .ds ref*spec!3 Q A T B E S V P I C D O
1601 .\" Tech report
1602 .ds ref*spec!4 Q A T R G P I C D O
1603 .\" ][ type
1604 .de ][
1605 .ie d ref*spec!\\$1 .ref*build \\*[ref*spec!\\$1]
1606 .el \{\
1607 . @error unknown reference type `\\$1'
1608 . ref*build \\*[ref*spec!0]
1610 .ref*print
1611 .rm ref*string
1612 .rm [F
1614 .\" start of reference number
1615 .ds [. \\*[par@sup-start]
1616 .\" end of reference number
1617 .ds .] \\*[par@sup-end]
1618 .\" period before reference
1619 .ds <. .
1620 .\" period after reference
1621 .ds >. \" empty
1622 .\" comma before reference
1623 .ds <, ,
1624 .\" comma after reference
1625 .ds >, \" empty
1626 .\" start collected references
1627 .de ]<
1628 .als ref*print ref*end-print
1630 \&\\*[REFERENCES]
1631 .par@reset
1633 .\" end collected references
1634 .de ]>
1635 .par@finish
1636 .als ref*print ref*normal-print
1638 .de ref*normal-print
1639 .ie d [F .FS "\\*([.\\*([F\\*(.]"
1640 .el .FS \&
1641 \\*[ref*string]
1644 .de ref*end-print
1645 .ie d [F .IP "\\*([F."
1646 .el .XP
1647 \\*[ref*string]
1649 .als ref*print ref*normal-print
1650 .de ref*build
1651 .rm ref*string ref*post-punct
1652 .nr ref*suppress-period 1
1653 .while \\n[.$] \{\
1654 . if d [\\$1 \{\
1655 . ie d ref*add-\\$1 .ref*add-\\$1
1656 . el .ref*add-dflt \\$1
1657 . \}
1658 . shift
1660 .\" now add a final period
1661 .ie d ref*string \{\
1662 . if !\\n[ref*suppress-period] .as ref*string .
1663 . if d ref*post-punct \{\
1664 . as ref*string "\\*[ref*post-punct]
1665 . rm ref*post-punct
1666 . \}
1668 .el .ds ref*string
1670 .de ref*add-T
1671 .ref*field T , "\\*Q" "" "\\*U"
1672 .if r [T .nr ref*suppress-period \\n([T
1674 .de ref*add-P
1675 .ie \\n([P>0 .ref*field P , "pp. "
1676 .el .ref*field P , "p. "
1678 .de ref*add-J
1679 .ref*field J , \fI "" \fP
1681 .de ref*add-D
1682 .ref*field D "" ( )
1684 .de ref*add-E
1685 .ref*field E , "ed. "
1687 .de ref*add-G
1688 .ref*field G "" ( )
1690 .de ref*add-B
1691 .ref*field B "" "in \fI" "" \fP
1693 .de ref*add-O
1694 .ref*field O .
1695 .ie r [O .nr ref*suppress-period \\n([O
1696 .el .nr ref*suppress-period 1
1698 .de ref*add-A
1699 .ref*field A ,
1700 .if r [A .nr ref*suppress-period \\n([A
1702 .de ref*add-dflt
1703 .ref*field \\$1 ,
1705 .\" First argument is the field letter.
1706 .\" Second argument is the punctuation character to use to separate this field
1707 .\" from the previous field.
1708 .\" Third argument is a string with which to prefix this field.
1709 .\" Fourth argument is a string with which to postfix this field.
1710 .\" Fifth argument is a string to add after the punctuation character supplied
1711 .\" by the next field.
1712 .de ref*field
1713 .if d ref*string \{\
1714 . ie d ref*post-punct \{\
1715 . as ref*string "\\$2\\*[ref*post-punct] \"
1716 . rm ref*post-punct
1717 . \}
1718 . el .as ref*string "\\$2 \"
1720 .as ref*string "\\$3\\*([\\$1\\$4
1721 .if \\n[.$]>4 .ds ref*post-punct "\\$5
1722 .nr ref*suppress-period 0
1724 .\" ****************************
1725 .\" ******** module acc ********
1726 .\" ****************************
1727 .\" Accents and special characters.
1728 .ds Q \)``\)
1729 .ds U \)''\)
1730 .ds - \(em
1731 .\" Characters
1732 .if !c\(rg .char \(rg (R)
1733 .if !c\(ah .char \(ah \v'-.55m'\s[\En[.s]/2u]v\s0\v'.55m'
1734 .if !c\(ad .char \(ad \v'-.55m'\s[\En[.s]*7u/10u].\h'.05m'.\s0\v'.55m'
1735 .if !c\(a- .char \(a- \v'-.55m'\D'l .25m 0'\v'.55m'
1736 .if !c\(ao .char \(ao \v'-.55m'\s[\En[.s]*6u/10u]\D'c .25m'\s0\v'.55m'
1737 .if !c\(ac .char \(ac \s[\En[.s]*8u/10u]\v'.05m',\v'-.05m'\s0
1738 .if !c\(ho .char \(ho \s[\En[.s]/2u]\v'.4m'c\v'-.4m'\s0
1739 .if !c\(-D .char \(-D \Z'\v'-.1m'-'D
1740 .if !c\(Sd .char \(Sd \Z'\v'-.3m'\h'.2m'-'\(pd
1741 .if !c\(TP .char \(TP I\h'-.25m'\v'-.33m'\s[\En[.s]*6u/10u]\v'.33m'D\
1742 \v'-.33m'\s0\v'.33m'
1743 .if !c\(Tp .char \(Tp \zlp
1744 .if !c\(ss .char \(ss \(*b
1745 .if !c\(AE .char \(AE A\h'-.3m'E
1746 .if !c\(ae .char \(ae a\h'-.19m'e
1747 .if !c\(OE .char \(OE O\h'-.25m'E
1748 .if !c\(oe .char \(oe o\h'-.14m'e
1749 .if !c\(r? .char \(r? \Z'\h'.1m'\v'-.15m'\s[\En[.s]*7u/10u]i\s0\v'.15m''\
1750 \v'.15m'\s[\En[.s]*7u/10u]c\s0\v'-.15m'
1751 .if !c\(r! .char \(r! \h'.1m'\Z'\v'-.4m'\s[\En[.s]*8u/10u].\s0\v'.4m''\
1752 \s[\En[.s]*8u/10u]\v'.4m'\(or\v'-.4m'\s0\h'.1m'
1753 .\" The idea of this definition is for the top of the 3 to be at the x-height.
1754 .\" A yogh really ought to have a little line going north-west from the top
1755 .\" left of the 3.
1756 .if !c\[yogh] .char \[yogh] \Z'\v'\w'x'*0-\En[rst]u'\s[\En[.s]*8u/10u]\
1757 \v'\w'3'*0+\En[rst]u'3\s0'\h'\w'\s[\En[.s]*8u/10u]3'u'
1758 .\" Accents
1759 .de acc*over-def
1760 .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
1761 \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
1763 .de acc*under-def
1764 .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
1766 .de acc*slash-def
1767 .ds \\$1 \Z'\h'(u;-\En[.w]-\w'\\$2'/2)'\
1768 \v'(u;\En[.cdp]-\En[.cht]+\En[rst]+\En[rsb]/2)'\\$2'
1770 .de acc*prefix-def
1771 .ds \\$1 \Z'\h'(u;\w'x'-\w'\\$2'/2)'\\$2'
1773 .acc*prefix-def ' \'
1774 .acc*prefix-def ` \`
1775 .acc*prefix-def ^ ^
1776 .acc*prefix-def , \(ac
1777 .acc*prefix-def : \(ad
1778 .acc*prefix-def ~ ~
1779 .\" improved accent marks
1780 .de AM
1781 .acc*over-def ' \'
1782 .acc*over-def ` \`
1783 .acc*over-def ^ ^
1784 .acc*over-def ~ ~
1785 .acc*over-def : \(ad
1786 .acc*over-def v \(ah
1787 .acc*over-def _ \(a-
1788 .acc*over-def o \(ao
1789 .acc*under-def , \(ac
1790 .acc*under-def . \s[\En[.s]*8u/10u]\v'.2m'.\v'-.2m'\s0
1791 .acc*under-def hook \(ho
1792 .acc*slash-def / /
1793 .char \[hooko] o\\\\*[hook]
1794 .ds q \[hooko]
1795 .ds 3 \[yogh]
1796 .ds D- \(-D\" Icelandic uppercase eth
1797 .ds d- \(Sd\" Icelandic lowercase eth
1798 .ds Th \(TP\" Icelandic uppercase thorn
1799 .ds th \(Tp\" Icelandic lowercase thorn
1800 .ds 8 \(ss\" German double s
1801 .ds Ae \(AE\" AE ligature
1802 .ds ae \(ae\" ae ligature
1803 .ds Oe \(OE\" OE ligature
1804 .ds oe \(oe\" oe ligature
1805 .ds ? \(r?\" upside down ?
1806 .ds ! \(r!\" upside down !
1808 .\" Make sure that no blank lines creep in at the end of this file.