home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / gnu / groff-1.09-src.lha / src / amiga / groff-1.09 / mm / tmac.m < prev    next >
Text File  |  1994-02-21  |  59KB  |  2,636 lines

  1. .\"    Version:
  2. .ds RE 1.19
  3. .ig
  4.  
  5. Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  6. mgm is written by Jörgen Hägg (jh@efd.lth.se)
  7.  
  8. mgm is free software; you can redistribute it and/or modify it under
  9. the terms of the GNU General Public License as published by the Free
  10. Software Foundation; either version 2, or (at your option) any later
  11. version.
  12.  
  13. mgm is distributed in the hope that it will be useful, but WITHOUT ANY
  14. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  16. for more details.
  17.  
  18. You should have received a copy of the GNU General Public License along
  19. with groff; see the file COPYING.  If not, write to the Free Software
  20. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  
  22. Almost complete. The letter format is not included.
  23. Maybe as a separate package.
  24. Should be better as time goes.
  25.  
  26. Please send bugreports with examples to jh@efd.lth.se.
  27.  
  28. Naming convention stolen from mgs.
  29. Local names    module*name
  30. Extern names    module@name
  31. Env.var        environ:name
  32. Index        array!index
  33. ..
  34. .warn
  35. .\" ####### init ######
  36. .\"    Contents level [0:7], contents saved if heading level <= Cl
  37. .nr Cl 2
  38. .\"    Eject page between LIST OF XXXX if Cp == 0
  39. .nr Cp 0
  40. .\"    Debugflag
  41. .if !r D .nr D 0
  42. .\"    Eject after floating display is output [0:1]
  43. .nr De 0
  44. .\"    Floating keep output [0;5]
  45. .nr Df 5
  46. .\"    space before and after display if == 1 [0:1]
  47. .nr Ds 1
  48. .\"    Eject page
  49. .nr Ej 0
  50. .\"    Equation lable adjust 0=left, 1=right
  51. .nr Eq 0
  52. .\"    Em dash string
  53. .ds EM \-
  54. .\"    Footnote spacing
  55. .nr Fs 1
  56. .\"    H1-H7    heading counters
  57. .nr H1 0 1
  58. .nr H2 0 1
  59. .nr H3 0 1
  60. .nr H4 0 1
  61. .nr H5 0 1
  62. .nr H6 0 1
  63. .nr H7 0 1
  64. .\"    Heading break level [0:7]
  65. .nr Hb 2
  66. .\"    heading centering level, [0:7]
  67. .nr Hc 0
  68. .\"    header format
  69. .ds HF 2 2 2 2 2 2 2
  70. .\"    heading temp. indent [0:2]
  71. .\"    0 -> 0 indent, left margin
  72. .\"    1 -> indent to right , like .P 1
  73. .\"    2 -> indent to line up with text part of preceding heading
  74. .nr Hi 1
  75. .\"    header pointsize
  76. .ds HP 0 0 0 0 0 0 0
  77. .\"    heading space level [0:7]
  78. .nr Hs 2
  79. .\"    heading numbering type
  80. .\"    0 -> multiple (1.1.1 ...)
  81. .\"    1 -> single
  82. .nr Ht 0
  83. .\"    Unnumbered heading level
  84. .nr Hu 2
  85. .\"    hyphenation in body
  86. .\"    0 -> no hyphenation
  87. .\"    1 -> hyphenation 14 on
  88. .nr Hy 1
  89. .\"    text for toc, selfexplanatory. Look in the new variable section
  90. .ds Lf LIST OF FIGURES
  91. .nr Lf 1
  92. .ds Lt LIST OF TABLES
  93. .nr Lt 1
  94. .ds Lx LIST OF EXHIBITS
  95. .nr Lx 1
  96. .ds Le LIST OF EQUATIONS
  97. .nr Le 0
  98. .\"    List indent, used by .AL
  99. .nr Li 6
  100. .\"    List space, if listlevel > Ls then no spacing will occur around lists.
  101. .nr Ls 99
  102. .\"    Numbering style [0:5]
  103. .if !r N .nr N 0
  104. .\"    numbered paragraphs
  105. .\"    0 == not numbered
  106. .\"    1 == numbered in first level headings.
  107. .nr Np 0
  108. .\"    Format of figure,table,exhibit,equation titles.
  109. .\"    0= ". ", 1=" - "
  110. .nr Of 0
  111. .\"    Page-number, normally same as %.
  112. .nr P 0
  113. .\"    paragraph indent
  114. .nr Pi 5
  115. .\"    paragraph spacing
  116. .nr Ps 1
  117. .\"    paragraph type
  118. .\"    0 == left-justified
  119. .\"    1 == indented .P
  120. .\"    2 == indented .P except after .H, .DE or .LE.
  121. .nr Pt 0
  122. .\"    Reference title
  123. .ds Rp REFERENCES
  124. .\"    Display indent
  125. .nr Si 5
  126. .\"
  127. .ds Tm \(tm
  128. .\"
  129. .\"---------------------------------------------
  130. .\"    Internal global variables
  131. .\"
  132. .\" These two are for cover macro .MT
  133. .\" Change @langage in the national file.
  134. .ds @cur-lib /gnu/lib/groff/tmac
  135. .\" .ds @language
  136. .\"
  137. .\"    Current pointsize and vertical space, always in points.
  138. .ie r S \{\
  139. .    nr @ps \n[S]
  140. .    nr @vs \n[S]+2
  141. .\}
  142. .el \{\
  143. .    nr @ps 10
  144. .    nr @vs 12
  145. .\}
  146. .\"
  147. .\"    Page length
  148. .ie r L .nr @pl \n[L]
  149. .el .nr @pl \n[.p]
  150. .\"    page width
  151. .ie r W .nr @ll \n[W]
  152. .el .nr @ll 6i
  153. .\"    page offset
  154. .ie r O .nr @po \n[O]
  155. .el .nr @po \n(.o
  156. .\"
  157. .\" cheating...
  158. .pl \n[@pl]u
  159. .ll \n[@ll]u
  160. .lt \n[@ll]u
  161. .po \n[@po]u
  162. .nr @cur-ll \n[@ll]
  163. .\"
  164. .\" non-zero if escape mechanism is turned off. Used by VERBON/OFF
  165. .nr @verbose-flag 0
  166. .\"---------------------------------------------
  167. .\"    New variables
  168. .\"
  169. .\" Appendix name
  170. .ds App APPENDIX
  171. .\" print appendixheader, 0 == don't
  172. .nr Aph 1
  173. .\"
  174. .\" header prespace level. If level <= Hps, then two lines will be printed
  175. .\" before the header instead of one.
  176. .nr Hps 1
  177. .\"
  178. .\" These variables controls the number of lines preceding .H.
  179. .\" Hps1 is the number of lines when level > Hps
  180. .nr Hps1 0.5v
  181. .if n .nr Hps1 1v
  182. .\"
  183. .\" Hps2 is the number of lines when level >= Hps
  184. .nr Hps2 1v
  185. .if n .nr Hps2 2v
  186. .\"
  187. .\" flag for mkindex
  188. .if !r Idxf .nr Idxf 0
  189. .\"    Change these in the national configuration file
  190. .ds Lifg Figure
  191. .ds Litb TABLE
  192. .ds Liex Exhibit
  193. .ds Liec Equation
  194. .ds Licon CONTENTS
  195. .\"
  196. .\" Lsp controls the height of an empty line. Normally 0.5v
  197. .\" Normally used for nroff compatibility.
  198. .nr Lsp 0.5v
  199. .if n .nr Lsp 1v
  200. .ds MO1 January
  201. .ds MO2 February
  202. .ds MO3 March
  203. .ds MO4 April
  204. .ds MO5 May
  205. .ds MO6 June
  206. .ds MO7 July
  207. .ds MO8 August
  208. .ds MO9 September
  209. .ds MO10 October
  210. .ds MO11 November
  211. .ds MO12 December
  212. .\" for GETR
  213. .ds Qrf See chapter \\*[Qrfh], page \\*[Qrfp].
  214. .\"
  215. .\" header- and footer-size will only change to the current
  216. .\" if Pgps is > 0.
  217. .nr Pgps 1
  218. .\"
  219. .\" section-page if Sectp > 0
  220. .nr Sectp 0
  221. .if (\n[N]=3):(\n[N]=5) \{\
  222. .    nr Sectp 1
  223. .    nr Ej 1
  224. .\}
  225. .\" section-figure if Sectf > 0
  226. .nr Sectf 0
  227. .if \n[N]=5 .nr Sectf 1
  228. .\"
  229. .\" argument to .nm in .VERBON.
  230. .ds Verbnm "1
  231. .\" indent for VERBON
  232. .nr Verbin 5n
  233. .\"
  234. .\"    test for mgm macro. This can be used if the text must test
  235. .\"    what macros is used.
  236. .nr .mgm 1
  237. .\"
  238. .\"---------------------------------------------
  239. .\" set local variables.
  240. .ie d @language .mso mm/\\*[@language]_locale
  241. .el .mso mm/locale
  242. .\"---------------------------------------------
  243. .if \n[D] .tm Groff mm, version \*[RE].
  244. .\" ####### module init ######
  245. .\"    reset all things
  246. .de init@reset
  247. .ie \\n[misc@adjust] 'ad
  248. .el 'na
  249. .ie \\n[Hy] 'hy 14
  250. .el 'nh
  251. 'in 0
  252. 'ti 0
  253. 'ps \\n[@ps]
  254. 'vs \\n[@vs]
  255. ..
  256. .de @error
  257. .tm ******************
  258. .tm ERROR:(\\n[.F]) input line \\n[.c]:\\$*
  259. .if \\n[D] .backtrace
  260. .tm ******************
  261. .ab "Input aborted, syntax error"
  262. ..
  263. .\" ####### module debug #################################
  264. .de debug
  265. .tm \\$1:\\n[.F]:\\n[c.] ll=\\n[.l] vs=\\n[.v] ps=\\n[.s],\\n[.ps] \
  266. in=\\n[.i] fi=\\n[.u] .d=\\n[.d] nl=\\n[nl] pg=\\n[%]
  267. ..
  268. .de debug-all
  269. .nr debug*n 1n
  270. .nr debug*m 1m
  271. .tm \\$1:\\n[.F]:\\n[c.] ll=\\n[.l] vs=\\n[.v] ps=\\n[.s] in=\\n[.i]\
  272.  ad=\\n[.j] fi=\\n[.u] pl=\\n[.p] page=\\n[%] .o=\\n[.o]
  273. .tm _______ .d=\\n[.d] .f=\\n[.f] .h=\\n[.h] .k=\\n[.k] .n=\\n[.n]\
  274.  .p=\\n[.p] .t=\\n[.t] .z=\\n[.z] nl=\\n[nl] dn=\\n[dn] n=\\n[debug*n]
  275. ..
  276. .\" ####### module par #################################
  277. .nr par@ind-flag 1    \" indent on following P if Pt=2
  278. .nr hd*last-pos -1
  279. .nr hd*last-hpos -1
  280. .nr par*number 0 1
  281. .af par*number 01
  282. .nr par*num-count 0 1
  283. .af par*num-count 01
  284. .\"    reset numbered paragraphs, arg1 = headerlevel
  285. .de par@reset-num
  286. .if \\$1<3 .nr par*num-count 0
  287. .if (\\$1=1)&(\\n[Np]=1) .nr par*number 0
  288. ..
  289. .\"------------
  290. .\" paragraph
  291. .de P
  292. .\"    skip P if previous heading
  293. .ie !((\\n[nl]=\\n[hd*last-pos]):(\\n[nl]=(\\n[hd*last-pos]-.5v))) \{\
  294. .    if \\n[D]>2 .tm Paragraph 
  295. .    par@doit \\$*
  296. .\}
  297. .el .if !(\\n[hd*last-hpos]=\\n[.k]) \{\
  298. .    if \\n[D]>2 .tm Paragraph 
  299. .    par@doit \\$*
  300. .\}
  301. .nr par@ind-flag 1
  302. ..
  303. .de par@doit
  304. .SP (u;\\n[Ps]*\\n[Lsp])
  305. .ie  \\n[.$] \{\
  306. .    if \\$1=1 .ti +\\n[Pi]n
  307. .\}
  308. .el \{\
  309. .    if \\n[Pt]=1 .ti +\\n[Pi]n
  310. .    if (\\n[Pt]=2)&\\n[par@ind-flag] .ti +\\n[Pi]n
  311. .\}
  312. .if \\n[Np] \{\
  313. \\n[H1].\\n+[par*number]\ \ \c
  314. .\" $$$ 'br
  315. .\}
  316. ..
  317. .\" ####### module line #######################################
  318. .de SP
  319. .br
  320. .if !r line*lp\\n[.z] .nr line*lp\\n[.z] 0
  321. .if !r line*ac\\n[.z] .nr line*ac\\n[.z] 0
  322. .ie \\n[.$] .nr line*temp (v;\\$1)
  323. .el .nr line*temp 1v
  324. .\"
  325. .ie \\n[line*lp\\n[.z]]=\\n[.d] \{\
  326. .    \" go here if no output since the last .SP
  327. .    nr line*output \\n[line*temp]-\\n[line*ac\\n[.z]]
  328. .    if \\n[line*output]<0 .nr line*output 0
  329. .    nr line*ac\\n[.z] +\\n[line*output]
  330. .\}
  331. .el \{\
  332. .    nr line*ac\\n[.z] \\n[line*temp]
  333. .    nr line*output \\n[line*temp]
  334. .    \" no extra space in the beginning of a page
  335. .    if (\\n[.d]<0):(\\n[pg*head-mark]=\\n[.d]) .nr line*output 0
  336. .\}
  337. .if \\n[line*output] .sp \\n[line*output]u
  338. .nr line*lp\\n[.z] \\n[.d]
  339. ..
  340. .\" ######## module misc ###############
  341. .nr misc@adjust 14
  342. .de SA
  343. .if \\n[.$] \{\
  344. .    if \\$1-1 .@error "SA: bad arg: \\$1"
  345. .    nr misc@adjust 0\\$1
  346. .\}
  347. .ie \\n[misc@adjust] 'ad
  348. .el 'na
  349. ..
  350. .\"-------------
  351. .\" switch environment, keep all important settings.
  352. .de misc@ev-keep
  353. .nr misc*ll \\n[.l]
  354. .ev \\$1
  355. .ll \\n[misc*ll]u
  356. .lt \\n[misc*ll]u
  357. ..
  358. .\"-------------
  359. .\" .misc@push stackname value
  360. .de misc@push
  361. .ie d misc*st-\\$1 .ds misc*st-\\$1 \\$2 \\*[misc*st-\\$1]
  362. .el .ds misc*st-\\$1 \\$2
  363. ..
  364. .\"-------------
  365. .\" .misc@pop stackname
  366. .\" value returned in the string misc*pop
  367. .de misc@pop
  368. .misc@pop-set misc*st-\\$1 \\*[misc*st-\\$1]
  369. ..
  370. .\"-------------
  371. .de misc@pop-set
  372. .ds misc*st-name \\$1
  373. .shift
  374. .if \\n[.$]<1 .@error "stack \\*[misc*st-name] empty"
  375. .ds misc*pop \\$1
  376. .shift
  377. .ds \\*[misc*st-name] \\$*
  378. ..
  379. .\"-------------
  380. .\" .misc@pop-nr stackname varname
  381. .de misc@pop-nr
  382. .misc@pop \\$1
  383. .nr \\$2 \\*[misc*pop]
  384. ..
  385. .\"-------------
  386. .\" .misc@pop-ds stackname varname
  387. .de misc@pop-ds
  388. .misc@pop \\$1
  389. .ds \\$2 \\*[misc*pop]
  390. ..
  391. .\"-----------
  392. .\" reset tabs
  393. .de TAB
  394. .ta T 5n
  395. ..
  396. .\"-------------
  397. .\" .PGFORM linelength [ pagelength [ pageoffset [1]]]
  398. .de PGFORM
  399. .\" Break here to avoid problems with new linesetting of the previous line.
  400. .\" Hope this doesn't break anything else :-)
  401. .\" Don't break if arg_4 is a '1'.
  402. .if ''\\$4' .br
  403. .if !''\\$1' .nr @ll \\$1
  404. .if !''\\$2' .nr @pl \\$2
  405. .if !''\\$3' .nr @po \\$3
  406. .ll \\n[@ll]u
  407. .lt \\n[@ll]u
  408. .po \\n[@po]u
  409. .pl \\n[@pl]u
  410. .nr @cur-ll \\n[@ll]
  411. 'in 0
  412. .pg@move-trap
  413. ..
  414. .\"-------------
  415. .\" .MOVE y [[x] linelength]
  416. .\" move to line y, indent to x
  417. .de MOVE
  418. .if !\\n[.$] .@error "MOVE y [x]: no arguments"
  419. .if \\n[nl]<0 \c
  420. .\" move to Y-pos
  421. .sp |(v;\\$1)
  422. .\" calc linelength
  423. .ie \\n[.$]>2 .nr pg*i (n;\\$3)
  424. .el \{\
  425. .    ie \\n[.$]>1 .nr pg*i (n;\\n[@ll]u-\\$2)
  426. .    el .nr pg*i \\n[@ll]u
  427. .\}
  428. .\" move to X-pos, if any
  429. .if !''\\$2' .po \\$2
  430. .\" set linelength
  431. .ll \\n[pg*i]u
  432. ..
  433. .\"-------------
  434. .de SM
  435. .if !\\n[.$] .@error "SM: no arguments"
  436. .if \\n[.$]=1 \s-1\\$1\s0
  437. .if \\n[.$]=2 \s-1\\$1\s0\\$2
  438. .if \\n[.$]=3 \\$1\s-1\\$2\s0\\$3
  439. ..
  440. .\"-------------
  441. .nr misc*S-ps \n[@ps]
  442. .nr misc*S-vs \n[@vs]
  443. .nr misc*S-ps1 \n[@ps]
  444. .nr misc*S-vs1 \n[@vs]
  445. .ds misc*a
  446. .ds misc*b
  447. .de S
  448. .ie !\\n[.$] \{\
  449. .    ds misc*a P
  450. .    ds misc*b P
  451. .\}
  452. .el \{\
  453. .    ie \\n[.$]=1 .ds misc*b D
  454. .    el \{\
  455. .        ie \w@\\$2@=0 .ds misc*b C
  456. .        el .ds misc*b \\$2
  457. .    \}
  458. .    ie \w@\\$1@=0 .ds misc*a C
  459. .    el .ds misc*a \\$1
  460. .\}
  461. .\"
  462. .\" set point size
  463. .if !'\\*[misc*a]'C' \{\
  464. .    ie '\\*[misc*a]'P' .nr @ps \\n[misc*S-ps]
  465. .    el \{\
  466. .        ie '\\*[misc*a]'D' .nr @ps 10
  467. .        el .nr @ps \\*[misc*a]
  468. .    \}
  469. .\}
  470. .\"
  471. .\" set vertical spacing
  472. .if !'\\*[misc*b]'C' \{\
  473. .    ie '\\*[misc*b]'P' .nr @vs \\n[misc*S-vs]
  474. .    el \{\
  475. .        ie '\\*[misc*b]'D' .nr @vs \\n[@ps]+2
  476. .        el .nr @vs \\*[misc*b]
  477. .    \}
  478. .\}
  479. 'ps \\n[@ps]
  480. 'vs \\n[@vs]
  481. .if \\n[D]>1 .tm point-size \\n[@ps] (\\n[.s]), vertical spacing \\n[@vs] (\\n[.v])
  482. .nr misc*S-ps \\n[misc*S-ps1]
  483. .nr misc*S-vs \\n[misc*S-vs1]
  484. .nr misc*S-ps1 \\n[@ps]
  485. .nr misc*S-vs1 \\n[@vs]
  486. ..
  487. .\"------------
  488. .de HC
  489. .ev 0
  490. .hc \\$1
  491. .ev
  492. .ev 1
  493. .hc \\$1
  494. .ev
  495. .ev 2
  496. .hc \\$1
  497. .ev
  498. ..
  499. .\"------------
  500. .de RD
  501. .di misc*rd
  502. 'fl
  503. .rd \\$1
  504. .br
  505. .di
  506. .ie !''\\$3' \{\
  507. .    di misc*rd2
  508. .    ds \\$3 "\\*[misc*rd]
  509. .    br
  510. .    di
  511. .\}
  512. .if !''\\$2' .rn misc*rd \\$2
  513. .rm misc*rd misc*rd2
  514. ..
  515. .\"------------
  516. .\" VERBON [flag [pointsize [font]]]
  517. .\"    flag
  518. .\"    bit    function
  519. .\"    0    escape on
  520. .\"    1    add an empty line before verbose text
  521. .\"    2    add an empty line after verbose text
  522. .\"    3    numbered lines (controlled by the string Verbnm)
  523. .\"    4    indent text by the numbervariable Verbin.
  524. .de VERBON
  525. .br
  526. .nr misc*verb 0\\$1
  527. .if (0\\n[misc*verb]%4)/2 .SP \\n[Lsp]u
  528. .misc@ev-keep misc*verb-ev
  529. .nf
  530. .if (0\\n[misc*verb]%16)/8 .nm \\*[Verbnm]
  531. .ie !'\\$3'' .ft \\$3
  532. .el .ft CR
  533. .ie 0\\$2 \{\
  534. .    ss \\$2
  535. .    ps \\$2
  536. .    vs \\$2
  537. .\}
  538. .el .ss 12
  539. .ta T 8u*\w@n@u
  540. .if (0\\n[misc*verb]%32)/16 .in +\\n[Verbin]u
  541. .if 0\\n[misc*verb]%2 \{\
  542. .    eo
  543. .    nr @verbose-flag 1        \" tell pageheader to set ec/eo
  544. .\}
  545. ..
  546. .de VERBOFF
  547. .ec
  548. .br
  549. .if (0\\n[misc*verb]%8)/4 .SP \\n[Lsp]u
  550. .if (0\\n[misc*verb]%16)/8 .nm
  551. .if (0\\n[misc*verb]%32)/16 .in
  552. .ev
  553. .nr @verbose-flag 0
  554. ..
  555. .\" ######## module acc #################
  556. .\"-----------
  557. .\" accents. These are copied from mgs, written by James Clark.
  558. .de acc@over-def
  559. .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
  560. \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
  561. ..
  562. .de acc@under-def
  563. .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
  564. ..
  565. .acc@over-def ` \`
  566. .acc@over-def ' \'
  567. .acc@over-def ^ ^
  568. .acc@over-def ~ ~
  569. .acc@over-def : \(ad
  570. .acc@over-def ; \(ad
  571. .acc@under-def , \(ac
  572. .\" ######## module uni #################
  573. .\" unimplemented macros
  574. .de OK
  575. .tm "OK: not implemented"
  576. ..
  577. .de PM
  578. .tm "PM: not implemented"
  579. ..
  580. .\" ######## module hd #################
  581. .\" support for usermacro
  582. .nr hd*h1-page 1    \" last page-number for level 1 header.
  583. .nr hd*htype 0
  584. .ds hd*sect-pg
  585. .ds hd*mark
  586. .ds hd*suf-space
  587. .nr hd*need 0
  588. .aln ;0 hd*htype
  589. .als }0 hd*mark
  590. .als }2 hd*suf-space
  591. .aln ;3 hd*need
  592. .\"-------------
  593. .\" .hd@split varable index name val1 val2 ...
  594. .de hd@split
  595. .if \\$2>(\\n[.$]-3) .@error "\\$3 must have at least \\$2 values (\\*[\\$3]).
  596. .nr hd*sp-tmp \\$2+3
  597. .ds \\$1 \\$[\\n[hd*sp-tmp]]
  598. ..
  599. .de HU
  600. .H 0 "\\$1"
  601. ..
  602. .\"-------------
  603. .de H
  604. .if !r hd*cur-bline .nr hd*cur-bline \\n[nl]
  605. .br
  606. .ds@print-float 2\"    $$$ could be wrong...
  607. .\" terminate all lists
  608. .LC 0
  609. .init@reset
  610. .nr hd*level 0\\$1
  611. .nr hd*arg1 0\\$1
  612. .if !\\n[hd*level] .nr hd*level \\n[Hu]
  613. .\"
  614. .\"    clear lower counters
  615. .nr hd*i 1 1
  616. .while \\n+[hd*i]<8 .if \\n[hd*level]<\\n[hd*i] .nr H\\n[hd*i] 0 1
  617. .\"
  618. .\"    Check if it's time for new page. Only if text has
  619. .\"    appeared before.
  620. .if \\n[Ej]&(\\n[Ej]>=\\n[hd*level])&(\\n[nl]>\\n[hd*cur-bline]) .pg@next-page
  621. .\"
  622. .\" increment current counter
  623. .nr H\\n[hd*level] +1
  624. .\"
  625. .\" update pagenumber if section-page is used
  626. .if \\n[hd*level]=1 .hd@set-page \\n[%]
  627. .\"
  628. .\"
  629. .\" hd*mark is the text written to the left of the header.
  630. .ds hd*mark \\n[H1].
  631. .\"
  632. .if \\n[hd*level]>1 .as hd*mark \\n[H2]
  633. .\"
  634. .nr hd*i 2 1
  635. .while \\n+[hd*i]<8 .if \\n[hd*level]>(\\n[hd*i]-1) .as hd*mark .\\n[H\\n[hd*i]]
  636. .if \\n[Ht] .ds hd*mark \\n[H\\n[hd*level]].
  637. .\"
  638. .\" toc-mark is sent to the table of contents
  639. .ds hd*toc-mark \\*[hd*mark]
  640. .as hd*mark \ \ \"            add spaces between mark and heading
  641. .if !\\n[hd*arg1] \{\
  642. .    ds hd*mark\"        no mark for unnumbered
  643. .    ds hd*toc-mark
  644. .\}
  645. .\"
  646. .if \\n[D]>1 .tm At header \\*[hd*toc-mark] "\\$2"
  647. .nr hd*htype 0                \" hd*htype = check break and space
  648. .                    \" 0 = run-in, 1 = break only, 2 = space
  649. .if \\n[hd*level]<=\\n[Hb] .nr hd*htype 1
  650. .if \\n[hd*level]<=\\n[Hs] .nr hd*htype 2
  651. .                    \" two spaces if hd*htype == 0
  652. .ie (\\n[hd*htype]=0)&(\w@\\$2@) .ds hd*suf-space "  \"
  653. .el .ds hd*suf-space
  654. .nr hd*need 2v                \" hd*need = header need space
  655. .if \\n[hd*htype]<2 .nr hd*need +\\n[Lsp]u \"    add some extra space
  656. .\"---------- user macro HX ------------
  657. .\" User exit macro to override numbering.
  658. .\" May change hd*mark (}0), hd*suf-space (}2) and hd*need (;3)
  659. .\" Can also change Hps1/2.
  660. .if d HX .HX \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
  661. .\"-------------------------------------- 
  662. .\" pre-space
  663. .ie \\n[hd*level]<=\\n[Hps] .SP \\n[Hps2]u
  664. .el .SP \\n[Hps1]u
  665. .\"
  666. .par@reset-num \\n[hd*level]\"            reset numbered paragraph
  667. .\" start diversion to measure size of header
  668. .di hd*div
  669. \\*[hd*mark]\\$2\\$3\\*[hd*suf-space]
  670. .br
  671. .di
  672. .rm hd*div
  673. .ne \\n[hd*need]u+\\n[dn]u+.5p  \"    this is the needed space for a header
  674. .if \\n[hd*htype] .na \"        no adjust if run-in
  675. .\"
  676. .\" size and font calculations
  677. .hd@split hd*font \\n[hd*level] HF \\*[HF]\"    get font for this level
  678. .ft \\*[hd*font]\"            set new font
  679. .hd@split hd*new-ps \\n[hd*level] HP \\*[HP]\"    get point size
  680. .ie (\\*[hd*new-ps]=0):(\w@\\*[hd*new-ps]@=0) \{\
  681. .    if \\n[hd*htype] \{\
  682. .        if '\\*[hd*font]'3' \{\
  683. .            ps -1
  684. .            vs -1
  685. .        \}
  686. .        if '\\*[hd*font]'B' \{\
  687. .            ps -1
  688. .            vs -1
  689. .        \}
  690. .    \}
  691. .\}
  692. .el \{\
  693. .    ps \\*[hd*new-ps]
  694. .    vs \\*[hd*new-ps]+2
  695. .\}
  696. .\"
  697. .\"---------- user macro HY ------------- 
  698. .\"    user macro to reset indents
  699. .if d HY .HY \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
  700. .\"-------------------------------------- 
  701. .nr hd*mark-size \w@\\*[hd*mark]@
  702. .if (\\n[hd*level]<=\\n[Hc])&\\n[hd*htype] .ce\" center if level<=Hc
  703. .\"
  704. .\"    finally, output the header
  705. \\*[hd*mark]\&\c
  706. .\"    and the rest of the header
  707. .ie \\n[hd*htype] \{\
  708. \\$2\\$3
  709. .    br
  710. .\}
  711. .el \\$2\\$3\\*[hd*suf-space]\&\c
  712. .ft 1
  713. .\" restore pointsize and vertical size.
  714. .ps \\n[@ps]
  715. .vs \\n[@vs]
  716. .\"
  717. .\" table of contents
  718. .if (\\n[hd*level]<=\\n[Cl])&\w@\\$2@ \{\
  719. .    ie \\n[Sectp] \{\
  720. .        toc@save \\n[hd*level] "\\*[hd*toc-mark]" "\\$2" \\*[hd*sect-pg]
  721. .    \}
  722. .    el .toc@save \\n[hd*level] "\\*[hd*toc-mark]" "\\$2" \\n[%]
  723. .\}
  724. .\"    set adjust to previous value
  725. .SA
  726. .\"    do break or space
  727. .if \\n[hd*htype] .br
  728. .if \\n[hd*htype]>1 .SP \\n[Lsp]u
  729. .if \\n[hd*htype] \{\
  730. .    \"    indent if Hi=1 and Pt=1
  731. .    if (\\n[Hi]=1)&(\\n[Pt]=1) .ti +\\n[Pi]n
  732. .    \"    indent size of mark if Hi=2
  733. .    if \\n[hd*htype]&(\\n[Hi]>1) .ti +\\n[hd*mark-size]u
  734. .\}
  735. .nr par@ind-flag 0            \" no indent on .P if Pt=2
  736. .\"
  737. .\"    check if it is time to reset footnotes
  738. .if (\\n[hd*level]=1)&\\n[ft*clear-at-header] .nr ft*nr 0 1
  739. .\"
  740. .\"    check if it is time to reset indexes
  741. .if (\\n[hd*level]=1)&\\n[Sectf] \{\
  742. .    nr lix*fg-nr 0 1
  743. .    nr lix*tb-nr 0 1
  744. .    nr lix*ec-nr 0 1
  745. .    nr lix*ex-nr 0 1
  746. .\}
  747. .\"---------- user macro HZ ----------
  748. .if d HZ .HZ \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
  749. .nr hd*last-pos \\n[nl]
  750. .nr hd*last-hpos \\n[.k]
  751. .nr par@ind-flag 0
  752. ..
  753. .\"--------
  754. .de HM
  755. .nr hd*i 0 1
  756. .while \\n+[hd*i]<8 .af H\\n[hd*i] \\$[\\n[hd*i]] 1
  757. ..
  758. .\"----------------------
  759. .\" set page-nr, called from header 
  760. .\" 
  761. .de hd@set-page
  762. .if \\n[.$]>0 .nr hd*h1-page \\$1
  763. .\"
  764. .ie \\n[Sectp] .nr P \\n[%]-\\n[hd*h1-page]+1
  765. .el .nr P \\n[%]
  766. .\"
  767. .\" Set section-page-string
  768. .ds hd*sect-pg \\n[H1]-\\n[P]
  769. .if \\n[Sectp]>1 .if '\\n[H1]'0' .ds hd*sect-pg "
  770. ..
  771. .\"########### module pg ####################
  772. .\" set end of text trap
  773. .wh 0 pg@header
  774. .em pg@end-of-text
  775. .\"
  776. .ds pg*header ''- % -''
  777. .ds pg*footer
  778. .if \n[N]=4 .ds pg*header ''''
  779. .if \n[N]=5 \{\
  780. .    ds pg*header ''''
  781. .    ds pg*footer ''\\*[hd*sect-pg]''
  782. .\}
  783. .ds pg*even-footer
  784. .ds pg*odd-footer
  785. .ds pg*even-header
  786. .ds pg*odd-header
  787. .\"
  788. .nr pg*top-margin 0
  789. .nr pg*foot-margin 0
  790. .nr pg*block-size 0
  791. .nr pg*footer-size 5\"             1v+footer+even/odd footer+2v
  792. .nr pg*header-size 7\"             3v+header+even/odd header+2v
  793. .nr pg*extra-footer-size 0
  794. .nr pg*extra-header-size 0
  795. .nr ft*note-size 0
  796. .nr pg*cur-column 0
  797. .nr pg*cols-per-page 1
  798. .nr pg*cur-po \n[@po]
  799. .nr pg*head-mark 0
  800. .\"
  801. .nr pg*ps \n[@ps]
  802. .nr pg*vs \n[@vs]
  803. .\"-------------------------
  804. .\" footer traps: set, enable and disable
  805. .de pg@set-new-trap
  806. .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]v+\\n[pg*extra-footer-size]u)
  807. .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]v) = \\n[pg*foot-trap]
  808. .\" last-pos points to the position of the footer and bottom 
  809. .\" block below foot-notes.
  810. .nr pg*last-pos \\n[@pl]u-(\\n[pg*block-size]u+\\n[pg*foot-margin]u+\\n[pg*footer-size]v)
  811. ..
  812. .de pg@enable-trap
  813. .wh \\n[pg*foot-trap]u pg@footer
  814. .if \\n[D]>2 .tm pg@enable-trap .t=\\n[.t] nl=\\n[nl]
  815. ..
  816. .de pg@disable-trap
  817. .ch pg@footer
  818. ..
  819. .\" move to new trap (if changed).
  820. .de pg@move-trap
  821. .pg@disable-trap
  822. .pg@set-new-trap
  823. .pg@enable-trap
  824. ..
  825. .de pg@enable-top-trap
  826. .\" set trap for pageheader.
  827. .nr pg*top-enabled 1
  828. ..
  829. .de pg@disable-top-trap
  830. .\" remove trap for pageheader.
  831. .nr pg*top-enabled 0
  832. ..
  833. .\" no header on the next page
  834. .de PGNH
  835. .nr pg*top-enabled -1
  836. ..
  837. .\" set first trap for pagefooter
  838. .pg@enable-top-trap
  839. .pg@set-new-trap
  840. .pg@enable-trap
  841. .\"-------------------------
  842. .\" stop output and begin on next page. Fix footnotes and all that.
  843. .de pg@next-page
  844. .\".debug next-page
  845. .ne 999i        \" activate trap
  846. .\" .pg@footer
  847. ..
  848. .\"-------------------------
  849. .\" support for PX and TP
  850. .als }t pg*header
  851. .als }e pg*even-header
  852. .als }o pg*odd-header
  853. .\"------------------------------------------------------------
  854. .\" HEADER
  855. .de pg@header
  856. .if \\n[D]>1 .tm Page# \\n[%] (\\n[.F]:\\n[c.])
  857. .if \\n[Idxf] \{\
  858. .tl '<pagenr\ \\n[%]>'''
  859. .\}
  860. .\" assign current page-number to P
  861. .hd@set-page
  862. .\"
  863. .\" suppress pageheader if pagenumber == 1 and N == [124]
  864. .if \\n[pg*top-enabled] \{\
  865. .    if \\n[pg*extra-header-size] 'sp \\n[pg*extra-header-size]u
  866. .    if \\n[pg*top-margin] 'sp \\n[pg*top-margin]u
  867. .    ev pg*tl-ev
  868. .    pg@set-env
  869. .    ie !d TP \{\
  870. '        sp 3
  871. .        ie ((\\n[%]=1)&((\\n[N]=1):(\\n[N]=2))) .sp
  872. .        el .tl \\*[pg*header]
  873. .        ie o .tl \\*[pg*odd-header]
  874. .        el .tl \\*[pg*even-header]
  875. '        sp 2
  876. .    \}
  877. .    el .TP
  878. .    ev
  879. .    \" why no-space??
  880. .    if d PX \{\
  881. .        ns
  882. .        PX
  883. .        rs
  884. .    \}
  885. .    \" check for pending footnotes 
  886. .    ft@check-old
  887. .    \"
  888. .    \" back to normal text processing
  889. .    pg@enable-trap
  890. .    \" mark for multicolumn
  891. .    nr pg*head-mark \\n[nl]u
  892. .    \" set multicolumn
  893. .    \" 
  894. .    pg@set-po
  895. .    \" print floating displays
  896. .    ds@print-float 4
  897. .    tbl@top-hook
  898. .    ns
  899. .\}
  900. .if \\n[pg*top-enabled]<0 .nr pg*top-enabled 1
  901. .nr hd*cur-bline \\n[nl]    \" .H needs to know if output has occured
  902. ..
  903. .\"---------------------------------------------------------
  904. .\" FOOTER
  905. .de pg@footer
  906. .ec
  907. .if \\n[D]>2 .tm Footer# \\n[%] (\\n[.F]:\\n[c.])
  908. .pg@disable-trap
  909. .\".debug footer
  910. .tbl@bottom-hook
  911. .\" increment pageoffset for MC
  912. .\" move to the exact start of footer.
  913. 'sp |\\n[pg*foot-trap]u+1v
  914. .\"
  915. .if \\n[D]>3 .tm FOOTER after .sp
  916. .\" print footnotes
  917. .if d ft*div .ft@print
  918. .\"
  919. .pg@inc-po
  920. .if !\\n[pg*cur-column] .pg@print-footer
  921. .\" next column
  922. .pg@set-po
  923. .pg@enable-trap
  924. .if \\n[@verbose-flag] .eo        \" to help VERBON/VERBOFF
  925. ..
  926. .\"-------------------------
  927. .de pg@print-footer
  928. .\" jump to the position just below the foot-notes.
  929. 'sp |\\n[pg*last-pos]u+1v
  930. .\" check if there are any bottom block
  931. .if d pg*block-div .pg@block
  932. .\"
  933. .\" print the footer and eject new page
  934. .ev pg*tl-ev
  935. .pg@set-env
  936. .ie o .tl \\*[pg*odd-footer]
  937. .el .tl \\*[pg*even-footer]
  938. .ie (\\n[%]=1)&(\\n[N]=1) .tl \\*[pg*header]
  939. .el .tl \\*[pg*footer]
  940. .ev
  941. .ie (\\n[ds*fnr]>=\\n[ds*o-fnr]):\\n[ft*exist] \{\
  942. .    ev ne
  943. '    bp
  944. .    ev
  945. .\}
  946. .el 'bp
  947. ..
  948. .\"-------------------------
  949. .\"
  950. .\" Initialize the title environment
  951. .de pg@set-env
  952. 'na
  953. 'nh
  954. 'in 0
  955. 'ti 0
  956. .ie \\n[Pgps] \{\
  957. .    ps \\n[@ps]
  958. .    vs \\n[@vs]
  959. .\}
  960. .el \{\
  961. .    ps \\n[pg*ps]
  962. .    vs \\n[pg*vs]
  963. .\}
  964. .lt \\n[@ll]u
  965. ..
  966. .\"-------------------------
  967. .de PH
  968. .ds pg*header "\\$1
  969. .pg@set-new-size
  970. ..
  971. .de PF
  972. .ds pg*footer "\\$1
  973. .pg@set-new-size
  974. ..
  975. .de OH
  976. .ds pg*odd-header "\\$1
  977. .pg@set-new-size
  978. ..
  979. .de EH
  980. .ds pg*even-header "\\$1
  981. .pg@set-new-size
  982. ..
  983. .de OF
  984. .ds pg*odd-footer "\\$1
  985. .pg@set-new-size
  986. ..
  987. .de EF
  988. .ds pg*even-footer "\\$1
  989. .pg@set-new-size
  990. ..
  991. .de pg@clear-hd
  992. .ds pg*even-header
  993. .ds pg*odd-header
  994. .ds pg*header
  995. ..
  996. .de pg@clear-ft
  997. .ds pg*even-footer
  998. .ds pg*odd-footer
  999. .ds pg*footer
  1000. ..
  1001. .de pg@set-new-size
  1002. .nr pg*ps \\n[@ps]
  1003. .nr pg*vs \\n[@vs]
  1004. .pg@move-trap
  1005. ..
  1006. .\"-------------------------
  1007. .\" end of page processing
  1008. .de pg@footnotes
  1009. .\".debug footnotes
  1010. .\" output footnotes. set trap for block
  1011. .\"
  1012. ..
  1013. .\"-------------------------
  1014. .\" print bottom block
  1015. .de pg@block
  1016. .ev pg*block-ev
  1017. 'nf
  1018. 'in 0
  1019. .ll 100i
  1020. .pg*block-div
  1021. .br
  1022. .ev
  1023. ..
  1024. .\"-------------------------
  1025. .\" define bottom block
  1026. .de BS
  1027. .misc@ev-keep pg*block-ev
  1028. .init@reset
  1029. .br
  1030. .di pg*block-div
  1031. ..
  1032. .\"-------------------------
  1033. .de BE
  1034. .br
  1035. .di
  1036. .nr pg*block-size \\n[dn]u
  1037. .ev
  1038. .pg@move-trap
  1039. ..
  1040. .\"-------------------------
  1041. .\" print out all pending text
  1042. .de pg@end-of-text
  1043. .if \\n[D]>2 .tm ---------- End of text processing ----------------
  1044. .ds@eot-print
  1045. .ref@eot-print
  1046. ..
  1047. .\"-------------------------
  1048. .\" set top and bottom margins 
  1049. .de VM
  1050. .if \\n[.$]=0 \{\
  1051. .    nr pg*extra-footer-size 0
  1052. .    nr pg*extra-header-size 0
  1053. .\}
  1054. .if \\n[.$]>0 .nr pg*extra-header-size (v;\\$1)
  1055. .if \\n[.$]>1 .nr pg*extra-footer-size (v;\\$2)
  1056. .if \\n[D]>2 \{\
  1057. .    tm extra top \\n[pg*extra-footer-size]
  1058. .    tm extra bottom \\n[pg*extra-header-size]
  1059. .\}
  1060. .pg@move-trap
  1061. ..
  1062. .\"---------------------
  1063. .\" multicolumn output. 
  1064. .de pg@set-po
  1065. .if \\n[pg*cols-per-page]>1 \{\
  1066. .    ll \\n[pg*column-size]u
  1067. .\}
  1068. ..
  1069. .de pg@inc-po
  1070. .if \\n[pg*cols-per-page]>1 \{\
  1071. .    ie \\n+[pg*cur-column]>=\\n[pg*cols-per-page] \{\
  1072. .        nr pg*cur-column 0 1
  1073. .        nr pg*cur-po \\n[@po]u
  1074. .        po \\n[@po]u
  1075. .        ll \\n[@ll]u
  1076. .    \}
  1077. .    el \{\
  1078. .        nr pg*cur-po +(\\n[pg*column-size]u+\\n[pg*column-sep]u)
  1079. .        po \\n[pg*cur-po]u
  1080. '        sp |\\n[pg*head-mark]u
  1081. .        tbl@top-hook
  1082. .    \}
  1083. .\}
  1084. ..
  1085. .\" An argument disables the page-break.
  1086. .de 1C
  1087. .br
  1088. .if \\n[pg*cols-per-page]<=1 .@error "1C: multicolumn mode not active"
  1089. .nr pg*cols-per-page 1
  1090. .nr pg*column-sep 0
  1091. .nr pg*column-size \\n[@ll]
  1092. .nr pg*cur-column 0 1
  1093. .nr pg*cur-po \\n[@po]u
  1094. .PGFORM
  1095. .if !'\\$1'1' .SK
  1096. ..
  1097. .de 2C
  1098. .br
  1099. .nr pg*head-mark \\n[nl]u
  1100. .if \\n[pg*cols-per-page]>1 .@error "2C: multicolumn mode already active"
  1101. .nr pg*cols-per-page 2
  1102. .nr pg*column-sep \\n[@ll]/15
  1103. .nr pg*column-size (\\n[@ll]u*7)/15
  1104. .nr pg*cur-column 0 1
  1105. .nr pg*cur-po \\n[@po]u
  1106. .ll \\n[pg*column-size]u
  1107. .\" .lt \\n[pg*column-size]u
  1108. ..
  1109. .\" MC column-size [ column-separation ]
  1110. .de MC
  1111. .br
  1112. .nr pg*head-mark \\n[nl]u
  1113. .if \\n[pg*cols-per-page]>1 .@error "MC: multicolumn mode already active"
  1114. .ie ''\\$1' .nr pg*column-size \\n[.l]
  1115. .el .nr pg*column-size (n;\\$1)
  1116. .ie ''\\$2' .nr pg*column-sep \\n[pg*column-size]/15
  1117. .el .nr pg*column-sep (n;\\$2)
  1118. .\"
  1119. .nr pg*cols-per-page (u;\\n[.l]/(\\n[pg*column-size]+\\n[pg*column-sep]+1))
  1120. .nr pg*cur-column 0 1
  1121. .nr pg*cur-po \\n[@po]u
  1122. .ll \\n[pg*column-size]u
  1123. .\" .lt \\n[pg*column-size]u
  1124. ..
  1125. .\" begin a new column
  1126. .de NCOL
  1127. .br
  1128. .pg@footer
  1129. ..
  1130. .\" skip pages
  1131. .de SK
  1132. .br
  1133. .bp
  1134. .nr pg*i 0 1
  1135. .\" force new page by writing something invisible.
  1136. .while \\n+[pg*i]<=(0\\$1) \{\
  1137. \&
  1138. .    bp
  1139. .\}
  1140. ..
  1141. .\"-------------------------------
  1142. .\" MULB width1 space1 width2 space2 width3 space3 ...
  1143. .de MULB
  1144. .br
  1145. .nr pg*i 0 1
  1146. .nr pg*mul-x 0 1
  1147. .nr pg*mul-ind 0
  1148. .nr pg*mul-last 0
  1149. .while \\n[.$] \{\
  1150. .    nr pg*mul!\\n+[pg*i] (n;0\\$1)
  1151. .    nr pg*muls!\\n[pg*i] (n;0\\$2)
  1152. .    shift 2
  1153. .\}
  1154. .nr pg*mul-max-col \\n[pg*i]
  1155. .ds pg*mul-fam \\n[.fam]
  1156. .nr pg*mul-font \\n[.f]
  1157. .ev pg*mul-ev
  1158. .ps \\n[@ps]
  1159. .vs \\n[@vs]
  1160. .fam \\*[pg*mul-fam]
  1161. .ft \\n[pg*mul-font]
  1162. .fi
  1163. .hy 14
  1164. .di pg*mul-div
  1165. .MULN
  1166. ..
  1167. .\"-----------
  1168. .de MULN
  1169. .if \\n[pg*mul-x]>=\\n[pg*mul-max-col] .@error "MULN: Undefined columnwidth"
  1170. .br
  1171. .if \\n[.d]>\\n[pg*mul-last] .nr pg*mul-last \\n[.d]
  1172. .rt +0
  1173. .in \\n[pg*mul-ind]u
  1174. .ll (u;\\n[.i]+\\n[pg*mul!\\n+[pg*mul-x]])u
  1175. .nr pg*mul-ind +(u;\\n[pg*mul!\\n[pg*mul-x]]+\\n[pg*muls!\\n[pg*mul-x]])
  1176. ..
  1177. .\"-----------
  1178. .\" MULE
  1179. .de MULE
  1180. .br
  1181. .if \\n[.d]>\\n[pg*mul-last] .nr pg*mul-last \\n[.d]
  1182. .di
  1183. .ev
  1184. .ne \\n[pg*mul-last]u
  1185. .nf
  1186. .mk
  1187. .pg*mul-div
  1188. .rt
  1189. .sp \\n[pg*mul-last]u
  1190. .fi
  1191. ..
  1192. .\"-----------
  1193. .de OP
  1194. .br
  1195. .ie o .if !\\n[pg*head-mark]=\\n[nl] \{\
  1196. .    bp +1
  1197. .    bp +1
  1198. .\}
  1199. .el .bp
  1200. ..
  1201. .\"########### module footnotes ###################
  1202. .nr ft*note-size 0
  1203. .nr ft*busy 0
  1204. .nr ft*nr 0 1
  1205. .nr ft*wide 0
  1206. .nr ft*hyphen 0\"    hyphenation value
  1207. .nr ft*adjust 1\"    >0 if adjust true
  1208. .nr ft*indent 1\"    >0 if text indent true (not imp. $$$)
  1209. .nr ft*just 0\"    0=left justification, 1=right (not imp. $$$)
  1210. .nr ft*exist 0\"    not zero if there are any footnotes to be printed
  1211. .nr ft*clear-at-header 0\" >0 if footnotes should be reset at first level head.
  1212. .\"
  1213. .ds F \v'-.4m'\s-3\\n+[ft*nr]\s0\v'.4m'
  1214. .\"
  1215. .\"-----------------
  1216. .\" init footnote environment
  1217. .de ft@init
  1218. .\" indentcontrol not implemented $$$
  1219. .\" label justification not implemented $$$
  1220. 'in 0
  1221. 'fi
  1222. .ie \\n[ft*adjust] 'ad
  1223. .el 'na
  1224. .ie \\n[ft*hyphen] 'hy 14
  1225. .el 'hy 0
  1226. .ll \\n[@cur-ll]u
  1227. .lt \\n[@cur-ll]u
  1228. .ps (\\n[@ps]-2)
  1229. .vs (\\n[@vs]-1)
  1230. ..
  1231. .\"-----------------
  1232. .\" set footnote format
  1233. .\" no support for two column processing (yet). $$$
  1234. .de FD
  1235. .if \\n[.$]=0 .@error "FD: bad arg \\$1"
  1236. .ie \\n[.$]=2 .nr ft*clear-at-header 1
  1237. .el .nr ft*clear-at-header 0
  1238. .\"
  1239. .if !'\\$1'' \{\
  1240. .    ie \\$1>11 .nr ft*format 0
  1241. .    el .nr ft*format \\$1
  1242. .    \"
  1243. .    nr ft*hyphen (\\n[ft*format]%2)*14
  1244. .    nr ft*format \\n[ft*format]/2
  1245. .    \"
  1246. .    nr ft*adjust 1-(\\n[ft*format]%2)
  1247. .    nr ft*format \\n[ft*format]/2
  1248. .    \"
  1249. .    nr ft*indent 1-(\\n[ft*format]%2)
  1250. .    nr ft*format \\n[ft*format]/2
  1251. .    \"
  1252. .    nr ft*just \\n[ft*format]%2
  1253. .\}
  1254. ..
  1255. .\"---------------
  1256. .\" Footnote and display width control $$$
  1257. .de WC
  1258. .nr ft*i 0 1
  1259. .while \\n+[ft*i]<=\\n[.$] \{\
  1260. .    ds ft*x \\$[\\n[ft*i]]
  1261. .    if '\\*[ft*x]'N' \{\
  1262. .        nr ft*wide 0
  1263. .        nr ft*first-fn 0
  1264. .        nr ds*wide 0
  1265. .        nr ds*float-break 1
  1266. .    \}
  1267. .    if '\\*[ft*x]'-WF' .nr ft*wide 0
  1268. .    if '\\*[ft*x]'WF' .nr ft*wide 1
  1269. .    if '\\*[ft*x]'-FF' .nr ft*first-fn 0
  1270. .    if '\\*[ft*x]'FF' .nr ft*first-fn 1
  1271. .    if '\\*[ft*x]'-WD' .nr ds*wide 0
  1272. .    if '\\*[ft*x]'WD' .nr ds*wide 1
  1273. .    if '\\*[ft*x]'-FB' .nr ds*float-break 0
  1274. .    if '\\*[ft*x]'FB' .nr ds*float-break 1
  1275. .\}
  1276. ..
  1277. .\"-----------------
  1278. .\" begin footnote
  1279. .de FS
  1280. .if \\n[ft*busy] .@error "FS: missing FE"
  1281. .nr ft*busy 1
  1282. .ev ft*ev
  1283. .ft@init
  1284. .if !\\n[ft*wide] .pg@set-po
  1285. .if !d ft*div .ft@init-footnote
  1286. .di ft*tmp-div
  1287. .nr ft*space (u;\\n[Fs]*\\n[Lsp])
  1288. .sp \\n[ft*space]u
  1289. .\" print mark
  1290. .ie \\n[.$] .ds ft*mark \\$1
  1291. .el .ds ft*mark \\n[ft*nr].
  1292. \\*[ft*mark]
  1293. .in +.75c
  1294. .sp -1
  1295. .nr ft*exist 1
  1296. ..
  1297. .\"-----------------
  1298. .\" init footnote diversion
  1299. .de ft@init-footnote
  1300. .di ft*div
  1301. \l'20n'
  1302. .br
  1303. .di
  1304. .nr ft*note-size \\n[dn]
  1305. ..
  1306. .\"-----------------
  1307. .\" end footnote
  1308. .de FE
  1309. .nr ft*busy 0
  1310. .br
  1311. .di
  1312. 'in 0
  1313. 'nf
  1314. .if \\n[@pl]u<\\n[dn]u .@error "FE: too big footnote"
  1315. .ie (\\n[pg*foot-trap]u-\\n[.d]u)<\\n[dn]u \{\
  1316. .    da ft*next-div
  1317. .    ft*tmp-div
  1318. .    br
  1319. .    di
  1320. .\}
  1321. .el \{\
  1322. .    da ft*div
  1323. .    ft*tmp-div
  1324. .    di
  1325. .    nr ft*note-size +\\n[dn]
  1326. .\}
  1327. .rm ft*tmp-div
  1328. .ev
  1329. .pg@move-trap
  1330. ..
  1331. .\"-----------------
  1332. .\" print footnotes, see pg@footer
  1333. .de ft@print
  1334. .ev ft*print-ev
  1335. 'nf
  1336. 'in 0
  1337. .ll 100i
  1338. .ft*div
  1339. .br
  1340. .ev
  1341. .rm ft*div
  1342. .nr ft*note-size 0
  1343. .pg@move-trap
  1344. ..
  1345. .\"-----------------
  1346. .\" check if any pending footnotes, see pg@header
  1347. .de ft@check-old
  1348. .if d ft*next-div \{\
  1349. .    ev ft*ev
  1350. .    ft@init
  1351. .    ft@init-footnote
  1352. .    nf
  1353. .    in 0
  1354. .    da ft*div
  1355. .    ft*next-div
  1356. .    di
  1357. .    nr ft*note-size +\\n[dn]
  1358. .    rm ft*next-div
  1359. .    ev
  1360. .    nr ft*exist 0
  1361. .    pg@move-trap
  1362. .\}
  1363. ..
  1364. .\"########### module display ###################
  1365. .nr ds*wide 0\"        >0 if wide displays wanted
  1366. .nr ds*fnr 0 1\"    floating display counter
  1367. .nr ds*o-fnr 1\"    floating display counter, already printed
  1368. .nr ds*snr 0 1\"    static display counter
  1369. .nr ds*lvl 0 1\"    display level
  1370. .nr ds*float-busy 0\"    >0 if printing float
  1371. .nr ds*ffloat 0\"    >0 if DF, 0 if DS
  1372. .\" static display start
  1373. .\" nested DS/DE is allowed. No limit on depth.
  1374. .de DS
  1375. .br
  1376. .ds@start 0 DS \\$@
  1377. ..
  1378. .\" floating display start
  1379. .\" nested DF/DE is not allowed.
  1380. .de DF
  1381. .if \\n[ds*lvl] .@error "DF:nested floating is not allowed. Use DS."
  1382. .ds@start 1 DF \\$@
  1383. ..
  1384. .\"---------------
  1385. .nr ds*format 0\"    dummy value for .En/.EQ
  1386. .nr ds*format! 0\"    no indent
  1387. .nr ds*format!0 0\"    no indent
  1388. .nr ds*format!L 0\"    no indent
  1389. .nr ds*format!I 1\"    indent
  1390. .nr ds*format!1 1\"    indent
  1391. .nr ds*format!C 2\"    center each line
  1392. .nr ds*format!2 2\"    center each line
  1393. .nr ds*format!CB 3\"    center as block
  1394. .nr ds*format!3 3\"    center as block
  1395. .nr ds*format!R 4\"    right justify each line
  1396. .nr ds*format!4 4\"    right justify each line
  1397. .nr ds*format!RB 5\"    right justify as block
  1398. .nr ds*format!5 5\"    right justify as block
  1399. .\"---------------
  1400. .nr ds*fill! 0\"    no fill
  1401. .nr ds*fill!N 0\"    no fill
  1402. .nr ds*fill!0 0\"    no fill
  1403. .nr ds*fill!F 1\"    fill on
  1404. .nr ds*fill!1 1\"    fill on
  1405. .\"---------------
  1406. .de ds@start
  1407. .nr ds*ffloat \\$1
  1408. .ds ds*type \\$2
  1409. .shift 2
  1410. .nr ds*lvl +1
  1411. .\" get format of the display
  1412. .ie \\n[.$] \{\
  1413. .    ie r ds*format!\\$1 .nr ds*format \\n[ds*format!\\$1]
  1414. .    el .@error "\\*[ds*type]:wrong format:\\$1"
  1415. .\}
  1416. .el .nr ds*format 0
  1417. .\" fill or not to fill, that is the...
  1418. .nr ds*fill 0
  1419. .ie \\n[.$]>1 \{\
  1420. .    ie r ds*fill!\\$2 .nr ds*fill \\n[ds*fill!\\$2]
  1421. .    el .@error "\\*[ds*type]:wrong fill:\\$2"
  1422. .\}
  1423. .nr ds*rindent 0
  1424. .if \\n[.$]>2 .nr ds*rindent \\$3
  1425. .\"
  1426. .\"---------------
  1427. .nr ds*old-ll \\n[.l]
  1428. .misc@push ds-ll \\n[.l]
  1429. .misc@push ds-form \\n[ds*format]
  1430. .misc@push ds-ffloat \\n[ds*ffloat]
  1431. .nr ds*i \\n[.i]
  1432. .nr ds*ftmp \\n[.f]
  1433. .misc@ev-keep ds*ev!\\n+[ds*snr]
  1434. .ft \\n[ds*ftmp]
  1435. .\"
  1436. .init@reset
  1437. 'in \\n[ds*i]u
  1438. .di ds*div!\\n[ds*snr]
  1439. .\"
  1440. .ll \\n[ds*old-ll]u
  1441. .lt \\n[ds*old-ll]u
  1442. .if \\n[ds*rindent] \{\
  1443. .    ll -\\n[ds*rindent]n
  1444. .    lt -\\n[ds*rindent]n
  1445. .\}
  1446. .if \\n[ds*wide] \{\
  1447. .    ll \\n[@ll]u
  1448. .    lt \\n[@ll]u
  1449. .\}
  1450. .\"
  1451. .ie \\n[ds*fill] 'fi
  1452. .el 'nf
  1453. .\"
  1454. .if \\n[ds*format]=1 \{\
  1455. .    ll -\\n[Si]n
  1456. .    lt -\\n[Si]n
  1457. '    in +\\n[Si]n
  1458. .\}
  1459. .if (\\n[ds*format]=3):(\\n[ds*format]=5) 'in 0
  1460. ..
  1461. .\"---------------
  1462. .de DE
  1463. .if \\n-[ds*lvl]<0 .@error "DE: no corresponding DS or DF"
  1464. .br
  1465. .if \\n[ds*ffloat] .SP \\n[Lsp]u
  1466. .di
  1467. .\" find out the real size of the diversion
  1468. .di ds*test
  1469. .ds*div!\\n[ds*snr]
  1470. .di
  1471. .nr ds*width \\n[dl]
  1472. .nr ds*height \\n[dn]
  1473. .rm ds*test
  1474. .misc@pop-nr ds-ll ds*old-ll
  1475. .misc@pop-nr ds-form ds*format
  1476. .misc@pop-nr ds-ffloat ds*ffloat
  1477. .if (\\n[ds*format]>=2)&(\\n[ds*width]>\\n[ds*old-ll]) \{\
  1478. .    @error "DE: display too wide for current line-length"
  1479. .\}
  1480. .\" prepare copy to floating display
  1481. .if \\n[ds*ffloat] .di ds*fdiv!\\n+[ds*fnr]
  1482. .\"
  1483. 'in 0
  1484. 'nf
  1485. .if \\n[ds*format]=2 'ce 9999
  1486. .if \\n[ds*format]=3 'in (u;(\\n[ds*old-ll]-\\n[ds*width])/2)
  1487. .if \\n[ds*format]=4 'rj 9999
  1488. .if \\n[ds*format]=5 'in (u;\\n[ds*old-ll]-\\n[ds*width])
  1489. .\"
  1490. .ie !\\n[ds*ffloat] \{\
  1491. .    \"
  1492. .    \"    Print static display
  1493. .    \"    Eject page if display will fit one page and
  1494. .    \"    there are less than half of the page left.
  1495. .    nr ds*i \\n[pg*foot-trap]-\\n[pg*header-size]v-\\n[pg*extra-header-size]v
  1496. .    if (\\n[ds*height]>\\n[ds*i])&(\\n[.t]<(\\n[ds*i]/2)) \{\
  1497. .        ne \\n[.t]u+1v
  1498. .    \}
  1499. .    if (\\n[ds*height]<\\n[ds*i])&(\\n[.t]<(\\n[ds*height])) \{\
  1500. .        ne \\n[.t]u+1v
  1501. .    \}
  1502. .    if \\n[Ds] .SP \\n[Lsp]u
  1503. .\}
  1504. .el .SP \\n[Lsp]u
  1505. .ds*div!\\n[ds*snr]
  1506. .ie !\\n[ds*ffloat] .if \\n[Ds] .SP \\n[Lsp]u
  1507. .el \{\
  1508. .    SP \\n[Lsp]u
  1509. .    di
  1510. .\}
  1511. .if \\n[ds*format]=2 'ce 0
  1512. .if \\n[ds*format]=4 'rj 0
  1513. .rm ds*div!\\n[ds*snr]
  1514. .nr ds*snr -1
  1515. .nr par@ind-flag 0
  1516. .\"        move div to the floating display list
  1517. .ev
  1518. .if \\n[ds*ffloat] \{\
  1519. .    nr ds*fsize!\\n[ds*fnr] \\n[dn]
  1520. .    \" print float if queue is empty and the display fits into
  1521. .    \" the current page
  1522. .    if ((\\n[ds*fnr]>\\n[ds*o-fnr])&(\\n[ds*height]<\\n[.t])) \{\
  1523. .        ds@print-float 1
  1524. .    \}
  1525. .\}
  1526. ..
  1527. .\"-------------
  1528. .\" called by end-of-text
  1529. .de ds@eot-print
  1530. .if \\n[ds*o-fnr]<=\\n[ds*fnr] \{\
  1531. .    if \\n[D]>2 .tm Print remaining displays.
  1532. .\" still some floats left, make non-empty environment
  1533. .    misc@ev-keep ne
  1534. .    init@reset
  1535. \c
  1536. .    ds@print-float 3
  1537. .    ev
  1538. .\}
  1539. ..
  1540. .\"---------------
  1541. .\" print according to Df and De.
  1542. .\" .ds@print-float type
  1543. .\"    type    called from
  1544. .\"    1    .DE
  1545. .\"    2    end of section
  1546. .\"    3    end of document
  1547. .\"    4    beginning of new page
  1548. .\"
  1549. .de ds@print-float
  1550. .if \\n[Df]>5 .@error "Df=\\n[Df], max value is 5"
  1551. .if !\\n[ds*float-busy] \{\
  1552. .    nr ds*float-busy 1
  1553. .\" at .DE
  1554. .    if (\\$1=1)&((\\n[Df]%2)=1) \{\
  1555. .        if \\n[.t]>\\n[ds*fsize!\\n[ds*o-fnr]] \{\
  1556. .            \" Df = 1,3 or 5
  1557. .            ds@print-one-float
  1558. .        \}
  1559. .    \}
  1560. .\" print all if Df<2 and end of section
  1561. .    if (\\$1=2)&(\\n[Df]<2) .ds@print-all-floats
  1562. .\" print all if end of document. Where should they go instead?
  1563. .    if \\$1=3 .ds@print-all-floats
  1564. .\" new page
  1565. .    if (\\$1=4)&(\\n[Df]>1) \{\
  1566. .        if \\n[Df]=2 .ds@print-one-float
  1567. .        if \\n[Df]=3 .ds@print-one-float
  1568. .        if \\n[Df]>3 \{\
  1569. .            ie \\n[De] .ds@print-all-floats
  1570. .            el .ds@print-this-page
  1571. .        \}
  1572. .    \}
  1573. .    nr ds*float-busy 0
  1574. .\}
  1575. ..
  1576. .\"---------------
  1577. .\" print a floating diversion
  1578. .de ds@output-div
  1579. .ev ds*fev
  1580. .in 0
  1581. .nf
  1582. .ds*fdiv!\\n[ds*o-fnr]
  1583. .ev
  1584. .rm ds*fdiv!\\n[ds*o-fnr]
  1585. .rm ds*fsize!\\n[ds*o-fnr]
  1586. .rm ds*fformat!\\n[ds*o-fnr]
  1587. .nr ds*o-fnr +1
  1588. ..
  1589. .\"---------------
  1590. .\" print one floating display if there is one.
  1591. .de ds@print-one-float
  1592. .if \\n[ds*o-fnr]<=\\n[ds*fnr] \{\
  1593. .    if \\n[.t]<\\n[ds*fsize!\\n[ds*o-fnr]] .pg@next-page
  1594. .    ds@output-div
  1595. .    if \\n[De] .pg@next-page
  1596. .\}
  1597. ..
  1598. .\"---------------
  1599. .\" print all queued floats.
  1600. .\" if De>0 do a page eject between the floats.
  1601. .de ds@print-all-floats
  1602. .while \\n[ds*o-fnr]<=\\n[ds*fnr] \{\
  1603. .    if \\n[.t]<\\n[ds*fsize!\\n[ds*o-fnr]] .pg@next-page
  1604. .    ds@output-div
  1605. .    if \\n[De] .pg@next-page
  1606. .\}
  1607. ..
  1608. .\"---------------
  1609. .\" print as many floats as will fit on the current page
  1610. .de ds@print-this-page
  1611. .while \\n[ds*o-fnr]<=\\n[ds*fnr] \{\
  1612. .    if \\n[.t]<\\n[ds*fsize!\\n[ds*o-fnr]] .break
  1613. .    ds@output-div
  1614. .\}
  1615. ..
  1616. .\"########### module list ###################
  1617. .\" .LI text-indent mark-indent pad type [mark [LI-space [LB-space] ] ]
  1618. .\"
  1619. .nr li*tind 0
  1620. .nr li*mind 0
  1621. .nr li*pad 0
  1622. .nr li*type 0
  1623. .ds li*mark 0
  1624. .nr li*li-spc 0
  1625. .nr li*lvl 0 1
  1626. .nr li*cur-vpos 0
  1627. .\"--------------------------
  1628. .\"    the major list-begin macro.
  1629. .\"    If type == -1 a 'break' will occur.
  1630. .de LB
  1631. .if \\n[.$]<4 .@error "LB: not enough arguments, min 4"
  1632. .misc@push cind \\n[.i]
  1633. .misc@push tind \\n[li*tind]
  1634. .misc@push mind \\n[li*mind]
  1635. .misc@push pad \\n[li*pad]
  1636. .misc@push type \\n[li*type]
  1637. .misc@push li-spc \\n[li*li-spc]
  1638. .ds li*mark-list!\\n[li*lvl] \\*[li*mark]
  1639. .nr li*lvl +1
  1640. .\"
  1641. .nr li*tind (n;0\\$1)\"            text-indent
  1642. .nr li*mind (n;0\\$2)\"            mark-indent
  1643. .nr li*pad (n;0\\$3)\"            pad
  1644. .nr li*type 0\\$4\"            type
  1645. .ds li*mark \\$5\"            mark
  1646. .ie !'\\$6'' .nr li*li-spc \\$6\"    LI-space
  1647. .el .nr li*li-spc 1
  1648. .ie !'\\$7'' .nr li*lb-spc \\$6\"    LB-space
  1649. .el .nr li*lb-spc 0
  1650. .\" init listcounter
  1651. .nr li*cnt!\\n[li*lvl] 0 1
  1652. .\" assign format
  1653. .af li*cnt!\\n[li*lvl] 1
  1654. .if \\n[li*type] .if !'\\*[li*mark]'' .af li*cnt!\\n[li*lvl] \\*[li*mark]
  1655. .\"
  1656. .if \\n[li*lb-spc] .SP (u;\\n[li*lb-spc]*\\n[Lsp])
  1657. .in +\\n[li*tind]u
  1658. ..
  1659. .\"---------------
  1660. .de LI
  1661. .if \\n[li*lvl]<1 .@error "LI:no lists active"
  1662. .if \\n[li*li-spc]&(\\n[Ls]>=\\n[li*lvl]) .SP (u;\\n[li*li-spc]*\\n[Lsp])
  1663. .ne 2v
  1664. .\"
  1665. .ds li*c-mark \\*[li*mark]
  1666. .nr li*cnt!\\n[li*lvl] +1
  1667. .if \\n[li*type]=1 .ds li*c-mark \\n[li*cnt!\\n[li*lvl]].
  1668. .if \\n[li*type]=2 .ds li*c-mark \\n[li*cnt!\\n[li*lvl]])
  1669. .if \\n[li*type]=3 .ds li*c-mark (\\n[li*cnt!\\n[li*lvl]])
  1670. .if \\n[li*type]=4 .ds li*c-mark [\\n[li*cnt!\\n[li*lvl]]]
  1671. .if \\n[li*type]=5 .ds li*c-mark <\\n[li*cnt!\\n[li*lvl]]>
  1672. .if \\n[li*type]=6 .ds li*c-mark {\\n[li*cnt!\\n[li*lvl]]}
  1673. .if \\n[.$]=1 .ds li*c-mark \\$1
  1674. .if \\n[.$]=2 .ds li*c-mark \\$1\ \\*[li*c-mark]
  1675. .if '\\*[li*c-mark]'\ ' .ds li*c-mark
  1676. .\"
  1677. .\" determine where the text begins
  1678. .nr li*text-begin \\n[li*tind]>?\w@\\*[li*c-mark]\ @
  1679. .nr x \w@\\*[li*c-mark]\ @
  1680. .\"
  1681. .\" determine where the mark begin
  1682. .ie !\\n[li*pad] .nr li*in \\n[li*mind]
  1683. .el .nr li*in \\n[li*text-begin]-\\n[li*pad]-\w@\\*[li*c-mark]@
  1684. .if !\\n[li*in] .nr li*in 0
  1685. .\"
  1686. .ti -\\n[li*tind]u
  1687. .\" no indentation if hanging indent
  1688. .if (\w@\\*[li*c-mark]@=0)&((\\n[.$]=0):(\w@\\$1@=0)) .nr li*text-begin 0
  1689. \Z'\&\h'\\n[li*in]u'\\*[li*c-mark]'\h'\\n[li*text-begin]u'\&\c
  1690. .if \\n[li*type]=-1 .br
  1691. ..
  1692. .\"
  1693. .\"-------------
  1694. .de li@pop
  1695. .nr li*lvl -1
  1696. .misc@pop-nr cind li*tmp
  1697. .in \\n[li*tmp]u
  1698. .misc@pop-nr tind li*tind
  1699. .misc@pop-nr mind li*mind
  1700. .misc@pop-nr pad li*pad
  1701. .misc@pop-nr type li*type
  1702. .misc@pop-nr li-spc li*li-spc
  1703. .ds li*mark \\*[li*mark-list!\\n[li*lvl]]
  1704. ..
  1705. .de LE
  1706. .if \\n[li*lvl]<1 .@error "LE:mismatched"
  1707. .li@pop
  1708. .if '\\$1'1' .SP \\n[Lsp]u
  1709. ..
  1710. .\"-------------
  1711. .\"    list status clear.
  1712. .de LC
  1713. .if !\\n[.$]=1 .@error "LC: no argument"
  1714. .if \\$1>\\n[li*lvl] .@error "LC: incorrect argument: \\$1 (too big)"
  1715. .while \\n[li*lvl]>\\$1 .li@pop
  1716. .nr par@ind-flag 0
  1717. ..
  1718. .\"-------------
  1719. .de AL
  1720. .if \\n[.$]>3 .@error "AL: too many arguments"
  1721. .if \\n[D]>2 .tm AL $*
  1722. .ie \\n[.$]<=1 .LB \\n[Li] 0 2 1 "\\$1"
  1723. .el \{\
  1724. .    ie \\n[.$]=2 .LB 0\\$2 0 2 1 "\\$1"
  1725. .    el \{\
  1726. .        ie !'\\$2'' .LB \\$2 0 2 1 "\\$1" 0 1
  1727. .        el .LB \\n[Li] 0 2 1 "\\$1" 0 1
  1728. .    \}
  1729. .\}
  1730. ..
  1731. .de ML
  1732. .if \\n[.$]>3 .@error "ML: too many arguments"
  1733. .if \\n[D]>2 .tm ML $*
  1734. .nr li*ml-width \w@\\$1@u+1n
  1735. .if \\n[.$]<2 .LB \\n[li*ml-width]u 0 1 0 "\\$1"
  1736. .if \\n[.$]=2 .LB 0\\$2 0 1 0 "\\$1"
  1737. .if \\n[.$]=3 \{\
  1738. .    ie '\\$2'' .LB \\n[li*ml-width]u 0 1 0 "\\$1" 0 1
  1739. .    el .LB \\n[Li] 0 1 0 "\\$1" 0 1
  1740. .\}
  1741. ..
  1742. .de VL
  1743. .if \\n[D]>2 .tm VL $*
  1744. .if \\n[.$]>3 .@error "VL: too many arguments"
  1745. .if \\n[.$]<1 .@error "VL: missing text-indent"
  1746. .ie \\n[.$]<3 .LB 0\\$1 0\\$2 0 0
  1747. .el .LB 0\\$1 0\\$2 0 0 \& 0 1
  1748. ..
  1749. .\"    Bullet (for .BL)
  1750. .de BL
  1751. .if \\n[D]>2 .tm BL $*
  1752. .ds BU \s-2\(bu\s0
  1753. .if \\n[.$]>2 .@error "BL: too many arguments"
  1754. .if \\n[.$]<1 .LB \\n[Pi] 0 1 0 \\*[BU]
  1755. .if \\n[.$]=1 .LB 0\\$1 0 1 0 \\*[BU]
  1756. .if \\n[.$]=2 \{\
  1757. .    ie '\\$1'' .LB \\n[Pi] 0 1 0 \\*[BU] 0 1
  1758. .    el .LB 0\\$1 0 1 0 \\*[BU] 0 1
  1759. .\}
  1760. ..
  1761. .de DL
  1762. .if \\n[D]>2 .tm DL $*
  1763. .if \\n[.$]>2 .@error "DL: too many arguments"
  1764. .if \\n[.$]<1 .LB \\n[Pi] 0 1 0 \(em
  1765. .if \\n[.$]=1 .LB 0\\$1 0 1 0 \(em
  1766. .if \\n[.$]=2 \{\
  1767. .    ie '\\$1'' .LB \\n[Pi] 0 1 0 \(em 0 1
  1768. .    el .LB 0\\$1 0 1 0 \(em 0 1
  1769. .\}
  1770. ..
  1771. .de RL
  1772. .if \\n[D]>2 .tm RL $*
  1773. .if \\n[.$]>2 .@error "RL: too many arguments"
  1774. .if \\n[.$]<1 .LB 6 0 2 4
  1775. .if \\n[.$]=1 .LB 0\\$1 0 2 4
  1776. .if \\n[.$]=2 \{\
  1777. .    ie '\\$1'' .LB 6 0 2 4 1 0 1
  1778. .    el .LB 0\\$1 0 2 4 1 0 1
  1779. .\}
  1780. ..
  1781. .\" Broken Variable List. As .VL but text begin on the next line
  1782. .de BVL
  1783. .if \\n[D]>2 .tm BVL $*
  1784. .if \\n[.$]>3 .@error "BVL: too many arguments"
  1785. .if \\n[.$]<1 .@error "BVL: missing text-indent"
  1786. .ie \\n[.$]<3 .LB 0\\$1 0\\$2 0 -1
  1787. .el .LB 0\\$1 0\\$2 0 -1 \& 0 1
  1788. ..
  1789. .\" ####### module tbl #######################################
  1790. .\" This module is copied from groff_ms and modified for mgm.
  1791. .\" Yes, it does not resemble the original anymore :-).
  1792. .\" Don't know if I missed something important.
  1793. .\" Groff_ms is written by James Clark.
  1794. .nr tbl*have-header 0
  1795. .nr tbl*header-written 0
  1796. .de TS
  1797. .br
  1798. .if ''\\n[.z]' .SP
  1799. .if '\\$1'H' .di tbl*header-div
  1800. ..
  1801. .de tbl@top-hook
  1802. .if \\n[tbl*have-header] \{\
  1803. .    ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl@print-header
  1804. .    el .sp \\n[.t]u
  1805. .\}
  1806. ..
  1807. .de tbl@bottom-hook
  1808. .if \\n[tbl*have-header] \{\
  1809. .    nr T. 1
  1810. .\" draw bottom and side lines of boxed tables.
  1811. .    T#
  1812. .\}
  1813. .nr tbl*header-written 0
  1814. ..
  1815. .de tbl@print-header
  1816. .ev tbl*ev
  1817. 'nf
  1818. .tbl*header-div
  1819. .ev
  1820. .mk #T
  1821. .nr tbl*header-written 1
  1822. ..
  1823. .de TH
  1824. .ie '\\n[.z]'tbl*header-div' \{\
  1825. .    nr T. 0
  1826. .    T#
  1827. .    br
  1828. .    di
  1829. .    nr tbl*header-ht \\n[dn]
  1830. .    ne \\n[dn]u+1v
  1831. .    nr tbl*have-header 1
  1832. .    ie '\\$1'N' .if !\\n[tbl*header-written] .tbl@print-header
  1833. .    el .tbl@print-header
  1834. .\}
  1835. .el .@error ".TH without .TS H"
  1836. ..
  1837. .de TE
  1838. .ie '\\n(.z'tbl*header-div' .@error ".TS H but no .TH before .TE"
  1839. .el \{\
  1840. .    nr tbl*have-header 0
  1841. .\}
  1842. .\" reset tabs
  1843. .TAB
  1844. ..
  1845. .de T&
  1846. ..
  1847. .\" ####### module pic #######################################
  1848. .de PS
  1849. .nr pic*in 0
  1850. .br
  1851. .SP .5
  1852. .ie \\n[.$]<2 .@error "PS: bad arguments. Probably not processed with pic."
  1853. .el \{\
  1854. .    if !\\n[ds*lvl] .ne (u;\\$1)+1v
  1855. .\" should be contained between .DS/.DE
  1856. .if r ds*format \{\
  1857. .        if \\n[ds*lvl]&((\\n[ds*format]=2):(\\n[ds*format]=3)) \{\
  1858. .            nr pic*in \\n[.i]
  1859. .\" .        in +(u;\\n[.l]-\\n[.i]-\\$2/2)
  1860. .        \}
  1861. .    \}
  1862. .\}
  1863. ..
  1864. .de PE
  1865. .init@reset
  1866. .SP .5
  1867. ..
  1868. .\" ####### module eq #######################################
  1869. .\" 
  1870. .nr eq*number 0 1
  1871. .de EQ
  1872. .ds eq*lable "\\$1
  1873. .di eq*div
  1874. .misc@ev-keep eq*ev
  1875. .in 0
  1876. .nf
  1877. ..
  1878. .de EN
  1879. .br
  1880. .di
  1881. .ta
  1882. .\" equation with lable.
  1883. .if \\n[dl] \{\
  1884. .    br
  1885. .    chop eq*div
  1886. .    ie (\\n[Eq]%2) \{\
  1887. .        \"    lable to the left
  1888. .        if \\n[ds*format]<2 \{\
  1889. .            ta (u;(\\n[.l]/7)+\\n[.i]) \\n[.l]u\" L
  1890. \\*[eq*lable]\t\\*[eq*div]\t\&
  1891. .        \}
  1892. .        if (\\n[ds*format]=2):(\\n[ds*format]=3) \{\
  1893. .            ta (u;(\\n[.l]-\\n[.i])/2+\\n[.i])C \\n[.l]u\" C
  1894. \\*[eq*lable]\t\\*[eq*div]\t\&
  1895. .        \}
  1896. .        if \\n[ds*format]>3 \{\
  1897. .            ta \\n[.l]uR\"    R
  1898. \\*[eq*lable]\t\\*[eq*div]
  1899. .        \}
  1900. .    \}
  1901. .    el \{\
  1902. .        \"    lable to the right
  1903. .        if \\n[ds*format]<2 \{\
  1904. .            ta \\n[.l]uR\" L
  1905. \\*[eq*div]\t\\*[eq*lable]
  1906. .        \}
  1907. .        if (\\n[ds*format]=2):(\\n[ds*format]=3) \{\
  1908. .            ta (u;(\\n[.l]-\\n[.i])/2+\\n[.i])C \\n[.l]uR\" C
  1909. \t\\*[eq*div]\t\\*[eq*lable]
  1910. .        \}
  1911. .        if \\n[ds*format]>3 \{\
  1912. .            ta (\\n[.l]u-\w@\\*[eq*lable]@u-1m)R \\n[.l]uR\" R
  1913. \t\\*[eq*div]\t\\*[eq*lable]
  1914. .        \}
  1915. .    \}
  1916. .\}
  1917. .TAB
  1918. .ev
  1919. ..
  1920. .\"########### module toc ###################
  1921. .\" table of contents
  1922. .nr toc*slevel 1
  1923. .nr toc*spacing \n[Lsp]u
  1924. .nr toc*tlevel 2
  1925. .nr toc*tab 0
  1926. .\"-----------
  1927. .\" Table of contents with friends (module lix)
  1928. .de TC
  1929. .br
  1930. .\" print any pending displays and references
  1931. .ds@print-float 3
  1932. .if \\n[ref*flag] .RP 0 1
  1933. .\"
  1934. .if \w@\\$1@>0 .nr toc*slevel \\$1
  1935. .if \w@\\$2@>0 .nr toc*spacing (u;\\$2*\\n[Lsp])
  1936. .if \w@\\$3@>0 .nr toc*tlevel \\$3
  1937. .if \w@\\$4@>0 .nr toc*tab \\$4
  1938. .if \\n[pg*cols-per-page]>1 .1C
  1939. .pg@clear-hd
  1940. .pg@next-page
  1941. .pg@clear-ft
  1942. .\"-------------
  1943. .if d Ci .toc@read-Ci \\*[Ci]
  1944. .nf
  1945. .in 0
  1946. .nr toc*pn 0 1
  1947. .af toc*pn i
  1948. .PF "''\\\\\\\\n+[toc*pn]''"
  1949. .nr toc*i 4 1
  1950. .while \\n+[toc*i]<10 \{\
  1951. .    if !'\\$\\n[toc*i]'' \{\
  1952. .        ce
  1953. \\$\\n[toc*i]
  1954. .        br
  1955. .    \}
  1956. .\}
  1957. .if \\n[.$]<=4 .if d TX .TX
  1958. .ie d TY .if \\n[.$]<=4 .TY
  1959. .el \{\
  1960. .    ce
  1961. \\*[Licon]
  1962. .    br
  1963. .    SP 3
  1964. .\}
  1965. .if d toc*list .toc*list
  1966. .\" print LIST OF XXX
  1967. .if d lix*dsfg .lix@print-ds fg "\\*[Lf]"
  1968. .if d lix*dstb .lix@print-ds tb "\\*[Lt]"
  1969. .if d lix*dsec .lix@print-ds ec "\\*[Le]"
  1970. .if d lix*dsex .lix@print-ds ex "\\*[Lx]"
  1971. ..
  1972. .\"-----------
  1973. .\" .toc@read-Ci lev1 lev2 lev3 lev4 ... lev7
  1974. .de toc@read-Ci
  1975. .nr toc*i 0 1
  1976. .while \\n+[toc*i]<8 \{\
  1977. .    nr toc*hl!\\n[toc*i] \\$\\n[toc*i]
  1978. .\}
  1979. ..
  1980. .\"-----------
  1981. .de toc@save
  1982. .\" collect maxsize of mark if string Ci don't exist.
  1983. .if !d Ci \{\
  1984. .    if !r toc*hl!\\$1 .nr toc*hl!\\$1 0
  1985. .    if \\n[toc*hl!\\$1]<=\w@\\$2@ \{\
  1986. .        nr toc*hl!\\$1 \w@\\$2@u+1m
  1987. .    \}
  1988. .\}
  1989. .am toc*list
  1990. .\" .toc@set level headernumber text pagenr
  1991. .toc@set \\$1 "\\$2" "\\$3" \\$4
  1992. \\..
  1993. ..
  1994. .\"-----------
  1995. .\" level mark text pagenumber
  1996. .de toc@set
  1997. .if \\$1<=\\n[toc*slevel] .SP \\n[toc*spacing]u
  1998. .ne 2v
  1999. .na
  2000. .fi
  2001. .nr toc*ind 0
  2002. .nr toc*i 0 1
  2003. .ie d Ci \{\
  2004. .    nr toc*ind +\\n[toc*hl!\\$1]u
  2005. .\}
  2006. .el \{\
  2007. .    while \\n+[toc*i]<\\$1 \{\
  2008. .        nr toc*ind +\\n[toc*hl!\\n[toc*i]]u
  2009. .    \}
  2010. .\}
  2011. .nr toc*text \\n[toc*ind]u+\\n[toc*hl!\\$1]u
  2012. .in \\n[toc*text]u
  2013. .ti -\\n[toc*hl!\\$1]u
  2014. .\"
  2015. .\" length of headernum space
  2016. .nr toc*i \\n[toc*hl!\\$1]-\w@\\$2@
  2017. .\"
  2018. .ll \\n[@ll]u-\w@\\$4@u-2m
  2019. .\" ragged right ---------------------------------
  2020. .ie \\$1>\\n[toc*tlevel] \{\
  2021. \\$2
  2022. .    sp -1
  2023. \\$3\ \ \ \\$4
  2024. .    br
  2025. .\}
  2026. .el \{\
  2027. .    \" unnumbered heading --------------------
  2028. .    ie '\\$2'' \{\
  2029. .        in \\n[toc*ind]u
  2030. \\$3\h'1m'
  2031. .    \}
  2032. .    \" normal heading ------------------------
  2033. .    el \{\
  2034. \\$2
  2035. .        sp -1
  2036. \\$3\h'1m'
  2037. .    \}
  2038. .    ll \\n[@ll]u
  2039. .    sp -1
  2040. .    nr toc*sep (u;\\n[.l]-\\n[.n]-\\n[.i]-\w@\\$4@)-1m
  2041. \h'|\\n[.n]u'\l'\\n[toc*sep]u.'\h'1m'\\$4
  2042. .\}
  2043. .ll \\n[@ll]u
  2044. ..
  2045. .\"########################### module lix ############################
  2046. .\" LIST OF figures, tables, exhibits and equations 
  2047. .nr lix*fg-nr 0 1
  2048. .nr lix*tb-nr 0 1
  2049. .nr lix*ec-nr 0 1
  2050. .nr lix*ex-nr 0 1
  2051. .aln Fg lix*fg-nr
  2052. .aln Tb lix*tb-nr
  2053. .aln Ec lix*ec-nr
  2054. .aln Ex lix*ex-nr
  2055. .\"------------
  2056. .de FG
  2057. .lix@print-line fg Lf \\n+[lix*fg-nr] "\\$1" "\\$2" "\\$3" "\\$4"
  2058. ..
  2059. .de TB
  2060. .lix@print-line tb Lt \\n+[lix*tb-nr] "\\$1" "\\$2" "\\$3" "\\$4"
  2061. ..
  2062. .de EC
  2063. .lix@print-line ec Le \\n+[lix*ec-nr] "\\$1" "\\$2" "\\$3" "\\$4"
  2064. ..
  2065. .de EX
  2066. .lix@print-line ex Lx \\n+[lix*ex-nr] "\\$1" "\\$2" "\\$3" "\\$4"
  2067. ..
  2068. .\"------------
  2069. .\" print line with 'figure' in the text
  2070. .\" type stringvar number text override flag refname
  2071. .de lix@print-line
  2072. .ds lix*text "\\$4
  2073. .\"
  2074. .ie \\n[Sectf] .ds lix*numb \\n[H1]-\\$3
  2075. .el .ds lix*numb \\$3
  2076. .\"
  2077. .ie !\\n[Of] .ds lix*ds-form .\ \ \"
  2078. .el .ds lix*ds-form "\ \(em\ \"
  2079. .nr lix*in \\n[.i]
  2080. .ds lix*lable \\*[Li\\$1]\ \\*[lix*numb]\\*[lix*ds-form]
  2081. .if !'\\$5'' \{\
  2082. .    if !0\\$6 .ds lix*lable \\*[Li\\$1]\ \\$5\\*[lix*numb]\\*[lix*ds-form]
  2083. .    if 0\\$6=1 .ds lix*lable \\*[Li\\$1]\ \\*[lix*numb]\\$5\\*[lix*ds-form]
  2084. .    if 0\\$6=2 .ds lix*lable \\*[Li\\$1]\ \\$5\\*[lix*ds-form]
  2085. .\}
  2086. .ie \\n[Sectp] .ds lix*pgnr \\*[hd*sect-pg]
  2087. .el .ds lix*pgnr \\n[%]
  2088. .\" print line if not between DS/DE
  2089. .ie \\n[ds*lvl]<1 .lix@print-text "\\*[lix*lable]" "\\*[lix*text]"
  2090. .el .lix@embedded-text "\\*[lix*lable]" "\\*[lix*text]"
  2091. .\"
  2092. .\" save line for LIST OF XXX
  2093. .if !r lix*wth\\$1 .nr lix*wth\\$1 0
  2094. .if \w@\\*[lix*lable]@>\\n[lix*wth\\$1] .nr lix*wth\\$1 \w@\\*[lix*lable]@
  2095. .if \\n[\\$2] .lix@ds-save \\$1 \\*[lix*pgnr] "\\$4" "\\*[lix*lable]"
  2096. .if !'\\$7'' .SETR \\$7 \\*[lix*numb]
  2097. ..
  2098. .\"-----------
  2099. .de lix@print-text
  2100. .SP \\n[Lsp]u
  2101. .misc@ev-keep lix
  2102. .init@reset
  2103. .br
  2104. .ie (\w@\\$1\\$2@)>(\\n[.l]-\\n[.i]) \{\
  2105. .    in +\w@\\$1@u
  2106. .    ti 0
  2107. .\}
  2108. .el .ce 1
  2109. \fB\\$1\fP\\$2
  2110. .br
  2111. .ev
  2112. ..
  2113. .\" hide printout until diversion is evaluated
  2114. .de lix@embedded-text
  2115. \!.SP \\n[Lsp]u
  2116. \!.misc@ev-keep lix
  2117. \!.init@reset
  2118. \!.br
  2119. \!.ie (\w@\\$1\\$2@)>(\\n[.l]-\\n[.i]) \{\
  2120. .    in +\w@\\$1@u
  2121. \!.    ti 0
  2122. \!.\}
  2123. \!.el .ce 1
  2124. \!\fB\\$1\fP\\$2
  2125. \!.br
  2126. \!.ev
  2127. ..
  2128. .\"------------
  2129. .\" print complete list of XXXX
  2130. .de lix@print-ds
  2131. .\" arg: fg,tb,ec,ex text
  2132. .if !\\n[Cp] .pg@next-page
  2133. .\" print LIST OF XXXX
  2134. .ce
  2135. \\$2
  2136. .SP 3
  2137. .in \\n[lix*wth\\$1]u
  2138. .fi
  2139. .lix*ds\\$1
  2140. ..
  2141. .\"------------
  2142. .\" save line of list in macro
  2143. .de lix@ds-save
  2144. .\" type pagenumber text
  2145. .am lix*ds\\$1
  2146. .lix@dsln \\$1 \\$2 "\\$3" "\\$4" \\$5
  2147. \\..
  2148. ..
  2149. .\"------------
  2150. .\" print appended macro
  2151. .\" lix@dsln type pagenumber text headernr
  2152. .de lix@dsln
  2153. .nr lix*i \\n[lix*wth\\$1]-\w@\\$4@
  2154. .ne 2v
  2155. .nr lix*sep \\n[.l]-\\n[lix*i]-\w'\\$4\\$3\\$2'-1m-1n-\\n[.i]
  2156. \h'\\n[lix*i]u'\\$4\\$3\h'1n'\l'\\n[lix*sep]u.'\h'1m'\\$2
  2157. .SP \\n[toc*spacing]u
  2158. ..
  2159. .\"########################### module fnt ############################
  2160. .\" some font macros.
  2161. .de R
  2162. .ft R
  2163. .ul 0
  2164. ..
  2165. .\"-----------
  2166. .de fnt@switch
  2167. .ul 0
  2168. .ds fnt*tmp
  2169. .nr fnt*prev \\n[.f]
  2170. .nr fnt*i 2 1
  2171. .while \\n+[fnt*i]<=\\n[.$] \{\
  2172. .    if \\n[fnt*i]>3 .as fnt*tmp \,
  2173. .    ie (\\n[fnt*i]%2)=1 .as fnt*tmp \\$1\\$[\\n[fnt*i]]
  2174. .    el .as fnt*tmp \\$2\\$[\\n[fnt*i]]
  2175. .    if \\n[fnt*i]<\\n[.$] .as fnt*tmp \/
  2176. .\}
  2177. \&\\*[fnt*tmp]\f[\\n[fnt*prev]]
  2178. ..
  2179. .\"-----------
  2180. .de B
  2181. .ie \\n[.$] .fnt@switch \fB \f[\\n[.f]] \\$@
  2182. .el .ft B
  2183. ..
  2184. .de I
  2185. .ie \\n[.$] .fnt@switch \fI \f[\\n[.f]] \\$@
  2186. .el .ft I
  2187. ..
  2188. .de IB
  2189. .if \\n[.$] .fnt@switch \fI \fB \\$@
  2190. ..
  2191. .de BI
  2192. .if \\n[.$] .fnt@switch \fB \fI \\$@
  2193. ..
  2194. .de IR
  2195. .if \\n[.$] .fnt@switch \fI \fR \\$@
  2196. ..
  2197. .de RI
  2198. .if \\n[.$] .fnt@switch \fR \fI \\$@
  2199. ..
  2200. .de RB
  2201. .if \\n[.$] .fnt@switch \fR \fB \\$@
  2202. ..
  2203. .de BR
  2204. .if \\n[.$] .fnt@switch \fB \fR \\$@
  2205. ..
  2206. .\"########################### module box ############################
  2207. .\" draw a box around some text. Text will be kept on the same page.
  2208. .\"
  2209. .nr box*ll 0
  2210. .\" .B1 and .B2 works like .DS
  2211. .de B1
  2212. .if \\n[box*ll] .@error "B1: missing B2"
  2213. .nr box*ll \\n[.l]
  2214. .nr box*ind \\n[.i]
  2215. .nr box*hyp \\n[.hy]
  2216. .nr box*wid \\n[.l]-\\n[.i]
  2217. .\"
  2218. .\" jump to new environment.
  2219. .ev box*ev
  2220. .di box*div
  2221. .ps \\n[@ps]
  2222. .vs \\n[@vs]
  2223. .in 1n
  2224. .ll (u;\\n[box*wid]-1n)
  2225. .hy \\n[.hy]
  2226. ..
  2227. .de B2
  2228. .if !\\n[box*ll] .@error "B2: missing B1"
  2229. .br
  2230. .di
  2231. .nr box*height \\n[dn]
  2232. .ne \\n[dn]u+1v
  2233. .ll \\n[box*ll]u
  2234. .in \\n[box*ind]u
  2235. .nr box*y-pos \\n[.d]u
  2236. .nf
  2237. .box*div
  2238. .fi
  2239. \v'-1v+.25m'\
  2240. \D'l \\n[box*wid]u 0'\
  2241. \D'l 0 -\\n[box*height]u'\
  2242. \D'l -\\n[box*wid]u 0'\
  2243. \D'l 0 \\n[box*height]u'
  2244. .br
  2245. .sp -1
  2246. .ev
  2247. .sp .20v
  2248. .in \\n[box*ind]u
  2249. .ll \\n[box*ll]u
  2250. .rm box*div
  2251. .nr box*ll 0
  2252. ..
  2253. .\"########################### module ref ############################
  2254. .nr ref*nr 0 1
  2255. .nr ref*nr-width 5n
  2256. .nr ref*flag 0        \" for end-of-text
  2257. .ds Rf \v'-.4m'\s-3[\\n+[ref*nr]]\s0\v'.4m'
  2258. .\"
  2259. .\" start reference
  2260. .\"------------
  2261. .de RS
  2262. .if !''\\$1' .ds \\$1 \\n[ref*nr]
  2263. .nr ref*flag 1
  2264. .am ref*mac
  2265. .ref@start-print \\n[ref*nr]
  2266. \\..
  2267. .eo
  2268. .am ref*mac RF
  2269. ..
  2270. .\"------------
  2271. .de RF
  2272. .ec
  2273. .am ref*mac
  2274. .ref@stop-print
  2275. \\..
  2276. ..
  2277. .\"------------
  2278. .de ref@start-print
  2279. .di ref*div
  2280. .in \\n[ref*nr-width]u
  2281. .ti -(\w@\\$1.@u+1n)
  2282. \\$1.
  2283. .sp -1
  2284. ..
  2285. .de ref@stop-print
  2286. .br
  2287. .di
  2288. .ne \\n[dn]u
  2289. .ev ref*ev2
  2290. .nf
  2291. .ref*div
  2292. .ev
  2293. .rm ref*div
  2294. .if \\n[Ls] .SP \\n[Lsp]u
  2295. ..
  2296. .\"-----------
  2297. .de RP
  2298. .if !d ref*mac .@error "RP: No references!"
  2299. .nr ref*i 0\\$2
  2300. .if \\n[ref*i]<2 .SK
  2301. .SP 2
  2302. .ref@print-refs
  2303. .if 0\\$1<1 .nr ref*nr 0 1
  2304. .if ((\\n[ref*i]=0):(\\n[ref*i]=2)) .SK
  2305. ..
  2306. .\"-----------
  2307. .\" called by end-of-text!
  2308. .de ref@eot-print
  2309. .\".if \\n[ref*flag] \{
  2310. .if d ref*mac \{\
  2311. .    if \\n[D]>2 .tm Print references, called by eot
  2312. .    nr ref*flag 0
  2313. .    br
  2314. .    misc@ev-keep ne
  2315. .    init@reset
  2316. \c
  2317. '    bp
  2318. .    ev
  2319. .    ref@print-refs
  2320. .\}
  2321. ..
  2322. .\"-----------
  2323. .\" prints the references
  2324. .de ref@print-refs
  2325. .toc@save 1 "" "\\*[Rp]" \\n[%]
  2326. .ce
  2327. \fI\\*[Rp]\fP
  2328. .sp
  2329. .nr ref*ll \\n[.l]
  2330. .misc@ev-keep ref*ev
  2331. .ll \\n[ref*ll]u
  2332. .in 0
  2333. .ref*mac
  2334. .in
  2335. .rm ref*mac
  2336. .ev
  2337. ..
  2338. .\"########################### module app ############################
  2339. .\" 
  2340. .nr app*nr 0 1
  2341. .af app*nr A
  2342. .nr app*dnr 0 1
  2343. .\"------------
  2344. .\" .APP name text
  2345. .\" name == "" -> autonumber
  2346. .de APP
  2347. .\" .if \\n[.$]<2 .@error "APP: too few arguments"
  2348. .app@set-ind "\\$1"
  2349. .\"
  2350. .ie \\n[Aph] .app@header \\*[app*ind] "\\$2"
  2351. .el .bp
  2352. .app@index "\\*[app*ind]" "\\$2"
  2353. ..
  2354. .\"------------
  2355. .\" .APPSK name pages text
  2356. .\" name == "" -> autonumber
  2357. .de APPSK
  2358. .if \\n[.$]<2 .@error "APPSK: too few arguments"
  2359. .app@set-ind "\\$1"
  2360. .\"
  2361. .ie \\n[Aph] .app@header \\*[app*ind] "\\$3"
  2362. .el .bp
  2363. .app@index "\\*[app*ind]" "\\$3"
  2364. .pn +\\$2
  2365. ..
  2366. .\"------------
  2367. .de app@set-ind
  2368. .ie \w@\\$1@ .ds app*ind \\$1
  2369. .el \{\
  2370. .    if !\\n[app*dnr] \{\
  2371. .        nr H1 0 1
  2372. .        af H1 A
  2373. .    \}
  2374. .    ds app*ind \\n+[app*nr]
  2375. .    nr H1 \\n+[app*dnr]
  2376. .\}
  2377. .\"    clear lower counters
  2378. .nr app*i 1 1
  2379. .while \\n+[app*i]<8 .nr H\\n[app*i] 0 1
  2380. ..
  2381. .\"------------
  2382. .de app@index
  2383. .toc@save 1 "" "\\*[App] \\$1: \\$2" \\n[%]
  2384. ..
  2385. .\"------------
  2386. .\" app@heaer name text
  2387. .de app@header
  2388. .bp
  2389. .SP (u;\\n[Lsp]*4)
  2390. .ce 1
  2391. \s+4\fB\\*[App]\ \\$1\fP\s0
  2392. .SP (u;\\n[Lsp]*2)
  2393. .if \w@\\$2@<\\n[.l] .ce 1
  2394. \fB\s+2\\$2\s0\fP
  2395. .SP (u;\\n[Lsp]*4)
  2396. ..
  2397. .\"########################### module cov ############################
  2398. .\" title stored in diversion cov*title
  2399. .\" abstract stored in diversion cov*abstract
  2400. .\"    arg to abstract stored in cov*abs-arg
  2401. .\"    indent stored in cov*abs-ind
  2402. .\" number of authors stored in cov*au
  2403. .\" author(s) stored in cov*au!x!y
  2404. .\" author(s) title stored in cov*at!x!y
  2405. .\"     x is the author-index [1-cov*au], y is the argument-index [1-9].
  2406. .\" author(s) firm stored in cov*firm
  2407. .\" new date (if .ND exists) is stored in cov*new-date
  2408. .\"
  2409. .\"
  2410. .ds cov*abs-name ABSTRACT
  2411. .\"
  2412. .nr cov*au 0
  2413. .de TL
  2414. .if \\n[.$]>0 .ds cov*title-charge-case \\$1
  2415. .if \\n[.$]>1 .ds cov*title-file-case \\$2
  2416. .pg@disable-top-trap
  2417. .eo
  2418. .de cov*title AU
  2419. ..
  2420. .\"-------------------
  2421. .de cov@title-end
  2422. .ec
  2423. ..
  2424. .\"-------------------
  2425. .\" .AU name [initials [loc [dept [ext [room [arg [arg [arg]]]]]]]]
  2426. .de AU
  2427. .cov@title-end
  2428. .pg@disable-top-trap
  2429. .if \\n[.$]<1 .@error "AU: no arguments"
  2430. .nr cov*au +1
  2431. .nr cov*i 0 1
  2432. .while \\n[.$]>=\\n+[cov*i] \{\
  2433. .    ds cov*au!\\n[cov*au]!\\n[cov*i] "\\$[\\n[cov*i]]
  2434. .\}
  2435. .if (\\n[.$]>=3)&(\w@\\$3@) \{\
  2436. .    if d cov*location-\\$3] \{\
  2437. .        ds cov*au!3!\\n[cov*au] \\*[cov*location-\\$3]
  2438. .    \}
  2439. .\}
  2440. ..
  2441. .\"-------------------
  2442. .\" .AT title1 [title2 [... [title9] ]]]]
  2443. .\" Well, thats all that COVEND look for.
  2444. .\" Must appear directly after .AU
  2445. .de AT
  2446. .if \\n[.$]<1 .@error "AT: no arguments"
  2447. .nr cov*i 0 1
  2448. .while \\n[.$]>=\\n+[cov*i] \{\
  2449. .    ds cov*at!\\n[cov*au]!\\n[cov*i] "\\$[\\n[cov*i]]
  2450. .\}
  2451. ..
  2452. .\"-------------------
  2453. .de AF
  2454. .cov@title-end
  2455. .if \\n[.$]<1 .@error "AF: no arguments"
  2456. .ds cov*firm \\$1
  2457. ..
  2458. .de AST
  2459. .ds cov*abs-name \\$1
  2460. ..
  2461. .de AS
  2462. .pg@disable-top-trap
  2463. .if d cov*abstract .@error "AS: only one abstract allowed"
  2464. .if !''\\n[.z]' .@error "AS: no diversion allowed (previous .AS?)"
  2465. .nr cov*abs-arg 0\\$1
  2466. .nr cov*abs-ind (n;0\\$2)
  2467. .de cov*abstract AE
  2468. ..
  2469. .de AE
  2470. ..
  2471. .\" I am planning to use mgm some time :-)
  2472. .ie \\n[yr]<50 .ds cov*new-date \\*[MO\\n[mo]] \\n[dy], 20\\n[yr]
  2473. .el .ds cov*new-date \\*[MO\\n[mo]] \\n[dy], 19\\n[yr]
  2474. .als DT cov*new-date
  2475. .de ND
  2476. .\" don't remember why I did this: .pg@disable-top-trap
  2477. .ds cov*new-date \\$1
  2478. ..
  2479. .\"-------------------
  2480. .\" save technical numbers.
  2481. .de TM
  2482. .nr cov*i 0 1
  2483. .while \\n[.$]>=\\n+[cov*i] .ds cov*mt-tm!\\n[cov*i] \\$[\\n[cov*i]]
  2484. .nr cov*mt-tm-max \\n[.$]
  2485. ..
  2486. .\"-----------------------
  2487. .\" cover sheet
  2488. .\" the file must have the following last lines (somewhere):
  2489. .\" .pg@enable-top-trap
  2490. .\" .bp 1
  2491. .\" .pg@enable-trap
  2492. .ds cov*mt-file!0 0.MT
  2493. .ds cov*mt-file!1 0.MT
  2494. .ds cov*mt-file!2 0.MT
  2495. .ds cov*mt-file!3 0.MT
  2496. .ds cov*mt-file!4 4.MT
  2497. .ds cov*mt-file!5 5.MT
  2498. .ds cov*mt-file!6 0.MT
  2499. .\"------------
  2500. .de MT
  2501. .ie \\n[.$] \{\
  2502. .    ie d cov*mt-file!\\$1 .ds cov*mt-type \\$1
  2503. .    el .ds cov*mt-type 6
  2504. .\}
  2505. .el .ds cov*mt-type 1
  2506. .ds cov*mt-addresse "\\$2
  2507. .ds cov*mt-type-text "\\$1
  2508. .ie d @language .ds cov*str mm/\\*[@language]_
  2509. .el .ds cov*str mm/
  2510. .mso \\*[cov*str]\\*[cov*mt-file!\\*[cov*mt-type]]
  2511. ..
  2512. .de COVER
  2513. .ie !\\n[.$] .ds cov*cov-type ms
  2514. .el .ds cov*cov-type \\$1
  2515. .pg@disable-top-trap
  2516. .ie d @language .ds cov*str mm/\\*[@language]_\\*[cov*cov-type].cov
  2517. .el .ds cov*str mm/\\*[cov*cov-type].cov
  2518. .mso \\*[cov*str]
  2519. ..
  2520. .\"########################### module qrf ############################
  2521. .\" forward and backward reference thru special files.
  2522. .\"
  2523. .\" init reference system
  2524. .de INITR
  2525. .if \\n[.$]<1 .@error "INITR:filename missing"
  2526. .\" ignore if INITR has already been used
  2527. .if !r qrf*pass \{\
  2528. .\"
  2529. .    ds qrf*file \\$1
  2530. .    sy test -f \\*[qrf*file].tmp
  2531. .    ie \\n[systat] \{\
  2532. .        \" PASS 1
  2533. .        if \\n[D]=1 .tm PASS 1
  2534. .        if \\n[D]>1 .tm INITR: file \\*[qrf*file].tmp, PASS 1
  2535. .        nr qrf*pass 1
  2536. .        open qrf*stream \\*[qrf*file].tmp
  2537. .        write qrf*stream .\\\\" references for \\*[qrf*file]
  2538. .        close qrf*stream
  2539. .    \}
  2540. .    el \{\
  2541. .        nr qrf*pass 2
  2542. .        if \\n[D]=1 .tm PASS 2
  2543. .        if \\n[D]>1 .tm INITR: file \\*[qrf*file].tmp, PASS 2
  2544. .        sy mv  \\*[qrf*file].tmp  \\*[qrf*file].qrf
  2545. '        so  \\*[qrf*file].qrf
  2546. .    \}
  2547. .\}
  2548. ..
  2549. .\"---------------
  2550. .\" set a reference.
  2551. .de SETR
  2552. .if \\n[.$]<1 .@error "SETR:reference name missing"
  2553. .ie !r qrf*pass .tm "SETR: No .INITR in this file"
  2554. .el \{\
  2555. .    ds qrf*name qrf*ref-\\$1
  2556. .\" probably pass two if already defined
  2557. .    if \\n[qrf*pass]<2 \{\
  2558. .        if \\n[D]>2 .tm SETR: ref \\*[qrf*name]=\\*[hd*toc-mark],\\n[%]
  2559. .        \" heading-number
  2560. .        ds \\*[qrf*name]-hn \\*[hd*toc-mark]
  2561. .        \" page-number
  2562. .        ds \\*[qrf*name]-pn \\n[%]
  2563. .        \"
  2564. .        \" append to file
  2565. .        opena qrf*stream \\*[qrf*file].tmp
  2566. .        write qrf*stream .ds \\*[qrf*name]-hn \\*[hd*toc-mark]
  2567. .        write qrf*stream .ds \\*[qrf*name]-pn \\n[%]
  2568. .        if !'\\$2'' .write qrf*stream .ds \\*[qrf*name]-xx \\$2
  2569. .        close qrf*stream
  2570. .    \}
  2571. .\}
  2572. ..
  2573. .\"---------------
  2574. .\" get misc-string, output <->42<-> in pass 1
  2575. .\" If two arg -> set var. arg to misc-string.
  2576. .de GETST
  2577. .if \\n[.$]<1 .@error "GETST:reference name missing"
  2578. .if !r qrf*pass .tm "GETST: No .INITR in this file"
  2579. .ds qrf*name qrf*ref-\\$1
  2580. .ie \\n[qrf*pass]=2 \{\
  2581. .    ie !d \\*[qrf*name]-xx .tm "GETHN:\\$1 not defined"
  2582. .    el \{\
  2583. .        ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-xx]
  2584. .        el \\*[\\*[qrf*name]-xx]\c
  2585. .    \}
  2586. .\}
  2587. .\" The answer...
  2588. .el <->42<->\c
  2589. ..
  2590. .\"---------------
  2591. .\" get header-number, output X.X.X. in pass 1
  2592. .\" If two arg -> set var. arg to header-number.
  2593. .de GETHN
  2594. .if \\n[.$]<1 .@error "GETHN:reference name missing"
  2595. .if !r qrf*pass .tm "GETHN: No .INITR in this file"
  2596. .ds qrf*name qrf*ref-\\$1
  2597. .ie \\n[qrf*pass]=2 \{\
  2598. .    ie !d \\*[qrf*name]-hn .tm "GETHN:\\$1 not defined"
  2599. .    el \{\
  2600. .        ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-hn]
  2601. .        el \\*[\\*[qrf*name]-hn]\c
  2602. .    \}
  2603. .\}
  2604. .el X.X.X.\c
  2605. ..
  2606. .\"---------------
  2607. .\" get page-number, output 9999 in pass 1
  2608. .\" If two arg -> set var. arg to page-number.
  2609. .de GETPN
  2610. .if \\n[.$]<1 .@error "GETPN:reference name missing"
  2611. .if !r qrf*pass .tm "GETPN: No .INITR in this file"
  2612. .ds qrf*name qrf*ref-\\$1
  2613. .ie \\n[qrf*pass]=2 \{\
  2614. .    ie !d \\*[qrf*name]-pn .tm "GETPN:\\$1 not defined"
  2615. .    el \{\
  2616. .        ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-pn]
  2617. .        el \\*[\\*[qrf*name]-pn]\c
  2618. .    \}
  2619. .\}
  2620. .el 9999\c
  2621. ..
  2622. .\"----------
  2623. .de GETR
  2624. .if \\n[.$]<1 .@error "GETR:reference name missing"
  2625. .ie !r qrf*pass \{\
  2626. .    tm "GETR: No .INITR in this file"
  2627. .\}
  2628. .el \{\
  2629. .    if \\n[qrf*pass]=2 \{\
  2630. .        GETHN \\$1 Qrfh
  2631. .        GETPN \\$1 Qrfp
  2632. \\*[Qrf]
  2633. .    \}
  2634. .\}
  2635. ..
  2636.