6 Copyright (C) 1989, 1990, 1991, 1992, 2001, 2002, 2003, 2004
7 Free Software Foundation, Inc.
8 Written by James Clark (jjc@jclark.com)
10 This file is part of groff.
12 groff is free software; you can redistribute it and/or modify it under
13 the terms of the GNU General Public License as published by the Free
14 Software Foundation; either version 2, or (at your option) any later
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
22 You should have received a copy of the GNU General Public License along
23 with groff; see the file COPYING. If not, write to the Free Software
24 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 .if !\n(.g .ab These ms macros require groff.
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.
36 .tm \\n(.F:\\n(.c: macro error: \\$*
39 .tm \\n(.F:\\n(.c: macro warning: \\$*
42 .ab \\n(.F:\\n(.c: fatal macro error: \\$*
45 .@error sorry, \\$0 not implemented
48 .als TM @not-implemented
49 .als CT @not-implemented
53 .if !rPO .nr PO \\n(.o
54 .\" a non-empty environment
62 .ds REFERENCES References
64 .ds TOC Table of Contents
77 .ds MO \\*[MONTH\n[mo]]
78 .ds DY \n[dy] \*[MO] \n[year]
80 .if \\n[.$] .ds DY "\\$*
83 .if \\n[.$] .ds DY "\\$*
88 .tm \\$1\t\\$2\t\\$3\t\\$4 ... \\n[PN]
90 .\" print an error message and then try to recover
92 .@error \\$@ (recovering)
95 . \"@warning automatically terminating diversion \\n(.z
96 . ie d @div-end!\\n(.z .@div-end!\\n(.z
97 . el .*div-end-default
99 . \" ensure that we don't loop forever
100 . if \\n[*pop-count]>20 .@fatal recovery failed
102 .while !'\\n[.ev]'0' .ev
114 .\" ****************************
115 .\" ******** module cov ********
116 .\" ****************************
117 .\" Cover sheet and first page.
118 .de cov*err-not-after-first-page
119 .@error \\$0 is not allowed after the first page has started
121 .de cov*err-not-before-tl
122 .@error \\$0 is not allowed before TL
124 .de cov*err-not-again
125 .@error \\$0 is not allowed more than once
127 .de cov*err-not-after-ab
128 .@error \\$0 is not allowed after first AB, LP, PP, IP, SH or NH
130 .als AU cov*err-not-before-tl
131 .als AI cov*err-not-before-tl
132 .als AB cov*err-not-before-tl
133 .de cov*first-page-init
134 .rm cov*first-page-init
136 .als RP cov*err-not-after-first-page
138 .ie \\n[cov*rp-format] \{\
149 .CHECK-FOOTER-AND-KEEP
151 .wh 0 cov*first-page-init
152 .\" This handles the case where FS occurs before TL or LP.
159 .\" released paper format
162 .if \\n[.$] .if '\\$1'no' .nr cov*rp-no 1
168 .als TL cov*err-not-again
172 .if !'\*(.T'html' .di cov*tl-div
188 .di cov*au-div!\\n[cov*n-au]
191 .ie (\\n[PS] >= 1000) \
192 . ps (\\n[PS]z / 1000u)
197 .if !'\*(.T'html' .par@reset
202 .ie !\\n[cov*n-au] .@error AI before AU
204 . di cov*ai-div!\\n[cov*n-au]
207 . ie (\\n[PS] >= 1000) \
208 . ps (\\n[PS]z / 1000u)
234 .als cov*ab-init @nop
252 .als AB cov*err-not-after-ab
263 .if !'\*(.T'html' .di cov*ab-div
277 . als cov*tl-au-print @nop
285 . als AE cov*err-not-again
288 . ie '\\n(.z'cov*ab-div' \{\
289 . als AE cov*err-not-again
292 .\" nr cov*ab-height \\n[dn]
297 . el .@error AE without AB
300 .de @div-end!cov*ab-div
306 . ie \\n[cov*rp-format] .cov*rp-print
307 . el .cov*draft-print
310 . if \\n[cov*rp-format] \{\
311 . @warning RP format but no TL
315 . CHECK-FOOTER-AND-KEEP
321 .nr cov*page-length \\n[.p]
326 . if !'\*(.T'html' . nf
333 .if \\n[cov*fn-height] \{\
334 . sp |(u;\\n[cov*page-length]-\\n[FM]\
335 -\\n[cov*fn-height]-\\n[fn@sep-dist]>?\\n[nl])
340 . ie \\n[cov*rp-no] .rm cov*fn-div
342 . rn cov*fn-div fn@overflow-div
343 . nr fn@have-overflow 1
348 .CHECK-FOOTER-AND-KEEP
349 .\" If anything was printed below where the footer line is normally printed,
350 .\" then that's an overflow.
351 .if -\\n[FM]/2+1v+\\n[cov*page-length]<\\n[nl] .@error cover sheet overflow
352 .pl \\n[cov*page-length]u
354 .if !\\n[cov*rp-no] .cov*tl-au-print
373 .if d cov*tl-div .cov*tl-div
376 .while \\n[cov*i]<=\\n[cov*n-au] \{\
378 . cov*au-div!\\n[cov*i]
379 . ie d cov*ai-div!\\n[cov*i] \{\
381 . cov*ai-div!\\n[cov*i]
391 .\" start of footnote on cover
393 .if \\n[cov*in-fn] \{\
401 .if !\\n[cov*fn-height] .ns
402 .ie \\n[.$] .FP "\\$1" no
405 .de @div-end!cov*fn-div
408 .\" end of footnote on cover
410 .ie '\\n(.z'cov*fn-div' \{\
415 . nr cov*fn-height +\\n[dn]
417 .el .@error FE without matching FS
419 .\" ***************************
420 .\" ******** module pg ********
421 .\" ***************************
422 .\" Page-level formatting.
423 .\" > 0 if we have a footnote on the current page
435 .ds pg*OH '\\*[LH]'\\*[CH]'\\*[RH]'
436 .ds pg*EH '\\*[LH]'\\*[CH]'\\*[RH]'
437 .ds pg*OF '\\*[LF]'\\*[CF]'\\*[RF]'
438 .ds pg*EF '\\*[LF]'\\*[CF]'\\*[RF]'
446 .ie \\n%=1 .if \\n[pg*P1] .tl \\*[pg*OH]
448 . ie o .tl \\*[pg*OH]
460 .wh -\n[FM]u pg@bottom
461 .wh -\n[FM]u/2u pg*footer
465 .if !'\\n(.z'' .error-recover MC while diversion open
467 .ie \\n[pg@ncols]>1 .pg@super-eject
469 . \" flush out any floating keeps
470 . while \\n[kp@tail]>\\n[kp@head] \{\
476 . nr pg@colw \\n[LL]*7/15
477 . nr pg*gutw \\n[LL]-(2*\\n[pg@colw])
481 . nr pg@colw (n;\\$1)<?\\n[LL]
482 . ie \\n[.$]<2 .nr pg*gutw \\n[MINGW]
483 . el .nr pg*gutw (n;\\$2)
484 . nr pg@ncols \\n[LL]-\\n[pg@colw]/(\\n[pg@colw]+\\n[pg*gutw])+1
485 . ie \\n[pg@ncols]>1 \
486 . nr pg*gutw \\n[LL]-(\\n[pg@ncols]*\\n[pg@colw])/(\\n[pg@ncols]-1)
489 .HTML-TAG ".mc \\n[pg@ncols] \\n[pg@colw] \\n[pg*gutw]"
493 .nr pg@fn-colw \\n[pg@colw]*5/6
502 .\" top of page macro
504 .ch pg*footer -\\n[FM]u/2u
507 .nr pg@fn-bottom-margin 0
521 .\" Handle footnote overflow before floating keeps, because the keep
522 .\" might contain an embedded footnote.
530 .\" move pg@bottom and pg*footer out of the way
531 .ch pg@bottom \\n[.p]u*2u
532 .ch pg*footer \\n[.p]u*2u
537 .if \\n[pg@fn-flag] .fn@bottom-hook
539 .ie \\n[pg*col-num]<\\n[pg@ncols] .pg*end-col
543 'sp |\\n[pg*col-top]u
544 .po (u;\\n[PO]+(\\n[pg@colw]+\\n[pg*gutw]*\\n[pg*col-num]))
545 .\"po +(u;\\n[pg@colw]+\\n[pg*gutw])
550 .\" Make sure we don't exit if there are still floats or footnotes left-over.
551 .ie \\n[kp@head]<\\n[kp@tail]:\\n[fn@have-overflow] \{\
552 . \" Switching environments ensures that we don't get an unnecessary
553 . \" blank line at the top of the page.
559 . \" If the text has ended and there are no more footnotes or keeps, exit.
560 . if \\n[pg@text-ended] .ex
561 . if r pg*next-number \{\
562 . pn \\n[pg*next-number]
564 . if d pg*next-format \{\
565 . af PN \\*[pg*next-format]
572 .\" pg@begin number format
575 . nr pg*next-number (;\\$1)
576 . ie \\n[.$]>1 .ds pg*next-format \\$2
577 . el .rm pg*next-format
579 .el .rr pg*next-number
582 .\" print the footer line
589 .\" flush out any keeps or footnotes
592 .if !'\\n(.z'' .@error-recover diversion open while ejecting page
593 .\" Make sure we stay in the end macro while there is still footnote overflow
594 .\" left, or floating keeps.
595 .while \\n[kp@tail]>\\n[kp@head]:\\n[pg@fn-flag] \{\
608 .\" ***************************
609 .\" ******** module fn ********
610 .\" ***************************
614 .\" Round it vertically
616 .nr fn@sep-dist \n[.v]
620 .ds * \\*[par@sup-start]\En+[fn*text-num]\\*[par@sup-end]
624 .ie \\n[.$] .fn*do-FS "\\$1" no
626 . ie \\n[fn*text-num]>\\n[fn*note-num] .fn*do-FS \\n+[fn*note-num]
630 .\" Second argument of `no' means don't embellish the first argument.
632 .if \\n[fn*open] .@error-recover nested FS
635 . \" Ensure that the first line of the footnote is on the same page
636 . \" as the reference. I think this is minimal.
640 . ie \\n[pg@fn-flag] .nr fn*need +\\n[fn:PD]
641 . el .nr fn*need +\\n[fn@sep-dist]
642 . ne \\n[fn*need]u+\\n[.V]u>?0
652 .ie !\\n[fn*open] .@error FE without FS
660 .nr fn@have-overflow 0
661 .\" called at the top of each column
664 .nr fn*page-bottom-pos 0-\\n[FM]-\\n[pg@fn-bottom-margin]
665 .ch pg@bottom \\n[fn*page-bottom-pos]u
666 .if \\n[fn@have-overflow] \{\
667 . nr fn@have-overflow 0
675 .\" This is called at the bottom of the column if pg@fn-flag is set.
678 .nr fn@have-overflow 0
679 .nr fn@bottom-pos \\n[.p]-\\n[FM]-\\n[pg@fn-bottom-margin]+\\n[.v]
681 .nr fn@bottom-pos -\\n[.v]
683 .ie \\n[nl]+\\n[fn@sep-dist]+\n[.V]>\\n[fn@bottom-pos] \{\
684 . rn fn@div fn@overflow-div
685 . nr fn@have-overflow 1
688 . if \\n[pg@ncols]>1 \
689 . if \\n[fn*max-width]>\\n[pg@fn-colw] \
690 . nr pg@fn-bottom-margin \\n[.p]-\\n[FM]-\\n[nl]+1v
691 . wh \\n[fn@bottom-pos]u fn*catch-overflow
697 . if '\\n(.z'fn@overflow-div' \{\
699 . nr fn@have-overflow \\n[dn]>0
701 . ch fn*catch-overflow
704 .de fn*catch-overflow
710 .if '\\n[.ev]'fn' .ev
714 .als @div-end!fn*embed-div @div-end!fn@div
718 . if !\\n[pg@fn-flag] .ns
723 .ie '\\n(.z'fn@div' \{\
725 . nr fn*page-bottom-pos -\\n[dn]
726 . nr fn*max-width \\n[fn*max-width]>?\\n[dl]
727 . if !\\n[pg@fn-flag] .nr fn*page-bottom-pos -\\n[fn@sep-dist]
729 . nr fn*page-bottom-pos \\n[nl]-\\n[.p]+\n[.V]>?\\n[fn*page-bottom-pos]
730 . ch pg@bottom \\n[fn*page-bottom-pos]u
733 . ie '\\n(.z'fn*embed-div' \{\
735 . rn fn*embed-div fn*embed-div!\\n[fn*embed-count]
736 \!. fn*embed-start \\n[fn*embed-count]
738 ' sp (u;\\n[dn]+\\n[fn@sep-dist]+\\n[.V])
740 . nr fn*embed-count +1
744 . @error-recover unclosed diversion within footnote
753 . rm fn*embed-div!\\$1
759 \!. fn*embed-start \\$1
764 .ie '\\n(.z'fn*null' \{\
770 .\" It's important that fn@print-sep use up exactly fn@sep-dist vertical space.
774 .vs \\n[fn@sep-dist]u
779 .\" ***************************
780 .\" ******** module kp ********
781 .\" ***************************
788 .if !'\\n(.z'' .@error-recover KF while open diversion
795 .ie '\\n(.z'kp*div' .kp*end
797 . ie '\\n(.z'kp*fdiv' .kp*fend
798 . el .@error KE without KS or KF
808 .ie '\\n(.z'' .ds@need \\$1
811 .\" end non-floating keep
824 .\" end floating keep
829 .ie \\n[.t]-(\\n[.k]>0*1v)>\\n[dn] \{\
837 . rn kp*fdiv kp*div!\\n[kp@tail]
838 . nr kp*ht!\\n[kp@tail] 0\\n[dn]
842 .\" top of page processing for KF
845 .if !\\n[kp*doing-top] \{\
852 .\" If the first keep won't fit, only force it out if we haven't had a footnote
853 .\" and we're at the top of the page.
854 .nr kp*force \\n[pg@fn-flag]=0&(\\n[nl]<=\\n[pg@header-bottom])
856 .while \\n[kp@tail]>\\n[kp@head]&\\n[kp*fits] \{\
857 . ie \\n[.t]>\\n[kp*ht!\\n[kp@head]]:\\n[kp*force] \{\
859 . \" It's important to advance kp@head before bringing
860 . \" back the keep, so that if the last line of the
861 . \" last keep springs the bottom of page trap, a new
862 . \" page will not be started unnecessarily.
863 . rn kp*div!\\n[kp@head] kp*temp
873 .\" ***************************
874 .\" ******** module ds ********
875 .\" ***************************
876 .\" Displays and non-floating keeps.
878 .ds*end!\\n[\\n[.ev]:ds-type]
879 .nr \\n[.ev]:ds-type 0
883 .if \\n[\\n[.ev]:ds-type] \{\
884 . @error automatically terminating display
889 .ie \\n[\\n[.ev]:ds-type] .DE
893 .@error DE without DS, ID, CD, LD or BD
897 .nr \\n[.ev]:ds-type 1
904 .ie \\n[.$] .in +(n;\\$1)
919 .als ds*end!1 ds*common-end
922 .nr \\n[.ev]:ds-type 2
927 .ie '\\n(.z'ds*div' \{\
930 . in (u;\\n[.l]-\\n[dl]/2>?0)
935 .el .@error-recover mismatched DE
942 . nr \\n[.ev]:ds-type 4
951 . ie '\\$1'I' .ID \\$2
956 . nr \\n[.ev]:ds-type 3
962 . while \\n[.t]<=(\\$1)&(\\n[nl]>\\n[pg@header-bottom]) \{\
970 .ie '\\n(.z'ds*div' \{\
979 .el .@error-recover mismatched DE
982 .ie '\\n(.z'ds*div' \{\
986 . in (u;\\n[.l]-\\n[dl]/2>?0)
992 .el .@error-recover mismatched DE
994 .\" ****************************
995 .\" ******** module par ********
996 .\" ****************************
997 .\" Paragraph-level formatting.
998 .\" Load time initialization.
1000 .\" PS and VS might have been set on the command-line
1004 .\" don't set LT so that it can be defaulted from LL
1005 .ie rLT .lt \\n[LT]u
1007 .ie (\\n[PS] >= 1000) \
1008 . ps (\\n[PS]z / 1000u)
1011 .\" don't set VS so that it can be defaulted from PS
1013 . ie (\\n[VS] >= 1000) \
1014 . par*vs "(\\n[VS]p / 1000u)"
1019 . ie (\\n[PS] >= 1000) \
1020 . par*vs "((\\n[PS]p / 1000u) + 2p)"
1022 . par*vs "(\\n[PS] + 2)"
1024 .if dFAM .fam \\*[FAM]
1028 .CHECK-FOOTER-AND-KEEP
1031 .\" If it's too big to be in points, treat it as units.
1032 .ie (p;\\$1)>=40p .vs (u;\\$1)
1036 .nr 0:li (u;\\n[LL]/12)
1043 .aln \\n[.ev]:MCLL LL
1045 .aln \\n[.ev]:MCLT LT
1051 .\" happens when the first page begins
1053 .if !rLT .nr LT \\n[LL]
1054 .if !rFL .nr FL \\n[LL]*5/6
1056 . ie (\\n[PS] >= 1000) \
1057 . nr VS (\\n[PS] + 2000)
1059 . nr VS (\\n[PS] + 2)
1063 . ie (\\n[PS] >= 1000) \
1064 . nr FPS (\\n[PS] - 2000)
1066 . nr FPS (\\n[PS] - 2)
1069 . ie (\\n[FPS] >= 1000) \
1070 . nr FVS (\\n[FPS] + 2000)
1072 . nr FVS (\\n[FPS] + 2)
1074 .\" don't change environment 0
1076 .ie (\\n[PS] >= 1000) \
1077 . ps (\\n[PS]z / 1000u)
1082 .ie (\\n[VS] >= 1000) \
1083 . par*vs "(\\n[VS]p / 1000u)"
1086 .if !rPD .nr PD .3v>?\n(.V
1087 .if !rDD .nr DD .5v>?\n(.V
1089 .if !rFPD .nr FPD \\n[PD]/2
1091 .if !dFAM .ds FAM \\n[.fam]
1113 .aln fn:MCLL pg@fn-colw
1114 .aln fn:MCLT pg@fn-colw
1120 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1123 .nr \\n[.ev]:ds-type 0
1132 .ie \\n[pg@ncols]>1 \{\
1133 . ll (u;\\n[\\n[.ev]:MCLL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1134 . lt \\n[\\n[.ev]:MCLT]u
1137 . ll (u;\\n[\\n[.ev]:LL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1138 . lt \\n[\\n[.ev]:LT]u
1140 .in (u;\\n[\\n[.ev]:li]+\\n[\\n[.ev]:pli])
1143 .ie (\\n[\\n[.ev]:PS] >= 1000) \
1144 . ps (\\n[\\n[.ev]:PS]z / 1000u)
1146 . ps \\n[\\n[.ev]:PS]
1147 .ie (\\n[\\n[.ev]:VS] >= 1000) \
1148 . par*vs "(\\n[\\n[.ev]:VS]p / 1000u)"
1150 . par*vs \\n[\\n[.ev]:VS]
1160 .\" This can be redefined by the user.
1166 .nr \\n[.ev]:pli \\$1
1167 .nr \\n[.ev]:pri \\$2
1169 .sp \\n[\\n[.ev]:PD]u
1180 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1184 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1185 .if !'\*(.T'html' .ti +\\n[\\n[.ev]:ai]u
1188 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1189 .par*start \\n[QI] \\n[QI]
1192 .par*start \\n[\\n[.ev]:PI] 0
1193 .ti -\\n[\\n[.ev]:PI]u
1196 .if \\n[.$]>1 .nr \\n[.ev]:ai (n;\\$2)
1197 .par*start \\n[\\n[.ev]:ai] 0
1199 . \" Divert the label so as to freeze any spaces.
1206 . ti -\\n[\\n[.ev]:ai]u
1207 . ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \\*[par*label]\h'|\\n[\\n[.ev]:ai]u'\c
1216 .if \\n[.$]>1 .nr \\n[.ev]:ai (n;\\$2)
1217 .par*start \\n[\\n[.ev]:ai] 0
1219 . \" Divert the label so as to freeze any spaces.
1226 . ti -\\n[\\n[.ev]:ai]u
1227 . ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \{\
1228 . HTML-TAG-NS ".col 1"
1229 \\$1\h'|\\n[\\n[.ev]:ai]u'\c
1230 . HTML-TAG-NS ".col 2"
1239 .\" We don't want margin characters to be attached when we divert
1240 .\" the tag. Since there's no way to save and restore the current
1241 .\" margin character, we have to switch to a new environment, taking
1242 .\" what we need of the old environment with us.
1243 .de par*push-tag-env
1244 .nr par*saved-font \\n[.f]
1245 .nr par*saved-size \\n[.s]z
1246 .nr par*saved-ss \\n[.ss]
1247 .ds par*saved-fam \\n[.fam]
1251 .ft \\n[par*saved-font]
1252 .ps \\n[par*saved-size]u
1253 .ss \\n[par*saved-ss]
1254 .fam \\*[par*saved-fam]
1261 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1262 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1263 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1264 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1265 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1267 .nr \\n[.ev]:li +\\n[\\n[.ev]:ai]
1268 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1273 .ie \\n[\\n[.ev]:il] \{\
1275 . nr \\n[.ev]:ai \\n[\\n[.ev]:ai!\\n[\\n[.ev]:il]]
1276 . nr \\n[.ev]:li \\n[\\n[.ev]:li!\\n[\\n[.ev]:il]]
1277 . nr \\n[.ev]:ri \\n[\\n[.ev]:ri!\\n[\\n[.ev]:il]]
1278 . nr \\n[.ev]:pli \\n[\\n[.ev]:pli!\\n[\\n[.ev]:il]]
1279 . nr \\n[.ev]:pri \\n[\\n[.ev]:pri!\\n[\\n[.ev]:il]]
1281 .el .@error unbalanced \\$0
1286 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1287 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1288 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1289 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1290 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1292 .nr \\n[.ev]:li +\\n[QI]
1293 .nr \\n[.ev]:ri +\\n[QI]
1294 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1298 .\" start boxed text
1305 .nr par*box-in \\n[.in]
1306 .\" remember what 1n is, just in case the point size changes
1311 .ti \\n[par*box-in]u+1n
1313 .de @div-end!par*box-div
1317 .\" Postpone the drawing of the box until we're in the top-level diversion,
1318 .\" in case there's a footnote inside the box.
1320 .ie '\\n(.z'par*box-div' \{\
1322 . if \n[.V]>.25m .sp
1324 . if \n[.V]>.25m .sp
1330 . nr \\n[.ev]:ri -\\n[par*box-n]
1331 . nr \\n[.ev]:li -\\n[par*box-n]
1332 . in -\\n[par*box-n]u
1333 . ll +\\n[par*box-n]u
1334 . lt +\\n[par*box-n]u
1335 . par*box-draw \\n[.i]u \\n[.l]u-(\\n[.H]u==1n*1n)
1337 .el .@error B2 without B1
1340 .de par*box-mark-top
1345 .el \!.par*box-mark-top
1349 . nr par*box-in \\n[.i]
1350 . nr par*box-ll \\n[.l]
1351 . nr par*box-vpt \\n[.vpt]
1352 . nr par*box-ad \\n[.j]
1358 \D'l (u;\\n[.l]-\\n[.i]) 0'\
1359 \D'l 0 |\\n[par*box-top]u'\
1360 \D'l -(u;\\n[.l]-\\n[.i]) 0'\
1361 \D'l 0 -|\\n[par*box-top]u'
1364 . in \\n[par*box-in]u
1365 . ll \\n[par*box-ll]u
1366 . vpt \\n[par*box-vpt]
1367 . ad \\n[par*box-ad]
1369 .el \!.par*box-draw \\$1 \\$2
1373 .\" Keep together the heading and the first two lines of the next paragraph.
1374 .ne 3v+\\n[\\n[.ev]:PD]u+\\n(.Vu
1382 .\" TL, AU, and AI are aliased to these in cov*ab-init.
1403 .\" In paragraph macros.
1405 .ie (\\n[\\n[.ev]:PS] >= 1000) \
1406 . ps (\\n[\\n[.ev]:PS]z / 1000u)
1408 . ps \\n[\\n[.ev]:PS]
1419 .\" par*define-font-macro macro font
1420 .de par*define-font-macro
1423 . nr par*prev-font \\\\n[.f]
1424 \&\\\\$3\f[\\$2]\\\\$1\f[\\\\n[par*prev-font]]\\\\$2
1429 .par*define-font-macro B B
1430 .par*define-font-macro I I
1431 .par*define-font-macro BI BI
1432 .par*define-font-macro CW CR
1433 .\" underline a word
1435 \Z'\\$1'\v'.25m'\D'l \w'\\$1'u 0'\v'-.25m'\\$2
1439 .nr par*bxw \w'\\$1'+.4m
1440 \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''\
1444 .\" The first time UX is used, put a registered mark after it.
1447 \s[\\n[.s]*8u/10u]UNIX\s0\\$1\\*[par*ux-rg]
1450 .ds par@sup-start \v'-.9m\s'\En[.s]*7u/10u'+.7m'
1451 .als { par@sup-start
1452 .ds par@sup-end \v'-.7m\s0+.9m'
1454 .\" footnote paragraphs
1455 .\" FF is the footnote format
1457 .\" This can be redefined. It gets a second argument of `no' if the first
1458 .\" argument was supplied by the user, rather than automatically.
1461 .if !d par*fp!\\n[FF] \{\
1462 . @error unknown footnote format `\\n[FF]'
1465 .ie '\\$2'no' .par*fp!\\n[FF]-no "\\$1"
1466 .el .par*fp!\\n[FF] "\\$1"
1470 \&\\*[par@sup-start]\\$1\\*[par@sup-end]\ \c
1493 .@IP "\\$1." (u;\\n[\\n[.ev]:PI]*2)
1496 .@IP "\\$1" (u;\\n[\\n[.ev]:PI]*2)
1498 .\" ***************************
1499 .\" ******** module nh ********
1500 .\" ***************************
1501 .\" Numbered headings.
1502 .\" nh*hl is the level of the last heading
1504 .\" numbered heading
1511 . nr H\\n[nh*hl] 0\\$1
1514 . if !\\n[nh*hl] \{\
1517 . @error missing arguments to .NH S
1521 . nr nh*ohl \\n[nh*hl]
1524 . ie \\n[nh*hl]<=0 \{\
1529 . if \\n[nh*hl]-\\n[nh*ohl]>1 \
1530 . @warning .NH \\n[nh*ohl] followed by .NH \\n[nh*hl]
1534 . while \\n[nh*hl]>\\n[nh*ohl] \{\
1542 .while \\n[nh*i]<\\n[nh*hl] \{\
1544 . as SN \\n[H\\n[nh*i]].
1547 .HTML-TAG ".NH \\$1"
1550 .\" ****************************
1551 .\" ******** module toc ********
1552 .\" ****************************
1553 .\" Table of contents generation.
1557 .ie \\n[.$] .XA "\\$1"
1560 .de @div-end!toc*div
1564 .ie '\\n(.z'toc*div' \{\
1565 . if d toc*num .toc*end-entry
1567 . ie '\\$1'no' .ds toc*num
1568 . el .ds toc*num "\\$1
1570 . el .ds toc*num \\n[PN]
1577 .el .@error XA without XS
1580 .ie '\\n(.z'toc*div' \{\
1581 . if d toc*num .toc*end-entry
1585 .el .@error XE without XS
1596 . ie (\\n[PS] >= 1000) \
1597 . ps ((\\n[PS]z / 1000u) + 2z)
1606 .char \[toc*leader-char] .\h'1m'
1607 .lc \[toc*leader-char]
1608 .ta (u;\\n[.l]-\\n[.i]-\w'000') (u;\\n[.l]-\\n[.i])R
1613 .\" print the table of contents on page i
1619 .\" ****************************
1620 .\" ******** module eqn ********
1621 .\" ****************************
1630 .ie '\\$1'L' .nr eqn*type 0
1632 . ie '\\$1'I' .nr eqn*type 1
1635 . if !'\\$1'C' .ds eqn*num "\\$1
1640 .if \\n[eqn*type]=0 .HTML-IMAGE-LEFT
1641 .if \\n[eqn*type]=1 \{\
1642 . if '\*(.T'html' .RS
1645 .if \\n[eqn*type]=2 .HTML-IMAGE
1646 .if !'\*(.T'html' .nf
1648 .de @div-end!eqn*div
1651 .\" Note that geqn mark and lineup work correctly in centered equations.
1653 .ie !'\\n(.z'eqn*div' .@error-recover mismatched EN
1658 . if !'\\*[eqn*num]'' .nr eqn*have-num 1
1659 . ie \\n[dl]:\\n[eqn*have-num] \{\
1660 . if !'\*(.T'html' .sp \\n[DD]u
1662 . ds eqn*tabs \\n[.tabs]
1665 .\" --fixme-- this really should not be necessary
1666 .\" and indicates that there is extra space creeping into
1667 .\" an equation when ps4html is enabled..
1668 . ie r ps4html .ds@need \\n[dn]u-1v+\n[.V]u+1i
1669 . el .ds@need \\n[dn]u-1v+\n[.V]u
1671 . ie \\n[eqn*type]=0 \{\
1672 . ta (u;\\n[.l]-\\n[.i])R
1673 \\*[eqn*div]\t\\*[eqn*num]
1676 . ie \\n[eqn*type]=1 .ta \\n[DI]u \
1677 (u;\\n[.l]-\\n[.i])R
1678 . el .ta (u;\\n[.l]-\\n[.i]/2)C \
1679 (u;\\n[.l]-\\n[.i])R
1680 \t\\*[eqn*div]\t\\*[eqn*num]
1684 . ta (u;\\n[.l]-\\n[.i])R
1687 . if !'\*(.T'html' .sp \\n[DD]u
1691 .\" must terminate empty equations in html and ps4html as they contain
1692 .\" the HTML-IMAGE-END suppression nodes
1693 . if \\n[dl] .chop eqn*div
1694 . if '\*(.T'html' \\*[eqn*div]
1695 . if r ps4html \\*[eqn*div]
1697 . if !'\*(.T'html' .fi
1698 . if \\n[eqn*type]=0 .HTML-IMAGE-END
1699 . if \\n[eqn*type]=1 \{\
1701 . if '\*(.T'html' .RE
1703 . if \\n[eqn*type]=2 .HTML-IMAGE-END
1706 .\" ****************************
1707 .\" ******** module tbl ********
1708 .\" ****************************
1710 .nr tbl*have-header 0
1711 .\" This gets called if TS occurs before the first paragraph.
1714 .\" cov*ab-init aliases TS to @TS
1719 .\" .if !'\*(.T'html' .sp \\n[DD]u
1720 .if '\\$1'H' .di tbl*header-div
1724 .if \\n[tbl*have-header] \{\
1725 . ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl*print-header
1729 .de tbl*print-header
1736 .ie '\\n[.z]'tbl*header-div' \{\
1741 . ie \\n[dn]+\\n[FM]+\\n[HM]+2v>=\\n[.p] \{\
1742 . @error ridiculously long table header
1747 . nr tbl*header-ht \\n[dn]
1748 . ds@need \\n[dn]u+1v
1750 . nr tbl*have-header 1
1753 .el .@error-recover .TH without .TS H
1755 .de @div-end!tbl*header-div
1760 .ie '\\n(.z'tbl*header-div' .@error-recover .TS H but no .TH before .TE
1762 . nr tbl*have-header 0
1763 . if !'\*(.T'html' .sp \\n[DD]u
1770 .if \\n[tbl*have-header] \{\
1777 .\" ****************************
1778 .\" ******** module pic ********
1779 .\" ****************************
1785 .ie \\n[.$]<2 .@error bad arguments to PS (not preprocessed with pic?)
1787 . ds@need (u;\\$1)+1v
1788 . in +(u;\\n[.l]-\\n[.i]-\\$2/2>?0)
1797 .\" ****************************
1798 .\" ******** module ref ********
1799 .\" ****************************
1802 .rm [A [B [C [D [E [G [I [J [N [O [P [Q [R [S [T [V
1806 .ds ref*spec!0 Q A T1 S V N P I C D O
1808 .ds ref*spec!1 Q A T2 J S V N P I C D O
1810 .ds ref*spec!2 Q A T1 S V P I C D O
1811 .\" Article within book
1812 .ds ref*spec!3 Q A T2 B E S V P I C D O
1814 .ds ref*spec!4 Q A T2 R G P I C D O
1821 .ie d ref*spec!\\$1 .ref*build \\*[ref*spec!\\$1]
1823 . @error unknown reference type `\\$1'
1824 . ref*build \\*[ref*spec!0]
1830 .\" start of reference number
1831 .ds [. \\*[par@sup-start]
1832 .\" end of reference number
1833 .ds .] \\*[par@sup-end]
1834 .\" period before reference
1836 .\" period after reference
1838 .\" comma before reference
1840 .\" comma after reference
1842 .\" start collected references
1844 .als ref*print ref*end-print
1849 .\" end collected references
1852 .als ref*print ref*normal-print
1854 .de ref*normal-print
1855 .ie d [F .FS "\\*([.\\*([F\\*(.]"
1861 .ie d [F .IP "\\*([F."
1865 .als ref*print ref*normal-print
1867 .rm ref*string ref*post-punct
1868 .nr ref*suppress-period 1
1871 . ie d ref*add-\\$1 .ref*add-\\$1
1872 . el .ref*add-dflt \\$1
1876 .\" now add a final period
1877 .ie d ref*string \{\
1878 . if !\\n[ref*suppress-period] .as ref*string .
1879 . if d ref*post-punct \{\
1880 . as ref*string "\\*[ref*post-punct]
1887 .ref*field T , "\fI" "" "\fP"
1888 .if r [T .nr ref*suppress-period \\n([T
1891 .ref*field T , "\\*Q" "" "\\*U"
1892 .if r [T .nr ref*suppress-period \\n([T
1895 .ie \\n([P>0 .ref*field P , "pp. "
1896 .el .ref*field P , "p. "
1899 .ref*field J , \fI "" \fP
1905 .ref*field E , "ed. "
1911 .ref*field B "" "in \fI" "" \fP
1915 .ie r [O .nr ref*suppress-period \\n([O
1916 .el .nr ref*suppress-period 1
1920 .if r [A .nr ref*suppress-period \\n([A
1925 .\" First argument is the field letter.
1926 .\" Second argument is the punctuation character to use to separate this field
1927 .\" from the previous field.
1928 .\" Third argument is a string with which to prefix this field.
1929 .\" Fourth argument is a string with which to postfix this field.
1930 .\" Fifth argument is a string to add after the punctuation character supplied
1931 .\" by the next field.
1933 .if d ref*string \{\
1934 . ie d ref*post-punct \{\
1935 . as ref*string "\\$2\\*[ref*post-punct] \"
1938 . el .as ref*string "\\$2 \"
1940 .as ref*string "\\$3\\*([\\$1\\$4
1941 .if \\n[.$]>4 .ds ref*post-punct "\\$5
1942 .nr ref*suppress-period 0
1944 .\" ****************************
1945 .\" ******** module acc ********
1946 .\" ****************************
1947 .\" Accents and special characters.
1952 .\" The idea of this definition is for the top of the 3 to be at the x-height.
1953 .if !c\[yogh] .char \[yogh] \Z'\v'\w'x'*0-\En[rst]u'\s[\En[.s]*8u/10u]\
1954 \v'\w'3'*0+\En[rst]u'3\s0'\h'\w'\s[\En[.s]*8u/10u]3'u'
1957 .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
1958 \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
1961 .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
1964 .ds \\$1 \Z'\h'(u;-\En[.w]-\w'\\$2'/2)'\
1965 \v'(u;\En[.cdp]-\En[.cht]+\En[rst]+\En[rsb]/2)'\\$2'
1968 .ds \\$1 \Z'\h'(u;\w'x'-\w'\\$2'/2)'\\$2'
1970 .acc*prefix-def ' \'
1971 .acc*prefix-def ` \`
1973 .acc*prefix-def , \(ac
1974 .acc*prefix-def : \(ad
1976 .\" improved accent marks
1982 .acc*over-def : \(ad
1983 .acc*over-def v \(ah
1984 .acc*over-def _ \(a-
1985 .acc*over-def o \(ao
1986 .acc*under-def , \(ac
1987 .acc*under-def . \s[\En[.s]*8u/10u]\v'.2m'.\v'-.2m'\s0
1988 .acc*under-def hook \(ho
1990 .char \[hooko] o\\\\*[hook]
1993 .ds D- \(-D\" Icelandic uppercase eth
1994 .ds d- \(Sd\" Icelandic lowercase eth
1995 .ds Th \(TP\" Icelandic uppercase thorn
1996 .ds th \(Tp\" Icelandic lowercase thorn
1997 .ds 8 \(ss\" German double s
1998 .ds Ae \(AE\" AE ligature
1999 .ds ae \(ae\" ae ligature
2000 .ds Oe \(OE\" OE ligature
2001 .ds oe \(oe\" oe ligature
2002 .ds ? \(r?\" upside down ?
2003 .ds ! \(r!\" upside down !
2005 .de CHECK-FOOTER-AND-KEEP
2006 .\" it might be better to als FS -> B1 and FE -> B2
2007 .\" however this produced wierd results, so I've moved back to a more reliable
2008 .\" but less interesting solution --fixme--
2009 . if '\*(.T'html' \{\
2037 .if '\*(.T'html' \{\
2041 .\" Make sure that no blank lines creep in at the end of this file.