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

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

Large files are truncated click here to view the full file

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