home *** CD-ROM | disk | FTP | other *** search
/ Aminet 10 / aminetcdnumber101996.iso / Aminet / util / gnu / groff_src.lha / groff-1.10src / mm / tmac.m < prev    next >
Text File  |  1995-06-22  |  67KB  |  3,087 lines

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