home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / TEKST / GROFFEXE / LIB / GROFF / TMAC / M < prev    next >
Text File  |  1993-04-05  |  58KB  |  2,583 lines

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