6 .\" $Id: m.tmac,v 2.15 2002/08/07 23:23:34 wlemb Exp $
7 .@revision $Revision: 2.15 $
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)
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*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.])
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
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 .\" check if there are any bottom block
1273 .if d pg*block-div .pg@block
1275 .\" print the footer and eject new page
1278 .\" user defined end-of-page macro
1281 . ie o .tl \\*[pg*odd-footer]
1282 . el .tl \\*[pg*even-footer]
1283 . ie (\\n[%]=1)&(\\n[N]=1) .tl \\*[pg*header]
1284 . el .tl \\*[pg*footer]
1285 . tl ''\\*[Pg_type!\\n[@copy_type]]''
1288 .\" be sure that floating displays and footnotes will be
1289 .\" printed at the end of the document.
1290 .ie (\\n[df*fnr]>=\\n[df*o-fnr]):\\n[ft*exist] \{\
1297 .\"-------------------------
1299 .\" Initialize the title environment
1315 .\"-------------------------
1325 .ds pg*odd-header "\\$1
1329 .ds pg*even-header "\\$1
1333 .ds pg*odd-footer "\\$1
1337 .ds pg*even-footer "\\$1
1355 .\"-------------------------
1356 .\" end of page processing
1359 .\" output footnotes. set trap for block
1362 .\"-------------------------
1363 .\" print bottom block
1373 .\"-------------------------
1374 .\" define bottom block
1376 .misc@ev-keep pg*block-ev
1381 .\"-------------------------
1385 .nr pg*block-size \\n[dn]u
1389 .\"-------------------------
1390 .\" print out all pending text
1392 .if \\n[D]>2 .tm ---------- End of text processing ----------------
1396 .\"-------------------------
1397 .\" set top and bottom margins
1398 .\" -T sets pg*footer-size and pg*header-size instead
1403 . nr pg*footer-size 5v
1404 . nr pg*header-size 7v
1406 . if \\n[.$]>0 .nr pg*header-size (v;\\$1)
1407 . if \\n[.$]>1 .nr pg*footer-size (v;\\$2)
1411 . nr pg*extra-footer-size 0
1412 . nr pg*extra-header-size 0
1414 . if \\n[.$]>0 .nr pg*extra-header-size (v;\\$1)
1415 . if \\n[.$]>1 .nr pg*extra-footer-size (v;\\$2)
1417 . tm extra top \\n[pg*extra-footer-size]
1418 . tm extra bottom \\n[pg*extra-header-size]
1423 .\"---------------------
1424 .\" multicolumn output.
1426 .if \\n[pg*cols-per-page]>1 \{\
1427 . ll \\n[pg*column-size]u
1431 .if \\n[pg*cols-per-page]>1 \{\
1432 . ie \\n+[pg*cur-column]>=\\n[pg*cols-per-page] \{\
1433 . nr pg*cur-column 0 1
1434 . nr pg*cur-po \\n[@po]u
1439 . nr pg*cur-po +(\\n[pg*column-size]u+\\n[pg*column-sep]u)
1440 . po \\n[pg*cur-po]u
1441 ' sp |\\n[pg*head-mark]u
1446 .\" An argument disables the page-break.
1449 .if \\n[pg*cols-per-page]<=1 .@error "1C: multicolumn mode not active"
1450 .nr pg*cols-per-page 1
1452 .nr pg*column-size \\n[@ll]
1453 .nr pg*ncol-i \\n[pg*cur-column]\" temp variable
1454 .nr pg*cur-column 0 1
1455 .nr pg*cur-po \\n[@po]u
1460 . if \\n[pg*ncol-i]>0 \{\
1461 . @warning 1C: footnotes will be messy
1464 . if \\n[pg*last-ncol]>0 \{\
1465 . sp |\\n[pg*last-ncol]u
1472 .nr pg*head-mark \\n[nl]u
1473 .if \\n[pg*cols-per-page]>1 .@error "2C: multicolumn mode already active"
1474 .nr pg*cols-per-page 2
1475 .nr pg*column-sep \\n[@ll]/15
1476 .nr pg*column-size (\\n[@ll]u*7)/15
1477 .nr pg*cur-column 0 1
1478 .nr pg*cur-po \\n[@po]u
1479 .ll \\n[pg*column-size]u
1480 .\" .lt \\n[pg*column-size]u
1482 .\" MC column-size [ column-separation ]
1485 .nr pg*head-mark \\n[nl]u
1486 .if \\n[pg*cols-per-page]>1 .@error "MC: multicolumn mode already active"
1487 .ie ''\\$1' .nr pg*column-size \\n[.l]
1488 .el .nr pg*column-size (n;\\$1)
1489 .ie ''\\$2' .nr pg*column-sep \\n[pg*column-size]/15
1490 .el .nr pg*column-sep (n;\\$2)
1492 .\" calculate the number of columns/page
1493 .nr pg*cols-per-page 0
1494 .nr pg*i \\n[pg*column-size]
1495 .while \\n[pg*i]<=\\n[.l] \{\
1496 . nr pg*cols-per-page \\n[pg*cols-per-page]+1
1497 . nr pg*i \\n[pg*i]+\\n[pg*column-sep]+\\n[pg*column-size]
1499 .nr pg*cur-column 0 1
1500 .nr pg*cur-po \\n[@po]u
1501 .ll \\n[pg*column-size]u
1502 .\" .lt \\n[pg*column-size]u
1504 .\" begin a new column
1507 .if \\n[nl]>\\n[pg*last-ncol] .nr pg*last-ncol \\n[nl]
1515 .\" force new page by writing something invisible.
1516 .while \\n+[pg*i]<=(0\\$1) \{\
1521 .\"-------------------------------
1522 .\" MULB width1 space1 width2 space2 width3 space3 ...
1530 . nr pg*mul!\\n+[pg*i] (n;0\\$1)
1531 . nr pg*muls!\\n[pg*i] (n;0\\$2)
1534 .nr pg*mul-max-col \\n[pg*i]
1535 .ds pg*mul-fam \\n[.fam]
1536 .nr pg*mul-font \\n[.f]
1540 .fam \\*[pg*mul-fam]
1541 .ft \\n[pg*mul-font]
1549 .if \\n[pg*mul-x]>=\\n[pg*mul-max-col] .@error "MULN: Undefined columnwidth"
1551 .if \\n[.d]>\\n[pg*mul-last] .nr pg*mul-last \\n[.d]
1553 .in \\n[pg*mul-ind]u
1554 .ll (u;\\n[.i]+\\n[pg*mul!\\n+[pg*mul-x]])u
1555 .nr pg*mul-ind +(u;\\n[pg*mul!\\n[pg*mul-x]]+\\n[pg*muls!\\n[pg*mul-x]])
1561 .if \\n[.d]>\\n[pg*mul-last] .nr pg*mul-last \\n[.d]
1564 .ne \\n[pg*mul-last]u
1569 .sp \\n[pg*mul-last]u
1575 .ie o .if !\\n[pg*head-mark]=\\n[nl] \{\
1581 .\"########### module footnotes ###################
1586 .nr ft*hyphen 0\" hyphenation value
1587 .nr ft*adjust 1\" >0 if adjust true
1588 .nr ft*indent 1\" >0 if text indent true (not imp. $$$)
1589 .nr ft*just 0\" 0=left justification, 1=right (not imp. $$$)
1590 .nr ft*exist 0\" not zero if there are any footnotes to be printed
1591 .nr ft*clear-at-header 0\" >0 if footnotes should be reset at first level head.
1593 .ds F \v'-.4m'\s-3\\n+[ft*nr]\s0\v'.4m'
1595 .\"-----------------
1596 .\" init footnote environment
1598 .\" indentcontrol not implemented $$$
1599 .\" label justification not implemented $$$
1602 .ie \\n[ft*adjust] 'ad
1604 .ie \\n[ft*hyphen] 'hy 14
1611 .\"-----------------
1612 .\" set footnote format
1613 .\" no support for two column processing (yet). $$$
1615 .if \\n[.$]=0 .@error "FD: bad arg \\$1"
1616 .ie \\n[.$]=2 .nr ft*clear-at-header 1
1617 .el .nr ft*clear-at-header 0
1620 . ie \\$1>11 .nr ft*format 0
1621 . el .nr ft*format \\$1
1623 . nr ft*hyphen (\\n[ft*format]%2)*14
1624 . nr ft*format \\n[ft*format]/2
1626 . nr ft*adjust 1-(\\n[ft*format]%2)
1627 . nr ft*format \\n[ft*format]/2
1629 . nr ft*indent 1-(\\n[ft*format]%2)
1630 . nr ft*format \\n[ft*format]/2
1632 . nr ft*just \\n[ft*format]%2
1636 .\" Footnote and display width control $$$
1639 .while \\n+[ft*i]<=\\n[.$] \{\
1640 . ds ft*x \\$[\\n[ft*i]]
1641 . if '\\*[ft*x]'N' \{\
1645 . nr ds*float-break 1
1647 . if '\\*[ft*x]'-WF' .nr ft*wide 0
1648 . if '\\*[ft*x]'WF' .nr ft*wide 1
1649 . if '\\*[ft*x]'-FF' .nr ft*first-fn 0
1650 . if '\\*[ft*x]'FF' .nr ft*first-fn 1
1651 . if '\\*[ft*x]'-WD' \{\
1653 . if r ft*df-save \{\
1654 . nr Df \\n[ft*df-save]
1658 . if '\\*[ft*x]'WD' \{\
1660 . nr ft*df-save \\n[Df]
1663 . if '\\*[ft*x]'-FB' .nr ds*float-break 0
1664 . if '\\*[ft*x]'FB' .nr ds*float-break 1
1665 . if \\n[D]>1 .tm WC WF=\\n[ft*wide] WD=\\n[ds*wide]
1668 .\"-----------------
1670 .\" Change environment, switch to diversion and print the foot-note mark.
1672 .if \\n[ft*busy] .@error "FS: missing FE"
1676 .if !\\n[ft*wide] .pg@set-po
1678 .nr ft*space (u;\\n[Fs]*\\n[Lsp])
1681 .ie \\n[.$] .ds ft*mark \\$1
1682 .el .ds ft*mark \\n[ft*nr].
1688 .\"-----------------
1689 .\" init footnote diversion
1690 .de ft@init-footnote
1695 .nr ft*note-size \\n[dn]
1697 .\"-----------------
1699 .\" End the diversion, back to previous environment, and adjust
1700 .\" the trap to the new foot-note size.
1707 .if \\n[@pl]u<\\n[dn]u .@error "FE: too big footnote"
1708 .if !d ft*div .nr dn +1v
1709 .if \\n[D]>3 .tm FE: foot-trap=\\n[pg*foot-trap] .d=\\n[.d] dn=\\n[dn]
1710 .ie (\\n[pg*foot-trap]u-\\n[.d]u)<\\n[dn]u \{\
1717 . if !d ft*div .ft@init-footnote
1721 . nr ft*note-size +\\n[dn]
1727 .\"-----------------
1728 .\" print footnotes, see pg@footer
1741 .\"-----------------
1742 .\" check if any pending footnotes, see pg@header
1744 .if d ft*next-div \{\
1753 . nr ft*note-size +\\n[dn]
1760 .\"########### module display ###################
1761 .nr ds*wide 0\" >0 if wide displays wanted
1762 .nr df*fnr 0 1\" floating display counter
1763 .nr df*o-fnr 1\" floating display counter, already printed
1764 .nr ds*snr 0 1\" static display counter
1765 .nr ds*lvl 0 1\" display level
1766 .nr ds*float-busy 0\" >0 if printing float
1767 .nr df*float 0 >0 if previous display was floating
1768 .\"--------------------------------------------
1770 .ie \\n[df*float] .df@end \\$@
1773 .\"--------------------------------------------
1774 .\" floating display start
1775 .\" nested DF/DE is not allowed.
1777 .if \\n[df*float] .@error "DF:nested floating is not allowed. Use DS."
1780 .nr df*old-ll \\n[.l]
1789 .ds@set-new-ev \\n[df*old-ll]
1793 .\"--------------------------------------------
1798 .nr df*width!\\n+[df*fnr] \\n[dl]
1799 .nr df*height!\\n[df*fnr] \\n[dn]
1800 .nr df*wide!\\n[df*fnr] \\n[ds*wide]
1801 .nr df*format!\\n[df*fnr] \\n[ds*format]
1803 .if \\n[D]>2 .tm DF:fnr=\\n[df*fnr] w=\\n[dl] h=\\n[dn] wide=\\n[ds*wide] \
1805 .\" move div to the floating display list
1806 .rn df*div df*fdiv!\\n[df*fnr]
1809 .\" print float if queue is empty and the display fits into
1810 .\" the current page
1811 .if ((\\n[df*fnr]>=\\n[df*o-fnr])&(\\n[dn]<\\n[.t])) .df@print-float 1
1815 .\" called by end-of-text
1818 .if \\n[df*o-fnr]<=\\n[df*fnr] \{\
1819 . if \\n[D]>2 .tm Print remaining displays.
1820 .\" still some floats left, make non-empty environment
1829 .\" print according to Df and De.
1830 .\" .df@print-float type
1831 .\" type called from
1833 .\" 2 end of section
1834 .\" 3 end of document
1835 .\" 4 beginning of new page
1838 .if \\n[Df]>5 .@error "Df=\\n[Df], max value is 5"
1839 .if !\\n[ds*float-busy] \{\
1840 . nr ds*float-busy 1
1842 . if \\n[D]>3 .tm print-float: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1844 . if (\\$1=1)&((\\n[Df]=1):(\\n[Df]=5)) \{\
1845 . if \\n[.t]>\\n[df*height!\\n[df*o-fnr]] \{\
1846 . \" Print only new displays.
1847 . if \\n[df*o-fnr]=\\n[df*fnr] \{\
1849 . ds@print-one-float
1854 . if (\\$1=1)&(\\n[Df]=3) \{\
1855 . if \\n[.t]>\\n[df*height!\\n[df*o-fnr]] \{\
1857 . ds@print-one-float
1860 .\" print all if Df<2 and end of section
1861 . if (\\$1=2)&(\\n[Sectp]>0)&(\\n[Df]<2) \{\
1863 . ds@print-all-floats
1865 .\" print all if end of document. Where should they go instead?
1868 . ds@print-all-floats
1871 . if (\\$1=4)&(\\n[Df]>1) \{\
1872 . if \\n[Df]=2 .ds@print-one-float
1873 . if \\n[Df]=3 .ds@print-one-float
1875 . ie \\n[De] .ds@print-all-floats
1876 . el .ds@print-this-page
1879 . nr ds*float-busy 0
1884 .\" print a floating diversion
1886 .nr df*old-ll \\n[.l]
1887 .nr df*old-in \\n[.i]
1890 .nr df*i \\n[df*o-fnr]
1891 .nr df*f \\n[df*format!\\n[df*i]]
1894 .if \\n[df*f]=1 'in +\\n[Si]n
1895 .if \\n[df*f]>=2 'in 0
1896 .if \\n[df*f]=2 'ce 9999
1897 .if \\n[df*f]=3 'in (u;(\\n[.l]-\\n[df*width!\\n[df*i]])/2)
1898 .if \\n[df*f]=4 'rj 9999
1899 .if \\n[df*f]=5 'in (u;\\n[.l]-\\n[df*width!\\n[df*i]])
1902 .df*fdiv!\\n[df*o-fnr]
1904 .if \\n[df*f]=2 'ce 0
1905 .if \\n[df*f]=4 'rj 0
1907 .rm df*fdiv!\\n[df*i]
1908 .rm df*height!\\n[df*i]
1909 .rm df*format!\\n[df*i]
1910 .if \\n[df*wide!\\n[df*i]] .nr pg*head-mark \\n[nl]u
1914 .\" print one floating display if there is one.
1915 .de ds@print-one-float
1916 .if \\n[df*o-fnr]<=\\n[df*fnr] \{\
1917 . if \\n[D]>3 .tm print-one-float: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1918 . if \\n[.t]<\\n[df*height!\\n[df*o-fnr]] .pg@next-page
1920 . if \\n[De] .pg@next-page
1924 .\" print all queued floats.
1925 .\" if De>0 do a page eject between the floats.
1926 .de ds@print-all-floats
1927 .while \\n[df*o-fnr]<=\\n[df*fnr] \{\
1928 . if \\n[D]>3 .tm print-all-floats: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1929 . if \\n[.t]<\\n[df*height!\\n[df*o-fnr]] .pg@next-page
1933 . if \\n[De] .pg@next-page
1937 .\" print as many floats as will fit on the current page
1938 .de ds@print-this-page
1939 .while \\n[df*o-fnr]<=\\n[df*fnr] \{\
1940 . if \\n[D]>3 .tm print-this-page: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1941 . if \\n[.t]<\\n[df*height!\\n[df*o-fnr]] .break
1945 .\"---------------------------------------------------
1946 .\" get format of the display
1949 . ie r ds*format!\\$1 .nr ds*format \\n[ds*format!\\$1]
1950 . el .@error "DS/DF:wrong format:\\$1"
1953 .if \\n[D]>2 .tm set format=\\n[ds*format]
1954 .\" fill or not to fill, that is the...
1957 . ie r ds*fill!\\$2 .nr ds*fill \\n[ds*fill!\\$2]
1958 . el .@error "\\*[ds*type]:wrong fill:\\$2"
1960 .if \\n[D]>2 .tm set fill=\\n[ds*fill]
1962 .if \\n[.$]>2 .nr ds*rindent \\$3
1963 .if \\n[D]>2 .tm set indent=\\n[ds*rindent]
1965 .\"-----------------------------
1966 .\" .ds@set-new-ev previous-line-length
1970 .if \\n[ds*rindent] \{\
1971 . ll -\\n[ds*rindent]n
1972 . lt -\\n[ds*rindent]n
1974 .if \\n[ds*wide] \{\
1979 .ie \\n[ds*fill] 'fi
1982 .\"--------------------------------------------------------
1983 .nr ds*format 0\" dummy value for .En/.EQ
1984 .nr ds*format! 0\" no indent
1985 .nr ds*format!0 0\" no indent
1986 .nr ds*format!L 0\" no indent
1987 .nr ds*format!I 1\" indent
1988 .nr ds*format!1 1\" indent
1989 .nr ds*format!C 2\" center each line
1990 .nr ds*format!2 2\" center each line
1991 .nr ds*format!CB 3\" center as block
1992 .nr ds*format!3 3\" center as block
1993 .nr ds*format!R 4\" right justify each line
1994 .nr ds*format!4 4\" right justify each line
1995 .nr ds*format!RB 5\" right justify as block
1996 .nr ds*format!5 5\" right justify as block
1998 .nr ds*fill! 0\" no fill
1999 .nr ds*fill!N 0\" no fill
2000 .nr ds*fill!0 0\" no fill
2001 .nr ds*fill!F 1\" fill on
2002 .nr ds*fill!1 1\" fill on
2003 .\"--------------------------------------------
2004 .\" static display start
2005 .\" nested DS/DE is allowed. No limit on depth.
2012 .nr ds*old-ll \\n[.l]
2013 .nr ds*old-in \\n[.i]
2014 .misc@push ds-ll \\n[.l]
2015 .misc@push ds-form \\n[ds*format]
2018 .misc@ev-keep ds*ev!\\n+[ds*snr]
2022 .\" indent in a diversion doesn't seem like a good idea.
2024 .di ds*div!\\n[ds*snr]
2026 .ds@set-new-ev \\n[ds*old-ll]
2029 .\"--------------------------------------------
2031 .if \\n-[ds*lvl]<0 .@error "DE: no corresponding DS"
2035 .nr ds*width \\n[dl]
2036 .nr ds*height \\n[dn]
2037 .misc@pop-nr ds-ll ds*old-ll
2038 .misc@pop-nr ds-form ds*format
2042 .\" calculate needed space
2043 .nr ds*need \\n[ds*height]
2044 .nr ds*i \\n[pg*foot-trap]-\\n[pg*header-size]u-\\n[pg*extra-header-size]u
2045 .if (\\n[ds*height]>\\n[ds*i])&(\\n[.t]<(\\n[ds*i]/2)) .nr ds*need \\n[.t]u+1v
2046 .if (\\n[ds*height]<\\n[ds*i])&(\\n[.t]<(\\n[ds*height])) .nr ds*need \\n[.t]u+1v
2047 .\" Eject page if display will fit one page and
2048 .\" there are less than half of the page left.
2049 .if \\n[ds*need] .ne \\n[ds*need]u
2051 .\" check if pending equation label
2052 .eq@check \\n[ds*need]
2054 .if \\n[ds*format]=1 'in \\n[ds*old-in]u+\\n[Si]n
2055 .if \\n[ds*format]>=2 'in 0
2056 .if \\n[ds*format]=2 'ce 9999
2057 .if \\n[ds*format]=3 'in (u;(\\n[.l]-\\n[ds*width])/2)
2058 .if \\n[ds*format]=4 'rj 9999
2059 .if \\n[ds*format]=5 'in (u;\\n[.l]-\\n[ds*width])
2062 .\" Print static display
2064 .if r Dsp .nr ds*i \\n[Dsp]
2066 .if \\n[Ds] .sp \\n[ds*i]u
2068 .if \\n[Ds] .sp \\n[ds*i]u
2070 .if \\n[ds*format]=2 'ce 0
2071 .if \\n[ds*format]=4 'rj 0
2072 .rm ds*div!\\n[ds*snr]
2077 .\"########### module list ###################
2078 .\" .LI text-indent mark-indent pad type [mark [LI-space [LB-space] ] ]
2089 .\"--------------------------
2090 .\" the major list-begin macro.
2091 .\" If type == -1 a 'break' will occur.
2093 .if \\n[.$]<4 .@error "LB: not enough arguments, min 4"
2094 .misc@push cind \\n[.i]
2095 .misc@push tind \\n[li*tind]
2096 .misc@push mind \\n[li*mind]
2097 .misc@push pad \\n[li*pad]
2098 .misc@push type \\n[li*type]
2099 .misc@push li-spc \\n[li*li-spc]
2100 .ds li*mark-list!\\n[li*lvl] \\*[li*mark]
2103 .nr li*tind (n;0\\$1)\" text-indent
2104 .nr li*mind (n;0\\$2)\" mark-indent
2105 .nr li*pad (n;0\\$3)\" pad
2106 .nr li*type 0\\$4\" type
2107 .ds li*mark \\$5\" mark
2108 .ie !'\\$6'' .nr li*li-spc \\$6\" LI-space
2110 .ie !'\\$7'' .nr li*lb-spc \\$7\" LB-space
2112 .\" init listcounter
2113 .nr li*cnt!\\n[li*lvl] 0 1
2115 .af li*cnt!\\n[li*lvl] 1
2116 .if \\n[li*type] .if !'\\*[li*mark]'' .af li*cnt!\\n[li*lvl] \\*[li*mark]
2118 .if \\n[li*lb-spc] .SP (u;\\n[li*lb-spc]*\\n[Lsp])
2123 .if \\n[li*lvl]<1 .@error "LI:no lists active"
2124 .if \\n[li*li-spc]&(\\n[Ls]>=\\n[li*lvl]) .SP (u;\\n[li*li-spc]*\\n[Lsp])
2127 .ds li*c-mark \\*[li*mark]
2128 .nr li*cnt!\\n[li*lvl] +1
2129 .if \\n[li*type]=1 .ds li*c-mark \\n[li*cnt!\\n[li*lvl]].
2130 .if \\n[li*type]=2 .ds li*c-mark \\n[li*cnt!\\n[li*lvl]])
2131 .if \\n[li*type]=3 .ds li*c-mark (\\n[li*cnt!\\n[li*lvl]])
2132 .if \\n[li*type]=4 .ds li*c-mark [\\n[li*cnt!\\n[li*lvl]]]
2133 .if \\n[li*type]=5 .ds li*c-mark <\\n[li*cnt!\\n[li*lvl]]>
2134 .if \\n[li*type]=6 .ds li*c-mark {\\n[li*cnt!\\n[li*lvl]]}
2135 .if \\n[.$]=1 .ds li*c-mark \\$1
2137 . ie (\\$2=2):(\\n[Limsp]=0) .ds li*c-mark \\$1\\*[li*c-mark]
2138 . el .ds li*c-mark \\$1\ \\*[li*c-mark]
2141 .\" determine where the text begins
2142 .nr li*text-begin \\n[li*tind]>?\w@\\*[li*c-mark]\ @
2143 .nr x \w@\\*[li*c-mark]\ @
2145 .\" determine where the mark begin
2146 .ie !\\n[li*pad] .nr li*in \\n[li*mind]
2147 .el .nr li*in \\n[li*text-begin]-\\n[li*pad]-\w@\\*[li*c-mark]@
2148 .if !\\n[li*in] .nr li*in 0
2151 .\" no indentation if hanging indent
2152 .if (\w@\\*[li*c-mark]@=0)&((\\n[.$]=0):(\w@\\$1@=0)) .nr li*text-begin 0
2153 \Z'\&\h'\\n[li*in]u'\\*[li*c-mark]'\h'\\n[li*text-begin]u'\&\c
2154 .if \\n[li*type]=-1 .br
2160 .misc@pop-nr cind li*tmp
2162 .misc@pop-nr tind li*tind
2163 .misc@pop-nr mind li*mind
2164 .misc@pop-nr pad li*pad
2165 .misc@pop-nr type li*type
2166 .misc@pop-nr li-spc li*li-spc
2167 .ds li*mark \\*[li*mark-list!\\n[li*lvl]]
2170 .if \\n[li*lvl]<1 .@error "LE:mismatched"
2172 .if '\\$1'1' .SP \\n[Lsp]u
2175 .\" list status clear.
2176 .\" terminate all lists to level i
2178 .ie \\n[.$]<1 .nr li*i 0
2180 .if \\n[li*i]>\\n[li*lvl] .@error "LC: incorrect argument: \\n[li*i] (too big)"
2181 .while \\n[li*lvl]>\\n[li*i] .li@pop
2186 .if \\n[.$]>3 .@error "AL: too many arguments"
2187 .if \\n[D]>2 .tm AL $*
2188 .ie \\n[.$]<=1 .LB \\n[Li] 0 2 1 "\\$1"
2190 . ie \\n[.$]=2 .LB 0\\$2 0 2 1 "\\$1"
2192 . ie !'\\$2'' .LB \\$2 0 2 1 "\\$1" 0 1
2193 . el .LB \\n[Li] 0 2 1 "\\$1" 0 1
2198 .if \\n[.$]>3 .@error "ML: too many arguments"
2199 .if \\n[D]>2 .tm ML $*
2200 .nr li*ml-width \w@\\$1@u+1n
2201 .if \\n[.$]<2 .LB \\n[li*ml-width]u 0 1 0 "\\$1"
2202 .if \\n[.$]=2 .LB 0\\$2 0 1 0 "\\$1"
2204 . ie '\\$2'' .LB \\n[li*ml-width]u 0 1 0 "\\$1" 0 1
2205 . el .LB \\n[Li] 0 1 0 "\\$1" 0 1
2209 .if \\n[D]>2 .tm VL $*
2210 .if \\n[.$]>3 .@error "VL: too many arguments"
2211 .if \\n[.$]<1 .@error "VL: missing text-indent"
2212 .ie \\n[.$]<3 .LB 0\\$1 0\\$2 0 0
2213 .el .LB 0\\$1 0\\$2 0 0 \& 0 1
2215 .\" Bullet (for .BL)
2217 .if \\n[D]>2 .tm BL $*
2219 .if \\n[.$]>2 .@error "BL: too many arguments"
2220 .if \\n[.$]<1 .LB \\n[Pi] 0 1 0 \\*[BU]
2221 .if \\n[.$]=1 .LB 0\\$1 0 1 0 \\*[BU]
2223 . ie '\\$1'' .LB \\n[Pi] 0 1 0 \\*[BU] 0 1
2224 . el .LB 0\\$1 0 1 0 \\*[BU] 0 1
2228 .if \\n[D]>2 .tm DL $*
2229 .if \\n[.$]>2 .@error "DL: too many arguments"
2230 .if \\n[.$]<1 .LB \\n[Pi] 0 1 0 \(em
2231 .if \\n[.$]=1 .LB 0\\$1 0 1 0 \(em
2233 . ie '\\$1'' .LB \\n[Pi] 0 1 0 \(em 0 1
2234 . el .LB 0\\$1 0 1 0 \(em 0 1
2238 .if \\n[D]>2 .tm RL $*
2239 .if \\n[.$]>2 .@error "RL: too many arguments"
2240 .if \\n[.$]<1 .LB 6 0 2 4
2241 .if \\n[.$]=1 .LB 0\\$1 0 2 4
2243 . ie '\\$1'' .LB 6 0 2 4 1 0 1
2244 . el .LB 0\\$1 0 2 4 1 0 1
2247 .\" Broken Variable List. As .VL but text begin on the next line
2249 .if \\n[D]>2 .tm BVL $*
2250 .if \\n[.$]>3 .@error "BVL: too many arguments"
2251 .if \\n[.$]<1 .@error "BVL: missing text-indent"
2252 .ie \\n[.$]<3 .LB 0\\$1 0\\$2 0 -1
2253 .el .LB 0\\$1 0\\$2 0 -1 \& 0 1
2255 .\" ####### module tbl #######################################
2256 .\" This module is copied from groff_ms and modified for mgm.
2257 .\" Yes, it does not resemble the original anymore :-).
2258 .\" Don't know if I missed something important.
2259 .\" Groff_ms is written by James Clark.
2260 .nr tbl*have-header 0
2261 .nr tbl*header-written 0
2265 .if '\\$1'H' .di tbl*header-div
2268 .if \\n[tbl*have-header] \{\
2269 . ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl@print-header
2274 .if \\n[tbl*have-header] \{\
2276 .\" draw bottom and side lines of boxed tables.
2279 .nr tbl*header-written 0
2281 .de tbl@print-header
2287 .nr tbl*header-written 1
2290 .ie '\\n[.z]'tbl*header-div' \{\
2295 . nr tbl*header-ht \\n[dn]
2297 . nr tbl*have-header 1
2298 . ie '\\$1'N' .if !\\n[tbl*header-written] .tbl@print-header
2299 . el .tbl@print-header
2301 .el .@error ".TH without .TS H"
2304 .ie '\\n(.z'tbl*header-div' .@error ".TS H but no .TH before .TE"
2306 . nr tbl*have-header 0
2313 .\" ####### module pic #######################################
2318 .ie \\n[.$]<2 .@error "PS: bad arguments. Probably not processed with pic."
2320 . if !\\n[ds*lvl] .ne (u;\\$1)+1v
2321 .\" should be contained between .DS/.DE
2323 . if \\n[ds*lvl]&((\\n[ds*format]=2):(\\n[ds*format]=3)) \{\
2325 .\" . in +(u;\\n[.l]-\\n[.i]-\\$2/2)
2334 .\" ####### module eq #######################################
2342 .if !'\\*[eq*label]'' \{\
2344 . \" space down to middle of equation
2346 . ie (\\n[Eq]%2) \{\
2347 . \" label to the left
2351 . \" label to the right
2352 \h'|\\n[.l]u'\\*[eq*label]
2360 .\"########### module toc ###################
2361 .\" table of contents
2363 .nr toc*spacing \n[Lsp]u
2367 .\" Table of contents with friends (module lix)
2370 .\" print any pending displays and references
2372 .if \\n[ref*flag] .RP 0 1
2374 .if \w@\\$1@>0 .nr toc*slevel \\$1
2375 .if \w@\\$2@>0 .nr toc*spacing (u;\\$2*\\n[Lsp])
2376 .if \w@\\$3@>0 .nr toc*tlevel \\$3
2377 .if \w@\\$4@>0 .nr toc*tab \\$4
2378 .if \\n[pg*cols-per-page]>1 .1C
2379 .ds H1txt \\*[Licon]
2386 .if d Ci .toc@read-Ci \\*[Ci]
2389 .ie \\n[Oc] .hd@set-page 1
2394 . PF "''\\\\\\\\n[toc*pn]''"
2400 .while \\n+[toc*i]<10 \{\
2401 . if !'\\$\\n[toc*i]'' \{\
2407 .if \\n[.$]<=4 .if d TX .TX
2408 .ie d TY .if \\n[.$]<=4 .TY
2415 .if d toc*list .toc*list
2417 .\" print LIST OF XXX
2418 .if d lix*dsfg .lix@print-ds fg FG "\\*[Lf]" \\n[.$]
2419 .if d lix*dstb .lix@print-ds tb TB "\\*[Lt]" \\n[.$]
2420 .if d lix*dsec .lix@print-ds ec EC "\\*[Le]" \\n[.$]
2421 .if d lix*dsex .lix@print-ds ex EX "\\*[Lx]" \\n[.$]
2424 .\" .toc@read-Ci lev1 lev2 lev3 lev4 ... lev7
2427 .while \\n+[toc*i]<8 \{\
2428 . nr toc*hl!\\n[toc*i] \\$\\n[toc*i]
2434 . toc@save \\$1 "\\*[hd*mark]" "\\$2" \\*[hd*sect-pg]
2436 .el .toc@save \\$1 "\\*[hd*mark]" "\\$2" \\n[%]
2441 .\" collect maxsize of mark if string Ci don't exist.
2443 . if !r toc*hl!\\$1 .nr toc*hl!\\$1 0
2444 . if \\n[toc*hl!\\$1]<=\w@\\$2@ \{\
2445 . nr toc*hl!\\$1 \w@\\$2@u
2449 .\" .toc@set level headernumber text pagenr
2450 .toc@set \\$1 "\\$2" "\\$3" \\$4
2454 .\" level mark text pagenumber
2456 .if \\$1<=\\n[toc*slevel] .SP \\n[toc*spacing]u
2462 . nr toc*ind +\\n[toc*hl!\\$1]u
2465 . while \\n+[toc*i]<\\$1 \{\
2466 . nr toc*ind +\\n[toc*hl!\\n[toc*i]]u
2469 .nr toc*text \\n[toc*ind]u+\\n[toc*hl!\\$1]u
2471 .ti -\\n[toc*hl!\\$1]u
2473 .\" length of headernum space
2474 .nr toc*i \\n[toc*hl!\\$1]-\w@\\$2@
2476 .ll \\n[@ll]u-\w@\\$4@u-2m
2478 .\" ragged right ---------------------------------
2479 .ie \\$1>\\n[toc*tlevel] \{\
2486 . \" unnumbered heading --------------------
2491 . \" normal heading ------------------------
2499 . nr toc*sep (u;\\n[.l]-\\n[.n]-\\n[.i]-\w@\\$4@)-1m
2500 \h'|\\n[.n]u'\l'\\n[toc*sep]u.'\h'1m'\\$4
2504 .\"########################### module lix ############################
2505 .\" LIST OF figures, tables, exhibits and equations
2516 .lix@print-line fg Lf \\n+[lix*fg-nr] "\\$1" "\\$2" "\\$3" "\\$4"
2519 .lix@print-line tb Lt \\n+[lix*tb-nr] "\\$1" "\\$2" "\\$3" "\\$4"
2522 .lix@print-line ec Le \\n+[lix*ec-nr] "\\$1" "\\$2" "\\$3" "\\$4"
2525 .lix@print-line ex Lx \\n+[lix*ex-nr] "\\$1" "\\$2" "\\$3" "\\$4"
2528 .\" print line with 'figure' in the text
2529 .\" type stringvar number text override flag refname
2533 .ie \\n[Sectf] .ds lix*numb \\n[H1]-\\$3
2534 .el .ds lix*numb \\$3
2536 .ie !\\n[Of] .ds lix*ds-form .\ \ \"
2537 .el .ds lix*ds-form "\ \(em\ \"
2539 .ds lix*label \\*[Li\\$1]\ \\*[lix*numb]\\*[lix*ds-form]
2541 . if !0\\$6 .ds lix*label \\*[Li\\$1]\ \\$5\\*[lix*numb]\\*[lix*ds-form]
2542 . if 0\\$6=1 .ds lix*label \\*[Li\\$1]\ \\*[lix*numb]\\$5\\*[lix*ds-form]
2543 . if 0\\$6=2 .ds lix*label \\*[Li\\$1]\ \\$5\\*[lix*ds-form]
2545 .\" print line if not between DS/DE
2546 .ie \\n[ds*lvl]<1&\\n[df*float]=0 \{\
2547 . lix@print-text "\\*[lix*label]" "\\*[lix*text]" \\$1 \\$2 \\$7
2550 . lix@embedded-text "\\*[lix*label]" "\\*[lix*text]" \\$1 \\$2 \\$7
2555 .\" label text type stringvar refname
2557 .ie \\n[Sectp] .ds lix*pgnr \\*[hd*sect-pg]
2558 .el .ds lix*pgnr \\n[%]
2563 .ie (\w@\\$1\\$2@)>(\\n[.l]-\\n[.i]) \{\
2571 .\" save line for LIST OF XXX, wth is the width of the label
2572 .if !r lix*wth\\$3 .nr lix*wth\\$3 0
2573 .\" find the maximum width
2574 .if \w@\\*[lix*label]@>\\n[lix*wth\\$3] .nr lix*wth\\$3 \w@\\*[lix*label]@
2575 .if \\n[\\$4] .lix@ds-save \\$3 \\*[lix*pgnr] "\\*[lix*text]" "\\*[lix*label]"
2576 .\" save reference to the figure
2577 .if !'\\$5'' .SETR \\$5 \\*[lix*numb]
2579 .\" hide printout until diversion is evaluated
2580 .de lix@embedded-text
2581 \!.ie \\\\n[Sectp] .ds lix*pgnr \\\\*[hd*sect-pg]
2582 \!.el .ds lix*pgnr \\\\n[%]
2588 \!.ie (\w@\\$1\\$2@)>(\\\\n[.l]-\\\\n[.i]) \{\
2599 .\" save line for LIST OF XXX, wth is the width of the label
2600 \!.if !r lix*wth\\$3 .nr lix*wth\\$3 0
2601 .\" find the maximum width
2602 \!.if \w@\\*[lix*label]@>\\\\n[lix*wth\\$3] .nr lix*wth\\$3 \w@\\*[lix*label]@
2603 \!.if \\\\n[\\$4] .lix@ds-save \\$3 \\\\*[lix*pgnr] "\\*[lix*text]" "\\*[lix*label]"
2604 .\" save reference to the figure
2605 \!.if !'\\$5'' .SETR \\$5 \\*[lix*numb]
2608 .\" print complete list of XXXX
2610 .\" arg: fg,tb,ec,ex text
2613 .if !\\n[Cp] .pg@next-page
2614 .\" print LIST OF XXXX
2615 .\" execute user-defined macros
2616 .if \\$4<=4 .if d TX\\$2 .TX\\$2
2617 .ie d TY\\$2 .if \\$4<=4 .TY\\$2
2623 .in \\n[lix*wth\\$1]u
2628 .\" save line of list in macro
2630 .\" type pagenumber text
2632 .lix@dsln \\$1 \\$2 "\\$3" "\\$4" \\$5
2636 .\" print appended macro
2637 .\" lix@dsln type pagenumber text headernr
2639 .nr lix*i \\n[lix*wth\\$1]-\w@\\$4@
2641 .ll \\n[@ll]u-\w@\\$4@u-\w@\\$2@u-2m
2642 .ti -\\n[lix*wth\\$1]u
2648 .nr lix*sep (u;\\n[.l]-\\n[.n]-\\n[.i]-\w@\\$2@)-1m
2649 \h'|\\n[.n]u'\l'\\n[lix*sep]u.'\h'1m'\\$2
2650 .SP \\n[toc*spacing]u
2652 .\"########################### module fnt ############################
2653 .\" some font macros.
2662 .nr fnt*prev \\n[.f]
2664 .while \\n+[fnt*i]<=\\n[.$] \{\
2665 . if \\n[fnt*i]>3 .as fnt*tmp \,
2666 . ie (\\n[fnt*i]%2)=1 .as fnt*tmp \\$1\\$[\\n[fnt*i]]
2667 . el .as fnt*tmp \\$2\\$[\\n[fnt*i]]
2668 . if \\n[fnt*i]<\\n[.$] .as fnt*tmp \/
2670 \&\\*[fnt*tmp]\f[\\n[fnt*prev]]
2674 .ie \\n[.$] .fnt@switch \fB \f[\\n[.f]] \\$@
2678 .ie \\n[.$] .fnt@switch \fI \f[\\n[.f]] \\$@
2682 .if \\n[.$] .fnt@switch \fI \fB \\$@
2685 .if \\n[.$] .fnt@switch \fB \fI \\$@
2688 .if \\n[.$] .fnt@switch \fI \fR \\$@
2691 .if \\n[.$] .fnt@switch \fR \fI \\$@
2694 .if \\n[.$] .fnt@switch \fR \fB \\$@
2697 .if \\n[.$] .fnt@switch \fB \fR \\$@
2699 .\"########################### module box ############################
2700 .\" draw a box around some text. Text will be kept on the same page.
2703 .\" .B1 and .B2 works like .DS
2705 .if \\n[box*ll] .@error "B1: missing B2"
2708 .nr box*hyp \\n[.hy]
2709 .nr box*wid \\n[.l]-\\n[.i]
2711 .\" jump to new environment.
2717 .ll (u;\\n[box*wid]-1n)
2721 .if !\\n[box*ll] .@error "B2: missing B1"
2724 .nr box*height \\n[dn]
2728 .nr box*y-pos \\n[.d]u
2733 \D'l \\n[box*wid]u 0'\
2734 \D'l 0 -\\n[box*height]u'\
2735 \D'l -\\n[box*wid]u 0'\
2736 \D'l 0 \\n[box*height]u'
2746 .\"########################### module ref ############################
2750 .nr ref*flag 0 \" for end-of-text
2751 .ds Rf \v'-.4m'\s-3[\\n+[ref*nr]]\s0\v'.4m'
2756 .if !''\\$1' .ds \\$1 \v'-.4m'\s-3[\\n[ref*nr]]\s0\v'.4m'
2759 .ref@start-print \\n[ref*nr]
2774 .in \\n[ref*nr-width]u
2775 .ti -(\w@\\$1.@u+1n)
2788 .if \\n[Ls] .SP \\n[Lsp]u
2792 .if !d ref*mac .@error "RP: No references!"
2794 .if \\n[ref*i]<2 .SK
2797 .if 0\\$1<1 .nr ref*nr 0 1
2798 .if ((\\n[ref*i]=0):(\\n[ref*i]=2)) .SK
2801 .\" called by end-of-text!
2803 .\".if \\n[ref*flag] \{
2805 . if \\n[D]>2 .tm Print references, called by eot
2817 .\" prints the references
2819 .toc@save 1 "" "\\*[Rp]" \\n[%]
2824 .misc@ev-keep ref*ev
2833 .\"########################### module app ############################
2841 .\" name == "" -> autonumber
2843 .\" .if \\n[.$]<2 .@error "APP: too few arguments"
2849 .ie \\n[Aph] .app@header \\*[app*ind] "\\$2"
2851 .app@index "\\*[app*ind]" "\\$2"
2854 .\" .APPSK name pages text
2855 .\" name == "" -> autonumber
2857 .if \\n[.$]<2 .@error "APPSK: too few arguments"
2863 .ie \\n[Aph] .app@header \\*[app*ind] "\\$3"
2865 .app@index "\\*[app*ind]" "\\$3"
2870 .ie \w@\\$1@ .ds app*ind \\$1
2872 . if !\\n[app*flag] \{\
2878 . ds app*ind \\n+[app*nr]
2879 . nr H1 \\n+[app*dnr]
2880 . nr H1h \\n[app*dnr]
2882 .\" clear lower counters
2884 .while \\n+[app*i]<8 .nr H\\n[app*i] 0 1
2888 .toc@save 1 "" "\\*[App] \\$1: \\$2" \\n[%]
2891 .\" app@heaer name text
2896 \s+4\fB\\*[App]\ \\$1\fP\s0
2898 .if \w@\\$2@<\\n[.l] .ce 1
2902 .als APPX app@header
2903 .\"########################### module cov ############################
2904 .\" title stored in diversion cov*title
2905 .\" abstract stored in diversion cov*abstract
2906 .\" arg to abstract stored in cov*abs-arg
2907 .\" indent stored in cov*abs-ind
2908 .\" number of authors stored in cov*au
2909 .\" author(s) stored in cov*au!x!y
2910 .\" author(s) title stored in cov*at!x!y
2911 .\" x is the author-index [1-cov*au], y is the argument-index [1-9].
2912 .\" author(s) firm stored in cov*firm
2913 .\" new date (if .ND exists) is stored in cov*new-date
2916 .ds cov*abs-name ABSTRACT
2920 .rm IA IE WA WE LO LT
2921 .if \\n[.$]>0 .ds cov*title-charge-case \\$1
2922 .if \\n[.$]>1 .ds cov*title-file-case \\$2
2923 .pg@disable-top-trap
2927 .\"-------------------
2931 .\"-------------------
2932 .\" .AU name [initials [loc [dept [ext [room [arg [arg [arg]]]]]]]]
2935 .pg@disable-top-trap
2938 .ds cov*au!\\n[cov*au]!1
2939 .while \\n[.$]>=\\n+[cov*i] \{\
2940 . ds cov*au!\\n[cov*au]!\\n[cov*i] "\\$[\\n[cov*i]]
2942 .if (\\n[.$]>=3)&(\w@\\$3@) \{\
2943 . if d cov*location-\\$3] \{\
2944 . ds cov*au!3!\\n[cov*au] \\*[cov*location-\\$3]
2948 .\"-------------------
2949 .\" .AT title1 [title2 [... [title9] ]]]]
2950 .\" Well, thats all that COVEND look for.
2951 .\" Must appear directly after .AU
2953 .if \\n[.$]<1 .@error "AT: no arguments"
2955 .while \\n[.$]>=\\n+[cov*i] \{\
2956 . ds cov*at!\\n[cov*au]!\\n[cov*i] "\\$[\\n[cov*i]]
2959 .\"-------------------
2965 .ds cov*abs-name \\$1
2968 .pg@disable-top-trap
2969 .if d cov*abstract .@error "AS: only one abstract allowed"
2970 .if !''\\n[.z]' .@error "AS: no diversion allowed (previous .AS?)"
2971 .nr cov*abs-arg 0\\$1
2972 .nr cov*abs-ind (n;0\\$2)
2977 .\" fixed for 2000, now uses \n[year].
2979 . \" support for ISO-date
2985 . ds cov*new-date \\*[MO\\n[mo]] \\n[dy], \\n[year]
2988 . ds cov*new-date \\n[year]-\\n[cov*mm]-\\n[cov*dd]
2992 .als DT cov*new-date
2994 .ds cov*new-date \\$1
2996 .\" switch to ISO-date if register Iso exist: YYYY-MM-DD
2997 .if r Iso .ISODATE 1
2998 .\"-------------------
2999 .\" save technical numbers.
3002 .while \\n[.$]>=\\n+[cov*i] .ds cov*mt-tm!\\n[cov*i] \\$[\\n[cov*i]]
3003 .nr cov*mt-tm-max \\n[.$]
3005 .\"-----------------------
3007 .\" the file must have the following last lines (somewhere):
3008 .\" .pg@enable-top-trap
3011 .ds cov*mt-file!0 0.MT
3012 .ds cov*mt-file!1 0.MT
3013 .ds cov*mt-file!2 0.MT
3014 .ds cov*mt-file!3 0.MT
3015 .ds cov*mt-file!4 4.MT
3016 .ds cov*mt-file!5 5.MT
3017 .ds cov*mt-file!6 0.MT
3021 . ie d cov*mt-file!\\$1 .ds cov*mt-type \\$1
3022 . el .ds cov*mt-type 6
3024 .el .ds cov*mt-type 1
3025 .ds cov*mt-addresse "\\$2
3026 .ds cov*mt-type-text "\\$1
3027 .ie d @language .ds cov*str mm/\\*[@language]_
3029 .mso \\*[cov*str]\\*[cov*mt-file!\\*[cov*mt-type]]
3032 .ie !\\n[.$] .ds cov*cov-type ms
3033 .el .ds cov*cov-type \\$1
3034 .pg@disable-top-trap
3035 .ie d @language .ds cov*str mm/\\*[@language]_\\*[cov*cov-type].cov
3036 .el .ds cov*str mm/\\*[cov*cov-type].cov
3039 .\"########################### module qrf ############################
3040 .\" forward and backward reference thru special files.
3042 .\" check if stderr-method is wanted
3043 .\" This was needed when I discovered that groff was considered unsafe
3044 .\" and groff -U didn't work. It's a workaround like the original
3045 .\" index method, but not in my view elegant enough.
3047 .\" init reference system
3049 .ds qrf*file \\$1.qrf
3051 .if \\n[D]>1 .tm INITR: source \\*[qrf*file]
3053 . tm .\\\\" Rfilename: \\*[qrf*file]
3055 .el 'so \\*[qrf*file]
3058 .\" set a reference.
3060 .if \\n[.$]<1 .@error "SETR:reference name missing"
3061 .if !r qrf*pass .tm "SETR: No .INITR in this file"
3063 . ds qrf*name qrf*ref-\\$1
3064 . if \\n[D]>2 .tm SETR: ref \\*[qrf*name]=\\*[hd*mark],\\n[%]
3066 . ds \\*[qrf*name]-hn \\*[hd*mark]
3068 . ds \\*[qrf*name]-pn \\n[%]
3071 . tm .ds \\*[qrf*name]-hn \\*[hd*mark]
3072 . tm .ds \\*[qrf*name]-pn \\n[%]
3073 . if !'\\$2'' .tm .ds \\*[qrf*name]-xx \\$2
3079 .\" If two arg -> set var. arg to misc-string.
3081 .if \\n[.$]<1 .@error "GETST:reference name missing"
3082 .if !r qrf*pass .tm "GETST: No .INITR in this file"
3083 .ds qrf*name qrf*ref-\\$1
3084 . if d \\*[qrf*name]-xx \{\
3085 . ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-xx]
3086 . el \\*[\\*[qrf*name]-xx]\c
3091 .\" get header-number
3092 .\" If two arg -> set var. arg to header-number.
3094 .if \\n[.$]<1 .@error "GETHN:reference name missing"
3095 .if !r qrf*pass .tm "GETHN: No .INITR in this file"
3096 .ds qrf*name qrf*ref-\\$1
3097 .if d \\*[qrf*name]-hn \{\
3098 . ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-hn]
3099 . el \\*[\\*[qrf*name]-hn]\c
3104 .\" If two arg -> set var. arg to page-number.
3106 .if \\n[.$]<1 .@error "GETPN:reference name missing"
3107 .if !r qrf*pass .tm "GETPN: No .INITR in this file"
3108 .ds qrf*name qrf*ref-\\$1
3109 .if d \\*[qrf*name]-pn \{\
3110 . ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-pn]
3111 . el \\*[\\*[qrf*name]-pn]\c
3116 .if \\n[.$]<1 .@error "GETR:reference name missing"
3118 . tm "GETR: No .INITR in this file"
3126 .\"########################### module ind ############################
3127 .\" Support for mgs-style indexing, borrowed from mgs.
3129 . tm \\$1\t\\$2\t\\$3\t\\$4 ... \\n[%]
3131 .\"--------------------
3132 .\" Another type of index system
3133 .\" INITI type filename [macro]
3135 .if \\n[.$]<1 .@error "INITI:type missing"
3136 .\" ignore if INITI has already been used
3138 . if d ind*file .@error "INITI:file already set"
3139 . ds ind*file \\$2.ind
3140 . if \\n[D]>1 .tm INITI: source \\*[ind*file]
3142 .if !d ind*file .@error "INITI:file not specified"
3145 . if \\n[.$]>2 .tm .\\\\" Imacro: \\$3
3150 .if !d ind*file .@error "IND: No active INITI"
3151 .if \\n[D]>1 .tm IND: type=\\*[ind*type]
3153 .if '\\*[ind*type]'N' .ds ind*ref \\n[%]
3154 .if '\\*[ind*type]'H' .ds ind*ref \\*[hd*mark]
3155 .if '\\*[ind*type]'B' .ds ind*ref \\*[hd*mark]\t\\n[%]
3156 .if '\\*[ind*ref]'' .@error "IND:wrong index type: \\*[ind*ref]"
3159 .while \\n[.$]>0 \{\
3161 . as ind*line \t\\$1
3163 .as ind*line \\*[ind*ref]
3164 .if \\n[Ref] .tm .\\\\" IND \\*[ind*line]
3168 .ie \\n[Ref] .tm .\\\\" Index: \\*[ind*file]
3170 . if !\\n[Cp] .pg@next-page
3172 . \" execute user-defined macros
3192 .\"########################### module let ############################
3194 .\"------------------------
3198 .ie \\n[.$] .ds let*i \\$1
3199 .el .ds let*i \\*[Letfc]
3200 .ie d let*type .let@fc_\\*[let*type] "\\*[let*i]" \\$@
3201 .el .let@mt-closing "\\*[let*i]" \\$@
3211 .\"------------------------
3214 .ie d let*type .let*lt-sign \\$@
3215 .el .let*mt-sign \\$@
3217 .\"------------------------
3219 .if !d let@sg_\\*[let*type] .@error "SG: letter type \\*[let*type] undefined"
3223 .while \\n+[let*i]<=\\n[let*wa-n] \{\
3224 .if \\n[let*i]=\\n[let*wa-n] .nr let*j 1
3225 .let@sg_\\*[let*type] "\\*[let*wa-name!\\n[let*i]]" "\\*[let*wa-title!\\n[let*i]]" \\n[let*i] \\n[let*j] \\$@
3228 .\"------------------------
3229 .\" Memorandum signature
3233 .ie \\n[.$]>1 .nr let*k 1
3234 .el .nr let*k \\n[cov*au]
3235 .ds let*tmp \\*[cov*au!\\n[let*k]!3]-\\*[cov*au!\\n[let*k]!4]-
3237 .while \\n+[let*i]<=\\n[cov*au] \{\
3238 . if \\n[let*i]>1 .as let*tmp /
3239 . as let*tmp \\*[cov*au!\\n[let*k]!2]
3241 .if !''\\$1' .as let*tmp -\\$1
3245 .while \\n+[let*i]<=\\n[cov*au] \{\
3247 . if \\n[let*i]=\\n[let*k] \{\
3248 \Z'\h'-(u;\\n[.l]/2)'\\*[let*tmp]'\c
3250 \\*[cov*au!\\n[let*i]!1]
3255 .\"------------------------
3256 .\" Approval signature
3261 .ie \\n[.$]<2 \\*[Letapp]
3264 .ie n ______________________________ ______________
3265 .el \D'l 25m 0'\h'4m'\D'l 12m 0'
3266 \Z'\\$1'\h'29m'\f[\\*[@sdf_font]]\\*[Letdate]\fP
3269 .\"------------------------
3270 .\" Letter signature
3275 .ie n ______________________________
3280 .\"------------------------
3282 .\" let@header is called from the header. It is supposed
3283 .\" to remove the alias itself.
3285 .rm AF AS AE AT AU CS OK TL MT
3289 .if !''\\$1' .ds let*type \\$1
3290 .if !d let@head_\\*[let*type] .@error "LT: unknown letter type \\$1"
3292 .als let@header let@head_\\*[let*type]
3293 .let@init_\\*[let*type] \\$@
3294 .if \n[D]>1 .tm Letter type \\*[let*type]
3313 .if \w'\\$5'&\\$4 \\$5
3316 .als let@fc_BL let@mt-closing
3318 .\" Semiblocked letter
3326 .als let@sg_SB let@sg_BL
3327 .als let@fc_SB let@mt-closing
3329 .\" Full-blocked letter
3343 .if \w'\\$5'&\\$4 \\$5
3352 .\" Simplified letter
3363 .misc@toupper "\\$1, \\$2"
3365 .if \w'\\$5'&\\$4 \\$5
3371 .\"--------------------------------------
3372 .\" Print the letter-head
3376 .if '1'\\$1' .in (u;\\n[.l]/2)
3378 .ie d let@wa-div .let@wa-div
3383 .if '1'\\$1' .if !d let*lo-CN .if !d let*lo-RN .sp 2
3384 .\" ---- Confidential
3387 . ie !''\\*[let*lo-CN]' \\*[let*lo-CN]
3393 \\*[LetRN] \\*[let*lo-RN]
3400 .while \\n+[let*i]<=\\n[let*ia-n] \{\
3401 \\*[let*ia-name!\\n[let*i]]
3402 \\*[let*ia-title!\\n[let*i]]
3404 .if d let@ia-div .let@ia-div
3408 \\*[LetAT] \\*[let*lo-AT]
3411 .if !'\\*[let*type]'SP' .if d let*lo-SA \{\
3414 . ie !''\\*[let*lo-SA]' \\*[let*lo-SA]
3419 . ie '\\*[let*type]'SP' \{\
3421 . misc@toupper \\*[let*lo-SJ]
3426 . if '\\*[let*type]'SB' .ti +5m
3427 \\*[LetSJ] \f[\\*[@sdf_font]]\\*[let*lo-SJ]\fP
3431 .\"-------------------
3432 .\" .IA [name [title]]
3435 .if \\n[.$] .ds let*ia-name!\\n+[let*ia-n] \\$1
3436 .if \\n[.$]>1 .ds let*ia-title!\\n[let*ia-n] \\$2
3448 .\"-------------------
3449 .\" .WA [name [title]]
3452 .if \\n[.$] .ds let*wa-name!\\n+[let*wa-n] \\$1
3453 .if \\n[.$]>1 .ds let*wa-title!\\n[let*wa-n] \\$2
3458 .it \\n[Letwam] let@wa-drain
3473 .if d let@wa-junk .rm let@wa-junk
3475 .\"-------------------
3479 .ie !''\\$2' .ds let*str \\$1
3482 . ie !\w'\\$1' .ds let*str \\*[Letns!\\*[Letnsdef]]
3484 . ie d Letns!\\$1 .ds let*str \\*[Letns!\\$1]
3485 . el .ds let*str \\*[Letns!copy](\\$1)\\*[Letns!to]
3488 . el .ds let*str \\*[Letns!\\*[Letnsdef]]
3497 .\"-------------------
3500 .rm AF AS AE AT AU CS OK TL MT
3501 .if ''\\$1' .@error "LO: missing option"
3502 .if !d Let\\$1 .@error "LO: unknown option (\\$1)"
3503 .ds let*lo-\\$1 \\$2
3504 .if \n[D]>1 .tm Letter option \\$1 \\$2
3506 .\"--------------------
3507 .\" Start with a clean slate