* src/roff/troff/nroff.cpp (space_node::get_breakpoints,
[s-roff.git] / contrib / mm / m.tmac
blob06395f196c9547762883aa00728a3ce05c1d63ac
1 .\"  
2 .de @revision
3 .ds RE \\$2
4 ..
5 .\"
6 .\" $Id$
7 .@revision $Revision$
8 .ig
10 Copyright (C) 1991-2000, 2001, 2002, 2003 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
16 version.
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
21 for more details.
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
32 Env.var         environ:name
33 Index           array!index
35 .if !\n(.g .ab These mm macros require groff.
36 .do if d PH .nx
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:14], contents saved if heading level <= Cl
41 .nr Cl 2
42 .\"     Eject page between LIST OF XXXX if Cp == 0
43 .nr Cp 0
44 .\"     Debugflag
45 .if !r D .nr D 0
46 .\"     Eject after floating display is output [0:1]
47 .nr De 0
48 .\"     Floating keep output [0;5]
49 .nr Df 5
50 .\"     space before and after display if == 1 [0:1]
51 .nr Ds 1
52 .\"     Eject page
53 .nr Ej 0
54 .\"     Equation label adjust 0=left, 1=right
55 .nr Eq 0
56 .\"     Em dash string
57 .ie n .ds EM " --
58 .el .ds EM \(em
59 .\"     Footnote spacing
60 .nr Fs 1
61 .\"     H1-H7   heading counters
62 .nr H1 0 1
63 .nr H2 0 1
64 .nr H3 0 1
65 .nr H4 0 1
66 .nr H5 0 1
67 .nr H6 0 1
68 .nr H7 0 1
69 .nr H8 0 1
70 .nr H9 0 1
71 .nr H10 0 1
72 .nr H11 0 1
73 .nr H12 0 1
74 .nr H13 0 1
75 .nr H14 0 1
76 .\"     Heading break level [0:14]
77 .nr Hb 2
78 .\"     heading centering level, [0:14]
79 .nr Hc 0
80 .\"     header format
81 .ds HF 2 2 2 2 2 2 2 2 2 2 2 2 2 2
82 .\"     heading temp. indent [0:2]
83 .\"     0 -> 0 indent, left margin
84 .\"     1 -> indent to right , like .P 1
85 .\"     2 -> indent to line up with text part of preceding heading
86 .nr Hi 1
87 .\"     header pointsize
88 .ds HP 0 0 0 0 0 0 0 0 0 0 0 0 0 0
89 .\"     heading space level [0:14]
90 .nr Hs 2
91 .\"     heading numbering type
92 .\"     0 -> multiple (1.1.1 ...)
93 .\"     1 -> single
94 .nr Ht 0
95 .\"     Unnumbered heading level
96 .nr Hu 2
97 .\"     hyphenation in body
98 .\"     0 -> no hyphenation
99 .\"     1 -> hyphenation 14 on
100 .nr Hy 0
101 .\"     text for toc, selfexplanatory. Look in the new variable section
102 .ds Lf LIST OF FIGURES
103 .nr Lf 1
104 .ds Lt LIST OF TABLES
105 .nr Lt 1
106 .ds Lx LIST OF EXHIBITS
107 .nr Lx 1
108 .ds Le LIST OF EQUATIONS
109 .nr Le 0
110 .\"     List indent, used by .AL
111 .nr Li 6
112 .\"     List space, if listlevel > Ls then no spacing will occur around lists.
113 .nr Ls 99
114 .\"     Numbering style [0:5]
115 .if !r N .nr N 0
116 .\"     numbered paragraphs
117 .\"     0 == not numbered
118 .\"     1 == numbered in first level headings.
119 .nr Np 0
120 .\"     Format of figure,table,exhibit,equation titles.
121 .\"     0= ". ", 1=" - "
122 .nr Of 0
123 .\"     Table of contents page numbering style
124 .nr Oc 0
125 .\"     Page-number, normally same as %.
126 .nr P 0
127 .\"     paragraph indent
128 .nr Pi 5
129 .\"     paragraph spacing
130 .nr Ps 1
131 .\"     paragraph type
132 .\"     0 == left-justified
133 .\"     1 == indented .P
134 .\"     2 == indented .P except after .H, .DE or .LE.
135 .nr Pt 0
136 .\"     Reference title
137 .ds Rp REFERENCES
138 .\"     Display indent
139 .nr Si 5
141 .\" Current state of TOC, empty outside TC, inside
142 .\" it will be set to co,fg,tb,ec,ex or ap.
143 .ds Tcst
145 .ds Tm \(tm
147 .\"---------------------------------------------
148 .\"     Internal global variables
150 .\" This is for cover macro .MT
151 .\" .ds @language
153 .nr @copy_type 0
154 .if r C .nr @copy_type \n[C]
155 .\" >0 if Subject/Date/From should be bold, roman otherwise
156 .ie n .ds @sdf_font R
157 .el .ds @sdf_font B
158 .if \n[@copy_type]=4 \{\
159 .       ls 2
160 .       nr Pi 10
161 .       nr Pt 1
165 .if r E \{\
166 .       ie \n[E] .ds @sdf_font B
167 .       el .ds @sdf_font R
170 .\"     Current pointsize and vertical space, always in points.
171 .if !r S .nr S 10
172 .ps \n[S]
173 .vs \n[S]+2
175 .nr @ps \n[.ps]
176 .nr @vs \n[.v]
177 .if \n[D]>1 .tm @ps=\n[@ps], @vs=\n[@vs]
178 .if \n[D]>3 .tm INIT: l:\n[.l] p:\n[.p] o:\n[.o]
180 .\"     Page length
181 .if r L \{\
182 .       ie n .pl \n[L]u
183 .       el .pl \n[L]u
185 .nr @pl \n[.p]
187 .\"     page width
188 .ie r W \{\
189 .       ie n .ll \n[W]u
190 .       el .ll \n[W]u
192 .el .ll 6i
193 .nr @ll \n[.l]
194 .nr @cur-ll \n[@ll]
195 .lt \n[@ll]u
197 .\"     page offset
198 .ie r O .po \n[O]u
199 .el \{\
200 .       ie n .po .75i
201 .       el .po .963i
204 .nr @po \n[.o]
206 .\" non-zero if escape mechanism is turned off. Used by VERBON/OFF
207 .nr @verbose-flag 0
208 .\"---------------------------------------------
209 .\"     New variables
211 .\" Appendix name
212 .ds App APPENDIX
213 .\" print appendixheader, 0 == don't
214 .nr Aph 1
216 .\" Current appendix text
217 .ds Apptext
218 .\" Controls the space before and after static displays if defined.
219 .\" Lsp is used otherwise
220 .\" .nr Dsp 1v
222 .\" Add a dot after level one heading number if >0
223 .nr H1dot 1
225 .\" header prespace level. If level <= Hps, then two lines will be printed
226 .\" before the header instead of one.
227 .nr Hps 1
229 .\" These variables controls the number of lines preceding .H.
230 .\" Hps1 is the number of lines when level > Hps
231 .nr Hps1 0.5v
232 .if n .nr Hps1 1v
234 .\" Hps2 is the number of lines when level <= Hps
235 .nr Hps2 1v
236 .if n .nr Hps2 2v
238 .\" Hss is the number of lines (Lsp) after the header.
239 .nr Hss 1
241 .\" H1txt will be updated by .H and .HU, containing the heading text.
242 .\" Will also be updated in table of contents & friends
244 .ds H1txt
246 .\" header text for the index
247 .ds Index INDEX
248 .\" command to sort the index
249 .ds Indcmd sort
251 .\" flag for mkindex
252 .if !r Idxf .nr Idxf 0
253 .\"     Change these in the national configuration file
254 .ds Lifg Figure
255 .ds Litb TABLE
256 .ds Liex Exhibit
257 .ds Liec Equation
258 .ds Licon CONTENTS
259 .\" Flag for space between mark and prefix 1==space, 0==no space
260 .\" Can also be controlled by using '.LI mark 2'
261 .nr Limsp 1
263 .\" Lsp controls the height of an empty line. Normally 0.5v
264 .\" Normally used for nroff compatibility.
265 .nr Lsp 0.5v
266 .if n .nr Lsp 1v
267 .ds MO1 January
268 .ds MO2 February
269 .ds MO3 March
270 .ds MO4 April
271 .ds MO5 May
272 .ds MO6 June
273 .ds MO7 July
274 .ds MO8 August
275 .ds MO9 September
276 .ds MO10 October
277 .ds MO11 November
278 .ds MO12 December
279 .\" for GETR
280 .ds Qrf See chapter \\*[Qrfh], page \\*[Qrfp].
282 .\" header- and footer-size will only change to the current
283 .\" if Pgps is > 0.
284 .nr Pgps 1
286 .\" section-page if Sectp > 0
287 .nr Sectp 0
288 .if (\n[N]=3):(\n[N]=5) \{\
289 .       nr Sectp 1
290 .       nr Ej 1
292 .\" section-figure if Sectf > 0
293 .nr Sectf 0
294 .if \n[N]=5 .nr Sectf 1
296 .\" argument to .nm in .VERBON.
297 .ds Verbnm "1
298 .\" indent for VERBON
299 .nr Verbin 5n
301 .\" Letter section
302 .\" Formal closing (.FC)
303 .ds Letfc Yours very truly,
305 .\" Approval line
306 .ds Letapp APPROVED:
307 .\" Approval date-string
308 .ds Letdate Date
310 .ds LetCN CONFIDENTIAL\"                Confidential default
311 .ds LetSA To Whom It May Concern:\"     Salutation default
312 .ds LetAT ATTENTION:\"                  Attention string
313 .ds LetSJ SUBJECT:\"                    Subject string
314 .ds LetRN In reference to:\"            Reference string
316 .\" Copy to (.NS)
317 .ds Letnsdef 0
318 .ds Letns!copy Copy \" space!
319 .ds Letns!to " to
320 .ds Letns!0 Copy to
321 .ds Letns!1 Copy (with att.) to
322 .ds Letns!2 Copy (without att.) to
323 .ds Letns!3 Att.
324 .ds Letns!4 Atts.
325 .ds Letns!5 Enc.
326 .ds Letns!6 Encs.
327 .ds Letns!7 Under separate cover
328 .ds Letns!8 Letter to
329 .ds Letns!9 Memorandum to
330 .ds Letns!10 Copy (with atts.) to
331 .ds Letns!11 Copy (without atts.) to
332 .ds Letns!12 Abstract Only to
333 .ds Letns!13 Complete Memorandum to
334 .ds Letns!14 CC:
336 .\" Text printed below the footer. Controlled by @copy_type (C).
337 .ds Pg_type!0
338 .ds Pg_type!1 OFFICIAL FILE COPY 
339 .ds Pg_type!2 DATE FILE COPY
340 .ds Pg_type!3 D\ R\ A\ F\ T
341 .ds Pg_type!4 D\ R\ A\ F\ T
342 .\" Max lines in return address
343 .nr Letwam 14
344 .\"--------------------------
345 .\"     test for mgm macro. This can be used if the text must test
346 .\"     what macros is used.
347 .nr .mgm 1
349 .\" Due to security problems with groff I had to rewrite
350 .\" the reference system. It's not as elegant as before, you
351 .\" have to run groff with '-z -rRef=1' and put stderr into the filename
352 .\" for .INITR
354 .\" Output references to stderr if non-zero
355 .ie !r Ref \{\
356 .       nr Ref 0
358 .el .warn 0
360 .\"---------------------------------------------
361 .\" set local variables.
362 .ie d @language .mso mm/\*[@language]_locale
363 .el .mso mm/locale
364 .\"---------------------------------------------
365 .if \n[D] .tm Groff mm, version \*[RE].
366 .\" ####### module init ######
367 .\"     reset all things
368 .de init@reset
369 .ie \\n[misc@adjust] 'ad
370 .el 'na
371 .ie \\n[Hy] 'hy 14
372 .el 'nh
373 'in 0
374 'ti 0
375 .ps \\n[@ps]u
376 .vs \\n[@vs]u
378 .de @warning
379 'tm WARNING:(\\n[.F]) input line \\n[.c]:\\$*
380 .if \\n[D] .backtrace
382 .de @error
383 'tm ******************
384 'tm ERROR:(\\n[.F]) input line \\n[.c]:\\$*
385 .if \\n[D] .backtrace
386 'tm ******************
387 .ab "Input aborted, syntax error"
389 .de misc@toupper
390 .tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
392 \\$1
393 .tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
396 .\" ####### module debug #################################
397 .de debug
398 'tm \\$1:\\n[.F]:\\n[c.] ll=\\n[.l] vs=\\n[.v] ps=\\n[.s],\\n[.ps] \
399 in=\\n[.i] fi=\\n[.u] .d=\\n[.d] nl=\\n[nl] pg=\\n[%]
401 .de debug-all
402 .nr debug*n 1n
403 .nr debug*m 1m
404 'tm \\$1:\\n[.F]:\\n[c.] ll=\\n[.l] vs=\\n[.v] ps=\\n[.s] in=\\n[.i]\
405  ad=\\n[.j] fi=\\n[.u] pl=\\n[.p] page=\\n[%] .o=\\n[.o]
406 'tm _______ .d=\\n[.d] .f=\\n[.f] .h=\\n[.h] .k=\\n[.k] .n=\\n[.n]\
407  .p=\\n[.p] .t=\\n[.t] .z=\\n[.z] nl=\\n[nl] dn=\\n[dn] n=\\n[debug*n]
409 .\" ####### module par #################################
410 .nr par@ind-flag 1      \" indent on following P if Pt=2
411 .nr hd*last-pos -1
412 .nr hd*last-hsize -1
413 .nr par*number 0 1
414 .af par*number 01
415 .nr par*number2 0 1
416 .af par*number2 01
417 .nr par*num-count 0 1
418 .af par*num-count 01
419 .\"     reset numbered paragraphs, arg1 = headerlevel
420 .de par@reset-num
421 .if \\$1<3 .nr par*num-count 0
422 .if (\\$1=1)&(\\n[Np]=1) .nr par*number 0
424 .\"------------
425 .\" paragraph
426 .de P
427 .\"     skip P if previous heading
428 .if \\n[D]>2 \{\
429 .       tm Paragraph nl=\\n[nl], last=\\n[hd*last-pos]
430 .       tm Paragraph .k=\\n[.k], hsize=\\n[hd*last-hsize]
432 .if !((\\n[nl]=\\n[hd*last-pos]):(\\n[hd*last-hsize]=\\n[.k])) \{\
433 .       if \\n[D]>2 .tm Paragraph set ind-flag=1
434 .       nr par@ind-flag 1
436 .\" any collected unprinted text?
437 .par@doit \\$*
438 .if \\n[Np] \\n[H1].\\n+[par*number]\ \ \c
440 .\"------------
441 .de nP
442 .\"     skip P if previous heading
443 .if \\n[D]>2 \{\
444 .       tm Paragraph nl=\\n[nl], last=\\n[hd*last-pos]
445 .       tm Paragraph .k=\\n[.k], hsize=\\n[hd*last-hsize]
447 .if !((\\n[nl]=\\n[hd*last-pos]):(\\n[hd*last-hsize]=\\n[.k])) \{\
448 .       if \\n[D]>2 .tm Paragraph set ind-flag=1
449 .       nr par@ind-flag 1
451 .par@doit \\$*
452 \\n[H2].\\n+[par*number2]\ \ \c
453 .nr par@ind-flag 1
455 .\"------------
456 .de par@doit
457 .SP (u;\\n[Ps]*\\n[Lsp])
458 .ie  \\n[.$] \{\
459 .       if \\$1=1 .ti +\\n[Pi]n
461 .el \{\
462 .       if \\n[Pt]=1 .ti +\\n[Pi]n
463 .       if (\\n[Pt]=2)&\\n[par@ind-flag] .ti +\\n[Pi]n
466 .\" ####### module line #######################################
467 .de SP
469 .if !r line*lp\\n[.z] .nr line*lp\\n[.z] 0
470 .if !r line*ac\\n[.z] .nr line*ac\\n[.z] 0
471 .ie \\n[.$] .nr line*temp (v;\\$1)
472 .el .nr line*temp 1v
474 .ie \\n[line*lp\\n[.z]]=\\n[.d] \{\
475 .       \" go here if no output since the last .SP
476 .       nr line*output \\n[line*temp]-\\n[line*ac\\n[.z]]
477 .       if \\n[line*output]<0 .nr line*output 0
478 .       nr line*ac\\n[.z] +\\n[line*output]
480 .el \{\
481 .       nr line*ac\\n[.z] \\n[line*temp]
482 .       nr line*output \\n[line*temp]
483 .       \" no extra space in the beginning of a page
484 .       if (\\n[.d]<0):(\\n[pg*head-mark]=\\n[.d]) .nr line*output 0
486 .if \\n[line*output] .sp \\n[line*output]u
487 .nr line*lp\\n[.z] \\n[.d]
489 .\" ######## module misc ###############
490 .nr misc@adjust 14
491 .de SA
492 .if \\n[.$] \{\
493 .       if \\$1-1 .@error "SA: bad arg: \\$1"
494 .       nr misc@adjust 0\\$1
496 .ie \\n[misc@adjust] 'ad
497 .el 'na
499 .\"-------------
500 .\" switch environment, keep all important settings.
501 .de misc@ev-keep
502 .nr misc*ll \\n[.l]
503 .ev \\$1
504 .ll \\n[misc*ll]u
505 .lt \\n[misc*ll]u
507 .\"-------------
508 .\" .misc@push stackname value
509 .de misc@push
510 .ie d misc*st-\\$1 .ds misc*st-\\$1 \\$2 \\*[misc*st-\\$1]
511 .el .ds misc*st-\\$1 \\$2
513 .\"-------------
514 .\" .misc@pop stackname
515 .\" value returned in the string misc*pop
516 .de misc@pop
517 .misc@pop-set misc*st-\\$1 \\*[misc*st-\\$1]
519 .\"-------------
520 .de misc@pop-set
521 .ds misc*st-name \\$1
522 .shift
523 .if \\n[.$]<1 .@error "stack \\*[misc*st-name] empty"
524 .ds misc*pop \\$1
525 .shift
526 .ds \\*[misc*st-name] \\$*
528 .\"-------------
529 .\" .misc@pop-nr stackname varname
530 .de misc@pop-nr
531 .misc@pop \\$1
532 .nr \\$2 \\*[misc*pop]
534 .\"-------------
535 .\" .misc@pop-ds stackname varname
536 .de misc@pop-ds
537 .misc@pop \\$1
538 .ds \\$2 \\*[misc*pop]
540 .\"-----------
541 .\" reset tabs
542 .de TAB
543 .ta T 5n
545 .\"-------------
546 .\" .PGFORM linelength [ pagelength [ pageoffset [1]]]
547 .de PGFORM
548 .\" Break here to avoid problems with new linesetting of the previous line.
549 .\" Hope this doesn't break anything else :-)
550 .\" Don't break if arg_4 is a '1'.
551 .if \\n[D]>2 .tm PGFORM: \\$*
552 .if ''\\$4' .br
553 .if \\n[D]>3 .tm PGFORM: IN l:\\n[.l] p:\\n[.p] o:\\n[.o]
554 .ie !''\\$1' \{\
555 .       ll \\$1
556 .       nr @ll \\n[.l]
557 .       nr @cur-ll \\n[@ll]
558 .       lt \\n[@ll]u
560 .el \{\
561 .       ll \\n[@ll]u
562 .       lt \\n[@ll]u
565 .ie !''\\$2' \{\
566 .       pl \\$2
567 .       nr @pl \\n[.p]
569 .el .pl \\n[@pl]u
571 .ie !''\\$3' \{\
572 .       po \\$3
573 .       nr @po \\n[.o]
575 .el .po \\n[@po]u
576 .if \\n[D]>3 .tm PGFORM: OUT l:\\n[.l] p:\\n[.p] o:\\n[.o]
577 .if \\n[D]>2 .tm PGFORM: ll=\\n[@ll], pl=\\n[@pl], po=\\n[@po]
578 'in 0
579 .pg@move-trap
580 .if \\n[D]>2 \{\
581 .       tm Traps:
582 .       ptr
585 .\"-------------
586 .\" .MOVE y [[x] linelength]
587 .\" move to line y, indent to x
588 .de MOVE
589 .if !\\n[.$] .@error "MOVE y [x]: no arguments"
590 .if \\n[nl]<0 \c
591 .\" move to Y-pos
592 .sp |(v;\\$1)
593 .\" calc linelength
594 .ie \\n[.$]>2 .nr pg*i (n;\\$3)
595 .el \{\
596 .       ie \\n[.$]>1 .nr pg*i (n;\\n[@ll]u-\\$2)
597 .       el .nr pg*i \\n[@ll]u
599 .\" move to X-pos, if any
600 .if !''\\$2' .po \\$2
601 .\" set linelength
602 .ll \\n[pg*i]u
604 .\"-------------
605 .de SM
606 .if !\\n[.$] .@error "SM: no arguments"
607 .if \\n[.$]=1 \s-1\\$1\s0
608 .if \\n[.$]=2 \s-1\\$1\s0\\$2
609 .if \\n[.$]=3 \\$1\s-1\\$2\s0\\$3
611 .\"-------------
612 .nr misc*S-ps \n[@ps]
613 .nr misc*S-vs \n[@vs]
614 .nr misc*S-ps1 \n[@ps]
615 .nr misc*S-vs1 \n[@vs]
616 .ds misc*a
617 .ds misc*b
618 .de S
619 .ie !\\n[.$] \{\
620 .       ds misc*a P
621 .       ds misc*b P
623 .el \{\
624 .       ie \\n[.$]=1 .ds misc*b D
625 .       el \{\
626 .               ie \w@\\$2@=0 .ds misc*b C
627 .               el .ds misc*b \\$2
628 .       \}
629 .       ie \w@\\$1@=0 .ds misc*a C
630 .       el .ds misc*a \\$1
633 .\" set point size
634 .if !'\\*[misc*a]'C' \{\
635 .       ie '\\*[misc*a]'P' .ps \\n[misc*S-ps]u
636 .       el \{\
637 .               ie '\\*[misc*a]'D' .ps \\n[S]
638 .               el .ps \\*[misc*a]
639 .               if \\n[D]>2 .tm S: .ps \\*[misc*a]
640 .       \}
643 .\" set vertical spacing
644 .if !'\\*[misc*b]'C' \{\
645 .       ie '\\*[misc*b]'P' .vs \\n[misc*S-vs]u
646 .       el \{\
647 .               ie '\\*[misc*b]'D' .vs \\n[.ps]u+2p
648 .               el .vs \\*[misc*b]
649 .               if \\n[D]>2 .tm S: .vs \\*[misc*b]
650 .       \}
652 .nr @ps \\n[.ps]
653 .nr @vs \\n[.v]
655 .if \\n[D]>1 .tm S(\\$*): ma:\\*[misc*a], mb:\\*[misc*b] => ps:\\n[@ps]u, vs:\\n[@vs]u
656 .nr misc*S-ps \\n[misc*S-ps1]
657 .nr misc*S-vs \\n[misc*S-vs1]
658 .nr misc*S-ps1 \\n[@ps]
659 .nr misc*S-vs1 \\n[@vs]
660 .pg@move-trap
662 .\"------------
663 .de HC
664 .ev 0
665 .hc \\$1
667 .ev 1
668 .hc \\$1
670 .ev 2
671 .hc \\$1
674 .\"------------
675 .de RD
676 .di misc*rd
678 .rd \\$1\t
681 .ie !''\\$3' \{\
682 .       di misc*rd2
683 .       ds \\$3 "\\*[misc*rd]
684 .       br
685 .       di
687 .if !''\\$2' .rn misc*rd \\$2
688 .rm misc*rd misc*rd2
690 .\"------------
691 .\" VERBON [flag [pointsize [font]]]
692 .\"     flag
693 .\"     bit     function
694 .\"     0       escape on
695 .\"     1       add an empty line before verbose text
696 .\"     2       add an empty line after verbose text
697 .\"     3       numbered lines (controlled by the string Verbnm)
698 .\"     4       indent text by the numbervariable Verbin.
699 .de VERBON
701 .nr misc*verb 0\\$1
702 .if (0\\n[misc*verb]%4)/2 .SP \\n[Lsp]u
703 .misc@ev-keep misc*verb-ev
705 .if (0\\n[misc*verb]%16)/8 .nm \\*[Verbnm]
706 .ie !'\\$3'' .ft \\$3
707 .el .ft CR
708 .ie 0\\$2 \{\
709 .       ss \\$2
710 .       ps \\$2
711 .       vs \\$2
713 .el .ss 12
714 .ta T 8u*\w@n@u
715 .if (0\\n[misc*verb]%32)/16 .in +\\n[Verbin]u
716 .if 0\\n[misc*verb]%2 \{\
717 .       eo
718 .       nr @verbose-flag 1              \" tell pageheader to set ec/eo
721 .de VERBOFF
724 .if (0\\n[misc*verb]%8)/4 .SP \\n[Lsp]u
725 .if (0\\n[misc*verb]%16)/8 .nm
726 .if (0\\n[misc*verb]%32)/16 .in
728 .nr @verbose-flag 0
730 .\" ######## module pict #################
731 .nr pict*width 0
732 .nr pict*height 0
733 .nr pict*mode 0
734 .nr pict*ind 0
735 .nr pict*id 0 1
736 .\" I assume that the number variable pict*id is the same
737 .\" between two runs.
738 .de PIC
740 .nr pict*ind 0
741 .nr pict*box 0
742 .while \\n[.$]>0 \{\
743 .       if '-B'\\$1' \{\
744 .               nr pict*box 1
745 .               shift
746 .               continue
747 .       \}
748 .       if '-L'\\$1' \{\
749 .               nr pict*mode 0
750 .               shift
751 .               continue
752 .       \}
753 .       if '-R'\\$1' \{\
754 .               nr pict*mode 1
755 .               shift
756 .               continue
757 .       \}
758 .       if '-I'\\$1' \{\
759 .               nr pict*ind (m;\\$2)
760 .               nr pict*mode 2
761 .               shift 2
762 .               continue
763 .       \}
764 .       if '-C'\\$1' \{\
765 .               nr pict*mode 3
766 .               shift
767 .               continue
768 .       \}
769 .       ds pict*f \\$1
770 .       nr pict*id +1
771 .       shift
772 .       if \\n[.$]>0 \{\
773 .               nr pict*width (i;\\$1)
774 .               shift
775 .       \}
776 .       if \\n[.$]>0 \{\
777 .               nr pict*height (i;\\$1)
778 .               shift
779 .       \}
781 .\" let mmroff know the filename and id
782 .if \\n[Ref]>0 \{\
783 .       tm .\\\\" PIC id \\n[pict*id]
784 .       tm .\\\\" PIC file \\*[pict*f]
786 .\" these are defined by mmroff in the second pass
787 .if d pict*file!\\n[pict*id] \{\
788 .       ds pict*f \\*[pict*file!\\n[pict*id]]
789 .       nr pict*llx \\n[pict*llx!\\n[pict*id]]
790 .       nr pict*lly \\n[pict*lly!\\n[pict*id]]
791 .       nr pict*urx \\n[pict*urx!\\n[pict*id]]
792 .       nr pict*ury \\n[pict*ury!\\n[pict*id]]
793 .       \"
794 .       nr pict*w (p;\\n[pict*urx]-\\n[pict*llx])
795 .       if \\n[pict*w]<0 .nr pict*w 0-\\n[pict*w]
796 .       nr pict*h (p;\\n[pict*ury]-\\n[pict*lly])
797 .       if \\n[pict*h]<0 .nr pict*h 0-\\n[pict*h]
798 .       if \\n[pict*width]>0 \{\
799 .               nr pict*rs (u;1000*\\n[pict*width]/\\n[pict*w])
800 .               nr pict*w (u;\\n[pict*w]*\\n[pict*rs]/1000)
801 .               nr pict*h (u;\\n[pict*h]*\\n[pict*rs]/1000)
802 .       \}
803 .       if \\n[pict*height]>0 \{\
804 .               nr pict*rs (u;1000*\\n[pict*height]/\\n[pict*h])
805 .               nr pict*h (u;\\n[pict*h]*\\n[pict*rs]/1000)
806 .       \}
807 .       if '0'\\n[pict*mode]' \{\
808 .               nr pict*in \\n[.i]u
809 .       \}
810 .       if '1'\\n[pict*mode]' \{\
811 .               nr pict*in (u;\\n[.l]-\\n[.i]-\\n[pict*w])
812 .       \}
813 .       if '2'\\n[pict*mode]' \{\
814 .               nr pict*in \\n[pict*ind]u
815 .       \}
816 .       if '3'\\n[pict*mode]' \{\
817 .               nr pict*in (u;(\\n[.l]-\\n[.i]-\\n[pict*w])/2)
818 .       \}
819 .       ds pict*h "
820 .       if \\n[pict*h]>0 .ds pict*h \\n[pict*h]
821 .       \"
822 .       ne \\n[pict*h]u-1v
823 .       \"
824 .       \" these lines are copied and modified from tmac.pspic.
825 .       \" Originally written by James Clark
826 .       br
827 .       ie \\n[pict*box]>0 \{\
828 \v'-1v'\h'\\n[pict*in]u'\
829 \Z'\D'p 0 \\n[pict*h]u \\n[pict*w]u 0 0 -\\n[pict*h]u''\
830 \v'\\n[pict*h]u'\X'ps: import \\*[pict*f] \
831 \\n[pict*llx] \\n[pict*lly] \
832 \\n[pict*urx] \\n[pict*ury] \
833 \\n[pict*w] \\n[pict*h]'
835 .       el \{\
836 \v'-1v'\h'\\n[pict*in]u'\
837 \X'ps: invis'\
838 \Z'\D'p 0 \\n[pict*h]u \\n[pict*w]u 0 0 -\\n[pict*h]u''\
839 \X'ps: endinvis'\
840 \v'\\n[pict*h]u'\X'ps: import \\*[pict*f] \
841 \\n[pict*llx] \\n[pict*lly] \
842 \\n[pict*urx] \\n[pict*ury] \
843 \\n[pict*w] \\n[pict*h]'
844 .       \}
845 .       br
846 .       sp \\n[pict*h]u-1v
849 .\" external picture
850 .\" -L  left adjust
851 .de EPIC
852 .if \\n[.$]<2 .@error "EPIC: Not enough arguments"
853 .nr pict*adj 0          \" centered
854 .if '\\$1'-L' \{\
855 .       shift 1         \" left adjust
856 .       nr pict*adj 1
858 .if \\n[nl]<0 \&
859 .nr pict*w \\$1
860 .nr pict*h \\$2
861 .ds pict*name "External picture
862 .if !''$3' .ds pict*name \\$3
863 .ne \\n[pict*h]u
864 .sp \\n[pict*h]u-1v
865 .nr pict*ind 0
866 .if !\\n[pict*adj] .nr pict*ind (u;(\\n[.l]-\\n[.i]-\\n[pict*w])/2)
868 .in +\\n[pict*ind]u
869 \D'l \\n[pict*w]u 0'\
870 \D'l 0 -\\n[pict*h]u'\
871 \D'l -\\n[pict*w]u 0'\
872 \D'l 0 \\n[pict*h]u'\
873 \v'-(u;\\n[pict*h]/2)'\
874 \h'(u;(\\n[pict*w]-\w'\\*[pict*name]'/2))'\\*[pict*name]
877 .sp 1v
879 .\" ######## module acc #################
880 .\"-----------
881 .\" accents. These are copied from mgs, written by James Clark.
882 .de acc@over-def
883 .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
884 \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
886 .de acc@under-def
887 .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
889 .acc@over-def ` \`
890 .acc@over-def ' \'
891 .acc@over-def ^ ^
892 .acc@over-def ~ ~
893 .acc@over-def : \(ad
894 .acc@over-def ; \(ad
895 .acc@under-def , \(ac
896 .\" ######## module uni #################
897 .\" unimplemented macros
898 .de OK
899 'tm "OK: not implemented"
901 .de PM
902 'tm "PM: not implemented"
904 .\" ######## module hd #################
905 .\" support for usermacro
906 .nr hd*h1-page 1        \" last page-number for level 1 header.
907 .nr hd*htype 0
908 .ds hd*sect-pg
909 .ds hd*mark
910 .ds hd*suf-space
911 .nr hd*need 0
912 .aln ;0 hd*htype
913 .als }0 hd*mark
914 .als }2 hd*suf-space
915 .aln ;3 hd*need
916 .\"-------------
917 .\" .hd@split varable index name val1 val2 ...
918 .de hd@split
919 .if \\$2>(\\n[.$]-3) .@error "\\$3 must have at least \\$2 values (\\*[\\$3]).
920 .nr hd*sp-tmp \\$2+3
921 .ds \\$1 \\$[\\n[hd*sp-tmp]]
923 .de HU
924 .H 0 "\\$1"
926 .\"-------------
927 .de H
928 .if !r hd*cur-bline .nr hd*cur-bline \\n[nl]
930 .df@print-float 2\"     $$$ could be wrong...
931 .\" terminate all lists
933 .init@reset
934 .nr hd*level 0\\$1
935 .nr hd*arg1 0\\$1
936 .if !\\n[hd*level] .nr hd*level \\n[Hu]
938 .\"     clear lower counters
939 .nr hd*i 1 1
940 .while \\n+[hd*i]<15 .if \\n[hd*level]<\\n[hd*i] .nr H\\n[hd*i] 0 1
942 .\" save last text for use in TP
943 .if \\n[hd*level]=1 .ds H1txt \\$2\\$3
945 .\" This is a little fix to be able to get correct H1 heading number
946 .\" in page headers. Special attention was needed when other formats are used.
947 .ie !''\\g[H1]' \{\
948 .       ds hd*format \\g[H1]
949 .       af H1 0
950 .       nr H1h \\n[H1] 1
951 .       af H1 \\*[hd*format]
953 .el .nr H1h \\n[H1] 1
954 .if \\n[hd*level]=1 .nr H1h +1
956 .\"     Check if it's time for new page. Only if text has
957 .\"     appeared before.
958 .if \\n[Ej]&(\\n[Ej]>=\\n[hd*level])&(\\n[nl]>\\n[hd*cur-bline]) .pg@next-page
960 .\" increment current counter
961 .nr H\\n[hd*level] +1
963 .\" update pagenumber if section-page is used
964 .if (\\n[hd*level]=1)&(\\n[Sectp]>0) .hd@set-page 1
966 .\" hd*mark is the text written to the left of the header.
967 .ds hd*mark \\n[H1].
969 .if \\n[hd*level]>1 .as hd*mark \\n[H2]
971 .nr hd*i 2 1
972 .while \\n+[hd*i]<15 .if \\n[hd*level]>(\\n[hd*i]-1) .as hd*mark .\\n[H\\n[hd*i]]
973 .if \\n[Ht] .ds hd*mark \\n[H\\n[hd*level]].
975 .\" special case, no dot after level one heading if not H1dot true
976 .if (\\n[hd*level]=1)&(\\n[H1dot]=0) .ds hd*mark \\n[H1]
978 .as hd*mark \ \ \"                      add spaces between mark and heading
979 .if !\\n[hd*arg1] .ds hd*mark\"         no mark for unnumbered
981 .if \\n[D]>1 .tm At header \\*[hd*mark] "\\$2"
982 .nr hd*htype 0                          \" hd*htype = check break and space
983 .                                       \" 0 = run-in, 1 = break only, 2 = space
984 .if \\n[hd*level]<=\\n[Hb] .nr hd*htype 1
985 .if \\n[hd*level]<=\\n[Hs] .nr hd*htype 2
986 .                                       \" two spaces if hd*htype == 0
987 .ie (\\n[hd*htype]=0)&(\w@\\$2@) .ds hd*suf-space "  \"
988 .el .ds hd*suf-space
989 .nr hd*need 2v                          \" hd*need = header need space
990 .\"---------- user macro HX ------------
991 .\" User exit macro to override numbering.
992 .\" May change hd*mark (}0), hd*suf-space (}2) and hd*need (;3)
993 .\" Can also change Hps1/2.
994 .if d HX .HX \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
995 .\"-------------------------------------- 
996 .\" pre-space
997 .ie \\n[hd*level]<=\\n[Hps] .SP (u;\\n[Hps2])
998 .el .SP (u;\\n[Hps1])
1000 .par@reset-num \\n[hd*level]\"                  reset numbered paragraph
1001 .\" start diversion to measure size of header
1002 .di hd*div
1003 \\*[hd*mark]\\$2\\$3\\*[hd*suf-space]
1006 .rm hd*div
1007 .if \\n[hd*htype] .na \"                no adjust if run-in
1008 .if \\n[hd*htype]<2 .nr hd*need +\\n[Lsp]u \"   add some extra space
1009 .ne \\n[hd*need]u+\\n[dn]u+.5p-1v \"    this is the needed space for a header
1011 .\" size and font calculations
1012 .hd@split hd*font \\n[hd*level] HF \\*[HF]\"    get font for this level
1013 .ft \\*[hd*font]\"                      set new font
1014 .hd@split hd*new-ps \\n[hd*level] HP \\*[HP]\"  get point size
1015 .ie (\\*[hd*new-ps]=0):(\w@\\*[hd*new-ps]@=0) \{\
1016 .       if \\n[hd*htype] \{\
1017 .               if '\\*[hd*font]'3' \{\
1018 .                       ps -1
1019 .                       vs -1
1020 .               \}
1021 .               if '\\*[hd*font]'B' \{\
1022 .                       ps -1
1023 .                       vs -1
1024 .               \}
1025 .       \}
1027 .el \{\
1028 .       ps \\*[hd*new-ps]
1029 .       vs \\*[hd*new-ps]+2
1032 .\"---------- user macro HY ------------- 
1033 .\"     user macro to reset indents
1034 .if d HY .HY \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
1035 .\"-------------------------------------- 
1036 .nr hd*mark-size \w@\\*[hd*mark]@
1037 .if (\\n[hd*level]<=\\n[Hc])&\\n[hd*htype] .ce\" center if level<=Hc
1039 .\"     finally, output the header
1040 \\*[hd*mark]\&\c
1041 .\"     and the rest of the header
1042 .ie \\n[hd*htype] \{\
1043 \\$2\\$3
1044 .       br
1046 .el \\$2\\$3\\*[hd*suf-space]\&\c
1047 .ft 1
1048 .\" restore pointsize and vertical size.
1049 .ps \\n[@ps]u
1050 .vs \\n[@vs]u
1052 .\" table of contents
1053 .if (\\n[hd*level]<=\\n[Cl])&\w@\\$2@ .toc@entry \\n[hd*level] "\\$2"
1054 .\"     set adjust to previous value
1056 .\"     do break or space
1057 .if \\n[hd*htype] .br
1058 .if \\n[hd*htype]>1 .SP (u;\\n[Lsp]*\\n[Hss])
1059 .if \\n[hd*htype] \{\
1060 .       \"      indent if Hi=1 and Pt=1
1061 .       if (\\n[Hi]=1)&(\\n[Pt]=1) .ti +\\n[Pi]n
1062 .       \"      indent size of mark if Hi=2
1063 .       if \\n[hd*htype]&(\\n[Hi]>1) .ti +\\n[hd*mark-size]u
1065 .nr par@ind-flag 0                      \" no indent on .P if Pt=2
1067 .\"     check if it is time to reset footnotes
1068 .if (\\n[hd*level]=1)&\\n[ft*clear-at-header] .nr ft*nr 0 1
1070 .\"     check if it is time to reset indexes
1071 .if (\\n[hd*level]=1)&\\n[Sectf] \{\
1072 .       nr lix*fg-nr 0 1
1073 .       nr lix*tb-nr 0 1
1074 .       nr lix*ec-nr 0 1
1075 .       nr lix*ex-nr 0 1
1077 .\"---------- user macro HZ ----------
1078 .if d HZ .HZ \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
1079 .nr hd*last-pos \\n[nl]
1080 .nr hd*last-hsize \\n[.k]
1081 .nr par@ind-flag 0
1083 .\"--------
1084 .de HM
1085 .nr hd*i 0 1
1086 .while \\n+[hd*i]<15 .af H\\n[hd*i] \\$[\\n[hd*i]] 1
1088 .\"----------------------
1089 .\" set page-nr, called from header 
1090 .\" 
1091 .de hd@set-page
1093 .ie \\n[.$]>0 .nr P \\$1
1094 .el .nr P +1
1095 .\" Set section-page-string
1096 .ds hd*sect-pg \\n[H1]-\\n[P]
1097 .if \\n[Sectp]>1 .if '\\n[H1]'0' .ds hd*sect-pg "
1099 .\"########### module pg ####################
1100 .\" set end of text trap
1101 .wh 0 pg@header
1102 .em pg@end-of-text
1104 .ds pg*header ''- \\nP -''
1105 .ds pg*footer
1106 .if \n[N]=4 .ds pg*header ''''
1107 .if (\n[N]=3):(\n[N]=5) \{\
1108 .       ds pg*header ''''
1109 .       ds pg*footer ''\\*[hd*sect-pg]''
1111 .ds pg*even-footer
1112 .ds pg*odd-footer
1113 .ds pg*even-header
1114 .ds pg*odd-header
1116 .nr pg*top-margin 0
1117 .nr pg*foot-margin 0
1118 .nr pg*block-size 0
1119 .nr pg*footer-size 5v\"                  1v+footer+even/odd footer+2v
1120 .nr pg*header-size 7v\"                  3v+header+even/odd header+2v
1121 .nr pg*extra-footer-size 0
1122 .nr pg*extra-header-size 0
1123 .nr ft*note-size 0
1124 .nr pg*cur-column 0
1125 .nr pg*cols-per-page 1
1126 .nr pg*cur-po \n[@po]
1127 .nr pg*head-mark 0
1129 .nr pg*ps \n[@ps]
1130 .nr pg*vs \n[@vs]
1131 .\"-------------------------
1132 .\" footer TRAPS: set, enable and disable
1133 .de pg@set-new-trap
1134 .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)
1136 .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]
1138 .\" last-pos points to the position of the footer and bottom 
1139 .\" block below foot-notes.
1140 .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)
1141 .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]
1143 .de pg@enable-trap
1144 .wh \\n[pg*foot-trap]u pg@footer
1145 .if \\n[D]>2 .tm pg@enable-trap .t=\\n[.t] nl=\\n[nl]
1146 .if \\n[D]>2 .ptr
1148 .de pg@disable-trap
1149 .ch pg@footer
1151 .\" move to new trap (if changed).
1152 .de pg@move-trap
1153 .pg@disable-trap
1154 .pg@set-new-trap
1155 .pg@enable-trap
1157 .de pg@enable-top-trap
1158 .\" set trap for pageheader.
1159 .nr pg*top-enabled 1
1161 .de pg@disable-top-trap
1162 .\" remove trap for pageheader.
1163 .nr pg*top-enabled 0
1165 .\" no header on the next page
1166 .de PGNH
1167 .nr pg*top-enabled (-1)
1169 .\" set first trap for pagefooter
1170 .pg@enable-top-trap
1171 .pg@set-new-trap
1172 .pg@enable-trap
1173 .\"-------------------------
1174 .\" stop output and begin on next page. Fix footnotes and all that.
1175 .de pg@next-page
1176 .\".debug next-page
1177 .ne 999i                \" activate trap
1178 .\" .pg@footer
1180 .\"-------------------------
1181 .\" support for PX, TP and EOP.
1182 .als }t pg*header
1183 .als }e pg*even-header
1184 .als }o pg*odd-header
1185 .als TPh pg*header
1186 .als TPeh pg*even-header
1187 .als TPoh pg*odd-header
1189 .als EOPf pg*footer
1190 .als EOPef pg*even-footer
1191 .als EOPof pg*odd-footer
1192 .\"------------------------------------------------------------
1193 .\" HEADER
1194 .de pg@header
1195 .if \\n[D]>1 .tm Page# \\n[%] (\\n[.F]:\\n[c.])
1196 .if \\n[Idxf] \{\
1197 .tl '<pagenr\ \\n[%]>'''
1199 .\" assign current page-number to P
1200 .hd@set-page
1201 .\" reset spacing
1202 .nr line*lp\\n[.z] 0
1203 .nr line*ac\\n[.z] 0
1205 .\" suppress pageheader if pagenumber == 1 and N == [124]
1206 .if \\n[pg*top-enabled] \{\
1207 .\"     must be fixed!!
1208 .\".    pg@disable-top-trap
1209 .       if \\n[pg*extra-header-size] 'sp \\n[pg*extra-header-size]u
1210 .       if \\n[pg*top-margin] 'sp \\n[pg*top-margin]u
1211 .       ev pg*tl-ev
1212 .       pg@set-env
1213 .       ie d let@header .let@header
1214 .       el \{\
1215 .               ie d TP .TP
1216 .               el \{\
1217 '                       sp 3
1218 .                       ie ((\\n[%]=1)&((\\n[N]=1):(\\n[N]=2))) .sp
1219 .                       el .tl \\*[pg*header]
1220 .                       ie o .tl \\*[pg*odd-header]
1221 .                       el .tl \\*[pg*even-header]
1222 '                       sp 2
1223 .               \}
1224 .       \}
1225 .       ev
1226 .       \" why no-space??
1227 .       if d PX \{\
1228 .               ns
1229 .               PX
1230 .               rs
1231 .       \}
1232 .       \" check for pending footnotes 
1233 .       ft@check-old
1234 .       \"
1235 .       \" back to normal text processing
1236 .       pg@enable-trap
1237 .       \" mark for multicolumn
1238 .       nr pg*head-mark \\n[nl]u
1239 .       \" reset NCOL pointer at each new page.
1240 .       nr pg*last-ncol 0
1241 .       \" set multicolumn
1242 .       \" 
1243 .       pg@set-po
1244 .       \" print floating displays
1245 .       df@print-float 4
1246 .       tbl@top-hook
1247 .       ns
1249 .if \\n[pg*top-enabled]<0 .nr pg*top-enabled 1
1250 .nr hd*cur-bline \\n[nl]        \" .H needs to know if output has occured
1252 .\"---------------------------------------------------------
1253 .\" FOOTER
1254 .de pg@footer
1256 .if \\n[D]>2 .tm Footer# \\n[%] (\\n[.F]:\\n[c.]) nl=\\n[nl]
1257 .pg@disable-trap
1258 .\".debug footer
1259 .tbl@bottom-hook
1260 .\" increment pageoffset for MC
1261 .\" move to the exact start of footer.
1262 'sp |\\n[pg*foot-trap]u+1v
1264 .if \\n[D]>3 .tm FOOTER after .sp, nl=\\n[nl]
1265 .\" print footnotes
1266 .if d ft*div .ft@print
1268 .pg@inc-po
1269 .if !\\n[pg*cur-column] .pg@print-footer
1270 .\" next column
1271 .pg@set-po
1272 .pg@enable-trap
1273 .if \\n[@verbose-flag] .eo              \" to help VERBON/VERBOFF
1275 .\"-------------------------
1276 .de pg@print-footer
1277 .\" jump to the position just below the foot-notes.
1278 'sp |\\n[pg*last-pos]u+1v
1279 .if \\n[D]>3 .tm print-footer nl=\\n[nl]
1280 .\" check if there are any bottom block
1281 .if d pg*block-div .pg@block
1283 .\" print the footer and eject new page
1284 .ev pg*tl-ev
1285 .pg@set-env
1286 .\" user defined end-of-page macro
1287 .ie d EOP .EOP
1288 .el \{\
1289 .       ie o .tl \\*[pg*odd-footer]
1290 .       el .tl \\*[pg*even-footer]
1291 .       ie (\\n[%]=1)&(\\n[N]=1) .tl \\*[pg*header]
1292 .       el .tl \\*[pg*footer]
1293 .       tl ''\\*[Pg_type!\\n[@copy_type]]''
1296 .\" be sure that floating displays and footnotes will be
1297 .\" printed at the end of the document.
1298 .ie (\\n[df*fnr]>=\\n[df*o-fnr]):\\n[ft*exist] \{\
1299 .       ev ne
1300 '       bp
1301 .       ev
1303 .el 'bp
1305 .\"-------------------------
1307 .\" Initialize the title environment
1308 .de pg@set-env
1311 'in 0
1312 'ti 0
1313 .ie \\n[Pgps] \{\
1314 .       ps \\n[@ps]u
1315 .       vs \\n[@vs]u
1317 .el \{\
1318 .       ps \\n[pg*ps]u
1319 .       vs \\n[pg*vs]u
1321 .lt \\n[@ll]u
1322 .ll \\n[@ll]u
1324 .\"-------------------------
1325 .de PH
1326 .ds pg*header "\\$1
1327 .pg@set-new-size
1329 .de PF
1330 .ds pg*footer "\\$1
1331 .pg@set-new-size
1333 .de OH
1334 .ds pg*odd-header "\\$1
1335 .pg@set-new-size
1337 .de EH
1338 .ds pg*even-header "\\$1
1339 .pg@set-new-size
1341 .de OF
1342 .ds pg*odd-footer "\\$1
1343 .pg@set-new-size
1345 .de EF
1346 .ds pg*even-footer "\\$1
1347 .pg@set-new-size
1349 .de pg@clear-hd
1350 .ds pg*even-header
1351 .ds pg*odd-header
1352 .ds pg*header
1354 .de pg@clear-ft
1355 .ds pg*even-footer
1356 .ds pg*odd-footer
1357 .ds pg*footer
1359 .de pg@set-new-size
1360 .nr pg*ps \\n[@ps]
1361 .nr pg*vs \\n[@vs]
1362 .pg@move-trap
1364 .\"-------------------------
1365 .\" end of page processing
1366 .de pg@footnotes
1367 .\".debug footnotes
1368 .\" output footnotes. set trap for block
1371 .\"-------------------------
1372 .\" print bottom block
1373 .de pg@block
1374 .ev pg*block-ev
1376 'in 0
1377 .ll 100i
1378 .pg*block-div
1382 .\"-------------------------
1383 .\" define bottom block
1384 .de BS
1385 .misc@ev-keep pg*block-ev
1386 .init@reset
1388 .di pg*block-div
1390 .\"-------------------------
1391 .de BE
1394 .nr pg*block-size \\n[dn]u
1396 .pg@move-trap
1398 .\"-------------------------
1399 .\" print out all pending text
1400 .de pg@end-of-text
1401 .if \\n[D]>2 .tm ---------- End of text processing ----------------
1402 .df@eot-print
1403 .ref@eot-print
1405 .\"-------------------------
1406 .\" set top and bottom margins 
1407 .\" -T  sets pg*footer-size and pg*header-size instead
1408 .de VM
1409 .ie '\\$1'-T' \{\
1410 .       shift
1411 .       if \\n[.$]=0 \{\
1412 .               nr pg*footer-size 5v
1413 .               nr pg*header-size 7v
1414 .       \}
1415 .       if \\n[.$]>0 .nr pg*header-size (v;\\$1)
1416 .       if \\n[.$]>1 .nr pg*footer-size (v;\\$2)
1418 .el \{\
1419 .       if \\n[.$]=0 \{\
1420 .               nr pg*extra-footer-size 0
1421 .               nr pg*extra-header-size 0
1422 .       \}
1423 .       if \\n[.$]>0 .nr pg*extra-header-size (v;\\$1)
1424 .       if \\n[.$]>1 .nr pg*extra-footer-size (v;\\$2)
1425 .       if \\n[D]>2 \{\
1426 .               tm extra top \\n[pg*extra-footer-size]
1427 .               tm extra bottom \\n[pg*extra-header-size]
1428 .       \}
1430 .pg@move-trap
1432 .\"---------------------
1433 .\" multicolumn output. 
1434 .de pg@set-po
1435 .if \\n[pg*cols-per-page]>1 \{\
1436 .       ll \\n[pg*column-size]u
1439 .de pg@inc-po
1440 .if \\n[pg*cols-per-page]>1 \{\
1441 .       ie \\n+[pg*cur-column]>=\\n[pg*cols-per-page] \{\
1442 .               nr pg*cur-column 0 1
1443 .               nr pg*cur-po \\n[@po]u
1444 .               po \\n[@po]u
1445 .               ll \\n[@ll]u
1446 .       \}
1447 .       el \{\
1448 .               nr pg*cur-po +(\\n[pg*column-size]u+\\n[pg*column-sep]u)
1449 .               po \\n[pg*cur-po]u
1450 '               sp |\\n[pg*head-mark]u
1451 .               tbl@top-hook
1452 .       \}
1455 .\" An argument disables the page-break.
1456 .de 1C
1458 .if \\n[pg*cols-per-page]<=1 .@error "1C: multicolumn mode not active"
1459 .nr pg*cols-per-page 1
1460 .nr pg*column-sep 0
1461 .nr pg*column-size \\n[@ll]
1462 .nr pg*ncol-i \\n[pg*cur-column]\"      temp variable
1463 .nr pg*cur-column 0 1
1464 .nr pg*cur-po \\n[@po]u
1465 .PGFORM
1466 .ie !'\\$1'1' .SK
1467 .el \{\
1468 .       if d ft*div \{\
1469 .               if \\n[pg*ncol-i]>0 \{\
1470 .                       @warning 1C: footnotes will be messy
1471 .               \}
1472 .       \}
1473 .       if \\n[pg*last-ncol]>0 \{\
1474 .               sp |\\n[pg*last-ncol]u
1475 .               nr pg*last-ncol 0
1476 .       \}
1479 .de 2C
1481 .nr pg*head-mark \\n[nl]u
1482 .if \\n[pg*cols-per-page]>1 .@error "2C: multicolumn mode already active"
1483 .nr pg*cols-per-page 2
1484 .nr pg*column-sep \\n[@ll]/15
1485 .nr pg*column-size (\\n[@ll]u*7)/15
1486 .nr pg*cur-column 0 1
1487 .nr pg*cur-po \\n[@po]u
1488 .ll \\n[pg*column-size]u
1489 .\" .lt \\n[pg*column-size]u
1491 .\" MC column-size [ column-separation ]
1492 .de MC
1494 .nr pg*head-mark \\n[nl]u
1495 .if \\n[pg*cols-per-page]>1 .@error "MC: multicolumn mode already active"
1496 .ie ''\\$1' .nr pg*column-size \\n[.l]
1497 .el .nr pg*column-size (n;\\$1)
1498 .ie ''\\$2' .nr pg*column-sep \\n[pg*column-size]/15
1499 .el .nr pg*column-sep (n;\\$2)
1501 .\" calculate the number of columns/page
1502 .nr pg*cols-per-page 0
1503 .nr pg*i \\n[pg*column-size]
1504 .while \\n[pg*i]<=\\n[.l] \{\
1505 .       nr pg*cols-per-page \\n[pg*cols-per-page]+1
1506 .       nr pg*i \\n[pg*i]+\\n[pg*column-sep]+\\n[pg*column-size]
1508 .nr pg*cur-column 0 1
1509 .nr pg*cur-po \\n[@po]u
1510 .ll \\n[pg*column-size]u
1511 .\" .lt \\n[pg*column-size]u
1513 .\" begin a new column
1514 .de NCOL
1516 .if \\n[nl]>\\n[pg*last-ncol] .nr pg*last-ncol \\n[nl]
1517 .pg@footer
1519 .\" skip pages
1520 .de SK
1523 .nr pg*i 0 1
1524 .\" force new page by writing something invisible.
1525 .while \\n+[pg*i]<=(0\\$1) \{\
1527 .       bp
1530 .\"-------------------------------
1531 .\" MULB width1 space1 width2 space2 width3 space3 ...
1532 .de MULB
1534 .nr pg*i 0 1
1535 .nr pg*mul-x 0 1
1536 .nr pg*mul-ind 0
1537 .nr pg*mul-last 0
1538 .while \\n[.$] \{\
1539 .       nr pg*mul!\\n+[pg*i] (n;0\\$1)
1540 .       nr pg*muls!\\n[pg*i] (n;0\\$2)
1541 .       shift 2
1543 .nr pg*mul-max-col \\n[pg*i]
1544 .ds pg*mul-fam \\n[.fam]
1545 .nr pg*mul-font \\n[.f]
1546 .ev pg*mul-ev
1547 .ps \\n[@ps]u
1548 .vs \\n[@vs]u
1549 .fam \\*[pg*mul-fam]
1550 .ft \\n[pg*mul-font]
1552 .hy 14
1553 .di pg*mul-div
1554 .MULN
1556 .\"-----------
1557 .de MULN
1558 .if \\n[pg*mul-x]>=\\n[pg*mul-max-col] .@error "MULN: Undefined columnwidth"
1560 .if \\n[.d]>\\n[pg*mul-last] .nr pg*mul-last \\n[.d]
1561 .rt +0
1562 .in \\n[pg*mul-ind]u
1563 .ll (u;\\n[.i]+\\n[pg*mul!\\n+[pg*mul-x]])u
1564 .nr pg*mul-ind +(u;\\n[pg*mul!\\n[pg*mul-x]]+\\n[pg*muls!\\n[pg*mul-x]])
1566 .\"-----------
1567 .\" MULE
1568 .de MULE
1570 .if \\n[.d]>\\n[pg*mul-last] .nr pg*mul-last \\n[.d]
1573 .ne \\n[pg*mul-last]u
1576 .pg*mul-div
1578 .sp \\n[pg*mul-last]u
1581 .\"-----------
1582 .de OP
1584 .ie o .if !\\n[pg*head-mark]=\\n[nl] \{\
1585 .       bp +1
1586 .       bp +1
1588 .el .bp
1590 .\"########### module footnotes ###################
1591 .nr ft*note-size 0
1592 .nr ft*busy 0
1593 .nr ft*nr 0 1
1594 .nr ft*wide 0
1595 .nr ft*hyphen 0\"       hyphenation value
1596 .nr ft*adjust 1\"       >0 if adjust true
1597 .nr ft*indent 1\"       >0 if text indent true (not imp. $$$)
1598 .nr ft*just 0\" 0=left justification, 1=right (not imp. $$$)
1599 .nr ft*exist 0\"        not zero if there are any footnotes to be printed
1600 .nr ft*clear-at-header 0\" >0 if footnotes should be reset at first level head.
1602 .ds F \v'-.4m'\s-3\\n+[ft*nr]\s0\v'.4m'
1604 .\"-----------------
1605 .\" init footnote environment
1606 .de ft@init
1607 .\" indentcontrol not implemented $$$
1608 .\" label justification not implemented $$$
1609 'in 0
1611 .ie \\n[ft*adjust] 'ad
1612 .el 'na
1613 .ie \\n[ft*hyphen] 'hy 14
1614 .el 'hy 0
1615 .ll \\n[@cur-ll]u
1616 .lt \\n[@cur-ll]u
1617 .ps (p;\\n[@ps]u-2)
1618 .vs (p;\\n[@vs]u-1)
1620 .\"-----------------
1621 .\" set footnote format
1622 .\" no support for two column processing (yet). $$$
1623 .de FD
1624 .if \\n[.$]=0 .@error "FD: bad arg \\$1"
1625 .ie \\n[.$]=2 .nr ft*clear-at-header 1
1626 .el .nr ft*clear-at-header 0
1628 .if !'\\$1'' \{\
1629 .       ie \\$1>11 .nr ft*format 0
1630 .       el .nr ft*format \\$1
1631 .       \"
1632 .       nr ft*hyphen (\\n[ft*format]%2)*14
1633 .       nr ft*format \\n[ft*format]/2
1634 .       \"
1635 .       nr ft*adjust 1-(\\n[ft*format]%2)
1636 .       nr ft*format \\n[ft*format]/2
1637 .       \"
1638 .       nr ft*indent 1-(\\n[ft*format]%2)
1639 .       nr ft*format \\n[ft*format]/2
1640 .       \"
1641 .       nr ft*just \\n[ft*format]%2
1644 .\"---------------
1645 .\" Footnote and display width control $$$
1646 .de WC
1647 .nr ft*i 0 1
1648 .while \\n+[ft*i]<=\\n[.$] \{\
1649 .       ds ft*x \\$[\\n[ft*i]]
1650 .       if '\\*[ft*x]'N' \{\
1651 .               nr ft*wide 0
1652 .               nr ft*first-fn 0
1653 .               nr ds*wide 0
1654 .               nr ds*float-break 1
1655 .       \}
1656 .       if '\\*[ft*x]'-WF' .nr ft*wide 0
1657 .       if '\\*[ft*x]'WF' .nr ft*wide 1
1658 .       if '\\*[ft*x]'-FF' .nr ft*first-fn 0
1659 .       if '\\*[ft*x]'FF' .nr ft*first-fn 1
1660 .       if '\\*[ft*x]'-WD' \{\
1661 .               nr ds*wide 0
1662 .               if r ft*df-save \{\
1663 .                       nr Df \\n[ft*df-save]
1664 .                       rm ft*df-save 
1665 .               \}
1666 .       \}
1667 .       if '\\*[ft*x]'WD' \{\
1668 .               nr ds*wide 1
1669 .               nr ft*df-save \\n[Df]
1670 .               nr Df 4
1671 .       \}
1672 .       if '\\*[ft*x]'-FB' .nr ds*float-break 0
1673 .       if '\\*[ft*x]'FB' .nr ds*float-break 1
1674 .       if \\n[D]>1 .tm WC WF=\\n[ft*wide] WD=\\n[ds*wide]
1677 .\"-----------------
1678 .\" begin footnote
1679 .\" Change environment, switch to diversion and print the foot-note mark.
1680 .de FS
1681 .if \\n[ft*busy] .@error "FS: missing FE"
1682 .nr ft*busy 1
1683 .ev ft*ev
1684 .ft@init
1685 .if !\\n[ft*wide] .pg@set-po
1686 .di ft*tmp-div
1687 .nr ft*space (u;\\n[Fs]*\\n[Lsp])
1688 .sp \\n[ft*space]u
1689 .\" print mark
1690 .ie \\n[.$] .ds ft*mark \\$1
1691 .el .ds ft*mark \\n[ft*nr].
1692 \\*[ft*mark]
1693 .in +.75c
1694 .sp -1
1695 .nr ft*exist 1
1697 .\"-----------------
1698 .\" init footnote diversion
1699 .de ft@init-footnote
1700 .di ft*div
1701 \l'20n'
1704 .nr ft*note-size \\n[dn]
1706 .\"-----------------
1707 .\" end footnote
1708 .\" End the diversion, back to previous environment, and adjust
1709 .\" the trap to the new foot-note size.
1710 .de FE
1711 .nr ft*busy 0
1714 'in 0
1716 .if \\n[@pl]u<\\n[dn]u .@error "FE: too big footnote"
1717 .if !d ft*div .nr dn +1v
1718 .if \\n[D]>3 .tm FE: foot-trap=\\n[pg*foot-trap] .d=\\n[.d] dn=\\n[dn]
1719 .ie (\\n[pg*foot-trap]u-\\n[.d]u)<\\n[dn]u \{\
1720 .       da ft*next-div
1721 .       ft*tmp-div
1722 .       br
1723 .       di
1725 .el \{\
1726 .       if !d ft*div .ft@init-footnote
1727 .       da ft*div
1728 .       ft*tmp-div
1729 .       di
1730 .       nr ft*note-size +\\n[dn]
1732 .rm ft*tmp-div
1734 .pg@move-trap
1736 .\"-----------------
1737 .\" print footnotes, see pg@footer
1738 .de ft@print
1739 .ev ft*print-ev
1741 'in 0
1742 .ll 100i
1743 .ft*div
1746 .rm ft*div
1747 .nr ft*note-size 0
1748 .pg@move-trap
1750 .\"-----------------
1751 .\" check if any pending footnotes, see pg@header
1752 .de ft@check-old
1753 .if d ft*next-div \{\
1754 .       ev ft*ev
1755 .       ft@init
1756 .       ft@init-footnote
1757 .       nf
1758 .       in 0
1759 .       da ft*div
1760 .       ft*next-div
1761 .       di
1762 .       nr ft*note-size +\\n[dn]
1763 .       rm ft*next-div
1764 .       ev
1765 .       nr ft*exist 0
1766 .       pg@move-trap
1769 .\"########### module display ###################
1770 .nr ds*wide 0\"         >0 if wide displays wanted
1771 .nr df*fnr 0 1\"        floating display counter
1772 .nr df*o-fnr 1\"        floating display counter, already printed
1773 .nr ds*snr 0 1\"        static display counter
1774 .nr ds*lvl 0 1\"        display level
1775 .nr ds*float-busy 0\"   >0 if printing float
1776 .nr df*float 0          >0 if previous display was floating
1777 .\"--------------------------------------------
1778 .de DE
1779 .ie \\n[df*float] .df@end \\$@
1780 .el .ds@end \\$@
1782 .\"--------------------------------------------
1783 .\" floating display start
1784 .\" nested DF/DE is not allowed.
1785 .de DF
1786 .if \\n[df*float] .@error "DF:nested floating is not allowed. Use DS."
1787 .ds@set-format \\$@
1789 .nr df*old-ll \\n[.l]
1790 .nr ds*ftmp \\n[.f]
1791 .misc@ev-keep df*ev
1792 .ft \\n[ds*ftmp]
1794 .init@reset
1795 .di df*div
1796 'in 0
1798 .ds@set-new-ev \\n[df*old-ll]
1799 .SP \\n[Lsp]u
1800 .nr df*float 1
1802 .\"--------------------------------------------
1803 .de df@end
1805 .SP \\n[Lsp]u
1807 .nr df*width!\\n+[df*fnr] \\n[dl]
1808 .nr df*height!\\n[df*fnr] \\n[dn]
1809 .nr df*wide!\\n[df*fnr] \\n[ds*wide]
1810 .nr df*format!\\n[df*fnr] \\n[ds*format]
1812 .if \\n[D]>2 .tm DF:fnr=\\n[df*fnr] w=\\n[dl] h=\\n[dn] wide=\\n[ds*wide] \
1813  form=\\n[ds*format]
1814 .\"     move div to the floating display list
1815 .rn df*div df*fdiv!\\n[df*fnr]
1817 .nr par@ind-flag 0
1818 .\" print float if queue is empty and the display fits into
1819 .\" the current page
1820 .if ((\\n[df*fnr]>=\\n[df*o-fnr])&(\\n[dn]<\\n[.t])) .df@print-float 1
1821 .nr df*float 0
1823 .\"-------------
1824 .\" called by end-of-text
1825 .de df@eot-print
1827 .if \\n[df*o-fnr]<=\\n[df*fnr] \{\
1828 .       if \\n[D]>2 .tm Print remaining displays.
1829 .\" still some floats left, make non-empty environment
1830 .       misc@ev-keep ne
1831 .       init@reset
1833 .       df@print-float 3
1834 .       ev
1837 .\"---------------
1838 .\" print according to Df and De.
1839 .\" .df@print-float type
1840 .\"     type    called from
1841 .\"     1       .DE
1842 .\"     2       end of section
1843 .\"     3       end of document
1844 .\"     4       beginning of new page
1846 .de df@print-float
1847 .if \\n[Df]>5 .@error "Df=\\n[Df], max value is 5"
1848 .if !\\n[ds*float-busy] \{\
1849 .       nr ds*float-busy 1
1850 .\" at .DE
1851 .       if \\n[D]>3 .tm print-float: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1852 .       \" Df = 1 or 5
1853 .       if (\\$1=1)&((\\n[Df]=1):(\\n[Df]=5)) \{\
1854 .               if \\n[.t]>\\n[df*height!\\n[df*o-fnr]] \{\
1855 .                       \" Print only new displays.
1856 .                       if \\n[df*o-fnr]=\\n[df*fnr] \{\
1857 .                               br
1858 .                               ds@print-one-float
1859 .                       \}
1860 .               \}
1861 .       \}
1862 .       \" Df = 3
1863 .       if (\\$1=1)&(\\n[Df]=3) \{\
1864 .               if \\n[.t]>\\n[df*height!\\n[df*o-fnr]] \{\
1865 .                       br
1866 .                       ds@print-one-float
1867 .               \}
1868 .       \}
1869 .\" print all if Df<2 and end of section
1870 .       if (\\$1=2)&(\\n[Sectp]>0)&(\\n[Df]<2) \{\
1871 .               br
1872 .               ds@print-all-floats
1873 .       \}
1874 .\" print all if end of document. Where should they go instead?
1875 .       if \\$1=3 \{\
1876 .               br
1877 .               ds@print-all-floats
1879 .\" new page
1880 .       if (\\$1=4)&(\\n[Df]>1) \{\
1881 .               if \\n[Df]=2 .ds@print-one-float
1882 .               if \\n[Df]=3 .ds@print-one-float
1883 .               if \\n[Df]>3 \{\
1884 .                       ie \\n[De] .ds@print-all-floats
1885 .                       el .ds@print-this-page
1886 .               \}
1887 .       \}
1888 .       nr ds*float-busy 0
1891 .\"---------------
1892 .\" DF out
1893 .\" print a floating diversion
1894 .de ds@output-float
1895 .nr df*old-ll \\n[.l]
1896 .nr df*old-in \\n[.i]
1897 .ev ds*fev
1899 .nr df*i \\n[df*o-fnr]
1900 .nr df*f \\n[df*format!\\n[df*i]]
1902 .in \\n[df*old-in]u
1903 .if \\n[df*f]=1 'in +\\n[Si]n
1904 .if \\n[df*f]>=2 'in 0
1905 .if \\n[df*f]=2 'ce 9999
1906 .if \\n[df*f]=3 'in (u;(\\n[.l]-\\n[df*width!\\n[df*i]])/2)
1907 .if \\n[df*f]=4 'rj 9999
1908 .if \\n[df*f]=5 'in (u;\\n[.l]-\\n[df*width!\\n[df*i]])
1911 .df*fdiv!\\n[df*o-fnr]
1913 .if \\n[df*f]=2 'ce 0
1914 .if \\n[df*f]=4 'rj 0
1916 .rm df*fdiv!\\n[df*i]
1917 .rm df*height!\\n[df*i]
1918 .rm df*format!\\n[df*i]
1919 .if \\n[df*wide!\\n[df*i]] .nr pg*head-mark \\n[nl]u
1920 .nr df*o-fnr +1
1922 .\"---------------
1923 .\" print one floating display if there is one.
1924 .de ds@print-one-float
1925 .if \\n[df*o-fnr]<=\\n[df*fnr] \{\
1926 .       if \\n[D]>3 .tm print-one-float: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1927 .       if \\n[.t]<\\n[df*height!\\n[df*o-fnr]] .pg@next-page
1928 .       ds@output-float
1929 .       if \\n[De] .pg@next-page
1932 .\"---------------
1933 .\" print all queued floats.
1934 .\" if De>0 do a page eject between the floats.
1935 .de ds@print-all-floats
1936 .while \\n[df*o-fnr]<=\\n[df*fnr] \{\
1937 .       if \\n[D]>3 .tm print-all-floats: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1938 .       if \\n[.t]<\\n[df*height!\\n[df*o-fnr]] .pg@next-page
1939 .       br
1941 .       ds@output-float
1942 .       if \\n[De] .pg@next-page
1945 .\"---------------
1946 .\" print as many floats as will fit on the current page
1947 .de ds@print-this-page
1948 .while \\n[df*o-fnr]<=\\n[df*fnr] \{\
1949 .       if \\n[D]>3 .tm print-this-page: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1950 .       if \\n[.t]<\\n[df*height!\\n[df*o-fnr]] .break
1951 .       ds@output-float
1954 .\"---------------------------------------------------
1955 .\" get format of the display
1956 .de ds@set-format
1957 .ie \\n[.$] \{\
1958 .       ie r ds*format!\\$1 .nr ds*format \\n[ds*format!\\$1]
1959 .       el .@error "DS/DF:wrong format:\\$1"
1961 .el .nr ds*format 0
1962 .if \\n[D]>2 .tm set format=\\n[ds*format]
1963 .\" fill or not to fill, that is the...
1964 .nr ds*fill 0
1965 .ie \\n[.$]>1 \{\
1966 .       ie r ds*fill!\\$2 .nr ds*fill \\n[ds*fill!\\$2]
1967 .       el .@error "\\*[ds*type]:wrong fill:\\$2"
1969 .if \\n[D]>2 .tm set fill=\\n[ds*fill]
1970 .nr ds*rindent 0
1971 .if \\n[.$]>2 .nr ds*rindent \\$3
1972 .if \\n[D]>2 .tm set indent=\\n[ds*rindent]
1974 .\"-----------------------------
1975 .\" .ds@set-new-ev previous-line-length
1976 .de ds@set-new-ev
1977 .ll \\$1u
1978 .lt \\$1u
1979 .if \\n[ds*rindent] \{\
1980 .       ll -\\n[ds*rindent]n
1981 .       lt -\\n[ds*rindent]n
1983 .if \\n[ds*wide] \{\
1984 .       ll \\n[@ll]u
1985 .       lt \\n[@ll]u
1988 .ie \\n[ds*fill] 'fi
1989 .el 'nf
1991 .\"--------------------------------------------------------
1992 .nr ds*format 0\"       dummy value for .En/.EQ
1993 .nr ds*format! 0\"      no indent
1994 .nr ds*format!0 0\"     no indent
1995 .nr ds*format!L 0\"     no indent
1996 .nr ds*format!I 1\"     indent
1997 .nr ds*format!1 1\"     indent
1998 .nr ds*format!C 2\"     center each line
1999 .nr ds*format!2 2\"     center each line
2000 .nr ds*format!CB 3\"    center as block
2001 .nr ds*format!3 3\"     center as block
2002 .nr ds*format!R 4\"     right justify each line
2003 .nr ds*format!4 4\"     right justify each line
2004 .nr ds*format!RB 5\"    right justify as block
2005 .nr ds*format!5 5\"     right justify as block
2006 .\"---------------
2007 .nr ds*fill! 0\"        no fill
2008 .nr ds*fill!N 0\"       no fill
2009 .nr ds*fill!0 0\"       no fill
2010 .nr ds*fill!F 1\"       fill on
2011 .nr ds*fill!1 1\"       fill on
2012 .\"--------------------------------------------
2013 .\" static display start
2014 .\" nested DS/DE is allowed. No limit on depth.
2015 .de DS
2017 .nr XXX \\n[nl]
2018 .nr ds*lvl +1
2019 .ds@set-format \\$@
2021 .nr ds*old-ll \\n[.l]
2022 .nr ds*old-in \\n[.i]
2023 .misc@push ds-ll \\n[.l]
2024 .misc@push ds-form \\n[ds*format]
2025 .nr ds*i \\n[.i]
2026 .nr ds*ftmp \\n[.f]
2027 .misc@ev-keep ds*ev!\\n+[ds*snr]
2028 .ft \\n[ds*ftmp]
2030 .init@reset
2031 .\" indent in a diversion doesn't seem like a good idea.
2032 'in 0
2033 .di ds*div!\\n[ds*snr]
2035 .ds@set-new-ev \\n[ds*old-ll]
2036 .nr df*float 0
2038 .\"--------------------------------------------
2039 .de ds@end
2040 .if \\n-[ds*lvl]<0 .@error "DE: no corresponding DS"
2043 .\" **********
2044 .nr ds*width \\n[dl]
2045 .nr ds*height \\n[dn]
2046 .misc@pop-nr ds-ll ds*old-ll
2047 .misc@pop-nr ds-form ds*format
2049 .\" **********
2051 .\" calculate needed space
2052 .nr ds*need \\n[ds*height]
2053 .nr ds*i \\n[pg*foot-trap]-\\n[pg*header-size]u-\\n[pg*extra-header-size]u
2054 .if (\\n[ds*height]>\\n[ds*i])&(\\n[.t]<(\\n[ds*i]/2)) .nr ds*need \\n[.t]u+1v
2055 .if (\\n[ds*height]<\\n[ds*i])&(\\n[.t]<(\\n[ds*height])) .nr ds*need \\n[.t]u+1v
2056 .\"     Eject page if display will fit one page and
2057 .\"     there are less than half of the page left.
2058 .if \\n[ds*need] .ne \\n[ds*need]u
2060 .\" check if pending equation label
2061 .eq@check \\n[ds*need]
2062 'in \\n[ds*old-in]u
2063 .if \\n[ds*format]=1 'in \\n[ds*old-in]u+\\n[Si]n
2064 .if \\n[ds*format]>=2 'in 0
2065 .if \\n[ds*format]=2 'ce 9999
2066 .if \\n[ds*format]=3 'in (u;(\\n[.l]-\\n[ds*width])/2)
2067 .if \\n[ds*format]=4 'rj 9999
2068 .if \\n[ds*format]=5 'in (u;\\n[.l]-\\n[ds*width])
2069 .\" **********
2071 .\"     Print static display
2072 .nr ds*i \\n[Lsp]
2073 .if r Dsp .nr ds*i \\n[Dsp]
2075 .if \\n[Ds] .sp \\n[ds*i]u
2076 .ds*div!\\n[ds*snr]
2077 .if \\n[Ds] .sp \\n[ds*i]u
2079 .if \\n[ds*format]=2 'ce 0
2080 .if \\n[ds*format]=4 'rj 0
2081 .rm ds*div!\\n[ds*snr]
2082 .nr ds*snr -1
2083 .nr par@ind-flag 0
2086 .\"########### module list ###################
2087 .\" .LI text-indent mark-indent pad type [mark [LI-space [LB-space] ] ]
2089 .nr li*tind 0
2090 .nr li*mind 0
2091 .nr li*pad 0
2092 .nr li*type 0
2093 .ds li*mark 0
2094 .nr li*li-spc 0
2095 .nr li*lvl 0 1
2096 .aln :g li*lvl
2097 .nr li*cur-vpos 0
2098 .\"--------------------------
2099 .\"     the major list-begin macro.
2100 .\"     If type == -1 a 'break' will occur.
2101 .de LB
2102 .if \\n[.$]<4 .@error "LB: not enough arguments, min 4"
2103 .misc@push cind \\n[.i]
2104 .misc@push tind \\n[li*tind]
2105 .misc@push mind \\n[li*mind]
2106 .misc@push pad \\n[li*pad]
2107 .misc@push type \\n[li*type]
2108 .misc@push li-spc \\n[li*li-spc]
2109 .ds li*mark-list!\\n[li*lvl] \\*[li*mark]
2110 .nr li*lvl +1
2112 .nr li*tind (n;0\\$1)\"                 text-indent
2113 .nr li*mind (n;0\\$2)\"                 mark-indent
2114 .nr li*pad (n;0\\$3)\"                  pad
2115 .nr li*type 0\\$4\"                     type
2116 .ds li*mark \\$5\"                      mark
2117 .ie !'\\$6'' .nr li*li-spc \\$6\"       LI-space
2118 .el .nr li*li-spc 1
2119 .ie !'\\$7'' .nr li*lb-spc \\$7\"       LB-space
2120 .el .nr li*lb-spc 0
2121 .\" init listcounter
2122 .nr li*cnt!\\n[li*lvl] 0 1
2123 .\" assign format
2124 .af li*cnt!\\n[li*lvl] 1
2125 .if \\n[li*type] .if !'\\*[li*mark]'' .af li*cnt!\\n[li*lvl] \\*[li*mark]
2127 .if \\n[li*lb-spc] .SP (u;\\n[li*lb-spc]*\\n[Lsp])
2128 .in +\\n[li*tind]u
2130 .\"---------------
2131 .de LI
2132 .if \\n[li*lvl]<1 .@error "LI:no lists active"
2133 .if \\n[li*li-spc]&(\\n[Ls]>=\\n[li*lvl]) .SP (u;\\n[li*li-spc]*\\n[Lsp])
2134 .ne 2v
2136 .ds li*c-mark \\*[li*mark]
2137 .nr li*cnt!\\n[li*lvl] +1
2138 .if \\n[li*type]=1 .ds li*c-mark \\n[li*cnt!\\n[li*lvl]].
2139 .if \\n[li*type]=2 .ds li*c-mark \\n[li*cnt!\\n[li*lvl]])
2140 .if \\n[li*type]=3 .ds li*c-mark (\\n[li*cnt!\\n[li*lvl]])
2141 .if \\n[li*type]=4 .ds li*c-mark [\\n[li*cnt!\\n[li*lvl]]]
2142 .if \\n[li*type]=5 .ds li*c-mark <\\n[li*cnt!\\n[li*lvl]]>
2143 .if \\n[li*type]=6 .ds li*c-mark {\\n[li*cnt!\\n[li*lvl]]}
2144 .if \\n[.$]=1 .ds li*c-mark \\$1
2145 .ie \\n[.$]=2 \{\
2146 .       ie (\\$2=2):(\\n[Limsp]=0) .ds li*c-mark \\$1\\*[li*c-mark]
2147 .       el .ds li*c-mark \\$1\ \\*[li*c-mark]
2150 .\" determine where the text begins
2151 .nr li*text-begin \\n[li*tind]>?\w@\\*[li*c-mark]\ @
2152 .nr x \w@\\*[li*c-mark]\ @
2154 .\" determine where the mark begin
2155 .ie !\\n[li*pad] .nr li*in \\n[li*mind]
2156 .el .nr li*in \\n[li*text-begin]-\\n[li*pad]-\w@\\*[li*c-mark]@
2157 .if !\\n[li*in] .nr li*in 0
2159 .ti -\\n[li*tind]u
2160 .\" no indentation if hanging indent
2161 .if (\w@\\*[li*c-mark]@=0)&((\\n[.$]=0):(\w@\\$1@=0)) .nr li*text-begin 0
2162 \Z'\&\h'\\n[li*in]u'\\*[li*c-mark]'\h'\\n[li*text-begin]u'\&\c
2163 .if \\n[li*type]=-1 .br
2166 .\"-------------
2167 .de li@pop
2168 .nr li*lvl -1
2169 .misc@pop-nr cind li*tmp
2170 .in \\n[li*tmp]u
2171 .misc@pop-nr tind li*tind
2172 .misc@pop-nr mind li*mind
2173 .misc@pop-nr pad li*pad
2174 .misc@pop-nr type li*type
2175 .misc@pop-nr li-spc li*li-spc
2176 .ds li*mark \\*[li*mark-list!\\n[li*lvl]]
2178 .de LE
2179 .if \\n[li*lvl]<1 .@error "LE:mismatched"
2180 .li@pop
2181 .if '\\$1'1' .SP \\n[Lsp]u
2183 .\"-------------
2184 .\"     list status clear.
2185 .\"     terminate all lists to level i
2186 .de LC
2187 .ie \\n[.$]<1 .nr li*i 0
2188 .el .nr li*i \\$1
2189 .if \\n[li*i]>\\n[li*lvl] .@error "LC: incorrect argument: \\n[li*i] (too big)"
2190 .while \\n[li*lvl]>\\n[li*i] .li@pop
2191 .nr par@ind-flag 0
2193 .\"-------------
2194 .de AL
2195 .if \\n[.$]>3 .@error "AL: too many arguments"
2196 .if \\n[D]>2 .tm AL $*
2197 .ie \\n[.$]<=1 .LB \\n[Li] 0 2 1 "\\$1"
2198 .el \{\
2199 .       ie \\n[.$]=2 .LB 0\\$2 0 2 1 "\\$1"
2200 .       el \{\
2201 .               ie !'\\$2'' .LB \\$2 0 2 1 "\\$1" 0 1
2202 .               el .LB \\n[Li] 0 2 1 "\\$1" 0 1
2203 .       \}
2206 .de ML
2207 .if \\n[.$]>3 .@error "ML: too many arguments"
2208 .if \\n[D]>2 .tm ML $*
2209 .nr li*ml-width \w@\\$1@u+1n
2210 .if \\n[.$]<2 .LB \\n[li*ml-width]u 0 1 0 "\\$1"
2211 .if \\n[.$]=2 .LB 0\\$2 0 1 0 "\\$1"
2212 .if \\n[.$]=3 \{\
2213 .       ie '\\$2'' .LB \\n[li*ml-width]u 0 1 0 "\\$1" 0 1
2214 .       el .LB \\n[Li] 0 1 0 "\\$1" 0 1
2217 .de VL
2218 .if \\n[D]>2 .tm VL $*
2219 .if \\n[.$]>3 .@error "VL: too many arguments"
2220 .if \\n[.$]<1 .@error "VL: missing text-indent"
2221 .ie \\n[.$]<3 .LB 0\\$1 0\\$2 0 0
2222 .el .LB 0\\$1 0\\$2 0 0 \& 0 1
2224 .\"     Bullet (for .BL)
2225 .de BL
2226 .if \\n[D]>2 .tm BL $*
2227 .ds BU \s-2\(bu\s0
2228 .if \\n[.$]>2 .@error "BL: too many arguments"
2229 .if \\n[.$]<1 .LB \\n[Pi] 0 1 0 \\*[BU]
2230 .if \\n[.$]=1 .LB 0\\$1 0 1 0 \\*[BU]
2231 .if \\n[.$]=2 \{\
2232 .       ie '\\$1'' .LB \\n[Pi] 0 1 0 \\*[BU] 0 1
2233 .       el .LB 0\\$1 0 1 0 \\*[BU] 0 1
2236 .de DL
2237 .if \\n[D]>2 .tm DL $*
2238 .if \\n[.$]>2 .@error "DL: too many arguments"
2239 .if \\n[.$]<1 .LB \\n[Pi] 0 1 0 \(em
2240 .if \\n[.$]=1 .LB 0\\$1 0 1 0 \(em
2241 .if \\n[.$]=2 \{\
2242 .       ie '\\$1'' .LB \\n[Pi] 0 1 0 \(em 0 1
2243 .       el .LB 0\\$1 0 1 0 \(em 0 1
2246 .de RL
2247 .if \\n[D]>2 .tm RL $*
2248 .if \\n[.$]>2 .@error "RL: too many arguments"
2249 .if \\n[.$]<1 .LB 6 0 2 4
2250 .if \\n[.$]=1 .LB 0\\$1 0 2 4
2251 .if \\n[.$]=2 \{\
2252 .       ie '\\$1'' .LB 6 0 2 4 1 0 1
2253 .       el .LB 0\\$1 0 2 4 1 0 1
2256 .\" Broken Variable List. As .VL but text begin on the next line
2257 .de BVL
2258 .if \\n[D]>2 .tm BVL $*
2259 .if \\n[.$]>3 .@error "BVL: too many arguments"
2260 .if \\n[.$]<1 .@error "BVL: missing text-indent"
2261 .ie \\n[.$]<3 .LB 0\\$1 0\\$2 0 -1
2262 .el .LB 0\\$1 0\\$2 0 -1 \& 0 1
2264 .\" ####### module tbl #######################################
2265 .\" This module is copied from groff_ms and modified for mgm.
2266 .\" Yes, it does not resemble the original anymore :-).
2267 .\" Don't know if I missed something important.
2268 .\" Groff_ms is written by James Clark.
2269 .nr tbl*have-header 0
2270 .nr tbl*header-written 0
2271 .de TS
2273 .if ''\\n[.z]' .SP
2274 .if '\\$1'H' .di tbl*header-div
2276 .de tbl@top-hook
2277 .if \\n[tbl*have-header] \{\
2278 .       ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl@print-header
2279 .       el .sp \\n[.t]u
2282 .de tbl@bottom-hook
2283 .if \\n[tbl*have-header] \{\
2284 .       nr T. 1
2285 .\" draw bottom and side lines of boxed tables.
2286 .       T#
2288 .nr tbl*header-written 0
2290 .de tbl@print-header
2291 .ev tbl*ev
2293 .tbl*header-div
2295 .mk #T
2296 .nr tbl*header-written 1
2298 .de TH
2299 .ie '\\n[.z]'tbl*header-div' \{\
2300 .       nr T. 0
2301 .       T#
2302 .       br
2303 .       di
2304 .       nr tbl*header-ht \\n[dn]
2305 .       ne \\n[dn]u+1v
2306 .       nr tbl*have-header 1
2307 .       ie '\\$1'N' .if !\\n[tbl*header-written] .tbl@print-header
2308 .       el .tbl@print-header
2310 .el .@error ".TH without .TS H"
2312 .de TE
2313 .ie '\\n(.z'tbl*header-div' .@error ".TS H but no .TH before .TE"
2314 .el \{\
2315 .       nr tbl*have-header 0
2317 .\" reset tabs
2318 .TAB
2320 .de T&
2322 .\" ####### module pic #######################################
2323 .de PS
2324 .nr pic*in 0
2326 .SP .5
2327 .ie \\n[.$]<2 .@error "PS: bad arguments. Probably not processed with pic."
2328 .el \{\
2329 .       if !\\n[ds*lvl] .ne (u;\\$1)+1v
2330 .\" should be contained between .DS/.DE
2331 .if r ds*format \{\
2332 .               if \\n[ds*lvl]&((\\n[ds*format]=2):(\\n[ds*format]=3)) \{\
2333 .                       nr pic*in \\n[.i]
2334 .\" .           in +(u;\\n[.l]-\\n[.i]-\\$2/2)
2335 .               \}
2336 .       \}
2339 .de PE
2340 .init@reset
2341 .SP .5
2343 .\" ####### module eq #######################################
2344 .\" 
2345 .nr eq*number 0 1
2346 .ds eq*label
2347 .de EQ
2348 .ds eq*label "\\$1
2350 .de eq@check
2351 .if !'\\*[eq*label]'' \{\
2352 .       mk
2353 .       \" space down to middle of equation
2354 '       sp (u;\\$1/2)
2355 .       ie (\\n[Eq]%2) \{\
2356 .               \"      label to the left
2357 \h'|0'\\*[eq*label]
2358 .       \}
2359 .       el \{\
2360 .               \"      label to the right
2361 \h'|\\n[.l]u'\\*[eq*label]
2362 .       \}
2363 .       rt
2365 .ds eq*label
2367 .de EN
2369 .\"########### module toc ###################
2370 .\" table of contents
2371 .nr toc*slevel 1
2372 .nr toc*spacing \n[Lsp]u
2373 .nr toc*tlevel 2
2374 .nr toc*tab 0
2375 .\"-----------
2376 .\" Table of contents with friends (module lix)
2377 .de TC
2379 .\" print any pending displays and references
2380 .df@print-float 3
2381 .if \\n[ref*flag] .RP 0 1
2383 .if \w@\\$1@>0 .nr toc*slevel \\$1
2384 .if \w@\\$2@>0 .nr toc*spacing (u;\\$2*\\n[Lsp])
2385 .if \w@\\$3@>0 .nr toc*tlevel \\$3
2386 .if \w@\\$4@>0 .nr toc*tab \\$4
2387 .if \\n[pg*cols-per-page]>1 .1C
2388 .ds H1txt \\*[Licon]
2389 .ds Tcst co
2390 .pg@clear-hd
2391 .EF ""
2392 .OF ""
2393 .pg@next-page
2394 .\"-------------
2395 .if d Ci .toc@read-Ci \\*[Ci]
2397 .in 0
2398 .ie \\n[Oc] .hd@set-page 1
2399 .el \{\
2400 .       nr toc*pn 1 1
2401 .       af toc*pn i
2402 .       aln ;g toc*pn
2403 .       PF "''\\\\\\\\n[toc*pn]''"
2404 .       am pg@header
2405 .               nr toc*pn +1
2406 \\..
2408 .nr toc*i 4 1
2409 .while \\n+[toc*i]<10 \{\
2410 .       if !'\\$\\n[toc*i]'' \{\
2411 .               ce
2412 \\$\\n[toc*i]
2413 .               br
2414 .       \}
2416 .if \\n[.$]<=4 .if d TX .TX
2417 .ie d TY .if \\n[.$]<=4 .TY
2418 .el \{\
2419 .       ce
2420 \\*[Licon]
2421 .       br
2422 .       SP 3
2424 .if d toc*list .toc*list
2426 .\" print LIST OF XXX
2427 .if d lix*dsfg .lix@print-ds fg FG "\\*[Lf]" \\n[.$]
2428 .if d lix*dstb .lix@print-ds tb TB "\\*[Lt]" \\n[.$]
2429 .if d lix*dsec .lix@print-ds ec EC "\\*[Le]" \\n[.$]
2430 .if d lix*dsex .lix@print-ds ex EX "\\*[Lx]" \\n[.$]
2432 .\"-----------
2433 .\" .toc@read-Ci lev1 lev2 lev3 lev4 ... lev7
2434 .de toc@read-Ci
2435 .nr toc*i 0 1
2436 .while \\n+[toc*i]<15 \{\
2437 .       nr toc*hl!\\n[toc*i] \\$[\\n[toc*i]]
2440 .\"-----------
2441 .de toc@entry
2442 .ie \\n[Sectp] \{\
2443 .       toc@save \\$1 "\\*[hd*mark]" "\\$2" \\*[hd*sect-pg]
2445 .el .toc@save \\$1 "\\*[hd*mark]" "\\$2" \\n[%]
2447 .als )E toc@entry
2448 .\"-----------
2449 .de toc@save
2450 .\" collect maxsize of mark if string Ci don't exist.
2451 .if !d Ci \{\
2452 .       if !r toc*hl!\\$1 .nr toc*hl!\\$1 0
2453 .       if \\n[toc*hl!\\$1]<=\w@\\$2@ \{\
2454 .               nr toc*hl!\\$1 \w@\\$2@u
2455 .       \}
2457 .am toc*list
2458 .\" .toc@set level headernumber text pagenr
2459 .toc@set \\$1 "\\$2" "\\$3" \\$4
2460 \\..
2462 .\"-----------
2463 .\" level mark text pagenumber
2464 .de toc@set
2465 .if \\$1<=\\n[toc*slevel] .SP \\n[toc*spacing]u
2468 .nr toc*ind 0
2469 .nr toc*i 0 1
2470 .ie d Ci \{\
2471 .       nr toc*ind +\\n[toc*hl!\\$1]u
2473 .el \{\
2474 .       while \\n+[toc*i]<\\$1 \{\
2475 .               nr toc*ind +\\n[toc*hl!\\n[toc*i]]u
2476 .       \}
2478 .nr toc*text \\n[toc*ind]u+\\n[toc*hl!\\$1]u
2479 .in \\n[toc*text]u
2480 .ti -\\n[toc*hl!\\$1]u
2482 .\" length of headernum space
2483 .nr toc*i \\n[toc*hl!\\$1]-\w@\\$2@
2485 .ll \\n[@ll]u-\w@\\$4@u-2m
2486 .ne 2v
2487 .\" ragged right ---------------------------------
2488 .ie \\$1>\\n[toc*tlevel] \{\
2489 \\$2
2490 .       sp -1
2491 \\$3\ \ \ \\$4
2492 .       br
2494 .el \{\
2495 .       \" unnumbered heading --------------------
2496 .       ie '\\$2'' \{\
2497 .               in \\n[toc*ind]u
2498 \\$3\h'1m'
2499 .       \}
2500 .       \" normal heading ------------------------
2501 .       el \{\
2502 \\$2
2503 .               sp -1
2504 \\$3\h'1m'
2505 .       \}
2506 .       ll \\n[@ll]u
2507 .       sp -1
2508 .       nr toc*sep (u;\\n[.l]-\\n[.n]-\\n[.i]-\w@\\$4@)-1m
2509 \h'|\\n[.n]u'\l'\\n[toc*sep]u.'\h'1m'\\$4
2511 .ll \\n[@ll]u
2513 .\"########################### module lix ############################
2514 .\" LIST OF figures, tables, exhibits and equations 
2515 .nr lix*fg-nr 0 1
2516 .nr lix*tb-nr 0 1
2517 .nr lix*ec-nr 0 1
2518 .nr lix*ex-nr 0 1
2519 .aln Fg lix*fg-nr
2520 .aln Tb lix*tb-nr
2521 .aln Ec lix*ec-nr
2522 .aln Ex lix*ex-nr
2523 .\"------------
2524 .de FG
2525 .lix@print-line fg Lf \\n+[lix*fg-nr] "\\$1" "\\$2" "\\$3" "\\$4"
2527 .de TB
2528 .lix@print-line tb Lt \\n+[lix*tb-nr] "\\$1" "\\$2" "\\$3" "\\$4"
2530 .de EC
2531 .lix@print-line ec Le \\n+[lix*ec-nr] "\\$1" "\\$2" "\\$3" "\\$4"
2533 .de EX
2534 .lix@print-line ex Lx \\n+[lix*ex-nr] "\\$1" "\\$2" "\\$3" "\\$4"
2536 .\"------------
2537 .\" print line with 'figure' in the text
2538 .\" type stringvar number text override flag refname
2539 .de lix@print-line
2540 .ds lix*text "\\$4
2542 .ie \\n[Sectf] .ds lix*numb \\n[H1]-\\$3
2543 .el .ds lix*numb \\$3
2545 .ie !\\n[Of] .ds lix*ds-form .\ \ \"
2546 .el .ds lix*ds-form "\ \(em\ \"
2547 .nr lix*in \\n[.i]
2548 .ds lix*label \\*[Li\\$1]\ \\*[lix*numb]\\*[lix*ds-form]
2549 .if !'\\$5'' \{\
2550 .       if !0\\$6 .ds lix*label \\*[Li\\$1]\ \\$5\\*[lix*numb]\\*[lix*ds-form]
2551 .       if 0\\$6=1 .ds lix*label \\*[Li\\$1]\ \\*[lix*numb]\\$5\\*[lix*ds-form]
2552 .       if 0\\$6=2 .ds lix*label \\*[Li\\$1]\ \\$5\\*[lix*ds-form]
2554 .\" print line if not between DS/DE
2555 .ie \\n[ds*lvl]<1&\\n[df*float]=0 \{\
2556 .       lix@print-text "\\*[lix*label]" "\\*[lix*text]" \\$1 \\$2 \\$7
2558 .el \{\
2559 .       lix@embedded-text "\\*[lix*label]" "\\*[lix*text]" \\$1 \\$2 \\$7
2563 .\"-----------
2564 .\" label text type stringvar refname
2565 .de lix@print-text
2566 .ie \\n[Sectp] .ds lix*pgnr \\*[hd*sect-pg]
2567 .el .ds lix*pgnr \\n[%]
2568 .SP \\n[Lsp]u
2569 .misc@ev-keep lix
2570 .init@reset
2572 .ie (\w@\\$1\\$2@)>(\\n[.l]-\\n[.i]) \{\
2573 .       in +\w@\\$1@u
2574 .       ti 0
2576 .el .ce 1
2577 \fB\\$1\fP\\$2
2580 .\" save line for LIST OF XXX, wth is the width of the label
2581 .if !r lix*wth\\$3 .nr lix*wth\\$3 0
2582 .\" find the maximum width
2583 .if \w@\\*[lix*label]@>\\n[lix*wth\\$3] .nr lix*wth\\$3 \w@\\*[lix*label]@
2584 .if \\n[\\$4] .lix@ds-save \\$3 \\*[lix*pgnr] "\\*[lix*text]" "\\*[lix*label]"
2585 .\" save reference to the figure
2586 .if !'\\$5'' .SETR \\$5 \\*[lix*numb]
2588 .\" hide printout until diversion is evaluated
2589 .de lix@embedded-text
2590 \!.ie \\\\n[Sectp] .ds lix*pgnr \\\\*[hd*sect-pg]
2591 \!.el .ds lix*pgnr \\\\n[%]
2592 \!.SP \\\\n[Lsp]u
2593 \!.misc@ev-keep lix
2594 \!.ll \\n[.l]u
2595 \!.init@reset
2596 \!.fi
2597 \!.ie (\w@\\$1\\$2@)>(\\\\n[.l]-\\\\n[.i]) \{\
2598 .       in +\w@\\$1@u
2599 \!.     ti 0
2600 \!\fB\\$1\fP\\$2
2601 \!.\}
2602 \!.el \{\
2603 .       ce 1
2604 \!\fB\\$1\fP\\$2
2605 \!.\}
2606 \!.br
2607 \!.ev
2608 .\" save line for LIST OF XXX, wth is the width of the label
2609 \!.if !r lix*wth\\$3 .nr lix*wth\\$3 0
2610 .\" find the maximum width
2611 \!.if \w@\\*[lix*label]@>\\\\n[lix*wth\\$3] .nr lix*wth\\$3 \w@\\*[lix*label]@
2612 \!.if \\\\n[\\$4] .lix@ds-save \\$3 \\\\*[lix*pgnr] "\\*[lix*text]" "\\*[lix*label]"
2613 .\" save reference to the figure
2614 \!.if !'\\$5'' .SETR \\$5 \\*[lix*numb]
2616 .\"------------
2617 .\" print complete list of XXXX
2618 .de lix@print-ds
2619 .\" arg: fg,tb,ec,ex text
2620 .ds H1txt \\$3
2621 .ds Tcst \\$1
2622 .if !\\n[Cp] .pg@next-page
2623 .\" print LIST OF XXXX
2624 .\" execute user-defined macros
2625 .if \\$4<=4 .if d TX\\$2 .TX\\$2
2626 .ie d TY\\$2 .if \\$4<=4 .TY\\$2
2627 .el \{\
2628 .       ce
2629 \\$3
2630 .       SP 3
2632 .in \\n[lix*wth\\$1]u
2634 .lix*ds\\$1
2636 .\"------------
2637 .\" save line of list in macro
2638 .de lix@ds-save
2639 .\" type pagenumber text
2640 .am lix*ds\\$1
2641 .lix@dsln \\$1 \\$2 "\\$3" "\\$4" \\$5
2642 \\..
2644 .\"------------
2645 .\" print appended macro
2646 .\" lix@dsln type pagenumber text headernr
2647 .de lix@dsln
2648 .nr lix*i \\n[lix*wth\\$1]-\w@\\$4@
2649 .ne 4v
2650 .ll \\n[@ll]u-\w@\\$4@u-\w@\\$2@u-2m
2651 .ti -\\n[lix*wth\\$1]u
2652 \\$4
2653 .sp -1
2654 \\$3\h'1m'
2655 .sp -1
2657 .nr lix*sep (u;\\n[.l]-\\n[.n]-\\n[.i]-\w@\\$2@)-1m
2658 \h'|\\n[.n]u'\l'\\n[lix*sep]u.'\h'1m'\\$2
2659 .SP \\n[toc*spacing]u
2661 .\"########################### module fnt ############################
2662 .\" some font macros.
2663 .de R
2664 .ft R
2665 .ul 0
2667 .\"-----------
2668 .de fnt@switch
2669 .ul 0
2670 .ds fnt*tmp
2671 .nr fnt*prev \\n[.f]
2672 .nr fnt*i 2 1
2673 .while \\n+[fnt*i]<=\\n[.$] \{\
2674 .       if \\n[fnt*i]>3 .as fnt*tmp \,
2675 .       ie (\\n[fnt*i]%2)=1 .as fnt*tmp \\$1\\$[\\n[fnt*i]]
2676 .       el .as fnt*tmp \\$2\\$[\\n[fnt*i]]
2677 .       if \\n[fnt*i]<\\n[.$] .as fnt*tmp \/
2679 \&\\*[fnt*tmp]\f[\\n[fnt*prev]]
2681 .\"-----------
2682 .de B
2683 .ie \\n[.$] .fnt@switch \fB \f[\\n[.f]] \\$@
2684 .el .ft B
2686 .de I
2687 .ie \\n[.$] .fnt@switch \fI \f[\\n[.f]] \\$@
2688 .el .ft I
2690 .de IB
2691 .if \\n[.$] .fnt@switch \fI \fB \\$@
2693 .de BI
2694 .if \\n[.$] .fnt@switch \fB \fI \\$@
2696 .de IR
2697 .if \\n[.$] .fnt@switch \fI \fR \\$@
2699 .de RI
2700 .if \\n[.$] .fnt@switch \fR \fI \\$@
2702 .de RB
2703 .if \\n[.$] .fnt@switch \fR \fB \\$@
2705 .de BR
2706 .if \\n[.$] .fnt@switch \fB \fR \\$@
2708 .\"########################### module box ############################
2709 .\" draw a box around some text. Text will be kept on the same page.
2711 .nr box*ll 0
2712 .\" .B1 and .B2 works like .DS
2713 .de B1
2714 .if \\n[box*ll] .@error "B1: missing B2"
2715 .nr box*ll \\n[.l]
2716 .nr box*ind \\n[.i]
2717 .nr box*hyp \\n[.hy]
2718 .nr box*wid \\n[.l]-\\n[.i]
2720 .\" jump to new environment.
2721 .ev box*ev
2722 .di box*div
2723 .ps \\n[@ps]u
2724 .vs \\n[@vs]u
2725 .in 1n
2726 .ll (u;\\n[box*wid]-1n)
2727 .hy \\n[.hy]
2729 .de B2
2730 .if !\\n[box*ll] .@error "B2: missing B1"
2733 .nr box*height \\n[dn]
2734 .ne \\n[dn]u+1v
2735 .ll \\n[box*ll]u
2736 .in \\n[box*ind]u
2737 .nr box*y-pos \\n[.d]u
2739 .box*div
2741 \v'-1v+.25m'\
2742 \D'l \\n[box*wid]u 0'\
2743 \D'l 0 -\\n[box*height]u'\
2744 \D'l -\\n[box*wid]u 0'\
2745 \D'l 0 \\n[box*height]u'
2747 .sp -1
2749 .sp .20v
2750 .in \\n[box*ind]u
2751 .ll \\n[box*ll]u
2752 .rm box*div
2753 .nr box*ll 0
2755 .\"########################### module ref ############################
2756 .nr ref*nr 0 1
2757 .aln :R ref*nr
2758 .nr ref*nr-width 5n
2759 .nr ref*flag 0          \" for end-of-text
2760 .ds Rf \v'-.4m'\s-3[\\n+[ref*nr]]\s0\v'.4m'
2762 .\" start reference
2763 .\"------------
2764 .de RS
2765 .if !''\\$1' .ds \\$1 \v'-.4m'\s-3[\\n[ref*nr]]\s0\v'.4m'
2766 .nr ref*flag 1
2767 .am ref*mac
2768 .ref@start-print \\n[ref*nr]
2769 \\..
2771 .am ref*mac RF
2773 .\"------------
2774 .de RF
2776 .am ref*mac
2777 .ref@stop-print
2778 \\..
2780 .\"------------
2781 .de ref@start-print
2782 .di ref*div
2783 .in \\n[ref*nr-width]u
2784 .ti -(\w@\\$1.@u+1n)
2785 \\$1.
2786 .sp -1
2788 .de ref@stop-print
2791 .ne \\n[dn]u
2792 .ev ref*ev2
2794 .ref*div
2796 .rm ref*div
2797 .if \\n[Ls] .SP \\n[Lsp]u
2799 .\"-----------
2800 .de RP
2801 .if !d ref*mac .@error "RP: No references!"
2802 .nr ref*i 0\\$2
2803 .if \\n[ref*i]<2 .SK
2804 .SP 2
2805 .ref@print-refs
2806 .if 0\\$1<1 .nr ref*nr 0 1
2807 .if ((\\n[ref*i]=0):(\\n[ref*i]=2)) .SK
2809 .\"-----------
2810 .\" called by end-of-text!
2811 .de ref@eot-print
2812 .\".if \\n[ref*flag] \{
2813 .if d ref*mac \{\
2814 .       if \\n[D]>2 .tm Print references, called by eot
2815 .       nr ref*flag 0
2816 .       br
2817 .       misc@ev-keep ne
2818 .       init@reset
2820 '       bp
2821 .       ev
2822 .       ref@print-refs
2825 .\"-----------
2826 .\" prints the references
2827 .de ref@print-refs
2828 .toc@save 1 "" "\\*[Rp]" \\n[%]
2830 \fI\\*[Rp]\fP
2832 .nr ref*ll \\n[.l]
2833 .misc@ev-keep ref*ev
2834 .ll \\n[ref*ll]u
2835 .in 0
2836 .ref*mac
2838 .rm ref*mac
2840 .nr ref*flag 0 1
2842 .\"########################### module app ############################
2843 .\" 
2844 .nr app*nr 0 1
2845 .af app*nr A
2846 .nr app*dnr 0 1
2847 .nr app*flag 0
2848 .\"------------
2849 .\" .APP name text
2850 .\" name == "" -> autonumber
2851 .de APP
2852 .\" .if \\n[.$]<2 .@error "APP: too few arguments"
2853 .app@set-ind "\\$1"
2855 .ds Tcst ap
2856 .ds Apptxt \\$2
2858 .ie \\n[Aph] .app@header \\*[app*ind] "\\$2"
2859 .el .bp
2860 .app@index "\\*[app*ind]" "\\$2"
2862 .\"------------
2863 .\" .APPSK name pages text
2864 .\" name == "" -> autonumber
2865 .de APPSK
2866 .if \\n[.$]<2 .@error "APPSK: too few arguments"
2867 .app@set-ind "\\$1"
2869 .ds Tcst ap
2870 .ds Apptxt \\$3
2872 .ie \\n[Aph] .app@header \\*[app*ind] "\\$3"
2873 .el .bp
2874 .app@index "\\*[app*ind]" "\\$3"
2875 .pn +\\$2
2877 .\"------------
2878 .de app@set-ind
2879 .ie \w@\\$1@ .ds app*ind \\$1
2880 .el \{\
2881 .       if !\\n[app*flag] \{\
2882 .               nr H1 0 1
2883 .               af H1 A
2884 .               af H1h A
2885 .               nr app*flag 1
2886 .       \}
2887 .       ds app*ind \\n+[app*nr]
2888 .       nr H1 \\n+[app*dnr]
2889 .       nr H1h \\n[app*dnr] 
2891 .\"     clear lower counters
2892 .nr app*i 1 1
2893 .while \\n+[app*i]<15 .nr H\\n[app*i] 0 1
2895 .\"------------
2896 .de app@index
2897 .toc@save 1 "" "\\*[App] \\$1: \\$2" \\n[%]
2899 .\"------------
2900 .\" app@heaer name text
2901 .de app@header
2903 .SP (u;\\n[Lsp]*4)
2904 .ce 1
2905 \s+4\fB\\*[App]\ \\$1\fP\s0
2906 .SP (u;\\n[Lsp]*2)
2907 .if \w@\\$2@<\\n[.l] .ce 1
2908 \fB\s+2\\$2\s0\fP
2909 .SP (u;\\n[Lsp]*4)
2911 .als APPX app@header
2912 .\"########################### module cov ############################
2913 .\" title stored in diversion cov*title
2914 .\" abstract stored in diversion cov*abstract
2915 .\"     arg to abstract stored in cov*abs-arg
2916 .\"     indent stored in cov*abs-ind
2917 .\" number of authors stored in cov*au
2918 .\" author(s) stored in cov*au!x!y
2919 .\" author(s) title stored in cov*at!x!y
2920 .\"     x is the author-index [1-cov*au], y is the argument-index [1-9].
2921 .\" author(s) firm stored in cov*firm
2922 .\" new date (if .ND exists) is stored in cov*new-date
2925 .ds cov*abs-name ABSTRACT
2927 .nr cov*au 0
2928 .de TL
2929 .rm IA IE WA WE LO LT
2930 .if \\n[.$]>0 .ds cov*title-charge-case \\$1
2931 .if \\n[.$]>1 .ds cov*title-file-case \\$2
2932 .pg@disable-top-trap
2934 .de cov*title AU
2936 .\"-------------------
2937 .de cov@title-end
2940 .\"-------------------
2941 .\" .AU name [initials [loc [dept [ext [room [arg [arg [arg]]]]]]]]
2942 .de AU
2943 .cov@title-end
2944 .pg@disable-top-trap
2945 .nr cov*au +1
2946 .nr cov*i 0 1
2947 .ds cov*au!\\n[cov*au]!1
2948 .while \\n[.$]>=\\n+[cov*i] \{\
2949 .       ds cov*au!\\n[cov*au]!\\n[cov*i] "\\$[\\n[cov*i]]
2951 .if (\\n[.$]>=3)&(\w@\\$3@) \{\
2952 .       if d cov*location-\\$3] \{\
2953 .               ds cov*au!3!\\n[cov*au] \\*[cov*location-\\$3]
2954 .       \}
2957 .\"-------------------
2958 .\" .AT title1 [title2 [... [title9] ]]]]
2959 .\" Well, thats all that COVEND look for.
2960 .\" Must appear directly after .AU
2961 .de AT
2962 .if \\n[.$]<1 .@error "AT: no arguments"
2963 .nr cov*i 0 1
2964 .while \\n[.$]>=\\n+[cov*i] \{\
2965 .       ds cov*at!\\n[cov*au]!\\n[cov*i] "\\$[\\n[cov*i]]
2968 .\"-------------------
2969 .de AF
2970 .cov@title-end
2971 .if !''\\$1' .ds cov*firm \\$1
2973 .de AST
2974 .ds cov*abs-name \\$1
2976 .de AS
2977 .pg@disable-top-trap
2978 .if d cov*abstract .@error "AS: only one abstract allowed"
2979 .if !''\\n[.z]' .@error "AS: no diversion allowed (previous .AS?)"
2980 .nr cov*abs-arg 0\\$1
2981 .nr cov*abs-ind (n;0\\$2)
2982 .de cov*abstract AE
2984 .de AE
2986 .\" fixed for 2000, now uses \n[year].
2987 .de ISODATE
2988 .       \" support for ISO-date
2989 .       nr cov*mm \\n[mo]
2990 .       nr cov*dd \\n[dy]
2991 .       af cov*mm 01
2992 .       af cov*dd 01
2993 .       ie '0'\\$1' \{\
2994 .               ds cov*new-date \\*[MO\\n[mo]] \\n[dy], \\n[year]
2995 .       \}
2996 .       el \{\
2997 .               ds cov*new-date \\n[year]-\\n[cov*mm]-\\n[cov*dd]
2998 .       \}
3000 .ISODATE 0
3001 .als DT cov*new-date
3002 .de ND
3003 .ds cov*new-date \\$1
3005 .\" switch to ISO-date if register Iso exist: YYYY-MM-DD
3006 .if r Iso .ISODATE 1
3007 .\"-------------------
3008 .\" save technical numbers.
3009 .de TM
3010 .nr cov*i 0 1
3011 .while \\n[.$]>=\\n+[cov*i] .ds cov*mt-tm!\\n[cov*i] \\$[\\n[cov*i]]
3012 .nr cov*mt-tm-max \\n[.$]
3014 .\"-----------------------
3015 .\" cover sheet
3016 .\" the file must have the following last lines (somewhere):
3017 .\" .pg@enable-top-trap
3018 .\" .bp 1
3019 .\" .pg@enable-trap
3020 .ds cov*mt-file!0 0.MT
3021 .ds cov*mt-file!1 0.MT
3022 .ds cov*mt-file!2 0.MT
3023 .ds cov*mt-file!3 0.MT
3024 .ds cov*mt-file!4 4.MT
3025 .ds cov*mt-file!5 5.MT
3026 .ds cov*mt-file!6 0.MT
3027 .\"------------
3028 .de MT
3029 .ie \\n[.$] \{\
3030 .       ie d cov*mt-file!\\$1 .ds cov*mt-type \\$1
3031 .       el .ds cov*mt-type 6
3033 .el .ds cov*mt-type 1
3034 .ds cov*mt-addresse "\\$2
3035 .ds cov*mt-type-text "\\$1
3036 .ie d @language .ds cov*str mm/\\*[@language]_
3037 .el .ds cov*str mm/
3038 .mso \\*[cov*str]\\*[cov*mt-file!\\*[cov*mt-type]]
3040 .de COVER
3041 .ie !\\n[.$] .ds cov*cov-type ms
3042 .el .ds cov*cov-type \\$1
3043 .pg@disable-top-trap
3044 .ie d @language .ds cov*str mm/\\*[@language]_\\*[cov*cov-type].cov
3045 .el .ds cov*str mm/\\*[cov*cov-type].cov
3046 .mso \\*[cov*str]
3048 .\"########################### module qrf ############################
3049 .\" forward and backward reference thru special files.
3051 .\" check if stderr-method is wanted
3052 .\" This was needed when I discovered that groff was considered unsafe
3053 .\" and groff -U didn't work. It's a workaround like the original
3054 .\" index method, but not in my view elegant enough.
3056 .\" init reference system
3057 .de INITR
3058 .ds qrf*file \\$1.qrf
3059 .nr qrf*pass 2
3060 .if \\n[D]>1 .tm INITR: source \\*[qrf*file]
3061 .ie \\n[Ref] \{\
3062 .       tm .\\\\" Rfilename: \\*[qrf*file]
3064 .el 'so  \\*[qrf*file]
3066 .\"---------------
3067 .\" set a reference.
3068 .de SETR
3069 .if \\n[.$]<1 .@error "SETR:reference name missing"
3070 .if !r qrf*pass .tm "SETR: No .INITR in this file"
3071 .if \\n[Ref] \{\
3072 .       ds qrf*name qrf*ref-\\$1
3073 .       if \\n[D]>2 .tm SETR: ref \\*[qrf*name]=\\*[hd*mark],\\n[%]
3074 .       \" heading-number
3075 .       ds \\*[qrf*name]-hn \\*[hd*mark]
3076 .       \" page-number
3077 .       ds \\*[qrf*name]-pn \\n[%]
3078 .       \"
3079 .       if \\n[Ref] \{\
3080 .               tm .ds \\*[qrf*name]-hn \\*[hd*mark]
3081 .               tm .ds \\*[qrf*name]-pn \\n[%]
3082 .               if !'\\$2'' .tm .ds \\*[qrf*name]-xx \\$2
3083 .       \}
3086 .\"---------------
3087 .\" get misc-string
3088 .\" If two arg -> set var. arg to misc-string.
3089 .de GETST
3090 .if \\n[.$]<1 .@error "GETST:reference name missing"
3091 .if !r qrf*pass .tm "GETST: No .INITR in this file"
3092 .ds qrf*name qrf*ref-\\$1
3093 .       if d \\*[qrf*name]-xx \{\
3094 .               ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-xx]
3095 .               el \\*[\\*[qrf*name]-xx]\c
3096 .       \}
3099 .\"---------------
3100 .\" get header-number
3101 .\" If two arg -> set var. arg to header-number.
3102 .de GETHN
3103 .if \\n[.$]<1 .@error "GETHN:reference name missing"
3104 .if !r qrf*pass .tm "GETHN: No .INITR in this file"
3105 .ds qrf*name qrf*ref-\\$1
3106 .if d \\*[qrf*name]-hn \{\
3107 .       ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-hn]
3108 .       el \\*[\\*[qrf*name]-hn]\c
3111 .\"---------------
3112 .\" get page-number
3113 .\" If two arg -> set var. arg to page-number.
3114 .de GETPN
3115 .if \\n[.$]<1 .@error "GETPN:reference name missing"
3116 .if !r qrf*pass .tm "GETPN: No .INITR in this file"
3117 .ds qrf*name qrf*ref-\\$1
3118 .if d \\*[qrf*name]-pn \{\
3119 .       ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-pn]
3120 .       el \\*[\\*[qrf*name]-pn]\c
3123 .\"----------
3124 .de GETR
3125 .if \\n[.$]<1 .@error "GETR:reference name missing"
3126 .ie !r qrf*pass \{\
3127 .       tm "GETR: No .INITR in this file"
3129 .el \{\
3130 .       GETHN \\$1 Qrfh
3131 .       GETPN \\$1 Qrfp
3132 \\*[Qrf]
3135 .\"########################### module ind ############################
3136 .\" Support for mgs-style indexing, borrowed from mgs.
3137 .de IX
3138 .       tm \\$1\t\\$2\t\\$3\t\\$4 ... \\n[%]
3140 .\"--------------------
3141 .\" Another type of index system
3142 .\" INITI type filename [macro]
3143 .de INITI
3144 .if \\n[.$]<1 .@error "INITI:type missing"
3145 .\" ignore if INITI has already been used
3146 .if \\n[.$]>1 \{\
3147 .       if d ind*file .@error "INITI:file already set"
3148 .       ds ind*file \\$2.ind
3149 .       if \\n[D]>1 .tm INITI: source \\*[ind*file]
3151 .if !d ind*file .@error "INITI:file not specified"
3152 .ds ind*type \\$1
3153 .if \\n[Ref] \{\
3154 .       if \\n[.$]>2 .tm .\\\\" Imacro: \\$3
3157 .\"---------------
3158 .de IND
3159 .if !d ind*file .@error "IND: No active INITI"
3160 .if \\n[D]>1 .tm IND: type=\\*[ind*type]
3161 .ds ind*ref
3162 .if '\\*[ind*type]'N' .ds ind*ref \\n[%]
3163 .if '\\*[ind*type]'H' .ds ind*ref \\*[hd*mark]
3164 .if '\\*[ind*type]'B' .ds ind*ref \\*[hd*mark]\t\\n[%]
3165 .if '\\*[ind*ref]'' .@error "IND:wrong index type: \\*[ind*ref]"
3167 .ds ind*line \\$1
3168 .while \\n[.$]>0 \{\
3169 .       shift
3170 .       as ind*line \t\\$1
3172 .as ind*line \\*[ind*ref]
3173 .if \\n[Ref] .tm .\\\\" IND \\*[ind*line]
3175 .\" print index
3176 .de INDP
3177 .ie \\n[Ref] .tm .\\\\" Index: \\*[ind*file]
3178 .el \{\
3179 .       if !\\n[Cp] .pg@next-page
3180 .       \" print INDEX
3181 .       \" execute user-defined macros
3182 .       if d TXIND .TXIND
3183 .       ie d TYIND .TYIND
3184 .       el \{\
3185 .               SK
3186 .               ce
3187 \\*[Index]
3188 .               SP 3
3189 .               2C
3190 .               nf
3191 .       \}
3192 '       so  \\*[ind*file]
3193 .       ie d TZIND .TZIND
3194 .       el \{\
3195 .               fi
3196 .               1C
3197 .       \}
3199 .rm ind*file
3201 .\"########################### module let ############################
3202 .\" Letter macros
3203 .\"------------------------
3204 .\" Formal closing
3205 .de FC
3206 .df@print-float 3
3207 .ie \\n[.$] .ds let*i \\$1
3208 .el .ds let*i \\*[Letfc]
3209 .ie d let*type .let@fc_\\*[let*type] "\\*[let*i]" \\$@
3210 .el .let@mt-closing "\\*[let*i]" \\$@
3212 .\"-------
3213 .de let@mt-closing
3214 .ne 5v
3215 .in (u;\\n[.l]/2)
3217 \\$1
3220 .\"------------------------
3221 .\" Signature line
3222 .de SG
3223 .ie d let*type .let*lt-sign \\$@
3224 .el .let*mt-sign \\$@
3226 .\"------------------------
3227 .de let*lt-sign
3228 .if !d let@sg_\\*[let*type] .@error "SG: letter type \\*[let*type] undefined"
3229 .df@print-float 3
3230 .nr let*i 0 1
3231 .nr let*j 0
3232 .while \\n+[let*i]<=\\n[let*wa-n] \{\
3233 .if \\n[let*i]=\\n[let*wa-n] .nr let*j 1
3234 .let@sg_\\*[let*type] "\\*[let*wa-name!\\n[let*i]]" "\\*[let*wa-title!\\n[let*i]]" \\n[let*i] \\n[let*j] \\$@
3237 .\"------------------------
3238 .\" Memorandum signature
3239 .de let*mt-sign
3240 .df@print-float 3
3241 .ne \\n[cov*au]u*4v
3242 .ie \\n[.$]>1 .nr let*k 1
3243 .el .nr let*k \\n[cov*au]
3244 .ds let*tmp \\*[cov*au!\\n[let*k]!3]-\\*[cov*au!\\n[let*k]!4]-
3245 .nr let*i 0 1
3246 .while \\n+[let*i]<=\\n[cov*au] \{\
3247 .       if \\n[let*i]>1 .as let*tmp /
3248 .       as let*tmp \\*[cov*au!\\n[let*k]!2]
3250 .if !''\\$1' .as let*tmp -\\$1
3251 .in (u;\\n[.l]/2)
3253 .nr let*i 0 1
3254 .while \\n+[let*i]<=\\n[cov*au] \{\
3255 .       SP 3v
3256 .       if \\n[let*i]=\\n[let*k] \{\
3257 \Z'\h'-(u;\\n[.l]/2)'\\*[let*tmp]'\c
3258 .       \}
3259 \\*[cov*au!\\n[let*i]!1]
3264 .\"------------------------
3265 .\" Approval signature
3266 .de AV
3267 .ne 6v
3270 .ie \\n[.$]<2 \\*[Letapp]
3271 .el .sp
3272 .sp 2
3273 .ie n ______________________________      ______________
3274 .el \D'l 25m 0'\h'4m'\D'l 12m 0'
3275 \Z'\\$1'\h'29m'\f[\\*[@sdf_font]]\\*[Letdate]\fP
3278 .\"------------------------
3279 .\" Letter signature
3280 .de AVL
3281 .ne 6v
3283 .sp 3
3284 .ie n ______________________________
3285 .el \D'l 25m 0'
3286 \Z'\\$1'
3289 .\"------------------------
3290 .\" Letter type
3291 .\" let@header is called from the header. It is supposed
3292 .\" to remove the alias itself.
3293 .de LT
3294 .rm AF AS AE AT AU CS OK TL MT
3295 .ds let*type BL
3296 .nr Pi 5
3297 .nr Pt 0
3298 .if !''\\$1' .ds let*type \\$1
3299 .if !d let@head_\\*[let*type] .@error "LT: unknown letter type \\$1"
3300 .shift
3301 .als let@header let@head_\\*[let*type]
3302 .let@init_\\*[let*type] \\$@
3303 .if \n[D]>1 .tm Letter type \\*[let*type]
3305 .\"-----------
3306 .\" Blocked letter
3307 .de let@init_BL
3309 .de let@head_BL
3310 .rm let@header
3311 .let@print-head 1
3313 .de let@sg_BL
3314 .ne 5v
3316 .in (u;\\n[.l]/2)
3317 .sp 3v
3318 \\$1
3319 \\$2
3321 .if \\$4 .sp
3322 .if \w'\\$5'&\\$4 \\$5
3325 .als let@fc_BL let@mt-closing
3326 .\"-----------
3327 .\" Semiblocked letter
3328 .de let@init_SB
3329 .nr Pt 1
3331 .de let@head_SB
3332 .rm let@header
3333 .let@print-head 1
3335 .als let@sg_SB let@sg_BL
3336 .als let@fc_SB let@mt-closing
3337 .\"-----------
3338 .\" Full-blocked letter
3339 .de let@init_FB
3341 .de let@head_FB
3342 .rm let@header
3343 .let@print-head
3345 .de let@sg_FB
3346 .ne 5v
3348 .sp 3v
3349 \\$1
3350 \\$2
3351 .if \\$4 .sp
3352 .if \w'\\$5'&\\$4 \\$5
3355 .de let@fc_FB
3356 .ne 5v
3358 \\$1
3360 .\"-----------
3361 .\" Simplified letter
3362 .de let@init_SP
3364 .de let@head_SP
3365 .rm let@header
3366 .let@print-head
3368 .de let@sg_SP
3370 .if \\$3=1 .sp
3372 .misc@toupper "\\$1, \\$2"
3373 .if \\$4 .sp
3374 .if \w'\\$5'&\\$4 \\$5
3377 .de let@fc_SP
3378 .sp 2
3380 .\"--------------------------------------
3381 .\" Print the letter-head
3382 .de let@print-head
3384 .sp |11
3385 .if '1'\\$1' .in (u;\\n[.l]/2)
3386 .\" ---- WA
3387 .ie d let@wa-div .let@wa-div
3388 .el .sp 3
3389 .\" ---- datum
3390 \\*[cov*new-date]
3392 .if '1'\\$1' .if !d let*lo-CN .if !d let*lo-RN .sp 2
3393 .\" ---- Confidential
3394 .if d let*lo-CN \{\
3395 .       ti 0
3396 .       ie !''\\*[let*lo-CN]' \\*[let*lo-CN]
3397 .       el \\*[LetCN]
3398 .       sp
3400 .\" ---- Reference
3401 .if d let*lo-RN \{\
3402 \\*[LetRN] \\*[let*lo-RN]
3403 .       sp
3405 .\" ---- IA
3407 .in 0
3408 .nr let*i 0 1
3409 .while \\n+[let*i]<=\\n[let*ia-n] \{\
3410 \\*[let*ia-name!\\n[let*i]]
3411 \\*[let*ia-title!\\n[let*i]]
3413 .if d let@ia-div .let@ia-div
3414 .\" ---- Attention
3415 .if d let*lo-AT \{\
3416 .       sp
3417 \\*[LetAT] \\*[let*lo-AT]
3419 .\" ---- Salutation
3420 .if !'\\*[let*type]'SP' .if d let*lo-SA \{\
3421 .       sp
3422 .       ti 0
3423 .       ie !''\\*[let*lo-SA]' \\*[let*lo-SA]
3424 .       el \\*[LetSA]
3426 .\" ---- Subject
3427 .if d let*lo-SJ \{\
3428 .       ie '\\*[let*type]'SP' \{\
3429 .               sp 2
3430 .               misc@toupper \\*[let*lo-SJ]
3431 .               sp
3432 .       \}
3433 .       el \{\
3434 .               sp
3435 .               if '\\*[let*type]'SB' .ti +5m
3436 \\*[LetSJ] \f[\\*[@sdf_font]]\\*[let*lo-SJ]\fP
3437 .       \}
3440 .\"-------------------
3441 .\" .IA [name [title]]
3442 .nr let*ia-n 0 1
3443 .de IA
3444 .if \\n[.$] .ds let*ia-name!\\n+[let*ia-n] \\$1
3445 .if \\n[.$]>1 .ds let*ia-title!\\n[let*ia-n] \\$2
3446 .ev let@ev
3447 .init@reset
3449 .di let@ia-div
3452 .de IE
3457 .\"-------------------
3458 .\" .WA [name [title]]
3459 .nr let*wa-n 0 1
3460 .de WA
3461 .if \\n[.$] .ds let*wa-name!\\n+[let*wa-n] \\$1
3462 .if \\n[.$]>1 .ds let*wa-title!\\n[let*wa-n] \\$2
3463 .ev let@ev
3464 .init@reset
3466 .di let@wa-div
3467 .it \\n[Letwam] let@wa-drain
3470 .\"------
3471 .de let@wa-drain
3474 .di let@wa-junk
3476 .\"------
3477 .de WE
3482 .if d let@wa-junk .rm let@wa-junk
3484 .\"-------------------
3485 .\" Copy to
3486 .de NS
3488 .ie !''\\$2' .ds let*str \\$1
3489 .el \{\
3490 .       ie \\n[.$]>0 \{\
3491 .               ie !\w'\\$1' .ds let*str \\*[Letns!\\*[Letnsdef]]
3492 .               el \{\
3493 .                       ie d Letns!\\$1 .ds let*str \\*[Letns!\\$1]
3494 .                       el .ds let*str \\*[Letns!copy](\\$1)\\*[Letns!to]
3495 .               \}
3496 .       \}
3497 .       el .ds let*str \\*[Letns!\\*[Letnsdef]]
3499 .ne 2
3501 \\*[let*str]
3503 .de NE
3506 .\"-------------------
3507 .\" Letter options
3508 .de LO
3509 .rm AF AS AE AT AU CS OK TL MT
3510 .if ''\\$1' .@error "LO: missing option"
3511 .if !d Let\\$1 .@error "LO: unknown option (\\$1)"
3512 .ds let*lo-\\$1 \\$2
3513 .if \n[D]>1 .tm Letter option \\$1 \\$2
3515 .\"--------------------
3516 .\" Start with a clean slate
3517 .init@reset