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, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, 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.
39 .tm \\n(.F:\\n(.c: macro error: \\$*
42 .tm \\n(.F:\\n(.c: macro warning: \\$*
45 .ab \\n(.F:\\n(.c: fatal macro error: \\$*
48 .@error sorry, \\$0 not implemented
51 .als TM @not-implemented
52 .als CT @not-implemented
56 .if !rPO .nr PO \\n(.o
57 .\" a non-empty environment
65 .ds REFERENCES References
67 .ds TOC Table of Contents
80 .ds MO \\*[MONTH\n[mo]]
81 .ds DY \n[dy] \*[MO] \n[year]
83 .if \\n[.$] .ds DY "\\$*
86 .if \\n[.$] .ds DY "\\$*
91 .tm \\$1\t\\$2\t\\$3\t\\$4 ... \\n[PN]
93 .\" print an error message and then try to recover
95 .@error \\$@ (recovering)
98 . \"@warning automatically terminating diversion \\n(.z
99 . ie d @div-end!\\n(.z .@div-end!\\n(.z
100 . el .*div-end-default
102 . \" ensure that we don't loop forever
103 . if \\n[*pop-count]>20 .@fatal recovery failed
105 .while !'\\n[.ev]'0' .ev
117 .\" ****************************
118 .\" ******** module cov ********
119 .\" ****************************
120 .\" Cover sheet and first page.
121 .de cov*err-not-after-first-page
122 .@error \\$0 is not allowed after the first page has started
124 .de cov*err-not-before-tl
125 .@error \\$0 is not allowed before TL
127 .de cov*err-not-again
128 .@error \\$0 is not allowed more than once
130 .de cov*err-not-after-ab
131 .@error \\$0 is not allowed after first AB, LP, PP, IP, SH or NH
133 .als AU cov*err-not-before-tl
134 .als AI cov*err-not-before-tl
135 .als AB cov*err-not-before-tl
136 .de cov*first-page-init
137 .rm cov*first-page-init
139 .als RP cov*err-not-after-first-page
141 .ie \\n[cov*rp-format] \{\
152 .CHECK-FOOTER-AND-KEEP
154 .wh 0 cov*first-page-init
155 .\" This handles the case where FS occurs before TL or LP.
162 .\" released paper format
165 .if \\n[.$] .if '\\$1'no' .nr cov*rp-no 1
171 .als TL cov*err-not-again
191 .di cov*au-div!\\n[cov*n-au]
194 .ie (\\n[PS] >= 1000) \
195 . ps (\\n[PS]z / 1000u)
205 .ie !\\n[cov*n-au] .@error AI before AU
207 . di cov*ai-div!\\n[cov*n-au]
210 . ie (\\n[PS] >= 1000) \
211 . ps (\\n[PS]z / 1000u)
237 .als cov*ab-init @nop
255 .als AB cov*err-not-after-ab
268 . als cov*tl-au-print @nop
274 . if '\*(.T'html' \{\
288 . als cov*tl-au-print @nop
296 . als AE cov*err-not-again
299 . ie '\\n(.z'cov*ab-div' \{\
300 . als AE cov*err-not-again
303 .\" nr cov*ab-height \\n[dn]
308 . el .@error AE without AB
311 .de @div-end!cov*ab-div
317 . ie \\n[cov*rp-format] .cov*rp-print
318 . el .cov*draft-print
321 . if \\n[cov*rp-format] \{\
322 . @warning RP format but no TL
326 . CHECK-FOOTER-AND-KEEP
332 .nr cov*page-length \\n[.p]
337 . if !'\*(.T'html' . nf
344 .if \\n[cov*fn-height] \{\
345 . sp |(u;\\n[cov*page-length]-\\n[FM]\
346 -\\n[cov*fn-height]-\\n[fn@sep-dist]>?\\n[nl])
351 . ie \\n[cov*rp-no] .rm cov*fn-div
353 . rn cov*fn-div fn@overflow-div
354 . nr fn@have-overflow 1
359 .CHECK-FOOTER-AND-KEEP
360 .\" If anything was printed below where the footer line is normally printed,
361 .\" then that's an overflow.
362 .if -\\n[FM]/2+1v+\\n[cov*page-length]<\\n[nl] .@error cover sheet overflow
363 .pl \\n[cov*page-length]u
365 .if !\\n[cov*rp-no] .cov*tl-au-print
390 .while \\n[cov*i]<=\\n[cov*n-au] \{\
391 . ie '\*(.T'html' .br
392 . el .sp \\n[cov*sp]u
393 . cov*au-div!\\n[cov*i]
394 . ie d cov*ai-div!\\n[cov*i] \{\
396 . cov*ai-div!\\n[cov*i]
406 .\" start of footnote on cover
408 .if \\n[cov*in-fn] \{\
416 .if !\\n[cov*fn-height] .ns
417 .ie \\n[.$] .FP "\\$1" no
420 .de @div-end!cov*fn-div
423 .\" end of footnote on cover
425 .ie '\\n(.z'cov*fn-div' \{\
430 . nr cov*fn-height +\\n[dn]
432 .el .@error FE without matching FS
434 .\" ***************************
435 .\" ******** module pg ********
436 .\" ***************************
437 .\" Page-level formatting.
438 .\" > 0 if we have a footnote on the current page
450 .ds pg*OH '\\*[LH]'\\*[CH]'\\*[RH]'
451 .ds pg*EH '\\*[LH]'\\*[CH]'\\*[RH]'
452 .ds pg*OF '\\*[LF]'\\*[CF]'\\*[RF]'
453 .ds pg*EF '\\*[LF]'\\*[CF]'\\*[RF]'
461 .ie \\n%=1 .if \\n[pg*P1] .tl \\*[pg*OH]
463 . ie o .tl \\*[pg*OH]
475 .wh -\n[FM]u pg@bottom
476 .wh -\n[FM]u/2u pg*footer
480 .if !'\\n(.z'' .error-recover MC while diversion open
482 .ie \\n[pg@ncols]>1 .pg@super-eject
484 . \" flush out any floating keeps
485 . while \\n[kp@tail]>\\n[kp@head] \{\
491 . nr pg@colw \\n[LL]*7/15
492 . nr pg*gutw \\n[LL]-(2*\\n[pg@colw])
496 . nr pg@colw (n;\\$1)<?\\n[LL]
497 . ie \\n[.$]<2 .nr pg*gutw \\n[MINGW]
498 . el .nr pg*gutw (n;\\$2)
499 . nr pg@ncols \\n[LL]-\\n[pg@colw]/(\\n[pg@colw]+\\n[pg*gutw])+1
500 . ie \\n[pg@ncols]>1 \
501 . nr pg*gutw \\n[LL]-(\\n[pg@ncols]*\\n[pg@colw])/(\\n[pg@ncols]-1)
504 .DEVTAG ".mc \\n[pg@ncols] \\n[pg@colw] \\n[pg*gutw]"
508 .nr pg@fn-colw \\n[pg@colw]*5/6
517 .\" top of page macro
519 .ch pg*footer -\\n[FM]u/2u
522 .nr pg@fn-bottom-margin 0
536 .\" Handle footnote overflow before floating keeps, because the keep
537 .\" might contain an embedded footnote.
545 .\" move pg@bottom and pg*footer out of the way
546 .ch pg@bottom \\n[.p]u*2u
547 .ch pg*footer \\n[.p]u*2u
552 .if \\n[pg@fn-flag] .fn@bottom-hook
554 .ie \\n[pg*col-num]<\\n[pg@ncols] .pg*end-col
558 'sp |\\n[pg*col-top]u
559 .po (u;\\n[PO]+(\\n[pg@colw]+\\n[pg*gutw]*\\n[pg*col-num]))
560 .\"po +(u;\\n[pg@colw]+\\n[pg*gutw])
565 .\" Make sure we don't exit if there are still floats or footnotes left-over.
566 .ie \\n[kp@head]<\\n[kp@tail]:\\n[fn@have-overflow] \{\
567 . \" Switching environments ensures that we don't get an unnecessary
568 . \" blank line at the top of the page.
574 . \" If the text has ended and there are no more footnotes or keeps, exit.
575 . if \\n[pg@text-ended] .ex
576 . if r pg*next-number \{\
577 . pn \\n[pg*next-number]
579 . if d pg*next-format \{\
580 . af PN \\*[pg*next-format]
587 .\" pg@begin number format
590 . nr pg*next-number (;\\$1)
591 . ie \\n[.$]>1 .ds pg*next-format \\$2
592 . el .rm pg*next-format
594 .el .rr pg*next-number
597 .\" print the footer line
604 .\" flush out any keeps or footnotes
607 .if !'\\n(.z'' .@error-recover diversion open while ejecting page
608 .\" Make sure we stay in the end macro while there is still footnote overflow
609 .\" left, or floating keeps.
610 .while \\n[kp@tail]>\\n[kp@head]:\\n[pg@fn-flag] \{\
623 .\" ***************************
624 .\" ******** module fn ********
625 .\" ***************************
629 .\" Round it vertically
631 .nr fn@sep-dist \n[.v]
635 .ds * \\*[par@sup-start]\En+[fn*text-num]\\*[par@sup-end]
639 .ie \\n[.$] .fn*do-FS "\\$1" no
641 . ie \\n[fn*text-num]>\\n[fn*note-num] .fn*do-FS \\n+[fn*note-num]
645 .\" Second argument of `no' means don't embellish the first argument.
647 .if \\n[fn*open] .@error-recover nested FS
650 . \" Ensure that the first line of the footnote is on the same page
651 . \" as the reference. I think this is minimal.
655 . ie \\n[pg@fn-flag] .nr fn*need +\\n[fn:PD]
656 . el .nr fn*need +\\n[fn@sep-dist]
657 . ne \\n[fn*need]u+\\n[.V]u>?0
667 .ie !\\n[fn*open] .@error FE without FS
675 .nr fn@have-overflow 0
676 .\" called at the top of each column
679 .nr fn*page-bottom-pos 0-\\n[FM]-\\n[pg@fn-bottom-margin]
680 .ch pg@bottom \\n[fn*page-bottom-pos]u
681 .if \\n[fn@have-overflow] \{\
682 . nr fn@have-overflow 0
690 .\" This is called at the bottom of the column if pg@fn-flag is set.
693 .nr fn@have-overflow 0
694 .nr fn@bottom-pos \\n[.p]-\\n[FM]-\\n[pg@fn-bottom-margin]+\\n[.v]
696 .nr fn@bottom-pos -\\n[.v]
698 .ie \\n[nl]+\\n[fn@sep-dist]+\n[.V]>\\n[fn@bottom-pos] \{\
699 . rn fn@div fn@overflow-div
700 . nr fn@have-overflow 1
703 . if \\n[pg@ncols]>1 \
704 . if \\n[fn*max-width]>\\n[pg@fn-colw] \
705 . nr pg@fn-bottom-margin \\n[.p]-\\n[FM]-\\n[nl]+1v
706 . wh \\n[fn@bottom-pos]u fn*catch-overflow
712 . if '\\n(.z'fn@overflow-div' \{\
714 . nr fn@have-overflow \\n[dn]>0
716 . ch fn*catch-overflow
719 .de fn*catch-overflow
725 .if '\\n[.ev]'fn' .ev
729 .als @div-end!fn*embed-div @div-end!fn@div
733 . if !\\n[pg@fn-flag] .ns
738 .ie '\\n(.z'fn@div' \{\
740 . nr fn*page-bottom-pos -\\n[dn]
741 . nr fn*max-width \\n[fn*max-width]>?\\n[dl]
742 . if !\\n[pg@fn-flag] .nr fn*page-bottom-pos -\\n[fn@sep-dist]
744 . nr fn*page-bottom-pos \\n[nl]-\\n[.p]+\n[.V]>?\\n[fn*page-bottom-pos]
745 . ch pg@bottom \\n[fn*page-bottom-pos]u
748 . ie '\\n(.z'fn*embed-div' \{\
750 . rn fn*embed-div fn*embed-div!\\n[fn*embed-count]
751 \!. fn*embed-start \\n[fn*embed-count]
753 ' sp (u;\\n[dn]+\\n[fn@sep-dist]+\\n[.V])
755 . nr fn*embed-count +1
759 . @error-recover unclosed diversion within footnote
768 . rm fn*embed-div!\\$1
774 \!. fn*embed-start \\$1
779 .ie '\\n(.z'fn*null' \{\
785 .\" It's important that fn@print-sep use up exactly fn@sep-dist vertical space.
789 .vs \\n[fn@sep-dist]u
794 .\" ***************************
795 .\" ******** module kp ********
796 .\" ***************************
803 .if !'\\n(.z'' .@error-recover KF while open diversion
810 .ie '\\n(.z'kp*div' .kp*end
812 . ie '\\n(.z'kp*fdiv' .kp*fend
813 . el .@error KE without KS or KF
823 .ie '\\n(.z'' .ds@need \\$1
826 .\" end non-floating keep
839 .\" end floating keep
844 .ie \\n[.t]-(\\n[.k]>0*1v)>\\n[dn] \{\
852 . rn kp*fdiv kp*div!\\n[kp@tail]
853 . nr kp*ht!\\n[kp@tail] 0\\n[dn]
857 .\" top of page processing for KF
860 .if !\\n[kp*doing-top] \{\
867 .\" If the first keep won't fit, only force it out if we haven't had a footnote
868 .\" and we're at the top of the page.
869 .nr kp*force \\n[pg@fn-flag]=0&(\\n[nl]<=\\n[pg@header-bottom])
871 .while \\n[kp@tail]>\\n[kp@head]&\\n[kp*fits] \{\
872 . ie \\n[.t]>\\n[kp*ht!\\n[kp@head]]:\\n[kp*force] \{\
874 . \" It's important to advance kp@head before bringing
875 . \" back the keep, so that if the last line of the
876 . \" last keep springs the bottom of page trap, a new
877 . \" page will not be started unnecessarily.
878 . rn kp*div!\\n[kp@head] kp*temp
888 .\" ***************************
889 .\" ******** module ds ********
890 .\" ***************************
891 .\" Displays and non-floating keeps.
893 .ds*end!\\n[\\n[.ev]:ds-type]
894 .nr \\n[.ev]:ds-type 0
897 .if \\n[\\n[.ev]:ds-type] \{\
898 . @error automatically terminating display
903 .ie \\n[\\n[.ev]:ds-type] .DE
907 .@error DE without DS, ID, CD, LD or BD
911 .nr \\n[.ev]:ds-type 1
918 .ie \\n[.$] .in +(n;\\$1)
933 .als ds*end!1 ds*common-end
936 .nr \\n[.ev]:ds-type 2
941 .ie '\\n(.z'ds*div' \{\
944 . in (u;\\n[.l]-\\n[dl]/2>?0)
949 .el .@error-recover mismatched DE
956 . nr \\n[.ev]:ds-type 4
965 . ie '\\$1'I' .ID \\$2
970 . nr \\n[.ev]:ds-type 3
975 . while \\n[.t]<=(\\$1)&(\\n[nl]>\\n[pg@header-bottom]) \{\
983 .ie '\\n(.z'ds*div' \{\
992 .el .@error-recover mismatched DE
995 .ie '\\n(.z'ds*div' \{\
999 . in (u;\\n[.l]-\\n[dl]/2>?0)
1005 .el .@error-recover mismatched DE
1007 .\" ****************************
1008 .\" ******** module par ********
1009 .\" ****************************
1010 .\" Paragraph-level formatting.
1011 .\" Load time initialization.
1013 .\" PS and VS might have been set on the command-line
1017 .\" don't set LT so that it can be defaulted from LL
1018 .ie rLT .lt \\n[LT]u
1020 .ie (\\n[PS] >= 1000) \
1021 . ps (\\n[PS]z / 1000u)
1024 .\" don't set VS so that it can be defaulted from PS
1026 . ie (\\n[VS] >= 1000) \
1027 . par*vs "(\\n[VS]p / 1000u)"
1032 . ie (\\n[PS] >= 1000) \
1033 . par*vs "((\\n[PS]p / 1000u) + 2p)"
1035 . par*vs "(\\n[PS] + 2)"
1037 .if dFAM .fam \\*[FAM]
1041 .CHECK-FOOTER-AND-KEEP
1044 .\" If it's too big to be in points, treat it as units.
1045 .ie (p;\\$1)>=40p .vs (u;\\$1)
1049 .nr 0:li (u;\\n[LL]/12)
1056 .aln \\n[.ev]:MCLL LL
1058 .aln \\n[.ev]:MCLT LT
1064 .\" happens when the first page begins
1066 .if !rLT .nr LT \\n[LL]
1067 .if !rFL .nr FL \\n[LL]*5/6
1069 . ie (\\n[PS] >= 1000) \
1070 . nr VS (\\n[PS] + 2000)
1072 . nr VS (\\n[PS] + 2)
1076 . ie (\\n[PS] >= 1000) \
1077 . nr FPS (\\n[PS] - 2000)
1079 . nr FPS (\\n[PS] - 2)
1082 . ie (\\n[FPS] >= 1000) \
1083 . nr FVS (\\n[FPS] + 2000)
1085 . nr FVS (\\n[FPS] + 2)
1087 .\" don't change environment 0
1089 .ie (\\n[PS] >= 1000) \
1090 . ps (\\n[PS]z / 1000u)
1095 .ie (\\n[VS] >= 1000) \
1096 . par*vs "(\\n[VS]p / 1000u)"
1099 .if !rPD .nr PD .3v>?\n(.V
1100 .if !rDD .nr DD .5v>?\n(.V
1102 .if !rFPD .nr FPD \\n[PD]/2
1104 .if !dFAM .ds FAM \\n[.fam]
1126 .aln fn:MCLL pg@fn-colw
1127 .aln fn:MCLT pg@fn-colw
1133 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1136 .nr \\n[.ev]:ds-type 0
1141 .if \\n[need_eo_tl]>0 .DEVTAG-EO-TL
1143 .if \\n[need_eo_h]>0 .DEVTAG-EO-H
1149 .ie \\n[pg@ncols]>1 \{\
1150 . ll (u;\\n[\\n[.ev]:MCLL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1151 . lt \\n[\\n[.ev]:MCLT]u
1154 . ll (u;\\n[\\n[.ev]:LL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1155 . lt \\n[\\n[.ev]:LT]u
1157 .in (u;\\n[\\n[.ev]:li]+\\n[\\n[.ev]:pli])
1160 .ie (\\n[\\n[.ev]:PS] >= 1000) \
1161 . ps (\\n[\\n[.ev]:PS]z / 1000u)
1163 . ps \\n[\\n[.ev]:PS]
1164 .ie (\\n[\\n[.ev]:VS] >= 1000) \
1165 . par*vs "(\\n[\\n[.ev]:VS]p / 1000u)"
1167 . par*vs \\n[\\n[.ev]:VS]
1177 .\" This can be redefined by the user.
1181 .\" \n[PORPHANS] sets number of initial lines of any paragraph,
1182 .\" which must be kept together, without any included page break.
1183 .\" Initialise to reproduce original behaviour; user may adjust it.
1184 .if !rPORPHANS .nr PORPHANS 1
1188 .nr \\n[.ev]:pli \\$1
1189 .nr \\n[.ev]:pri \\$2
1191 .sp \\n[\\n[.ev]:PD]u
1192 .ne \\n[PORPHANS]v+\\n(.Vu
1202 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1206 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1207 .if !'\*(.T'html' .ti +\\n[\\n[.ev]:ai]u
1210 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1211 .par*start \\n[QI] \\n[QI]
1214 .par*start \\n[\\n[.ev]:PI] 0
1215 .ti -\\n[\\n[.ev]:PI]u
1218 .if \\n[.$]>1 .nr \\n[.ev]:ai (n;\\$2)
1219 .par*start \\n[\\n[.ev]:ai] 0
1221 . \" Divert the label so as to freeze any spaces.
1228 . ti -\\n[\\n[.ev]:ai]u
1229 . ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \{\
1231 \\*[par*label]\h'|\\n[\\n[.ev]:ai]u'\c
1243 .\" We don't want margin characters to be attached when we divert
1244 .\" the tag. Since there's no way to save and restore the current
1245 .\" margin character, we have to switch to a new environment, taking
1246 .\" what we need of the old environment with us.
1247 .de par*push-tag-env
1248 .nr par*saved-font \\n[.f]
1249 .nr par*saved-size \\n[.s]z
1250 .nr par*saved-ss \\n[.ss]
1251 .ds par*saved-fam \\n[.fam]
1255 .ft \\n[par*saved-font]
1256 .ps \\n[par*saved-size]u
1257 .ss \\n[par*saved-ss]
1258 .fam \\*[par*saved-fam]
1265 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1266 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1267 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1268 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1269 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1271 .nr \\n[.ev]:li +\\n[\\n[.ev]:ai]
1272 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1277 .ie \\n[\\n[.ev]:il] \{\
1279 . nr \\n[.ev]:ai \\n[\\n[.ev]:ai!\\n[\\n[.ev]:il]]
1280 . nr \\n[.ev]:li \\n[\\n[.ev]:li!\\n[\\n[.ev]:il]]
1281 . nr \\n[.ev]:ri \\n[\\n[.ev]:ri!\\n[\\n[.ev]:il]]
1282 . nr \\n[.ev]:pli \\n[\\n[.ev]:pli!\\n[\\n[.ev]:il]]
1283 . nr \\n[.ev]:pri \\n[\\n[.ev]:pri!\\n[\\n[.ev]:il]]
1285 .el .@error unbalanced \\$0
1290 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1291 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1292 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1293 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1294 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1296 .nr \\n[.ev]:li +\\n[QI]
1297 .nr \\n[.ev]:ri +\\n[QI]
1298 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1302 .\" start boxed text
1309 .nr par*box-in \\n[.in]
1310 .\" remember what 1n is, just in case the point size changes
1315 .ti \\n[par*box-in]u+1n
1317 .de @div-end!par*box-div
1321 .\" Postpone the drawing of the box until we're in the top-level diversion,
1322 .\" in case there's a footnote inside the box.
1324 .ie '\\n(.z'par*box-div' \{\
1326 . if \n[.V]>.25m .sp
1328 . if \n[.V]>.25m .sp
1334 . nr \\n[.ev]:ri -\\n[par*box-n]
1335 . nr \\n[.ev]:li -\\n[par*box-n]
1336 . in -\\n[par*box-n]u
1337 . ll +\\n[par*box-n]u
1338 . lt +\\n[par*box-n]u
1339 . par*box-draw \\n[.i]u \\n[.l]u-(\\n[.H]u==1n*1n)
1341 .el .@error B2 without B1
1344 .de par*box-mark-top
1349 .el \!.par*box-mark-top
1353 . nr par*box-in \\n[.i]
1354 . nr par*box-ll \\n[.l]
1355 . nr par*box-vpt \\n[.vpt]
1356 . nr par*box-ad \\n[.j]
1362 \D'l (u;\\n[.l]-\\n[.i]) 0'\
1363 \D'l 0 |\\n[par*box-top]u'\
1364 \D'l -(u;\\n[.l]-\\n[.i]) 0'\
1365 \D'l 0 -|\\n[par*box-top]u'
1368 . in \\n[par*box-in]u
1369 . ll \\n[par*box-ll]u
1370 . vpt \\n[par*box-vpt]
1371 . ad \\n[par*box-ad]
1373 .el \!.par*box-draw \\$1 \\$2
1375 .\" \n[HORPHANS] sets how many lines of the following paragraph must be
1376 .\" kept together, with a preceding section header. Initialise it,
1377 .\" to reproduce original behaviour; user may change it.
1378 .if !rHORPHANS .nr HORPHANS 1
1380 .\" \n[GROWPS] and \n[PSINCR] cause auto-increment of header point size.
1381 .\" Initialise them, so they have no effect, unless explicitly set by the user.
1382 .if !rGROWPS .nr GROWPS 0
1383 .if !rPSINCR .nr PSINCR 1p
1387 .\" Keep the heading and the first few lines of the next paragraph together.
1388 .\" (\n[HORPHANS] defines "first few" -- default = 1; user may redefine it).
1389 .nr sh*minvs \\n[HORPHANS]v
1390 .if \\n[sh*psincr]<0 .nr sh*psincr 0
1391 .ie \\n(VS<1000 .par*vs \\n(VSp+\\n[sh*psincr]u
1392 .el .par*vs \\n(VSp/1000u+\\n[sh*psincr]u
1393 .ne 2v+\\n[sh*minvs]u+\\n[\\n[.ev]:PD]u+\\n(.Vu
1394 .\" Adjust point size for heading text, as specified by \n[GROWPS] and \n[PSINCR].
1395 .ie \\n(PS<1000 .ps \\n(PS+\\n[sh*psincr]u
1396 .el .ps \\n(PSz/1000u+\\n[sh*psincr]u
1401 .\" Standard ms implementation does not expect an argument,
1402 .\" but allow ".SH n" to make heading point size match ".NH n",
1403 .\" for same "n", when \n[GROWPS] and \n[PSINCR] are set.
1405 . if 0\\$1>0 .nr sh*psincr (\\n[GROWPS]-0\\$1)*\\n[PSINCR]
1408 . if '\*(.T'html' .nr need_eo_h 1
1410 .\" TL, AU, and AI are aliased to these in cov*ab-init.
1432 .\" In paragraph macros.
1434 .ie (\\n[\\n[.ev]:PS] >= 1000) \
1435 . ps (\\n[\\n[.ev]:PS]z / 1000u)
1437 . ps \\n[\\n[.ev]:PS]
1448 .\" par*define-font-macro macro font
1449 .de par*define-font-macro
1452 . nr par*prev-font \\\\n[.f]
1453 \&\\\\$3\f[\\$2]\\\\$1\f[\\\\n[par*prev-font]]\\\\$2
1458 .par*define-font-macro B B
1459 .par*define-font-macro I I
1460 .par*define-font-macro BI BI
1461 .par*define-font-macro CW CR
1462 .\" underline a word
1464 \Z'\\$1'\v'.25m'\D'l \w'\\$1'u 0'\v'-.25m'\\$2
1468 .nr par*bxw \w'\\$1'+.4m
1469 \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''\
1473 .\" The first time UX is used, put a registered mark after it.
1476 \s[\\n[.s]*8u/10u]UNIX\s0\\$1\\*[par*ux-rg]
1479 .ds par@sup-start \v'-.9m\s'\En[.s]*7u/10u'+.7m'
1480 .als { par@sup-start
1481 .ds par@sup-end \v'-.7m\s0+.9m'
1483 .\" footnote paragraphs
1484 .\" FF is the footnote format
1486 .\" This can be redefined. It gets a second argument of `no' if the first
1487 .\" argument was supplied by the user, rather than automatically.
1490 .if !d par*fp!\\n[FF] \{\
1491 . @error unknown footnote format `\\n[FF]'
1494 .ie '\\$2'no' .par*fp!\\n[FF]-no "\\$1"
1495 .el .par*fp!\\n[FF] "\\$1"
1499 \&\\*[par@sup-start]\\$1\\*[par@sup-end]\ \c
1522 .@IP "\\$1." (u;\\n[\\n[.ev]:PI]*2)
1525 .@IP "\\$1" (u;\\n[\\n[.ev]:PI]*2)
1527 .\" ***************************
1528 .\" ******** module nh ********
1529 .\" ***************************
1530 .\" Numbered headings.
1531 .\" nh*hl is the level of the last heading
1533 .\" numbered heading
1540 . nr H\\n[nh*hl] 0\\$1
1543 . if !\\n[nh*hl] \{\
1546 . @error missing arguments to .NH S
1550 . nr nh*ohl \\n[nh*hl]
1553 . ie \\n[nh*hl]<=0 \{\
1558 . if \\n[nh*hl]-\\n[nh*ohl]>1 \
1559 . @warning .NH \\n[nh*ohl] followed by .NH \\n[nh*hl]
1563 . while \\n[nh*hl]>\\n[nh*ohl] \{\
1569 .ds SN-NO-DOT \\n(H1
1571 .while \\n[nh*i]<\\n[nh*hl] \{\
1573 . as SN-NO-DOT .\\n[H\\n[nh*i]]
1575 .ds SN-DOT \\*[SN-NO-DOT].
1576 .if !dSN .als SN SN-DOT
1577 .nr sh*psincr (\\n[GROWPS]-\\n[nh*hl])*\\n[PSINCR]
1580 . if '\*(.T'html' .nr need_eo_h 1
1583 .\" ****************************
1584 .\" ******** module toc ********
1585 .\" ****************************
1586 .\" Table of contents generation.
1590 .ie \\n[.$] .XA "\\$1"
1593 .de @div-end!toc*div
1597 .ie '\\n(.z'toc*div' \{\
1598 . if d toc*num .toc*end-entry
1600 . ie '\\$1'no' .ds toc*num
1601 . el .ds toc*num "\\$1
1603 . el .ds toc*num \\n[PN]
1610 .el .@error XA without XS
1613 .ie '\\n(.z'toc*div' \{\
1614 . if d toc*num .toc*end-entry
1618 .el .@error XE without XS
1629 . ie (\\n[PS] >= 1000) \
1630 . ps ((\\n[PS]z / 1000u) + 2z)
1639 .char \[toc*leader-char] .\h'1m'
1640 .lc \[toc*leader-char]
1641 .ta (u;\\n[.l]-\\n[.i]-\w'000') (u;\\n[.l]-\\n[.i])R
1646 .\" print the table of contents on page i
1652 .\" ****************************
1653 .\" ******** module eqn ********
1654 .\" ****************************
1663 .ie '\\$1'L' .nr eqn*type 0
1665 . ie '\\$1'I' .nr eqn*type 1
1668 . if !'\\$1'C' .ds eqn*num "\\$1
1673 .if \\n[eqn*type]=0 .HTML-IMAGE-LEFT
1674 .if \\n[eqn*type]=1 \{\
1675 . if '\*(.T'html' .RS
1678 .if \\n[eqn*type]=2 .HTML-IMAGE
1681 .de @div-end!eqn*div
1684 .\" Note that geqn mark and lineup work correctly in centered equations.
1686 .ie !'\\n(.z'eqn*div' .@error-recover mismatched EN
1691 . if !'\\*[eqn*num]'' .nr eqn*have-num 1
1692 . ie \\n[dl]:\\n[eqn*have-num] \{\
1695 . ds eqn*tabs \\n[.tabs]
1698 .\" --fixme-- this really should not be necessary
1699 .\" and indicates that there is extra space creeping into
1700 .\" an equation when ps4html is enabled..
1701 . ie r ps4html .ds@need \\n[dn]u-1v+\n[.V]u+1i
1702 . el .ds@need \\n[dn]u-1v+\n[.V]u
1704 . ie \\n[eqn*type]=0 \{\
1705 . ta (u;\\n[.l]-\\n[.i])R
1706 \\*[eqn*div]\t\\*[eqn*num]
1709 . ie \\n[eqn*type]=1 .ta \\n[DI]u \
1710 (u;\\n[.l]-\\n[.i])R
1711 . el .ta (u;\\n[.l]-\\n[.i]/2)C \
1712 (u;\\n[.l]-\\n[.i])R
1713 \t\\*[eqn*div]\t\\*[eqn*num]
1717 . ta (u;\\n[.l]-\\n[.i])R
1720 .\". if !'\*(.T'html' .sp \\n[DD]u
1725 .\" must terminate empty equations in html and ps4html as they contain
1726 .\" the HTML-IMAGE-END suppression nodes
1727 . if \\n[dl] .chop eqn*div
1728 . if '\*(.T'html' \\*[eqn*div]
1729 . if r ps4html \\*[eqn*div]
1731 . if !'\*(.T'html' .fi
1732 . if \\n[eqn*type]=0 .HTML-IMAGE-END
1733 . if \\n[eqn*type]=1 \{\
1735 . if '\*(.T'html' .RE
1737 . if \\n[eqn*type]=2 .HTML-IMAGE-END
1740 .\" ****************************
1741 .\" ******** module tbl ********
1742 .\" ****************************
1744 .nr tbl*have-header 0
1745 .\" This gets called if TS occurs before the first paragraph.
1748 .\" cov*ab-init aliases TS to @TS
1753 .if '\\$1'H' .di tbl*header-div
1757 .if \\n[tbl*have-header] \{\
1758 . ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl*print-header
1762 .de tbl*print-header
1769 .ie '\\n[.z]'tbl*header-div' \{\
1774 . ie \\n[dn]+\\n[FM]+\\n[HM]+2v>=\\n[.p] \{\
1775 . @error ridiculously long table header
1780 . nr tbl*header-ht \\n[dn]
1781 . ds@need \\n[dn]u+1v
1783 . nr tbl*have-header 1
1786 .el .@error-recover .TH without .TS H
1788 .de @div-end!tbl*header-div
1793 .ie '\\n(.z'tbl*header-div' .@error-recover .TS H but no .TH before .TE
1795 . nr tbl*have-header 0
1796 . if !'\*(.T'html' .sp \\n[DD]u
1803 .if \\n[tbl*have-header] \{\
1810 .\" ****************************
1811 .\" ******** module pic ********
1812 .\" ****************************
1818 .ie \\n[.$]<2 .@error bad arguments to PS (not preprocessed with pic?)
1820 . ds@need (u;\\$1)+1v
1821 . in +(u;\\n[.l]-\\n[.i]-\\$2/2>?0)
1830 .\" ****************************
1831 .\" ******** module ref ********
1832 .\" ****************************
1835 .rm [A [B [C [D [E [G [I [J [N [O [P [Q [R [S [T [V
1839 .ds ref*spec!0 Q A T1 S V N P I C D O
1841 .ds ref*spec!1 Q A T2 J S V N P I C D O
1843 .ds ref*spec!2 Q A T1 S V P I C D O
1844 .\" Article within book
1845 .ds ref*spec!3 Q A T2 B E S V P I C D O
1847 .ds ref*spec!4 Q A T2 R G P I C D O
1854 .ie d ref*spec!\\$1 .ref*build \\*[ref*spec!\\$1]
1856 . @error unknown reference type `\\$1'
1857 . ref*build \\*[ref*spec!0]
1863 .\" start of reference number
1864 .ds [. \\*[par@sup-start]
1865 .\" end of reference number
1866 .ds .] \\*[par@sup-end]
1867 .\" period before reference
1869 .\" period after reference
1871 .\" comma before reference
1873 .\" comma after reference
1875 .\" start collected references
1877 .als ref*print ref*end-print
1882 .\" end collected references
1885 .als ref*print ref*normal-print
1887 .de ref*normal-print
1888 .ie d [F .FS "\\*([.\\*([F\\*(.]"
1894 .ie d [F .IP "\\*([F."
1898 .als ref*print ref*normal-print
1900 .rm ref*string ref*post-punct
1901 .nr ref*suppress-period 1
1904 . ie d ref*add-\\$1 .ref*add-\\$1
1905 . el .ref*add-dflt \\$1
1909 .\" now add a final period
1910 .ie d ref*string \{\
1911 . if !\\n[ref*suppress-period] .as ref*string .
1912 . if d ref*post-punct \{\
1913 . as ref*string "\\*[ref*post-punct]
1920 .ref*field T , "\fI" "" "\fP"
1921 .if r [T .nr ref*suppress-period \\n([T
1924 .ref*field T , "\\*Q" "" "\\*U"
1925 .if r [T .nr ref*suppress-period \\n([T
1928 .ie \\n([P>0 .ref*field P , "pp. "
1929 .el .ref*field P , "p. "
1932 .ref*field J , \fI "" \fP
1938 .ref*field E , "ed. "
1944 .ref*field B "" "in \fI" "" \fP
1948 .ie r [O .nr ref*suppress-period \\n([O
1949 .el .nr ref*suppress-period 1
1953 .if r [A .nr ref*suppress-period \\n([A
1956 .ref*field V "" \fB \fR
1959 .ref*field N \z( "" ")"
1964 .\" First argument is the field letter.
1965 .\" Second argument is the punctuation character to use to separate this field
1966 .\" from the previous field.
1967 .\" Third argument is a string with which to prefix this field.
1968 .\" Fourth argument is a string with which to postfix this field.
1969 .\" Fifth argument is a string to add after the punctuation character supplied
1970 .\" by the next field.
1972 .if d ref*string \{\
1973 . ie d ref*post-punct \{\
1974 . as ref*string "\\$2\\*[ref*post-punct] \"
1977 . el .as ref*string "\\$2 \"
1979 .as ref*string "\\$3\\*([\\$1\\$4
1980 .if \\n[.$]>4 .ds ref*post-punct "\\$5
1981 .nr ref*suppress-period 0
1983 .\" ****************************
1984 .\" ******** module acc ********
1985 .\" ****************************
1986 .\" Accents and special characters.
1991 .\" The idea of this definition is for the top of the 3 to be at the x-height.
1992 .if !c\[yogh] .char \[yogh] \Z'\v'\w'x'*0-\En[rst]u'\s[\En[.s]*8u/10u]\
1993 \v'\w'3'*0+\En[rst]u'3\s0'\h'\w'\s[\En[.s]*8u/10u]3'u'
1996 .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
1997 \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
2000 .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
2003 .ds \\$1 \Z'\h'(u;-\En[.w]-\w'\\$2'/2)'\
2004 \v'(u;\En[.cdp]-\En[.cht]+\En[rst]+\En[rsb]/2)'\\$2'
2007 .ds \\$1 \Z'\h'(u;\w'x'-\w'\\$2'/2)'\\$2'
2009 .acc*prefix-def ' \'
2010 .acc*prefix-def ` \`
2012 .acc*prefix-def , \(ac
2013 .acc*prefix-def : \(ad
2015 .\" improved accent marks
2021 .acc*over-def : \(ad
2022 .acc*over-def v \(ah
2023 .acc*over-def _ \(a-
2024 .acc*over-def o \(ao
2025 .acc*under-def , \(ac
2026 .acc*under-def . \s[\En[.s]*8u/10u]\v'.2m'.\v'-.2m'\s0
2027 .acc*under-def hook \(ho
2029 .char \[hooko] o\\\\*[hook]
2032 .ds D- \(-D\" Icelandic uppercase eth
2033 .ds d- \(Sd\" Icelandic lowercase eth
2034 .ds Th \(TP\" Icelandic uppercase thorn
2035 .ds th \(Tp\" Icelandic lowercase thorn
2036 .ds 8 \(ss\" German double s
2037 .ds Ae \(AE\" AE ligature
2038 .ds ae \(ae\" ae ligature
2039 .ds Oe \(OE\" OE ligature
2040 .ds oe \(oe\" oe ligature
2041 .ds ? \(r?\" upside down ?
2042 .ds ! \(r!\" upside down !
2044 .de CHECK-FOOTER-AND-KEEP
2045 .\" it might be better to als FS -> B1 and FE -> B2
2046 .\" however this produced wierd results, so I've moved back to a more reliable
2047 .\" but less interesting solution --fixme--
2048 . if '\*(.T'html' \{\
2076 .\" Make sure that no blank lines creep in at the end of this file.