PageRenderTime 66ms CodeModel.GetById 13ms app.highlight 31ms RepoModel.GetById 1ms app.codeStats 1ms

/contrib/groff/contrib/mm/m.tmac

https://bitbucket.org/freebsd/freebsd-head/
Unknown | 3536 lines | 3530 code | 6 blank | 0 comment | 0 complexity | bec6fe6abc9267b7102c33c011b42f2f MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1.\"  
   2.de @revision
   3.ds RE \\$2
   4..
   5.\"
   6.\" $Id: m.tmac,v 2.26 2005/05/26 06:28:38 wl Exp $
   7.@revision $Revision: 2.26 $
   8.ig
   9
  10Copyright (C) 1991-2000, 2001, 2002, 2003, 2004, 2005
  11  Free Software Foundation, Inc.
  12mgm is written by Jörgen Hägg <jh@axis.com>
  13
  14mgm is free software; you can redistribute it and/or modify it under
  15the terms of the GNU General Public License as published by the Free
  16Software Foundation; either version 2, or (at your option) any later
  17version.
  18
  19mgm is distributed in the hope that it will be useful, but WITHOUT ANY
  20WARRANTY; without even the implied warranty of MERCHANTABILITY or
  21FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  22for more details.
  23
  24You should have received a copy of the GNU General Public License along
  25with groff; see the file COPYING.  If not, write to the Free Software
  26Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  27
  28Please send bugreports with examples to jh@axis.com.
  29
  30Naming convention stolen from mgs.
  31Local names	module*name
  32Extern names	module@name
  33Env.var		environ:name
  34Index		array!index
  35..
  36.if !\n(.g .ab These mm macros require groff.
  37.do if d PH .nx
  38.if \n(.C .ab The groff mm macros do not work in compatibility mode.
  39.if (\n[.warn] == 65543) .warn
  40.mso devtag.tmac
  41.\" ######## init #######
  42.\"	Contents level [0:14], contents saved if heading level <= Cl
  43.nr Cl 2
  44.\"	Eject page between LIST OF XXXX if Cp == 0
  45.nr Cp 0
  46.\"	Debugflag
  47.if !r D .nr D 0
  48.\"	Eject after floating display is output [0:1]
  49.nr De 0
  50.\"	Floating keep output [0;5]
  51.nr Df 5
  52.\"	space before and after display if == 1 [0:1]
  53.nr Ds 1
  54.\"	Eject page
  55.nr Ej 0
  56.\"	Equation label adjust 0=left, 1=right
  57.nr Eq 0
  58.\"	Em dash string
  59.ie n .ds EM " --
  60.el .ds EM \(em
  61.\"	Footnote spacing
  62.nr Fs 1
  63.\"	H1-H7	heading counters
  64.nr H1 0 1
  65.nr H2 0 1
  66.nr H3 0 1
  67.nr H4 0 1
  68.nr H5 0 1
  69.nr H6 0 1
  70.nr H7 0 1
  71.nr H8 0 1
  72.nr H9 0 1
  73.nr H10 0 1
  74.nr H11 0 1
  75.nr H12 0 1
  76.nr H13 0 1
  77.nr H14 0 1
  78.\"	Heading break level [0:14]
  79.nr Hb 2
  80.\"	heading centering level, [0:14]
  81.nr Hc 0
  82.\"	header format
  83.ds HF 2 2 2 2 2 2 2 2 2 2 2 2 2 2
  84.\"	heading temp. indent [0:2]
  85.\"	0 -> 0 indent, left margin
  86.\"	1 -> indent to right , like .P 1
  87.\"	2 -> indent to line up with text part of preceding heading
  88.nr Hi 1
  89.\"	header pointsize
  90.ds HP 0 0 0 0 0 0 0 0 0 0 0 0 0 0
  91.\"	heading space level [0:14]
  92.nr Hs 2
  93.\"	heading numbering type
  94.\"	0 -> multiple (1.1.1 ...)
  95.\"	1 -> single
  96.nr Ht 0
  97.\"	Unnumbered heading level
  98.nr Hu 2
  99.\"	hyphenation in body
 100.\"	0 -> no hyphenation
 101.\"	1 -> hyphenation 14 on
 102.nr Hy 0
 103.\"	text for toc, selfexplanatory. Look in the new variable section
 104.ds Lf LIST OF FIGURES
 105.nr Lf 1
 106.ds Lt LIST OF TABLES
 107.nr Lt 1
 108.ds Lx LIST OF EXHIBITS
 109.nr Lx 1
 110.ds Le LIST OF EQUATIONS
 111.nr Le 0
 112.\"	List indent, used by .AL
 113.nr Li 6
 114.\"	List space, if listlevel > Ls then no spacing will occur around lists.
 115.nr Ls 99
 116.\"	Numbering style [0:5]
 117.if !r N .nr N 0
 118.\"	numbered paragraphs
 119.\"	0 == not numbered
 120.\"	1 == numbered in first level headings.
 121.nr Np 0
 122.\"	Format of figure,table,exhibit,equation titles.
 123.\"	0= ". ", 1=" - "
 124.nr Of 0
 125.\"	Table of contents page numbering style
 126.nr Oc 0
 127.\"	Page-number, normally same as %.
 128.nr P 0
 129.\"	paragraph indent
 130.nr Pi 5
 131.\"	paragraph spacing
 132.nr Ps 1
 133.\"	paragraph type
 134.\"	0 == left-justified
 135.\"	1 == indented .P
 136.\"	2 == indented .P except after .H, .DE or .LE.
 137.nr Pt 0
 138.\"	Reference title
 139.ds Rp REFERENCES
 140.\"	Display indent
 141.nr Si 5
 142.\"
 143.\" Current state of TOC, empty outside TC, inside
 144.\" it will be set to co,fg,tb,ec,ex or ap.
 145.ds Tcst
 146.\"
 147.ds Tm \(tm
 148.\"
 149.\"---------------------------------------------
 150.\"	Internal global variables
 151.\"
 152.\" This is for cover macro .MT
 153.\" .ds @language
 154.\"
 155.nr @copy_type 0
 156.if r C .nr @copy_type \n[C]
 157.\" >0 if Subject/Date/From should be bold, roman otherwise
 158.ie n .ds @sdf_font R
 159.el .ds @sdf_font B
 160.if \n[@copy_type]=4 \{\
 161.	ls 2
 162.	nr Pi 10
 163.	nr Pt 1
 164.\}
 165.\"
 166.\"
 167.if r E \{\
 168.	ie \n[E] .ds @sdf_font B
 169.	el .ds @sdf_font R
 170.\}
 171.\"
 172.\"	Current pointsize and vertical space, always in points.
 173.if !r S .nr S 10
 174.ps \n[S]
 175.vs \n[S]+2
 176.\"
 177.nr @ps \n[.ps]
 178.nr @vs \n[.v]
 179.if \n[D]>1 .tm @ps=\n[@ps], @vs=\n[@vs]
 180.if \n[D]>3 .tm INIT: l:\n[.l] p:\n[.p] o:\n[.o]
 181.\"
 182.\"	Page length
 183.if r L \{\
 184.	ie n .pl \n[L]u
 185.	el .pl \n[L]u
 186.\}
 187.nr @pl \n[.p]
 188.\"
 189.\"	page width
 190.ie r W \{\
 191.	ie n .ll \n[W]u
 192.	el .ll \n[W]u
 193.\}
 194.el .ll 6i
 195.nr @ll \n[.l]
 196.nr @cur-ll \n[@ll]
 197.lt \n[@ll]u
 198.\"
 199.\"	page offset
 200.ie r O .po \n[O]u
 201.el \{\
 202.	ie n .po .75i
 203.	el .po .963i
 204.\}
 205.\"
 206.nr @po \n[.o]
 207.\"
 208.\" non-zero if escape mechanism is turned off. Used by VERBON/OFF
 209.nr @verbose-flag 0
 210.\"---------------------------------------------
 211.\"	New variables
 212.\"
 213.\" Appendix name
 214.ds App APPENDIX
 215.\" print appendixheader, 0 == don't
 216.nr Aph 1
 217.\"
 218.\" Current appendix text
 219.ds Apptext
 220.\" Controls the space before and after static displays if defined.
 221.\" Lsp is used otherwise
 222.\" .nr Dsp 1v
 223.\"
 224.\" Add a dot after level one heading number if >0
 225.nr H1dot 1
 226.\"
 227.\" header prespace level. If level <= Hps, then two lines will be printed
 228.\" before the header instead of one.
 229.nr Hps 1
 230.\"
 231.\" These variables controls the number of lines preceding .H.
 232.\" Hps1 is the number of lines when level > Hps
 233.nr Hps1 0.5v
 234.if n .nr Hps1 1v
 235.\"
 236.\" Hps2 is the number of lines when level <= Hps
 237.nr Hps2 1v
 238.if n .nr Hps2 2v
 239.\"
 240.\" Hss is the number of lines (Lsp) after the header.
 241.nr Hss 1
 242.\"
 243.\" H1txt will be updated by .H and .HU, containing the heading text.
 244.\" Will also be updated in table of contents & friends
 245.\"
 246.ds H1txt
 247.\"
 248.\" header text for the index
 249.ds Index INDEX
 250.\" command to sort the index
 251.ds Indcmd sort
 252.\"
 253.\" flag for mkindex
 254.if !r Idxf .nr Idxf 0
 255.\"	Change these in the national configuration file
 256.ds Lifg Figure
 257.ds Litb TABLE
 258.ds Liex Exhibit
 259.ds Liec Equation
 260.ds Licon CONTENTS
 261.\" Flag for space between mark and prefix 1==space, 0==no space
 262.\" Can also be controlled by using '.LI mark 2'
 263.nr Limsp 1
 264.\"
 265.\" Lsp controls the height of an empty line. Normally 0.5v
 266.\" Normally used for nroff compatibility.
 267.nr Lsp 0.5v
 268.if n .nr Lsp 1v
 269.ds MO1 January
 270.ds MO2 February
 271.ds MO3 March
 272.ds MO4 April
 273.ds MO5 May
 274.ds MO6 June
 275.ds MO7 July
 276.ds MO8 August
 277.ds MO9 September
 278.ds MO10 October
 279.ds MO11 November
 280.ds MO12 December
 281.\" for GETR
 282.ds Qrf See chapter \\*[Qrfh], page \\*[Qrfp].
 283.\"
 284.\" header- and footer-size will only change to the current
 285.\" if Pgps is > 0.
 286.nr Pgps 1
 287.\"
 288.\" section-page if Sectp > 0
 289.nr Sectp 0
 290.if (\n[N]=3):(\n[N]=5) \{\
 291.	nr Sectp 1
 292.	nr Ej 1
 293.\}
 294.\" section-figure if Sectf > 0
 295.nr Sectf 0
 296.if \n[N]=5 .nr Sectf 1
 297.\"
 298.\" argument to .nm in .VERBON.
 299.ds Verbnm "1
 300.\" indent for VERBON
 301.nr Verbin 5n
 302.\"
 303.\" Letter section
 304.\" Formal closing (.FC)
 305.ds Letfc Yours very truly,
 306.\"
 307.\" Approval line
 308.ds Letapp APPROVED:
 309.\" Approval date-string
 310.ds Letdate Date
 311.\"
 312.ds LetCN CONFIDENTIAL\"		Confidential default
 313.ds LetSA To Whom It May Concern:\"	Salutation default
 314.ds LetAT ATTENTION:\"			Attention string
 315.ds LetSJ SUBJECT:\"			Subject string
 316.ds LetRN In reference to:\"		Reference string
 317.\"
 318.\" Copy to (.NS)
 319.ds Letnsdef 0
 320.ds Letns!copy Copy \" space!
 321.ds Letns!to " to
 322.ds Letns!0 Copy to
 323.ds Letns!1 Copy (with att.) to
 324.ds Letns!2 Copy (without att.) to
 325.ds Letns!3 Att.
 326.ds Letns!4 Atts.
 327.ds Letns!5 Enc.
 328.ds Letns!6 Encs.
 329.ds Letns!7 Under separate cover
 330.ds Letns!8 Letter to
 331.ds Letns!9 Memorandum to
 332.ds Letns!10 Copy (with atts.) to
 333.ds Letns!11 Copy (without atts.) to
 334.ds Letns!12 Abstract Only to
 335.ds Letns!13 Complete Memorandum to
 336.ds Letns!14 CC:
 337.\"
 338.\" Text printed below the footer. Controlled by @copy_type (C).
 339.ds Pg_type!0
 340.ds Pg_type!1 OFFICIAL FILE COPY 
 341.ds Pg_type!2 DATE FILE COPY
 342.ds Pg_type!3 D\ R\ A\ F\ T
 343.ds Pg_type!4 D\ R\ A\ F\ T
 344.\" Max lines in return address
 345.nr Letwam 14
 346.\"--------------------------
 347.\"	test for mgm macro. This can be used if the text must test
 348.\"	what macros is used.
 349.nr .mgm 1
 350.\"
 351.\" Due to security problems with groff I had to rewrite
 352.\" the reference system. It's not as elegant as before, you
 353.\" have to run groff with '-z -rRef=1' and put stderr into the filename
 354.\" for .INITR
 355.\"
 356.\" Output references to stderr if non-zero
 357.ie !r Ref \{\
 358.	nr Ref 0
 359.\}
 360.el .warn 0
 361.\"
 362.\"---------------------------------------------
 363.\" set local variables.
 364.ie d @language .mso mm/\*[@language]_locale
 365.el .mso mm/locale
 366.\"---------------------------------------------
 367.if \n[D] .tm Groff mm, version \*[RE].
 368.\" ####### module init ######
 369.\"	reset all things
 370.de init@reset
 371.ie \\n[misc@adjust] 'ad
 372.el 'na
 373.ie \\n[Hy] 'hy 14
 374.el 'nh
 375'in 0
 376'ti 0
 377.ps \\n[@ps]u
 378.vs \\n[@vs]u
 379..
 380.de @warning
 381'tm WARNING:(\\n[.F]) input line \\n[.c]:\\$*
 382.if \\n[D] .backtrace
 383..
 384.de @error
 385'tm ******************
 386'tm ERROR:(\\n[.F]) input line \\n[.c]:\\$*
 387.if \\n[D] .backtrace
 388'tm ******************
 389.ab "Input aborted, syntax error"
 390..
 391.de misc@toupper
 392.tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
 393.br
 394\\$1
 395.tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
 396.br
 397..
 398.\" ####### module debug #################################
 399.de debug
 400'tm \\$1:\\n[.F]:\\n[c.] ll=\\n[.l] vs=\\n[.v] ps=\\n[.s],\\n[.ps] \
 401in=\\n[.i] fi=\\n[.u] .d=\\n[.d] nl=\\n[nl] pg=\\n[%]
 402..
 403.de debug-all
 404.nr debug*n 1n
 405.nr debug*m 1m
 406'tm \\$1:\\n[.F]:\\n[c.] ll=\\n[.l] vs=\\n[.v] ps=\\n[.s] in=\\n[.i]\
 407 ad=\\n[.j] fi=\\n[.u] pl=\\n[.p] page=\\n[%] .o=\\n[.o]
 408'tm _______ .d=\\n[.d] .f=\\n[.f] .h=\\n[.h] .k=\\n[.k] .n=\\n[.n]\
 409 .p=\\n[.p] .t=\\n[.t] .z=\\n[.z] nl=\\n[nl] dn=\\n[dn] n=\\n[debug*n]
 410..
 411.\" ####### module par #################################
 412.nr par@ind-flag 1	\" indent on following P if Pt=2
 413.nr hd*last-pos -1
 414.nr hd*last-hsize -1
 415.nr par*number 0 1
 416.af par*number 01
 417.nr par*number2 0 1
 418.af par*number2 01
 419.nr par*num-count 0 1
 420.af par*num-count 01
 421.\"	reset numbered paragraphs, arg1 = headerlevel
 422.de par@reset-num
 423.if \\$1<3 .nr par*num-count 0
 424.if (\\$1=1)&(\\n[Np]=1) .nr par*number 0
 425..
 426.\"------------
 427.\" paragraph
 428.de P
 429.\"	skip P if previous heading
 430.if \\n[D]>2 \{\
 431.	tm Paragraph nl=\\n[nl], last=\\n[hd*last-pos]
 432.	tm Paragraph .k=\\n[.k], hsize=\\n[hd*last-hsize]
 433.\}
 434.if !((\\n[nl]=\\n[hd*last-pos]):(\\n[hd*last-hsize]=\\n[.k])) \{\
 435.	if \\n[D]>2 .tm Paragraph set ind-flag=1
 436.	nr par@ind-flag 1
 437.\}
 438.\" any collected unprinted text?
 439.par@doit \\$*
 440.if \\n[Np] \\n[H1].\\n+[par*number]\ \ \c
 441..
 442.\"------------
 443.de nP
 444.\"	skip P if previous heading
 445.if \\n[D]>2 \{\
 446.	tm Paragraph nl=\\n[nl], last=\\n[hd*last-pos]
 447.	tm Paragraph .k=\\n[.k], hsize=\\n[hd*last-hsize]
 448.\}
 449.if !((\\n[nl]=\\n[hd*last-pos]):(\\n[hd*last-hsize]=\\n[.k])) \{\
 450.	if \\n[D]>2 .tm Paragraph set ind-flag=1
 451.	nr par@ind-flag 1
 452.\}
 453.par@doit \\$*
 454\\n[H2].\\n+[par*number2]\ \ \c
 455.nr par@ind-flag 1
 456..
 457.\"------------
 458.de par@doit
 459.SP (u;\\n[Ps]*\\n[Lsp])
 460.ie  \\n[.$] \{\
 461.	if \\$1=1 .ti +\\n[Pi]n
 462.\}
 463.el \{\
 464.	if \\n[Pt]=1 .ti +\\n[Pi]n
 465.	if (\\n[Pt]=2)&\\n[par@ind-flag] .ti +\\n[Pi]n
 466.\}
 467..
 468.\" ####### module line #######################################
 469.de SP
 470.br
 471.if !r line*lp\\n[.z] .nr line*lp\\n[.z] 0
 472.if !r line*ac\\n[.z] .nr line*ac\\n[.z] 0
 473.ie \\n[.$] .nr line*temp (v;\\$1)
 474.el .nr line*temp 1v
 475.\"
 476.ie \\n[line*lp\\n[.z]]=\\n[.d] \{\
 477.	\" go here if no output since the last .SP
 478.	nr line*output \\n[line*temp]-\\n[line*ac\\n[.z]]
 479.	if \\n[line*output]<0 .nr line*output 0
 480.	nr line*ac\\n[.z] +\\n[line*output]
 481.\}
 482.el \{\
 483.	nr line*ac\\n[.z] \\n[line*temp]
 484.	nr line*output \\n[line*temp]
 485.	\" no extra space in the beginning of a page
 486.	if (\\n[.d]<0):(\\n[pg*head-mark]=\\n[.d]) .nr line*output 0
 487.\}
 488.if \\n[line*output] .sp \\n[line*output]u
 489.nr line*lp\\n[.z] \\n[.d]
 490..
 491.\" ######## module misc ###############
 492.nr misc@adjust 14
 493.de SA
 494.if \\n[.$] \{\
 495.	if \\$1-1 .@error "SA: bad arg: \\$1"
 496.	nr misc@adjust 0\\$1
 497.\}
 498.ie \\n[misc@adjust] 'ad
 499.el 'na
 500..
 501.\"-------------
 502.\" switch environment, keep all important settings.
 503.de misc@ev-keep
 504.nr misc*ll \\n[.l]
 505.ev \\$1
 506.ll \\n[misc*ll]u
 507.lt \\n[misc*ll]u
 508..
 509.\"-------------
 510.\" .misc@push stackname value
 511.de misc@push
 512.ie d misc*st-\\$1 .ds misc*st-\\$1 \\$2 \\*[misc*st-\\$1]
 513.el .ds misc*st-\\$1 \\$2
 514..
 515.\"-------------
 516.\" .misc@pop stackname
 517.\" value returned in the string misc*pop
 518.de misc@pop
 519.misc@pop-set misc*st-\\$1 \\*[misc*st-\\$1]
 520..
 521.\"-------------
 522.de misc@pop-set
 523.ds misc*st-name \\$1
 524.shift
 525.if \\n[.$]<1 .@error "stack \\*[misc*st-name] empty"
 526.ds misc*pop \\$1
 527.shift
 528.ds \\*[misc*st-name] \\$*
 529..
 530.\"-------------
 531.\" .misc@pop-nr stackname varname
 532.de misc@pop-nr
 533.misc@pop \\$1
 534.nr \\$2 \\*[misc*pop]
 535..
 536.\"-------------
 537.\" .misc@pop-ds stackname varname
 538.de misc@pop-ds
 539.misc@pop \\$1
 540.ds \\$2 \\*[misc*pop]
 541..
 542.\"-----------
 543.\" reset tabs
 544.de TAB
 545.ta T 5n
 546..
 547.\"-------------
 548.\" .PGFORM linelength [ pagelength [ pageoffset [1]]]
 549.de PGFORM
 550.\" Break here to avoid problems with new linesetting of the previous line.
 551.\" Hope this doesn't break anything else :-)
 552.\" Don't break if arg_4 is a '1'.
 553.if \\n[D]>2 .tm PGFORM: \\$*
 554.if ''\\$4' .br
 555.if \\n[D]>3 .tm PGFORM: IN l:\\n[.l] p:\\n[.p] o:\\n[.o]
 556.ie !''\\$1' \{\
 557.	ll \\$1
 558.	nr @ll \\n[.l]
 559.	nr @cur-ll \\n[@ll]
 560.	lt \\n[@ll]u
 561.\}
 562.el \{\
 563.	ll \\n[@ll]u
 564.	lt \\n[@ll]u
 565.\}
 566.\"
 567.ie !''\\$2' \{\
 568.	pl \\$2
 569.	nr @pl \\n[.p]
 570.\}
 571.el .pl \\n[@pl]u
 572.\"
 573.ie !''\\$3' \{\
 574.	po \\$3
 575.	nr @po \\n[.o]
 576.\}
 577.el .po \\n[@po]u
 578.if \\n[D]>3 .tm PGFORM: OUT l:\\n[.l] p:\\n[.p] o:\\n[.o]
 579.if \\n[D]>2 .tm PGFORM: ll=\\n[@ll], pl=\\n[@pl], po=\\n[@po]
 580'in 0
 581.pg@move-trap
 582.if \\n[D]>2 \{\
 583.	tm Traps:
 584.	ptr
 585.\}
 586..
 587.\"-------------
 588.\" .MOVE y [[x] linelength]
 589.\" move to line y, indent to x
 590.de MOVE
 591.if !\\n[.$] .@error "MOVE y [x]: no arguments"
 592.if \\n[nl]<0 \c
 593.\" move to Y-pos
 594.sp |(v;\\$1)
 595.\" calc linelength
 596.ie \\n[.$]>2 .nr pg*i (n;\\$3)
 597.el \{\
 598.	ie \\n[.$]>1 .nr pg*i (n;\\n[@ll]u-\\$2)
 599.	el .nr pg*i \\n[@ll]u
 600.\}
 601.\" move to X-pos, if any
 602.if !''\\$2' .po \\$2
 603.\" set linelength
 604.ll \\n[pg*i]u
 605..
 606.\"-------------
 607.de SM
 608.if !\\n[.$] .@error "SM: no arguments"
 609.if \\n[.$]=1 \s-1\\$1\s0
 610.if \\n[.$]=2 \s-1\\$1\s0\\$2
 611.if \\n[.$]=3 \\$1\s-1\\$2\s0\\$3
 612..
 613.\"-------------
 614.nr misc*S-ps \n[@ps]
 615.nr misc*S-vs \n[@vs]
 616.nr misc*S-ps1 \n[@ps]
 617.nr misc*S-vs1 \n[@vs]
 618.ds misc*a
 619.ds misc*b
 620.de S
 621.ie !\\n[.$] \{\
 622.	ds misc*a P
 623.	ds misc*b P
 624.\}
 625.el \{\
 626.	ie \\n[.$]=1 .ds misc*b D
 627.	el \{\
 628.		ie \w@\\$2@=0 .ds misc*b C
 629.		el .ds misc*b \\$2
 630.	\}
 631.	ie \w@\\$1@=0 .ds misc*a C
 632.	el .ds misc*a \\$1
 633.\}
 634.\"
 635.\" set point size
 636.if !'\\*[misc*a]'C' \{\
 637.	ie '\\*[misc*a]'P' .ps \\n[misc*S-ps]u
 638.	el \{\
 639.		ie '\\*[misc*a]'D' .ps \\n[S]
 640.		el .ps \\*[misc*a]
 641.		if \\n[D]>2 .tm S: .ps \\*[misc*a]
 642.	\}
 643.\}
 644.\"
 645.\" set vertical spacing
 646.if !'\\*[misc*b]'C' \{\
 647.	ie '\\*[misc*b]'P' .vs \\n[misc*S-vs]u
 648.	el \{\
 649.		ie '\\*[misc*b]'D' .vs \\n[.ps]s+2p
 650.		el .vs \\*[misc*b]
 651.		if \\n[D]>2 .tm S: .vs \\*[misc*b]
 652.	\}
 653.\}
 654.nr @ps \\n[.ps]
 655.nr @psu \\n[.ps]s
 656.nr @vs \\n[.v]
 657.nr @vsp \\n[.v]u/1p
 658.nr @res 1i
 659.\"
 660.if \\n[D]>1 \{\
 661.	tmc "S(\\$*): ma:\\*[misc*a], mb:\\*[misc*b]
 662.	tm1 " => ps:\\n[.s]p (\\n[@psu]u), vs:\\n[@vsp]p (\\n[@vs]u) (res:\\n[@res])
 663.\}
 664.nr misc*S-ps \\n[misc*S-ps1]
 665.nr misc*S-vs \\n[misc*S-vs1]
 666.nr misc*S-ps1 \\n[@ps]
 667.nr misc*S-vs1 \\n[@vs]
 668.pg@move-trap
 669..
 670.\"------------
 671.de HC
 672.ev 0
 673.hc \\$1
 674.ev
 675.ev 1
 676.hc \\$1
 677.ev
 678.ev 2
 679.hc \\$1
 680.ev
 681..
 682.\"------------
 683.de RD
 684.di misc*rd
 685'fl
 686.rd \\$1\t
 687.br
 688.di
 689.ie !''\\$3' \{\
 690.	di misc*rd2
 691.	ds \\$3 "\\*[misc*rd]
 692.	br
 693.	di
 694.\}
 695.if !''\\$2' .rn misc*rd \\$2
 696.rm misc*rd misc*rd2
 697..
 698.\"------------
 699.\" VERBON [flag [pointsize [font]]]
 700.\"	flag
 701.\"	bit	function
 702.\"	0	escape on
 703.\"	1	add an empty line before verbose text
 704.\"	2	add an empty line after verbose text
 705.\"	3	numbered lines (controlled by the string Verbnm)
 706.\"	4	indent text by the numbervariable Verbin.
 707.de VERBON
 708.br
 709.nr misc*verb 0\\$1
 710.if (0\\n[misc*verb]%4)/2 .SP \\n[Lsp]u
 711.misc@ev-keep misc*verb-ev
 712.nf
 713.if (0\\n[misc*verb]%16)/8 .nm \\*[Verbnm]
 714.ie !'\\$3'' .ft \\$3
 715.el .ft CR
 716.ie 0\\$2 \{\
 717.	ss \\$2
 718.	ps \\$2
 719.	vs \\$2
 720.\}
 721.el .ss 12
 722.ta T 8u*\w@n@u
 723.if (0\\n[misc*verb]%32)/16 .in +\\n[Verbin]u
 724.if 0\\n[misc*verb]%2 \{\
 725.	eo
 726.	nr @verbose-flag 1		\" tell pageheader to set ec/eo
 727.\}
 728..
 729.de VERBOFF
 730.ec
 731.br
 732.if (0\\n[misc*verb]%8)/4 .SP \\n[Lsp]u
 733.if (0\\n[misc*verb]%16)/8 .nm
 734.if (0\\n[misc*verb]%32)/16 .in
 735.ev
 736.nr @verbose-flag 0
 737..
 738.\" ######## module pict #################
 739.nr pict*width 0
 740.nr pict*height 0
 741.nr pict*mode 0
 742.nr pict*ind 0
 743.nr pict*id 0 1
 744.\" I assume that the number variable pict*id is the same
 745.\" between two runs.
 746.de PIC
 747.br
 748.nr pict*ind 0
 749.nr pict*box 0
 750.while \\n[.$]>0 \{\
 751.	if '-B'\\$1' \{\
 752.		nr pict*box 1
 753.		shift
 754.		continue
 755.	\}
 756.	if '-L'\\$1' \{\
 757.		nr pict*mode 0
 758.		shift
 759.		continue
 760.	\}
 761.	if '-R'\\$1' \{\
 762.		nr pict*mode 1
 763.		shift
 764.		continue
 765.	\}
 766.	if '-I'\\$1' \{\
 767.		nr pict*ind (m;\\$2)
 768.		nr pict*mode 2
 769.		shift 2
 770.		continue
 771.	\}
 772.	if '-C'\\$1' \{\
 773.		nr pict*mode 3
 774.		shift
 775.		continue
 776.	\}
 777.	ds pict*f \\$1
 778.	nr pict*id +1
 779.	shift
 780.	if \\n[.$]>0 \{\
 781.		nr pict*width (i;\\$1)
 782.		shift
 783.	\}
 784.	if \\n[.$]>0 \{\
 785.		nr pict*height (i;\\$1)
 786.		shift
 787.	\}
 788.\}
 789.\" let mmroff know the filename and id
 790.if \\n[Ref]>0 \{\
 791.	tm .\\\\" PIC id \\n[pict*id]
 792.	tm .\\\\" PIC file \\*[pict*f]
 793.\}
 794.\" these are defined by mmroff in the second pass
 795.if d pict*file!\\n[pict*id] \{\
 796.	ds pict*f \\*[pict*file!\\n[pict*id]]
 797.	nr pict*llx \\n[pict*llx!\\n[pict*id]]
 798.	nr pict*lly \\n[pict*lly!\\n[pict*id]]
 799.	nr pict*urx \\n[pict*urx!\\n[pict*id]]
 800.	nr pict*ury \\n[pict*ury!\\n[pict*id]]
 801.	\"
 802.	nr pict*w (p;\\n[pict*urx]-\\n[pict*llx])
 803.	if \\n[pict*w]<0 .nr pict*w 0-\\n[pict*w]
 804.	nr pict*h (p;\\n[pict*ury]-\\n[pict*lly])
 805.	if \\n[pict*h]<0 .nr pict*h 0-\\n[pict*h]
 806.	if \\n[pict*width]>0 \{\
 807.		nr pict*rs (u;1000*\\n[pict*width]/\\n[pict*w])
 808.		nr pict*w (u;\\n[pict*w]*\\n[pict*rs]/1000)
 809.		nr pict*h (u;\\n[pict*h]*\\n[pict*rs]/1000)
 810.	\}
 811.	if \\n[pict*height]>0 \{\
 812.		nr pict*rs (u;1000*\\n[pict*height]/\\n[pict*h])
 813.		nr pict*h (u;\\n[pict*h]*\\n[pict*rs]/1000)
 814.	\}
 815.	if '0'\\n[pict*mode]' \{\
 816.		nr pict*in \\n[.i]u
 817.	\}
 818.	if '1'\\n[pict*mode]' \{\
 819.		nr pict*in (u;\\n[.l]-\\n[.i]-\\n[pict*w])
 820.	\}
 821.	if '2'\\n[pict*mode]' \{\
 822.		nr pict*in \\n[pict*ind]u
 823.	\}
 824.	if '3'\\n[pict*mode]' \{\
 825.		nr pict*in (u;(\\n[.l]-\\n[.i]-\\n[pict*w])/2)
 826.	\}
 827.	ds pict*h "
 828.	if \\n[pict*h]>0 .ds pict*h \\n[pict*h]
 829.	\"
 830.	ne \\n[pict*h]u-1v
 831.	\"
 832.	\" these lines are copied and modified from tmac.pspic.
 833.	\" Originally written by James Clark
 834.	br
 835.	ie \\n[pict*box]>0 \{\
 836\v'-1v'\h'\\n[pict*in]u'\
 837\Z'\D'p 0 \\n[pict*h]u \\n[pict*w]u 0 0 -\\n[pict*h]u''\
 838\v'\\n[pict*h]u'\X'ps: import \\*[pict*f] \
 839\\n[pict*llx] \\n[pict*lly] \
 840\\n[pict*urx] \\n[pict*ury] \
 841\\n[pict*w] \\n[pict*h]'
 842.\}
 843.	el \{\
 844\v'-1v'\h'\\n[pict*in]u'\
 845\X'ps: invis'\
 846\Z'\D'p 0 \\n[pict*h]u \\n[pict*w]u 0 0 -\\n[pict*h]u''\
 847\X'ps: endinvis'\
 848\v'\\n[pict*h]u'\X'ps: import \\*[pict*f] \
 849\\n[pict*llx] \\n[pict*lly] \
 850\\n[pict*urx] \\n[pict*ury] \
 851\\n[pict*w] \\n[pict*h]'
 852.	\}
 853.	br
 854.	sp \\n[pict*h]u-1v
 855.\}
 856..
 857.\" external picture
 858.\" -L	left adjust
 859.de EPIC
 860.if \\n[.$]<2 .@error "EPIC: Not enough arguments"
 861.nr pict*adj 0		\" centered
 862.if '\\$1'-L' \{\
 863.	shift 1		\" left adjust
 864.	nr pict*adj 1
 865.\}
 866.if \\n[nl]<0 \&
 867.nr pict*w \\$1
 868.nr pict*h \\$2
 869.ds pict*name "External picture
 870.if !''$3' .ds pict*name \\$3
 871.ne \\n[pict*h]u
 872.sp \\n[pict*h]u-1v
 873.nr pict*ind 0
 874.if !\\n[pict*adj] .nr pict*ind (u;(\\n[.l]-\\n[.i]-\\n[pict*w])/2)
 875.mk
 876.in +\\n[pict*ind]u
 877\D'l \\n[pict*w]u 0'\
 878\D'l 0 -\\n[pict*h]u'\
 879\D'l -\\n[pict*w]u 0'\
 880\D'l 0 \\n[pict*h]u'\
 881\v'-(u;\\n[pict*h]/2)'\
 882\h'(u;(\\n[pict*w]-\w'\\*[pict*name]'/2))'\\*[pict*name]
 883.in
 884.rt
 885.sp 1v
 886..
 887.\" ######## module acc #################
 888.\"-----------
 889.\" accents. These are copied from mgs, written by James Clark.
 890.de acc@over-def
 891.ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
 892\h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
 893..
 894.de acc@under-def
 895.ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
 896..
 897.acc@over-def ` \`
 898.acc@over-def ' \'
 899.acc@over-def ^ ^
 900.acc@over-def ~ ~
 901.acc@over-def : \(ad
 902.acc@over-def ; \(ad
 903.acc@under-def , \(ac
 904.\" ######## module uni #################
 905.\" unimplemented macros
 906.de OK
 907'tm "OK: not implemented"
 908..
 909.de PM
 910'tm "PM: not implemented"
 911..
 912.\" ######## module hd #################
 913.\" support for usermacro
 914.nr hd*h1-page 1	\" last page-number for level 1 header.
 915.nr hd*htype 0
 916.ds hd*sect-pg
 917.ds hd*mark
 918.ds hd*suf-space
 919.nr hd*need 0
 920.aln ;0 hd*htype
 921.als }0 hd*mark
 922.als }2 hd*suf-space
 923.aln ;3 hd*need
 924.\"-------------
 925.\" .hd@split varable index name val1 val2 ...
 926.de hd@split
 927.if \\$2>(\\n[.$]-3) .@error "\\$3 must have at least \\$2 values (\\*[\\$3]).
 928.nr hd*sp-tmp \\$2+3
 929.ds \\$1 \\$[\\n[hd*sp-tmp]]
 930..
 931.de HU
 932.H 0 "\\$1"
 933..
 934.\"-------------
 935.de H
 936.if !r hd*cur-bline .nr hd*cur-bline \\n[nl]
 937.br
 938.df@print-float 2\"	$$$ could be wrong...
 939.\" terminate all lists
 940.LC
 941.init@reset
 942.nr hd*level 0\\$1
 943.nr hd*arg1 0\\$1
 944.if !\\n[hd*level] .nr hd*level \\n[Hu]
 945.\"
 946.\"	clear lower counters
 947.nr hd*i 1 1
 948.while \\n+[hd*i]<15 .if \\n[hd*level]<\\n[hd*i] .nr H\\n[hd*i] 0 1
 949.\"
 950.\" save last text for use in TP
 951.if \\n[hd*level]=1 .ds H1txt \\$2\\$3
 952.\"
 953.\" This is a little fix to be able to get correct H1 heading number
 954.\" in page headers. Special attention was needed when other formats are used.
 955.ie !''\\g[H1]' \{\
 956.	ds hd*format \\g[H1]
 957.	af H1 0
 958.	nr H1h \\n[H1] 1
 959.	af H1 \\*[hd*format]
 960.\}
 961.el .nr H1h \\n[H1] 1
 962.if \\n[hd*level]=1 .nr H1h +1
 963.\"
 964.\"	Check if it's time for new page. Only if text has
 965.\"	appeared before.
 966.if \\n[Ej]&(\\n[Ej]>=\\n[hd*level])&(\\n[nl]>\\n[hd*cur-bline]) .pg@next-page
 967.\"
 968.\" increment current counter
 969.nr H\\n[hd*level] +1
 970.\"
 971.\" update pagenumber if section-page is used
 972.if (\\n[hd*level]=1)&(\\n[Sectp]>0) .hd@set-page 1
 973.\"
 974.\" hd*mark is the text written to the left of the header.
 975.ds hd*mark \\n[H1].
 976.\"
 977.if \\n[hd*level]>1 .as hd*mark \\n[H2]
 978.\"
 979.nr hd*i 2 1
 980.while \\n+[hd*i]<15 .if \\n[hd*level]>(\\n[hd*i]-1) .as hd*mark .\\n[H\\n[hd*i]]
 981.if \\n[Ht] .ds hd*mark \\n[H\\n[hd*level]].
 982.\"
 983.\" special case, no dot after level one heading if not H1dot true
 984.if (\\n[hd*level]=1)&(\\n[H1dot]=0) .ds hd*mark \\n[H1]
 985.\"
 986.as hd*mark \ \ \"			add spaces between mark and heading
 987.if !\\n[hd*arg1] .ds hd*mark\"		no mark for unnumbered
 988.\"
 989.if \\n[D]>1 .tm At header \\*[hd*mark] "\\$2"
 990.nr hd*htype 0				\" hd*htype = check break and space
 991.					\" 0 = run-in, 1 = break only, 2 = space
 992.if \\n[hd*level]<=\\n[Hb] .nr hd*htype 1
 993.if \\n[hd*level]<=\\n[Hs] .nr hd*htype 2
 994.					\" two spaces if hd*htype == 0
 995.ie (\\n[hd*htype]=0)&(\w@\\$2@) .ds hd*suf-space "  \"
 996.el .ds hd*suf-space
 997.nr hd*need 2v				\" hd*need = header need space
 998.\"---------- user macro HX ------------
 999.\" User exit macro to override numbering.
1000.\" May change hd*mark (}0), hd*suf-space (}2) and hd*need (;3)
1001.\" Can also change Hps1/2.
1002.if d HX .HX \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
1003.\"-------------------------------------- 
1004.\" pre-space
1005.ie \\n[hd*level]<=\\n[Hps] .SP (u;\\n[Hps2])
1006.el .SP (u;\\n[Hps1])
1007.\"
1008.par@reset-num \\n[hd*level]\"			reset numbered paragraph
1009.\" start diversion to measure size of header
1010.di hd*div
1011\\*[hd*mark]\\$2\\$3\\*[hd*suf-space]
1012.br
1013.di
1014.rm hd*div
1015.if \\n[hd*htype] .na \"		no adjust if run-in
1016.if \\n[hd*htype]<2 .nr hd*need +\\n[Lsp]u \"	add some extra space
1017.ne \\n[hd*need]u+\\n[dn]u+.5p-1v \"	this is the needed space for a header
1018.\"
1019.\" size and font calculations
1020.hd@split hd*font \\n[hd*level] HF \\*[HF]\"	get font for this level
1021.ft \\*[hd*font]\"			set new font
1022.hd@split hd*new-ps \\n[hd*level] HP \\*[HP]\"	get point size
1023.ie (\\*[hd*new-ps]=0):(\w@\\*[hd*new-ps]@=0) \{\
1024.	if \\n[hd*htype] \{\
1025.		if '\\*[hd*font]'3' \{\
1026.			ps -1
1027.			vs -1
1028.		\}
1029.		if '\\*[hd*font]'B' \{\
1030.			ps -1
1031.			vs -1
1032.		\}
1033.	\}
1034.\}
1035.el \{\
1036.	ps \\*[hd*new-ps]
1037.	vs \\*[hd*new-ps]+2
1038.\}
1039.\"
1040.\"---------- user macro HY ------------- 
1041.\"	user macro to reset indents
1042.if d HY .HY \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
1043.DEVTAG-NH \\n[hd*level]              \" HTML: mark beginning of heading
1044.\"-------------------------------------- 
1045.nr hd*mark-size \w@\\*[hd*mark]@
1046.if (\\n[hd*level]<=\\n[Hc])&\\n[hd*htype] .ce\" center if level<=Hc
1047.\"
1048.\"	finally, output the header
1049\\*[hd*mark]\&\c
1050.\"	and the rest of the header
1051.ie \\n[hd*htype] \{\
1052\\$2\\$3
1053.	br
1054.\}
1055.el \\$2\\$3\\*[hd*suf-space]\&\c
1056.ft 1
1057.\" restore pointsize and vertical size.
1058.ps \\n[@ps]u
1059.vs \\n[@vs]u
1060.\"
1061.\" table of contents
1062.if (\\n[hd*level]<=\\n[Cl])&\w@\\$2@ .toc@entry \\n[hd*level] "\\$2"
1063.\"	set adjust to previous value
1064.SA
1065.\"	do break or space
1066.if \\n[hd*htype] .br
1067.if \\n[hd*htype]>1 .SP (u;\\n[Lsp]*\\n[Hss])
1068.if \\n[hd*htype] \{\
1069.	\"	indent if Hi=1 and Pt=1
1070.	if (\\n[Hi]=1)&(\\n[Pt]=1) .ti +\\n[Pi]n
1071.	\"	indent size of mark if Hi=2
1072.	if \\n[hd*htype]&(\\n[Hi]>1) .ti +\\n[hd*mark-size]u
1073.\}
1074.nr par@ind-flag 0			\" no indent on .P if Pt=2
1075.\"
1076.\"	check if it is time to reset footnotes
1077.if (\\n[hd*level]=1)&\\n[ft*clear-at-header] .nr ft*nr 0 1
1078.\"
1079.\"	check if it is time to reset indexes
1080.if (\\n[hd*level]=1)&\\n[Sectf] \{\
1081.	nr lix*fg-nr 0 1
1082.	nr lix*tb-nr 0 1
1083.	nr lix*ec-nr 0 1
1084.	nr lix*ex-nr 0 1
1085.\}
1086.\"---------- user macro HZ ----------
1087.if d HZ .HZ \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
1088.nr hd*last-pos \\n[nl]
1089.nr hd*last-hsize \\n[.k]
1090.nr par@ind-flag 0
1091.DEVTAG-EO-H  \" HTML: end of heading
1092..
1093.\"--------
1094.de HM
1095.nr hd*i 0 1
1096.while \\n+[hd*i]<15 .af H\\n[hd*i] \\$[\\n[hd*i]] 1
1097..
1098.\"----------------------
1099.\" set page-nr, called from header 
1100.\" 
1101.de hd@set-page
1102.\"
1103.ie \\n[.$]>0 .nr P \\$1
1104.el .nr P +1
1105.\" Set section-page-string
1106.ds hd*sect-pg \\n[H1]-\\n[P]
1107.if \\n[Sectp]>1 .if '\\n[H1]'0' .ds hd*sect-pg "
1108..
1109.\"########### module pg ####################
1110.\" set end of text trap
1111.wh 0 pg@header
1112.em pg@end-of-text
1113.\"
1114.ds pg*header ''- \\nP -''
1115.ds pg*footer
1116.if \n[N]=4 .ds pg*header ''''
1117.if (\n[N]=3):(\n[N]=5) \{\
1118.	ds pg*header ''''
1119.	ds pg*footer ''\\*[hd*sect-pg]''
1120.\}
1121.ds pg*even-footer
1122.ds pg*odd-footer
1123.ds pg*even-header
1124.ds pg*odd-header
1125.\"
1126.nr pg*top-margin 0
1127.nr pg*foot-margin 0
1128.nr pg*block-size 0
1129.nr pg*footer-size 5v\"			 1v+footer+even/odd footer+2v
1130.nr pg*header-size 7v\"			 3v+header+even/odd header+2v
1131.nr pg*extra-footer-size 0
1132.nr pg*extra-header-size 0
1133.nr ft*note-size 0
1134.nr pg*cur-column 0
1135.nr pg*cols-per-page 1
1136.nr pg*cur-po \n[@po]
1137.nr pg*head-mark 0
1138.\"
1139.nr pg*ps \n[@ps]
1140.nr pg*vs \n[@vs]
1141.\"-------------------------
1142.\" footer TRAPS: set, enable and disable
1143.de pg@set-new-trap
1144.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)
1145.\"
1146.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]
1147.\"
1148.\" last-pos points to the position of the footer and bottom 
1149.\" block below foot-notes.
1150.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)
1151.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]
1152..
1153.de pg@enable-trap
1154.\" Disable in HTML mode
1155.if !'\*[.T]'html' \{\
1156.wh \\n[pg*foot-trap]u pg@footer
1157.if \\n[D]>2 .tm pg@enable-trap .t=\\n[.t] nl=\\n[nl]
1158.if \\n[D]>2 .ptr
1159.\}
1160..
1161.de pg@disable-trap
1162.ch pg@footer
1163..
1164.\" move to new trap (if changed).
1165.de pg@move-trap
1166.pg@disable-trap
1167.pg@set-new-trap
1168.pg@enable-trap
1169..
1170.de pg@enable-top-trap
1171.\" set trap for pageheader.
1172.nr pg*top-enabled 1
1173..
1174.de pg@disable-top-trap
1175.\" remove trap for pageheader.
1176.nr pg*top-enabled 0
1177..
1178.\" no header on the next page
1179.de PGNH
1180.nr pg*top-enabled (-1)
1181..
1182.\" set first trap for pagefooter
1183.pg@enable-top-trap
1184.pg@set-new-trap
1185.pg@enable-trap
1186.\"-------------------------
1187.\" stop output and begin on next page. Fix footnotes and all that.
1188.de pg@next-page
1189.\".debug next-page
1190.ne 999i		\" activate trap
1191.\" .pg@footer
1192..
1193.\"-------------------------
1194.\" support for PX, TP and EOP.
1195.als }t pg*header
1196.als }e pg*even-header
1197.als }o pg*odd-header
1198.als TPh pg*header
1199.als TPeh pg*even-header
1200.als TPoh pg*odd-header
1201.\"
1202.als EOPf pg*footer
1203.als EOPef pg*even-footer
1204.als EOPof pg*odd-footer
1205.\"------------------------------------------------------------
1206.\" HEADER
1207.de pg@header
1208.\" Disable in HTML mode
1209.if !'\*[.T]'html' \{\
1210.if \\n[D]>1 .tm Page# \\n[%] (\\n[.F]:\\n[c.])
1211.\" check if Hy has been changed
1212.ie \\n[Hy] 'hy 14
1213.el 'nh
1214.if \\n[Idxf] \{\
1215.tl '<pagenr\ \\n[%]>'''
1216.\}
1217.\" assign current page-number to P
1218.hd@set-page
1219.\" reset spacing
1220.nr line*lp\\n[.z] 0
1221.nr line*ac\\n[.z] 0
1222.\"
1223.\" suppress pageheader if pagenumber == 1 and N == [124]
1224.if \\n[pg*top-enabled] \{\
1225.\"	must be fixed!!
1226.\".	pg@disable-top-trap
1227.	if \\n[pg*extra-header-size] 'sp \\n[pg*extra-header-size]u
1228.	if \\n[pg*top-margin] 'sp \\n[pg*top-margin]u
1229.	ev pg*tl-ev
1230.	pg@set-env
1231.	ie d let@header .let@header
1232.	el \{\
1233.		ie d TP .TP
1234.		el \{\
1235'			sp 3
1236.			ie ((\\n[%]=1)&((\\n[N]=1):(\\n[N]=2))) .sp
1237.			el .tl \\*[pg*header]
1238.			ie o .tl \\*[pg*odd-header]
1239.			el .tl \\*[pg*even-header]
1240'			sp 2
1241.		\}
1242.	\}
1243.	ev
1244.	\" why no-space??
1245.	if d PX \{\
1246.		ns
1247.		PX
1248.		rs
1249.	\}
1250.	\" check for pending footnotes 
1251.	ft@check-old
1252.	\"
1253.	\" back to normal text processing
1254.	pg@enable-trap
1255.	\" mark for multicolumn
1256.	nr pg*head-mark \\n[nl]u
1257.	\" reset NCOL pointer at each new page.
1258.	nr pg*last-ncol 0
1259.	\" set multicolumn
1260.	\" 
1261.	pg@set-po
1262.	\" print floating displays
1263.	df@print-float 4
1264.	tbl@top-hook
1265.	ns
1266.\}
1267.if \\n[pg*top-enabled]<0 .nr pg*top-enabled 1
1268.nr hd*cur-bline \\n[nl]	\" .H needs to know if output has occured
1269.\}
1270..
1271.\"---------------------------------------------------------
1272.\" FOOTER
1273.de pg@footer
1274.ec
1275.if \\n[D]>2 .tm Footer# \\n[%] (\\n[.F]:\\n[c.]) nl=\\n[nl]
1276.pg@disable-trap
1277.\".debug footer
1278.tbl@bottom-hook
1279.\" increment pageoffset for MC
1280.\" move to the exact start of footer.
1281'sp |\\n[pg*foot-trap]u+1v
1282.\"
1283.if \\n[D]>3 .tm FOOTER after .sp, nl=\\n[nl]
1284.\" print footnotes
1285.if d ft*div .ft@print
1286.\"
1287.pg@inc-po
1288.if !\\n[pg*cur-column] .pg@print-footer
1289.\" next column
1290.pg@set-po
1291.pg@enable-trap
1292.if \\n[@verbose-flag] .eo		\" to help VERBON/VERBOFF
1293..
1294.\"-------------------------
1295.de pg@print-footer
1296.\" jump to the position just below the foot-notes.
1297'sp |\\n[pg*last-pos]u+1v
1298.if \\n[D]>3 .tm print-footer nl=\\n[nl]
1299.\" check if there are any bottom block
1300.if d pg*block-div .pg@block
1301.\"
1302.\" print the footer and eject new page
1303.ev pg*tl-ev
1304.pg@set-env
1305.\" user defined end-of-page macro
1306.ie d EOP .EOP
1307.el \{\
1308.	ie o .tl \\*[pg*odd-footer]
1309.	el .tl \\*[pg*even-footer]
1310.	ie (\\n[%]=1)&(\\n[N]=1) .tl \\*[pg*header]
1311.	el .tl \\*[pg*footer]
1312.	tl ''\\*[Pg_type!\\n[@copy_type]]''
1313.\}
1314.ev
1315.\" be sure that floating displays and footnotes will be
1316.\" printed at the end of the document.
1317.ie (\\n[df*fnr]>=\\n[df*o-fnr]):\\n[ft*exist] \{\
1318.	ev ne
1319'	bp
1320.	ev
1321.\}
1322.el 'bp
1323..
1324.\"-------------------------
1325.\"
1326.\" Initialize the title environment
1327.de pg@set-env
1328'na
1329'nh
1330'in 0
1331'ti 0
1332.ie \\n[Pgps] \{\
1333.	ps \\n[@ps]u
1334.	vs \\n[@vs]u
1335.\}
1336.el \{\
1337.	ps \\n[pg*ps]u
1338.	vs \\n[pg*vs]u
1339.\}
1340.lt \\n[@ll]u
1341.ll \\n[@ll]u
1342..
1343.\"-------------------------
1344.de PH
1345.ds pg*header "\\$1
1346.pg@set-new-size
1347..
1348.de PF
1349.ds pg*footer "\\$1
1350.pg@set-new-size
1351..
1352.de OH
1353.ds pg*odd-header "\\$1
1354.pg@set-new-size
1355..
1356.de EH
1357.ds pg*even-header "\\$1
1358.pg@set-new-size
1359..
1360.de OF
1361.ds pg*odd-footer "\\$1
1362.pg@set-new-size
1363..
1364.de EF
1365.ds pg*even-footer "\\$1
1366.pg@set-new-size
1367..
1368.de pg@clear-hd
1369.ds pg*even-header
1370.ds pg*odd-header
1371.ds pg*header
1372..
1373.de pg@clear-ft
1374.ds pg*even-footer
1375.ds pg*odd-footer
1376.ds pg*footer
1377..
1378.de pg@set-new-size
1379.nr pg*ps \\n[@ps]
1380.nr pg*vs \\n[@vs]
1381.pg@move-trap
1382..
1383.\"-------------------------
1384.\" end of page processing
1385.de pg@footnotes
1386.\".debug footnotes
1387.\" output footnotes. set trap for block
1388.\"
1389..
1390.\"-------------------------
1391.\" print bottom block
1392.de pg@block
1393.ev pg*block-ev
1394'nf
1395'in 0
1396.ll 100i
1397.pg*block-div
1398.br
1399.ev
1400..
1401.\"-------------------------
1402.\" define bottom block
1403.de BS
1404.misc@ev-keep pg*block-ev
1405.init@reset
1406.br
1407.di pg*block-div
1408..
1409.\"-------------------------
1410.de BE
1411.br
1412.di
1413.nr pg*block-size \\n[dn]u
1414.ev
1415.pg@move-trap
1416..
1417.\"-------------------------
1418.\" print out all pending text
1419.de pg@end-of-text
1420.if \\n[D]>2 .tm ---------- End of text processing ----------------
1421.df@eot-print
1422.ref@eot-print
1423..
1424.\"-------------------------
1425.\" set top and bottom margins 
1426.\" -T	sets pg*footer-size and pg*header-size instead
1427.de VM
1428.ie '\\$1'-T' \{\
1429.	shift
1430.	if \\n[.$]=0 \{\
1431.		nr pg*footer-size 5v
1432.		nr pg*header-size 7v
1433.	\}
1434.	if \\n[.$]>0 .nr pg*header-size (v;\\$1)
1435.	if \\n[.$]>1 .nr pg*footer-size (v;\\$2)
1436.\}
1437.el \{\
1438.	if \\n[.$]=0 \{\
1439.		nr pg*extra-footer-size 0
1440.		nr pg*extra-header-size 0
1441.	\}
1442.	if \\n[.$]>0 .nr pg*extra-header-size (v;\\$1)
1443.	if \\n[.$]>1 .nr pg*extra-footer-size (v;\\$2)
1444.	if \\n[D]>2 \{\
1445.		tm extra top \\n[pg*extra-footer-size]
1446.		tm extra bottom \\n[pg*extra-header-size]
1447.	\}
1448.\}
1449.pg@move-trap
1450..
1451.\"---------------------
1452.\" multicolumn output. 
1453.de pg@set-po
1454.if \\n[pg*cols-per-page]>1 \{\
1455.	ll \\n[pg*column-size]u
1456.\}
1457..
1458.de pg@inc-po
1459.if \\n[pg*cols-per-page]>1 \{\
1460.	ie \\n+[pg*cur-column]>=\\n[pg*cols-per-page] \{\
1461.		nr pg*cur-column 0 1
1462.		nr pg*cur-po \\n[@po]u
1463.		po \\n[@po]u
1464.		ll \\n[@ll]u
1465.	\}
1466.	el \{\
1467.		nr pg*cur-po +(\\n[pg*column-size]u+\\n[pg*column-sep]u)
1468.		po \\n[pg*cur-po]u
1469'		sp |\\n[pg*head-mark]u
1470.		tbl@top-hook
1471.	\}
1472.\}
1473..
1474.\" An argument disables the page-break.
1475.de 1C
1476.br
1477.if \\n[pg*cols-per-page]<=1 .@error "1C: multicolumn mode not active"
1478.nr pg*cols-per-page 1
1479.nr pg*column-sep 0
1480.nr pg*column-size \\n[@ll]
1481.nr pg*ncol-i \\n[pg*cur-column]\"	temp variable
1482.nr pg*cur-column 0 1
1483.nr pg*cur-po \\n[@po]u
1484.PGFORM
1485.ie !'\\$1'1' .SK
1486.el \{\
1487.	if d ft*div \{\
1488.		if \\n[pg*ncol-i]>0 \{\
1489.			@warning 1C: footnotes will be messy
1490.		\}
1491.	\}
1492.	if \\n[pg*last-ncol]>0 \{\
1493.		sp |\\n[pg*last-ncol]u
1494.		nr pg*last-ncol 0
1495.	\}
1496.\}
1497..
1498.de 2C
1499.br
1500.nr pg*head-mark \\n[nl]u
1501.if \\n[pg*cols-per-page]>1 .@error "2C: multicolumn mode already active"
1502.nr pg*cols-per-page 2
1503.nr pg*column-sep \\n[@ll]/15
1504.nr pg*column-size (\\n[@ll]u*7)/15
1505.nr pg*cur-column 0 1
1506.nr pg*cur-po \\n[@po]u
1507.ll \\n[pg*column-size]u
1508.\" .lt \\n[pg*column-size]u
1509..
1510.\" MC column-size [ column-separation ]
1511.de MC
1512.br
1513.nr pg*head-mark \\n[nl]u
1514.if \\n[pg*cols-per-page]>1 .@error "MC: multicolumn mode already active"
1515.ie ''\\$1' .nr pg*column-size \\n[.l]
1516.el .nr pg*column-size (n;\\$1)
1517.ie ''\\$2' .nr pg*column-sep \\n[pg*column-size]/15
1518.el .nr pg*column-sep (n;\\$2)
1519.\"
1520.\" calculate the number of columns/page
1521.nr pg*cols-per-page 0
1522.nr pg*i \\n[pg*column-size]
1523.while \\n[pg*i]<=\\n[.l] \{\
1524.	nr pg*cols-per-page \\n[pg*cols-per-page]+1
1525.	nr pg*i \\n[pg*i]+\\n[pg*column-sep]+\\n[pg*column-size]
1526.\}
1527.nr pg*cur-column 0 1
1528.nr pg*cur-po \\n[@po]u
1529.ll \\n[pg*column-size]u
1530.\" .lt \\n[pg*column-size]u
1531..
1532.\" begin a new column
1533.de NCOL
1534.br
1535.if \\n[nl]>\\n[pg*last-ncol] .nr pg*last-ncol \\n[nl]
1536.pg@footer
1537..
1538.\" skip pages
1539.de SK
1540.br
1541.bp
1542.nr pg*i 0 1
1543.\" force new page by writing something invisible.
1544.while \\n+[pg*i]<=(0\\$1) \{\
1545\&
1546.	bp
1547.\}
1548..
1549.\"-------------------------------
1550.\" MULB width1 space1 width2 space2 width3 space3 ...
1551.de MULB
1552.br
1553.nr pg*i 0 1
1554.nr pg*mul-x 0 1
1555.nr pg*mul-ind 0
1556.nr pg*mul-last 0
1557.while \\n[.$] \{\
1558.	nr pg*mul!\\n+[pg*i] (n;0\\$1)
1559.	nr pg*muls!\\n[pg*i] (n;0\\$2)
1560.	shift 2
1561.\}
1562.nr pg*mul-max-col \\n[pg*i]
1563.ds pg*mul-fam \\n[.fam]
1564.nr pg*mul-font \\n[.f]
1565.ev pg*mul-ev
1566.ps \\n[@ps]u
1567.vs \\n[@vs]u
1568.fam \\*[pg*mul-fam]
1569.ft \\n[pg*mul-font]
1570.fi
1571.hy 14
1572.di pg*mul-div
1573.MULN
1574..
1575.\"-----------
1576.de MULN
1577.if \\n[pg*mul-x]>=\\n[pg*mul-max-col] .@error "MULN: Undefined columnwidth"
1578.br
1579.if \\n[.d]>\\n[pg*mul-last] .nr pg*mul-last \\n[.d]
1580.rt +0
1581.in \\n[pg*mul-ind]u
1582.ll (u;\\n[.i]+\\n[pg*mul!\\n+[pg*mul-x]])u
1583.nr pg*mul-ind +(u;\\n[pg*mul!\\n[pg*mul-x]]+\\n[pg*muls!\\n[pg*mul-x]])
1584..
1585.\"-----------
1586.\" MULE
1587.de MULE
1588.br
1589.if \\n[.d]>\\n[pg*mul-last] .nr pg*mul-last \\n[.d]
1590.di
1591.ev
1592.ne \\n[pg*mul-last]u
1593.nf
1594.mk
1595.pg*mul-div
1596.rt
1597.sp \\n[pg*mul-last]u
1598.fi
1599..
1600.\"-----------
1601.de OP
1602.br
1603.ie o .if !\\n[pg*head-mark]=\\n[nl] \{\
1604.	bp +1
1605.	bp +1
1606.\}
1607.el .bp
1608..
1609.\"########### module footnotes ###################
1610.nr ft*note-size 0
1611.nr ft*busy 0
1612.nr ft*nr 0 1
1613.nr ft*wide 0
1614.nr ft*hyphen 0\"	hyphenation value
1615.nr ft*adjust 1\"	>0 if adjust true
1616.nr ft*indent 1\"	>0 if text indent true (not imp. $$$)
1617.nr ft*just 0\"	0=left justification, 1=right (not imp. $$$)
1618.nr ft*exist 0\"	not zero if there are any footnotes to be printed
1619.nr ft*clear-at-header 0\" >0 if footnotes should be reset at first level head.
1620.\"
1621.ds F \v'-.4m'\s-3\\n+[ft*nr]\s0\v'.4m'
1622.\"
1623.\"-----------------
1624.\" init footnote environment
1625.de ft@init
1626.\" indentcontrol not implemented $$$
1627.\" label justification not implemented $$$
1628'in 0
1629'fi
1630.ie \\n[ft*adjust] 'ad
1631.el 'na
1632.ie \\n[ft*hyphen] 'hy 14
1633.el 'hy 0
1634.ll \\n[@cur-ll]u
1635.lt \\n[@cur-ll]u
1636.ps (p;\\n[@ps]u-2)
1637.vs (p;\\n[@vs]u-1)
1638..
1639.\"-----------------
1640.\" set footnote format
1641.\" no support for two column processing (yet). $$$
1642.de FD
1643.if \\n[.$]=0 .@error "FD: bad arg \\$1"
1644.ie \\n[.$]=2 .nr ft*clear-at-header 1
1645.el .nr ft*clear-at-header 0
1646.\"
1647.if !'\\$1'' \{\
1648.	ie \\$1>11 .nr ft*format 0
1649.	el .nr ft*format \\$1
1650.	\"
1651.	nr ft*hyphen (\\n[ft*format]%2)*14
1652.	nr ft*format \\n[ft*format]/2
1653.	\"
1654.	nr ft*adjust 1-(\\n[ft*format]%2)
1655.	nr ft*format \\n[ft*format]/2
1656.	\"
1657.	nr ft*indent 1-(\\n[ft*format]%2)
1658.	nr ft*format \\n[ft*format]/2
1659.	\"
1660.	nr ft*just \\n[ft*format]%2
1661.\}
1662..
1663.\"---------------
1664.\" Footnote and display width control $$$
1665.de WC
1666.nr ft*i 0 1
1667.while \\n+[ft*i]<=\\n[.$] \{\
1668.	ds ft*x \\$[\\n[ft*i]]
1669.	if '\\*[ft*x]'N' \{\
1670.		nr ft*wide 0
1671.		nr ft*first-fn 0
1672.		nr ds*wide 0
1673.		nr ds*float-break 1
1674.	\}
1675.	if '\\*[ft*x]'-WF' .nr ft*wide 0
1676.	if '\\*[ft*x]'WF' .nr ft*wide 1
1677.	if '\\*[ft*x]'-FF' .nr ft*first-fn 0
1678.	if '\\*[ft*x]'FF' .nr ft*first-fn 1
1679.	if '\\*[ft*x]'-WD' \{\
1680.		nr ds*wide 0
1681.		if r ft*df-save \{\
1682.			nr Df \\n[ft*df-save]
1683.			rm ft*df-save 
1684.		\}
1685.	\}
1686.	if '\\*[ft*x]'WD' \{\
1687.		nr ds*wide 1
1688.		nr ft*df-save \\n[Df]
1689.		nr Df 4
1690.	\}
1691.	if '\\*[ft*x]'-FB' .nr ds*float-break 0
1692.	if '\\*[ft*x]'FB' .nr ds*float-break 1
1693.	if \\n[D]>1 .tm WC WF=\\n[ft*wide] WD=\\n[ds*wide]
1694.\}
1695..
1696.\"-----------------
1697.\" begin footnote
1698.\" Change environment, switch to diversion and print the foot-note mark.
1699.de FS
1700.if \\n[ft*busy] .@error "FS: missing FE"
1701.nr ft*busy 1
1702.ev ft*ev
1703.ft@init
1704.if !\\n[ft*wide] .pg@set-po
1705.di ft*tmp-div
1706.nr ft*space (u;\\n[Fs]*\\n[Lsp])
1707.sp \\n[ft*space]u
1708.\" print mark
1709.ie \\n[.$] .ds ft*mark \\$1
1710.el .ds ft*mark \\n[ft*nr].
1711\\*[ft*mark]
1712.in +.75c
1713.sp -1
1714.nr ft*exist 1
1715..
1716.\"-----------------
1717.\" init footnote diversion
1718.de ft@init-footnote
1719.di ft*div
1720\l'20n'
1721.br
1722.di
1723.nr ft*note-size \\n[dn]
1724..
1725.\"-----------------
1726.\" end footnote
1727.\" End the diversion, back to previous environment, and adjust
1728.\" the trap to the new foot-note size.
1729.de FE
1730.nr ft*busy 0
1731.br
1732.di
1733'in 0
1734'nf
1735.if \\n[@pl]u<\\n[dn]u .@error "FE: too big footnote"
1736.if !d ft*div .nr dn +1v
1737.if \\n[D]>3 .tm FE: foot-trap=\\n[pg*foot-trap] .d=\\n[.d] dn=\\n[dn]
1738.ie (\\n[pg*foot-trap]u-\\n[.d]u)<\\n[dn]u \{\
1739.	da ft*next-div
1740.	ft*tmp-div
1741.	br
1742.	di
1743.\}
1744.el \{\
1745.	if !d ft*div .ft@init-footnote
1746.	da ft*div
1747.	ft*tmp-div
1748.	di
1749.	nr ft*note-size +\\n[dn]
1750.\}
1751.rm ft*tmp-div
1752.ev
1753.pg@move-trap
1754..
1755.\"-----------------
1756.\" print footnotes, see pg@footer
1757.de ft@print
1758.ev ft*print-ev
1759'nf
1760'in 0
1761.ll 100i
1762.ft*div
1763.br
1764.ev
1765.rm ft*div
1766.nr ft*note-size 0
1767.pg@move-trap
1768..
1769.\"-----------------
1770.\" check if any pending footnotes, see pg@header
1771.de ft@check-old
1772.if d ft*next-div \{\
1773.	ev ft*ev
1774.	ft@init
1775.	ft@init-footnote
1776.	nf
1777.	in 0
1778.	da ft*div
1779.	ft*next-div
1780.	di
1781.	nr ft*note-size +\\n[dn]
1782.	rm ft*next-div
1783.	ev
1784.	nr ft*exist 0
1785.	pg@move-trap
1786.\}
1787..
1788.\"########### module display ###################
1789.nr ds*wide 0\"		>0 if wide displays wanted
1790.nr df*fnr 0 1\"	floating display counter
1791.nr df*o-fnr 1\"	floating display counter, already printed
1792.nr ds*snr 0 1\"	static display counter
1793.nr ds*lvl 0 1\"	display level
1794.nr ds*float-busy 0\"	>0 if printing float
1795.nr df*float 0		>0 if previous display was floating
1796.\"--------------------------------------------
1797.de DE
1798.ie \\n[df*float] .df@end \\$@
1799.el .ds@end \\$@
1800..
1801.\"--------------------------------------------
1802.\" floating display start
1803.\" nested DF/DE is not allowed.
1804.de DF
1805.if \\n[df*float] .@error "DF:nested floating is not allowed. Use DS."
1806.ds@set-format \\$@
1807.\"
1808.nr df*old-ll \\n[.l]
1809.nr ds*ftmp \\n[.f]
1810.misc@ev-keep df*ev
1811.ft \\n[ds*ftmp]
1812.\"
1813.init@reset
1814.di df*div
1815'in 0
1816.\"
1817.ds@set-new-ev \\n[df*old-ll]
1818.SP \\n[Lsp]u
1819.nr df*float 1
1820..
1821.\"--------------------------------------------
1822.de df@end
1823.br
1824.SP \\n[Lsp]u
1825.di
1826.nr df*width!\\n+[df*fnr] \\n[dl]
1827.nr df*height!\\n[df*fnr] \\n[dn]
1828.nr df*wide!\\n[df*fnr] \\n[ds*wide]
1829.nr df*format!\\n[df*fnr] \\n[ds*format]
1830.ev
1831.if \\n[D]>2 .tm DF:fnr=\\n[df*fnr] w=\\n[dl] h=\\n[dn] wide=\\n[ds*wide] \
1832 form=\\n[ds*format]
1833.\"	move div to the floating display list
1834.rn df*div df*fdiv!\\n[df*fnr]
1835.\"
1836.nr par@ind-flag 0
1837.\" print float if queue is empty and the display fits into
1838.\" the current page
1839.if ((\\n[df*fnr]>=\\n[df*o-fnr])&(\\n[dn]<\\n[.t])) .df@print-float 1
1840.nr df*float 0
1841..
1842.\"-------------
1843.\" called by end-of-text
1844.de df@eot-print
1845.br
1846.if \\n[df*o-fnr]<=\\n[df*fnr] \{\
1847.	if \\n[D]>2 .tm Print remaining displays.
1848.\" still some floats left, make non-empty environment
1849.	misc@ev-keep ne
1850.	init@reset
1851\c
1852.	df@print-float 3
1853.	ev
1854.\}
1855..
1856.\"---------------
1857.\" print according to Df and De.
1858.\" .df@print-float type
1859.\"	type	called from
1860.\"	1	.DE
1861.\"	2	end of section
1862.\"	3	end of document
1863.\"	4	beginning of new page
1864.\"
1865.de df@print-float
1866.if \\n[Df]>5 .@error "Df=\\n[Df], max value is 5"
1867.if !\\n[ds*float-busy] \{\
1868.	nr ds*float-busy 1
1869.\" at .DE
1870.	if \\n[D]>3 .tm print-float: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1871.	\" Df = 1 or 5
1872.	if (\\$1=1)&((\\n[Df]=1):(\\n[Df]=5)) \{\
1873.		if \\n[.t]>\\n[df*height!\\n[df*o-fnr]] \{\
1874.			\" Print only new displays.
1875.			if \\n[df*o-fnr]=\\n[df*fnr] \{\
1876.				br
1877.				ds@print-one-float
1878.			\}
1879.		\}
1880.	\}
1881.	\" Df = 3
1882.	if (\\$1=1)&(\\n[Df]=3) \{\
1883.		if \\n[.t]>\\n[df*height!\\n[df*o-fnr]] \{\
1884.			br
1885.			ds@print-one-float
1886.		\}
1887.	\}
1888.\" print all if Df<2 and end of section
1889.	if (\\$1=2)&(\\n[Sectp]>0)&(\\n[Df]<2) \{\
1890.		br
1891.		ds@print-all-floats
1892.	\}
1893.\" print all if end of document. Where should they go instead?
1894.	if \\$1=3 \{\
1895.		br
1896.		ds@print-all-floats
1897.\}
1898.\" new page
1899.	if (\\$1=4)&(\\n[Df]>1) \{\
1900.		if \\n[Df]=2 .ds@print-one-float
1901.		if \\n[Df]=3 .ds@print-one-float
1902.		if \\n[Df]>3 \{\
1903.			ie \\n[De] .ds@print-all-floats
1904.			el .ds@print-this-page
1905.		\}
1906.	\}
1907.	nr ds*float-busy 0
1908.\}
1909..
1910.\"---------------
1911.\" DF out
1912.\" print a floating diversion
1913.de ds@output-float
1914.nr df*old-ll \\n[.l]
1915.nr df*old-in \\n[.i]
1916.ev ds*fev
1917.nf
1918.nr df*i \\n[df*o-fnr]
1919.nr df*f \\n[df*format!\\n[df*i]]
1920.\"
1921.in \\n[df*old-in]u
1922.if \\n[df*f]=1 'in +\\n[Si]n
1923.if \\n[df*f]>=2 'in 0
1924.if \\n[df*f]=2 'ce 9999
1925.if \\n[df*f]=3 'in (u;(\\n[.l]-\\n[df*width!\\n[df*i]])/2)
1926.if \\n[df*f]=4 'rj 9999
1927.if \\n[df*f]=5 'in (u;\\n[.l]-\\n[df*width!\\n[df*i]])
1928.\"
1929.\"
1930.df*fdiv!\\n[df*o-fnr]
1931.\"
1932.if \\n[df*f]=2 'ce 0
1933.if \\n[df*f]=4 'rj 0
1934.ev
1935.rm df*fdiv!\\n[df*i]
1936.rm df*height!\\n[df*i]
1937.rm df*format!\\n[df*i]
1938.if \\n[df*wide!\\n[df*i]] .nr pg*head-mark \\n[nl]u
1939.nr df*o-fnr +1
1940..
1941.\"---------------
1942.\" print one floating display if there is one.
1943.de ds@print-one-float
1944.if \\n[df*o-fnr]<=\\n[df*fnr] \{\
1945.	if \\n[D]>3 .tm print-one-float: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1946.	if \\n[.t]<\\n[df*height!\\n[df*o-fnr]] .pg@next-page
1947.	ds@output-float
1948.	if \\n[De] .pg@next-page
1949.\}
1950..
1951.\"---------------
1952.\" print all queued floats.
1953.\" if De>0 do a page eject between the floats.
1954.de ds@print-all-floats
1955.while \\n[df*o-fnr]<=\\n[df*fnr] \{\
1956.	if \\n[D]>3 .tm print-all-floats: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1957.	if \\n[.t]<\\n[df*height!\\n[df*o-fnr]] .pg@next-page
1958.	br
1959\c
1960.	ds@output-float
1961.	if \\n[De] .pg@next-page
1962.\}
1963..
1964.\"---------------
1965.\" print as many floats as will fit on the current page
1966.de ds@print-this-page
1967.while \\n[df*o-fnr]<=\\n[df*fnr] \{\
1968.	if \\n[D]>3 .tm print-this-page: .t=\\n[.t], h=\\n[df*height!\\n[df*o-fnr]]
1969.	if \\n[.t]<\\n[df*height!\\n[df*o-fnr]] .break
1970.	ds@output-float
1971.\}
1972..
1973.\"---------------------------------------------------
1974.\" get format of the display
1975.de ds@set-format
1976.ie \\n[.$] \{\
1977.	ie r ds*format!\\$1 .nr ds*format \\n[ds*format!\\$1]
1978.	el .@error "DS/DF:wrong format:\\$1"
1979.\}
1980.el .nr ds*format 0
1981.if \\n[D]>2 .tm set format=\\n[ds*format]
1982.\" fill or not to fill, that is the...
1983.nr ds*fill 0
1984.ie \\n[.$]>1 \{\
1985.	ie r ds*fill!\\$2 .nr ds*fill \\n[ds*fill!\\$2]
1986.	el .@error "\\*[ds*type]:wrong fill:\\$2"
1987.\}
1988.if \\n[D]>2 .tm set fill=\\n[ds*fill]
1989.nr ds*rindent 0
1990.if \\n[.$]>2 .nr ds*rindent \\$3
1991.if \\n[D]>2 .tm set indent=\\n[ds*rindent]
1992..
1993.\"-----------------------------
1994.\" .ds@set-new-ev previous-line-length
1995.de ds@set-new-ev
1996.ll \\$1u
1997.lt \\$1u
1998.if \\n[ds*rindent] \{\
1999.	ll -\\n[ds*rindent]n
2000.	lt -\\n[ds*rindent]n
2001.\}
2002.if \\n[ds*wide] \{\
2003.	ll \\n[@ll]u
2004.	lt \\n[@ll]u
2005.\}
2006.\"
2007.ie \\n[ds*fill] 'fi
2008.el 'nf
2009..
2010.\"--------------------------------------------------------
2011.nr ds*format 0\"	dummy value for .En/.EQ
2012.nr ds*format! 0\"	no indent
2013.nr ds*format!0 0\"	no indent
2014.nr ds*format!L 0\"	no indent
2015.nr ds*format!I 1\"	indent
2016.nr ds*format!1 1\"	indent
2017.nr ds*format!C 2\"	center each line
2018.nr ds*format!2 2\"	center each line
2019.nr ds*format!CB 3\"	center as block
2020.nr ds*format!3 3\"	center as block
2021.nr ds*format!R 4\"	right justify each line
2022.nr ds*format!4 4\"	right justify each line
2023.nr ds*format!RB 5\"	right justify as block
2024.nr ds*format!5 5\"	right justify as block
2025.\"---------------
2026.nr ds*fill! 0\"	no fill
2027.nr ds*fill!N 0\"	no fill
2028.nr ds*fill!0 0\"	no fill
2029.nr ds*fill!F 1\"	fill on
2030.nr ds*fill!1 1\"	fill on
2031.\"--------------------------------------------
2032.\" static display start
2033.\" nested DS/DE is allowed. No limit on depth.
2034.de DS
2035.br
2036.nr XXX \\n[nl]
2037.nr ds*lvl +1
2038.ds@set-format \\$@
2039.\"
2040.nr ds*old-ll \\n[.l]
2041.nr ds*old-in \\n[.i]
2042.misc@push ds-ll \\n[.l]
2043.misc@push ds-form \\n[ds*format]
2044.nr ds*i \\n[.i]
2045.nr ds*ftmp \\n[.f]
2046.misc@ev-keep ds*ev!\\n+[ds*snr]
2047.ft \\n[ds*ftmp]
2048.\"
2049.init@reset
2050.\" indent in a diversion doesn't seem like a good idea.
2051'in 0
2052.di ds*div!\\n[ds*snr]
2053.\"
2054.ds@set-new-ev \\n[ds*old-ll]
2055.nr df*float 0
2056..
2057.\"--------------------------------------------
2058.de ds@end
2059.if \\n-[ds*lvl]<0 .@error "DE: no corresponding DS"
2060.br
2061.di
2062.\" **********
2063.nr ds*width \\n[dl]
2064.nr ds*height \\n[dn]
2065.misc@pop-nr ds-ll ds*old-ll
2066.misc@pop-nr ds-form ds*format
2067.\"
2068.\" **********
2069'nf
2070.\" calculate needed space
2071.nr ds*need \\n[ds*height]
2072.nr ds*i \\n[pg*foot-trap]-\\n[pg*header-size]u-\\n[pg*extra-header-size]u
2073.if (\\n[ds*height]>\\n[ds*i])&(\\n[.t]<(\\n[ds*i]/2)) .nr ds*need \\n[.t]u+1v
2074.if (\\n[ds*height]<\\n[ds*i])&(\\n[.t]<(\\n[ds*height])) .nr ds*need \\n[.t]u+1v
2075.\"	Eject page if display will fit one page and
2076.\"	there are less than half of the page left.
2077.if \\n[ds*need] .ne \\n[ds*need]u
2078.\"
2079.\" check if pending equation label
2080.eq@check \\n[ds*need]
2081'in \\n[ds*old-in]u
2082.if \\n[ds*format]=1 'in \\n[ds*old-in]u+\\n[Si]n
2083.if \\n[ds*format]>=2 'in 0
2084.if \\n[ds*format]=2 'ce 9999
2085.if \\n[ds*format]=3 'in (u;(\\n[.l]-\\n[ds*width])/2)
2086.if \\n[ds*format]=4 'rj 9999
2087.if \\n[ds*format]=5 'in (u;\\n[.l]-\\n[ds*width])
2088.\" **********
2089.\"
2090.\"	Print static display
2091.nr ds*i \\n[Lsp]
2092.if r Dsp .nr ds*i \\n[Dsp]
2093.\"
2094.if \\n[Ds] .sp \\n[ds*i]u
2095.ds*div!\\n[ds*snr]
2096.if \\n[Ds] .sp \\n[ds*i]u
2097.\"
2098.if \\n[ds*format]=2 'ce 0
2099.if \\n[ds*format]=4 'rj 0
2100.rm ds*div!\\n[ds*snr]
2101.nr ds*snr -1
2102.nr par@ind-flag 0
2103.ev
2104..
2105.\"########### module list ###################
2106.\" .LI text-indent mark-indent pad type [mark [LI-space [LB-space] ] ]
2107.\"
2108.nr li*tind 0
2109.nr li*mind 0
2110.nr li*pad 0
2111.nr li*type 0
2112.ds li*mark 0
2113.nr li*li-spc 0
2114.nr li*lvl 0 1
2115.aln :g li*lvl
2116.nr li*cur-vpos 0
2117.\"--------------------------
2118.\"	the major list-begin macro.
2119.\"	If type == -1 a 'break' will occur.
2120.de LB
2121.if \\n[.$]<4 .@error "LB: not enough arguments, min 4"
2122.misc@push cind \\n[.i]
2123.misc@push tind \\n[li*tind]
2124.misc@push mind \\n[li*mind]
2125.misc@push pad \\n[li*pad]
2126.misc@push type \\n[li*type]
2127.misc@push li-spc \\n[li*li-spc]
2128.ds li*mark-list!\\n[li*lvl] \\*[li*mark]
2129.nr li*lvl +1
2130.\"
2131.nr li*tind (n;0\\$1)\"			text-indent
2132.nr li*mind (n;0\\$2)\"			mark-indent
2133.nr li*pad (n;0\\$3)\"			pad
2134.nr li*type 0\\$4\"			type
2135.ds li*mark \\$5\"			mark
2136.ie !'\\$6'' .nr li*li-spc \\$6\"	LI-space
2137.el .nr li*li-spc 1
2138.ie !'\\$7'' .nr li*lb-spc \\$7\"	LB-space
2139.el .nr li*lb-spc 0
2140.\" init listcounter
2141.nr li*cnt!\\n[li*lvl] 0 1
2142.\" assign format
2143.af li*cnt!\\n[li*lvl] 1
2144.if \\n[li*type] .if !'\\*[li*mark]'' .af li*cnt!\\n[li*lvl] \\*[li*mark]
2145.\"
2146.if \\n[li*lb-spc] .SP (u;\\n[li*lb-spc]*\\n[Lsp])
2147.in +\\n[li*tind]u
2148..
2149.\"---------------
2150.de LI
2151.if \\n[li*lvl]<1 .@error "LI:no lists active"
2152.if \\n[li*li-spc]&(\\n[Ls]>=\\n[li*lvl]) .SP (u;\\n[li*li-spc]*\\n[Lsp])
2153.ne 2v
2154.\"
2155.ds li*c-mark \\*[li*mark]
2156.nr li*cnt!\\n[li*lvl] +1
2157.if \\n[li*type]=1 .ds li*c-mark \\n[li*cnt!\\n[li*lvl]].
2158.if \\n[li*type]=2 .ds li*c-mark \\n[li*cnt!\\n[li*lvl]])
2159.if \\n[li*type]=3 .ds li*c-mark (\\n[li*cnt!\\n[li*lvl]])
2160.if \\n[li*type]=4 .ds li*c-mark [\\n[li*cnt!\\n[li*lvl]]]
2161.if \\n[li*type]=5 .ds li*c-mark <\\n[li*cnt!\\n[li*lvl]]>
2162.if \\n[li*type]=6 .ds li*c-mark {\\n[li*cnt!\\n[li*lvl]]}
2163.if \\n[.$]=1 .ds li*c-mark \\$1
2164.ie \\n[.$]=2 \{\
2165.	ie (\\$2=2):(\\n[Limsp]=0) .ds li*c-mark \\$1\\*[li*c-mark]
2166.	el .ds li*c-mark \\$1\ \\*[li*c-mark]
2167.\}
2168.\"
2169.\" determine where the text begins
2170.nr li*text-begin \\n[li*tind]>?\w@\\*[li*c-mark]\ @
2171.nr x \w@\\*[li*c-mark]\ @
2172.\"
2173.\" determine where the mark begin
2174.ie !\\n[li*pad] .nr li*in \\n[li*mind]
2175.el .nr li*in \\n[li*text-begin]-\\n[li*pad]-\w@\\*[li*c-mark]@
2176.if !\\n[li*in] .nr li*in 0
2177.\"
2178.ti -\\n[li*tind]u
2179.\" no indentation if hanging indent
2180.if (\w@\\*[li*c…

Large files files are truncated, but you can click here to view the full file