6 .\" $Id: m.tmac,v 2.18 2003/04/02 04:44:59 jhaegg Exp $
7 .@revision $Revision: 2.18 $
10 Copyright (C) 1991-2000 Free Software Foundation, Inc.
11 mgm is written by Jörgen Hägg <jh@axis.com>
13 mgm is free software; you can redistribute it and/or modify it under
14 the terms of the GNU General Public License as published by the Free
15 Software Foundation; either version 2, or (at your option) any later
18 mgm is distributed in the hope that it will be useful, but WITHOUT ANY
19 WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 You should have received a copy of the GNU General Public License along
24 with groff; see the file COPYING. If not, write to the Free Software
25 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27 Please send bugreports with examples to jh@axis.com.
29 Naming convention stolen from mgs.
30 Local names module*name
31 Extern names module@name
35 .if !\n(.g .ab These mm macros require groff.
37 .if \n(.C .ab The groff mm macros do not work in compatibility mode.
38 .if (\n[.warn] == 65543) .warn
39 .\" ######## init #######
40 .\" Contents level [0:7], contents saved if heading level <= Cl
42 .\" Eject page between LIST OF XXXX if Cp == 0
46 .\" Eject after floating display is output [0:1]
48 .\" Floating keep output [0;5]
50 .\" space before and after display if == 1 [0:1]
54 .\" Equation label adjust 0=left, 1=right
61 .\" H1-H7 heading counters
69 .\" Heading break level [0:7]
71 .\" heading centering level, [0:7]
75 .\" heading temp. indent [0:2]
76 .\" 0 -> 0 indent, left margin
77 .\" 1 -> indent to right , like .P 1
78 .\" 2 -> indent to line up with text part of preceding heading
82 .\" heading space level [0:7]
84 .\" heading numbering type
85 .\" 0 -> multiple (1.1.1 ...)
88 .\" Unnumbered heading level
90 .\" hyphenation in body
91 .\" 0 -> no hyphenation
92 .\" 1 -> hyphenation 14 on
94 .\" text for toc, selfexplanatory. Look in the new variable section
95 .ds Lf LIST OF FIGURES
99 .ds Lx LIST OF EXHIBITS
101 .ds Le LIST OF EQUATIONS
103 .\" List indent, used by .AL
105 .\" List space, if listlevel > Ls then no spacing will occur around lists.
107 .\" Numbering style [0:5]
109 .\" numbered paragraphs
110 .\" 0 == not numbered
111 .\" 1 == numbered in first level headings.
113 .\" Format of figure,table,exhibit,equation titles.
116 .\" Table of contents page numbering style
118 .\" Page-number, normally same as %.
122 .\" paragraph spacing
125 .\" 0 == left-justified
127 .\" 2 == indented .P except after .H, .DE or .LE.
134 .\" Current state of TOC, empty outside TC, inside
135 .\" it will be set to co,fg,tb,ec,ex or ap.
140 .\"---------------------------------------------
141 .\" Internal global variables
143 .\" This is for cover macro .MT
147 .if r C .nr @copy_type \n[C]
148 .\" >0 if Subject/Date/From should be bold, roman otherwise
149 .ie n .ds @sdf_font R
151 .if \n[@copy_type]=4 \{\
159 . ie \n[E] .ds @sdf_font B
163 .\" Current pointsize and vertical space, always in points.
170 .if \n[D]>1 .tm @ps=\n[@ps], @vs=\n[@vs]
171 .if \n[D]>3 .tm INIT: l:\n[.l] p:\n[.p] o:\n[.o]
199 .\" non-zero if escape mechanism is turned off. Used by VERBON/OFF
201 .\"---------------------------------------------
206 .\" print appendixheader, 0 == don't
209 .\" Current appendix text
211 .\" Controls the space before and after static displays if defined.
212 .\" Lsp is used otherwise
215 .\" Add a dot after level one heading number if >0
218 .\" header prespace level. If level <= Hps, then two lines will be printed
219 .\" before the header instead of one.
222 .\" These variables controls the number of lines preceding .H.
223 .\" Hps1 is the number of lines when level > Hps
227 .\" Hps2 is the number of lines when level <= Hps
231 .\" Hss is the number of lines (Lsp) after the header.
234 .\" H1txt will be updated by .H and .HU, containing the heading text.
235 .\" Will also be updated in table of contents & friends
239 .\" header text for the index
241 .\" command to sort the index
245 .if !r Idxf .nr Idxf 0
246 .\" Change these in the national configuration file
252 .\" Flag for space between mark and prefix 1==space, 0==no space
253 .\" Can also be controlled by using '.LI mark 2'
256 .\" Lsp controls the height of an empty line. Normally 0.5v
257 .\" Normally used for nroff compatibility.
273 .ds Qrf See chapter \\*[Qrfh], page \\*[Qrfp].
275 .\" header- and footer-size will only change to the current
279 .\" section-page if Sectp > 0
281 .if (\n[N]=3):(\n[N]=5) \{\
285 .\" section-figure if Sectf > 0
287 .if \n[N]=5 .nr Sectf 1
289 .\" argument to .nm in .VERBON.
291 .\" indent for VERBON
295 .\" Formal closing (.FC)
296 .ds Letfc Yours very truly,
300 .\" Approval date-string
303 .ds LetCN CONFIDENTIAL\" Confidential default
304 .ds LetSA To Whom It May Concern:\" Salutation default
305 .ds LetAT ATTENTION:\" Attention string
306 .ds LetSJ SUBJECT:\" Subject string
307 .ds LetRN In reference to:\" Reference string
311 .ds Letns!copy Copy \" space!
314 .ds Letns!1 Copy (with att.) to
315 .ds Letns!2 Copy (without att.) to
320 .ds Letns!7 Under separate cover
321 .ds Letns!8 Letter to
322 .ds Letns!9 Memorandum to
323 .ds Letns!10 Copy (with atts.) to
324 .ds Letns!11 Copy (without atts.) to
325 .ds Letns!12 Abstract Only to
326 .ds Letns!13 Complete Memorandum to
329 .\" Text printed below the footer. Controlled by @copy_type (C).
331 .ds Pg_type!1 OFFICIAL FILE COPY
332 .ds Pg_type!2 DATE FILE COPY
333 .ds Pg_type!3 D\ R\ A\ F\ T
334 .ds Pg_type!4 D\ R\ A\ F\ T
335 .\" Max lines in return address
337 .\"--------------------------
338 .\" test for mgm macro. This can be used if the text must test
339 .\" what macros is used.
342 .\" Due to security problems with groff I had to rewrite
343 .\" the reference system. It's not as elegant as before, you
344 .\" have to run groff with '-z -rRef=1' and put stderr into the filename
347 .\" Output references to stderr if non-zero
353 .\"---------------------------------------------
354 .\" set local variables.
355 .ie d @language .mso mm/\*[@language]_locale
357 .\"---------------------------------------------
358 .if \n[D] .tm Groff mm, version \*[RE].
359 .\" ####### module init ######
362 .ie \\n[misc@adjust] 'ad
372 'tm WARNING:(\\n[.F]) input line \\n[.c]:\\$*
373 .if \\n[D] .backtrace
376 'tm ******************
377 'tm ERROR:(\\n[.F]) input line \\n[.c]:\\$*
378 .if \\n[D] .backtrace
379 'tm ******************
380 .ab "Input aborted, syntax error"
383 .tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
386 .tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
389 .\" ####### module debug #################################
391 'tm \\$1:\\n[.F]:\\n[c.] ll=\\n[.l] vs=\\n[.v] ps=\\n[.s],\\n[.ps] \
392 in=\\n[.i] fi=\\n[.u] .d=\\n[.d] nl=\\n[nl] pg=\\n[%]
397 'tm \\$1:\\n[.F]:\\n[c.] ll=\\n[.l] vs=\\n[.v] ps=\\n[.s] in=\\n[.i]\
398 ad=\\n[.j] fi=\\n[.u] pl=\\n[.p] page=\\n[%] .o=\\n[.o]
399 'tm _______ .d=\\n[.d] .f=\\n[.f] .h=\\n[.h] .k=\\n[.k] .n=\\n[.n]\
400 .p=\\n[.p] .t=\\n[.t] .z=\\n[.z] nl=\\n[nl] dn=\\n[dn] n=\\n[debug*n]
402 .\" ####### module par #################################
403 .nr par@ind-flag 1 \" indent on following P if Pt=2
410 .nr par*num-count 0 1
412 .\" reset numbered paragraphs, arg1 = headerlevel
414 .if \\$1<3 .nr par*num-count 0
415 .if (\\$1=1)&(\\n[Np]=1) .nr par*number 0
420 .\" skip P if previous heading
422 . tm Paragraph nl=\\n[nl], last=\\n[hd*last-pos]
423 . tm Paragraph .k=\\n[.k], hsize=\\n[hd*last-hsize]
425 .if !((\\n[nl]=\\n[hd*last-pos]):(\\n[hd*last-hsize]=\\n[.k])) \{\
426 . if \\n[D]>2 .tm Paragraph set ind-flag=1
429 .\" any collected unprinted text?
431 .if \\n[Np] \\n[H1].\\n+[par*number]\ \ \c
435 .\" skip P if previous heading
437 . tm Paragraph nl=\\n[nl], last=\\n[hd*last-pos]
438 . tm Paragraph .k=\\n[.k], hsize=\\n[hd*last-hsize]
440 .if !((\\n[nl]=\\n[hd*last-pos]):(\\n[hd*last-hsize]=\\n[.k])) \{\
441 . if \\n[D]>2 .tm Paragraph set ind-flag=1
445 \\n[H2].\\n+[par*number2]\ \ \c
450 .SP (u;\\n[Ps]*\\n[Lsp])
452 . if \\$1=1 .ti +\\n[Pi]n
455 . if \\n[Pt]=1 .ti +\\n[Pi]n
456 . if (\\n[Pt]=2)&\\n[par@ind-flag] .ti +\\n[Pi]n
459 .\" ####### module line #######################################
462 .if !r line*lp\\n[.z] .nr line*lp\\n[.z] 0
463 .if !r line*ac\\n[.z] .nr line*ac\\n[.z] 0
464 .ie \\n[.$] .nr line*temp (v;\\$1)
467 .ie \\n[line*lp\\n[.z]]=\\n[.d] \{\
468 . \" go here if no output since the last .SP
469 . nr line*output \\n[line*temp]-\\n[line*ac\\n[.z]]
470 . if \\n[line*output]<0 .nr line*output 0
471 . nr line*ac\\n[.z] +\\n[line*output]
474 . nr line*ac\\n[.z] \\n[line*temp]
475 . nr line*output \\n[line*temp]
476 . \" no extra space in the beginning of a page
477 . if (\\n[.d]<0):(\\n[pg*head-mark]=\\n[.d]) .nr line*output 0
479 .if \\n[line*output] .sp \\n[line*output]u
480 .nr line*lp\\n[.z] \\n[.d]
482 .\" ######## module misc ###############
486 . if \\$1-1 .@error "SA: bad arg: \\$1"
487 . nr misc@adjust 0\\$1
489 .ie \\n[misc@adjust] 'ad
493 .\" switch environment, keep all important settings.
501 .\" .misc@push stackname value
503 .ie d misc*st-\\$1 .ds misc*st-\\$1 \\$2 \\*[misc*st-\\$1]
504 .el .ds misc*st-\\$1 \\$2
507 .\" .misc@pop stackname
508 .\" value returned in the string misc*pop
510 .misc@pop-set misc*st-\\$1 \\*[misc*st-\\$1]
514 .ds misc*st-name \\$1
516 .if \\n[.$]<1 .@error "stack \\*[misc*st-name] empty"
519 .ds \\*[misc*st-name] \\$*
522 .\" .misc@pop-nr stackname varname
525 .nr \\$2 \\*[misc*pop]
528 .\" .misc@pop-ds stackname varname
531 .ds \\$2 \\*[misc*pop]
539 .\" .PGFORM linelength [ pagelength [ pageoffset [1]]]
541 .\" Break here to avoid problems with new linesetting of the previous line.
542 .\" Hope this doesn't break anything else :-)
543 .\" Don't break if arg_4 is a '1'.
544 .if \\n[D]>2 .tm PGFORM: \\$*
546 .if \\n[D]>3 .tm PGFORM: IN l:\\n[.l] p:\\n[.p] o:\\n[.o]
550 . nr @cur-ll \\n[@ll]
569 .if \\n[D]>3 .tm PGFORM: OUT l:\\n[.l] p:\\n[.p] o:\\n[.o]
570 .if \\n[D]>2 .tm PGFORM: ll=\\n[@ll], pl=\\n[@pl], po=\\n[@po]
579 .\" .MOVE y [[x] linelength]
580 .\" move to line y, indent to x
582 .if !\\n[.$] .@error "MOVE y [x]: no arguments"
587 .ie \\n[.$]>2 .nr pg*i (n;\\$3)
589 . ie \\n[.$]>1 .nr pg*i (n;\\n[@ll]u-\\$2)
590 . el .nr pg*i \\n[@ll]u
592 .\" move to X-pos, if any
593 .if !''\\$2' .po \\$2
599 .if !\\n[.$] .@error "SM: no arguments"
600 .if \\n[.$]=1 \s-1\\$1\s0
601 .if \\n[.$]=2 \s-1\\$1\s0\\$2
602 .if \\n[.$]=3 \\$1\s-1\\$2\s0\\$3
605 .nr misc*S-ps \n[@ps]
606 .nr misc*S-vs \n[@vs]
607 .nr misc*S-ps1 \n[@ps]
608 .nr misc*S-vs1 \n[@vs]
617 . ie \\n[.$]=1 .ds misc*b D
619 . ie \w@\\$2@=0 .ds misc*b C
622 . ie \w@\\$1@=0 .ds misc*a C
627 .if !'\\*[misc*a]'C' \{\
628 . ie '\\*[misc*a]'P' .ps \\n[misc*S-ps]u
630 . ie '\\*[misc*a]'D' .ps \\n[S]
632 . if \\n[D]>2 .tm S: .ps \\*[misc*a]
636 .\" set vertical spacing
637 .if !'\\*[misc*b]'C' \{\
638 . ie '\\*[misc*b]'P' .vs \\n[misc*S-vs]u
640 . ie '\\*[misc*b]'D' .vs \\n[.ps]u+2p
642 . if \\n[D]>2 .tm S: .vs \\*[misc*b]
648 .if \\n[D]>1 .tm S(\\$*): ma:\\*[misc*a], mb:\\*[misc*b] => ps:\\n[@ps]u, vs:\\n[@vs]u
649 .nr misc*S-ps \\n[misc*S-ps1]
650 .nr misc*S-vs \\n[misc*S-vs1]
651 .nr misc*S-ps1 \\n[@ps]
652 .nr misc*S-vs1 \\n[@vs]
676 . ds \\$3 "\\*[misc*rd]
680 .if !''\\$2' .rn misc*rd \\$2
684 .\" VERBON [flag [pointsize [font]]]
688 .\" 1 add an empty line before verbose text
689 .\" 2 add an empty line after verbose text
690 .\" 3 numbered lines (controlled by the string Verbnm)
691 .\" 4 indent text by the numbervariable Verbin.
695 .if (0\\n[misc*verb]%4)/2 .SP \\n[Lsp]u
696 .misc@ev-keep misc*verb-ev
698 .if (0\\n[misc*verb]%16)/8 .nm \\*[Verbnm]
699 .ie !'\\$3'' .ft \\$3
708 .if (0\\n[misc*verb]%32)/16 .in +\\n[Verbin]u
709 .if 0\\n[misc*verb]%2 \{\
711 . nr @verbose-flag 1 \" tell pageheader to set ec/eo
717 .if (0\\n[misc*verb]%8)/4 .SP \\n[Lsp]u
718 .if (0\\n[misc*verb]%16)/8 .nm
719 .if (0\\n[misc*verb]%32)/16 .in
723 .\" ######## module pict #################
729 .\" I assume that the number variable pict*id is the same
730 .\" between two runs.
752 . nr pict*ind (m;\\$2)
766 . nr pict*width (i;\\$1)
770 . nr pict*height (i;\\$1)
774 .\" let mmroff know the filename and id
776 . tm .\\\\" PIC id \\n[pict*id]
777 . tm .\\\\" PIC file \\*[pict*f]
779 .\" these are defined by mmroff in the second pass
780 .if d pict*file!\\n[pict*id] \{\
781 . ds pict*f \\*[pict*file!\\n[pict*id]]
782 . nr pict*llx \\n[pict*llx!\\n[pict*id]]
783 . nr pict*lly \\n[pict*lly!\\n[pict*id]]
784 . nr pict*urx \\n[pict*urx!\\n[pict*id]]
785 . nr pict*ury \\n[pict*ury!\\n[pict*id]]
787 . nr pict*w (p;\\n[pict*urx]-\\n[pict*llx])
788 . if \\n[pict*w]<0 .nr pict*w 0-\\n[pict*w]
789 . nr pict*h (p;\\n[pict*ury]-\\n[pict*lly])
790 . if \\n[pict*h]<0 .nr pict*h 0-\\n[pict*h]
791 . if \\n[pict*width]>0 \{\
792 . nr pict*rs (u;1000*\\n[pict*width]/\\n[pict*w])
793 . nr pict*w (u;\\n[pict*w]*\\n[pict*rs]/1000)
794 . nr pict*h (u;\\n[pict*h]*\\n[pict*rs]/1000)
796 . if \\n[pict*height]>0 \{\
797 . nr pict*rs (u;1000*\\n[pict*height]/\\n[pict*h])
798 . nr pict*h (u;\\n[pict*h]*\\n[pict*rs]/1000)
800 . if '0'\\n[pict*mode]' \{\
801 . nr pict*in \\n[.i]u
803 . if '1'\\n[pict*mode]' \{\
804 . nr pict*in (u;\\n[.l]-\\n[.i]-\\n[pict*w])
806 . if '2'\\n[pict*mode]' \{\
807 . nr pict*in \\n[pict*ind]u
809 . if '3'\\n[pict*mode]' \{\
810 . nr pict*in (u;(\\n[.l]-\\n[.i]-\\n[pict*w])/2)
813 . if \\n[pict*h]>0 .ds pict*h \\n[pict*h]
817 . \" these lines are copied and modified from tmac.pspic.
818 . \" Originally written by James Clark
820 . ie \\n[pict*box]>0 \{\
821 \v'-1v'\h'\\n[pict*in]u'\
822 \Z'\D'p 0 \\n[pict*h]u \\n[pict*w]u 0 0 -\\n[pict*h]u''\
823 \v'\\n[pict*h]u'\X'ps: import \\*[pict*f] \
824 \\n[pict*llx] \\n[pict*lly] \
825 \\n[pict*urx] \\n[pict*ury] \
826 \\n[pict*w] \\n[pict*h]'
829 \v'-1v'\h'\\n[pict*in]u'\
831 \Z'\D'p 0 \\n[pict*h]u \\n[pict*w]u 0 0 -\\n[pict*h]u''\
833 \v'\\n[pict*h]u'\X'ps: import \\*[pict*f] \
834 \\n[pict*llx] \\n[pict*lly] \
835 \\n[pict*urx] \\n[pict*ury] \
836 \\n[pict*w] \\n[pict*h]'
845 .if \\n[.$]<2 .@error "EPIC: Not enough arguments"
846 .nr pict*adj 0 \" centered
848 . shift 1 \" left adjust
854 .ds pict*name "External picture
855 .if !''$3' .ds pict*name \\$3
859 .if !\\n[pict*adj] .nr pict*ind (u;(\\n[.l]-\\n[.i]-\\n[pict*w])/2)
862 \D'l \\n[pict*w]u 0'\
863 \D'l 0 -\\n[pict*h]u'\
864 \D'l -\\n[pict*w]u 0'\
865 \D'l 0 \\n[pict*h]u'\
866 \v'-(u;\\n[pict*h]/2)'\
867 \h'(u;(\\n[pict*w]-\w'\\*[pict*name]'/2))'\\*[pict*name]
872 .\" ######## module acc #################
874 .\" accents. These are copied from mgs, written by James Clark.
876 .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
877 \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
880 .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
888 .acc@under-def , \(ac
889 .\" ######## module uni #################
890 .\" unimplemented macros
892 'tm "OK: not implemented"
895 'tm "PM: not implemented"
897 .\" ######## module hd #################
898 .\" support for usermacro
899 .nr hd*h1-page 1 \" last page-number for level 1 header.
910 .\" .hd@split varable index name val1 val2 ...
912 .if \\$2>(\\n[.$]-3) .@error "\\$3 must have at least \\$2 values (\\*[\\$3]).
914 .ds \\$1 \\$[\\n[hd*sp-tmp]]
921 .if !r hd*cur-bline .nr hd*cur-bline \\n[nl]
923 .df@print-float 2\" $$$ could be wrong...
924 .\" terminate all lists
929 .if !\\n[hd*level] .nr hd*level \\n[Hu]
931 .\" clear lower counters
933 .while \\n+[hd*i]<8 .if \\n[hd*level]<\\n[hd*i] .nr H\\n[hd*i] 0 1
935 .\" save last text for use in TP
936 .if \\n[hd*level]=1 .ds H1txt \\$2\\$3
938 .\" This is a little fix to be able to get correct H1 heading number
939 .\" in page headers. Special attention was needed when other formats are used.
941 . ds hd*format \\g[H1]
944 . af H1 \\*[hd*format]
946 .el .nr H1h \\n[H1] 1
947 .if \\n[hd*level]=1 .nr H1h +1
949 .\" Check if it's time for new page. Only if text has
951 .if \\n[Ej]&(\\n[Ej]>=\\n[hd*level])&(\\n[nl]>\\n[hd*cur-bline]) .pg@next-page
953 .\" increment current counter
954 .nr H\\n[hd*level] +1
956 .\" update pagenumber if section-page is used
957 .if (\\n[hd*level]=1)&(\\n[Sectp]>0) .hd@set-page 1
959 .\" hd*mark is the text written to the left of the header.
962 .if \\n[hd*level]>1 .as hd*mark \\n[H2]
965 .while \\n+[hd*i]<8 .if \\n[hd*level]>(\\n[hd*i]-1) .as hd*mark .\\n[H\\n[hd*i]]
966 .if \\n[Ht] .ds hd*mark \\n[H\\n[hd*level]].
968 .\" special case, no dot after level one heading if not H1dot true
969 .if (\\n[hd*level]=1)&(\\n[H1dot]=0) .ds hd*mark \\n[H1]
971 .as hd*mark \ \ \" add spaces between mark and heading
972 .if !\\n[hd*arg1] .ds hd*mark\" no mark for unnumbered
974 .if \\n[D]>1 .tm At header \\*[hd*mark] "\\$2"
975 .nr hd*htype 0 \" hd*htype = check break and space
976 . \" 0 = run-in, 1 = break only, 2 = space
977 .if \\n[hd*level]<=\\n[Hb] .nr hd*htype 1
978 .if \\n[hd*level]<=\\n[Hs] .nr hd*htype 2
979 . \" two spaces if hd*htype == 0
980 .ie (\\n[hd*htype]=0)&(\w@\\$2@) .ds hd*suf-space " \"
982 .nr hd*need 2v \" hd*need = header need space
983 .\"---------- user macro HX ------------
984 .\" User exit macro to override numbering.
985 .\" May change hd*mark (}0), hd*suf-space (}2) and hd*need (;3)
986 .\" Can also change Hps1/2.
987 .if d HX .HX \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
988 .\"--------------------------------------
990 .ie \\n[hd*level]<=\\n[Hps] .SP (u;\\n[Hps2])
991 .el .SP (u;\\n[Hps1])
993 .par@reset-num \\n[hd*level]\" reset numbered paragraph
994 .\" start diversion to measure size of header
996 \\*[hd*mark]\\$2\\$3\\*[hd*suf-space]
1000 .if \\n[hd*htype] .na \" no adjust if run-in
1001 .if \\n[hd*htype]<2 .nr hd*need +\\n[Lsp]u \" add some extra space
1002 .ne \\n[hd*need]u+\\n[dn]u+.5p-1v \" this is the needed space for a header
1004 .\" size and font calculations
1005 .hd@split hd*font \\n[hd*level] HF \\*[HF]\" get font for this level
1006 .ft \\*[hd*font]\" set new font
1007 .hd@split hd*new-ps \\n[hd*level] HP \\*[HP]\" get point size
1008 .ie (\\*[hd*new-ps]=0):(\w@\\*[hd*new-ps]@=0) \{\
1009 . if \\n[hd*htype] \{\
1010 . if '\\*[hd*font]'3' \{\
1014 . if '\\*[hd*font]'B' \{\
1022 . vs \\*[hd*new-ps]+2
1025 .\"---------- user macro HY -------------
1026 .\" user macro to reset indents
1027 .if d HY .HY \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
1028 .\"--------------------------------------
1029 .nr hd*mark-size \w@\\*[hd*mark]@
1030 .if (\\n[hd*level]<=\\n[Hc])&\\n[hd*htype] .ce\" center if level<=Hc
1032 .\" finally, output the header
1034 .\" and the rest of the header
1035 .ie \\n[hd*htype] \{\
1039 .el \\$2\\$3\\*[hd*suf-space]\&\c
1041 .\" restore pointsize and vertical size.
1045 .\" table of contents
1046 .if (\\n[hd*level]<=\\n[Cl])&\w@\\$2@ .toc@entry \\n[hd*level] "\\$2"
1047 .\" set adjust to previous value
1049 .\" do break or space
1050 .if \\n[hd*htype] .br
1051 .if \\n[hd*htype]>1 .SP (u;\\n[Lsp]*\\n[Hss])
1052 .if \\n[hd*htype] \{\
1053 . \" indent if Hi=1 and Pt=1
1054 . if (\\n[Hi]=1)&(\\n[Pt]=1) .ti +\\n[Pi]n
1055 . \" indent size of mark if Hi=2
1056 . if \\n[hd*htype]&(\\n[Hi]>1) .ti +\\n[hd*mark-size]u
1058 .nr par@ind-flag 0 \" no indent on .P if Pt=2
1060 .\" check if it is time to reset footnotes
1061 .if (\\n[hd*level]=1)&\\n[ft*clear-at-header] .nr ft*nr 0 1
1063 .\" check if it is time to reset indexes
1064 .if (\\n[hd*level]=1)&\\n[Sectf] \{\
1070 .\"---------- user macro HZ ----------
1071 .if d HZ .HZ \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
1072 .nr hd*last-pos \\n[nl]
1073 .nr hd*last-hsize \\n[.k]
1079 .while \\n+[hd*i]<8 .af H\\n[hd*i] \\$[\\n[hd*i]] 1
1081 .\"----------------------
1082 .\" set page-nr, called from header
1086 .ie \\n[.$]>0 .nr P \\$1
1088 .\" Set section-page-string
1089 .ds hd*sect-pg \\n[H1]-\\n[P]
1090 .if \\n[Sectp]>1 .if '\\n[H1]'0' .ds hd*sect-pg "
1092 .\"########### module pg ####################
1093 .\" set end of text trap
1097 .ds pg*header ''- \\nP -''
1099 .if \n[N]=4 .ds pg*header ''''
1100 .if (\n[N]=3):(\n[N]=5) \{\
1102 . ds pg*footer ''\\*[hd*sect-pg]''
1110 .nr pg*foot-margin 0
1112 .nr pg*footer-size 5v\" 1v+footer+even/odd footer+2v
1113 .nr pg*header-size 7v\" 3v+header+even/odd header+2v
1114 .nr pg*extra-footer-size 0
1115 .nr pg*extra-header-size 0
1118 .nr pg*cols-per-page 1
1119 .nr pg*cur-po \n[@po]
1124 .\"-------------------------
1125 .\" footer TRAPS: set, enable and disable
1127 .nr pg*foot-trap \\n[@pl]u-(\\n[pg*block-size]u+\\n[ft*note-size]u+\\n[pg*foot-margin]u+\\n[pg*footer-size]u+\\n[pg*extra-footer-size]u)
1129 .if \\n[D]>2 .tm pg*foot-trap \\n[@pl]u-(\\n[pg*block-size]u+\\n[ft*note-size]u+\\n[pg*foot-margin]u+\\n[pg*footer-size]u+\\n[pg*extra-footer-size]u) = \\n[pg*foot-trap]
1131 .\" last-pos points to the position of the footer and bottom
1132 .\" block below foot-notes.
1133 .nr pg*last-pos \\n[@pl]u-(\\n[pg*block-size]u+\\n[pg*foot-margin]u+\\n[pg*footer-size]u+\\n[pg*extra-footer-size]u)
1134 .if \\n[D]>2 .tm pg*last-pos \\n[@pl]u-(\\n[pg*block-size]u+\\n[pg*foot-margin]u+\\n[pg*footer-size]u+\\n[pg*extra-footer-size]u) = \\n[pg*last-pos]
1137 .wh \\n[pg*foot-trap]u pg@footer
1138 .if \\n[D]>2 .tm pg@enable-trap .t=\\n[.t] nl=\\n[nl]
1144 .\" move to new trap (if changed).
1150 .de pg@enable-top-trap
1151 .\" set trap for pageheader.
1152 .nr pg*top-enabled 1
1154 .de pg@disable-top-trap
1155 .\" remove trap for pageheader.
1156 .nr pg*top-enabled 0
1158 .\" no header on the next page
1160 .nr pg*top-enabled (-1)
1162 .\" set first trap for pagefooter
1166 .\"-------------------------
1167 .\" stop output and begin on next page. Fix footnotes and all that.
1170 .ne 999i \" activate trap
1173 .\"-------------------------
1174 .\" support for PX, TP and EOP.
1176 .als }e pg*even-header
1177 .als }o pg*odd-header
1179 .als TPeh pg*even-header
1180 .als TPoh pg*odd-header
1183 .als EOPef pg*even-footer
1184 .als EOPof pg*odd-footer
1185 .\"------------------------------------------------------------
1188 .if \\n[D]>1 .tm Page# \\n[%] (\\n[.F]:\\n[c.])
1190 .tl '<pagenr\ \\n[%]>'''
1192 .\" assign current page-number to P
1195 .nr line*lp\\n[.z] 0
1196 .nr line*ac\\n[.z] 0
1198 .\" suppress pageheader if pagenumber == 1 and N == [124]
1199 .if \\n[pg*top-enabled] \{\
1201 .\". pg@disable-top-trap
1202 . if \\n[pg*extra-header-size] 'sp \\n[pg*extra-header-size]u
1203 . if \\n[pg*top-margin] 'sp \\n[pg*top-margin]u
1206 . ie d let@header .let@header
1211 . ie ((\\n[%]=1)&((\\n[N]=1):(\\n[N]=2))) .sp
1212 . el .tl \\*[pg*header]
1213 . ie o .tl \\*[pg*odd-header]
1214 . el .tl \\*[pg*even-header]
1225 . \" check for pending footnotes
1228 . \" back to normal text processing
1230 . \" mark for multicolumn
1231 . nr pg*head-mark \\n[nl]u
1232 . \" reset NCOL pointer at each new page.
1234 . \" set multicolumn
1237 . \" print floating displays
1242 .if \\n[pg*top-enabled]<0 .nr pg*top-enabled 1
1243 .nr hd*cur-bline \\n[nl] \" .H needs to know if output has occured
1245 .\"---------------------------------------------------------
1249 .if \\n[D]>2 .tm Footer# \\n[%] (\\n[.F]:\\n[c.]) nl=\\n[nl]
1253 .\" increment pageoffset for MC
1254 .\" move to the exact start of footer.
1255 'sp |\\n[pg*foot-trap]u+1v
1257 .if \\n[D]>3 .tm FOOTER after .sp, nl=\\n[nl]
1259 .if d ft*div .ft@print
1262 .if !\\n[pg*cur-column] .pg@print-footer
1266 .if \\n[@verbose-flag] .eo \" to help VERBON/VERBOFF
1268 .\"-------------------------
1270 .\" jump to the position just below the foot-notes.
1271 'sp |\\n[pg*last-pos]u+1v
1272 .if \\n[D]>3 .tm print-footer nl=\\n[nl]
1273 .\" check if there are any bottom block
1274 .if d pg*block-div .pg@block
1276 .\" print the footer and eject new page
1279 .\" user defined end-of-page macro
1282 . ie o .tl \\*[pg*odd-footer]
1283 . el .tl \\*[pg*even-footer]
1284 . ie (\\n[%]=1)&(\\n[N]=1) .tl \\*[pg*header]
1285 . el .tl \\*[pg*footer]
1286 . tl ''\\*[Pg_type!\\n[@copy_type]]''
1289 .\" be sure that floating displays and footnotes will be
1290 .\" printed at the end of the document.
1291 .ie (\\n[df*fnr]>=\\n[df*o-fnr]):\\n[ft*exist] \{\
1298 .\"-------------------------
1300 .\" Initialize the title environment
1317 .\"-------------------------
1327 .ds pg*odd-header "\\$1
1331 .ds pg*even-header "\\$1
1335 .ds pg*odd-footer "\\$1
1339 .ds pg*even-footer "\\$1
1357 .\"-------------------------
1358 .\" end of page processing
1361 .\" output footnotes. set trap for block
1364 .\"-------------------------
1365 .\" print bottom block
1375 .\"-------------------------
1376 .\" define bottom block
1378 .misc@ev-keep pg*block-ev
1383 .\"-------------------------
1387 .nr pg*block-size \\n[dn]u
1391 .\"-------------------------
1392 .\" print out all pending text
1394 .if \\n[D]>2 .tm ---------- End of text processing ----------------
1398 .\"-------------------------
1399 .\" set top and bottom margins
1400 .\" -T sets pg*footer-size and pg*header-size instead
1405 . nr pg*footer-size 5v
1406 . nr pg*header-size 7v
1408 . if \\n[.$]>0 .nr pg*header-size (v;\\$1)
1409 . if \\n[.$]>1 .nr pg*footer-size (v;\\$2)
1413 . nr pg*extra-footer-size 0
1414 . nr pg*extra-header-size 0
1416 . if \\n[.$]>0 .nr pg*extra-header-size (v;\\$1)
1417 . if \\n[.$]>1 .nr pg*extra-footer-size (v;\\$2)
1419 . tm extra top \\n[pg*extra-footer-size]
1420 . tm extra bottom \\n[pg*extra-header-size]
1425 .\"---------------------
1426 .\" multicolumn output.
1428 .if \\n[pg*cols-per-page]>1 \{\
1429 . ll \\n[pg*column-size]u
1433 .if \\n[pg*cols-per-page]>1 \{\
1434 . ie \\n+[pg*cur-column]>=\\n[pg*cols-per-page] \{\
1435 . nr pg*cur-column 0 1
1436 . nr pg*cur-po \\n[@po]u
1441 . nr pg*cur-po +(\\n[pg*column-size]u+\\n[pg*column-sep]u)
1442 . po \\n[pg*cur-po]u
1443 ' sp |\\n[pg*head-mark]u
1448 .\" An argument disables the page-break.
1451 .if \\n[pg*cols-per-page]<=1 .@error "1C: multicolumn mode not active"
1452 .nr pg*cols-per-page 1
1454 .nr pg*column-size \\n[@ll]
1455 .nr pg*ncol-i \\n[pg*cur-column]\" temp variable
1456 .nr pg*cur-column 0 1
1457 .nr pg*cur-po \\n[@po]u
1462 . if \\n[pg*ncol-i]>0 \{\
1463 . @warning 1C: footnotes will be messy
1466 . if \\n[pg*last-ncol]>0 \{\
1467 . sp |\\n[pg*last-ncol]u
1474 .nr pg*head-mark \\n[nl]u
1475 .if \\n[pg*cols-per-page]>1 .@error "2C: multicolumn mode already active"
1476 .nr pg*cols-per-page 2
1477 .nr pg*column-sep \\n[@ll]/15
1478 .nr pg*column-size (\\n[@ll]u*7)/15
1479 .nr pg*cur-column 0 1
1480 .nr pg*cur-po \\n[@po]u
1481 .ll \\n[pg*column-size]u
1482 .\" .lt \\n[pg*column-size]u
1484 .\" MC column-size [ column-separation ]
1487 .nr pg*head-mark \\n[nl]u
1488 .if \\n[pg*cols-per-page]>1 .@error "MC: multicolumn mode already active"
1489 .ie ''\\$1' .nr pg*column-size \\n[.l]
1490 .el .nr pg*column-size (n;\\$1)
1491 .ie ''\\$2' .nr pg*column-sep \\n[pg*column-size]/15
1492 .el .nr pg*column-sep (n;\\$2)
1494 .\" calculate the number of columns/page
1495 .nr pg*cols-per-page 0
1496 .nr pg*i \\n[pg*column-size]
1497 .while \\n[pg*i]<=\\n[.l] \{\
1498 . nr pg*cols-per-page \\n[pg*cols-per-page]+1
1499 . nr pg*i \\n[pg*i]+\\n[pg*column-sep]+\\n[pg*column-size]
1501 .nr pg*cur-column 0 1
1502 .nr pg*cur-po \\n[@po]u
1503 .ll \\n[pg*column-size]u
1504 .\" .lt \\n[pg*column-size]u
1506 .\" begin a new column
1509 .if \\n[nl]>\\n[pg*last-ncol] .nr pg*last-ncol \\n[nl]
1517 .\" force new page by writing something invisible.
1518 .while \\n+[pg*i]<=(0\\$1) \{\
1523 .\"-------------------------------
1524 .\" MULB width1 space1 width2 space2 width3 space3 ...
1532 . nr pg*mul!\\n+[pg*i] (n;0\\$1)
1533 . nr pg*muls!\\n[pg*i] (n;0\\$2)
1536 .nr pg*mul-max-col \\n[pg*i]
1537 .ds pg*mul-fam \\n[.fam]
1538 .nr pg*mul-font \\n[.f]
1542 .fam \\*[pg*mul-fam]
1543 .ft \\n[pg*mul-font]
1551 .if \\n[pg*mul-x]>=\\n[pg*mul-max-col] .@error "MULN: Undefined columnwidth"
1553 .if \\n[.d]>\\n[pg*mul-last] .nr pg*mul-last \\n[.d]
1555 .in \\n[pg*mul-ind]u
1556 .ll (u;\\n[.i]+\\n[pg*mul!\\n+[pg*mul-x]])u
1557 .nr pg*mul-ind +(u;\\n[pg*mul!\\n[pg*mul-x]]+\\n[pg*muls!\\n[pg*mul-x]])
1563 .if \\n[.d]>\\n[pg*mul-last] .nr pg*mul-last \\n[.d]
1566 .ne \\n[pg*mul-last]u
1571 .sp \\n[pg*mul-last]u
1577 .ie o .if !\\n[pg*head-mark]=\\n[nl] \{\
1583 .\"########### module footnotes ###################
1588 .nr ft*hyphen 0\" hyphenation value
1589 .nr ft*adjust 1\" >0 if adjust true
1590 .nr ft*indent 1\" >0 if text indent true (not imp. $$$)
1591 .nr ft*just 0\" 0=left justification, 1=right (not imp. $$$)
1592 .nr ft*exist 0\" not zero if there are any footnotes to be printed
1593 .nr ft*clear-at-header 0\" >0 if footnotes should be reset at first level head.
1595 .ds F \v'-.4m'\s-3\\n+[ft*nr]\s0\v'.4m'
1597 .\"-----------------
1598 .\" init footnote environment
1600 .\" indentcontrol not implemented $$$
1601 .\" label justification not implemented $$$
1604 .ie \\n[ft*adjust] 'ad
1606 .ie \\n[ft*hyphen] 'hy 14
1613 .\"-----------------
1614 .\" set footnote format
1615 .\" no support for two column processing (yet). $$$
1617 .if \\n[.$]=0 .@error "FD: bad arg \\$1"
1618 .ie \\n[.$]=2 .nr ft*clear-at-header 1
1619 .el .nr ft*clear-at-header 0
1622 . ie \\$1>11 .nr ft*format 0
1623 . el .nr ft*format \\$1
1625 . nr ft*hyphen (\\n[ft*format]%2)*14
1626 . nr ft*format \\n[ft*format]/2
1628 . nr ft*adjust 1-(\\n[ft*format]%2)
1629 . nr ft*format \\n[ft*format]/2
1631 . nr ft*indent 1-(\\n[ft*format]%2)
1632 . nr ft*format \\n[ft*format]/2
1634 . nr ft*just \\n[ft*format]%2
1638 .\" Footnote and display width control $$$
1641 .while \\n+[ft*i]<=\\n[.$] \{\
1642 . ds ft*x \\$[\\n[ft*i]]
1643 . if '\\*[ft*x]'N' \{\
1647 . nr ds*float-break 1
1649 . if '\\*[ft*x]'-WF' .nr ft*wide 0
1650 . if '\\*[ft*x]'WF' .nr ft*wide 1
1651 . if '\\*[ft*x]'-FF' .nr ft*first-fn 0
1652 . if '\\*[ft*x]'FF' .nr ft*first-fn 1
1653 . if '\\*[ft*x]'-WD' \{\
1655 . if r ft*df-save \{\
1656 . nr Df \\n[ft*df-save]
1660 . if '\\*[ft*x]'WD' \{\
1662 . nr ft*df-save \\n[Df]
1665 . if '\\*[ft*x]'-FB' .nr ds*float-break 0
1666 . if '\\*[ft*x]'FB' .nr ds*float-break 1
1667 . if \\n[D]>1 .tm WC WF=\\n[ft*wide] WD=\\n[ds*wide]
1670 .\"-----------------
1672 .\" Change environment, switch to diversion and print the foot-note mark.
1674 .if \\n[ft*busy] .@error "FS: missing FE"
1678 .if !\\n[ft*wide] .pg@set-po
1680 .nr ft*space (u;\\n[Fs]*\\n[Lsp])
1683 .ie \\n[.$] .ds ft*mark \\$1
1684 .el .ds ft*mark \\n[ft*nr].
1690 .\"-----------------
1691 .\" init footnote diversion
1692 .de ft@init-footnote
1697 .nr ft*note-size \\n[dn]
1699 .\"-----------------
1701 .\" End the diversion, back to previous environment, and adjust
1702 .\" the trap to the new foot-note size.
1709 .if \\n[@pl]u<\\n[dn]u .@error "FE: too big footnote"
1710 .if !d ft*div .nr dn +1v
1711 .if \\n[D]>3 .tm FE: foot-trap=\\n[pg*foot-trap] .d=\\n[.d] dn=\\n[dn]
1712 .ie (\\n[pg*foot-trap]u-\\n[.d]u)<\\n[dn]u \{\
1719 . if !d ft*div .ft@init-footnote
1723 . nr ft*note-size +\\n[dn]
1729 .\"-----------------
1730 .\" print footnotes, see pg@footer
1743 .\"-----------------
1744 .\" check if any pending footnotes, see pg@header
1746 .if d ft*next-div \{\
1755 . nr ft*note-size +\\n[dn]
1762 .\"########### module display ###################
1763 .nr ds*wide 0\" >0 if wide displays wanted
1764 .nr df*fnr 0 1\" floating display counter
1765 .nr df*o-fnr 1\" floating display counter, already printed
1766 .nr ds*snr 0 1\" static display counter
1767 .nr ds*lvl 0 1\" display level
1768 .nr ds*float-busy 0\" >0 if printing float
1769 .nr df*float 0 >0 if previous display was floating
1770 .\"--------------------------------------------
1772 .ie \\n[df*float] .df@end \\$@
1775 .\"--------------------------------------------
1776 .\" floating display start
1777 .\" nested DF/DE is not allowed.
1779 .if \\n[df*float] .@error "DF:nested floating is not allowed. Use DS."
1782 .nr df*old-ll \\n[.l]
1791 .ds@set-new-ev \\n[df*old-ll]
1795 .\"--------------------------------------------
1800 .nr df*width!\\n+[df*fnr] \\n[dl]
1801 .nr df*height!\\n[df*fnr] \\n[dn]
1802 .nr df*wide!\\n[df*fnr] \\n[ds*wide]
1803 .nr df*format!\\n[df*fnr] \\n[ds*format]
1805 .if \\n[D]>2 .tm DF:fnr=\\n[df*fnr] w=\\n[dl] h=\\n[dn] wide=\\n[ds*wide] \
1807 .\" move div to the floating display list
1808 .rn df*div df*fdiv!\\n[df*fnr]
1811 .\" print float if queue is empty and the display fits into
1812 .\" the current page
1813 .if ((\\n[df*fnr]>=\\n[df*o-fnr])&(\\n[dn]<\\n[.t])) .df@print-float 1
1817 .\" called by end-of-text
1820 .if \\n[df*o-fnr]<=\\n[df*fnr] \{\
1821 . if \\n[D]>2 .tm Print remaining displays.
1822 .\" still some floats left, make non-empty environment
1831 .\" print according to Df and De.
1832 .\" .df@print-float type
1833 .\" type called from
1835 .\" 2 end of section
1836 .\" 3 end of document
1837 .\" 4 beginning of new page
1840 .if \\n[Df]>5 .@error "Df=\\n[Df], max value is 5"
1841 .if !\\n[ds*float-busy] \{\
1842 . nr ds*float-busy 1
1844 . if \\n[D]>3 .tm print-float: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1846 . if (\\$1=1)&((\\n[Df]=1):(\\n[Df]=5)) \{\
1847 . if \\n[.t]>\\n[df*height!\\n[df*o-fnr]] \{\
1848 . \" Print only new displays.
1849 . if \\n[df*o-fnr]=\\n[df*fnr] \{\
1851 . ds@print-one-float
1856 . if (\\$1=1)&(\\n[Df]=3) \{\
1857 . if \\n[.t]>\\n[df*height!\\n[df*o-fnr]] \{\
1859 . ds@print-one-float
1862 .\" print all if Df<2 and end of section
1863 . if (\\$1=2)&(\\n[Sectp]>0)&(\\n[Df]<2) \{\
1865 . ds@print-all-floats
1867 .\" print all if end of document. Where should they go instead?
1870 . ds@print-all-floats
1873 . if (\\$1=4)&(\\n[Df]>1) \{\
1874 . if \\n[Df]=2 .ds@print-one-float
1875 . if \\n[Df]=3 .ds@print-one-float
1877 . ie \\n[De] .ds@print-all-floats
1878 . el .ds@print-this-page
1881 . nr ds*float-busy 0
1886 .\" print a floating diversion
1888 .nr df*old-ll \\n[.l]
1889 .nr df*old-in \\n[.i]
1892 .nr df*i \\n[df*o-fnr]
1893 .nr df*f \\n[df*format!\\n[df*i]]
1896 .if \\n[df*f]=1 'in +\\n[Si]n
1897 .if \\n[df*f]>=2 'in 0
1898 .if \\n[df*f]=2 'ce 9999
1899 .if \\n[df*f]=3 'in (u;(\\n[.l]-\\n[df*width!\\n[df*i]])/2)
1900 .if \\n[df*f]=4 'rj 9999
1901 .if \\n[df*f]=5 'in (u;\\n[.l]-\\n[df*width!\\n[df*i]])
1904 .df*fdiv!\\n[df*o-fnr]
1906 .if \\n[df*f]=2 'ce 0
1907 .if \\n[df*f]=4 'rj 0
1909 .rm df*fdiv!\\n[df*i]
1910 .rm df*height!\\n[df*i]
1911 .rm df*format!\\n[df*i]
1912 .if \\n[df*wide!\\n[df*i]] .nr pg*head-mark \\n[nl]u
1916 .\" print one floating display if there is one.
1917 .de ds@print-one-float
1918 .if \\n[df*o-fnr]<=\\n[df*fnr] \{\
1919 . if \\n[D]>3 .tm print-one-float: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1920 . if \\n[.t]<\\n[df*height!\\n[df*o-fnr]] .pg@next-page
1922 . if \\n[De] .pg@next-page
1926 .\" print all queued floats.
1927 .\" if De>0 do a page eject between the floats.
1928 .de ds@print-all-floats
1929 .while \\n[df*o-fnr]<=\\n[df*fnr] \{\
1930 . if \\n[D]>3 .tm print-all-floats: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1931 . if \\n[.t]<\\n[df*height!\\n[df*o-fnr]] .pg@next-page
1935 . if \\n[De] .pg@next-page
1939 .\" print as many floats as will fit on the current page
1940 .de ds@print-this-page
1941 .while \\n[df*o-fnr]<=\\n[df*fnr] \{\
1942 . if \\n[D]>3 .tm print-this-page: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1943 . if \\n[.t]<\\n[df*height!\\n[df*o-fnr]] .break
1947 .\"---------------------------------------------------
1948 .\" get format of the display
1951 . ie r ds*format!\\$1 .nr ds*format \\n[ds*format!\\$1]
1952 . el .@error "DS/DF:wrong format:\\$1"
1955 .if \\n[D]>2 .tm set format=\\n[ds*format]
1956 .\" fill or not to fill, that is the...
1959 . ie r ds*fill!\\$2 .nr ds*fill \\n[ds*fill!\\$2]
1960 . el .@error "\\*[ds*type]:wrong fill:\\$2"
1962 .if \\n[D]>2 .tm set fill=\\n[ds*fill]
1964 .if \\n[.$]>2 .nr ds*rindent \\$3
1965 .if \\n[D]>2 .tm set indent=\\n[ds*rindent]
1967 .\"-----------------------------
1968 .\" .ds@set-new-ev previous-line-length
1972 .if \\n[ds*rindent] \{\
1973 . ll -\\n[ds*rindent]n
1974 . lt -\\n[ds*rindent]n
1976 .if \\n[ds*wide] \{\
1981 .ie \\n[ds*fill] 'fi
1984 .\"--------------------------------------------------------
1985 .nr ds*format 0\" dummy value for .En/.EQ
1986 .nr ds*format! 0\" no indent
1987 .nr ds*format!0 0\" no indent
1988 .nr ds*format!L 0\" no indent
1989 .nr ds*format!I 1\" indent
1990 .nr ds*format!1 1\" indent
1991 .nr ds*format!C 2\" center each line
1992 .nr ds*format!2 2\" center each line
1993 .nr ds*format!CB 3\" center as block
1994 .nr ds*format!3 3\" center as block
1995 .nr ds*format!R 4\" right justify each line
1996 .nr ds*format!4 4\" right justify each line
1997 .nr ds*format!RB 5\" right justify as block
1998 .nr ds*format!5 5\" right justify as block
2000 .nr ds*fill! 0\" no fill
2001 .nr ds*fill!N 0\" no fill
2002 .nr ds*fill!0 0\" no fill
2003 .nr ds*fill!F 1\" fill on
2004 .nr ds*fill!1 1\" fill on
2005 .\"--------------------------------------------
2006 .\" static display start
2007 .\" nested DS/DE is allowed. No limit on depth.
2014 .nr ds*old-ll \\n[.l]
2015 .nr ds*old-in \\n[.i]
2016 .misc@push ds-ll \\n[.l]
2017 .misc@push ds-form \\n[ds*format]
2020 .misc@ev-keep ds*ev!\\n+[ds*snr]
2024 .\" indent in a diversion doesn't seem like a good idea.
2026 .di ds*div!\\n[ds*snr]
2028 .ds@set-new-ev \\n[ds*old-ll]
2031 .\"--------------------------------------------
2033 .if \\n-[ds*lvl]<0 .@error "DE: no corresponding DS"
2037 .nr ds*width \\n[dl]
2038 .nr ds*height \\n[dn]
2039 .misc@pop-nr ds-ll ds*old-ll
2040 .misc@pop-nr ds-form ds*format
2044 .\" calculate needed space
2045 .nr ds*need \\n[ds*height]
2046 .nr ds*i \\n[pg*foot-trap]-\\n[pg*header-size]u-\\n[pg*extra-header-size]u
2047 .if (\\n[ds*height]>\\n[ds*i])&(\\n[.t]<(\\n[ds*i]/2)) .nr ds*need \\n[.t]u+1v
2048 .if (\\n[ds*height]<\\n[ds*i])&(\\n[.t]<(\\n[ds*height])) .nr ds*need \\n[.t]u+1v
2049 .\" Eject page if display will fit one page and
2050 .\" there are less than half of the page left.
2051 .if \\n[ds*need] .ne \\n[ds*need]u
2053 .\" check if pending equation label
2054 .eq@check \\n[ds*need]
2056 .if \\n[ds*format]=1 'in \\n[ds*old-in]u+\\n[Si]n
2057 .if \\n[ds*format]>=2 'in 0
2058 .if \\n[ds*format]=2 'ce 9999
2059 .if \\n[ds*format]=3 'in (u;(\\n[.l]-\\n[ds*width])/2)
2060 .if \\n[ds*format]=4 'rj 9999
2061 .if \\n[ds*format]=5 'in (u;\\n[.l]-\\n[ds*width])
2064 .\" Print static display
2066 .if r Dsp .nr ds*i \\n[Dsp]
2068 .if \\n[Ds] .sp \\n[ds*i]u
2070 .if \\n[Ds] .sp \\n[ds*i]u
2072 .if \\n[ds*format]=2 'ce 0
2073 .if \\n[ds*format]=4 'rj 0
2074 .rm ds*div!\\n[ds*snr]
2079 .\"########### module list ###################
2080 .\" .LI text-indent mark-indent pad type [mark [LI-space [LB-space] ] ]
2091 .\"--------------------------
2092 .\" the major list-begin macro.
2093 .\" If type == -1 a 'break' will occur.
2095 .if \\n[.$]<4 .@error "LB: not enough arguments, min 4"
2096 .misc@push cind \\n[.i]
2097 .misc@push tind \\n[li*tind]
2098 .misc@push mind \\n[li*mind]
2099 .misc@push pad \\n[li*pad]
2100 .misc@push type \\n[li*type]
2101 .misc@push li-spc \\n[li*li-spc]
2102 .ds li*mark-list!\\n[li*lvl] \\*[li*mark]
2105 .nr li*tind (n;0\\$1)\" text-indent
2106 .nr li*mind (n;0\\$2)\" mark-indent
2107 .nr li*pad (n;0\\$3)\" pad
2108 .nr li*type 0\\$4\" type
2109 .ds li*mark \\$5\" mark
2110 .ie !'\\$6'' .nr li*li-spc \\$6\" LI-space
2112 .ie !'\\$7'' .nr li*lb-spc \\$7\" LB-space
2114 .\" init listcounter
2115 .nr li*cnt!\\n[li*lvl] 0 1
2117 .af li*cnt!\\n[li*lvl] 1
2118 .if \\n[li*type] .if !'\\*[li*mark]'' .af li*cnt!\\n[li*lvl] \\*[li*mark]
2120 .if \\n[li*lb-spc] .SP (u;\\n[li*lb-spc]*\\n[Lsp])
2125 .if \\n[li*lvl]<1 .@error "LI:no lists active"
2126 .if \\n[li*li-spc]&(\\n[Ls]>=\\n[li*lvl]) .SP (u;\\n[li*li-spc]*\\n[Lsp])
2129 .ds li*c-mark \\*[li*mark]
2130 .nr li*cnt!\\n[li*lvl] +1
2131 .if \\n[li*type]=1 .ds li*c-mark \\n[li*cnt!\\n[li*lvl]].
2132 .if \\n[li*type]=2 .ds li*c-mark \\n[li*cnt!\\n[li*lvl]])
2133 .if \\n[li*type]=3 .ds li*c-mark (\\n[li*cnt!\\n[li*lvl]])
2134 .if \\n[li*type]=4 .ds li*c-mark [\\n[li*cnt!\\n[li*lvl]]]
2135 .if \\n[li*type]=5 .ds li*c-mark <\\n[li*cnt!\\n[li*lvl]]>
2136 .if \\n[li*type]=6 .ds li*c-mark {\\n[li*cnt!\\n[li*lvl]]}
2137 .if \\n[.$]=1 .ds li*c-mark \\$1
2139 . ie (\\$2=2):(\\n[Limsp]=0) .ds li*c-mark \\$1\\*[li*c-mark]
2140 . el .ds li*c-mark \\$1\ \\*[li*c-mark]
2143 .\" determine where the text begins
2144 .nr li*text-begin \\n[li*tind]>?\w@\\*[li*c-mark]\ @
2145 .nr x \w@\\*[li*c-mark]\ @
2147 .\" determine where the mark begin
2148 .ie !\\n[li*pad] .nr li*in \\n[li*mind]
2149 .el .nr li*in \\n[li*text-begin]-\\n[li*pad]-\w@\\*[li*c-mark]@
2150 .if !\\n[li*in] .nr li*in 0
2153 .\" no indentation if hanging indent
2154 .if (\w@\\*[li*c-mark]@=0)&((\\n[.$]=0):(\w@\\$1@=0)) .nr li*text-begin 0
2155 \Z'\&\h'\\n[li*in]u'\\*[li*c-mark]'\h'\\n[li*text-begin]u'\&\c
2156 .if \\n[li*type]=-1 .br
2162 .misc@pop-nr cind li*tmp
2164 .misc@pop-nr tind li*tind
2165 .misc@pop-nr mind li*mind
2166 .misc@pop-nr pad li*pad
2167 .misc@pop-nr type li*type
2168 .misc@pop-nr li-spc li*li-spc
2169 .ds li*mark \\*[li*mark-list!\\n[li*lvl]]
2172 .if \\n[li*lvl]<1 .@error "LE:mismatched"
2174 .if '\\$1'1' .SP \\n[Lsp]u
2177 .\" list status clear.
2178 .\" terminate all lists to level i
2180 .ie \\n[.$]<1 .nr li*i 0
2182 .if \\n[li*i]>\\n[li*lvl] .@error "LC: incorrect argument: \\n[li*i] (too big)"
2183 .while \\n[li*lvl]>\\n[li*i] .li@pop
2188 .if \\n[.$]>3 .@error "AL: too many arguments"
2189 .if \\n[D]>2 .tm AL $*
2190 .ie \\n[.$]<=1 .LB \\n[Li] 0 2 1 "\\$1"
2192 . ie \\n[.$]=2 .LB 0\\$2 0 2 1 "\\$1"
2194 . ie !'\\$2'' .LB \\$2 0 2 1 "\\$1" 0 1
2195 . el .LB \\n[Li] 0 2 1 "\\$1" 0 1
2200 .if \\n[.$]>3 .@error "ML: too many arguments"
2201 .if \\n[D]>2 .tm ML $*
2202 .nr li*ml-width \w@\\$1@u+1n
2203 .if \\n[.$]<2 .LB \\n[li*ml-width]u 0 1 0 "\\$1"
2204 .if \\n[.$]=2 .LB 0\\$2 0 1 0 "\\$1"
2206 . ie '\\$2'' .LB \\n[li*ml-width]u 0 1 0 "\\$1" 0 1
2207 . el .LB \\n[Li] 0 1 0 "\\$1" 0 1
2211 .if \\n[D]>2 .tm VL $*
2212 .if \\n[.$]>3 .@error "VL: too many arguments"
2213 .if \\n[.$]<1 .@error "VL: missing text-indent"
2214 .ie \\n[.$]<3 .LB 0\\$1 0\\$2 0 0
2215 .el .LB 0\\$1 0\\$2 0 0 \& 0 1
2217 .\" Bullet (for .BL)
2219 .if \\n[D]>2 .tm BL $*
2221 .if \\n[.$]>2 .@error "BL: too many arguments"
2222 .if \\n[.$]<1 .LB \\n[Pi] 0 1 0 \\*[BU]
2223 .if \\n[.$]=1 .LB 0\\$1 0 1 0 \\*[BU]
2225 . ie '\\$1'' .LB \\n[Pi] 0 1 0 \\*[BU] 0 1
2226 . el .LB 0\\$1 0 1 0 \\*[BU] 0 1
2230 .if \\n[D]>2 .tm DL $*
2231 .if \\n[.$]>2 .@error "DL: too many arguments"
2232 .if \\n[.$]<1 .LB \\n[Pi] 0 1 0 \(em
2233 .if \\n[.$]=1 .LB 0\\$1 0 1 0 \(em
2235 . ie '\\$1'' .LB \\n[Pi] 0 1 0 \(em 0 1
2236 . el .LB 0\\$1 0 1 0 \(em 0 1
2240 .if \\n[D]>2 .tm RL $*
2241 .if \\n[.$]>2 .@error "RL: too many arguments"
2242 .if \\n[.$]<1 .LB 6 0 2 4
2243 .if \\n[.$]=1 .LB 0\\$1 0 2 4
2245 . ie '\\$1'' .LB 6 0 2 4 1 0 1
2246 . el .LB 0\\$1 0 2 4 1 0 1
2249 .\" Broken Variable List. As .VL but text begin on the next line
2251 .if \\n[D]>2 .tm BVL $*
2252 .if \\n[.$]>3 .@error "BVL: too many arguments"
2253 .if \\n[.$]<1 .@error "BVL: missing text-indent"
2254 .ie \\n[.$]<3 .LB 0\\$1 0\\$2 0 -1
2255 .el .LB 0\\$1 0\\$2 0 -1 \& 0 1
2257 .\" ####### module tbl #######################################
2258 .\" This module is copied from groff_ms and modified for mgm.
2259 .\" Yes, it does not resemble the original anymore :-).
2260 .\" Don't know if I missed something important.
2261 .\" Groff_ms is written by James Clark.
2262 .nr tbl*have-header 0
2263 .nr tbl*header-written 0
2267 .if '\\$1'H' .di tbl*header-div
2270 .if \\n[tbl*have-header] \{\
2271 . ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl@print-header
2276 .if \\n[tbl*have-header] \{\
2278 .\" draw bottom and side lines of boxed tables.
2281 .nr tbl*header-written 0
2283 .de tbl@print-header
2289 .nr tbl*header-written 1
2292 .ie '\\n[.z]'tbl*header-div' \{\
2297 . nr tbl*header-ht \\n[dn]
2299 . nr tbl*have-header 1
2300 . ie '\\$1'N' .if !\\n[tbl*header-written] .tbl@print-header
2301 . el .tbl@print-header
2303 .el .@error ".TH without .TS H"
2306 .ie '\\n(.z'tbl*header-div' .@error ".TS H but no .TH before .TE"
2308 . nr tbl*have-header 0
2315 .\" ####### module pic #######################################
2320 .ie \\n[.$]<2 .@error "PS: bad arguments. Probably not processed with pic."
2322 . if !\\n[ds*lvl] .ne (u;\\$1)+1v
2323 .\" should be contained between .DS/.DE
2325 . if \\n[ds*lvl]&((\\n[ds*format]=2):(\\n[ds*format]=3)) \{\
2327 .\" . in +(u;\\n[.l]-\\n[.i]-\\$2/2)
2336 .\" ####### module eq #######################################
2344 .if !'\\*[eq*label]'' \{\
2346 . \" space down to middle of equation
2348 . ie (\\n[Eq]%2) \{\
2349 . \" label to the left
2353 . \" label to the right
2354 \h'|\\n[.l]u'\\*[eq*label]
2362 .\"########### module toc ###################
2363 .\" table of contents
2365 .nr toc*spacing \n[Lsp]u
2369 .\" Table of contents with friends (module lix)
2372 .\" print any pending displays and references
2374 .if \\n[ref*flag] .RP 0 1
2376 .if \w@\\$1@>0 .nr toc*slevel \\$1
2377 .if \w@\\$2@>0 .nr toc*spacing (u;\\$2*\\n[Lsp])
2378 .if \w@\\$3@>0 .nr toc*tlevel \\$3
2379 .if \w@\\$4@>0 .nr toc*tab \\$4
2380 .if \\n[pg*cols-per-page]>1 .1C
2381 .ds H1txt \\*[Licon]
2388 .if d Ci .toc@read-Ci \\*[Ci]
2391 .ie \\n[Oc] .hd@set-page 1
2396 . PF "''\\\\\\\\n[toc*pn]''"
2402 .while \\n+[toc*i]<10 \{\
2403 . if !'\\$\\n[toc*i]'' \{\
2409 .if \\n[.$]<=4 .if d TX .TX
2410 .ie d TY .if \\n[.$]<=4 .TY
2417 .if d toc*list .toc*list
2419 .\" print LIST OF XXX
2420 .if d lix*dsfg .lix@print-ds fg FG "\\*[Lf]" \\n[.$]
2421 .if d lix*dstb .lix@print-ds tb TB "\\*[Lt]" \\n[.$]
2422 .if d lix*dsec .lix@print-ds ec EC "\\*[Le]" \\n[.$]
2423 .if d lix*dsex .lix@print-ds ex EX "\\*[Lx]" \\n[.$]
2426 .\" .toc@read-Ci lev1 lev2 lev3 lev4 ... lev7
2429 .while \\n+[toc*i]<8 \{\
2430 . nr toc*hl!\\n[toc*i] \\$\\n[toc*i]
2436 . toc@save \\$1 "\\*[hd*mark]" "\\$2" \\*[hd*sect-pg]
2438 .el .toc@save \\$1 "\\*[hd*mark]" "\\$2" \\n[%]
2443 .\" collect maxsize of mark if string Ci don't exist.
2445 . if !r toc*hl!\\$1 .nr toc*hl!\\$1 0
2446 . if \\n[toc*hl!\\$1]<=\w@\\$2@ \{\
2447 . nr toc*hl!\\$1 \w@\\$2@u
2451 .\" .toc@set level headernumber text pagenr
2452 .toc@set \\$1 "\\$2" "\\$3" \\$4
2456 .\" level mark text pagenumber
2458 .if \\$1<=\\n[toc*slevel] .SP \\n[toc*spacing]u
2464 . nr toc*ind +\\n[toc*hl!\\$1]u
2467 . while \\n+[toc*i]<\\$1 \{\
2468 . nr toc*ind +\\n[toc*hl!\\n[toc*i]]u
2471 .nr toc*text \\n[toc*ind]u+\\n[toc*hl!\\$1]u
2473 .ti -\\n[toc*hl!\\$1]u
2475 .\" length of headernum space
2476 .nr toc*i \\n[toc*hl!\\$1]-\w@\\$2@
2478 .ll \\n[@ll]u-\w@\\$4@u-2m
2480 .\" ragged right ---------------------------------
2481 .ie \\$1>\\n[toc*tlevel] \{\
2488 . \" unnumbered heading --------------------
2493 . \" normal heading ------------------------
2501 . nr toc*sep (u;\\n[.l]-\\n[.n]-\\n[.i]-\w@\\$4@)-1m
2502 \h'|\\n[.n]u'\l'\\n[toc*sep]u.'\h'1m'\\$4
2506 .\"########################### module lix ############################
2507 .\" LIST OF figures, tables, exhibits and equations
2518 .lix@print-line fg Lf \\n+[lix*fg-nr] "\\$1" "\\$2" "\\$3" "\\$4"
2521 .lix@print-line tb Lt \\n+[lix*tb-nr] "\\$1" "\\$2" "\\$3" "\\$4"
2524 .lix@print-line ec Le \\n+[lix*ec-nr] "\\$1" "\\$2" "\\$3" "\\$4"
2527 .lix@print-line ex Lx \\n+[lix*ex-nr] "\\$1" "\\$2" "\\$3" "\\$4"
2530 .\" print line with 'figure' in the text
2531 .\" type stringvar number text override flag refname
2535 .ie \\n[Sectf] .ds lix*numb \\n[H1]-\\$3
2536 .el .ds lix*numb \\$3
2538 .ie !\\n[Of] .ds lix*ds-form .\ \ \"
2539 .el .ds lix*ds-form "\ \(em\ \"
2541 .ds lix*label \\*[Li\\$1]\ \\*[lix*numb]\\*[lix*ds-form]
2543 . if !0\\$6 .ds lix*label \\*[Li\\$1]\ \\$5\\*[lix*numb]\\*[lix*ds-form]
2544 . if 0\\$6=1 .ds lix*label \\*[Li\\$1]\ \\*[lix*numb]\\$5\\*[lix*ds-form]
2545 . if 0\\$6=2 .ds lix*label \\*[Li\\$1]\ \\$5\\*[lix*ds-form]
2547 .\" print line if not between DS/DE
2548 .ie \\n[ds*lvl]<1&\\n[df*float]=0 \{\
2549 . lix@print-text "\\*[lix*label]" "\\*[lix*text]" \\$1 \\$2 \\$7
2552 . lix@embedded-text "\\*[lix*label]" "\\*[lix*text]" \\$1 \\$2 \\$7
2557 .\" label text type stringvar refname
2559 .ie \\n[Sectp] .ds lix*pgnr \\*[hd*sect-pg]
2560 .el .ds lix*pgnr \\n[%]
2565 .ie (\w@\\$1\\$2@)>(\\n[.l]-\\n[.i]) \{\
2573 .\" save line for LIST OF XXX, wth is the width of the label
2574 .if !r lix*wth\\$3 .nr lix*wth\\$3 0
2575 .\" find the maximum width
2576 .if \w@\\*[lix*label]@>\\n[lix*wth\\$3] .nr lix*wth\\$3 \w@\\*[lix*label]@
2577 .if \\n[\\$4] .lix@ds-save \\$3 \\*[lix*pgnr] "\\*[lix*text]" "\\*[lix*label]"
2578 .\" save reference to the figure
2579 .if !'\\$5'' .SETR \\$5 \\*[lix*numb]
2581 .\" hide printout until diversion is evaluated
2582 .de lix@embedded-text
2583 \!.ie \\\\n[Sectp] .ds lix*pgnr \\\\*[hd*sect-pg]
2584 \!.el .ds lix*pgnr \\\\n[%]
2590 \!.ie (\w@\\$1\\$2@)>(\\\\n[.l]-\\\\n[.i]) \{\
2601 .\" save line for LIST OF XXX, wth is the width of the label
2602 \!.if !r lix*wth\\$3 .nr lix*wth\\$3 0
2603 .\" find the maximum width
2604 \!.if \w@\\*[lix*label]@>\\\\n[lix*wth\\$3] .nr lix*wth\\$3 \w@\\*[lix*label]@
2605 \!.if \\\\n[\\$4] .lix@ds-save \\$3 \\\\*[lix*pgnr] "\\*[lix*text]" "\\*[lix*label]"
2606 .\" save reference to the figure
2607 \!.if !'\\$5'' .SETR \\$5 \\*[lix*numb]
2610 .\" print complete list of XXXX
2612 .\" arg: fg,tb,ec,ex text
2615 .if !\\n[Cp] .pg@next-page
2616 .\" print LIST OF XXXX
2617 .\" execute user-defined macros
2618 .if \\$4<=4 .if d TX\\$2 .TX\\$2
2619 .ie d TY\\$2 .if \\$4<=4 .TY\\$2
2625 .in \\n[lix*wth\\$1]u
2630 .\" save line of list in macro
2632 .\" type pagenumber text
2634 .lix@dsln \\$1 \\$2 "\\$3" "\\$4" \\$5
2638 .\" print appended macro
2639 .\" lix@dsln type pagenumber text headernr
2641 .nr lix*i \\n[lix*wth\\$1]-\w@\\$4@
2643 .ll \\n[@ll]u-\w@\\$4@u-\w@\\$2@u-2m
2644 .ti -\\n[lix*wth\\$1]u
2650 .nr lix*sep (u;\\n[.l]-\\n[.n]-\\n[.i]-\w@\\$2@)-1m
2651 \h'|\\n[.n]u'\l'\\n[lix*sep]u.'\h'1m'\\$2
2652 .SP \\n[toc*spacing]u
2654 .\"########################### module fnt ############################
2655 .\" some font macros.
2664 .nr fnt*prev \\n[.f]
2666 .while \\n+[fnt*i]<=\\n[.$] \{\
2667 . if \\n[fnt*i]>3 .as fnt*tmp \,
2668 . ie (\\n[fnt*i]%2)=1 .as fnt*tmp \\$1\\$[\\n[fnt*i]]
2669 . el .as fnt*tmp \\$2\\$[\\n[fnt*i]]
2670 . if \\n[fnt*i]<\\n[.$] .as fnt*tmp \/
2672 \&\\*[fnt*tmp]\f[\\n[fnt*prev]]
2676 .ie \\n[.$] .fnt@switch \fB \f[\\n[.f]] \\$@
2680 .ie \\n[.$] .fnt@switch \fI \f[\\n[.f]] \\$@
2684 .if \\n[.$] .fnt@switch \fI \fB \\$@
2687 .if \\n[.$] .fnt@switch \fB \fI \\$@
2690 .if \\n[.$] .fnt@switch \fI \fR \\$@
2693 .if \\n[.$] .fnt@switch \fR \fI \\$@
2696 .if \\n[.$] .fnt@switch \fR \fB \\$@
2699 .if \\n[.$] .fnt@switch \fB \fR \\$@
2701 .\"########################### module box ############################
2702 .\" draw a box around some text. Text will be kept on the same page.
2705 .\" .B1 and .B2 works like .DS
2707 .if \\n[box*ll] .@error "B1: missing B2"
2710 .nr box*hyp \\n[.hy]
2711 .nr box*wid \\n[.l]-\\n[.i]
2713 .\" jump to new environment.
2719 .ll (u;\\n[box*wid]-1n)
2723 .if !\\n[box*ll] .@error "B2: missing B1"
2726 .nr box*height \\n[dn]
2730 .nr box*y-pos \\n[.d]u
2735 \D'l \\n[box*wid]u 0'\
2736 \D'l 0 -\\n[box*height]u'\
2737 \D'l -\\n[box*wid]u 0'\
2738 \D'l 0 \\n[box*height]u'
2748 .\"########################### module ref ############################
2752 .nr ref*flag 0 \" for end-of-text
2753 .ds Rf \v'-.4m'\s-3[\\n+[ref*nr]]\s0\v'.4m'
2758 .if !''\\$1' .ds \\$1 \v'-.4m'\s-3[\\n[ref*nr]]\s0\v'.4m'
2761 .ref@start-print \\n[ref*nr]
2776 .in \\n[ref*nr-width]u
2777 .ti -(\w@\\$1.@u+1n)
2790 .if \\n[Ls] .SP \\n[Lsp]u
2794 .if !d ref*mac .@error "RP: No references!"
2796 .if \\n[ref*i]<2 .SK
2799 .if 0\\$1<1 .nr ref*nr 0 1
2800 .if ((\\n[ref*i]=0):(\\n[ref*i]=2)) .SK
2803 .\" called by end-of-text!
2805 .\".if \\n[ref*flag] \{
2807 . if \\n[D]>2 .tm Print references, called by eot
2819 .\" prints the references
2821 .toc@save 1 "" "\\*[Rp]" \\n[%]
2826 .misc@ev-keep ref*ev
2835 .\"########################### module app ############################
2843 .\" name == "" -> autonumber
2845 .\" .if \\n[.$]<2 .@error "APP: too few arguments"
2851 .ie \\n[Aph] .app@header \\*[app*ind] "\\$2"
2853 .app@index "\\*[app*ind]" "\\$2"
2856 .\" .APPSK name pages text
2857 .\" name == "" -> autonumber
2859 .if \\n[.$]<2 .@error "APPSK: too few arguments"
2865 .ie \\n[Aph] .app@header \\*[app*ind] "\\$3"
2867 .app@index "\\*[app*ind]" "\\$3"
2872 .ie \w@\\$1@ .ds app*ind \\$1
2874 . if !\\n[app*flag] \{\
2880 . ds app*ind \\n+[app*nr]
2881 . nr H1 \\n+[app*dnr]
2882 . nr H1h \\n[app*dnr]
2884 .\" clear lower counters
2886 .while \\n+[app*i]<8 .nr H\\n[app*i] 0 1
2890 .toc@save 1 "" "\\*[App] \\$1: \\$2" \\n[%]
2893 .\" app@heaer name text
2898 \s+4\fB\\*[App]\ \\$1\fP\s0
2900 .if \w@\\$2@<\\n[.l] .ce 1
2904 .als APPX app@header
2905 .\"########################### module cov ############################
2906 .\" title stored in diversion cov*title
2907 .\" abstract stored in diversion cov*abstract
2908 .\" arg to abstract stored in cov*abs-arg
2909 .\" indent stored in cov*abs-ind
2910 .\" number of authors stored in cov*au
2911 .\" author(s) stored in cov*au!x!y
2912 .\" author(s) title stored in cov*at!x!y
2913 .\" x is the author-index [1-cov*au], y is the argument-index [1-9].
2914 .\" author(s) firm stored in cov*firm
2915 .\" new date (if .ND exists) is stored in cov*new-date
2918 .ds cov*abs-name ABSTRACT
2922 .rm IA IE WA WE LO LT
2923 .if \\n[.$]>0 .ds cov*title-charge-case \\$1
2924 .if \\n[.$]>1 .ds cov*title-file-case \\$2
2925 .pg@disable-top-trap
2929 .\"-------------------
2933 .\"-------------------
2934 .\" .AU name [initials [loc [dept [ext [room [arg [arg [arg]]]]]]]]
2937 .pg@disable-top-trap
2940 .ds cov*au!\\n[cov*au]!1
2941 .while \\n[.$]>=\\n+[cov*i] \{\
2942 . ds cov*au!\\n[cov*au]!\\n[cov*i] "\\$[\\n[cov*i]]
2944 .if (\\n[.$]>=3)&(\w@\\$3@) \{\
2945 . if d cov*location-\\$3] \{\
2946 . ds cov*au!3!\\n[cov*au] \\*[cov*location-\\$3]
2950 .\"-------------------
2951 .\" .AT title1 [title2 [... [title9] ]]]]
2952 .\" Well, thats all that COVEND look for.
2953 .\" Must appear directly after .AU
2955 .if \\n[.$]<1 .@error "AT: no arguments"
2957 .while \\n[.$]>=\\n+[cov*i] \{\
2958 . ds cov*at!\\n[cov*au]!\\n[cov*i] "\\$[\\n[cov*i]]
2961 .\"-------------------
2964 .if !''\\$1' .ds cov*firm \\$1
2967 .ds cov*abs-name \\$1
2970 .pg@disable-top-trap
2971 .if d cov*abstract .@error "AS: only one abstract allowed"
2972 .if !''\\n[.z]' .@error "AS: no diversion allowed (previous .AS?)"
2973 .nr cov*abs-arg 0\\$1
2974 .nr cov*abs-ind (n;0\\$2)
2979 .\" fixed for 2000, now uses \n[year].
2981 . \" support for ISO-date
2987 . ds cov*new-date \\*[MO\\n[mo]] \\n[dy], \\n[year]
2990 . ds cov*new-date \\n[year]-\\n[cov*mm]-\\n[cov*dd]
2994 .als DT cov*new-date
2996 .ds cov*new-date \\$1
2998 .\" switch to ISO-date if register Iso exist: YYYY-MM-DD
2999 .if r Iso .ISODATE 1
3000 .\"-------------------
3001 .\" save technical numbers.
3004 .while \\n[.$]>=\\n+[cov*i] .ds cov*mt-tm!\\n[cov*i] \\$[\\n[cov*i]]
3005 .nr cov*mt-tm-max \\n[.$]
3007 .\"-----------------------
3009 .\" the file must have the following last lines (somewhere):
3010 .\" .pg@enable-top-trap
3013 .ds cov*mt-file!0 0.MT
3014 .ds cov*mt-file!1 0.MT
3015 .ds cov*mt-file!2 0.MT
3016 .ds cov*mt-file!3 0.MT
3017 .ds cov*mt-file!4 4.MT
3018 .ds cov*mt-file!5 5.MT
3019 .ds cov*mt-file!6 0.MT
3023 . ie d cov*mt-file!\\$1 .ds cov*mt-type \\$1
3024 . el .ds cov*mt-type 6
3026 .el .ds cov*mt-type 1
3027 .ds cov*mt-addresse "\\$2
3028 .ds cov*mt-type-text "\\$1
3029 .ie d @language .ds cov*str mm/\\*[@language]_
3031 .mso \\*[cov*str]\\*[cov*mt-file!\\*[cov*mt-type]]
3034 .ie !\\n[.$] .ds cov*cov-type ms
3035 .el .ds cov*cov-type \\$1
3036 .pg@disable-top-trap
3037 .ie d @language .ds cov*str mm/\\*[@language]_\\*[cov*cov-type].cov
3038 .el .ds cov*str mm/\\*[cov*cov-type].cov
3041 .\"########################### module qrf ############################
3042 .\" forward and backward reference thru special files.
3044 .\" check if stderr-method is wanted
3045 .\" This was needed when I discovered that groff was considered unsafe
3046 .\" and groff -U didn't work. It's a workaround like the original
3047 .\" index method, but not in my view elegant enough.
3049 .\" init reference system
3051 .ds qrf*file \\$1.qrf
3053 .if \\n[D]>1 .tm INITR: source \\*[qrf*file]
3055 . tm .\\\\" Rfilename: \\*[qrf*file]
3057 .el 'so \\*[qrf*file]
3060 .\" set a reference.
3062 .if \\n[.$]<1 .@error "SETR:reference name missing"
3063 .if !r qrf*pass .tm "SETR: No .INITR in this file"
3065 . ds qrf*name qrf*ref-\\$1
3066 . if \\n[D]>2 .tm SETR: ref \\*[qrf*name]=\\*[hd*mark],\\n[%]
3068 . ds \\*[qrf*name]-hn \\*[hd*mark]
3070 . ds \\*[qrf*name]-pn \\n[%]
3073 . tm .ds \\*[qrf*name]-hn \\*[hd*mark]
3074 . tm .ds \\*[qrf*name]-pn \\n[%]
3075 . if !'\\$2'' .tm .ds \\*[qrf*name]-xx \\$2
3081 .\" If two arg -> set var. arg to misc-string.
3083 .if \\n[.$]<1 .@error "GETST:reference name missing"
3084 .if !r qrf*pass .tm "GETST: No .INITR in this file"
3085 .ds qrf*name qrf*ref-\\$1
3086 . if d \\*[qrf*name]-xx \{\
3087 . ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-xx]
3088 . el \\*[\\*[qrf*name]-xx]\c
3093 .\" get header-number
3094 .\" If two arg -> set var. arg to header-number.
3096 .if \\n[.$]<1 .@error "GETHN:reference name missing"
3097 .if !r qrf*pass .tm "GETHN: No .INITR in this file"
3098 .ds qrf*name qrf*ref-\\$1
3099 .if d \\*[qrf*name]-hn \{\
3100 . ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-hn]
3101 . el \\*[\\*[qrf*name]-hn]\c
3106 .\" If two arg -> set var. arg to page-number.
3108 .if \\n[.$]<1 .@error "GETPN:reference name missing"
3109 .if !r qrf*pass .tm "GETPN: No .INITR in this file"
3110 .ds qrf*name qrf*ref-\\$1
3111 .if d \\*[qrf*name]-pn \{\
3112 . ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-pn]
3113 . el \\*[\\*[qrf*name]-pn]\c
3118 .if \\n[.$]<1 .@error "GETR:reference name missing"
3120 . tm "GETR: No .INITR in this file"
3128 .\"########################### module ind ############################
3129 .\" Support for mgs-style indexing, borrowed from mgs.
3131 . tm \\$1\t\\$2\t\\$3\t\\$4 ... \\n[%]
3133 .\"--------------------
3134 .\" Another type of index system
3135 .\" INITI type filename [macro]
3137 .if \\n[.$]<1 .@error "INITI:type missing"
3138 .\" ignore if INITI has already been used
3140 . if d ind*file .@error "INITI:file already set"
3141 . ds ind*file \\$2.ind
3142 . if \\n[D]>1 .tm INITI: source \\*[ind*file]
3144 .if !d ind*file .@error "INITI:file not specified"
3147 . if \\n[.$]>2 .tm .\\\\" Imacro: \\$3
3152 .if !d ind*file .@error "IND: No active INITI"
3153 .if \\n[D]>1 .tm IND: type=\\*[ind*type]
3155 .if '\\*[ind*type]'N' .ds ind*ref \\n[%]
3156 .if '\\*[ind*type]'H' .ds ind*ref \\*[hd*mark]
3157 .if '\\*[ind*type]'B' .ds ind*ref \\*[hd*mark]\t\\n[%]
3158 .if '\\*[ind*ref]'' .@error "IND:wrong index type: \\*[ind*ref]"
3161 .while \\n[.$]>0 \{\
3163 . as ind*line \t\\$1
3165 .as ind*line \\*[ind*ref]
3166 .if \\n[Ref] .tm .\\\\" IND \\*[ind*line]
3170 .ie \\n[Ref] .tm .\\\\" Index: \\*[ind*file]
3172 . if !\\n[Cp] .pg@next-page
3174 . \" execute user-defined macros
3194 .\"########################### module let ############################
3196 .\"------------------------
3200 .ie \\n[.$] .ds let*i \\$1
3201 .el .ds let*i \\*[Letfc]
3202 .ie d let*type .let@fc_\\*[let*type] "\\*[let*i]" \\$@
3203 .el .let@mt-closing "\\*[let*i]" \\$@
3213 .\"------------------------
3216 .ie d let*type .let*lt-sign \\$@
3217 .el .let*mt-sign \\$@
3219 .\"------------------------
3221 .if !d let@sg_\\*[let*type] .@error "SG: letter type \\*[let*type] undefined"
3225 .while \\n+[let*i]<=\\n[let*wa-n] \{\
3226 .if \\n[let*i]=\\n[let*wa-n] .nr let*j 1
3227 .let@sg_\\*[let*type] "\\*[let*wa-name!\\n[let*i]]" "\\*[let*wa-title!\\n[let*i]]" \\n[let*i] \\n[let*j] \\$@
3230 .\"------------------------
3231 .\" Memorandum signature
3235 .ie \\n[.$]>1 .nr let*k 1
3236 .el .nr let*k \\n[cov*au]
3237 .ds let*tmp \\*[cov*au!\\n[let*k]!3]-\\*[cov*au!\\n[let*k]!4]-
3239 .while \\n+[let*i]<=\\n[cov*au] \{\
3240 . if \\n[let*i]>1 .as let*tmp /
3241 . as let*tmp \\*[cov*au!\\n[let*k]!2]
3243 .if !''\\$1' .as let*tmp -\\$1
3247 .while \\n+[let*i]<=\\n[cov*au] \{\
3249 . if \\n[let*i]=\\n[let*k] \{\
3250 \Z'\h'-(u;\\n[.l]/2)'\\*[let*tmp]'\c
3252 \\*[cov*au!\\n[let*i]!1]
3257 .\"------------------------
3258 .\" Approval signature
3263 .ie \\n[.$]<2 \\*[Letapp]
3266 .ie n ______________________________ ______________
3267 .el \D'l 25m 0'\h'4m'\D'l 12m 0'
3268 \Z'\\$1'\h'29m'\f[\\*[@sdf_font]]\\*[Letdate]\fP
3271 .\"------------------------
3272 .\" Letter signature
3277 .ie n ______________________________
3282 .\"------------------------
3284 .\" let@header is called from the header. It is supposed
3285 .\" to remove the alias itself.
3287 .rm AF AS AE AT AU CS OK TL MT
3291 .if !''\\$1' .ds let*type \\$1
3292 .if !d let@head_\\*[let*type] .@error "LT: unknown letter type \\$1"
3294 .als let@header let@head_\\*[let*type]
3295 .let@init_\\*[let*type] \\$@
3296 .if \n[D]>1 .tm Letter type \\*[let*type]
3315 .if \w'\\$5'&\\$4 \\$5
3318 .als let@fc_BL let@mt-closing
3320 .\" Semiblocked letter
3328 .als let@sg_SB let@sg_BL
3329 .als let@fc_SB let@mt-closing
3331 .\" Full-blocked letter
3345 .if \w'\\$5'&\\$4 \\$5
3354 .\" Simplified letter
3365 .misc@toupper "\\$1, \\$2"
3367 .if \w'\\$5'&\\$4 \\$5
3373 .\"--------------------------------------
3374 .\" Print the letter-head
3378 .if '1'\\$1' .in (u;\\n[.l]/2)
3380 .ie d let@wa-div .let@wa-div
3385 .if '1'\\$1' .if !d let*lo-CN .if !d let*lo-RN .sp 2
3386 .\" ---- Confidential
3389 . ie !''\\*[let*lo-CN]' \\*[let*lo-CN]
3395 \\*[LetRN] \\*[let*lo-RN]
3402 .while \\n+[let*i]<=\\n[let*ia-n] \{\
3403 \\*[let*ia-name!\\n[let*i]]
3404 \\*[let*ia-title!\\n[let*i]]
3406 .if d let@ia-div .let@ia-div
3410 \\*[LetAT] \\*[let*lo-AT]
3413 .if !'\\*[let*type]'SP' .if d let*lo-SA \{\
3416 . ie !''\\*[let*lo-SA]' \\*[let*lo-SA]
3421 . ie '\\*[let*type]'SP' \{\
3423 . misc@toupper \\*[let*lo-SJ]
3428 . if '\\*[let*type]'SB' .ti +5m
3429 \\*[LetSJ] \f[\\*[@sdf_font]]\\*[let*lo-SJ]\fP
3433 .\"-------------------
3434 .\" .IA [name [title]]
3437 .if \\n[.$] .ds let*ia-name!\\n+[let*ia-n] \\$1
3438 .if \\n[.$]>1 .ds let*ia-title!\\n[let*ia-n] \\$2
3450 .\"-------------------
3451 .\" .WA [name [title]]
3454 .if \\n[.$] .ds let*wa-name!\\n+[let*wa-n] \\$1
3455 .if \\n[.$]>1 .ds let*wa-title!\\n[let*wa-n] \\$2
3460 .it \\n[Letwam] let@wa-drain
3475 .if d let@wa-junk .rm let@wa-junk
3477 .\"-------------------
3481 .ie !''\\$2' .ds let*str \\$1
3484 . ie !\w'\\$1' .ds let*str \\*[Letns!\\*[Letnsdef]]
3486 . ie d Letns!\\$1 .ds let*str \\*[Letns!\\$1]
3487 . el .ds let*str \\*[Letns!copy](\\$1)\\*[Letns!to]
3490 . el .ds let*str \\*[Letns!\\*[Letnsdef]]
3499 .\"-------------------
3502 .rm AF AS AE AT AU CS OK TL MT
3503 .if ''\\$1' .@error "LO: missing option"
3504 .if !d Let\\$1 .@error "LO: unknown option (\\$1)"
3505 .ds let*lo-\\$1 \\$2
3506 .if \n[D]>1 .tm Letter option \\$1 \\$2
3508 .\"--------------------
3509 .\" Start with a clean slate