Imported Upstream version 1.22.4
[platform/upstream/groff.git] / tmac / s.tmac
1 .ig
2
3 s.tmac
4
5 Copyright (C) 1989-2018 Free Software Foundation, Inc.
6      Written by James Clark (jjc@jclark.com)
7
8 This file is part of groff.
9
10 groff is free software; you can redistribute it and/or modify it under
11 the terms of the GNU General Public License as published by the Free
12 Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14
15 groff is distributed in the hope that it will be useful, but WITHOUT ANY
16 WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
18 for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program.  If not, see <http://www.gnu.org/licenses/>.
22 ..
23 .if !\n(.g .ab These ms macros require groff.
24 .if \n(.C \
25 .       ab The groff ms macros do not work in compatibility mode.
26 .\" Enable warnings (only if none are given on the command line).
27 .\" You can delete this if you want.
28 .if (\n[.warn] == 65543) .warn
29 .\" See if already loaded.
30 .if r GS .nx
31 .mso devtag.tmac
32 .nr GS 1
33 .nr need_eo_h 0
34 .nr need_eo_tl 0
35 .de @error
36 .tm \\n(.F:\\n(.c: macro error: \\$*
37 ..
38 .de @warning
39 .tm \\n(.F:\\n(.c: macro warning: \\$*
40 ..
41 .de @fatal
42 .ab \\n(.F:\\n(.c: fatal macro error: \\$*
43 ..
44 .de @not-implemented
45 .@error sorry, \\$0 not implemented
46 .als \\$0 @nop
47 ..
48 .als TM @not-implemented
49 .als CT @not-implemented
50 .de @nop
51 ..
52 .de @init
53 .if !rPO .nr PO \\n(.o
54 .\" a non-empty environment
55 .ev ne
56 \c
57 .ev
58 .ev nf
59 'nf
60 .ev
61 ..
62 .ds REFERENCES References
63 .ds ABSTRACT ABSTRACT
64 .ds TOC Table of Contents
65 .ds MONTH1 January
66 .ds MONTH2 February
67 .ds MONTH3 March
68 .ds MONTH4 April
69 .ds MONTH5 May
70 .ds MONTH6 June
71 .ds MONTH7 July
72 .ds MONTH8 August
73 .ds MONTH9 September
74 .ds MONTH10 October
75 .ds MONTH11 November
76 .ds MONTH12 December
77 .ds MO \E*[MONTH\n[mo]]
78 .ds DY \n[dy] \*[MO] \n[year]
79 .de ND
80 .if \\n[.$] .ds DY "\\$*
81 ..
82 .de DA
83 .if \\n[.$] .ds DY "\\$*
84 .ds CF \\*[DY]
85 ..
86 .\" indexing
87 .de IX
88 .tm \\$1\t\\$2\t\\$3\t\\$4 ... \\n[PN]
89 ..
90 .\" print an error message and then try to recover
91 .de @error-recover
92 .@error \\$@ (recovering)
93 .nr *pop-count 0
94 .while !'\\n(.z'' \{\
95 .       \"@warning automatically terminating diversion \\n(.z
96 .       ie d @div-end!\\n(.z .@div-end!\\n(.z
97 .       el .*div-end-default
98 .       nr *pop-count +1
99 .       \" ensure that we don't loop forever
100 .       if \\n[*pop-count]>20 .@fatal recovery failed
101 .\}
102 .while !'\\n[.ev]'0' .ev
103 .par@reset-env
104 .par@reset
105 ..
106 .de *div-end-default
107 .ds *last-div \\n(.z
108 .br
109 .di
110 .ev nf
111 .\\*[*last-div]
112 .ev
113 ..
114 .\" ****************************
115 .\" ******** module cov ********
116 .\" ****************************
117 .\" Cover sheet and first page.
118 .de cov*err-not-after-first-page
119 .@error \\$0 is not allowed after the first page has started
120 ..
121 .de cov*err-not-before-tl
122 .@error \\$0 is not allowed before TL
123 ..
124 .de cov*err-not-again
125 .@error \\$0 is not allowed more than once
126 ..
127 .de cov*err-not-after-ab
128 .@error \\$0 is not allowed after first AB, LP, PP, IP, SH or NH
129 ..
130 .als AU cov*err-not-before-tl
131 .als AI cov*err-not-before-tl
132 .als AB cov*err-not-before-tl
133 .de cov*first-page-init
134 .\" Invoked by '.wh 0' trap on first page.
135 .\" We should not come here again, but at short page length,
136 .\" recursion may occur; remove trap and macro to avoid it.
137 .ch cov*first-page-init
138 .rm cov*first-page-init
139 .if !'\\n[.ev]'0' \{\
140 .       @error must be in top-level environment, not '\\n[.ev]',
141 .       @error when first page is started
142 .\}
143 .par@init
144 .als RP cov*err-not-after-first-page
145 .@init
146 .ie \\n[cov*rp-format] \{\
147 .       pg@cs-top
148 .       als FS cov*FS
149 .       als FE cov*FE
150 .\}
151 .el \{\
152 .       pg@top
153 .       als FS @FS
154 .       als FE @FE
155 .\}
156 .wh 0 pg@top
157 .CHECK-FOOTER-AND-KEEP
158 ..
159 .wh 0 cov*first-page-init
160 .\" This handles the case where FS occurs before TL or LP.
161 .de FS
162 .br
163 \\*[FS]\\
164 ..
165 .nr cov*rp-format 0
166 .nr cov*rp-no 0
167 .\" released paper format
168 .de RP
169 .nr cov*rp-format 1
170 .if \\n[.$] .if '\\$1'no' .nr cov*rp-no 1
171 .if rPO .po \\n(POu
172 .pn 0
173 ..
174 .de TL
175 .br
176 .als TL cov*err-not-again
177 .rn @AB AB
178 .rn @AU AU
179 .rn @AI AI
180 .di cov*tl-div
181 .par@reset
182 .ft B
183 .ps +2
184 .vs +3p
185 .ll (u;\\n[LL]*5/6)
186 .nr cov*n-au 0
187 .DEVTAG-TL
188 ..
189 .de @AU
190 .par@reset
191 .if !'\\n(.z'' \{\
192 .       br
193 .       di
194 .\}
195 .nr cov*n-au +1
196 .di cov*au-div!\\n[cov*n-au]
197 .nf
198 .ft I
199 .ie (\\n[PS] >= 1000) \
200 .       ps (\\n[PS]z / 1000u)
201 .el \
202 .       ps \\n[PS]
203 ..
204 .de @AI
205 .par@reset
206 .if !'\\n(.z'' \{\
207 .       br
208 .       di
209 .\}
210 .ie !\\n[cov*n-au] .@error AI before AU
211 .el \{\
212 .       di cov*ai-div!\\n[cov*n-au]
213 .       nf
214 .       ft R
215 .       ie (\\n[PS] >= 1000) \
216 .               ps (\\n[PS]z / 1000u)
217 .       el \
218 .               ps \\n[PS]
219 .\}
220 ..
221 .
222 .de LP
223 .if !'\\n[.z]'' \{\
224 .       br
225 .       di
226 .\}
227 .br
228 .cov*ab-init
229 .cov*print
230 .nop \\*[\\$0]\\
231 ..
232 .
233 .als IP LP
234 .als PP LP
235 .als XP LP
236 .als QP LP
237 .als RS LP
238 .als NH LP
239 .als SH LP
240 .als MC LP
241 .als RT LP
242 .als XS LP
243 .
244 .de cov*ab-init
245 .als cov*ab-init @nop
246 .als LP @LP
247 .als IP @IP
248 .als PP @PP
249 .als XP @XP
250 .als RT @RT
251 .als XS @XS
252 .als SH @SH
253 .als NH @NH
254 .als QP @QP
255 .als RS @RS
256 .als RE @RE
257 .als QS @QS
258 .als QE @QE
259 .als MC @MC
260 .als EQ @EQ
261 .als EN @EN
262 .als TS @TS
263 .als AB cov*err-not-after-ab
264 .als AU par@AU
265 .als AI par@AI
266 .als TL par@TL
267 ..
268 .
269 .de @AB
270 .if !'\\n(.z'' \{\
271 .       br
272 .       di
273 .\}
274 .cov*ab-init
275 .ie '\*(.T'html' \{\
276 .       cov*tl-au-print
277 .       als cov*tl-au-print @nop
278 .\}
279 .el .di cov*ab-div
280 .par@ab-indent
281 .par@reset
282 .if !'\\$1'no' \{\
283 .       if '\*(.T'html'  \{\
284 .               nf
285 .               sp
286 .       \}
287 .       ft I
288 .       ce 1
289 \\*[ABSTRACT]
290 .       sp
291 .       ft R
292 .\}
293 .ns
294 .@PP
295 .if '\*(.T'html' \{\
296 .       cov*tl-au-print
297 .       als cov*tl-au-print @nop
298 .       par@reset-env
299 .       par@reset
300 .       cov*print
301 .\}
302 ..
303 .de AE
304 .ie '\*(.T'html' \{\
305 .       als AE cov*err-not-again
306 .\}
307 .el \{\
308 .  ie '\\n(.z'cov*ab-div' \{\
309 .       als AE cov*err-not-again
310 .       br
311 .       di
312 .\"     nr cov*ab-height \\n[dn]
313 .       par@reset-env
314 .       par@reset
315 .       cov*print
316 .  \}
317 .  el .@error AE without AB
318 .\}
319 ..
320 .de @div-end!cov*ab-div
321 .AE
322 ..
323 .de cov*print
324 .als cov*print @nop
325 .ie d cov*tl-div \{\
326 .       ie \\n[cov*rp-format] .cov*rp-print
327 .       el .cov*draft-print
328 .\}
329 .el \{\
330 .       if \\n[cov*rp-format] \{\
331 .               @warning RP format but no TL
332 .               bp 1
333 .               als FS @FS
334 .               als FE @FE
335 .               CHECK-FOOTER-AND-KEEP
336 .       \}
337 .       br
338 .\}
339 ..
340 .de cov*rp-print
341 .nr cov*page-length \\n[.p]
342 .pl 1000i
343 .cov*tl-au-print
344 .sp 3
345 .if d cov*ab-div \{\
346 .  if !'\*(.T'html'  .nf
347 .       cov*ab-div
348 .\}
349 .sp 3
350 .par@reset
351 \\*[DY]
352 .br
353 .if \\n[cov*fn-height] \{\
354 .       sp |(u;\\n[cov*page-length]-\\n[FM]\
355 -\\n[cov*fn-height]-\\n[fn@sep-dist]>?\\n[nl])
356 .       fn@print-sep
357 .       ev nf
358 .       cov*fn-div
359 .       ev
360 .       ie \\n[cov*rp-no] .rm cov*fn-div
361 .       el \{\
362 .               rn cov*fn-div fn@overflow-div
363 .               nr fn@have-overflow 1
364 .       \}
365 .\}
366 .als FS @FS
367 .als FE @FE
368 .CHECK-FOOTER-AND-KEEP
369 .\" If anything was printed below where the footer line is normally
370 .\" printed, then that's an overflow.
371 .if -\\n[FM]/2+1v+\\n[cov*page-length]<\\n[nl] .@error cover sheet overflow
372 .pl \\n[cov*page-length]u
373 .bp 1
374 .if !\\n[cov*rp-no] .cov*tl-au-print
375 .rs
376 .sp 1
377 ..
378 .de cov*draft-print
379 .cov*tl-au-print
380 .if d cov*ab-div \{\
381 .       nf
382 .       sp 2
383 .       cov*ab-div
384 .\}
385 .sp 1
386 ..
387 .de cov*tl-au-print
388 .par@reset
389 .nf
390 .rs
391 .sp 3
392 .ce 9999
393 .if d cov*tl-div \{\
394 .    cov*tl-div
395 .    DEVTAG-EO-TL
396 .\}
397 .nr cov*i 1
398 .nr cov*sp 1v
399 .while \\n[cov*i]<=\\n[cov*n-au] \{\
400 .       ie '\*(.T'html' .br
401 .       el .sp \\n[cov*sp]u
402 .       cov*au-div!\\n[cov*i]
403 .       ie d cov*ai-div!\\n[cov*i] \{\
404 .               sp .5v  
405 .               cov*ai-div!\\n[cov*i]
406 .               nr cov*sp 1v
407 .       \}
408 .       el .nr cov*sp .5v
409 .       nr cov*i +1
410 .\}
411 .ce 0
412 ..
413 .nr cov*fn-height 0
414 .nr cov*in-fn 0
415 .\" start of footnote on cover
416 .de cov*FS
417 .if \\n[cov*in-fn] \{\
418 .       @error nested FS
419 .       FE
420 .\}
421 .nr cov*in-fn 1
422 .ev fn
423 .par@reset-env
424 .da cov*fn-div
425 .if !\\n[cov*fn-height] .ns
426 .ie \\n[.$] .FP "\\$1" no
427 .el .@LP
428 ..
429 .de @div-end!cov*fn-div
430 .cov*FE
431 ..
432 .\" end of footnote on cover
433 .de cov*FE
434 .ie '\\n(.z'cov*fn-div' \{\
435 .       br
436 .       ev
437 .       di
438 .       nr cov*in-fn 0
439 .       nr cov*fn-height +\\n[dn]
440 .\}
441 .el .@error FE without matching FS
442 ..
443 .\" ***************************
444 .\" ******** module pg ********
445 .\" ***************************
446 .\" Page-level formatting.
447 .\" > 0 if we have a footnote on the current page
448 .nr pg@fn-flag 0
449 .nr pg@colw 0
450 .nr pg@fn-colw 0
451 .nr HM 1i
452 .nr FM 1i
453 .ds LF
454 .ds CF
455 .ds RF
456 .ds LH
457 .ds CH -\En[PN]-
458 .ds RH
459 .ds pg*OH '\E*[LH]'\E*[CH]'\E*[RH]'
460 .ds pg*EH '\E*[LH]'\E*[CH]'\E*[RH]'
461 .ds pg*OF '\E*[LF]'\E*[CF]'\E*[RF]'
462 .ds pg*EF '\E*[LF]'\E*[CF]'\E*[RF]'
463 .de OH
464 .ds pg*\\$0 "\\$*
465 ..
466 .als EH OH
467 .als OF OH
468 .als EF OH
469 .de PT
470 .ie \\n%=1 .if \\n[pg*P1] .tl \\*[pg*OH]
471 .el \{\
472 .       ie o .tl \\*[pg*OH]
473 .       el .tl \\*[pg*EH]
474 .\}
475 ..
476 .de BT
477 .ie o .tl \\*[pg*OF]
478 .el .tl \\*[pg*EF]
479 ..
480 .nr pg*P1 0
481 .de P1
482 .ie r bell_localisms \{\
483 .       DS L
484 .       ft CW
485 .\}
486 .el .nr pg*P1 1
487 ..
488 .wh -\n[FM]u pg@bottom
489 .wh -\n[FM]u/2u pg*footer
490 .nr MINGW 2n
491 .nr pg@ncols 1
492 .de @MC
493 .if !'\\n(.z'' .error-recover MC while diversion open
494 .br
495 .ie \\n[pg@ncols]>1 .pg@super-eject
496 .el \{\
497 .       \" flush out any floating keeps
498 .       while \\n[kp@tail]>\\n[kp@head] \{\
499 .               rs
500 .               bp
501 .       \}
502 .\}
503 .ie !\\n(.$ \{\
504 .       nr pg@colw \\n[LL]*7/15
505 .       nr pg*gutw \\n[LL]-(2*\\n[pg@colw])
506 .       nr pg@ncols 2
507 .\}
508 .el \{\
509 .       nr pg@colw (n;\\$1)<?\\n[LL]
510 .       ie \\n[.$]<2 .nr pg*gutw \\n[MINGW]
511 .       el .nr pg*gutw (n;\\$2)
512 .       nr pg@ncols \\n[LL]-\\n[pg@colw]/(\\n[pg@colw]+\\n[pg*gutw])+1
513 .       ie \\n[pg@ncols]>1 \
514 .               nr pg*gutw \\n[LL]-(\\n[pg@ncols]*\\n[pg@colw])/(\\n[pg@ncols]-1)
515 .       el .nr pg*gutw 0
516 .\}
517 .DEVTAG ".mc \\n[pg@ncols] \\n[pg@colw] \\n[pg*gutw]"
518 .ns
519 .nr pg*col-num 0
520 .nr pg@fn-colw \\n[pg@colw]*5/6
521 .par@reset
522 .mk pg*col-top
523 ..
524 .de 2C
525 .MC
526 ..
527 .de 1C
528 .MC \\n[LL]u
529 ..
530 .\" top of page macro
531 .de pg@top
532 .ch pg*footer -\\n[FM]u/2u
533 .nr PN \\n%
534 .nr pg*col-num 0
535 .nr pg@fn-bottom-margin 0
536 .po \\n[PO]u
537 .ev h
538 .par@reset
539 .sp (u;\\n[HM]/2)
540 .PT
541 .sp |\\n[HM]u
542 .if d HD .HD
543 .mk pg@header-bottom
544 .ev
545 .mk pg*col-top
546 .pg*start-col
547 ..
548 .de pg*start-col
549 .\" Handle footnote overflow before floating keeps, because the keep
550 .\" might contain an embedded footnote.
551 .fn@top-hook
552 .kp@top-hook
553 .tbl@top-hook
554 .ns
555 ..
556 .de pg@cs-top
557 .sp \\n[HM]u
558 .\" move pg@bottom and pg*footer out of the way
559 .ch pg@bottom \\n[.p]u*2u
560 .ch pg*footer \\n[.p]u*2u
561 .ns
562 ..
563 .de pg@bottom
564 .tbl@bottom-hook
565 .if \\n[pg@fn-flag] .fn@bottom-hook
566 .nr pg*col-num +1
567 .ie \\n[pg*col-num]<\\n[pg@ncols] .pg*end-col
568 .el .pg*end-page
569 ..
570 .de pg*end-col
571 'sp |\\n[pg*col-top]u
572 .po (u;\\n[PO]+(\\n[pg@colw]+\\n[pg*gutw]*\\n[pg*col-num]))
573 .\"po +(u;\\n[pg@colw]+\\n[pg*gutw])
574 .pg*start-col
575 ..
576 .de pg*end-page
577 .po \\n[PO]u
578 .\" Make sure we don't exit if there are still floats or footnotes
579 .\" left-over.
580 .ie \\n[kp@head]<\\n[kp@tail]:\\n[fn@have-overflow] \{\
581 .       \" Switching environments ensures that we don't get an unnecessary
582 .       \" blank line at the top of the page.
583 .       ev ne
584 '       bp
585 .       ev
586 .\}
587 .el \{\
588 .       \" If the text has ended and there are no more footnotes or
589 .       \" keeps, exit.
590 .       if \\n[pg@text-ended] .ex
591 .       if r pg*next-number \{\
592 .               pn \\n[pg*next-number]
593 .               rr pg*next-number
594 .               if d pg*next-format \{\
595 .                       af PN \\*[pg*next-format]
596 .                       rm pg*next-format
597 .               \}
598 .       \}
599 '       bp
600 .\}
601 ..
602 .\" pg@begin number format
603 .de pg@begin
604 .ie \\n[.$]>0 \{\
605 .       nr pg*next-number (;\\$1)
606 .       ie \\n[.$]>1 .ds pg*next-format \\$2
607 .       el .rm pg*next-format
608 .\}
609 .el .rr pg*next-number
610 .pg@super-eject
611 ..
612 .\" print the footer line
613 .de pg*footer
614 .ev h
615 .par@reset
616 .BT
617 .ev
618 ..
619 .\" flush out any keeps or footnotes
620 .de pg@super-eject
621 .br
622 .if !'\\n(.z'' .@error-recover diversion open while ejecting page
623 .\" Make sure we stay in the end macro while there is still footnote
624 .\" overflow left, or floating keeps.
625 .while \\n[kp@tail]>\\n[kp@head]:\\n[pg@fn-flag] \{\
626 .       rs
627 .       bp
628 .\}
629 .bp
630 ..
631 .nr pg@text-ended 0
632 .de pg@end-text
633 .br
634 .nr pg@text-ended 1
635 .pg@super-eject
636 ..
637 .em pg@end-text
638 .\" ***************************
639 .\" ******** module fn ********
640 .\" ***************************
641 .\" Footnotes.
642 .nr fn@sep-dist 8p
643 .ev fn
644 .\" Round it vertically
645 .vs \n[fn@sep-dist]u
646 .nr fn@sep-dist \n[.v]
647 .ev
648 .nr fn*text-num 0 1
649 .nr fn*note-num 0 1
650 .ds * \E*[par@sup-start]\En+[fn*text-num]\E*[par@sup-end]
651 .nr fn*open 0
652 .\" normal FS
653 .de @FS
654 .ie \\n[.$] .fn*do-FS "\\$1" no
655 .el \{\
656 .       ie \\n[fn*text-num]>\\n[fn*note-num] .fn*do-FS \\n+[fn*note-num]
657 .       el .fn*do-FS
658 .\}
659 ..
660 .\" Second argument of 'no' means don't embellish the first argument.
661 .de fn*do-FS
662 .if \\n[fn*open] .@error-recover nested FS
663 .nr fn*open 1
664 .if \\n[.u] \{\
665 .       \" Ensure that the first line of the footnote is on the same page
666 .       \" as the reference.  I think this is minimal.
667 .       ev fn
668 .       nr fn*need 1v
669 .       ev
670 .       ie \\n[pg@fn-flag] .nr fn*need +\\n[fn:PD]
671 .       el .nr fn*need +\\n[fn@sep-dist]
672 .       ne \\n[fn*need]u+\\n[.V]u>?0
673 .\}
674 .ev fn
675 .par@reset-env
676 .fn*start-div
677 .par@reset
678 .ie \\n[.$] .FP \\$@
679 .el .@LP
680 ..
681 .de @FE
682 .ie !\\n[fn*open] .@error FE without FS
683 .el \{\
684 .       nr fn*open 0
685 .       br
686 .       ev
687 .       fn*end-div
688 .\}
689 ..
690 .nr fn@have-overflow 0
691 .\" called at the top of each column
692 .de fn@top-hook
693 .nr fn*max-width 0
694 .nr fn*page-bottom-pos 0-\\n[FM]-\\n[pg@fn-bottom-margin]
695 .ch pg@bottom \\n[fn*page-bottom-pos]u
696 .if \\n[fn@have-overflow] \{\
697 .       nr fn@have-overflow 0
698 .       fn*start-div
699 .       ev nf
700 .       fn@overflow-div
701 .       ev
702 .       fn*end-div
703 .\}
704 ..
705 .\" This is called at the bottom of the column if pg@fn-flag is set.
706 .de fn@bottom-hook
707 .nr pg@fn-flag 0
708 .nr fn@have-overflow 0
709 .nr fn@bottom-pos \\n[.p]-\\n[FM]-\\n[pg@fn-bottom-margin]+\\n[.v]
710 .ev fn
711 .nr fn@bottom-pos -\\n[.v]
712 .ev
713 .ie \\n[nl]+\\n[fn@sep-dist]+\n[.V]>\\n[fn@bottom-pos] \{\
714 .       rn fn@div fn@overflow-div
715 .       nr fn@have-overflow 1
716 .\}
717 .el \{\
718 .       if \\n[pg@ncols]>1 \
719 .               if \\n[fn*max-width]>\\n[pg@fn-colw] \
720 .                       nr pg@fn-bottom-margin \\n[.p]-\\n[FM]-\\n[nl]+1v
721 .       wh \\n[fn@bottom-pos]u fn*catch-overflow
722 .       fn@print-sep
723 .       ev nf
724 .       fn@div
725 .       rm fn@div
726 .       ev
727 .       if '\\n(.z'fn@overflow-div' \{\
728 .               di
729 .               nr fn@have-overflow \\n[dn]>0
730 .       \}
731 .       ch fn*catch-overflow
732 .\}
733 ..
734 .de fn*catch-overflow
735 .di fn@overflow-div
736 ..
737 .nr fn*embed-count 0
738 .de @div-end!fn@div
739 .br
740 .if '\\n[.ev]'fn' .ev
741 .fn*end-div
742 .nr fn*open 0
743 ..
744 .als @div-end!fn*embed-div @div-end!fn@div
745 .de fn*start-div
746 .ie '\\n(.z'' \{\
747 .       da fn@div
748 .       if !\\n[pg@fn-flag] .ns
749 .\}
750 .el .di fn*embed-div
751 ..
752 .de fn*end-div
753 .ie '\\n(.z'fn@div' \{\
754 .       di
755 .       nr fn*page-bottom-pos -\\n[dn]
756 .       nr fn*max-width \\n[fn*max-width]>?\\n[dl]
757 .       if !\\n[pg@fn-flag] .nr fn*page-bottom-pos -\\n[fn@sep-dist]
758 .       nr pg@fn-flag 1
759 .       nr fn*page-bottom-pos \\n[nl]-\\n[.p]+\n[.V]>?\\n[fn*page-bottom-pos]
760 .       ch pg@bottom \\n[fn*page-bottom-pos]u
761 .\}
762 .el \{\
763 .       ie '\\n(.z'fn*embed-div' \{\
764 .       di
765 .               rn fn*embed-div fn*embed-div!\\n[fn*embed-count]
766 \!.             fn*embed-start \\n[fn*embed-count]
767 .               rs
768 '               sp (u;\\n[dn]+\\n[fn@sep-dist]+\\n[.V])
769 \!.             fn*embed-end
770 .               nr fn*embed-count +1
771 .       \}
772 .       el \{\
773 .               ev fn
774 .               @error-recover unclosed diversion within footnote
775 .       \}
776 .\}
777 ..
778 .de fn*embed-start
779 .ie '\\n(.z'' \{\
780 .       fn*start-div
781 .       ev nf
782 .       fn*embed-div!\\$1
783 .       rm fn*embed-div!\\$1
784 .       ev
785 .       fn*end-div
786 .       di fn*null
787 .\}
788 .el \{\
789 \!.     fn*embed-start \\$1
790 .       rs
791 .\}
792 ..
793 .de fn*embed-end
794 .ie '\\n(.z'fn*null' \{\
795 .       di
796 .       rm fn*null
797 .\}
798 .el \!.fn*embed-end
799 ..
800 .\" It's important that fn@print-sep use up exactly fn@sep-dist vertical
801 .\" space.
802 .de fn@print-sep
803 .ev fn
804 .in 0
805 .vs \\n[fn@sep-dist]u
806 \D'l 1i 0'
807 .br
808 .ev
809 ..
810 .\" ***************************
811 .\" ******** module kp ********
812 .\" ***************************
813 .\" Keeps.
814 .de KS
815 .br
816 .di kp*div
817 ..
818 .de KF
819 .if !'\\n(.z'' .@error-recover KF while open diversion
820 .di kp*fdiv
821 .ev k
822 .par@reset-env
823 .par@reset
824 ..
825 .de KE
826 .ie '\\n(.z'kp*div' .kp*end
827 .el \{\
828 .       ie '\\n(.z'kp*fdiv' .kp*fend
829 .       el .@error KE without KS or KF
830 .\}
831 ..
832 .de @div-end!kp*div
833 .kp*end
834 ..
835 .de @div-end!kp*fdiv
836 .kp*fend
837 ..
838 .de kp*need
839 .ie '\\n(.z'' .ds@need \\$1
840 .el \!.kp*need \\$1
841 ..
842 .\" end non-floating keep
843 .de kp*end
844 .br
845 .di
846 .kp*need \\n[dn]
847 .ev nf
848 .kp*div
849 .ev
850 .rm kp*div
851 ..
852 .\" Floating keeps.
853 .nr kp@head 0
854 .nr kp@tail 0
855 .\" end floating keep
856 .de kp*fend
857 .br
858 .ev
859 .di
860 .ie \\n[.t]-(\\n[.k]>0*1v)>\\n[dn] \{\
861 .       br
862 .       ev nf
863 .       kp*fdiv
864 .       rm kp*fdiv
865 .       ev
866 .\}
867 .el \{\
868 .       rn kp*fdiv kp*div!\\n[kp@tail]
869 .       nr kp*ht!\\n[kp@tail] 0\\n[dn]
870 .       nr kp@tail +1
871 .\}
872 ..
873 .\" top of page processing for KF
874 .nr kp*doing-top 0
875 .de kp@top-hook
876 .if !\\n[kp*doing-top] \{\
877 .       nr kp*doing-top 1
878 .       kp*do-top
879 .       nr kp*doing-top 0
880 .\}
881 ..
882 .de kp*do-top
883 .\" If the first keep won't fit, only force it out if we haven't had a
884 .\" footnote and we're at the top of the page.
885 .nr kp*force \\n[pg@fn-flag]=0&(\\n[nl]<=\\n[pg@header-bottom])
886 .nr kp*fits 1
887 .while \\n[kp@tail]>\\n[kp@head]&\\n[kp*fits] \{\
888 .       ie \\n[.t]>\\n[kp*ht!\\n[kp@head]]:\\n[kp*force] \{\
889 .               nr kp*force 0
890 .               \" It's important to advance kp@head before bringing
891 .               \" back the keep, so that if the last line of the
892 .               \" last keep springs the bottom of page trap, a new
893 .               \" page will not be started unnecessarily.
894 .               rn kp*div!\\n[kp@head] kp*temp
895 .               nr kp@head +1
896 .               ev nf
897 .               kp*temp
898 .               ev
899 .               rm kp*temp
900 .       \}
901 .       el .nr kp*fits 0
902 .\}
903 ..
904 .\" ***************************
905 .\" ******** module ds ********
906 .\" ***************************
907 .\" Displays and non-floating keeps.
908 .de DE
909 .ds*end!\\n[\\n[.ev]:ds-type]
910 .nr \\n[.ev]:ds-type 0
911 ..
912 .de ds@auto-end
913 .if \\n[\\n[.ev]:ds-type] \{\
914 .       @error automatically terminating display
915 .       DE
916 .\}
917 ..
918 .de @div-end!ds*div
919 .ie \\n[\\n[.ev]:ds-type] .DE
920 .el .ds*end!2
921 ..
922 .de ds*end!0
923 .@error DE without DS, ID, CD, LD or BD
924 ..
925 .de LD
926 .br
927 .nr \\n[.ev]:ds-type 1
928 .par@reset
929 .nf
930 .sp \\n[DD]u
931 ..
932 .de ID
933 .LD
934 .ie \\n[.$] .in +(n;\\$1)
935 .el .in +\\n[DI]u
936 ..
937 .de CD
938 .LD
939 .ce 9999
940 ..
941 .de RD
942 .LD
943 .rj 9999
944 ..
945 .de ds*common-end
946 .par@reset
947 .sp \\n[DD]u
948 ..
949 .als ds*end!1 ds*common-end
950 .de BD
951 .LD
952 .nr \\n[.ev]:ds-type 2
953 .di ds*div
954 ..
955 .de ds*end!2
956 .br
957 .ie '\\n(.z'ds*div' \{\
958 .       di
959 .       nf
960 .       in (u;\\n[.l]-\\n[dl]/2>?0)
961 .       ds*div
962 .       rm ds*div
963 .       ds*common-end
964 .\}
965 .el .@error-recover mismatched DE
966 ..
967 .de DS
968 .br
969 .di ds*div
970 .ie '\\$1'B' \{\
971 .       LD
972 .       nr \\n[.ev]:ds-type 4
973 .\}
974 .el \{\
975 .       ie '\\$1'L' .LD
976 .       el \{\
977 .               ie '\\$1'C' .CD
978 .               el \{\
979 .                       ie '\\$1'R' .RD
980 .                       el \{\
981 .                               ie '\\$1'I' .ID \\$2
982 .                               el .ID \\$1
983 .                       \}
984 .               \}
985 .       \}
986 .       nr \\n[.ev]:ds-type 3
987 .\}
988 ..
989 .de ds@need
990 .if '\\n(.z'' \{\
991 .       while \\n[.t]<=(\\$1)&(\\n[nl]>\\n[pg@header-bottom]) \{\
992 .               rs
993 '               sp \\n[.t]u
994 .       \}
995 .\}
996 ..
997 .de ds*end!3
998 .br
999 .ie '\\n(.z'ds*div' \{\
1000 .       di
1001 .       ds@need \\n[dn]
1002 .       ev nf
1003 .       ds*div
1004 .       ev
1005 .       rm ds*div
1006 .       ds*common-end
1007 .\}
1008 .el .@error-recover mismatched DE
1009 ..
1010 .de ds*end!4
1011 .ie '\\n(.z'ds*div' \{\
1012 .       br
1013 .       di
1014 .       nf
1015 .       in (u;\\n[.l]-\\n[dl]/2>?0)
1016 .       ds@need \\n[dn]
1017 .       ds*div
1018 .       rm ds*div
1019 .       ds*common-end
1020 .\}
1021 .el .@error-recover mismatched DE
1022 ..
1023 .\" ****************************
1024 .\" ******** module par ********
1025 .\" ****************************
1026 .\" Paragraph-level formatting.
1027 .\" Load time initialization.
1028 .de par@load-init
1029 .\" PS and VS might have been set on the command line
1030 .if !rPS .nr PS 10
1031 .if !rLL .nr LL 6i
1032 .ll \\n[LL]u
1033 .\" don't set LT so that it can be defaulted from LL
1034 .ie rLT .lt \\n[LT]u
1035 .el .lt \\n[LL]u
1036 .ie (\\n[PS] >= 1000) \
1037 .       ps (\\n[PS]z / 1000u)
1038 .el \
1039 .       ps \\n[PS]
1040 .\" don't set VS so that it can be defaulted from PS
1041 .ie rVS \{\
1042 .       ie (\\n[VS] >= 1000) \
1043 .               par*vs "(\\n[VS]p / 1000u)"
1044 .       el \
1045 .               par*vs \\n[VS]
1046 .\}
1047 .el \{\
1048 .       ie (\\n[PS] >= 1000) \
1049 .               par*vs "((\\n[PS]p / 1000u) + 2p)"
1050 .       el \
1051 .               par*vs "(\\n[PS] + 2)"
1052 .\}
1053 .if dFAM .fam \\*[FAM]
1054 .if !rHY .nr HY 6
1055 .hy \\n[HY]
1056 .TA
1057 .CHECK-FOOTER-AND-KEEP
1058 ..
1059 .de par*vs
1060 .\" If it's too big to be in points, treat it as units.
1061 .ie (p;\\$1)>=40p .vs (u;\\$1)
1062 .el .vs (p;\\$1)
1063 ..
1064 .de par@ab-indent
1065 .nr 0:li (u;\\n[LL]/12)
1066 .nr 0:ri \\n[0:li]
1067 ..
1068 .de par*env-init
1069 .aln \\n[.ev]:PS PS
1070 .aln \\n[.ev]:VS VS
1071 .aln \\n[.ev]:LL LL
1072 .aln \\n[.ev]:MCLL LL
1073 .aln \\n[.ev]:LT LT
1074 .aln \\n[.ev]:MCLT LT
1075 .aln \\n[.ev]:PI PI
1076 .aln \\n[.ev]:PD PD
1077 .ad \\n[par*adj]
1078 .par@reset-env
1079 ..
1080 .\" happens when the first page begins
1081 .de par@init
1082 .if !rLT .nr LT \\n[LL]
1083 .if !rFL .nr FL \\n[LL]*5/6
1084 .if !rVS \{\
1085 .       ie (\\n[PS] >= 1000) \
1086 .               nr VS (\\n[PS] + 2000)
1087 .       el \
1088 .               nr VS (\\n[PS] + 2)
1089 .\}
1090 .if !rDI .nr DI .5i
1091 .if !rFPS \{\
1092 .       ie (\\n[PS] >= 1000) \
1093 .               nr FPS (\\n[PS] - 2000)
1094 .       el \
1095 .               nr FPS (\\n[PS] - 2)
1096 .\}
1097 .if !rFVS \{\
1098 .       ie (\\n[FPS] >= 1000) \
1099 .               nr FVS (\\n[FPS] + 2000)
1100 .       el \
1101 .               nr FVS (\\n[FPS] + 2)
1102 .\}
1103 .\" don't change environment 0
1104 .ev h
1105 .ie (\\n[PS] >= 1000) \
1106 .       ps (\\n[PS]z / 1000u)
1107 .el \
1108 .       ps \\n[PS]
1109 .if !rQI .nr QI 5n
1110 .if !rPI .nr PI 5n
1111 .ie (\\n[VS] >= 1000) \
1112 .       par*vs "(\\n[VS]p / 1000u)"
1113 .el \
1114 .       par*vs \\n[VS]
1115 .if !rPD .nr PD .3v>?\n(.V
1116 .if !rDD .nr DD .5v>?\n(.V
1117 .if !rFI .nr FI 2n
1118 .if !rFPD .nr FPD \\n[PD]/2
1119 .ev
1120 .if !dFAM .ds FAM \\n[.fam]
1121 .nr par*adj \\n[.j]
1122 .par*env-init
1123 .ev h
1124 .par*env-init
1125 .ev
1126 .ev fn
1127 .par*env-init
1128 .ev
1129 .ev k
1130 .par*env-init
1131 .ev
1132 .aln 0:MCLL pg@colw
1133 .aln 0:MCLT pg@colw
1134 .aln k:MCLL pg@colw
1135 .aln k:MCLT pg@colw
1136 .aln fn:PS FPS
1137 .aln fn:VS FVS
1138 .aln fn:LL FL
1139 .aln fn:LT FL
1140 .aln fn:PI FI
1141 .aln fn:PD FPD
1142 .aln fn:MCLL pg@fn-colw
1143 .aln fn:MCLT pg@fn-colw
1144 ..
1145 .de par@reset-env
1146 .nr \\n[.ev]:il 0
1147 .nr \\n[.ev]:li 0
1148 .nr \\n[.ev]:ri 0
1149 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1150 .nr \\n[.ev]:pli 0
1151 .nr \\n[.ev]:pri 0
1152 .nr \\n[.ev]:ds-type 0
1153 ..
1154 .\" par@reset
1155 .de par@reset
1156 .br
1157 .if \\n[need_eo_tl]>0 .DEVTAG-EO-TL
1158 .nr need_eo_tl 0
1159 .if \\n[need_eo_h]>0 .DEVTAG-EO-H
1160 .nr need_eo_h 0
1161 .ce 0
1162 .rj 0
1163 .ul 0
1164 .fi
1165 .ie \\n[pg@ncols]>1 \{\
1166 .       ll (u;\\n[\\n[.ev]:MCLL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1167 .       lt \\n[\\n[.ev]:MCLT]u
1168 .\}
1169 .el \{\
1170 .       ll (u;\\n[\\n[.ev]:LL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
1171 .       lt \\n[\\n[.ev]:LT]u
1172 .\}
1173 .in (u;\\n[\\n[.ev]:li]+\\n[\\n[.ev]:pli])
1174 .ft 1
1175 .fam \\*[FAM]
1176 .ie (\\n[\\n[.ev]:PS] >= 1000) \
1177 .       ps (\\n[\\n[.ev]:PS]z / 1000u)
1178 .el \
1179 .       ps \\n[\\n[.ev]:PS]
1180 .ie (\\n[\\n[.ev]:VS] >= 1000) \
1181 .       par*vs "(\\n[\\n[.ev]:VS]p / 1000u)"
1182 .el \
1183 .       par*vs \\n[\\n[.ev]:VS]
1184 .ls 1
1185 .TA
1186 .hy \\n[HY]
1187 ..
1188 .de @RT
1189 .nr \\n[.ev]:pli 0
1190 .nr \\n[.ev]:pri 0
1191 .par@reset
1192 ..
1193 .\" This can be redefined by the user.
1194 .de TA
1195 .ta T 5n
1196 ..
1197 .\" \n[PORPHANS] sets number of initial lines of any paragraph,
1198 .\" which must be kept together, without any included page break.
1199 .\" Initialise to reproduce original behaviour; user may adjust it.
1200 .if !rPORPHANS .nr PORPHANS 1
1201 .
1202 .de par*start
1203 .ds@auto-end
1204 .nr \\n[.ev]:pli \\$1
1205 .nr \\n[.ev]:pri \\$2
1206 .par@reset
1207 .sp \\n[\\n[.ev]:PD]u
1208 .ne \\n[PORPHANS]v+\\n(.Vu
1209 ..
1210 .de par@finish
1211 .nr \\n[.ev]:pli 0
1212 .nr \\n[.ev]:pri 0
1213 .par@reset
1214 ..
1215 .\" normal LP
1216 .de @LP
1217 .par*start 0 0
1218 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1219 ..
1220 .de @PP
1221 .par*start 0 0
1222 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1223 .if !'\*(.T'html' .ti +\\n[\\n[.ev]:ai]u
1224 ..
1225 .de @QP
1226 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1227 .par*start \\n[QI] \\n[QI]
1228 ..
1229 .de @XP
1230 .par*start \\n[\\n[.ev]:PI] 0
1231 .ti -\\n[\\n[.ev]:PI]u
1232 ..
1233 .de @IP
1234 .if \\n[.$]>1 .nr \\n[.ev]:ai (n;\\$2)
1235 .par*start \\n[\\n[.ev]:ai] 0
1236 .if !'\\$1'' \{\
1237 .       \" Divert the label so as to freeze any spaces.
1238 .       di par*label
1239 .       par*push-tag-env
1240 \&\\$1
1241 .       par*pop-tag-env
1242 .       di
1243 .       chop par*label
1244 .       ti -\\n[\\n[.ev]:ai]u
1245 .       ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \{\
1246 .               DEVTAG-COL 1
1247 \\*[par*label]\h'|\\n[\\n[.ev]:ai]u'\c
1248 .               DEVTAG-COL 2
1249 .       \}
1250 .       el \{\
1251 .               DEVTAG-COL 1
1252 \\*[par*label]
1253 .               DEVTAG-COL-NEXT 2
1254 .               br
1255 .       \}
1256 .       rm par*label
1257 .\}
1258 ..
1259 .\" We don't want margin characters to be attached when we divert
1260 .\" the tag.  Since there's no way to save and restore the current
1261 .\" margin character, we have to switch to a new environment, taking
1262 .\" what we need of the old environment with us.
1263 .de par*push-tag-env
1264 .nr par*saved-font \\n[.f]
1265 .nr par*saved-size \\n[.s]z
1266 .nr par*saved-ss \\n[.ss]
1267 .ds par*saved-fam \\n[.fam]
1268 .ev par
1269 .nf
1270 .TA
1271 .ft \\n[par*saved-font]
1272 .ps \\n[par*saved-size]u
1273 .ss \\n[par*saved-ss]
1274 .fam \\*[par*saved-fam]
1275 ..
1276 .de par*pop-tag-env
1277 .ev
1278 ..
1279 .de @RS
1280 .br
1281 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1282 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1283 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1284 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1285 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1286 .nr \\n[.ev]:il +1
1287 .nr \\n[.ev]:li +\\n[\\n[.ev]:ai]
1288 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1289 .par@reset
1290 ..
1291 .de @RE
1292 .br
1293 .ie \\n[\\n[.ev]:il] \{\
1294 .       nr \\n[.ev]:il -1
1295 .       nr \\n[.ev]:ai \\n[\\n[.ev]:ai!\\n[\\n[.ev]:il]]
1296 .       nr \\n[.ev]:li \\n[\\n[.ev]:li!\\n[\\n[.ev]:il]]
1297 .       nr \\n[.ev]:ri \\n[\\n[.ev]:ri!\\n[\\n[.ev]:il]]
1298 .       nr \\n[.ev]:pli \\n[\\n[.ev]:pli!\\n[\\n[.ev]:il]]
1299 .       nr \\n[.ev]:pri \\n[\\n[.ev]:pri!\\n[\\n[.ev]:il]]
1300 .\}
1301 .el .@error unbalanced \\$0
1302 .ie '\\$0'QE' .par*start 0 0
1303 .el .par@reset
1304 ..
1305 .de @QS
1306 .br
1307 .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
1308 .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
1309 .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
1310 .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
1311 .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
1312 .nr \\n[.ev]:il +1
1313 .nr \\n[.ev]:li +\\n[QI]
1314 .nr \\n[.ev]:ri +\\n[QI]
1315 .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
1316 .par*start 0 0
1317 ..
1318 .als @QE @RE
1319 .\" start boxed text
1320 .de B1
1321 .br
1322 .HTML-IMAGE
1323 .di par*box-div
1324 .nr \\n[.ev]:li +1n
1325 .nr \\n[.ev]:ri +1n
1326 .nr par*box-in \\n[.in]
1327 .\" remember what 1n is, just in case the point size changes
1328 .nr par*box-n 1n
1329 .in +1n
1330 .ll -1n
1331 .lt -1n
1332 .ti \\n[par*box-in]u+1n
1333 ..
1334 .de @div-end!par*box-div
1335 .B2
1336 ..
1337 .\" end boxed text
1338 .\" Postpone the drawing of the box until we're in the top-level
1339 .\" diversion, in case there's a footnote inside the box.
1340 .de B2
1341 .ie '\\n(.z'par*box-div' \{\
1342 .       br
1343 .       if \n[.V]>.25m .sp
1344 .       di
1345 .       if \n[.V]>.25m .sp
1346 .       ds@need \\n[dn]
1347 .       par*box-mark-top
1348 .       ev nf
1349 .       par*box-div
1350 .       ev
1351 .       nr \\n[.ev]:ri -\\n[par*box-n]
1352 .       nr \\n[.ev]:li -\\n[par*box-n]
1353 .       in -\\n[par*box-n]u
1354 .       ll +\\n[par*box-n]u
1355 .       lt +\\n[par*box-n]u
1356 .       par*box-draw \\n[.i]u \\n[.l]u-(\\n[.H]u==1n*1n)
1357 .\}
1358 .el .@error B2 without B1
1359 .HTML-IMAGE-END
1360 ..
1361 .de par*box-mark-top
1362 .ie '\\n[.z]'' \{\
1363 .       rs
1364 .       mk par*box-top
1365 .\}
1366 .el \!.par*box-mark-top
1367 ..
1368 .de par*box-draw
1369 .ie '\\n[.z]'' \{\
1370 .       nr par*box-in \\n[.i]
1371 .       nr par*box-ll \\n[.l]
1372 .       nr par*box-vpt \\n[.vpt]
1373 .       nr par*box-ad \\n[.j]
1374 .       ad l
1375 .       vpt 0
1376 .       in \\$1
1377 .       ll \\$2
1378 \v'-1v+.25m'\
1379 \D'l (u;\\n[.l]-\\n[.i]) 0'\
1380 \D'l 0 |\\n[par*box-top]u'\
1381 \D'l -(u;\\n[.l]-\\n[.i]) 0'\
1382 \D'l 0 -|\\n[par*box-top]u'
1383 .       br
1384 .       sp -1
1385 .       in \\n[par*box-in]u
1386 .       ll \\n[par*box-ll]u
1387 .       vpt \\n[par*box-vpt]
1388 .       ad \\n[par*box-ad]
1389 .\}
1390 .el \!.par*box-draw \\$1 \\$2
1391 ..
1392 .\" \n[HORPHANS] sets how many lines of the following paragraph must be
1393 .\" kept together, with a preceding section header.  Initialise it,
1394 .\" to reproduce original behaviour; user may change it.
1395 .if !rHORPHANS .nr HORPHANS 1
1396 .
1397 .\" \n[GROWPS] and \n[PSINCR] cause auto-increment of header point size.
1398 .\" Initialise them, so they have no effect, unless explicitly set by
1399 .\" the user.
1400 .if !rGROWPS .nr GROWPS 0
1401 .if !rPSINCR .nr PSINCR 1p
1402 .
1403 .de SH-NO-TAG
1404 .par@finish
1405 .\" Keep the heading and the first few lines of the next paragraph
1406 .\" together.  (\n[HORPHANS] defines "first few" -- default = 1; user
1407 .\" may redefine it).
1408 .nr sh*minvs \\n[HORPHANS]v
1409 .if \\n[sh*psincr]<0 .nr sh*psincr 0
1410 .ie \\n(VS<1000 .par*vs \\n(VSp+\\n[sh*psincr]u
1411 .el .par*vs \\n(VSp/1000u+\\n[sh*psincr]u
1412 .ne 2v+\\n[sh*minvs]u+\\n[\\n[.ev]:PD]u+\\n(.Vu
1413 .\" Adjust point size for heading text, as specified by \n[GROWPS] and
1414 .\" \n[PSINCR].
1415 .ie \\n(PS<1000 .ps \\n(PS+\\n[sh*psincr]u
1416 .el .ps \\n(PSz/1000u+\\n[sh*psincr]u
1417 .sp 1
1418 .ft B
1419 ..
1420 .de @SH
1421 .\" Standard ms implementation does not expect an argument,
1422 .\" but allow ".SH n" to make heading point size match ".NH n",
1423 .\" for same "n", when \n[GROWPS] and \n[PSINCR] are set.
1424 .  nr sh*psincr 0
1425 .  if 0\\$1>0 .nr sh*psincr (\\n[GROWPS]-0\\$1)*\\n[PSINCR]
1426 .  SH-NO-TAG
1427 .  DEVTAG-SH 1
1428 .  if '\*(.T'html' .nr need_eo_h 1
1429 ..
1430 .\" TL, AU, and AI are aliased to these in cov*ab-init.
1431 .de par@TL
1432 .par@finish
1433 .sp 1
1434 .ft B
1435 .ps +2
1436 .vs +3p
1437 .ce 9999
1438 .DEVTAG-TL
1439 .nr need_eo_tl 1
1440 ..
1441 .de par@AU
1442 .par@finish
1443 .sp 1
1444 .ft I
1445 .ce 9999
1446 ..
1447 .de par@AI
1448 .par@finish
1449 .sp .5
1450 .ce 9999
1451 ..
1452 .\" In paragraph macros.
1453 .de NL
1454 .ie (\\n[\\n[.ev]:PS] >= 1000) \
1455 .       ps (\\n[\\n[.ev]:PS]z / 1000u)
1456 .el \
1457 .       ps \\n[\\n[.ev]:PS]
1458 ..
1459 .de SM
1460 .ps -2
1461 ..
1462 .de LG
1463 .ps +2
1464 ..
1465 .de R
1466 .ft R
1467 ..
1468 .\" par*define-font-macro macro font
1469 .de par*define-font-macro
1470 .de \\$1
1471 .ie \En[.$] \{\
1472 .       nr par*prev-font \En[.f]
1473 \&\E$3\f[\\$2]\E$1\f[\En[par*prev-font]]\E$2
1474 .\}
1475 .el .ft \\$2
1476 \\..
1477 ..
1478 .par*define-font-macro B B
1479 .par*define-font-macro I I
1480 .par*define-font-macro BI BI
1481 .par*define-font-macro CW CR
1482 .\" underline a word
1483 .de UL
1484 \Z'\\$1'\v'.25m'\D'l \w'\\$1'u 0'\v'-.25m'\\$2
1485 ..
1486 .\" box a word
1487 .de BX
1488 .nr par*bxw \w'\\$1'+.4m
1489 \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''\
1490 \Z'\h'.2m'\\$1'\
1491 \h'\\n[par*bxw]u'
1492 ..
1493 .\" The first time UX is used, put a registered mark after it.
1494 .ds par*ux-rg \(rg
1495 .de UX
1496 \s[\\n[.s]*8u/10u]UNIX\s0\\$1\\*[par*ux-rg]
1497 .ds par*ux-rg
1498 ..
1499 .ds par@sup-start \v'-.9m\s'\En[.s]*7u/10u'+.7m'
1500 .als { par@sup-start
1501 .ds par@sup-end \v'-.7m\s0+.9m'
1502 .als } par@sup-end
1503 .\" footnote paragraphs
1504 .\" FF is the footnote format
1505 .nr FF 0
1506 .\" This can be redefined. It gets a second argument of 'no' if the
1507 .\" first argument was supplied by the user, rather than automatically.
1508 .de FP
1509 .br
1510 .if !d par*fp!\\n[FF] \{\
1511 .       @error unknown footnote format '\\n[FF]'
1512 .       nr FF 0
1513 .\}
1514 .ie '\\$2'no' .par*fp!\\n[FF]-no "\\$1"
1515 .el .par*fp!\\n[FF] "\\$1"
1516 ..
1517 .de par*fp!0
1518 .@PP
1519 \&\\*[par@sup-start]\\$1\\*[par@sup-end]\ \c
1520 ..
1521 .de par*fp!0-no
1522 .@PP
1523 \&\\$1\ \c
1524 ..
1525 .de par*fp!1
1526 .@PP
1527 \&\\$1.\ \c
1528 ..
1529 .de par*fp!1-no
1530 .@PP
1531 \&\\$1\ \c
1532 ..
1533 .de par*fp!2
1534 .@LP
1535 \&\\$1.\ \c
1536 ..
1537 .de par*fp!2-no
1538 .@LP
1539 \&\\$1\ \c
1540 ..
1541 .de par*fp!3
1542 .@IP "\\$1." (u;\\n[\\n[.ev]:PI]*2)
1543 ..
1544 .de par*fp!3-no
1545 .@IP "\\$1" (u;\\n[\\n[.ev]:PI]*2)
1546 ..
1547 .\" ***************************
1548 .\" ******** module nh ********
1549 .\" ***************************
1550 .\" Numbered headings.
1551 .\" nh*hl is the level of the last heading
1552 .nr nh*hl 0
1553 .\" SN-DOT and SN-NO-DOT represent the section number of
1554 .\" the current heading, with and without a terminating dot.
1555 .ds SN-DOT
1556 .ds SN-NO-DOT
1557 .\" SN-STYLE sets the statement numbering style used in headings
1558 .\" (either SN-DOT or SN-NO-DOT); for backward compatibility with
1559 .\" earlier ms versions, the default is SN-DOT
1560 .als SN-STYLE SN-DOT
1561 .\" Also for backward compatibility, let SN represent SN-DOT.
1562 .als SN SN-DOT
1563 .\" numbered heading
1564 .de @NH
1565 .ie '\\$1'S' \{\
1566 .       shift
1567 .       nr nh*hl 0
1568 .       while \\n[.$] \{\
1569 .               nr nh*hl +1
1570 .               nr H\\n[nh*hl] 0\\$1
1571 .               shift
1572 .       \}
1573 .       if !\\n[nh*hl] \{\
1574 .               nr H1 1
1575 .               nr nh*hl 1
1576 .               @error missing arguments to .NH S
1577 .       \}
1578 .\}
1579 .el \{\
1580 .       nr nh*ohl \\n[nh*hl]
1581 .       ie \\n[.$] \{\
1582 .               nr nh*hl 0\\$1
1583 .               ie \\n[nh*hl]<=0 \{\
1584 .                       nr nh*ohl 0
1585 .                       nr nh*hl 1
1586 .               \}
1587 .               el \{\
1588 .                       if \\n[nh*hl]-\\n[nh*ohl]>1 \
1589 .                               @warning .NH \\n[nh*ohl] followed by .NH \\n[nh*hl]
1590 .               \}
1591 .       \}
1592 .       el .nr nh*hl 1
1593 .       while \\n[nh*hl]>\\n[nh*ohl] \{\
1594 .               nr nh*ohl +1
1595 .               nr H\\n[nh*ohl] 0
1596 .       \}
1597 .       nr H\\n[nh*hl] +1
1598 .\}
1599 .ds SN-NO-DOT \\n(H1
1600 .nr nh*i 1
1601 .while \\n[nh*i]<\\n[nh*hl] \{\
1602 .       nr nh*i +1
1603 .       as SN-NO-DOT .\\n[H\\n[nh*i]]
1604 .\}
1605 .ds SN-DOT \\*[SN-NO-DOT].
1606 .nr sh*psincr (\\n[GROWPS]-\\n[nh*hl])*\\n[PSINCR]
1607 .SH-NO-TAG
1608 .DEVTAG-NH "\\$1"
1609 .  if '\*(.T'html' .nr need_eo_h 1
1610 \\*[SN-STYLE]
1611 ..
1612 .\" ****************************
1613 .\" ******** module toc ********
1614 .\" ****************************
1615 .\" Table of contents generation.
1616 .de @XS
1617 .da toc*div
1618 .ev h
1619 .ie \\n[.$] .XA "\\$1"
1620 .el .XA
1621 ..
1622 .de @div-end!toc*div
1623 .XE
1624 ..
1625 .de XA
1626 .ie '\\n(.z'toc*div' \{\
1627 .       if d toc*num .toc*end-entry
1628 .       ie \\n[.$] \{\
1629 .               ie '\\$1'no' .ds toc*num
1630 .               el .ds toc*num "\\$1
1631 .       \}
1632 .       el .ds toc*num \\n[PN]
1633 .       br
1634 .       par@reset
1635 .       na
1636 .       ll -8n
1637 .       in (n;0\\$2)
1638 .\}
1639 .el .@error XA without XS
1640 ..
1641 .de XE
1642 .ie '\\n(.z'toc*div' \{\
1643 .       if d toc*num .toc*end-entry
1644 .       ev
1645 .       di
1646 .\}
1647 .el .@error XE without XS
1648 ..
1649 .de toc*end-entry
1650 \\a\\t\\*[toc*num]
1651 .br
1652 .rm toc*num
1653 ..
1654 .de PX
1655 .1C
1656 .if !'\\$1'no' \{\
1657 .       ce 1
1658 .       ie (\\n[PS] >= 1000) \
1659 .               ps ((\\n[PS]z / 1000u) + 2z)
1660 .       el \
1661 .               ps \\n[PS]+2
1662 .       ft B
1663 \\*[TOC]
1664 .       ft
1665 .       ps
1666 .\}
1667 .nf
1668 .char \[toc*leader-char] .\h'1m'
1669 .lc \[toc*leader-char]
1670 .ta (u;\\n[.l]-\\n[.i]-\w'000') (u;\\n[.l]-\\n[.i])R
1671 .sp 2
1672 .toc*div
1673 .par@reset
1674 ..
1675 .\" print the table of contents on page i
1676 .de TC
1677 .P1
1678 .pg@begin 1 i
1679 .PX \\$1
1680 ..
1681 .\" ****************************
1682 .\" ******** module eqn ********
1683 .\" ****************************
1684 .\" Eqn support.
1685 .de EQ
1686 ..
1687 .de EN
1688 ..
1689 .de @EQ
1690 .br
1691 .ds eqn*num "\\$2
1692 .ie '\\$1'L' .nr eqn*type 0
1693 .el \{\
1694 .       ie '\\$1'I' .nr eqn*type 1
1695 .       el \{\
1696 .               nr eqn*type 2
1697 .               if !'\\$1'C' .ds eqn*num "\\$1
1698 .       \}
1699 .\}
1700 .di eqn*div
1701 .in 0
1702 .if '\*(.T'html' \{\
1703 .       nr eqn*ll \\n[.l]
1704 .       ll 1000n
1705 .\}
1706 .if \\n[eqn*type]=0 .EQN-HTML-IMAGE-LEFT
1707 .if \\n[eqn*type]=1 \{\
1708 .   if '\*(.T'html' .RS
1709 .EQN-HTML-IMAGE-INLINE
1710 .\}
1711 .if \\n[eqn*type]=2 .EQN-HTML-IMAGE
1712 .nf
1713 ..
1714 .de @div-end!eqn*div
1715 .@EN
1716 ..
1717 .\" Note that geqn mark and lineup work correctly in centered equations.
1718 .de @EN
1719 .ie !'\\n(.z'eqn*div' .@error-recover mismatched EN
1720 .el \{\
1721 .       br
1722 .       di
1723 .       nr eqn*have-num 0
1724 .       if !'\\*[eqn*num]'' .nr eqn*have-num 1
1725 .       ie \\n[dl]:\\n[eqn*have-num] \{\
1726 .               sp \\n[DD]u
1727 .               par@reset
1728 .               ds eqn*tabs \\n[.tabs]
1729 .               nf
1730 .               ie \\n[dl] \{\
1731 .\"                     --fixme-- this really should not be necessary
1732 .\"                     and indicates that there is extra space creeping
1733 .\"                     into an equation when ps4html is enabled..
1734 .                       ie r ps4html .ds@need \\n[dn]u-1v+\n[.V]u+1i
1735 .                       el .ds@need \\n[dn]u-1v+\n[.V]u
1736 .                       chop eqn*div
1737 .                       ie \\n[eqn*type]=0 \{\
1738 .                               ta (u;\\n[.l]-\\n[.i])R
1739 \\*[eqn*div]\t\\*[eqn*num]
1740 .                       \}
1741 .                       el \{\
1742 .                               ie \\n[eqn*type]=1 .ta \\n[DI]u \
1743 (u;\\n[.l]-\\n[.i])R
1744 .                               el .ta (u;\\n[.l]-\\n[.i]/2)C \
1745 (u;\\n[.l]-\\n[.i])R
1746 \t\\*[eqn*div]\t\\*[eqn*num]
1747 .                       \}
1748 .               \}
1749 .               el \{\
1750 .                       ta (u;\\n[.l]-\\n[.i])R
1751 \t\\*[eqn*num]
1752 .               \}
1753 .\".            if !'\*(.T'html' .sp \\n[DD]u
1754 .               sp \\n[DD]u
1755 .               ta \\*[eqn*tabs]
1756 .       \}
1757 .       el \{\
1758 .\" must terminate empty equations in html and ps4html as they contain
1759 .\" the EQN-HTML-IMAGE-END suppression nodes
1760 .               if \\n[dl] .chop eqn*div
1761 .               if '\*(.T'html' \\*[eqn*div]
1762 .               if r ps4html    \\*[eqn*div]
1763 .       \}
1764 .       if !'\*(.T'html' .fi
1765 .       if \\n[eqn*type]=0 .EQN-HTML-IMAGE-END
1766 .       if \\n[eqn*type]=1 \{\
1767 .               EQN-HTML-IMAGE-END
1768 .               if '\*(.T'html' .RE
1769 .       \}
1770 .       if \\n[eqn*type]=2 .EQN-HTML-IMAGE-END
1771 .       if '\*(.T'html' \
1772 .               ll \\n[eqn*ll]u
1773 .\}
1774 ..
1775 .
1776 .\" ****************************
1777 .\" ******** module tbl ********
1778 .\" ****************************
1779 .\" Tbl support.
1780 .nr tbl*have-header 0
1781 .\" This gets called if TS occurs before the first paragraph.
1782 .de TS
1783 .LP
1784 .\" cov*ab-init aliases TS to @TS
1785 \\*[TS]\\
1786 ..
1787 .de @TS
1788 .sp \\n[DD]u
1789 .if '\\$1'H' .di tbl*header-div
1790 .if '\*(.T'html' \{\
1791 .       nr tbl*ll \\n[.l]
1792 .       ll 1000n
1793 .\}
1794 .HTML-IMAGE
1795 ..
1796 .de tbl@top-hook
1797 .if \\n[tbl*have-header] \{\
1798 .       ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl*print-header
1799 .       el .sp \\n[.t]u
1800 .\}
1801 ..
1802 .de tbl*print-header
1803 .ev nf
1804 .tbl*header-div
1805 .ev
1806 .mk #T
1807 ..
1808 .de TH
1809 .ie '\\n[.z]'tbl*header-div' \{\
1810 .       nr T. 0
1811 .       T#
1812 .       br
1813 .       di
1814 .       ie \\n[dn]+\\n[FM]+\\n[HM]+2v>=\\n[.p] \{\
1815 .               @error ridiculously long table header
1816 .               ds@need \\n[dn]
1817 .               tbl*print-header
1818 .       \}
1819 .       el \{\
1820 .               nr tbl*header-ht \\n[dn]
1821 .               ds@need \\n[dn]u+1v
1822 .               tbl*print-header
1823 .               nr tbl*have-header 1
1824 .       \}
1825 .\}
1826 .el .@error-recover .TH without .TS H
1827 ..
1828 .de @div-end!tbl*header-div
1829 .TH
1830 .TE
1831 ..
1832 .de TE
1833 .ie '\\n(.z'tbl*header-div' .@error-recover .TS H but no .TH before .TE
1834 .el \{\
1835 .       nr tbl*have-header 0
1836 .       if !'\*(.T'html' .sp \\n[DD]u
1837 .\}
1838 .HTML-IMAGE-END
1839 .if '\*(.T'html' \
1840 .       ll \\n[tbl*ll]u
1841 .\" reset tabs
1842 .TA
1843 ..
1844 .de tbl@bottom-hook
1845 .if \\n[tbl*have-header] \{\
1846 .       nr T. 1
1847 .       T#
1848 .\}
1849 ..
1850 .de T&
1851 ..
1852 .\" ****************************
1853 .\" ******** module pic ********
1854 .\" ****************************
1855 .\" Pic support.
1856 .\" PS height width
1857 .de PS
1858 .br
1859 .sp \\n[DD]u
1860 .ie \\n[.$]<2 .@error bad arguments to PS (not preprocessed with pic?)
1861 .el \{\
1862 .       ds@need (u;\\$1)+1v
1863 .       in +(u;\\n[.l]-\\n[.i]-\\$2/2>?0)
1864 .\}
1865 .HTML-IMAGE
1866 ..
1867 .de PE
1868 .HTML-IMAGE-END
1869 .par@reset
1870 .sp \\n[DD]u+.5m
1871 ..
1872 .\" ****************************
1873 .\" ******** module ref ********
1874 .\" ****************************
1875 .\" Refer support.
1876 .mso refer-ms.tmac
1877 .\" ****************************
1878 .\" ******** module acc ********
1879 .\" ****************************
1880 .\" Accents and special characters.
1881 .ds Q \(lq
1882 .ds U \(rq
1883 .ds - \(em
1884 .\" Characters
1885 .\" The idea of this definition is for the top of the 3 to be at the
1886 .\" x-height.
1887 .if !c\[yogh] .char \[yogh] \Z'\v'\w'x'*0-\En[rst]u'\s[\En[.s]*8u/10u]\
1888 \v'\w'3'*0+\En[rst]u'3\s0'\h'\w'\s[\En[.s]*8u/10u]3'u'
1889 .\" Accents
1890 .de acc*over-def
1891 .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
1892 \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
1893 ..
1894 .de acc*under-def
1895 .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
1896 ..
1897 .de acc*slash-def
1898 .ds \\$1 \Z'\h'(u;-\En[.w]-\w'\\$2'/2)'\
1899 \v'(u;\En[.cdp]-\En[.cht]+\En[rst]+\En[rsb]/2)'\\$2'
1900 ..
1901 .de acc*prefix-def
1902 .ds \\$1 \Z'\h'(u;\w'x'-\w'\\$2'/2)'\\$2'
1903 ..
1904 .acc*prefix-def ' \'
1905 .acc*prefix-def ` \`
1906 .acc*prefix-def ^ ^
1907 .acc*prefix-def , \(ac
1908 .acc*prefix-def : \(ad
1909 .acc*prefix-def ~ ~
1910 .\" improved accent marks
1911 .de AM
1912 .acc*over-def ' \'
1913 .acc*over-def ` \`
1914 .acc*over-def ^ ^
1915 .acc*over-def ~ ~
1916 .acc*over-def : \(ad
1917 .acc*over-def v \(ah
1918 .acc*over-def _ \(a-
1919 .acc*over-def o \(ao
1920 .acc*under-def , \(ac
1921 .acc*under-def . \s[\En[.s]*8u/10u]\v'.2m'.\v'-.2m'\s0
1922 .acc*under-def hook \(ho
1923 .acc*slash-def / /
1924 .char \[hooko] o\E*[hook]
1925 .ds q \[hooko]
1926 .ds 3 \[yogh]
1927 .ds D- \(-D\"                   Icelandic uppercase eth
1928 .ds d- \(Sd\"                   Icelandic lowercase eth
1929 .ds Th \(TP\"                   Icelandic uppercase thorn
1930 .ds th \(Tp\"                   Icelandic lowercase thorn
1931 .ds 8 \(ss\"                    German double s
1932 .ds Ae \(AE\"                   AE ligature
1933 .ds ae \(ae\"                   ae ligature
1934 .ds Oe \(OE\"                   OE ligature
1935 .ds oe \(oe\"                   oe ligature
1936 .ds ? \(r?\"                    upside down ?
1937 .ds ! \(r!\"                    upside down !
1938 ..
1939 .de CHECK-FOOTER-AND-KEEP
1940 .if '\*(.T'html' \{\
1941 .   rm KF
1942 .   als KF KS
1943 .
1944 .   rm FS
1945 .   de FS
1946 .      sp
1947 .      HTML-NS <cite>
1948 \\..
1949 .   rm FE
1950 .   de FE
1951 .      HTML-NS </cite>
1952 .      sp
1953 \\..
1954 .\}
1955 ..
1956 .par@load-init
1957 .\" ****************************
1958 .\" ******** module bell ********
1959 .\" ****************************
1960 .\" Emulate Bell Labs localisms. Note, (a) they're not documented, and
1961 .\" (b) the .P1 and .UC macros collide with different ones in Berkeley
1962 .\" ms.  We hack around this by conditionalizing the behavior of P1; UC
1963 .\" was not defined by groff and will be a no-op if called Berkeley
1964 .\" style with no arguments, so there is no problem with hijacking it
1965 .\" here.
1966 .\"
1967 .\" What's done here is sufficient to give back the Guide to EQN (1976)
1968 .\" its section headings and restore some text that had gone missing as
1969 .\" macro arguments; no warranty express or implied is given as to how
1970 .\" well the typographic details these produce match the original Bell
1971 .\" Labs macros.
1972 .\"
1973 .\" P1 is now defined in module pg.
1974 .de SC
1975 .nr bell_localisms 1
1976 .NH 
1977 \\$*
1978 ..
1979 .de UC
1980 .if r bell_localisms \f(CW\\$*\fP
1981 ..
1982 .de P2
1983 .if r bell_localisms \{\
1984 .       ft
1985 .       DE
1986 .\}
1987 ..
1988 .\" ====================================================================
1989 .\" Editor settings
1990 .\" ====================================================================
1991 .
1992 .\" Local Variables:
1993 .\" mode: nroff
1994 .\" fill-column: 72
1995 .\" End:
1996 .\" vim: set filetype=groff textwidth=72: