tmac.usenix 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848
  1. .ig
  2. Copyright (C) 1990, 1991 Free Software Foundation, Inc.
  3. Written by James Clark (jjc@jclark.uucp)
  4. This file is part of groff.
  5. groff is free software; you can redistribute it and/or modify it under
  6. the terms of the GNU General Public License as published by the Free
  7. Software Foundation; either version 1, or (at your option) any later
  8. version.
  9. groff is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. for more details.
  13. You should have received a copy of the GNU General Public License along
  14. with groff; see the file LICENSE. If not, write to the Free Software
  15. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ..
  17. .if !\n(.g .ab These ms macros require groff.
  18. .if \n(.C \
  19. . ab The groff ms macros do not work in compatibility mode.
  20. .\" Enable warnings. You can delete this if you want.
  21. .warn
  22. .\" See if already loaded.
  23. .if r GS .nx /dev/null
  24. .nr GS 1
  25. .de @error
  26. .tm \\n(.F:\\n(.c: macro error: \\$*
  27. ..
  28. .de @warning
  29. .tm \\n(.F:\\n(.c: macro warning: \\$*
  30. ..
  31. .de @fatal
  32. .ab \\n(.F:\\n(.c: fatal macro error: \\$*
  33. ..
  34. .de @not-implemented
  35. .@error sorry, \\$0 not implemented
  36. .als \\$0 @nop
  37. ..
  38. .als TM @not-implemented
  39. .als CT @not-implemented
  40. .de @nop
  41. ..
  42. .de @init
  43. .\" a non-empty environment
  44. .ev ne
  45. \c
  46. .ev
  47. .ev nf
  48. 'nf
  49. .ev
  50. ..
  51. .ds REFERENCES References
  52. .ds ABSTRACT ABSTRACT
  53. .ds TOC Table of Contents
  54. .ds MONTH1 January
  55. .ds MONTH2 February
  56. .ds MONTH3 March
  57. .ds MONTH4 April
  58. .ds MONTH5 May
  59. .ds MONTH6 June
  60. .ds MONTH7 July
  61. .ds MONTH8 August
  62. .ds MONTH9 September
  63. .ds MONTH10 October
  64. .ds MONTH11 November
  65. .ds MONTH12 December
  66. .ds MO \\*[MONTH\n[mo]]
  67. .nr *year \n[yr]+1900
  68. .ds DY \n[dy] \*[MO] \n[*year]
  69. .de ND
  70. .if \\n[.$] .ds DY "\\$*
  71. ..
  72. .de DA
  73. .if \\n[.$] .ds DY "\\$*
  74. .ds CF \\*[DY]
  75. ..
  76. .\" indexing
  77. .de IX
  78. .tm \\$1\t\\$2\t\\$3\t\\$4 ... \\n[PN]
  79. ..
  80. .\" print an error message and then try to recover
  81. .de @error-recover
  82. .@error \\$@ (recovering)
  83. .nr *pop-count 0
  84. .while !'\\n(.z'' \{\
  85. . \"@warning automatically terminating diversion \\n(.z
  86. . ie d @div-end!\\n(.z .@div-end!\\n(.z
  87. . el .*div-end-default
  88. . nr *pop-count +1
  89. . \" ensure that we don't loop forever
  90. . if \\n[*pop-count]>20 .@fatal recovery failed
  91. .\}
  92. .while !'\\n[.ev]'0' .ev
  93. .par@reset-env
  94. .par@reset
  95. ..
  96. .de *div-end-default
  97. .ds *last-div \\n(.z
  98. .br
  99. .di
  100. .ev nf
  101. .\\*[*last-div]
  102. .ev
  103. ..
  104. .\" ****************************
  105. .\" ******** module cov ********
  106. .\" ****************************
  107. .\" Cover sheet and first page.
  108. .de cov*err-not-after-first-page
  109. .@error \\$0 is not allowed after the first page has started
  110. ..
  111. .de cov*err-not-before-tl
  112. .@error \\$0 is not allowed before TL
  113. ..
  114. .de cov*err-not-again
  115. .@error \\$0 is not allowed more than once
  116. ..
  117. .de cov*err-not-after-ab
  118. .@error \\$0 is not allowed after first AB, LP, PP, IP, SH or NH
  119. ..
  120. .als AU cov*err-not-before-tl
  121. .als AI cov*err-not-before-tl
  122. .als AB cov*err-not-before-tl
  123. .de cov*first-page-init
  124. .rm cov*first-page-init
  125. .par@init
  126. .als RP cov*err-not-after-first-page
  127. .@init
  128. .ie \\n[cov*rp-format] \{\
  129. . pg@cs-top
  130. . als FS cov*FS
  131. . als FE cov*FE
  132. .\}
  133. .el \{\
  134. . pg@top
  135. . als FS @FS
  136. . als FE @FE
  137. .\}
  138. .wh 0 pg@top
  139. ..
  140. .wh 0 cov*first-page-init
  141. .\" This handles the case where FS occurs before TL or LP.
  142. .de FS
  143. .br
  144. \\*[FS]\\
  145. ..
  146. .nr cov*rp-format 0
  147. .nr cov*rp-no 0
  148. .\" released paper format
  149. .de RP
  150. .nr cov*rp-format 1
  151. .if \\n[.$] .if '\\$1'no' .nr cov*rp-no 1
  152. .pn 0
  153. ..
  154. .de TL
  155. .br
  156. .als TL cov*err-not-again
  157. .rn @AB AB
  158. .rn @AU AU
  159. .rn @AI AI
  160. .di cov*tl-div
  161. .par@reset
  162. .ft 3
  163. .ie \\n[VARPS] \{\
  164. . ps 14
  165. . vs 16
  166. .\}
  167. .el \{\
  168. . ps +2
  169. . vs +3p
  170. .\}
  171. .ll (u;\\n[LL]*5/6)
  172. .nr cov*n-au 0
  173. ..
  174. .de @AU
  175. .par@reset
  176. .if !'\\n(.z'' \{\
  177. . br
  178. . di
  179. .\}
  180. .nr cov*n-au +1
  181. .di cov*au-div!\\n[cov*n-au]
  182. .nf
  183. .ft 2
  184. .ps \\n[PS]
  185. ..
  186. .de @AI
  187. .par@reset
  188. .if !'\\n(.z'' \{\
  189. . br
  190. . di
  191. .\}
  192. .ie !\\n[cov*n-au] .@error AI before AU
  193. .el \{\
  194. . di cov*ai-div!\\n[cov*n-au]
  195. . nf
  196. . ft 1
  197. . ps \\n[PS]
  198. .\}
  199. ..
  200. .de LP
  201. .if !'\\n[.z]'' \{\
  202. . br
  203. . di
  204. .\}
  205. .br
  206. .cov*ab-init
  207. .cov*print
  208. \\*[\\$0]\\
  209. ..
  210. .als IP LP
  211. .als PP LP
  212. .als XP LP
  213. .als NH LP
  214. .als SH LP
  215. .als MC LP
  216. .als RT LP
  217. .de cov*ab-init
  218. .als cov*ab-init @nop
  219. .als LP @LP
  220. .als IP @IP
  221. .als PP @PP
  222. .als XP @XP
  223. .als RT @RT
  224. .als SH @SH
  225. .als NH @NH
  226. .als QP @QP
  227. .als RS @RS
  228. .als RE @RE
  229. .als QS @QS
  230. .als QE @QE
  231. .als MC @MC
  232. .als EQ @EQ
  233. .als EN @EN
  234. .als AB cov*err-not-after-ab
  235. .als AU par@AU
  236. .als AI par@AI
  237. .als TL par@TL
  238. ..
  239. .de @AB
  240. .if !'\\n(.z'' \{\
  241. . br
  242. . di
  243. .\}
  244. .cov*ab-init
  245. .di cov*ab-div
  246. .par@ab-indent
  247. .par@reset
  248. .if !'\\$1'no' \{\
  249. . ft 2
  250. . ce 1
  251. \\*[ABSTRACT]
  252. . sp
  253. . ft 1
  254. .\}
  255. .ns
  256. .@PP
  257. ..
  258. .de AE
  259. .ie '\\n(.z'cov*ab-div' \{\
  260. . als AE cov*err-not-again
  261. . br
  262. . di
  263. .\" nr cov*ab-height \\n[dn]
  264. . par@reset-env
  265. . par@reset
  266. . cov*print
  267. .\}
  268. .el .@error AE without AB
  269. ..
  270. .de @div-end!cov*ab-div
  271. .AE
  272. ..
  273. .de cov*print
  274. .als cov*print @nop
  275. .ie d cov*tl-div \{\
  276. . ie \\n[cov*rp-format] .cov*rp-print
  277. . el .cov*draft-print
  278. .\}
  279. .el \{\
  280. . if \\n[cov*rp-format] \{\
  281. . @warning RP format but no TL
  282. . bp 1
  283. . als FS @FS
  284. . als FE @FE
  285. . \}
  286. . br
  287. .\}
  288. ..
  289. .de cov*rp-print
  290. .nr cov*page-length \\n[.p]
  291. .pl 1000i
  292. .cov*tl-au-print
  293. .sp 3
  294. .if d cov*ab-div \{\
  295. . nf
  296. . cov*ab-div
  297. .\}
  298. .sp 3
  299. .par@reset
  300. \\*[DY]
  301. .br
  302. .if \\n[cov*fn-height] \{\
  303. . sp |(u;\\n[cov*page-length]-\\n[FM]\
  304. -\\n[cov*fn-height]-\\n[fn@sep-dist]>?\\n[nl])
  305. . fn@print-sep
  306. . ev nf
  307. . cov*fn-div
  308. . ev
  309. . ie \\n[cov*rp-no] .rm cov*fn-div
  310. . el \{\
  311. . rn cov*fn-div fn@overflow-div
  312. . nr fn@have-overflow 1
  313. . \}
  314. .\}
  315. .als FS @FS
  316. .als FE @FE
  317. .\" If anything was printed below where the footer line is normally printed,
  318. .\" then that's an overflow.
  319. .if -\\n[FM]/2+1v+\\n[cov*page-length]<\\n[nl] .@error cover sheet overflow
  320. .pl \\n[cov*page-length]u
  321. .bp 1
  322. .if !\\n[cov*rp-no] .cov*tl-au-print
  323. .rs
  324. .sp 1
  325. ..
  326. .de cov*draft-print
  327. .cov*tl-au-print
  328. .if d cov*ab-div \{\
  329. . nf
  330. . sp 2
  331. . cov*ab-div
  332. .\}
  333. .sp 1
  334. ..
  335. .de cov*tl-au-print
  336. .par@reset
  337. .nf
  338. .rs
  339. .sp 3
  340. .ce 9999
  341. .cov*tl-div
  342. .nr cov*i 1
  343. .nr cov*sp 1v
  344. .while \\n[cov*i]<=\\n[cov*n-au] \{\
  345. . sp \\n[cov*sp]u
  346. . cov*au-div!\\n[cov*i]
  347. . ie d cov*ai-div!\\n[cov*i] \{\
  348. . sp .5v
  349. . cov*ai-div!\\n[cov*i]
  350. . nr cov*sp 1v
  351. . \}
  352. . el .nr cov*sp .5v
  353. . nr cov*i +1
  354. .\}
  355. .ce 0
  356. ..
  357. .nr cov*fn-height 0
  358. .nr cov*in-fn 0
  359. .\" start of footnote on cover
  360. .de cov*FS
  361. .if \\n[cov*in-fn] \{\
  362. . @error nested FS
  363. . FE
  364. .\}
  365. .nr cov*in-fn 1
  366. .ev fn
  367. .par@reset-env
  368. .da cov*fn-div
  369. .if !\\n[cov*fn-height] .ns
  370. .ie \\n[.$] .FP "\\$1" no
  371. .el .@LP
  372. ..
  373. .de @div-end!cov*fn-div
  374. .cov*FE
  375. ..
  376. .\" end of footnote on cover
  377. .de cov*FE
  378. .ie '\\n(.z'cov*fn-div' \{\
  379. . br
  380. . ev
  381. . di
  382. . nr cov*in-fn 0
  383. . nr cov*fn-height +\\n[dn]
  384. .\}
  385. .el .@error FE without matching FS
  386. ..
  387. .\" ***************************
  388. .\" ******** module pg ********
  389. .\" ***************************
  390. .\" Page-level formatting.
  391. .\" > 0 if we have a footnote on the current page
  392. .nr pg@fn-flag 0
  393. .nr pg@colw 0
  394. .nr pg@fn-colw 0
  395. .nr HM 1i
  396. .nr FM 1i
  397. .nr PO 1.25i
  398. .ds LF
  399. .ds CF
  400. .ds RF
  401. .ds LH
  402. .ds CH -\\n[PN]-
  403. .ds RH
  404. .ds pg*OH '\\*[LH]'\\*[CH]'\\*[RH]'
  405. .ds pg*EH '\\*[LH]'\\*[CH]'\\*[RH]'
  406. .ds pg*OF '\\*[LF]'\\*[CF]'\\*[RF]'
  407. .ds pg*EF '\\*[LF]'\\*[CF]'\\*[RF]'
  408. .de OH
  409. .ds pg*\\$0 "\\$*
  410. ..
  411. .als EH OH
  412. .als OF OH
  413. .als EF OH
  414. .de PT
  415. .ie \\n%=1 .if \\n[pg*P1] .tl \\*[pg*OH]
  416. .el \{\
  417. . ie o .tl \\*[pg*OH]
  418. . el .tl \\*[pg*EH]
  419. .\}
  420. ..
  421. .de BT
  422. .ie o .tl \\*[pg*OF]
  423. .el .tl \\*[pg*EF]
  424. ..
  425. .nr pg*P1 0
  426. .de P1
  427. .nr pg*P1 1
  428. ..
  429. .wh -\n[FM]u pg@bottom
  430. .wh -\n[FM]u/2u pg*footer
  431. .nr MINGW 2n
  432. .nr pg@ncols 1
  433. .de @MC
  434. .if !'\\n(.z'' .error-recover MC while diversion open
  435. .br
  436. .ie \\n[pg@ncols]>1 .pg@super-eject
  437. .el \{\
  438. . \" flush out any floating keeps
  439. . while \\n[kp@tail]>\\n[kp@head] \{\
  440. . rs
  441. . bp
  442. . \}
  443. .\}
  444. .ie !\\n(.$ \{\
  445. . nr pg@colw \\n[LL]*7/15
  446. . nr pg*gutw \\n[LL]-(2*\\n[pg@colw])
  447. . nr pg@ncols 2
  448. .\}
  449. .el \{\
  450. . nr pg@colw (n;\\$1)<?\\n[LL]
  451. . ie \\n[.$]<2 .nr pg*gutw \\n[MINGW]
  452. . el .nr pg*gutw (n;\\$2)
  453. . nr pg@ncols \\n[LL]-\\n[pg@colw]/(\\n[pg@colw]+\\n[pg*gutw])+1
  454. . ie \\n[pg@ncols]>1 \
  455. . nr pg*gutw \\n[LL]-(\\n[pg@ncols]*\\n[pg@colw])/(\\n[pg@ncols]-1)
  456. . el .nr pg*gutw 0
  457. .\}
  458. .mk pg*col-top
  459. .ns
  460. .nr pg*col-num 0
  461. .nr pg@fn-colw \\n[pg@colw]*5/6
  462. .par@reset
  463. ..
  464. .de 2C
  465. .MC
  466. ..
  467. .de 1C
  468. .MC \\n[LL]u
  469. ..
  470. .\" top of page macro
  471. .de pg@top
  472. .ch pg*footer -\\n[FM]u/2u
  473. .nr PN \\n%
  474. .nr pg*col-num 0
  475. .nr pg@fn-bottom-margin 0
  476. .nr pg*saved-po \\n[PO]
  477. .po \\n[PO]u
  478. .ev h
  479. .par@reset
  480. .sp (u;\\n[HM]/2)
  481. .PT
  482. .sp |\\n[HM]u
  483. .if d HD .HD
  484. .mk pg@header-bottom
  485. .ev
  486. .mk pg*col-top
  487. .pg*start-col
  488. ..
  489. .de pg*start-col
  490. .\" Handle footnote overflow before floating keeps, because the keep
  491. .\" might contain an embedded footnote.
  492. .fn@top-hook
  493. .kp@top-hook
  494. .tbl@top-hook
  495. .ns
  496. ..
  497. .de pg@cs-top
  498. .sp \\n[HM]u
  499. .\" move pg@bottom and pg*footer out of the way
  500. .ch pg@bottom \\n[.p]u*2u
  501. .ch pg*footer \\n[.p]u*2u
  502. .ns
  503. ..
  504. .de pg@bottom
  505. .tbl@bottom-hook
  506. .if \\n[pg@fn-flag] .fn@bottom-hook
  507. .nr pg*col-num +1
  508. .ie \\n[pg*col-num]<\\n[pg@ncols] .pg*end-col
  509. .el .pg*end-page
  510. ..
  511. .de pg*end-col
  512. 'sp |\\n[pg*col-top]u
  513. .po (u;\\n[pg*saved-po]+(\\n[pg@colw]+\\n[pg*gutw]*\\n[pg*col-num]))
  514. .\"po +(u;\\n[pg@colw]+\\n[pg*gutw])
  515. .pg*start-col
  516. ..
  517. .de pg*end-page
  518. .po \\n[pg*saved-po]u
  519. .\" Make sure we don't exit if there are still floats or footnotes left-over.
  520. .ie \\n[kp@head]<\\n[kp@tail]:\\n[fn@have-overflow] \{\
  521. . \" Switching environments ensures that we don't get an unnecessary
  522. . \" blank line at the top of the page.
  523. . ev ne
  524. ' bp
  525. . ev
  526. .\}
  527. .el \{\
  528. . if r pg*next-number \{\
  529. . pn \\n[pg*next-number]
  530. . rr pg*next-number
  531. . if d pg*next-format \{\
  532. . af PN \\*[pg*next-format]
  533. . rm pg*next-format
  534. . \}
  535. . \}
  536. ' bp
  537. .\}
  538. ..
  539. .\" pg@begin number format
  540. .de pg@begin
  541. .ie \\n[.$]>0 \{\
  542. . nr pg*next-number (;\\$1)
  543. . ie \\n[.$]>1 .ds pg*next-format \\$2
  544. . el .rm pg*next-format
  545. .\}
  546. .el .rr pg*next-number
  547. .pg@super-eject
  548. ..
  549. .\" print the footer line
  550. .de pg*footer
  551. .ev h
  552. .par@reset
  553. .BT
  554. .ev
  555. ..
  556. .\" flush out any keeps or footnotes
  557. .de pg@super-eject
  558. .br
  559. .if !'\\n(.z'' .@error-recover diversion open while ejecting page
  560. .\" Make sure we stay in the end macro while there is still footnote overflow
  561. .\" left, or floating keeps.
  562. .while \\n[kp@tail]>\\n[kp@head]:\\n[pg@fn-flag] \{\
  563. . rs
  564. . bp
  565. .\}
  566. .bp
  567. ..
  568. .em pg@super-eject
  569. .\" ***************************
  570. .\" ******** module fn ********
  571. .\" ***************************
  572. .\" Footnotes.
  573. .nr fn@sep-dist 8p
  574. .ev fn
  575. .\" Round it vertically
  576. .vs \n[fn@sep-dist]u
  577. .nr fn@sep-dist \n[.v]
  578. .ev
  579. .nr fn*text-num 0 1
  580. .nr fn*note-num 0 1
  581. .ds * \\*[par@sup-start]\En+[fn*text-num]\\*[par@sup-end]
  582. .nr fn*open 0
  583. .\" normal FS
  584. .de @FS
  585. .ie \\n[.$] .fn*do-FS "\\$1" no
  586. .el \{\
  587. . ie \\n[fn*text-num]>\\n[fn*note-num] .fn*do-FS \\n+[fn*note-num]
  588. . el .fn*do-FS
  589. .\}
  590. ..
  591. .\" Second argument of `no' means don't embellish the first argument.
  592. .de fn*do-FS
  593. .if \\n[fn*open] .@error-recover nested FS
  594. .nr fn*open 1
  595. .if \\n[.u] \{\
  596. . \" Ensure that the first line of the footnote is on the same page
  597. . \" as the reference. I think this is minimal.
  598. . ev fn
  599. . nr fn*need 1v
  600. . ev
  601. . ie \\n[pg@fn-flag] .nr fn*need +\\n[fn:PD]
  602. . el .nr fn*need +\\n[fn@sep-dist]
  603. . ne \\n[fn*need]u+\\n[.V]u>?0
  604. .\}
  605. .ev fn
  606. .par@reset-env
  607. .fn*start-div
  608. .par@reset
  609. .ie \\n[.$] .FP \\$@
  610. .el .@LP
  611. ..
  612. .de @FE
  613. .ie !\\n[fn*open] .@error FE without FS
  614. .el \{\
  615. . nr fn*open 0
  616. . br
  617. . ev
  618. . fn*end-div
  619. .\}
  620. ..
  621. .nr fn@have-overflow 0
  622. .\" called at the top of each column
  623. .de fn@top-hook
  624. .nr fn*max-width 0
  625. .nr fn*page-bottom-pos 0-\\n[FM]-\\n[pg@fn-bottom-margin]
  626. .ch pg@bottom \\n[fn*page-bottom-pos]u
  627. .if \\n[fn@have-overflow] \{\
  628. . nr fn@have-overflow 0
  629. . fn*start-div
  630. . ev nf
  631. . fn@overflow-div
  632. . ev
  633. . fn*end-div
  634. .\}
  635. ..
  636. .\" This is called at the bottom of the column if pg@fn-flag is set.
  637. .de fn@bottom-hook
  638. .nr pg@fn-flag 0
  639. .nr fn@have-overflow 0
  640. .nr fn@bottom-pos \\n[.p]-\\n[FM]-\\n[pg@fn-bottom-margin]+\\n[.v]
  641. .ev fn
  642. .nr fn@bottom-pos -\\n[.v]
  643. .ev
  644. .ie \\n[nl]+\\n[fn@sep-dist]+\n[.V]>\\n[fn@bottom-pos] \{\
  645. . rn fn@div fn@overflow-div
  646. . nr fn@have-overflow 1
  647. .\}
  648. .el \{\
  649. . if \\n[pg@ncols]>1 \
  650. . if \\n[fn*max-width]>\\n[pg@fn-colw] \
  651. . nr pg@fn-bottom-margin \\n[.p]-\\n[FM]-\\n[nl]+1v
  652. . wh \\n[fn@bottom-pos]u fn*catch-overflow
  653. . fn@print-sep
  654. . ev nf
  655. . fn@div
  656. . rm fn@div
  657. . ev
  658. . if '\\n(.z'fn@overflow-div' \{\
  659. . di
  660. . nr fn@have-overflow \\n[dn]>0
  661. . \}
  662. . ch fn*catch-overflow
  663. .\}
  664. ..
  665. .de fn*catch-overflow
  666. .di fn@overflow-div
  667. ..
  668. .nr fn*embed-count 0
  669. .de @div-end!fn@div
  670. .br
  671. .if '\\n[.ev]'fn' .ev
  672. .fn*end-div
  673. .nr fn*open 0
  674. ..
  675. .als @div-end!fn*embed-div @div-end!fn@div
  676. .de fn*start-div
  677. .ie '\\n(.z'' \{\
  678. . da fn@div
  679. . if !\\n[pg@fn-flag] .ns
  680. .\}
  681. .el .di fn*embed-div
  682. ..
  683. .de fn*end-div
  684. .ie '\\n(.z'fn@div' \{\
  685. . di
  686. . nr fn*page-bottom-pos -\\n[dn]
  687. . nr fn*max-width \\n[fn*max-width]>?\\n[dl]
  688. . if !\\n[pg@fn-flag] .nr fn*page-bottom-pos -\\n[fn@sep-dist]
  689. . nr pg@fn-flag 1
  690. . nr fn*page-bottom-pos \\n[nl]-\\n[.p]+\n[.V]>?\\n[fn*page-bottom-pos]
  691. . ch pg@bottom \\n[fn*page-bottom-pos]u
  692. .\}
  693. .el \{\
  694. . ie '\\n(.z'fn*embed-div' \{\
  695. . di
  696. . rn fn*embed-div fn*embed-div!\\n[fn*embed-count]
  697. \!. fn*embed-start \\n[fn*embed-count]
  698. . rs
  699. ' sp (u;\\n[dn]+\\n[fn@sep-dist]+\\n[.V])
  700. \!. fn*embed-end
  701. . nr fn*embed-count +1
  702. . \}
  703. . el \{\
  704. . ev fn
  705. . @error-recover unclosed diversion within footnote
  706. . \}
  707. .\}
  708. ..
  709. .de fn*embed-start
  710. .ie '\\n(.z'' \{\
  711. . fn*start-div
  712. . ev nf
  713. . fn*embed-div!\\$1
  714. . rm fn*embed-div!\\$1
  715. . ev
  716. . fn*end-div
  717. . di fn*null
  718. .\}
  719. .el \{\
  720. \!. fn*embed-start \\$1
  721. . rs
  722. .\}
  723. ..
  724. .de fn*embed-end
  725. .ie '\\n(.z'fn*null' \{\
  726. . di
  727. . rm fn*null
  728. .\}
  729. .el \!.fn*embed-end
  730. ..
  731. .\" It's important that fn@print-sep use up exactly fn@sep-dist vertical space.
  732. .de fn@print-sep
  733. .ev fn
  734. .in 0
  735. .vs \\n[fn@sep-dist]u
  736. \D'l 1i 0'
  737. .br
  738. .ev
  739. ..
  740. .\" ***************************
  741. .\" ******** module kp ********
  742. .\" ***************************
  743. .\" Keeps.
  744. .de KS
  745. .br
  746. .di kp*div
  747. ..
  748. .de KF
  749. .if !'\\n(.z'' .@error-recover KF while open diversion
  750. .di kp*fdiv
  751. .ev k
  752. .par@reset-env
  753. .par@reset
  754. ..
  755. .de KE
  756. .ie '\\n(.z'kp*div' .kp*end
  757. .el \{\
  758. . ie '\\n(.z'kp*fdiv' .kp*fend
  759. . el .@error KE without KS or KF
  760. .\}
  761. ..
  762. .de @div-end!kp*div
  763. .kp*end
  764. ..
  765. .de @div-end!kp*fdiv
  766. .kp*fend
  767. ..
  768. .de kp*need
  769. .ie '\\n(.z'' .ds@need \\$1
  770. .el \!.kp*need \\$1
  771. ..
  772. .\" end non-floating keep
  773. .de kp*end
  774. .br
  775. .di
  776. .kp*need \\n[dn]
  777. .ev nf
  778. .kp*div
  779. .ev
  780. .rm kp*div
  781. ..
  782. .\" Floating keeps.
  783. .nr kp@head 0
  784. .nr kp@tail 0
  785. .\" end floating keep
  786. .de kp*fend
  787. .br
  788. .ev
  789. .di
  790. .ie \\n[.t]-(\\n[.k]>0*1v)>\\n[dn] \{\
  791. . br
  792. . ev nf
  793. . kp*fdiv
  794. . rm kp*fdiv
  795. . ev
  796. .\}
  797. .el \{\
  798. . rn kp*fdiv kp*div!\\n[kp@tail]
  799. . nr kp*ht!\\n[kp@tail] 0\\n[dn]
  800. . nr kp@tail +1
  801. .\}
  802. ..
  803. .\" top of page processing for KF
  804. .nr kp*doing-top 0
  805. .de kp@top-hook
  806. .if !\\n[kp*doing-top] \{\
  807. . nr kp*doing-top 1
  808. . kp*do-top
  809. . nr kp*doing-top 0
  810. .\}
  811. ..
  812. .de kp*do-top
  813. .\" If the first keep won't fit, only force it out if we haven't had a footnote
  814. .\" and we're at the top of the page.
  815. .nr kp*force \\n[pg@fn-flag]=0&(\\n[nl]<=\\n[pg@header-bottom])
  816. .nr kp*fits 1
  817. .while \\n[kp@tail]>\\n[kp@head]&\\n[kp*fits] \{\
  818. . ie \\n[.t]>\\n[kp*ht!\\n[kp@head]]:\\n[kp*force] \{\
  819. . nr kp*force 0
  820. . \" It's important to advance kp@head before bringing
  821. . \" back the keep, so that if the last line of the
  822. . \" last keep springs the bottom of page trap, a new
  823. . \" page will not be started unnecessarily.
  824. . rn kp*div!\\n[kp@head] kp*temp
  825. . nr kp@head +1
  826. . ev nf
  827. . kp*temp
  828. . ev
  829. . rm kp*temp
  830. . \}
  831. . el .nr kp*fits 0
  832. .\}
  833. ..
  834. .\" ***************************
  835. .\" ******** module ds ********
  836. .\" ***************************
  837. .\" Displays and non-floating keeps.
  838. .de DE
  839. .ds*end!\\n[\\n[.ev]:ds-type]
  840. .nr \\n[.ev]:ds-type 0
  841. ..
  842. .de ds@auto-end
  843. .if \\n[\\n[.ev]:ds-type] \{\
  844. . @error automatically terminating display
  845. . DE
  846. .\}
  847. ..
  848. .de @div-end!ds*div
  849. .ie \\n[\\n[.ev]:ds-type] .DE
  850. .el .ds*end!2
  851. ..
  852. .de ds*end!0
  853. .@error DE without DS, ID, CD, LD or BD
  854. ..
  855. .de LD
  856. .br
  857. .nr \\n[.ev]:ds-type 1
  858. .par@reset
  859. .nf
  860. .sp \\n[DD]u
  861. ..
  862. .de ID
  863. .LD
  864. .ie \\n[.$] .in +(n;\\$1)
  865. .el .in +\\n[DI]u
  866. ..
  867. .de CD
  868. .LD
  869. .ce 9999
  870. ..
  871. .de RD
  872. .LD
  873. .rj 9999
  874. ..
  875. .de ds*common-end
  876. .par@reset
  877. .sp \\n[DD]u
  878. ..
  879. .als ds*end!1 ds*common-end
  880. .de BD
  881. .LD
  882. .nr \\n[.ev]:ds-type 2
  883. .di ds*div
  884. ..
  885. .de ds*end!2
  886. .br
  887. .ie '\\n(.z'ds*div' \{\
  888. . di
  889. . nf
  890. . in (u;\\n[.l]-\\n[dl]/2)
  891. . ds*div
  892. . rm ds*div
  893. . ds*common-end
  894. .\}
  895. .el .@error-recover mismatched DE
  896. ..
  897. .de DS
  898. .br
  899. .di ds*div
  900. .ie '\\$1'B' \{\
  901. . LD
  902. . nr \\n[.ev]:ds-type 4
  903. .\}
  904. .el \{\
  905. . ie '\\$1'L' .LD
  906. . el \{\
  907. . ie '\\$1'C' .CD
  908. . el \{\
  909. . ie '\\$1'R' .RD
  910. . el \{\
  911. . ie '\\$1'I' .ID \\$2
  912. . el .ID \\$1
  913. . \}
  914. . \}
  915. . \}
  916. . nr \\n[.ev]:ds-type 3
  917. .\}
  918. ..
  919. .de ds@need
  920. .if '\\n(.z'' \{\
  921. . while \\n[.t]<=(\\$1)&(\\n[nl]>\\n[pg@header-bottom]) \{\
  922. . rs
  923. ' sp \\n[.t]u
  924. . \}
  925. .\}
  926. ..
  927. .de ds*end!3
  928. .br
  929. .ie '\\n(.z'ds*div' \{\
  930. . di
  931. . ds@need \\n[dn]
  932. . ev nf
  933. . ds*div
  934. . ev
  935. . rm ds*div
  936. . ds*common-end
  937. .\}
  938. .el .@error-recover mismatched DE
  939. ..
  940. .de ds*end!4
  941. .ie '\\n(.z'ds*div' \{\
  942. . br
  943. . di
  944. . nf
  945. . in (u;\\n[.l]-\\n[dl]/2)
  946. . ds@need \\n[dn]
  947. . ds*div
  948. . rm ds*div
  949. . ds*common-end
  950. .\}
  951. .el .@error-recover mismatched DE
  952. ..
  953. .\" ****************************
  954. .\" ******** module par ********
  955. .\" ****************************
  956. .\" Paragraph-level formatting.
  957. .nr VARPS 0
  958. .nr PS 10
  959. .nr LL 6i
  960. .de par*vs
  961. .\" If it's too big to be in points, treat it as units.
  962. .ie (p;\\$1)>=40p .vs (u;\\$1)
  963. .el .vs (p;\\$1)
  964. ..
  965. .de par@ab-indent
  966. .nr 0:li (u;\\n[LL]/12)
  967. .nr 0:ri \\n[0:li]
  968. ..
  969. .de par*env-init
  970. .aln \\n[.ev]:PS PS
  971. .aln \\n[.ev]:VS VS
  972. .aln \\n[.ev]:LL LL
  973. .aln \\n[.ev]:MCLL LL
  974. .aln \\n[.ev]:LT LT
  975. .aln \\n[.ev]:MCLT LT
  976. .aln \\n[.ev]:PI PI
  977. .aln \\n[.ev]:PD PD
  978. .par@reset-env
  979. ..
  980. .\" happens when the first page begins
  981. .de par@init
  982. .if !rLT .nr LT \\n[LL]
  983. .if !rFL .nr FL \\n[LL]*5/6
  984. .if !rVS .nr VS \\n[PS]+2
  985. .ps \\n[PS]
  986. .if !rDI .nr DI .5i
  987. .if !rQI .nr QI 5n
  988. .if !rPI .nr PI 5n
  989. .par*vs \\n[VS]
  990. .if !rPD .nr PD .3v
  991. .if !rDD .nr DD .5v
  992. .if !dFAM .ds FAM \\n[.fam]
  993. .nr par*adj \\n[.j]
  994. .par*env-init
  995. .ev h
  996. .par*env-init
  997. .ev
  998. .ev fn
  999. .par*env-init
  1000. .ev
  1001. .ev k
  1002. .par*env-init
  1003. .ev
  1004. .aln 0:MCLL pg@colw
  1005. .aln 0:MCLT pg@colw
  1006. .aln k:MCLL pg@colw
  1007. .aln k:MCLT pg@colw
  1008. .if !rFPS .nr FPS \\n[PS]-2
  1009. .if !rFVS .nr FVS (p;\\n[FPS]+2)
  1010. .if !rFI .nr FI 2n
  1011. .if !rFPD .nr FPD \\n[PD]/2
  1012. .aln fn:PS FPS
  1013. .aln fn:VS FVS
  1014. .aln fn:LL FL
  1015. .aln fn:LT FL
  1016. .aln fn:PI FI
  1017. .aln fn:PD FPD
  1018. .aln fn:MCLL pg@fn-colw
  1019. .aln fn:MCLT pg@fn-colw
  1020. ..
  1021. .de par@reset-env
  1022. .nr \\n[.ev]:il 0
  1023. .nr \\n[.ev]:li 0
  1024. .nr \\n[.ev]:ri 0
  1025. .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
  1026. .nr \\n[.ev]:pli 0
  1027. .nr \\n[.ev]:pri 0
  1028. .nr \\n[.ev]:ds-type 0
  1029. ..
  1030. .\" par@reset
  1031. .de par@reset
  1032. .br
  1033. .ce 0
  1034. .rj 0
  1035. .ul 0
  1036. .fi
  1037. .ad \\n[par*adj]
  1038. .ie \\n[pg@ncols]>1 \{\
  1039. . ll (u;\\n[\\n[.ev]:MCLL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
  1040. . lt \\n[\\n[.ev]:MCLT]u
  1041. .\}
  1042. .el \{\
  1043. . ll (u;\\n[\\n[.ev]:LL]-\\n[\\n[.ev]:ri]-\\n[\\n[.ev]:pri])
  1044. . lt \\n[\\n[.ev]:LT]u
  1045. .\}
  1046. .in (u;\\n[\\n[.ev]:li]+\\n[\\n[.ev]:pli])
  1047. .ft 1
  1048. .fam \\*[FAM]
  1049. .ps \\n[\\n[.ev]:PS]
  1050. .par*vs \\n[\\n[.ev]:VS]
  1051. .ls 1
  1052. .TA
  1053. .hy 14
  1054. ..
  1055. .als @RT par@reset
  1056. .\" This can be redefined by the user.
  1057. .de TA
  1058. .ta T 5n
  1059. ..
  1060. .de par*start
  1061. .ds@auto-end
  1062. .nr \\n[.ev]:pli \\$1
  1063. .nr \\n[.ev]:pri \\$2
  1064. .par@reset
  1065. .sp \\n[\\n[.ev]:PD]u
  1066. .ne 1v+\\n(.Vu
  1067. ..
  1068. .de par@finish
  1069. .nr \\n[.ev]:pli 0
  1070. .nr \\n[.ev]:pri 0
  1071. .par@reset
  1072. ..
  1073. .\" normal LP
  1074. .de @LP
  1075. .par*start 0 0
  1076. .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
  1077. ..
  1078. .de @PP
  1079. .par*start 0 0
  1080. .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
  1081. .ti +\\n[\\n[.ev]:ai]u
  1082. ..
  1083. .de @QP
  1084. .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
  1085. .par*start \\n[QI] \\n[QI]
  1086. ..
  1087. .de @XP
  1088. .par*start \\n[\\n[.ev]:PI] 0
  1089. .ti -\\n[\\n[.ev]:PI]u
  1090. ..
  1091. .de @IP
  1092. .if \\n[.$]>1 .nr \\n[.ev]:ai (n;\\$2)
  1093. .par*start \\n[\\n[.ev]:ai] 0
  1094. .if !'\\$1'' \{\
  1095. . \" Divert the label so as to freeze any spaces.
  1096. . di par*label
  1097. . in 0
  1098. . nf
  1099. \&\\$1
  1100. . di
  1101. . in
  1102. . fi
  1103. . chop par*label
  1104. . ti -\\n[\\n[.ev]:ai]u
  1105. . ie \\n[dl]+1n<=\\n[\\n[.ev]:ai] \\*[par*label]\h'|\\n[\\n[.ev]:ai]u'\c
  1106. . el \{\
  1107. \\*[par*label]
  1108. . br
  1109. . \}
  1110. . rm par*label
  1111. .\}
  1112. ..
  1113. .de @RS
  1114. .br
  1115. .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
  1116. .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
  1117. .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
  1118. .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
  1119. .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
  1120. .nr \\n[.ev]:il +1
  1121. .nr \\n[.ev]:li +\\n[\\n[.ev]:ai]
  1122. .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
  1123. .par@reset
  1124. ..
  1125. .de @RE
  1126. .br
  1127. .ie \\n[\\n[.ev]:il] \{\
  1128. . nr \\n[.ev]:il -1
  1129. . nr \\n[.ev]:ai \\n[\\n[.ev]:ai!\\n[\\n[.ev]:il]]
  1130. . nr \\n[.ev]:li \\n[\\n[.ev]:li!\\n[\\n[.ev]:il]]
  1131. . nr \\n[.ev]:ri \\n[\\n[.ev]:ri!\\n[\\n[.ev]:il]]
  1132. . nr \\n[.ev]:pli \\n[\\n[.ev]:pli!\\n[\\n[.ev]:il]]
  1133. . nr \\n[.ev]:pri \\n[\\n[.ev]:pri!\\n[\\n[.ev]:il]]
  1134. .\}
  1135. .el .@error unbalanced \\$0
  1136. .par@reset
  1137. ..
  1138. .\" ---------------------------------------------------------------------------
  1139. .de LINE
  1140. . br
  1141. . ps 32
  1142. \l'\\n[.l]u-\\n[\\n[.ev]:ri]u-\\n[\\n[.ev]:pri]u'
  1143. . ps
  1144. ..
  1145. .\" ---------------------------------------------------------------------------
  1146. .de QSTART
  1147. . nr SaveQI \\n[QI]
  1148. . if \\n[.$] .nr QI \\$1
  1149. . QS
  1150. . LINE
  1151. . ft 3
  1152. ..
  1153. .\" ---------------------------------------------------------------------------
  1154. .de QEND
  1155. . ft P
  1156. . sp -.5
  1157. . LINE
  1158. . QE
  1159. . nr QI \\n[SaveQI]
  1160. . if \\n[.$] .sp \\$1
  1161. ..
  1162. .de @QS
  1163. .br
  1164. .nr \\n[.ev]:li!\\n[\\n[.ev]:il] \\n[\\n[.ev]:li]
  1165. .nr \\n[.ev]:ri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ri]
  1166. .nr \\n[.ev]:ai!\\n[\\n[.ev]:il] \\n[\\n[.ev]:ai]
  1167. .nr \\n[.ev]:pli!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pli]
  1168. .nr \\n[.ev]:pri!\\n[\\n[.ev]:il] \\n[\\n[.ev]:pri]
  1169. .nr \\n[.ev]:il +1
  1170. .nr \\n[.ev]:li +\\n[QI]
  1171. .nr \\n[.ev]:ri +\\n[QI]
  1172. .nr \\n[.ev]:ai \\n[\\n[.ev]:PI]
  1173. .par@reset
  1174. ..
  1175. .als @QE @RE
  1176. .\" start boxed text
  1177. .de B1
  1178. .br
  1179. .di par*box-div
  1180. .nr \\n[.ev]:li +1n
  1181. .nr \\n[.ev]:ri +1n
  1182. .par@reset
  1183. ..
  1184. .de @div-end!par*box-div
  1185. .B2
  1186. ..
  1187. .\" end boxed text
  1188. .\" Postpone the drawing of the box until we're in the top-level diversion,
  1189. .\" in case there's a footnote inside the box.
  1190. .de B2
  1191. .ie '\\n(.z'par*box-div' \{\
  1192. . br
  1193. . di
  1194. . ds@need \\n[dn]
  1195. . par*box-mark-top
  1196. . ev nf
  1197. . par*box-div
  1198. . ev
  1199. . nr \\n[.ev]:ri -1n
  1200. . nr \\n[.ev]:li -1n
  1201. . par@finish
  1202. . par*box-draw \\n[.i]u \\n[.l]u
  1203. .\}
  1204. .el .@error B2 without B1
  1205. ..
  1206. .de par*box-mark-top
  1207. .ie '\\n[.z]'' .mk par*box-top
  1208. .el \!.par*box-mark-top
  1209. ..
  1210. .de par*box-draw
  1211. .ie '\\n[.z]'' \{\
  1212. . nr par*box-in \\n[.i]
  1213. . nr par*box-ll \\n[.l]
  1214. . nr par*box-vpt \\n[.vpt]
  1215. . vpt 0
  1216. . in \\$1
  1217. . ll \\$2
  1218. \v'-1v+.25m'\
  1219. \D'l (u;\\n[.l]-\\n[.i]) 0'\
  1220. \D'l 0 |\\n[par*box-top]u'\
  1221. \D'l -(u;\\n[.l]-\\n[.i]) 0'\
  1222. \D'l 0 -|\\n[par*box-top]u'
  1223. . br
  1224. . sp -1
  1225. . in \\n[par*box-in]u
  1226. . ll \\n[par*box-ll]u
  1227. . vpt \\n[par*box-vpt]
  1228. .\}
  1229. .el \!.par*box-draw \\$1 \\$2
  1230. ..
  1231. .de @SH
  1232. .par@finish
  1233. .\" Keep together the heading and the first two lines of the next paragraph.
  1234. .\" XXX - fix for variable PS.
  1235. .ne 3v+\\n[\\n[.ev]:PD]u+\\n(.Vu
  1236. .sp 1
  1237. .ft 3
  1238. .if \\n[VARPS] .ps \\n[PS]+2
  1239. ..
  1240. .\" TL, AU, and AI are aliased to these in cov*ab-init.
  1241. .de par@TL
  1242. .par@finish
  1243. .sp 1
  1244. .ft 3
  1245. .ps +2
  1246. .vs +3p
  1247. .ce 9999
  1248. ..
  1249. .de par@AU
  1250. .par@finish
  1251. .sp 1
  1252. .ft I
  1253. .ce 9999
  1254. ..
  1255. .de par@AI
  1256. .par@finish
  1257. .sp .5
  1258. .ce 9999
  1259. ..
  1260. .\" In paragraph macros.
  1261. .de NL
  1262. .ps \\n[\\n[.ev]:PS]
  1263. ..
  1264. .de SM
  1265. .ps -2
  1266. ..
  1267. .de LG
  1268. .ps +2
  1269. ..
  1270. .de R
  1271. .ft R
  1272. ..
  1273. .de par*set-font
  1274. .ie \\n[.$] \{\
  1275. . nr par*prev-font \\n[.f]
  1276. \&\\$3\f[\\*[par*font-name!\\$0]]\\$1\f[\\n[par*prev-font]]\\$2
  1277. .\}
  1278. .el .ft \\*[par*font-name!\\$0]
  1279. ..
  1280. .ds par*font-name!B 3
  1281. .ds par*font-name!I 2
  1282. .ds par*font-name!BI BI
  1283. .ds par*font-name!CW CR
  1284. .als B par*set-font
  1285. .als I par*set-font
  1286. .als BI par*set-font
  1287. .als CW par*set-font
  1288. .\" underline a word
  1289. .de UL
  1290. \Z'\\$1'\v'.25m'\D'l \w'\\$1'u 0'\v'-.25m'\\$2
  1291. ..
  1292. .\" box a word
  1293. .de BX
  1294. .nr par*bxw \w'\\$1'+.4m
  1295. \Z'\v'.25m'\D'l 0 -1m'\D'l \\n[par*bxw]u 0'\D'l 0 1m'\D'l -\\n[par*bxw]u 0''\
  1296. \Z'\h'.2m'\\$1'\
  1297. \h'\\n[par*bxw]u'
  1298. ..
  1299. .\" The first time UX is used, put a registered mark after it.
  1300. .ds par*ux-rg \(rg
  1301. .de UX
  1302. \s[\\n[.s]*8u/10u]UNIX\s0\\$1\\*[par*ux-rg]
  1303. .ds par*ux-rg
  1304. ..
  1305. .ds par@sup-start \v'-.9m\s'\En[.s]*7u/10u'+.7m'
  1306. .als { par@sup-start
  1307. .ds par@sup-end \v'-.7m\s0+.9m'
  1308. .als } par@sup-end
  1309. .\" footnote paragraphs
  1310. .\" FF is the footnote format
  1311. .nr FF 0
  1312. .\" This can be redefined. It gets a second argument of `no' if the first
  1313. .\" argument was supplied by the user, rather than automatically.
  1314. .de FP
  1315. .br
  1316. .if !d par*fp!\\n[FF] \{\
  1317. . @error unknown footnote format `\\n[FF]'
  1318. . nr FF 0
  1319. .\}
  1320. .ie '\\$2'no' .par*fp!\\n[FF]-no "\\$1"
  1321. .el .par*fp!\\n[FF] "\\$1"
  1322. ..
  1323. .de par*fp!0
  1324. .@PP
  1325. \&\\*[par@sup-start]\\$1\\*[par@sup-end]\ \c
  1326. ..
  1327. .de par*fp!0-no
  1328. .@PP
  1329. \&\\$1\ \c
  1330. ..
  1331. .de par*fp!1
  1332. .@PP
  1333. \&\\$1.\ \c
  1334. ..
  1335. .de par*fp!1-no
  1336. .@PP
  1337. \&\\$1\ \c
  1338. ..
  1339. .de par*fp!2
  1340. .@LP
  1341. \&\\$1.\ \c
  1342. ..
  1343. .de par*fp!2-no
  1344. .@LP
  1345. \&\\$1\ \c
  1346. ..
  1347. .de par*fp!3
  1348. .@IP "\\$1." (u;\\n[\\n[.ev]:PI]*2)
  1349. ..
  1350. .de par*fp!3-no
  1351. .@IP "\\$1" (u;\\n[\\n[.ev]:PI]*2)
  1352. ..
  1353. .\" ***************************
  1354. .\" ******** module nh ********
  1355. .\" ***************************
  1356. .\" Numbered headings.
  1357. .\" nh*hl is the level of the last heading
  1358. .nr nh*hl 0
  1359. .\" numbered heading
  1360. .de @NH
  1361. .ie '\\$1'S' \{\
  1362. . shift
  1363. . nr nh*hl 0
  1364. . while \\n[.$] \{\
  1365. . nr nh*hl +1
  1366. . nr H\\n[nh*hl] 0\\$1
  1367. . shift
  1368. . \}
  1369. . if !\\n[nh*hl] \{\
  1370. . nr H1 1
  1371. . nr nh*hl 1
  1372. . @error missing arguments to .NH S
  1373. . \}
  1374. .\}
  1375. .el \{\
  1376. . nr nh*ohl \\n[nh*hl]
  1377. . ie \\n[.$] \{\
  1378. . nr nh*hl 0\\$1
  1379. . ie \\n[nh*hl]<=0 \{\
  1380. . nr nh*ohl 0
  1381. . nr nh*hl 1
  1382. . \}
  1383. . el \{\
  1384. . if \\n[nh*hl]-\\n[nh*ohl]>1 \
  1385. . @warning .NH \\n[nh*ohl] followed by .NH \\n[nh*hl]
  1386. . \}
  1387. . \}
  1388. . el .nr nh*hl 1
  1389. . while \\n[nh*hl]>\\n[nh*ohl] \{\
  1390. . nr nh*ohl +1
  1391. . nr H\\n[nh*ohl] 0
  1392. . \}
  1393. . nr H\\n[nh*hl] +1
  1394. .\}
  1395. .ds SN
  1396. .nr nh*i 0
  1397. .while \\n[nh*i]<\\n[nh*hl] \{\
  1398. . nr nh*i +1
  1399. . as SN \\n[H\\n[nh*i]].
  1400. .\}
  1401. .SH
  1402. .if \\n[VARPS] \{\
  1403. . ps \\n[PS]+2
  1404. . ne 3
  1405. .\}
  1406. \\*[SN]
  1407. ..
  1408. .de VARPS
  1409. .nr VARPS 1
  1410. ..
  1411. .\" ****************************
  1412. .\" ******** module toc ********
  1413. .\" ****************************
  1414. .\" Table of contents generation.
  1415. .de XS
  1416. .da toc*div
  1417. .ev h
  1418. .par@reset
  1419. .fi
  1420. .ie \\n[.$] .XA "\\$1"
  1421. .el .XA
  1422. ..
  1423. .de @div-end!toc*div
  1424. .XE
  1425. ..
  1426. .de XA
  1427. .ie '\\n(.z'toc*div' \{\
  1428. . if d toc*num .toc*end-entry
  1429. . ie \\n[.$] \{\
  1430. . ie '\\$1'no' .ds toc*num
  1431. . el .ds toc*num "\\$1
  1432. . \}
  1433. . el .ds toc*num \\n[PN]
  1434. . in (n;0\\$2)
  1435. .\}
  1436. .el .@error XA without XS
  1437. ..
  1438. .de XE
  1439. .ie '\\n(.z'toc*div' \{\
  1440. . if d toc*num .toc*end-entry
  1441. . ev
  1442. . di
  1443. .\}
  1444. .el .@error XS without XE
  1445. ..
  1446. .de toc*end-entry
  1447. \\a\\t\\*[toc*num]
  1448. .br
  1449. .rm toc*num
  1450. ..
  1451. .de PX
  1452. .1C
  1453. .if !'\\$1'no' \{\
  1454. . ce 1
  1455. . ps \\n[PS]+2
  1456. . ft 3
  1457. \\*[TOC]
  1458. . ft
  1459. . ps
  1460. .\}
  1461. .nf
  1462. .char \[toc*leader-char] .\h'1m'
  1463. .lc \[toc*leader-char]
  1464. .ta (u;\\n[.l]-\\n[.i]-\w'000') (u;\\n[.l]-\\n[.i])R
  1465. .sp 2
  1466. .toc*div
  1467. .par@reset
  1468. ..
  1469. .\" print the table of contents on page i
  1470. .de TC
  1471. .P1
  1472. .pg@begin 1 i
  1473. .PX \\$1
  1474. ..
  1475. .\" ****************************
  1476. .\" ******** module eqn ********
  1477. .\" ****************************
  1478. .\" Eqn support.
  1479. .de EQ
  1480. ..
  1481. .de EN
  1482. ..
  1483. .de @EQ
  1484. .br
  1485. .ds eqn*num "\\$2
  1486. .ie '\\$1'L' .nr eqn*type 0
  1487. .el \{\
  1488. . ie '\\$1'I' .nr eqn*type 1
  1489. . el \{\
  1490. . nr eqn*type 2
  1491. . if !'\\$1'C' .ds eqn*num "\\$1
  1492. . \}
  1493. .\}
  1494. .di eqn*div
  1495. .in 0
  1496. .nf
  1497. ..
  1498. .de @div-end!eqn*div
  1499. .@EN
  1500. ..
  1501. .\" Note that geqn mark and lineup work correctly in centered equations.
  1502. .de @EN
  1503. .ie !'\\n(.z'eqn*div' .@error-recover mismatched EN
  1504. .el \{\
  1505. . br
  1506. . di
  1507. . nr eqn*have-num 0
  1508. . if !'\\*[eqn*num]'' .nr eqn*have-num 1
  1509. . if \\n[dl]:\\n[eqn*have-num] \{\
  1510. . sp \\n[DD]u
  1511. . par@reset
  1512. . ds eqn*tabs \\n[.tabs]
  1513. . nf
  1514. . ie \\n[dl] \{\
  1515. . ds@need \\n[dn]u-1v+\n[.V]u
  1516. . chop eqn*div
  1517. . ie \\n[eqn*type]=0 \{\
  1518. . ta (u;\\n[.l]-\\n[.i])R
  1519. \\*[eqn*div]\t\\*[eqn*num]
  1520. . \}
  1521. . el \{\
  1522. . ie \\n[eqn*type]=1 .ta \\n[DI]u \
  1523. (u;\\n[.l]-\\n[.i])R
  1524. . el .ta (u;\\n[.l]-\\n[.i]/2)C \
  1525. (u;\\n[.l]-\\n[.i])R
  1526. \t\\*[eqn*div]\t\\*[eqn*num]
  1527. . \}
  1528. . \}
  1529. . el \{\
  1530. . ta (u;\\n[.l]-\\n[.i])R
  1531. \t\\*[eqn*num]
  1532. . \}
  1533. . sp \\n[DD]u
  1534. . fi
  1535. . ta \\*[eqn*tabs]
  1536. . \}
  1537. .\}
  1538. ..
  1539. .\" ****************************
  1540. .\" ******** module tbl ********
  1541. .\" ****************************
  1542. .\" Tbl support.
  1543. .nr tbl*have-header 0
  1544. .de TS
  1545. .\" The break is necessary in the case where the first page has not yet begun.
  1546. .br
  1547. .sp \\n[DD]u
  1548. .if '\\$1'H' .di tbl*header-div
  1549. ..
  1550. .de tbl@top-hook
  1551. .if \\n[tbl*have-header] \{\
  1552. . ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl*print-header
  1553. . el .sp \\n[.t]u
  1554. .\}
  1555. ..
  1556. .de tbl*print-header
  1557. .ev nf
  1558. .tbl*header-div
  1559. .ev
  1560. .mk #T
  1561. ..
  1562. .de TH
  1563. .ie '\\n[.z]'tbl*header-div' \{\
  1564. . nr T. 0
  1565. . T#
  1566. . br
  1567. . di
  1568. . ie \\n[dn]+\\n[FM]+\\n[HM]+2v>=\\n[.p] \{\
  1569. . @error ridiculously long table header
  1570. . ds@need \\n[dn]
  1571. . tbl*print-header
  1572. . \}
  1573. . el \{\
  1574. . nr tbl*header-ht \\n[dn]
  1575. . ds@need \\n[dn]u+1v
  1576. . tbl*print-header
  1577. . nr tbl*have-header 1
  1578. . \}
  1579. .\}
  1580. .el .@error-recover .TH without .TS H
  1581. ..
  1582. .de @div-end!tbl*header-div
  1583. .TH
  1584. .TE
  1585. ..
  1586. .de TE
  1587. .ie '\\n(.z'tbl*header-div' .@error-recover .TS H but no .TH before .TE
  1588. .el \{\
  1589. . nr tbl*have-header 0
  1590. . sp \\n[DD]u
  1591. .\}
  1592. .\" reset tabs
  1593. .TA
  1594. ..
  1595. .de tbl@bottom-hook
  1596. .if \\n[tbl*have-header] \{\
  1597. . nr T. 1
  1598. . T#
  1599. .\}
  1600. ..
  1601. .de T&
  1602. ..
  1603. .\" ****************************
  1604. .\" ******** module pic ********
  1605. .\" ****************************
  1606. .\" Pic support.
  1607. .\" PS height width
  1608. .de PS
  1609. .br
  1610. .sp \\n[DD]u
  1611. .ie \\n[.$]<2 .@error bad arguments to PS (not preprocessed with pic?)
  1612. .el \{\
  1613. . ds@need (u;\\$1)+1v
  1614. . in +(u;\\n[.l]-\\n[.i]-\\$2/2>?0)
  1615. .\}
  1616. ..
  1617. .de PE
  1618. .par@reset
  1619. .sp \\n[DD]u+.5m
  1620. ..
  1621. .\" ****************************
  1622. .\" ******** module ref ********
  1623. .\" ****************************
  1624. .\" Refer support.
  1625. .de ]-
  1626. .rm [A [B [C [D [E [G [I [J [N [O [P [Q [R [S [T [V
  1627. .rm ref*string
  1628. ..
  1629. .\" Other
  1630. .ds ref*spec!0 Q A T S V N P I C D O
  1631. .\" Journal article
  1632. .ds ref*spec!1 Q A T J S V N P I C D O
  1633. .\" Book
  1634. .ds ref*spec!2 Q A T S V P I C D O
  1635. .\" Article within book
  1636. .ds ref*spec!3 Q A T B E S V P I C D O
  1637. .\" Tech report
  1638. .ds ref*spec!4 Q A T R G P I C D O
  1639. .\" ][ type
  1640. .de ][
  1641. .ie d ref*spec!\\$1 .ref*build \\*[ref*spec!\\$1]
  1642. .el \{\
  1643. . @error unknown reference type `\\$1'
  1644. . ref*build \\*[ref*spec!0]
  1645. .\}
  1646. .ref*print
  1647. .rm ref*string
  1648. .rm [F
  1649. ..
  1650. .\" start of reference number
  1651. .ds [. \\*[par@sup-start]
  1652. .\" end of reference number
  1653. .ds .] \\*[par@sup-end]
  1654. .\" period before reference
  1655. .ds <. .
  1656. .\" period after reference
  1657. .ds >. \" empty
  1658. .\" comma before reference
  1659. .ds <, ,
  1660. .\" comma after reference
  1661. .ds >, \" empty
  1662. .\" start collected references
  1663. .de ]<
  1664. .als ref*print ref*end-print
  1665. .SH
  1666. \&\\*[REFERENCES]
  1667. .par@reset
  1668. ..
  1669. .\" end collected references
  1670. .de ]>
  1671. .par@finish
  1672. .als ref*print ref*normal-print
  1673. ..
  1674. .de ref*normal-print
  1675. .ie d [F .FS "\\*([.\\*([F\\*(.]"
  1676. .el .FS \&
  1677. \\*[ref*string]
  1678. .FE
  1679. ..
  1680. .de ref*end-print
  1681. .ie d [F .IP "\\*([F."
  1682. .el .XP
  1683. \\*[ref*string]
  1684. ..
  1685. .als ref*print ref*normal-print
  1686. .de ref*build
  1687. .rm ref*string ref*post-punct
  1688. .nr ref*suppress-period 1
  1689. .while \\n[.$] \{\
  1690. . if d [\\$1 \{\
  1691. . ie d ref*add-\\$1 .ref*add-\\$1
  1692. . el .ref*add-dflt \\$1
  1693. . \}
  1694. . shift
  1695. .\}
  1696. .\" now add a final period
  1697. .ie d ref*string \{\
  1698. . if !\\n[ref*suppress-period] .as ref*string .
  1699. . if d ref*post-punct \{\
  1700. . as ref*string "\\*[ref*post-punct]
  1701. . rm ref*post-punct
  1702. . \}
  1703. .\}
  1704. .el .ds ref*string
  1705. ..
  1706. .de ref*add-T
  1707. .ref*field T , "\\*Q" "" "\\*U"
  1708. .if r [T .nr ref*suppress-period \\n([T
  1709. ..
  1710. .de ref*add-P
  1711. .ie \\n([P>0 .ref*field P , "pp. "
  1712. .el .ref*field P , "p. "
  1713. ..
  1714. .de ref*add-J
  1715. .ref*field J , \f2 "" \fP
  1716. ..
  1717. .de ref*add-D
  1718. .ref*field D "" ( )
  1719. ..
  1720. .de ref*add-E
  1721. .ref*field E , "ed. "
  1722. ..
  1723. .de ref*add-G
  1724. .ref*field G "" ( )
  1725. ..
  1726. .de ref*add-B
  1727. .ref*field B "" "in \f2" "" \fP
  1728. ..
  1729. .de ref*add-O
  1730. .ref*field O .
  1731. .ie r [O .nr ref*suppress-period \\n([O
  1732. .el .nr ref*suppress-period 1
  1733. ..
  1734. .de ref*add-A
  1735. .ref*field A ,
  1736. .if r [A .nr ref*suppress-period \\n([A
  1737. ..
  1738. .de ref*add-dflt
  1739. .ref*field \\$1 ,
  1740. ..
  1741. .\" First argument is the field letter.
  1742. .\" Second argument is the punctuation character to use to separate this field
  1743. .\" from the previous field.
  1744. .\" Third argument is a string with which to prefix this field.
  1745. .\" Fourth argument is a string with which to postfix this field.
  1746. .\" Fifth argument is a string to add after the punctuation character supplied
  1747. .\" by the next field.
  1748. .de ref*field
  1749. .if d ref*string \{\
  1750. . ie d ref*post-punct \{\
  1751. . as ref*string "\\$2\\*[ref*post-punct] \"
  1752. . rm ref*post-punct
  1753. . \}
  1754. . el .as ref*string "\\$2 \"
  1755. .\}
  1756. .as ref*string "\\$3\\*([\\$1\\$4
  1757. .if \\n[.$]>4 .ds ref*post-punct "\\$5
  1758. .nr ref*suppress-period 0
  1759. ..
  1760. .\" ****************************
  1761. .\" ******** module acc ********
  1762. .\" ****************************
  1763. .\" Accents and special characters.
  1764. .ds Q \)``\)
  1765. .ds U \)''\)
  1766. .ds - \(em
  1767. .\" Characters
  1768. .if !c\(rg .char \(rg (R)
  1769. .if !c\(ah .char \(ah \v'-.55m'\s[\En[.s]/2u]v\s0\v'.55m'
  1770. .if !c\(ad .char \(ad \v'-.55m'\s[\En[.s]*7u/10u].\h'.05m'.\s0\v'.55m'
  1771. .if !c\(a- .char \(a- \v'-.55m'\D'l .25m 0'\v'.55m'
  1772. .if !c\(ao .char \(ao \v'-.55m'\s[\En[.s]*6u/10u]\D'c .25m'\s0\v'.55m'
  1773. .if !c\(ac .char \(ac \s[\En[.s]*8u/10u]\v'.05m',\v'-.05m'\s0
  1774. .if !c\(ho .char \(ho \s[\En[.s]/2u]\v'.4m'c\v'-.4m'\s0
  1775. .if !c\(-D .char \(-D \Z'\v'-.1m'-'D
  1776. .if !c\(Sd .char \(Sd \Z'\v'-.3m'\h'.2m'-'\(pd
  1777. .if !c\(TP .char \(TP I\h'-.25m'\v'-.33m'\s[\En[.s]*6u/10u]\v'.33m'D\
  1778. \v'-.33m'\s0\v'.33m'
  1779. .if !c\(Tp .char \(Tp \zlp
  1780. .if !c\(ss .char \(ss \(*b
  1781. .if !c\(AE .char \(AE A\h'-.3m'E
  1782. .if !c\(ae .char \(ae a\h'-.19m'e
  1783. .if !c\(OE .char \(OE O\h'-.25m'E
  1784. .if !c\(oe .char \(oe o\h'-.14m'e
  1785. .if !c\(r? .char \(r? \Z'\h'.1m'\v'-.15m'\s[\En[.s]*7u/10u]i\s0\v'.15m''\
  1786. \v'.15m'\s[\En[.s]*7u/10u]c\s0\v'-.15m'
  1787. .if !c\(r! .char \(r! \h'.1m'\Z'\v'-.4m'\s[\En[.s]*8u/10u].\s0\v'.4m''\
  1788. \s[\En[.s]*8u/10u]\v'.4m'\(or\v'-.4m'\s0\h'.1m'
  1789. .\" The idea of this definition is for the top of the 3 to be at the x-height.
  1790. .\" A yogh really ought to have a little line going north-west from the top
  1791. .\" left of the 3.
  1792. .if !c\[yogh] .char \[yogh] \Z'\v'\w'x'*0-\En[rst]u'\s[\En[.s]*8u/10u]\
  1793. \v'\w'3'*0+\En[rst]u'3\s0'\h'\w'\s[\En[.s]*8u/10u]3'u'
  1794. .\" Accents
  1795. .de acc*over-def
  1796. .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
  1797. \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
  1798. ..
  1799. .de acc*under-def
  1800. .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
  1801. ..
  1802. .de acc*slash-def
  1803. .ds \\$1 \Z'\h'(u;-\En[.w]-\w'\\$2'/2)'\
  1804. \v'(u;\En[.cdp]-\En[.cht]+\En[rst]+\En[rsb]/2)'\\$2'
  1805. ..
  1806. .de acc*prefix-def
  1807. .ds \\$1 \Z'\h'(u;\w'x'-\w'\\$2'/2)'\\$2'
  1808. ..
  1809. .acc*prefix-def ' \'
  1810. .acc*prefix-def ` \`
  1811. .acc*prefix-def ^ ^
  1812. .acc*prefix-def , \(ac
  1813. .acc*prefix-def : \(ad
  1814. .acc*prefix-def ~ ~
  1815. .\" improved accent marks
  1816. .de AM
  1817. .acc*over-def ' \'
  1818. .acc*over-def ` \`
  1819. .acc*over-def ^ ^
  1820. .acc*over-def ~ ~
  1821. .acc*over-def : \(ad
  1822. .acc*over-def v \(ah
  1823. .acc*over-def _ \(a-
  1824. .acc*over-def o \(ao
  1825. .acc*under-def , \(ac
  1826. .acc*under-def . \s[\En[.s]*8u/10u]\v'.2m'.\v'-.2m'\s0
  1827. .acc*under-def hook \(ho
  1828. .acc*slash-def / /
  1829. .char \[hooko] o\\\\*[hook]
  1830. .ds q \[hooko]
  1831. .ds 3 \[yogh]
  1832. .ds D- \(-D\" Icelandic uppercase eth
  1833. .ds d- \(Sd\" Icelandic lowercase eth
  1834. .ds Th \(TP\" Icelandic uppercase thorn
  1835. .ds th \(Tp\" Icelandic lowercase thorn
  1836. .ds 8 \(ss\" German double s
  1837. .ds Ae \(AE\" AE ligature
  1838. .ds ae \(ae\" ae ligature
  1839. .ds Oe \(OE\" OE ligature
  1840. .ds oe \(oe\" oe ligature
  1841. .ds ? \(r?\" upside down ?
  1842. .ds ! \(r!\" upside down !
  1843. ..
  1844. .\" Make sure that no blank lines creep in at the end of this file.