Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192
  193
  194
  195
  196
  197
  198
  199
  200
  201
  202
  203
  204
  205
  206
  207
  208
  209
  210
  211
  212
  213
  214
  215
  216
  217
  218
  219
  220
  221
  222
  223
  224
  225
  226
  227
  228
  229
  230
  231
  232
  233
  234
  235
  236
  237
  238
  239
  240
  241
  242
  243
  244
  245
  246
  247
  248
  249
  250
  251
  252
  253
  254
  255
  256
  257
  258
  259
  260
  261
  262
  263
  264
  265
  266
  267
  268
  269
  270
  271
  272
  273
  274
  275
  276
  277
  278
  279
  280
  281
  282
  283
  284
  285
  286
  287
  288
  289
  290
  291
  292
  293
  294
  295
  296
  297
  298
  299
  300
  301
  302
  303
  304
  305
  306
  307
  308
  309
  310
  311
  312
  313
  314
  315
  316
  317
  318
  319
  320
  321
  322
  323
  324
  325
  326
  327
  328
  329
  330
  331
  332
  333
  334
  335
  336
  337
  338
  339
  340
  341
  342
  343
  344
  345
  346
  347
  348
  349
  350
  351
  352
  353
  354
  355
  356
  357
  358
  359
  360
  361
  362
  363
  364
  365
  366
  367
  368
  369
  370
  371
  372
  373
  374
  375
  376
  377
  378
  379
  380
  381
  382
  383
  384
  385
  386
  387
  388
  389
  390
  391
  392
  393
  394
  395
  396
  397
  398
  399
  400
  401
  402
  403
  404
  405
  406
  407
  408
  409
  410
  411
  412
  413
  414
  415
  416
  417
  418
  419
  420
  421
  422
  423
  424
  425
  426
  427
  428
  429
  430
  431
  432
  433
  434
  435
  436
  437
  438
  439
  440
  441
  442
  443
  444
  445
  446
  447
  448
  449
  450
  451
  452
  453
  454
  455
  456
  457
  458
  459
  460
  461
  462
  463
  464
  465
  466
  467
  468
  469
  470
  471
  472
  473
  474
  475
  476
  477
  478
  479
  480
  481
  482
  483
  484
  485
  486
  487
  488
  489
  490
  491
  492
  493
  494
  495
  496
  497
  498
  499
  500
  501
  502
  503
  504
  505
  506
  507
  508
  509
  510
  511
  512
  513
  514
  515
  516
  517
  518
  519
  520
  521
  522
  523
  524
  525
  526
  527
  528
  529
  530
  531
  532
  533
  534
  535
  536
  537
  538
  539
  540
  541
  542
  543
  544
  545
  546
  547
  548
  549
  550
  551
  552
  553
  554
  555
  556
  557
  558
  559
  560
  561
  562
  563
  564
  565
  566
  567
  568
  569
  570
  571
  572
  573
  574
  575
  576
  577
  578
  579
  580
  581
  582
  583
  584
  585
  586
  587
  588
  589
  590
  591
  592
  593
  594
  595
  596
  597
  598
  599
  600
  601
  602
  603
  604
  605
  606
  607
  608
  609
  610
  611
  612
  613
  614
  615
  616
  617
  618
  619
  620
  621
  622
  623
  624
  625
  626
  627
  628
  629
  630
  631
  632
  633
  634
  635
  636
  637
  638
  639
  640
  641
  642
  643
  644
  645
  646
  647
  648
  649
  650
  651
  652
  653
  654
  655
  656
  657
  658
  659
  660
  661
  662
  663
  664
  665
  666
  667
  668
  669
  670
  671
  672
  673
  674
  675
  676
  677
  678
  679
  680
  681
  682
  683
  684
  685
  686
  687
  688
  689
  690
  691
  692
  693
  694
  695
  696
  697
  698
  699
  700
  701
  702
  703
  704
  705
  706
  707
  708
  709
  710
  711
  712
  713
  714
  715
  716
  717
  718
  719
  720
  721
  722
  723
  724
  725
  726
  727
  728
  729
  730
  731
  732
  733
  734
  735
  736
  737
  738
  739
  740
  741
  742
  743
  744
  745
  746
  747
  748
  749
  750
  751
  752
  753
  754
  755
  756
  757
  758
  759
  760
  761
  762
  763
  764
  765
  766
  767
  768
  769
  770
  771
  772
  773
  774
  775
  776
  777
  778
  779
  780
  781
  782
  783
  784
  785
  786
  787
  788
  789
  790
  791
  792
  793
  794
  795
  796
  797
  798
  799
  800
  801
  802
  803
  804
  805
  806
  807
  808
  809
  810
  811
  812
  813
  814
  815
  816
  817
  818
  819
  820
  821
  822
  823
  824
  825
  826
  827
  828
  829
  830
  831
  832
  833
  834
  835
  836
  837
  838
  839
  840
  841
  842
  843
  844
  845
  846
  847
  848
  849
  850
  851
  852
  853
  854
  855
  856
  857
  858
  859
  860
  861
  862
  863
  864
  865
  866
  867
  868
  869
  870
  871
  872
  873
  874
  875
  876
  877
  878
  879
  880
  881
  882
  883
  884
  885
  886
  887
  888
  889
  890
  891
  892
  893
  894
  895
  896
  897
  898
  899
  900
  901
  902
  903
  904
  905
  906
  907
  908
  909
  910
  911
  912
  913
  914
  915
  916
  917
  918
  919
  920
  921
  922
  923
  924
  925
  926
  927
  928
  929
  930
  931
  932
  933
  934
  935
  936
  937
  938
  939
  940
  941
  942
  943
  944
  945
  946
  947
  948
  949
  950
  951
  952
  953
  954
  955
  956
  957
  958
  959
  960
  961
  962
  963
  964
  965
  966
  967
  968
  969
  970
  971
  972
  973
  974
  975
  976
  977
  978
  979
  980
  981
  982
  983
  984
  985
  986
  987
  988
  989
  990
  991
  992
  993
  994
  995
  996
  997
  998
  999
 1000
 1001
 1002
 1003
 1004
 1005
 1006
 1007
 1008
 1009
 1010
 1011
 1012
 1013
 1014
 1015
 1016
 1017
 1018
 1019
 1020
 1021
 1022
 1023
 1024
 1025
 1026
 1027
 1028
 1029
 1030
 1031
 1032
 1033
 1034
 1035
 1036
 1037
 1038
 1039
 1040
 1041
 1042
 1043
 1044
 1045
 1046
 1047
 1048
 1049
 1050
 1051
 1052
 1053
 1054
 1055
 1056
 1057
 1058
 1059
 1060
 1061
 1062
 1063
 1064
 1065
 1066
 1067
 1068
 1069
 1070
 1071
 1072
 1073
 1074
 1075
 1076
 1077
 1078
 1079
 1080
 1081
 1082
 1083
 1084
 1085
 1086
 1087
 1088
 1089
 1090
 1091
 1092
 1093
 1094
 1095
 1096
 1097
 1098
 1099
 1100
 1101
 1102
 1103
 1104
 1105
 1106
 1107
 1108
 1109
 1110
 1111
 1112
 1113
 1114
 1115
 1116
 1117
 1118
 1119
 1120
 1121
 1122
 1123
 1124
 1125
 1126
 1127
 1128
 1129
 1130
 1131
 1132
 1133
 1134
 1135
 1136
 1137
 1138
 1139
 1140
 1141
 1142
 1143
 1144
 1145
 1146
 1147
 1148
 1149
 1150
 1151
 1152
 1153
 1154
 1155
 1156
 1157
 1158
 1159
 1160
 1161
 1162
 1163
 1164
 1165
 1166
 1167
 1168
 1169
 1170
 1171
 1172
 1173
 1174
 1175
 1176
 1177
 1178
 1179
 1180
 1181
 1182
 1183
 1184
 1185
 1186
 1187
 1188
 1189
 1190
 1191
 1192
 1193
 1194
 1195
 1196
 1197
 1198
 1199
 1200
 1201
 1202
 1203
 1204
 1205
 1206
 1207
 1208
 1209
 1210
 1211
 1212
 1213
 1214
 1215
 1216
 1217
 1218
 1219
 1220
 1221
 1222
 1223
 1224
 1225
 1226
 1227
 1228
 1229
 1230
 1231
 1232
 1233
 1234
 1235
 1236
 1237
 1238
 1239
 1240
 1241
 1242
 1243
 1244
 1245
 1246
 1247
 1248
 1249
 1250
 1251
 1252
 1253
 1254
 1255
 1256
 1257
 1258
 1259
 1260
 1261
 1262
 1263
 1264
 1265
 1266
 1267
 1268
 1269
 1270
 1271
 1272
 1273
 1274
 1275
 1276
 1277
 1278
 1279
 1280
 1281
 1282
 1283
 1284
 1285
 1286
 1287
 1288
 1289
 1290
 1291
 1292
 1293
 1294
 1295
 1296
 1297
 1298
 1299
 1300
 1301
 1302
 1303
 1304
 1305
 1306
 1307
 1308
 1309
 1310
 1311
 1312
 1313
 1314
 1315
 1316
 1317
 1318
 1319
 1320
 1321
 1322
 1323
 1324
 1325
 1326
 1327
 1328
 1329
 1330
 1331
 1332
 1333
 1334
 1335
 1336
 1337
 1338
 1339
 1340
 1341
 1342
 1343
 1344
 1345
 1346
 1347
 1348
 1349
 1350
 1351
 1352
 1353
 1354
 1355
 1356
 1357
 1358
 1359
 1360
 1361
 1362
 1363
 1364
 1365
 1366
 1367
 1368
 1369
 1370
 1371
 1372
 1373
 1374
 1375
 1376
 1377
 1378
 1379
 1380
 1381
 1382
 1383
 1384
 1385
 1386
 1387
 1388
 1389
 1390
 1391
 1392
 1393
 1394
 1395
 1396
 1397
 1398
 1399
 1400
 1401
 1402
 1403
 1404
 1405
 1406
 1407
 1408
 1409
 1410
 1411
 1412
 1413
 1414
 1415
 1416
 1417
 1418
 1419
 1420
 1421
 1422
 1423
 1424
 1425
 1426
 1427
 1428
 1429
 1430
 1431
 1432
 1433
 1434
 1435
 1436
 1437
 1438
 1439
 1440
 1441
 1442
 1443
 1444
 1445
 1446
 1447
 1448
 1449
 1450
 1451
 1452
 1453
 1454
 1455
 1456
 1457
 1458
 1459
 1460
 1461
 1462
 1463
 1464
 1465
 1466
 1467
 1468
 1469
 1470
 1471
 1472
 1473
 1474
 1475
 1476
 1477
 1478
 1479
 1480
 1481
 1482
 1483
 1484
 1485
 1486
 1487
 1488
 1489
 1490
 1491
 1492
 1493
 1494
 1495
 1496
 1497
 1498
 1499
 1500
 1501
 1502
 1503
 1504
 1505
 1506
 1507
 1508
 1509
 1510
 1511
 1512
 1513
 1514
 1515
 1516
 1517
 1518
 1519
 1520
 1521
 1522
 1523
 1524
 1525
 1526
 1527
 1528
 1529
 1530
 1531
 1532
 1533
 1534
 1535
 1536
 1537
 1538
 1539
 1540
 1541
 1542
 1543
 1544
 1545
 1546
 1547
 1548
 1549
 1550
 1551
 1552
 1553
 1554
 1555
 1556
 1557
 1558
 1559
 1560
 1561
 1562
 1563
 1564
 1565
 1566
 1567
 1568
 1569
 1570
 1571
 1572
 1573
 1574
 1575
 1576
 1577
 1578
 1579
 1580
 1581
 1582
 1583
 1584
 1585
 1586
 1587
 1588
 1589
 1590
 1591
 1592
 1593
 1594
 1595
 1596
 1597
 1598
 1599
 1600
 1601
 1602
 1603
 1604
 1605
 1606
 1607
 1608
 1609
 1610
 1611
 1612
 1613
 1614
 1615
 1616
 1617
 1618
 1619
 1620
 1621
 1622
 1623
 1624
 1625
 1626
 1627
 1628
 1629
 1630
 1631
 1632
 1633
 1634
 1635
 1636
 1637
 1638
 1639
 1640
 1641
 1642
 1643
 1644
 1645
 1646
 1647
 1648
 1649
 1650
 1651
 1652
 1653
 1654
 1655
 1656
 1657
 1658
 1659
 1660
 1661
 1662
 1663
 1664
 1665
 1666
 1667
 1668
 1669
 1670
 1671
 1672
 1673
 1674
 1675
 1676
 1677
 1678
 1679
 1680
 1681
 1682
 1683
 1684
 1685
 1686
 1687
 1688
 1689
 1690
 1691
 1692
 1693
 1694
 1695
 1696
 1697
 1698
 1699
 1700
 1701
 1702
 1703
 1704
 1705
 1706
 1707
 1708
 1709
 1710
 1711
 1712
 1713
 1714
 1715
 1716
 1717
 1718
 1719
 1720
 1721
 1722
 1723
 1724
 1725
 1726
 1727
 1728
 1729
 1730
 1731
 1732
 1733
 1734
 1735
 1736
 1737
 1738
 1739
 1740
 1741
 1742
 1743
 1744
 1745
 1746
 1747
 1748
 1749
 1750
 1751
 1752
 1753
 1754
 1755
 1756
 1757
 1758
 1759
 1760
 1761
 1762
 1763
 1764
 1765
 1766
 1767
 1768
 1769
 1770
 1771
 1772
 1773
 1774
 1775
 1776
 1777
 1778
 1779
 1780
 1781
 1782
 1783
 1784
 1785
 1786
 1787
 1788
 1789
 1790
 1791
 1792
 1793
 1794
 1795
 1796
 1797
 1798
 1799
 1800
 1801
 1802
 1803
 1804
 1805
 1806
 1807
 1808
 1809
 1810
 1811
 1812
 1813
 1814
 1815
 1816
 1817
 1818
 1819
 1820
 1821
 1822
 1823
 1824
 1825
 1826
 1827
 1828
 1829
 1830
 1831
 1832
 1833
 1834
 1835
 1836
 1837
 1838
 1839
 1840
 1841
 1842
 1843
 1844
 1845
 1846
 1847
 1848
 1849
 1850
 1851
 1852
 1853
 1854
 1855
 1856
 1857
 1858
 1859
 1860
 1861
 1862
 1863
 1864
 1865
 1866
 1867
 1868
 1869
 1870
 1871
 1872
 1873
 1874
 1875
 1876
 1877
 1878
 1879
 1880
 1881
 1882
 1883
 1884
 1885
 1886
 1887
 1888
 1889
 1890
 1891
 1892
 1893
 1894
 1895
 1896
 1897
 1898
 1899
 1900
 1901
 1902
 1903
 1904
 1905
 1906
 1907
 1908
 1909
 1910
 1911
 1912
 1913
 1914
 1915
 1916
 1917
 1918
 1919
 1920
 1921
 1922
 1923
 1924
 1925
 1926
 1927
 1928
 1929
 1930
 1931
 1932
 1933
 1934
 1935
 1936
 1937
 1938
 1939
 1940
 1941
 1942
 1943
 1944
 1945
 1946
 1947
 1948
 1949
 1950
 1951
 1952
 1953
 1954
 1955
 1956
 1957
 1958
 1959
 1960
 1961
 1962
 1963
 1964
 1965
 1966
 1967
 1968
 1969
 1970
 1971
 1972
 1973
 1974
 1975
 1976
 1977
 1978
 1979
 1980
 1981
 1982
 1983
 1984
 1985
 1986
 1987
 1988
 1989
 1990
 1991
 1992
 1993
 1994
 1995
 1996
 1997
 1998
 1999
 2000
 2001
 2002
 2003
 2004
 2005
 2006
 2007
 2008
 2009
 2010
 2011
 2012
 2013
 2014
 2015
 2016
 2017
 2018
 2019
 2020
 2021
 2022
 2023
 2024
 2025
 2026
 2027
 2028
 2029
 2030
 2031
 2032
 2033
 2034
 2035
 2036
 2037
 2038
 2039
 2040
 2041
 2042
 2043
 2044
 2045
 2046
 2047
 2048
 2049
 2050
 2051
 2052
 2053
 2054
 2055
 2056
 2057
 2058
 2059
 2060
 2061
 2062
 2063
 2064
 2065
 2066
 2067
 2068
 2069
 2070
 2071
 2072
 2073
 2074
 2075
 2076
 2077
 2078
 2079
 2080
 2081
 2082
 2083
 2084
 2085
 2086
 2087
 2088
 2089
 2090
 2091
 2092
 2093
 2094
 2095
 2096
 2097
 2098
 2099
 2100
 2101
 2102
 2103
 2104
 2105
 2106
 2107
 2108
 2109
 2110
 2111
 2112
 2113
 2114
 2115
 2116
 2117
 2118
 2119
 2120
 2121
 2122
 2123
 2124
 2125
 2126
 2127
 2128
 2129
 2130
 2131
 2132
 2133
 2134
 2135
 2136
 2137
 2138
 2139
 2140
 2141
 2142
 2143
 2144
 2145
 2146
 2147
 2148
 2149
 2150
 2151
 2152
 2153
 2154
 2155
 2156
 2157
 2158
 2159
 2160
 2161
 2162
 2163
 2164
 2165
 2166
 2167
 2168
 2169
 2170
 2171
 2172
 2173
 2174
 2175
 2176
 2177
 2178
 2179
 2180
 2181
 2182
 2183
 2184
 2185
 2186
 2187
 2188
 2189
 2190
 2191
 2192
 2193
 2194
 2195
 2196
 2197
 2198
 2199
 2200
 2201
 2202
 2203
 2204
 2205
 2206
 2207
 2208
 2209
 2210
 2211
 2212
 2213
 2214
 2215
 2216
 2217
 2218
 2219
 2220
 2221
 2222
 2223
 2224
 2225
 2226
 2227
 2228
 2229
 2230
 2231
 2232
 2233
 2234
 2235
 2236
 2237
 2238
 2239
 2240
 2241
 2242
 2243
 2244
 2245
 2246
 2247
 2248
 2249
 2250
 2251
 2252
 2253
 2254
 2255
 2256
 2257
 2258
 2259
 2260
 2261
 2262
 2263
 2264
 2265
 2266
 2267
 2268
 2269
 2270
 2271
 2272
 2273
 2274
 2275
 2276
 2277
 2278
 2279
 2280
 2281
 2282
 2283
 2284
 2285
 2286
 2287
 2288
 2289
 2290
 2291
 2292
 2293
 2294
 2295
 2296
 2297
 2298
 2299
 2300
 2301
 2302
 2303
 2304
 2305
 2306
 2307
 2308
 2309
 2310
 2311
 2312
 2313
 2314
 2315
 2316
 2317
 2318
 2319
 2320
 2321
 2322
 2323
 2324
 2325
 2326
 2327
 2328
 2329
 2330
 2331
 2332
 2333
 2334
 2335
 2336
 2337
 2338
 2339
 2340
 2341
 2342
 2343
 2344
 2345
 2346
 2347
 2348
 2349
 2350
 2351
 2352
 2353
 2354
 2355
 2356
 2357
 2358
 2359
 2360
 2361
 2362
 2363
 2364
 2365
 2366
 2367
 2368
 2369
 2370
 2371
 2372
 2373
 2374
 2375
 2376
 2377
 2378
 2379
 2380
 2381
 2382
 2383
 2384
 2385
 2386
 2387
 2388
 2389
 2390
 2391
 2392
 2393
 2394
 2395
 2396
 2397
 2398
 2399
 2400
 2401
 2402
 2403
 2404
 2405
 2406
 2407
 2408
 2409
 2410
 2411
 2412
 2413
 2414
 2415
 2416
 2417
 2418
 2419
 2420
 2421
 2422
 2423
 2424
 2425
 2426
 2427
 2428
 2429
 2430
 2431
 2432
 2433
 2434
 2435
 2436
 2437
 2438
 2439
 2440
 2441
 2442
 2443
 2444
 2445
 2446
 2447
 2448
 2449
 2450
 2451
 2452
 2453
 2454
 2455
 2456
 2457
 2458
 2459
 2460
 2461
 2462
 2463
 2464
 2465
 2466
 2467
 2468
 2469
 2470
 2471
 2472
 2473
 2474
 2475
 2476
 2477
 2478
 2479
 2480
 2481
 2482
 2483
 2484
 2485
 2486
 2487
 2488
 2489
 2490
 2491
 2492
 2493
 2494
 2495
 2496
 2497
 2498
 2499
 2500
 2501
 2502
 2503
 2504
 2505
 2506
 2507
 2508
 2509
 2510
 2511
 2512
 2513
 2514
 2515
 2516
 2517
 2518
 2519
 2520
 2521
 2522
 2523
 2524
 2525
 2526
 2527
 2528
 2529
 2530
 2531
 2532
 2533
 2534
 2535
 2536
 2537
 2538
 2539
 2540
 2541
 2542
 2543
 2544
 2545
 2546
 2547
 2548
 2549
 2550
 2551
 2552
 2553
 2554
 2555
 2556
 2557
 2558
 2559
 2560
 2561
 2562
 2563
 2564
 2565
 2566
 2567
 2568
 2569
 2570
 2571
 2572
 2573
 2574
 2575
 2576
 2577
 2578
 2579
 2580
 2581
 2582
 2583
 2584
 2585
 2586
 2587
 2588
 2589
 2590
 2591
 2592
 2593
 2594
 2595
 2596
 2597
 2598
 2599
 2600
 2601
 2602
 2603
 2604
 2605
 2606
 2607
 2608
 2609
 2610
 2611
 2612
 2613
 2614
 2615
 2616
 2617
 2618
 2619
 2620
 2621
 2622
 2623
 2624
 2625
 2626
 2627
 2628
 2629
 2630
 2631
 2632
 2633
 2634
 2635
 2636
 2637
 2638
 2639
 2640
 2641
 2642
 2643
 2644
 2645
 2646
 2647
 2648
 2649
 2650
 2651
 2652
 2653
 2654
 2655
 2656
 2657
 2658
 2659
 2660
 2661
 2662
 2663
 2664
 2665
 2666
 2667
 2668
 2669
 2670
 2671
 2672
 2673
 2674
 2675
 2676
 2677
 2678
 2679
 2680
 2681
 2682
 2683
 2684
 2685
 2686
 2687
 2688
 2689
 2690
 2691
 2692
 2693
 2694
 2695
 2696
 2697
 2698
 2699
 2700
 2701
 2702
 2703
 2704
 2705
 2706
 2707
 2708
 2709
 2710
 2711
 2712
 2713
 2714
 2715
 2716
 2717
 2718
 2719
 2720
 2721
 2722
 2723
 2724
 2725
 2726
 2727
 2728
 2729
 2730
 2731
 2732
 2733
 2734
 2735
 2736
 2737
 2738
 2739
 2740
 2741
 2742
 2743
 2744
 2745
 2746
 2747
 2748
 2749
 2750
 2751
 2752
 2753
 2754
 2755
 2756
 2757
 2758
 2759
 2760
 2761
 2762
 2763
 2764
 2765
 2766
 2767
 2768
 2769
 2770
 2771
 2772
 2773
 2774
 2775
 2776
 2777
 2778
 2779
 2780
 2781
 2782
 2783
 2784
 2785
 2786
 2787
 2788
 2789
 2790
 2791
 2792
 2793
 2794
 2795
 2796
 2797
 2798
 2799
 2800
 2801
 2802
 2803
 2804
 2805
 2806
 2807
 2808
 2809
 2810
 2811
 2812
 2813
 2814
 2815
 2816
 2817
 2818
 2819
 2820
 2821
 2822
 2823
 2824
 2825
 2826
 2827
 2828
 2829
 2830
 2831
 2832
 2833
 2834
 2835
 2836
 2837
 2838
 2839
 2840
 2841
 2842
 2843
 2844
 2845
 2846
 2847
 2848
 2849
 2850
 2851
 2852
 2853
 2854
 2855
 2856
 2857
 2858
 2859
 2860
 2861
 2862
 2863
 2864
 2865
 2866
 2867
 2868
 2869
 2870
 2871
 2872
 2873
 2874
 2875
 2876
 2877
 2878
 2879
 2880
 2881
 2882
 2883
 2884
 2885
 2886
 2887
 2888
 2889
 2890
 2891
 2892
 2893
 2894
 2895
 2896
 2897
 2898
 2899
 2900
 2901
 2902
 2903
 2904
 2905
 2906
 2907
 2908
 2909
 2910
 2911
 2912
 2913
 2914
 2915
 2916
 2917
 2918
 2919
 2920
 2921
 2922
 2923
 2924
 2925
 2926
 2927
 2928
 2929
 2930
 2931
 2932
 2933
 2934
 2935
 2936
 2937
 2938
 2939
 2940
 2941
 2942
 2943
 2944
 2945
 2946
 2947
 2948
 2949
 2950
 2951
 2952
 2953
 2954
 2955
 2956
 2957
 2958
 2959
 2960
 2961
 2962
 2963
 2964
 2965
 2966
 2967
 2968
 2969
 2970
 2971
 2972
 2973
 2974
 2975
 2976
 2977
 2978
 2979
 2980
 2981
 2982
 2983
 2984
 2985
 2986
 2987
 2988
 2989
 2990
 2991
 2992
 2993
 2994
 2995
 2996
 2997
 2998
 2999
 3000
 3001
 3002
 3003
 3004
 3005
 3006
 3007
 3008
 3009
 3010
 3011
 3012
 3013
 3014
 3015
 3016
 3017
 3018
 3019
 3020
 3021
 3022
 3023
 3024
 3025
 3026
 3027
 3028
 3029
 3030
 3031
 3032
 3033
 3034
 3035
 3036
 3037
 3038
 3039
 3040
 3041
 3042
 3043
 3044
 3045
 3046
 3047
 3048
 3049
 3050
 3051
 3052
 3053
 3054
 3055
 3056
 3057
 3058
 3059
 3060
 3061
 3062
 3063
 3064
 3065
 3066
 3067
 3068
 3069
 3070
 3071
 3072
 3073
 3074
 3075
 3076
 3077
 3078
 3079
 3080
 3081
 3082
 3083
 3084
 3085
 3086
 3087
 3088
 3089
 3090
 3091
 3092
 3093
 3094
 3095
 3096
 3097
 3098
 3099
 3100
 3101
 3102
 3103
 3104
 3105
 3106
 3107
 3108
 3109
 3110
 3111
 3112
 3113
 3114
 3115
 3116
 3117
 3118
 3119
 3120
 3121
 3122
 3123
 3124
 3125
 3126
 3127
 3128
 3129
 3130
 3131
 3132
 3133
 3134
 3135
 3136
 3137
 3138
 3139
 3140
 3141
 3142
 3143
 3144
 3145
 3146
 3147
 3148
 3149
 3150
 3151
 3152
 3153
 3154
 3155
 3156
 3157
 3158
 3159
 3160
 3161
 3162
 3163
 3164
 3165
 3166
 3167
 3168
 3169
 3170
 3171
 3172
 3173
 3174
 3175
 3176
 3177
 3178
 3179
 3180
 3181
 3182
 3183
 3184
 3185
 3186
 3187
 3188
 3189
 3190
 3191
 3192
 3193
 3194
 3195
 3196
 3197
 3198
 3199
 3200
 3201
 3202
 3203
 3204
 3205
 3206
 3207
 3208
 3209
 3210
 3211
 3212
 3213
 3214
 3215
 3216
 3217
 3218
 3219
 3220
 3221
 3222
 3223
 3224
 3225
 3226
 3227
 3228
 3229
 3230
 3231
 3232
 3233
 3234
 3235
 3236
 3237
 3238
 3239
 3240
 3241
 3242
 3243
 3244
 3245
 3246
 3247
 3248
 3249
 3250
 3251
 3252
 3253
 3254
 3255
 3256
 3257
 3258
 3259
 3260
 3261
 3262
 3263
 3264
 3265
 3266
 3267
 3268
 3269
 3270
 3271
 3272
 3273
 3274
 3275
 3276
 3277
 3278
 3279
 3280
 3281
 3282
 3283
 3284
 3285
 3286
 3287
 3288
 3289
 3290
 3291
 3292
 3293
 3294
 3295
 3296
 3297
 3298
 3299
 3300
 3301
 3302
 3303
 3304
 3305
 3306
 3307
 3308
 3309
 3310
 3311
 3312
 3313
 3314
 3315
 3316
 3317
 3318
 3319
 3320
 3321
 3322
 3323
 3324
 3325
 3326
 3327
 3328
 3329
 3330
 3331
 3332
 3333
 3334
 3335
 3336
 3337
 3338
 3339
 3340
 3341
 3342
 3343
 3344
 3345
 3346
 3347
 3348
 3349
 3350
 3351
 3352
 3353
 3354
 3355
 3356
 3357
 3358
 3359
 3360
 3361
 3362
 3363
 3364
 3365
 3366
 3367
 3368
 3369
 3370
 3371
 3372
 3373
 3374
 3375
 3376
 3377
 3378
 3379
 3380
 3381
 3382
 3383
 3384
 3385
 3386
 3387
 3388
 3389
 3390
 3391
 3392
 3393
 3394
 3395
 3396
 3397
 3398
 3399
 3400
 3401
 3402
 3403
 3404
 3405
 3406
 3407
 3408
 3409
 3410
 3411
 3412
 3413
 3414
 3415
 3416
 3417
 3418
 3419
 3420
 3421
 3422
 3423
 3424
 3425
 3426
 3427
 3428
 3429
 3430
 3431
 3432
 3433
 3434
 3435
 3436
 3437
 3438
 3439
 3440
 3441
 3442
 3443
 3444
 3445
 3446
 3447
 3448
 3449
 3450
 3451
 3452
 3453
 3454
 3455
 3456
 3457
 3458
 3459
 3460
 3461
 3462
 3463
 3464
 3465
 3466
 3467
 3468
 3469
 3470
 3471
 3472
 3473
 3474
 3475
 3476
 3477
 3478
 3479
 3480
 3481
 3482
 3483
 3484
 3485
 3486
 3487
 3488
 3489
 3490
 3491
 3492
 3493
 3494
 3495
 3496
 3497
 3498
 3499
 3500
 3501
 3502
 3503
 3504
 3505
 3506
 3507
 3508
 3509
 3510
 3511
 3512
 3513
 3514
 3515
 3516
 3517
 3518
 3519
 3520
 3521
 3522
 3523
 3524
 3525
 3526
 3527
 3528
 3529
 3530
 3531
 3532
 3533
 3534
 3535
 3536
 3537
 3538
 3539
 3540
 3541
 3542
 3543
 3544
 3545
 3546
 3547
 3548
 3549
 3550
 3551
 3552
 3553
 3554
 3555
 3556
 3557
 3558
 3559
 3560
 3561
 3562
 3563
 3564
 3565
 3566
 3567
 3568
 3569
 3570
 3571
 3572
 3573
 3574
 3575
 3576
 3577
 3578
 3579
 3580
 3581
 3582
 3583
 3584
 3585
 3586
 3587
 3588
 3589
 3590
 3591
 3592
 3593
 3594
 3595
 3596
 3597
 3598
 3599
 3600
 3601
 3602
 3603
 3604
 3605
 3606
 3607
 3608
 3609
 3610
 3611
 3612
 3613
 3614
 3615
 3616
 3617
 3618
 3619
 3620
 3621
 3622
 3623
 3624
 3625
 3626
 3627
 3628
 3629
 3630
 3631
 3632
 3633
 3634
 3635
 3636
 3637
 3638
 3639
 3640
 3641
 3642
 3643
 3644
 3645
 3646
 3647
 3648
 3649
 3650
 3651
 3652
 3653
 3654
 3655
 3656
 3657
 3658
 3659
 3660
 3661
 3662
 3663
 3664
 3665
 3666
 3667
 3668
 3669
 3670
 3671
 3672
 3673
 3674
 3675
 3676
 3677
 3678
 3679
 3680
 3681
 3682
 3683
 3684
 3685
 3686
 3687
 3688
 3689
 3690
 3691
 3692
 3693
 3694
 3695
 3696
 3697
 3698
 3699
 3700
 3701
 3702
 3703
 3704
 3705
 3706
 3707
 3708
 3709
 3710
 3711
 3712
 3713
 3714
 3715
 3716
 3717
 3718
 3719
 3720
 3721
 3722
 3723
 3724
 3725
 3726
 3727
 3728
 3729
 3730
 3731
 3732
 3733
 3734
 3735
 3736
 3737
 3738
 3739
 3740
 3741
 3742
 3743
 3744
 3745
 3746
 3747
 3748
 3749
 3750
 3751
 3752
 3753
 3754
 3755
 3756
 3757
 3758
 3759
 3760
 3761
 3762
 3763
 3764
 3765
 3766
 3767
 3768
 3769
 3770
 3771
 3772
 3773
 3774
 3775
 3776
 3777
 3778
 3779
 3780
 3781
 3782
 3783
 3784
 3785
 3786
 3787
 3788
 3789
 3790
 3791
 3792
 3793
 3794
 3795
 3796
 3797
 3798
 3799
 3800
 3801
 3802
 3803
 3804
 3805
 3806
 3807
 3808
 3809
 3810
 3811
 3812
 3813
 3814
 3815
 3816
 3817
 3818
 3819
 3820
 3821
 3822
 3823
 3824
 3825
 3826
 3827
 3828
 3829
 3830
 3831
 3832
 3833
 3834
 3835
 3836
 3837
 3838
 3839
 3840
 3841
 3842
 3843
 3844
 3845
 3846
 3847
 3848
 3849
 3850
 3851
 3852
 3853
 3854
 3855
 3856
 3857
 3858
 3859
 3860
 3861
 3862
 3863
 3864
 3865
 3866
 3867
 3868
 3869
 3870
 3871
 3872
 3873
 3874
 3875
 3876
 3877
 3878
 3879
 3880
 3881
 3882
 3883
 3884
 3885
 3886
 3887
 3888
 3889
 3890
 3891
 3892
 3893
 3894
 3895
 3896
 3897
 3898
 3899
 3900
 3901
 3902
 3903
 3904
 3905
 3906
 3907
 3908
 3909
 3910
 3911
 3912
 3913
 3914
 3915
 3916
 3917
 3918
 3919
 3920
 3921
 3922
 3923
 3924
 3925
 3926
 3927
 3928
 3929
 3930
 3931
 3932
 3933
 3934
 3935
 3936
 3937
 3938
 3939
 3940
 3941
 3942
 3943
 3944
 3945
 3946
 3947
 3948
 3949
 3950
 3951
 3952
 3953
 3954
 3955
 3956
 3957
 3958
 3959
 3960
 3961
 3962
 3963
 3964
 3965
 3966
 3967
 3968
 3969
 3970
 3971
 3972
 3973
 3974
 3975
 3976
 3977
 3978
 3979
 3980
 3981
 3982
 3983
 3984
 3985
 3986
 3987
 3988
 3989
 3990
 3991
 3992
 3993
 3994
 3995
 3996
 3997
 3998
 3999
 4000
 4001
 4002
 4003
 4004
 4005
 4006
 4007
 4008
 4009
 4010
 4011
 4012
 4013
 4014
 4015
 4016
 4017
 4018
 4019
 4020
 4021
 4022
 4023
 4024
 4025
 4026
 4027
 4028
 4029
 4030
 4031
 4032
 4033
 4034
 4035
 4036
 4037
 4038
 4039
 4040
 4041
 4042
 4043
 4044
 4045
 4046
 4047
 4048
 4049
 4050
 4051
 4052
 4053
 4054
 4055
 4056
 4057
 4058
 4059
 4060
 4061
 4062
 4063
 4064
 4065
 4066
 4067
 4068
 4069
 4070
 4071
 4072
 4073
 4074
 4075
 4076
 4077
 4078
 4079
 4080
 4081
 4082
 4083
 4084
 4085
 4086
 4087
 4088
 4089
 4090
 4091
 4092
 4093
 4094
 4095
 4096
 4097
 4098
 4099
 4100
 4101
 4102
 4103
 4104
 4105
 4106
 4107
 4108
 4109
 4110
 4111
 4112
 4113
 4114
 4115
 4116
 4117
 4118
 4119
 4120
 4121
 4122
 4123
 4124
 4125
 4126
 4127
 4128
 4129
 4130
 4131
 4132
 4133
 4134
 4135
 4136
 4137
 4138
 4139
 4140
 4141
 4142
 4143
 4144
 4145
 4146
 4147
 4148
 4149
 4150
 4151
 4152
 4153
 4154
 4155
 4156
 4157
 4158
 4159
 4160
 4161
 4162
 4163
 4164
 4165
 4166
 4167
 4168
 4169
 4170
 4171
 4172
 4173
 4174
 4175
 4176
 4177
 4178
 4179
 4180
 4181
 4182
 4183
 4184
 4185
 4186
 4187
 4188
 4189
 4190
 4191
 4192
 4193
 4194
 4195
 4196
 4197
 4198
 4199
 4200
 4201
 4202
 4203
 4204
 4205
 4206
 4207
 4208
 4209
 4210
 4211
 4212
 4213
 4214
 4215
 4216
 4217
 4218
 4219
 4220
 4221
 4222
 4223
 4224
 4225
 4226
 4227
 4228
 4229
 4230
 4231
 4232
 4233
 4234
 4235
 4236
 4237
 4238
 4239
 4240
 4241
 4242
 4243
 4244
 4245
 4246
 4247
 4248
 4249
 4250
 4251
 4252
 4253
 4254
 4255
 4256
 4257
 4258
 4259
 4260
 4261
 4262
 4263
 4264
 4265
 4266
 4267
 4268
 4269
 4270
 4271
 4272
 4273
 4274
 4275
 4276
 4277
 4278
 4279
 4280
 4281
 4282
 4283
 4284
 4285
 4286
 4287
 4288
 4289
 4290
 4291
 4292
 4293
 4294
 4295
 4296
 4297
 4298
 4299
 4300
 4301
 4302
 4303
 4304
 4305
 4306
 4307
 4308
 4309
 4310
 4311
 4312
 4313
 4314
 4315
 4316
 4317
 4318
 4319
 4320
 4321
 4322
 4323
 4324
 4325
 4326
 4327
 4328
 4329
 4330
 4331
 4332
 4333
 4334
 4335
 4336
 4337
 4338
 4339
 4340
 4341
 4342
 4343
 4344
 4345
 4346
 4347
 4348
 4349
 4350
 4351
 4352
 4353
 4354
 4355
 4356
 4357
 4358
 4359
 4360
 4361
 4362
 4363
 4364
 4365
 4366
 4367
 4368
 4369
 4370
 4371
 4372
 4373
 4374
 4375
 4376
 4377
 4378
 4379
 4380
 4381
 4382
 4383
 4384
 4385
 4386
 4387
 4388
 4389
 4390
 4391
 4392
 4393
 4394
 4395
 4396
 4397
 4398
 4399
 4400
 4401
 4402
 4403
 4404
 4405
 4406
 4407
 4408
 4409
 4410
 4411
 4412
 4413
 4414
 4415
 4416
 4417
 4418
 4419
 4420
 4421
 4422
 4423
 4424
 4425
 4426
 4427
 4428
 4429
 4430
 4431
 4432
 4433
 4434
 4435
 4436
 4437
 4438
 4439
 4440
 4441
 4442
 4443
 4444
 4445
 4446
 4447
 4448
 4449
 4450
 4451
 4452
 4453
 4454
 4455
 4456
 4457
 4458
 4459
 4460
 4461
 4462
 4463
 4464
 4465
 4466
 4467
 4468
 4469
 4470
 4471
 4472
 4473
 4474
 4475
 4476
 4477
 4478
 4479
 4480
 4481
 4482
 4483
 4484
 4485
 4486
 4487
 4488
 4489
 4490
 4491
 4492
 4493
 4494
 4495
 4496
 4497
 4498
 4499
 4500
 4501
 4502
 4503
 4504
 4505
 4506
 4507
 4508
 4509
 4510
 4511
 4512
 4513
 4514
 4515
 4516
 4517
 4518
 4519
 4520
 4521
 4522
 4523
 4524
 4525
 4526
 4527
 4528
 4529
 4530
 4531
 4532
 4533
 4534
 4535
 4536
 4537
 4538
 4539
 4540
 4541
 4542
 4543
 4544
 4545
 4546
 4547
 4548
 4549
 4550
 4551
 4552
 4553
 4554
 4555
 4556
 4557
 4558
 4559
 4560
 4561
 4562
 4563
 4564
 4565
 4566
 4567
 4568
 4569
 4570
 4571
 4572
 4573
 4574
 4575
 4576
 4577
 4578
 4579
 4580
 4581
 4582
 4583
 4584
 4585
 4586
 4587
 4588
 4589
 4590
 4591
 4592
 4593
 4594
 4595
 4596
 4597
 4598
 4599
 4600
 4601
 4602
 4603
 4604
 4605
 4606
 4607
 4608
 4609
 4610
 4611
 4612
 4613
 4614
 4615
 4616
 4617
 4618
 4619
 4620
 4621
 4622
 4623
 4624
 4625
 4626
 4627
 4628
 4629
 4630
 4631
 4632
 4633
 4634
 4635
 4636
 4637
 4638
 4639
 4640
 4641
 4642
 4643
 4644
 4645
 4646
 4647
 4648
 4649
 4650
 4651
 4652
 4653
 4654
 4655
 4656
 4657
 4658
 4659
 4660
 4661
 4662
 4663
 4664
 4665
 4666
 4667
 4668
 4669
 4670
 4671
 4672
 4673
 4674
 4675
 4676
 4677
 4678
 4679
 4680
 4681
 4682
 4683
 4684
 4685
 4686
 4687
 4688
 4689
 4690
 4691
 4692
 4693
 4694
 4695
 4696
 4697
 4698
 4699
 4700
 4701
 4702
 4703
 4704
 4705
 4706
 4707
 4708
 4709
 4710
 4711
 4712
 4713
 4714
 4715
 4716
 4717
 4718
 4719
 4720
 4721
 4722
 4723
 4724
 4725
 4726
 4727
 4728
 4729
 4730
 4731
 4732
 4733
 4734
 4735
 4736
 4737
 4738
 4739
 4740
 4741
 4742
 4743
 4744
 4745
 4746
 4747
 4748
 4749
 4750
 4751
 4752
 4753
 4754
 4755
 4756
 4757
 4758
 4759
 4760
 4761
 4762
 4763
 4764
 4765
 4766
 4767
 4768
 4769
 4770
 4771
 4772
 4773
 4774
 4775
 4776
 4777
 4778
 4779
 4780
 4781
 4782
 4783
 4784
 4785
 4786
 4787
 4788
 4789
 4790
 4791
 4792
 4793
 4794
 4795
 4796
 4797
 4798
 4799
 4800
 4801
 4802
 4803
 4804
 4805
 4806
 4807
 4808
 4809
 4810
 4811
 4812
 4813
 4814
 4815
 4816
 4817
 4818
 4819
 4820
 4821
 4822
 4823
 4824
 4825
 4826
 4827
 4828
 4829
 4830
 4831
 4832
 4833
 4834
 4835
 4836
 4837
 4838
 4839
 4840
 4841
 4842
 4843
 4844
 4845
 4846
 4847
 4848
 4849
 4850
 4851
 4852
 4853
 4854
 4855
 4856
 4857
 4858
 4859
 4860
 4861
 4862
 4863
 4864
 4865
 4866
 4867
 4868
 4869
 4870
 4871
 4872
 4873
 4874
 4875
 4876
 4877
 4878
 4879
 4880
 4881
 4882
 4883
 4884
 4885
 4886
 4887
 4888
 4889
 4890
 4891
 4892
 4893
 4894
 4895
 4896
 4897
 4898
 4899
 4900
 4901
 4902
 4903
 4904
 4905
 4906
 4907
 4908
 4909
 4910
 4911
 4912
 4913
 4914
 4915
 4916
 4917
 4918
 4919
 4920
 4921
 4922
 4923
 4924
 4925
 4926
 4927
 4928
 4929
 4930
 4931
 4932
 4933
 4934
 4935
 4936
 4937
 4938
 4939
 4940
 4941
 4942
 4943
 4944
 4945
 4946
 4947
 4948
 4949
 4950
 4951
 4952
 4953
 4954
 4955
 4956
 4957
 4958
 4959
 4960
 4961
 4962
 4963
 4964
 4965
 4966
 4967
 4968
 4969
 4970
 4971
 4972
 4973
 4974
 4975
 4976
 4977
 4978
 4979
 4980
 4981
 4982
 4983
 4984
 4985
 4986
 4987
 4988
 4989
 4990
 4991
 4992
 4993
 4994
 4995
 4996
 4997
 4998
 4999
 5000
 5001
 5002
 5003
 5004
 5005
 5006
 5007
 5008
 5009
 5010
 5011
 5012
 5013
 5014
 5015
 5016
 5017
 5018
 5019
 5020
 5021
 5022
 5023
 5024
 5025
 5026
 5027
 5028
 5029
 5030
 5031
 5032
 5033
 5034
 5035
 5036
 5037
 5038
 5039
 5040
 5041
 5042
 5043
 5044
 5045
 5046
 5047
 5048
 5049
 5050
 5051
 5052
 5053
 5054
 5055
 5056
 5057
 5058
 5059
 5060
 5061
 5062
 5063
 5064
 5065
 5066
 5067
 5068
 5069
 5070
 5071
 5072
 5073
 5074
 5075
 5076
 5077
 5078
 5079
 5080
 5081
 5082
 5083
 5084
 5085
 5086
 5087
 5088
 5089
 5090
 5091
 5092
 5093
 5094
 5095
 5096
 5097
 5098
 5099
 5100
 5101
 5102
 5103
 5104
 5105
 5106
 5107
 5108
 5109
 5110
 5111
 5112
 5113
 5114
 5115
 5116
 5117
 5118
 5119
 5120
 5121
 5122
 5123
 5124
 5125
 5126
 5127
 5128
 5129
 5130
 5131
 5132
 5133
 5134
 5135
 5136
 5137
 5138
 5139
 5140
 5141
 5142
 5143
 5144
 5145
 5146
 5147
 5148
 5149
 5150
 5151
 5152
 5153
 5154
 5155
 5156
 5157
 5158
 5159
 5160
 5161
 5162
 5163
 5164
 5165
 5166
 5167
 5168
 5169
 5170
 5171
 5172
 5173
 5174
 5175
 5176
 5177
 5178
 5179
 5180
 5181
 5182
 5183
 5184
 5185
 5186
 5187
 5188
 5189
 5190
 5191
 5192
 5193
 5194
 5195
 5196
 5197
 5198
 5199
 5200
 5201
 5202
 5203
 5204
 5205
 5206
 5207
 5208
 5209
 5210
 5211
 5212
 5213
 5214
 5215
 5216
 5217
 5218
 5219
 5220
 5221
 5222
 5223
 5224
 5225
 5226
 5227
 5228
 5229
 5230
 5231
 5232
 5233
 5234
 5235
 5236
 5237
 5238
 5239
 5240
 5241
 5242
 5243
 5244
 5245
 5246
 5247
 5248
 5249
 5250
 5251
 5252
 5253
 5254
 5255
 5256
 5257
 5258
 5259
 5260
 5261
 5262
 5263
 5264
 5265
 5266
 5267
 5268
 5269
 5270
 5271
 5272
 5273
 5274
 5275
 5276
 5277
 5278
 5279
 5280
 5281
 5282
 5283
 5284
 5285
 5286
 5287
 5288
 5289
 5290
 5291
 5292
 5293
 5294
 5295
 5296
 5297
 5298
 5299
 5300
 5301
 5302
 5303
 5304
 5305
 5306
 5307
 5308
 5309
 5310
 5311
 5312
 5313
 5314
 5315
 5316
 5317
 5318
 5319
 5320
 5321
 5322
 5323
 5324
 5325
 5326
 5327
 5328
 5329
 5330
 5331
 5332
 5333
 5334
 5335
 5336
 5337
 5338
 5339
 5340
 5341
 5342
 5343
 5344
 5345
 5346
 5347
 5348
 5349
 5350
 5351
 5352
 5353
 5354
 5355
 5356
 5357
 5358
 5359
 5360
 5361
 5362
 5363
 5364
 5365
 5366
 5367
 5368
 5369
 5370
 5371
 5372
 5373
 5374
 5375
 5376
 5377
 5378
 5379
 5380
 5381
 5382
 5383
 5384
 5385
 5386
 5387
 5388
 5389
 5390
 5391
 5392
 5393
 5394
 5395
 5396
 5397
 5398
 5399
 5400
 5401
 5402
 5403
 5404
 5405
 5406
 5407
 5408
 5409
 5410
 5411
 5412
 5413
 5414
 5415
 5416
 5417
 5418
 5419
 5420
 5421
 5422
 5423
 5424
 5425
 5426
 5427
 5428
 5429
 5430
 5431
 5432
 5433
 5434
 5435
 5436
 5437
 5438
 5439
 5440
 5441
 5442
 5443
 5444
 5445
 5446
 5447
 5448
 5449
 5450
 5451
 5452
 5453
 5454
 5455
 5456
 5457
 5458
 5459
 5460
 5461
 5462
 5463
 5464
 5465
 5466
 5467
 5468
 5469
 5470
 5471
 5472
 5473
 5474
 5475
 5476
 5477
 5478
 5479
 5480
 5481
 5482
 5483
 5484
 5485
 5486
 5487
 5488
 5489
 5490
 5491
 5492
 5493
 5494
 5495
 5496
 5497
 5498
 5499
 5500
 5501
 5502
 5503
 5504
 5505
 5506
 5507
 5508
 5509
 5510
 5511
 5512
 5513
 5514
 5515
 5516
 5517
 5518
 5519
 5520
 5521
 5522
 5523
 5524
 5525
 5526
 5527
 5528
 5529
 5530
 5531
 5532
 5533
 5534
 5535
 5536
 5537
 5538
 5539
 5540
 5541
 5542
 5543
 5544
 5545
 5546
 5547
 5548
 5549
 5550
 5551
 5552
 5553
 5554
 5555
 5556
 5557
 5558
 5559
 5560
 5561
 5562
 5563
 5564
 5565
 5566
 5567
 5568
 5569
 5570
 5571
 5572
 5573
 5574
 5575
 5576
 5577
 5578
 5579
 5580
 5581
 5582
 5583
 5584
 5585
 5586
 5587
 5588
 5589
 5590
 5591
 5592
 5593
 5594
 5595
 5596
 5597
 5598
 5599
 5600
 5601
 5602
 5603
 5604
 5605
 5606
 5607
 5608
 5609
 5610
 5611
 5612
 5613
 5614
 5615
 5616
 5617
 5618
 5619
 5620
 5621
 5622
 5623
 5624
 5625
 5626
 5627
 5628
 5629
 5630
 5631
 5632
 5633
 5634
 5635
 5636
 5637
 5638
 5639
 5640
 5641
 5642
 5643
 5644
 5645
 5646
 5647
 5648
 5649
 5650
 5651
 5652
 5653
 5654
 5655
 5656
 5657
 5658
 5659
 5660
 5661
 5662
 5663
 5664
 5665
 5666
 5667
 5668
 5669
 5670
 5671
 5672
 5673
 5674
 5675
 5676
 5677
 5678
 5679
 5680
 5681
 5682
 5683
 5684
 5685
 5686
 5687
 5688
 5689
 5690
 5691
 5692
 5693
 5694
 5695
 5696
 5697
 5698
 5699
 5700
 5701
 5702
 5703
 5704
 5705
 5706
 5707
 5708
 5709
 5710
 5711
 5712
 5713
 5714
 5715
 5716
 5717
 5718
 5719
 5720
 5721
 5722
 5723
 5724
 5725
 5726
 5727
 5728
 5729
 5730
 5731
 5732
 5733
 5734
 5735
 5736
 5737
 5738
 5739
 5740
 5741
 5742
 5743
 5744
 5745
 5746
 5747
 5748
 5749
 5750
 5751
 5752
 5753
 5754
 5755
 5756
 5757
 5758
 5759
 5760
 5761
 5762
 5763
 5764
 5765
 5766
 5767
 5768
 5769
 5770
 5771
 5772
 5773
 5774
 5775
 5776
 5777
 5778
 5779
 5780
 5781
 5782
 5783
 5784
 5785
 5786
 5787
 5788
 5789
 5790
 5791
 5792
 5793
 5794
 5795
 5796
 5797
 5798
 5799
 5800
 5801
 5802
 5803
 5804
 5805
 5806
 5807
 5808
 5809
 5810
 5811
 5812
 5813
 5814
 5815
 5816
 5817
 5818
 5819
 5820
 5821
 5822
 5823
 5824
 5825
 5826
 5827
 5828
 5829
 5830
 5831
 5832
 5833
 5834
 5835
 5836
 5837
 5838
 5839
 5840
 5841
 5842
 5843
 5844
 5845
 5846
 5847
 5848
 5849
 5850
 5851
 5852
 5853
 5854
 5855
 5856
 5857
 5858
 5859
 5860
 5861
 5862
 5863
 5864
 5865
 5866
 5867
 5868
 5869
 5870
 5871
 5872
 5873
 5874
 5875
 5876
 5877
 5878
 5879
 5880
 5881
 5882
 5883
 5884
 5885
 5886
 5887
 5888
 5889
 5890
 5891
 5892
 5893
 5894
 5895
 5896
 5897
 5898
 5899
 5900
 5901
 5902
 5903
 5904
 5905
 5906
 5907
 5908
 5909
 5910
 5911
 5912
 5913
 5914
 5915
 5916
 5917
 5918
 5919
 5920
 5921
 5922
 5923
 5924
 5925
 5926
 5927
 5928
 5929
 5930
 5931
 5932
 5933
 5934
 5935
 5936
 5937
 5938
 5939
 5940
 5941
 5942
 5943
 5944
 5945
 5946
 5947
 5948
 5949
 5950
 5951
 5952
 5953
 5954
 5955
 5956
 5957
 5958
 5959
 5960
 5961
 5962
 5963
 5964
 5965
 5966
 5967
 5968
 5969
 5970
 5971
 5972
 5973
 5974
 5975
 5976
 5977
 5978
 5979
 5980
 5981
 5982
 5983
 5984
 5985
 5986
 5987
 5988
 5989
 5990
 5991
 5992
 5993
 5994
 5995
 5996
 5997
 5998
 5999
 6000
 6001
 6002
 6003
 6004
 6005
 6006
 6007
 6008
 6009
 6010
 6011
 6012
 6013
 6014
 6015
 6016
 6017
 6018
 6019
 6020
 6021
 6022
 6023
 6024
 6025
 6026
 6027
 6028
 6029
 6030
 6031
 6032
 6033
 6034
 6035
 6036
 6037
 6038
 6039
 6040
 6041
 6042
 6043
 6044
 6045
 6046
 6047
 6048
 6049
 6050
 6051
 6052
 6053
 6054
 6055
 6056
 6057
 6058
 6059
 6060
 6061
 6062
 6063
 6064
 6065
 6066
 6067
 6068
 6069
 6070
 6071
 6072
 6073
 6074
 6075
 6076
 6077
 6078
 6079
 6080
 6081
 6082
 6083
 6084
 6085
 6086
 6087
 6088
 6089
 6090
 6091
 6092
 6093
 6094
 6095
 6096
 6097
 6098
 6099
 6100
 6101
 6102
 6103
 6104
 6105
 6106
 6107
 6108
 6109
 6110
 6111
 6112
 6113
 6114
 6115
 6116
 6117
 6118
 6119
 6120
 6121
 6122
 6123
 6124
 6125
 6126
 6127
 6128
 6129
 6130
 6131
 6132
 6133
 6134
 6135
 6136
 6137
 6138
 6139
 6140
 6141
 6142
 6143
 6144
 6145
 6146
 6147
 6148
 6149
 6150
 6151
 6152
 6153
 6154
 6155
 6156
 6157
 6158
 6159
 6160
 6161
 6162
 6163
 6164
 6165
 6166
 6167
 6168
 6169
 6170
 6171
 6172
 6173
 6174
 6175
 6176
 6177
 6178
 6179
 6180
 6181
 6182
 6183
 6184
 6185
 6186
 6187
 6188
 6189
 6190
 6191
 6192
 6193
 6194
 6195
 6196
 6197
 6198
 6199
 6200
 6201
 6202
 6203
 6204
 6205
 6206
 6207
 6208
 6209
 6210
 6211
 6212
 6213
 6214
 6215
 6216
 6217
 6218
 6219
 6220
 6221
 6222
 6223
 6224
 6225
 6226
 6227
 6228
 6229
 6230
 6231
 6232
 6233
 6234
 6235
 6236
 6237
 6238
 6239
 6240
 6241
 6242
 6243
 6244
 6245
 6246
 6247
 6248
 6249
 6250
 6251
 6252
 6253
 6254
 6255
 6256
 6257
 6258
 6259
 6260
 6261
 6262
 6263
 6264
 6265
 6266
 6267
 6268
 6269
 6270
 6271
 6272
 6273
 6274
 6275
 6276
 6277
 6278
 6279
 6280
 6281
 6282
 6283
 6284
 6285
 6286
 6287
 6288
 6289
 6290
 6291
 6292
 6293
 6294
 6295
 6296
 6297
 6298
 6299
 6300
 6301
 6302
 6303
 6304
 6305
 6306
 6307
 6308
 6309
 6310
 6311
 6312
 6313
 6314
 6315
 6316
 6317
 6318
 6319
 6320
 6321
 6322
 6323
 6324
 6325
 6326
 6327
 6328
 6329
 6330
 6331
 6332
 6333
 6334
 6335
 6336
 6337
 6338
 6339
 6340
 6341
 6342
 6343
 6344
 6345
 6346
 6347
 6348
 6349
 6350
 6351
 6352
 6353
 6354
 6355
 6356
 6357
 6358
 6359
 6360
 6361
 6362
 6363
 6364
 6365
 6366
 6367
 6368
 6369
 6370
 6371
 6372
 6373
 6374
 6375
 6376
 6377
 6378
 6379
 6380
 6381
 6382
 6383
 6384
 6385
 6386
 6387
 6388
 6389
 6390
 6391
 6392
 6393
 6394
 6395
 6396
 6397
 6398
 6399
 6400
 6401
 6402
 6403
 6404
 6405
 6406
 6407
 6408
 6409
 6410
 6411
 6412
 6413
 6414
 6415
 6416
 6417
 6418
 6419
 6420
 6421
 6422
 6423
 6424
 6425
 6426
 6427
 6428
 6429
 6430
 6431
 6432
 6433
 6434
 6435
 6436
 6437
 6438
 6439
 6440
 6441
 6442
 6443
 6444
 6445
 6446
 6447
 6448
 6449
 6450
 6451
 6452
 6453
 6454
 6455
 6456
 6457
 6458
 6459
 6460
 6461
 6462
 6463
 6464
 6465
 6466
 6467
 6468
 6469
 6470
 6471
 6472
 6473
 6474
 6475
 6476
 6477
 6478
 6479
 6480
 6481
 6482
 6483
 6484
 6485
 6486
 6487
 6488
 6489
 6490
 6491
 6492
 6493
 6494
 6495
 6496
 6497
 6498
 6499
 6500
 6501
 6502
 6503
 6504
 6505
 6506
 6507
 6508
 6509
 6510
 6511
 6512
 6513
 6514
 6515
 6516
 6517
 6518
 6519
 6520
 6521
 6522
 6523
 6524
 6525
 6526
 6527
 6528
 6529
 6530
 6531
 6532
 6533
 6534
 6535
 6536
 6537
 6538
 6539
 6540
 6541
 6542
 6543
 6544
 6545
 6546
 6547
 6548
 6549
 6550
 6551
 6552
 6553
 6554
 6555
 6556
 6557
 6558
 6559
 6560
 6561
 6562
 6563
 6564
 6565
 6566
 6567
 6568
 6569
 6570
 6571
 6572
 6573
 6574
 6575
 6576
 6577
 6578
 6579
 6580
 6581
 6582
 6583
 6584
 6585
 6586
 6587
 6588
 6589
 6590
 6591
 6592
 6593
 6594
 6595
 6596
 6597
 6598
 6599
 6600
 6601
 6602
 6603
 6604
 6605
 6606
 6607
 6608
 6609
 6610
 6611
 6612
 6613
 6614
 6615
 6616
 6617
 6618
 6619
 6620
 6621
 6622
 6623
 6624
 6625
 6626
 6627
 6628
 6629
 6630
 6631
 6632
 6633
 6634
 6635
 6636
 6637
 6638
 6639
 6640
 6641
 6642
 6643
 6644
 6645
 6646
 6647
 6648
 6649
 6650
 6651
 6652
 6653
 6654
 6655
 6656
 6657
 6658
 6659
 6660
 6661
 6662
 6663
 6664
 6665
 6666
 6667
 6668
 6669
 6670
 6671
 6672
 6673
 6674
 6675
 6676
 6677
 6678
 6679
 6680
 6681
 6682
 6683
 6684
 6685
 6686
 6687
 6688
 6689
 6690
 6691
 6692
 6693
 6694
 6695
 6696
 6697
 6698
 6699
 6700
 6701
 6702
 6703
 6704
 6705
 6706
 6707
 6708
 6709
 6710
 6711
 6712
 6713
 6714
 6715
 6716
 6717
 6718
 6719
 6720
 6721
 6722
 6723
 6724
 6725
 6726
 6727
 6728
 6729
 6730
 6731
 6732
 6733
 6734
 6735
 6736
 6737
 6738
 6739
 6740
 6741
 6742
 6743
 6744
 6745
 6746
 6747
 6748
 6749
 6750
 6751
 6752
 6753
 6754
 6755
 6756
 6757
 6758
 6759
 6760
 6761
 6762
 6763
 6764
 6765
 6766
 6767
 6768
 6769
 6770
 6771
 6772
 6773
 6774
 6775
 6776
 6777
 6778
 6779
 6780
 6781
 6782
 6783
 6784
 6785
 6786
 6787
 6788
 6789
 6790
 6791
 6792
 6793
 6794
 6795
 6796
 6797
 6798
 6799
 6800
 6801
 6802
 6803
 6804
 6805
 6806
 6807
 6808
 6809
 6810
 6811
 6812
 6813
 6814
 6815
 6816
 6817
 6818
 6819
 6820
 6821
 6822
 6823
 6824
 6825
 6826
 6827
 6828
 6829
 6830
 6831
 6832
 6833
 6834
 6835
 6836
 6837
 6838
 6839
 6840
 6841
 6842
 6843
 6844
 6845
 6846
 6847
 6848
 6849
 6850
 6851
 6852
 6853
 6854
 6855
 6856
 6857
 6858
 6859
 6860
 6861
 6862
 6863
 6864
 6865
 6866
 6867
 6868
 6869
 6870
 6871
 6872
 6873
 6874
 6875
 6876
 6877
 6878
 6879
 6880
 6881
 6882
 6883
 6884
 6885
 6886
 6887
 6888
 6889
 6890
 6891
 6892
 6893
 6894
 6895
 6896
 6897
 6898
 6899
 6900
 6901
 6902
 6903
 6904
 6905
 6906
 6907
 6908
 6909
 6910
 6911
 6912
 6913
 6914
 6915
 6916
 6917
 6918
 6919
 6920
 6921
 6922
 6923
 6924
 6925
 6926
 6927
 6928
 6929
 6930
 6931
 6932
 6933
 6934
 6935
 6936
 6937
 6938
 6939
 6940
 6941
 6942
 6943
 6944
 6945
 6946
 6947
 6948
 6949
 6950
 6951
 6952
 6953
 6954
 6955
 6956
 6957
 6958
 6959
 6960
 6961
 6962
 6963
 6964
 6965
 6966
 6967
 6968
 6969
 6970
 6971
 6972
 6973
 6974
 6975
 6976
 6977
 6978
 6979
 6980
 6981
 6982
 6983
 6984
 6985
 6986
 6987
 6988
 6989
 6990
 6991
 6992
 6993
 6994
 6995
 6996
 6997
 6998
 6999
 7000
 7001
 7002
 7003
 7004
 7005
 7006
 7007
 7008
 7009
 7010
 7011
 7012
 7013
 7014
 7015
 7016
 7017
 7018
 7019
 7020
 7021
 7022
 7023
 7024
 7025
 7026
 7027
 7028
 7029
 7030
 7031
 7032
 7033
 7034
 7035
 7036
 7037
 7038
 7039
 7040
 7041
 7042
 7043
 7044
 7045
 7046
 7047
 7048
 7049
 7050
 7051
 7052
 7053
 7054
 7055
 7056
 7057
 7058
 7059
 7060
 7061
 7062
 7063
 7064
 7065
 7066
 7067
 7068
 7069
 7070
 7071
 7072
 7073
 7074
 7075
 7076
 7077
 7078
 7079
 7080
 7081
 7082
 7083
 7084
 7085
 7086
 7087
 7088
 7089
 7090
 7091
 7092
 7093
 7094
 7095
 7096
 7097
 7098
 7099
 7100
 7101
 7102
 7103
 7104
 7105
 7106
 7107
 7108
 7109
 7110
 7111
 7112
 7113
 7114
 7115
 7116
 7117
 7118
 7119
 7120
 7121
 7122
 7123
 7124
 7125
 7126
 7127
 7128
 7129
 7130
 7131
 7132
 7133
 7134
 7135
 7136
 7137
 7138
 7139
 7140
 7141
 7142
 7143
 7144
 7145
 7146
 7147
 7148
 7149
 7150
 7151
 7152
 7153
 7154
 7155
 7156
 7157
 7158
 7159
 7160
 7161
 7162
 7163
 7164
 7165
 7166
 7167
 7168
 7169
 7170
 7171
 7172
 7173
 7174
 7175
 7176
 7177
 7178
 7179
 7180
 7181
 7182
 7183
 7184
 7185
 7186
 7187
 7188
 7189
 7190
 7191
 7192
 7193
 7194
 7195
 7196
 7197
 7198
 7199
 7200
 7201
 7202
 7203
 7204
 7205
 7206
 7207
 7208
 7209
 7210
 7211
 7212
 7213
 7214
 7215
 7216
 7217
 7218
 7219
 7220
 7221
 7222
 7223
 7224
 7225
 7226
 7227
 7228
 7229
 7230
 7231
 7232
 7233
 7234
 7235
 7236
 7237
 7238
 7239
 7240
 7241
 7242
 7243
 7244
 7245
 7246
 7247
 7248
 7249
 7250
 7251
 7252
 7253
 7254
 7255
 7256
 7257
 7258
 7259
 7260
 7261
 7262
 7263
 7264
 7265
 7266
 7267
 7268
 7269
 7270
 7271
 7272
 7273
 7274
 7275
 7276
 7277
 7278
 7279
 7280
 7281
 7282
 7283
 7284
 7285
 7286
 7287
 7288
 7289
 7290
 7291
 7292
 7293
 7294
 7295
 7296
 7297
 7298
 7299
 7300
 7301
 7302
 7303
 7304
 7305
 7306
 7307
 7308
 7309
 7310
 7311
 7312
 7313
 7314
 7315
 7316
 7317
 7318
 7319
 7320
 7321
 7322
 7323
 7324
 7325
 7326
 7327
 7328
 7329
 7330
 7331
 7332
 7333
 7334
 7335
 7336
 7337
 7338
 7339
 7340
 7341
 7342
 7343
 7344
 7345
 7346
 7347
 7348
 7349
 7350
 7351
 7352
 7353
 7354
 7355
 7356
 7357
 7358
 7359
 7360
 7361
 7362
 7363
 7364
 7365
 7366
 7367
 7368
 7369
 7370
 7371
 7372
 7373
 7374
 7375
 7376
 7377
 7378
 7379
 7380
 7381
 7382
 7383
 7384
 7385
 7386
 7387
 7388
 7389
 7390
 7391
 7392
 7393
 7394
 7395
 7396
 7397
 7398
 7399
 7400
 7401
 7402
 7403
 7404
 7405
 7406
 7407
 7408
 7409
 7410
 7411
 7412
 7413
 7414
 7415
 7416
 7417
 7418
 7419
 7420
 7421
 7422
 7423
 7424
 7425
 7426
 7427
 7428
 7429
 7430
 7431
 7432
 7433
 7434
 7435
 7436
 7437
 7438
 7439
 7440
 7441
 7442
 7443
 7444
 7445
 7446
 7447
 7448
 7449
 7450
 7451
 7452
 7453
 7454
 7455
 7456
 7457
 7458
 7459
 7460
 7461
 7462
 7463
 7464
 7465
 7466
 7467
 7468
 7469
 7470
 7471
 7472
 7473
 7474
 7475
 7476
 7477
 7478
 7479
 7480
 7481
 7482
 7483
 7484
 7485
 7486
 7487
 7488
 7489
 7490
 7491
 7492
 7493
 7494
 7495
 7496
 7497
 7498
 7499
 7500
 7501
 7502
 7503
 7504
 7505
 7506
 7507
 7508
 7509
 7510
 7511
 7512
 7513
 7514
 7515
 7516
 7517
 7518
 7519
 7520
 7521
 7522
 7523
 7524
 7525
 7526
 7527
 7528
 7529
 7530
 7531
 7532
 7533
 7534
 7535
 7536
 7537
 7538
 7539
 7540
 7541
 7542
 7543
 7544
 7545
 7546
 7547
 7548
 7549
 7550
 7551
 7552
 7553
 7554
 7555
 7556
 7557
 7558
 7559
 7560
 7561
 7562
 7563
 7564
 7565
 7566
 7567
 7568
 7569
 7570
 7571
 7572
 7573
 7574
 7575
 7576
 7577
 7578
 7579
 7580
 7581
 7582
 7583
 7584
 7585
 7586
 7587
 7588
 7589
 7590
 7591
 7592
 7593
 7594
 7595
 7596
 7597
 7598
 7599
 7600
 7601
 7602
 7603
 7604
 7605
 7606
 7607
 7608
 7609
 7610
 7611
 7612
 7613
 7614
 7615
 7616
 7617
 7618
 7619
 7620
 7621
 7622
 7623
 7624
 7625
 7626
 7627
 7628
 7629
 7630
 7631
 7632
 7633
 7634
 7635
 7636
 7637
 7638
 7639
 7640
 7641
 7642
 7643
 7644
 7645
 7646
 7647
 7648
 7649
 7650
 7651
 7652
 7653
 7654
 7655
 7656
 7657
 7658
 7659
 7660
 7661
 7662
 7663
 7664
 7665
 7666
 7667
 7668
 7669
 7670
 7671
 7672
 7673
 7674
 7675
 7676
 7677
 7678
 7679
 7680
 7681
 7682
 7683
 7684
 7685
 7686
 7687
 7688
 7689
 7690
 7691
 7692
 7693
 7694
 7695
 7696
 7697
 7698
 7699
 7700
 7701
 7702
 7703
 7704
 7705
 7706
 7707
 7708
 7709
 7710
 7711
 7712
 7713
 7714
 7715
 7716
 7717
 7718
 7719
 7720
 7721
 7722
 7723
 7724
 7725
 7726
 7727
 7728
 7729
 7730
 7731
 7732
 7733
 7734
 7735
 7736
 7737
 7738
 7739
 7740
 7741
 7742
 7743
 7744
 7745
 7746
 7747
 7748
 7749
 7750
 7751
 7752
 7753
 7754
 7755
 7756
 7757
 7758
 7759
 7760
 7761
 7762
 7763
 7764
 7765
 7766
 7767
 7768
 7769
 7770
 7771
 7772
 7773
 7774
 7775
 7776
 7777
 7778
 7779
 7780
 7781
 7782
 7783
 7784
 7785
 7786
 7787
 7788
 7789
 7790
 7791
 7792
 7793
 7794
 7795
 7796
 7797
 7798
 7799
 7800
 7801
 7802
 7803
 7804
 7805
 7806
 7807
 7808
 7809
 7810
 7811
 7812
 7813
 7814
 7815
 7816
 7817
 7818
 7819
 7820
 7821
 7822
 7823
 7824
 7825
 7826
 7827
 7828
 7829
 7830
 7831
 7832
 7833
 7834
 7835
 7836
 7837
 7838
 7839
 7840
 7841
 7842
 7843
 7844
 7845
 7846
 7847
 7848
 7849
 7850
 7851
 7852
 7853
 7854
 7855
 7856
 7857
 7858
 7859
 7860
 7861
 7862
 7863
 7864
 7865
 7866
 7867
 7868
 7869
 7870
 7871
 7872
 7873
 7874
 7875
 7876
 7877
 7878
 7879
 7880
 7881
 7882
 7883
 7884
 7885
 7886
 7887
 7888
 7889
 7890
 7891
 7892
 7893
 7894
 7895
 7896
 7897
 7898
 7899
 7900
 7901
 7902
 7903
 7904
 7905
 7906
 7907
 7908
 7909
 7910
 7911
 7912
 7913
 7914
 7915
 7916
 7917
 7918
 7919
 7920
 7921
 7922
 7923
 7924
 7925
 7926
 7927
 7928
 7929
 7930
 7931
 7932
 7933
 7934
 7935
 7936
 7937
 7938
 7939
 7940
 7941
 7942
 7943
 7944
 7945
 7946
 7947
 7948
 7949
 7950
 7951
 7952
 7953
 7954
 7955
 7956
 7957
 7958
 7959
 7960
 7961
 7962
 7963
 7964
 7965
 7966
 7967
 7968
 7969
 7970
 7971
 7972
 7973
 7974
 7975
 7976
 7977
 7978
 7979
 7980
 7981
 7982
 7983
 7984
 7985
 7986
 7987
 7988
 7989
 7990
 7991
 7992
 7993
 7994
 7995
 7996
 7997
 7998
 7999
 8000
 8001
 8002
 8003
 8004
 8005
 8006
 8007
 8008
 8009
 8010
 8011
 8012
 8013
 8014
 8015
 8016
 8017
 8018
 8019
 8020
 8021
 8022
 8023
 8024
 8025
 8026
 8027
 8028
 8029
 8030
 8031
 8032
 8033
 8034
 8035
 8036
 8037
 8038
 8039
 8040
 8041
 8042
 8043
 8044
 8045
 8046
 8047
 8048
 8049
 8050
 8051
 8052
 8053
 8054
 8055
 8056
 8057
 8058
 8059
 8060
 8061
 8062
 8063
 8064
 8065
 8066
 8067
 8068
 8069
 8070
 8071
 8072
 8073
 8074
 8075
 8076
 8077
 8078
 8079
 8080
 8081
 8082
 8083
 8084
 8085
 8086
 8087
 8088
 8089
 8090
 8091
 8092
 8093
 8094
 8095
 8096
 8097
 8098
 8099
 8100
 8101
 8102
 8103
 8104
 8105
 8106
 8107
 8108
 8109
 8110
 8111
 8112
 8113
 8114
 8115
 8116
 8117
 8118
 8119
 8120
 8121
 8122
 8123
 8124
 8125
 8126
 8127
 8128
 8129
 8130
 8131
 8132
 8133
 8134
 8135
 8136
 8137
 8138
 8139
 8140
 8141
 8142
 8143
 8144
 8145
 8146
 8147
 8148
 8149
 8150
 8151
 8152
 8153
 8154
 8155
 8156
 8157
 8158
 8159
 8160
 8161
 8162
 8163
 8164
 8165
 8166
 8167
 8168
 8169
 8170
 8171
 8172
 8173
 8174
 8175
 8176
 8177
 8178
 8179
 8180
 8181
 8182
 8183
 8184
 8185
 8186
 8187
 8188
 8189
 8190
 8191
 8192
 8193
 8194
 8195
 8196
 8197
 8198
 8199
 8200
 8201
 8202
 8203
 8204
 8205
 8206
 8207
 8208
 8209
 8210
 8211
 8212
 8213
 8214
 8215
 8216
 8217
 8218
 8219
 8220
 8221
 8222
 8223
 8224
 8225
 8226
 8227
 8228
 8229
 8230
 8231
 8232
 8233
 8234
 8235
 8236
 8237
 8238
 8239
 8240
 8241
 8242
 8243
 8244
 8245
 8246
 8247
 8248
 8249
 8250
 8251
 8252
 8253
 8254
 8255
 8256
 8257
 8258
 8259
 8260
 8261
 8262
 8263
 8264
 8265
 8266
 8267
 8268
 8269
 8270
 8271
 8272
 8273
 8274
 8275
 8276
 8277
 8278
 8279
 8280
 8281
 8282
 8283
 8284
 8285
 8286
 8287
 8288
 8289
 8290
 8291
 8292
 8293
 8294
 8295
 8296
 8297
 8298
 8299
 8300
 8301
 8302
 8303
 8304
 8305
 8306
 8307
 8308
 8309
 8310
 8311
 8312
 8313
 8314
 8315
 8316
 8317
 8318
 8319
 8320
 8321
 8322
 8323
 8324
 8325
 8326
 8327
 8328
 8329
 8330
 8331
 8332
 8333
 8334
 8335
 8336
 8337
 8338
 8339
 8340
 8341
 8342
 8343
 8344
 8345
 8346
 8347
 8348
 8349
 8350
 8351
 8352
 8353
 8354
 8355
 8356
 8357
 8358
 8359
 8360
 8361
 8362
 8363
 8364
 8365
 8366
 8367
 8368
 8369
 8370
 8371
 8372
 8373
 8374
 8375
 8376
 8377
 8378
 8379
 8380
 8381
 8382
 8383
 8384
 8385
 8386
 8387
 8388
 8389
 8390
 8391
 8392
 8393
 8394
 8395
 8396
 8397
 8398
 8399
 8400
 8401
 8402
 8403
 8404
 8405
 8406
 8407
 8408
 8409
 8410
 8411
 8412
 8413
 8414
 8415
 8416
 8417
 8418
 8419
 8420
 8421
 8422
 8423
 8424
 8425
 8426
 8427
 8428
 8429
 8430
 8431
 8432
 8433
 8434
 8435
 8436
 8437
 8438
 8439
 8440
 8441
 8442
 8443
 8444
 8445
 8446
 8447
 8448
 8449
 8450
 8451
 8452
 8453
 8454
 8455
 8456
 8457
 8458
 8459
 8460
 8461
 8462
 8463
 8464
 8465
 8466
 8467
 8468
 8469
 8470
 8471
 8472
 8473
 8474
 8475
 8476
 8477
 8478
 8479
 8480
 8481
 8482
 8483
 8484
 8485
 8486
 8487
 8488
 8489
 8490
 8491
 8492
 8493
 8494
 8495
 8496
 8497
 8498
 8499
 8500
 8501
 8502
 8503
 8504
 8505
 8506
 8507
 8508
 8509
 8510
 8511
 8512
 8513
 8514
 8515
 8516
 8517
 8518
 8519
 8520
 8521
 8522
 8523
 8524
 8525
 8526
 8527
 8528
 8529
 8530
 8531
 8532
 8533
 8534
 8535
 8536
 8537
 8538
 8539
 8540
 8541
 8542
 8543
 8544
 8545
 8546
 8547
 8548
 8549
 8550
 8551
 8552
 8553
 8554
 8555
 8556
 8557
 8558
 8559
 8560
 8561
 8562
 8563
 8564
 8565
 8566
 8567
 8568
 8569
 8570
 8571
 8572
 8573
 8574
 8575
 8576
 8577
 8578
 8579
 8580
 8581
 8582
 8583
 8584
 8585
 8586
 8587
 8588
 8589
 8590
 8591
 8592
 8593
 8594
 8595
 8596
 8597
 8598
 8599
 8600
 8601
 8602
 8603
 8604
 8605
 8606
 8607
 8608
 8609
 8610
 8611
 8612
 8613
 8614
 8615
 8616
 8617
 8618
 8619
 8620
 8621
 8622
 8623
 8624
 8625
 8626
 8627
 8628
 8629
 8630
 8631
 8632
 8633
 8634
 8635
 8636
 8637
 8638
 8639
 8640
 8641
 8642
 8643
 8644
 8645
 8646
 8647
 8648
 8649
 8650
 8651
 8652
 8653
 8654
 8655
 8656
 8657
 8658
 8659
 8660
 8661
 8662
 8663
 8664
 8665
 8666
 8667
 8668
 8669
 8670
 8671
 8672
 8673
 8674
 8675
 8676
 8677
 8678
 8679
 8680
 8681
 8682
 8683
 8684
 8685
 8686
 8687
 8688
 8689
 8690
 8691
 8692
 8693
 8694
 8695
 8696
 8697
 8698
 8699
 8700
 8701
 8702
 8703
 8704
 8705
 8706
 8707
 8708
 8709
 8710
 8711
 8712
 8713
 8714
 8715
 8716
 8717
 8718
 8719
 8720
 8721
 8722
 8723
 8724
 8725
 8726
 8727
 8728
 8729
 8730
 8731
 8732
 8733
 8734
 8735
 8736
 8737
 8738
 8739
 8740
 8741
 8742
 8743
 8744
 8745
 8746
 8747
 8748
 8749
 8750
 8751
 8752
 8753
 8754
 8755
 8756
 8757
 8758
 8759
 8760
 8761
 8762
 8763
 8764
 8765
 8766
 8767
 8768
 8769
 8770
 8771
 8772
 8773
 8774
 8775
 8776
 8777
 8778
 8779
 8780
 8781
 8782
 8783
 8784
 8785
 8786
 8787
 8788
 8789
 8790
 8791
 8792
 8793
 8794
 8795
 8796
 8797
 8798
 8799
 8800
 8801
 8802
 8803
 8804
 8805
 8806
 8807
 8808
 8809
 8810
 8811
 8812
 8813
 8814
 8815
 8816
 8817
 8818
 8819
 8820
 8821
 8822
 8823
 8824
 8825
 8826
 8827
 8828
 8829
 8830
 8831
 8832
 8833
 8834
 8835
 8836
 8837
 8838
 8839
 8840
 8841
 8842
 8843
 8844
 8845
 8846
 8847
 8848
 8849
 8850
 8851
 8852
 8853
 8854
 8855
 8856
 8857
 8858
 8859
 8860
 8861
 8862
 8863
 8864
 8865
 8866
 8867
 8868
 8869
 8870
 8871
 8872
 8873
 8874
 8875
 8876
 8877
 8878
 8879
 8880
 8881
 8882
 8883
 8884
 8885
 8886
 8887
 8888
 8889
 8890
 8891
 8892
 8893
 8894
 8895
 8896
 8897
 8898
 8899
 8900
 8901
 8902
 8903
 8904
 8905
 8906
 8907
 8908
 8909
 8910
 8911
 8912
 8913
 8914
 8915
 8916
 8917
 8918
 8919
 8920
 8921
 8922
 8923
 8924
 8925
 8926
 8927
 8928
 8929
 8930
 8931
 8932
 8933
 8934
 8935
 8936
 8937
 8938
 8939
 8940
 8941
 8942
 8943
 8944
 8945
 8946
 8947
 8948
 8949
 8950
 8951
 8952
 8953
 8954
 8955
 8956
 8957
 8958
 8959
 8960
 8961
 8962
 8963
 8964
 8965
 8966
 8967
 8968
 8969
 8970
 8971
 8972
 8973
 8974
 8975
 8976
 8977
 8978
 8979
 8980
 8981
 8982
 8983
 8984
 8985
 8986
 8987
 8988
 8989
 8990
 8991
 8992
 8993
 8994
 8995
 8996
 8997
 8998
 8999
 9000
 9001
 9002
 9003
 9004
 9005
 9006
 9007
 9008
 9009
 9010
 9011
 9012
 9013
 9014
 9015
 9016
 9017
 9018
 9019
 9020
 9021
 9022
 9023
 9024
 9025
 9026
 9027
 9028
 9029
 9030
 9031
 9032
 9033
 9034
 9035
 9036
 9037
 9038
 9039
 9040
 9041
 9042
 9043
 9044
 9045
 9046
 9047
 9048
 9049
 9050
 9051
 9052
 9053
 9054
 9055
 9056
 9057
 9058
 9059
 9060
 9061
 9062
 9063
 9064
 9065
 9066
 9067
 9068
 9069
 9070
 9071
 9072
 9073
 9074
 9075
 9076
 9077
 9078
 9079
 9080
 9081
 9082
 9083
 9084
 9085
 9086
 9087
 9088
 9089
 9090
 9091
 9092
 9093
 9094
 9095
 9096
 9097
 9098
 9099
 9100
 9101
 9102
 9103
 9104
 9105
 9106
 9107
 9108
 9109
 9110
 9111
 9112
 9113
 9114
 9115
 9116
 9117
 9118
 9119
 9120
 9121
 9122
 9123
 9124
 9125
 9126
 9127
 9128
 9129
 9130
 9131
 9132
 9133
 9134
 9135
 9136
 9137
 9138
 9139
 9140
 9141
 9142
 9143
 9144
 9145
 9146
 9147
 9148
 9149
 9150
 9151
 9152
 9153
 9154
 9155
 9156
 9157
 9158
 9159
 9160
 9161
 9162
 9163
 9164
 9165
 9166
 9167
 9168
 9169
 9170
 9171
 9172
 9173
 9174
 9175
 9176
 9177
 9178
 9179
 9180
 9181
 9182
 9183
 9184
 9185
 9186
 9187
 9188
 9189
 9190
 9191
 9192
 9193
 9194
 9195
 9196
 9197
 9198
 9199
 9200
 9201
 9202
 9203
 9204
 9205
 9206
 9207
 9208
 9209
 9210
 9211
 9212
 9213
 9214
 9215
 9216
 9217
 9218
 9219
 9220
 9221
 9222
 9223
 9224
 9225
 9226
 9227
 9228
 9229
 9230
 9231
 9232
 9233
 9234
 9235
 9236
 9237
 9238
 9239
 9240
 9241
 9242
 9243
 9244
 9245
 9246
 9247
 9248
 9249
 9250
 9251
 9252
 9253
 9254
 9255
 9256
 9257
 9258
 9259
 9260
 9261
 9262
 9263
 9264
 9265
 9266
 9267
 9268
 9269
 9270
 9271
 9272
 9273
 9274
 9275
 9276
 9277
 9278
 9279
 9280
 9281
 9282
 9283
 9284
 9285
 9286
 9287
 9288
 9289
 9290
 9291
 9292
 9293
 9294
 9295
 9296
 9297
 9298
 9299
 9300
 9301
 9302
 9303
 9304
 9305
 9306
 9307
 9308
 9309
 9310
 9311
 9312
 9313
 9314
 9315
 9316
 9317
 9318
 9319
 9320
 9321
 9322
 9323
 9324
 9325
 9326
 9327
 9328
 9329
 9330
 9331
 9332
 9333
 9334
 9335
 9336
 9337
 9338
 9339
 9340
 9341
 9342
 9343
 9344
 9345
 9346
 9347
 9348
 9349
 9350
 9351
 9352
 9353
 9354
 9355
 9356
 9357
 9358
 9359
 9360
 9361
 9362
 9363
 9364
 9365
 9366
 9367
 9368
 9369
 9370
 9371
 9372
 9373
 9374
 9375
 9376
 9377
 9378
 9379
 9380
 9381
 9382
 9383
 9384
 9385
 9386
 9387
 9388
 9389
 9390
 9391
 9392
 9393
 9394
 9395
 9396
 9397
 9398
 9399
 9400
 9401
 9402
 9403
 9404
 9405
 9406
 9407
 9408
 9409
 9410
 9411
 9412
 9413
 9414
 9415
 9416
 9417
 9418
 9419
 9420
 9421
 9422
 9423
 9424
 9425
 9426
 9427
 9428
 9429
 9430
 9431
 9432
 9433
 9434
 9435
 9436
 9437
 9438
 9439
 9440
 9441
 9442
 9443
 9444
 9445
 9446
 9447
 9448
 9449
 9450
 9451
 9452
 9453
 9454
 9455
 9456
 9457
 9458
 9459
 9460
 9461
 9462
 9463
 9464
 9465
 9466
 9467
 9468
 9469
 9470
 9471
 9472
 9473
 9474
 9475
 9476
 9477
 9478
 9479
 9480
 9481
 9482
 9483
 9484
 9485
 9486
 9487
 9488
 9489
 9490
 9491
 9492
 9493
 9494
 9495
 9496
 9497
 9498
 9499
 9500
 9501
 9502
 9503
 9504
 9505
 9506
 9507
 9508
 9509
 9510
 9511
 9512
 9513
 9514
 9515
 9516
 9517
 9518
 9519
 9520
 9521
 9522
 9523
 9524
 9525
 9526
 9527
 9528
 9529
 9530
 9531
 9532
 9533
 9534
 9535
 9536
 9537
 9538
 9539
 9540
 9541
 9542
 9543
 9544
 9545
 9546
 9547
 9548
 9549
 9550
 9551
 9552
 9553
 9554
 9555
 9556
 9557
 9558
 9559
 9560
 9561
 9562
 9563
 9564
 9565
 9566
 9567
 9568
 9569
 9570
 9571
 9572
 9573
 9574
 9575
 9576
 9577
 9578
 9579
 9580
 9581
 9582
 9583
 9584
 9585
 9586
 9587
 9588
 9589
 9590
 9591
 9592
 9593
 9594
 9595
 9596
 9597
 9598
 9599
 9600
 9601
 9602
 9603
 9604
 9605
 9606
 9607
 9608
 9609
 9610
 9611
 9612
 9613
 9614
 9615
 9616
 9617
 9618
 9619
 9620
 9621
 9622
 9623
 9624
 9625
 9626
 9627
 9628
 9629
 9630
 9631
 9632
 9633
 9634
 9635
 9636
 9637
 9638
 9639
 9640
 9641
 9642
 9643
 9644
 9645
 9646
 9647
 9648
 9649
 9650
 9651
 9652
 9653
 9654
 9655
 9656
 9657
 9658
 9659
 9660
 9661
 9662
 9663
 9664
 9665
 9666
 9667
 9668
 9669
 9670
 9671
 9672
 9673
 9674
 9675
 9676
 9677
 9678
 9679
 9680
 9681
 9682
 9683
 9684
 9685
 9686
 9687
 9688
 9689
 9690
 9691
 9692
 9693
 9694
 9695
 9696
 9697
 9698
 9699
 9700
 9701
 9702
 9703
 9704
 9705
 9706
 9707
 9708
 9709
 9710
 9711
 9712
 9713
 9714
 9715
 9716
 9717
 9718
 9719
 9720
 9721
 9722
 9723
 9724
 9725
 9726
 9727
 9728
 9729
 9730
 9731
 9732
 9733
 9734
 9735
 9736
 9737
 9738
 9739
 9740
 9741
 9742
 9743
 9744
 9745
 9746
 9747
 9748
 9749
 9750
 9751
 9752
 9753
 9754
 9755
 9756
 9757
 9758
 9759
 9760
 9761
 9762
 9763
 9764
 9765
 9766
 9767
 9768
 9769
 9770
 9771
 9772
 9773
 9774
 9775
 9776
 9777
 9778
 9779
 9780
 9781
 9782
 9783
 9784
 9785
 9786
 9787
 9788
 9789
 9790
 9791
 9792
 9793
 9794
 9795
 9796
 9797
 9798
 9799
 9800
 9801
 9802
 9803
 9804
 9805
 9806
 9807
 9808
 9809
 9810
 9811
 9812
 9813
 9814
 9815
 9816
 9817
 9818
 9819
 9820
 9821
 9822
 9823
 9824
 9825
 9826
 9827
 9828
 9829
 9830
 9831
 9832
 9833
 9834
 9835
 9836
 9837
 9838
 9839
 9840
 9841
 9842
 9843
 9844
 9845
 9846
 9847
 9848
 9849
 9850
 9851
 9852
 9853
 9854
 9855
 9856
 9857
 9858
 9859
 9860
 9861
 9862
 9863
 9864
 9865
 9866
 9867
 9868
 9869
 9870
 9871
 9872
 9873
 9874
 9875
 9876
 9877
 9878
 9879
 9880
 9881
 9882
 9883
 9884
 9885
 9886
 9887
 9888
 9889
 9890
 9891
 9892
 9893
 9894
 9895
 9896
 9897
 9898
 9899
 9900
 9901
 9902
 9903
 9904
 9905
 9906
 9907
 9908
 9909
 9910
 9911
 9912
 9913
 9914
 9915
 9916
 9917
 9918
 9919
 9920
 9921
 9922
 9923
 9924
 9925
 9926
 9927
 9928
 9929
 9930
 9931
 9932
 9933
 9934
 9935
 9936
 9937
 9938
 9939
 9940
 9941
 9942
 9943
 9944
 9945
 9946
 9947
 9948
 9949
 9950
 9951
 9952
 9953
 9954
 9955
 9956
 9957
 9958
 9959
 9960
 9961
 9962
 9963
 9964
 9965
 9966
 9967
 9968
 9969
 9970
 9971
 9972
 9973
 9974
 9975
 9976
 9977
 9978
 9979
 9980
 9981
 9982
 9983
 9984
 9985
 9986
 9987
 9988
 9989
 9990
 9991
 9992
 9993
 9994
 9995
 9996
 9997
 9998
 9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
.\" om.tmac
.ig
Mom -- a typesetting/document-processing macro set for groff.

Copyright (C) 2002, 2003 Free Software Foundation, Inc.
     Written by Peter Schaffter (peter@faustus.dyn.ca)

This file is part of groff.

groff is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.

groff is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License along
with groff; see the file COPYING.  If not, write to the Free Software
Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Version 1.3-a
-------------
Antoine de St-Exupéry asserted that elegance in engineering is
achieved not when there is nothing left to add, but when there is
nothing left to take away.

By those standards, mom is a Rube Goldberg contraption.  She was
created over the years while groff, and my understanding of it,
changed and evolved.  However, I'm a firm believer in "if it
ain't broke, don't fix it," so I'm leaving any major clean-up
of redundancies and whatnot for a rainy day.

Inasmuch as possible, macros that turn a feature on or off follow
a similar style.  Invoking the macro without an argument turns
the feature on.  Invoking it with any other argument turns it off.
Use of the argument OFF is recommended, but not required; users
may find other conventions preferable (e.g. NO, X, END, QUIT, etc.).

"<anything>" in the description of arguments that can be passed
to a macro means that any argument turns the feature off.
..
\#
\# ====================================================================
\#
\# Check which version of groff is being run
.if (\n[.x]\n[.y] < 118) \
.  ab You need GNU troff version 1.18 or higher to run this version of mom.
\# Check that GNU troff is being run
.if !\n[.g]=1 \
.  ab The mom macros require that you be running GNU troff.
.if \n(.C \
.   ab The groff mom macros do not work in compatibility mode.
\# Add supplementary styles
.sty \n[.fp] L       \"  Light Roman
.sty \n[.fp] LI      \"  Light Italic
.sty \n[.fp] LCD     \"  Light Condensed Roman
.sty \n[.fp] LCDI    \"  Light Condensed Italic
.sty \n[.fp] LEX     \"  Light Extended Roman
.sty \n[.fp] LEXI    \"  Light Extended Italic
.sty \n[.fp] CD      \"  Medium/Book Condensed Roman
.sty \n[.fp] CDI     \"  Medium/Book Condensed Italic
.sty \n[.fp] EX      \"  Medium/Book Extended Roman
.sty \n[.fp] EXI     \"  Medium/Book Extended Italic
.sty \n[.fp] DB      \"  DemiBold Roman
.sty \n[.fp] DBI     \"  DemiBold Italic
.sty \n[.fp] BCD     \"  Bold Condensed Roman
.sty \n[.fp] BCDI    \"  Bold Condensed Italic
.sty \n[.fp] BEX     \"  Bold Extended Roman
.sty \n[.fp] BEXI    \"  Bold Extended Italic
.sty \n[.fp] HV      \"  Heavy Roman
.sty \n[.fp] HVI     \"  Heavy Italic
.sty \n[.fp] HVCD    \"  Heavy Condensed Roman
.sty \n[.fp] HVCDI   \"  Heavy Condensed Italic
.sty \n[.fp] HVEX    \"  Heavy Extended Roman
.sty \n[.fp] HVEXI   \"  Heavy Extended Italic
.sty \n[.fp] BL      \"  Black Roman
.sty \n[.fp] BLI     \"  Black Italic
.sty \n[.fp] BLCD    \"  Black Condensed Roman
.sty \n[.fp] BLCDI   \"  Black Condensed Italic
.sty \n[.fp] BLEX    \"  Black Extended Roman
.sty \n[.fp] BLEXI   \"  Black Extended Italic
.sty \n[.fp] UBL     \"  Ultra-Black Roman
.sty \n[.fp] UBLI    \"  Ultra-Black Italic
\#
\# ====================================================================
\#
\# TYPESETTING MACROS, STRINGS, AND ALIASES
\# ========================================
\#
\# +++ALIASES+++
\#
\# Alias .als as ALIAS, and .aln (number registers) as ALIASN
\#
.als      ALIAS           als
.als      ALIASN          aln
\#
\#
\# ALIASES FOR GROFF REQUESTS
\# --------------------------
\#
.ALIAS    MAC             de
.ALIAS    BR              br
.ALIAS    SP              sp
.ALIAS    PAGELENGTH      pl
.ALIAS    SPREAD          brp
.ALIAS    ESC_CHAR        ec
.ALIAS    STRING          ds
\#
\# ALIASES FOR NUMBER REGISTERS
\# ----------------------------
\#
.ALIASN  #PT_SIZE        .ps    \"fractional point size in units
.ALIASN  #DIVER_DEPTH     dn    \"diversion depth
.ALIASN  #DIVER_WIDTH     dl    \"diversion width
.ALIASN  #TRAP_DISTANCE  .t     \"distance to next trap
.ALIASN  #LEAD           .v     \"line space (.vs, not .ls)
.ALIASN  #PAGE_LENGTH    .p     \"page length
.ALIASN  #NUM_ARGS       .$     \"number of arguments passed to a macro
.ALIASN  #INDENT         .i     \"value of current indent
\#
\# ====================================================================
\#
\# MISCELLANEOUS
\# =============
.nr #L_MARGIN \n(.o  \" Tabs, etc require #L_MARGIN
.cflags 4 /\(en      \" So slash and en-dashes get broken
.warn 8192
\#
.ig
About the warn level
--------------------

There's a lot of testing for the presence of number registers and
strings in this macro file.  Many of the registers and strings
pop into and out of existence on the fly.  For convenience, I
often use

    .if \\n[whatever]    and    .if !\\n[whatever]

to test "if the register exists and is (not) empty."  Groff,
encountering such tests when called with the -ww options, emits

    warning: number register whatever not defined.

Groff also warns about strings similarly tested for.

The warn level, above, is high in order to shut off those
warnings.  If you're futzing in this file and need more verbose
warnings, either comment out ".warn 8192" or set the warnlevel
to the one you need (but be ready for lots of what I've just
described).
..
\#
\# ====================================================================
\#
\# +++PAGE LAYOUT+++
\#
\# Macros that control the physical layout of the page: paper size
\# and margins.
\#
\# PAGE WIDTH
\# ----------
\# *Argument:
\#   <width of printer sheet>
\# *Function:
\#   Stores user supplied page width in register #PAGE_WIDTH.
\# *Notes:
\#   #PAGE_WIDTH is used to establish the default LL (and right margin).
\#   Requires unit of measure.
\#
.MAC PAGEWIDTH END
.    br
.    nr #PAGE_WIDTH \\$1
.    if !r#L_MARGIN \{ .L_MARGIN \\n(.o \}
.    if !r#R_MARGIN \{ .R_MARGIN 1i \}
.END
\#
\#
\# L_MARGIN
\# --------
\# *Argument:
\#   <offset from page left>
\# *Function:
\#   Stores user supplied page offset in register #L_MARGIN.
\#   Sets .po to user supplied offset.
\# *Notes:
\#   Requires unit of measure.
\#
.MAC L_MARGIN END
.    br
.    nr #L_MARGIN (\\$1)
.    po \\n[#L_MARGIN]u
.END
\#
\#
\# R_MARGIN
\# --------
\# *Argument:
\#   <width of right margin>
\# *Function:
\#   Stores user supplied right margin in register #R_MARGIN.
\# *Notes:
\#   This is a pseudo-margin.  Right margin is actually a function of
\#   line length.  The macro calculates line length from the page offset
\#   and the value plugged into #R_MARGIN.
\#
\#   N.B. -- PAGEWIDTH and L_MARGIN have to be defined before R_MARGIN.
\#
\#   Requires unit of measure.
\#
.MAC R_MARGIN END
.    br
.    nr #R_MARGIN (\\$1)
.    ll \\n[#PAGE_WIDTH]u-\\n[#L_MARGIN]u-\\n[#R_MARGIN]u
.    ta \\n(.lu
.    nr #L_LENGTH \\n(.l
.END
\#
\#
\# T_MARGIN
\# --------
\# *Argument:
\#   <distance to advance from top of page>
\# *Function:
\#   Stores the user supplied top margin in register #T_MARGIN.
\#   Advances user supplied depth from the top of the page.
\# *Notes:
\#   Requires unit of measure.
\#
.MAC T_MARGIN END
.    nr #T_MARGIN (\\$1)
.    nr #TOP 1
.    if !\\n[#DOCS] \{\
.       sp |\\n[#T_MARGIN]u-1v
.    \}
.    wh 0i DO_T_MARGIN
.END
\#
\#
\# B_MARGIN
\# --------
\# *Argument:
\#   <space to leave at the bottom of the page>
\# *Function:
\#   Stores the user supplied bottom margin in register #B_MARGIN.
\# *Notes:
\#   Requires unit of measure.
\#
.MAC B_MARGIN END
.    br
.    nr #B_MARGIN (\\$1)
.    nr #ORIGINAL_B_MARGIN \\n[#B_MARGIN]
.    nr #B_MARGIN_SET 1
.    wh -\\n[#B_MARGIN]u DO_B_MARGIN
.END
\#
\#
\# PAGE
\# ----
\# *Arguments:
\#   <pagewidth>  [pagelength [leftmargin [rightmargin [topmargin [bottommargin]]]]]
\# *Function:
\#   Page set-up.  Collects arguments and passes them to the appropriate
\#   macros.
\# *Notes:
\#   All arguments after pagewidth are optional, but must appear
\#   in the order given above.  (User can fill in as much or as
\#   little as desired.)
\#
\#   All arguments require a unit of measure.
\#
.MAC PAGE END
.    br
.    PAGEWIDTH   \\$1
.    PAGELENGTH  \\$2
.    ie '\\$3''  \{ .L_MARGIN \\n(.o  \}
.    el          \{ .L_MARGIN \\$3    \}
.    ie '\\$4''  \{ .R_MARGIN 1i      \}
.    el          \{ .R_MARGIN \\$4    \}
.    if !'\\$5'' \{ .T_MARGIN \\$5    \}
.    if !'\\$6'' \{ .B_MARGIN \\$6    \}
.END
\#
\# =====================================================================
\#
\# +++PAGE CONTROL+++
\#
\# Generic macros for breaking pages.
\#
\# DO_T_MARGIN
\# -----------
\# *Argument:
\#   <none>
\# *Function:
\#   Plants the top margin at the top of each page.
\# *Notes:
\#   The trap is set in .T_MARGIN or .PAGE
\#
.MAC DO_T_MARGIN END
.    ev T_MARGIN
.    nr #TOP 1
.    sp |\\n[#T_MARGIN]u-1v
.    ev
.    sp -\\n[#T_MARGIN_LEAD_ADJ]u
.END
\#
\#
\# DO_B_MARGIN
\# -----------
\# *Argument:
\#   <none>
\# *Function:
\#   Plants the bottom margin at the bottom of each page.
\# *Notes:
\#   The trap is set in .B_MARGIN or .PAGE.
\#
.MAC DO_B_MARGIN END
.    nr #T_MARGIN_LEAD_ADJ \\n[#LEAD]-12000
.    ev B_MARGIN
.    bp
.    ev
.END
\#
\#
\# NEWPAGE
\# -------
\# *Argument:
\#   <none>
\# *Function:
\#   Breaks to a new page.
\# *Notes:
\#   If a B_MARGIN has been set, processes that, otherwise, just
\#   breaks to a new page.
\#
.MAC NEWPAGE END
.    br
.    nr #NEWPAGE 1
.    ie \\n[#B_MARGIN_SET]=1 \{\
.       ie !\\n[#DOCS]=1 \{\
.          ev NP
.          bp
.          ev
.       \}
.       el \{\
.          if \\n[#COLUMNS]=1 \{ .nr #COL_NUM \\n[#NUM_COLS] \}
.          ie !\\n[#FN_DEPTH] \{\
.             ch FN_OVERFLOW_TRAP
.             DO_B_MARGIN
.             wh -(\\n[#FN_OVERFLOW_TRAP_POS]u) FN_OVERFLOW_TRAP
.          \}
.          el \{\
.             DO_B_MARGIN
.          \}
.       \}
.    \}
.    el \{\
.       DO_B_MARGIN
.    \}
.END
\#
\# =====================================================================
\#
\# +++GENERAL STYLE MACROS+++
\#
\# Macros that are likely to appear together to define general
\# type style: line length, family, font, point size, and line
\# spacing.
\#
\# LINE LENGTH
\# -----------
\# *Argument:
\#   <line length>
\# *Function:
\#   Stores user supplied line length in register #L_LENGTH.
\#   Sets .ll to #L_LENGTHu
\# *Notes:
\#   Requires unit of measure.
\#
.MAC LL END
.    nr #USER_SET_L_LENGTH 1
.    ll \\$1
.    nr #L_LENGTH \\n(.l
.    ta \\n(.lu
.END
\#
\#
\# +++FAMILY AND FONT+++
\#
\# FALLBACK FONT
\# -------------
\# *Argument:
\#   <fallback font> [ ABORT | WARN ] | ABORT | WARN
\# *Function:
\#   Sets register #ABORT_FT_ERRORS to 1, or defines a fallback font
\#   called "dummy" at font position 0.
\# *Notes:
\#   Calls to non-existent families cause mom to continue processing
\#   files using the fallback font until a valid family is entered.
\#
\#   Calls to non-existent fonts generate warnings.  If ABORT is passed
\#   to FALLBACK_FONT, mom stops processing files after the warning.
\#   Otherwise, she continues to process files using the fallback font
\#   after the warning is issued.  The default fallback font is CR; the
\#   default for font warnings is to abort.
\#
.MAC FALLBACK_FONT END
.    if \\n[#NUM_ARGS]=1 \{\
.       if '\\$1'ABORT' \{ .nr #ABORT_FT_ERRORS 1 \}
.       if '\\$1'WARN' \{\
.          if r#ABORT_FT_ERRORS \{ .nr #ABORT_FT_ERRORS 0 \}
.       \}
.       if !'\\$1'ABORT' \{\
.          if !'\\$1'WARN' \{\
.             fp 0 dummy \\$1
.          \}
.       \}
.    \}
.    if \\n[#NUM_ARGS]=2 \{\
.       fp 0 dummy \\$1
.       if '\\$2'ABORT' \{ .nr #ABORT_FT_ERRORS 1 \}
.       if '\\$2'WARN'  \{ .nr #ABORT_FT_ERRORS 0 \}
.    \}
.END
\#
.FALLBACK_FONT CR ABORT
\#
\# FAMILY
\# ------
\# *Argument:
\#   <font family>
\# *Function:
\#   Stores user supplied font family in string $FAMILY.  Sets .fam
\#   to $FAMILY.
\#
.MAC FAMILY END
.    if \\n[#PRINT_STYLE]=1 \{\
.       fam C
.       return
.    \}
.    if \\n[#IGNORE] \{\
.       fam C
.       return
.    \}
.    if (\\n[.x]\\n[.y]\\n[.Y] >= 1192) \{\
.       ds $SAVED_STYLE \\n[.sty]
.    \}
.    ds $FAMILY \\$1
.    ft 0
.    fam \\*[$FAMILY]
.    if (\\n[.x]\\n[.y]\\n[.Y] >= 1192) \{\
.       ft \\*[$SAVED_STYLE]
.       if !F\\n[.fn] \{\
.          ft 0
.       \}
.    \}
.    if \\n[#COLLATE]=1 \{\
.       if !r#START \{ .DOC_FAM \\*[$FAMILY] \}
.    \}
.END
\#
\#
\# FONT
\# ----
\# *Argument:
\#   R | I | B | BI | <other style extension>
\# *Function:
\#  Stores user supplied font in $FONT and sets .ft to $FONT.
\#
.MAC FT END
.    if \\n[#PRINT_STYLE]=1 \{\
.       ie '\\$1'I' \{\
.          if \\n[#UNDERLINE_ITALIC]=1 \{\
.             UNDERLINE
.             return
.          \}
.          if \\n[#ITALIC_MEANS_ITALIC]=1 \{\
.             ds $FONT \\$1
.             ft \\*[$FONT]
.             return
.          \}
.       \}
.       el \{ .UNDERLINE OFF \}
.       return
.    \}
.    ds $FONT \\$1
.    ft 0
.    ft \\*[$FONT]
.    if if (\\n[.x]\\n[.y]\\n[.Y] >= 1192) \{\
.       if '\\n[.sty]'' \{\
.          if !F\\n[.fn] \{\
.             if !S\\*[$FONT] \{\
.                tm1 "[mom]: Font style "\\*[$FONT]" at line \\n(.c has not been registered.
.                ie \\n[#ABORT_FT_ERRORS]=0 \{\
.                   tm1 "       Continuing to process using fallback font.
.                \}
.                el .ab Aborting.
.             \}
.             if \\n[.f]=0 \{\
.                tm1 "[mom]: Either font style "\\*[$FONT]" at line \\n(.c does not exist in family "\\n[.fam]",
.                tm1 "       or family "\\n[.fam]" has not been installed in font/devps.
.                ie \\n[#ABORT_FT_ERRORS]=0 \{\
.                   tm1 "       Continuing to process using fallback font.
.                \}
.                el .ab Aborting.
.             \}
.          \}
.       \}
.    \}
.END
\#
\#
\# POINT SIZE
\# ----------
\# *Arguments:
\#   <point size of type>
\# *Function:
\#   Sets point size to user supplied value in scaled points.
\#   If #AUTO_LEAD is on, sets .vs to #AUTOLEAD_VALUE+#PT_SIZE.
\# *Notes:
\#   Must NOT use a unit of measure.
\#
.MAC PT_SIZE END
.    if \\n[#PRINT_STYLE]=1 \{ .return \}
.    if \\n[#IGNORE]        \{ .return \}
.    nr #PT_SIZE_SET 1
.    ps \\$1
.    if \\n[#AUTO_LEAD] \{\
.       ie \\n[#AUTOLEAD_FACTOR] \{ .vs \\n[#PT_SIZE]u*\\n[#AUTOLEAD_VALUE]u/1000u \}
.       el \{ .vs \\n[#PT_SIZE]u+\\n[#AUTOLEAD_VALUE]u \}
.    \}
.    nr #PT_SIZE_IN_UNITS \\n[.ps]
.END
\#
\#
\# SIZE (inline)
\# -------------
\# *Arguments:
\#   <point size of type>
\# *Function:
\#   Sets point size to user supplied value in scaled points.
\#   Intended to be called inline with \*[SIZE <n><unit>]
\# *Notes:
\#   Can be used with a unit of measure or not.
\#
.MAC SIZE END
\c
.ps \\$1
.END
\#
\#
\# LEADING
\# -------
\# *Argument:
\#   <leading between lines of text>
\# *Function:
\#   Turns off #AUTOLEAD if it's on.
\#   Sets .vs to user supplied value.
\# *Notes:
\#   Does not require unit of measure.  LS automatically turns off AUTOLEAD.
\#
.MAC LS END
.    br
.    nr #OLD_LEAD \\n(.v
.    if \\n[#PRINT_STYLE]=1 \{ .return \}
.    if \\n[#IGNORE]        \{ .return \}
.    if \\n[#AUTO_LEAD] \{\
.       rr #AUTO_LEAD
.       rr #AUTOLEAD_FACTOR
.    \}
.    vs \\$1
.    if \\n[#TOP] \{\
.       nr #TOP_BASELINE_ADJ \\n(.v-\\n[#OLD_LEAD]
.       sp -\\n[#TOP_BASELINE_ADJ]u
.       rr #TOP
.       rr #TOP_BASELINE_ADJ
.    \}
.END
\#
.MAC RESET_LEAD END
'    vs
.    ch RESET_LEAD
.END
\#
\#
\# AUTOLEAD
\# --------
\# *Argument:
\#   <leading value to add to #PT_SIZE> [FACTOR]
\# *Function:
\#   Stores user supplied auto-lead value in register #AUTOLEAD_VALUE.
\#   Adds #AUT0LEAD_VALUE to #PT_SIZE when invoked to set leading.
\#   All subsequent PT_SIZE requests reset the leading in the same way until
\#   AUTOLEAD is turned off.
\# *Notes:
\#   With the optional FACTOR argument, the current point size is
\#   multiplied by #AUTOLEAD_VALUE instead of the two being added
\#   together.
\#
.MAC AUTOLEAD END
.    if \\n[#PRINT_STYLE]=1 \{ .return \}
.    if \\n[#IGNORE]        \{ .return \}
.    nr #AUTO_LEAD 1
.    nr #OLD_LEAD \\n(.v
.    nr #AUTOLEAD_VALUE (p;\\$1)
.    ie \\n[#NUM_ARGS]=2 \{\
.       if '\\$2'FACTOR' \{\
.          nr #AUTOLEAD_FACTOR 1
.          vs \\n[#PT_SIZE]u*\\n[#AUTOLEAD_VALUE]u/1000u
.       \}
.    \}
.    el \{\
.       vs \\n[#PT_SIZE]u+\\n[#AUTOLEAD_VALUE]u
.    \}
.    if \\n[#TOP] \{\
.       nr #TOP_BASELINE_ADJ \\n(.v-\\n[#OLD_LEAD]
.       sp -\\n[#TOP_BASELINE_ADJ]u
.       rr #TOP
.       rr #TOP_BASELINE_ADJ
.    \}
.END
\#
\#
\# STRINGS FOR INLINE CONTROL OF GENERAL TYPE STYLE
\# ------------------------------------------------
.ds ROM  \EfR
.ds IT   \EfI
.ds BD   \EfB
.ds BDI  \Ef(BI
.ds PREV \EfP
.ds S    \Es
\#
\# =====================================================================
\#
\# +++KERNING+++
\#
\# AUTOMATIC PAIRWISE KERNING
\# --------------------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Turns automatic pairwise kerning on or off.
\#
.MAC KERN END
.    ie '\\$1'' \{\
.       kern
.       nr #KERN 1
.    \}
.    el \{\
.       kern 0
.       nr #KERN 0
.    \}
.END
\#
\#
.ig
INLINE KERNING AND HORIZONTAL MOVEMENT
--------------------------------------
Kerning

Inline kerning provides a simple method for users to adjust the
amount of space between any two letters.  It's predicated on a
unit of measure "U", which is 1/36 of the current point size as
returned by \n[.ps].  E.g., if the current point size is 18,
\n[.ps] returns 18000u, therefore U=500u.  Since U remains
proportional relative to the current point size, the amount
of kerning between two letters as expressed in Us remains
visually similar regardless of changes in point size.

N.B.--the amount of inline kerning supplied by \*[BU<n>] or
\*[FU<n>] is added to or subtracted from any kerning that already
takes place between two characters when automatic kerning is
turned on.

In groff v. 1.17.2, it was not possible to pass arguments to macros that
were called with inline escapes, nor thence to evaluate conditional
expressions.  Consequently, each pseudo-escape \[BU<n>] had to be defined
separately with ".char".

As of v. 1.18, one can pass arguments to inline strings/macros,
hence it is now possible to do \*[BU n] where n, inline, is the desired
number of kern units.  The original .char definitions have been left in
for backward compatibility with documents created prior to mom-1.1.3c.
..
\#
.nr #KERN_UNIT 36
.ds BU   \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*\\$1u)'
.ds FU   \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*\\$1u)'
\#
\# Initialize strings for pre-1.1.3c-style BU and FU
\#
.nr #LOOP 0 1
.while \n+[#LOOP]<37 \{\
.   ds BU\n[#LOOP]  \h'-(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*\n[#LOOP]u)'
.\}
\#
.nr #LOOP 0 1
.while \n+[#LOOP]<37 \{\
.   ds FU\n[#LOOP]  \h'(\En[#PT_SIZE]u/\n[#KERN_UNIT]u*\n[#LOOP]u)'
.\}
.rr #LOOP
\#
.ig
Horizontal movements

BP1...12.75 and FP1...12.75 move backwards or forwards inline by the
specified number of points.
Left in for backward compatibility with mom-1.1.3c, the
preferred methods for inline horizontal movements are now
\*[BCK <n><unit>] and \*[FWD <n><unit>].
..
\#
.ds BCK  \h'-\\$1'
.ds FWD  \h'\\$1'
\#
.ds BP.25    \h'-.25'
.ds BP.5     \h'-.5'
.ds BP.75    \h'-.75'
.ds BP1      \h'-1p'
.ds BP1.25   \h'-1.25p'
.ds BP1.5    \h'-1.5p'
.ds BP1.75   \h'-1.75p'
.ds BP2      \h'-2p'
.ds BP2.25   \h'-2.25p'
.ds BP2.5    \h'-2.5p'
.ds BP2.75   \h'-2.75p'
.ds BP3      \h'-3p'
.ds BP3.25   \h'-3.25p'
.ds BP3.5    \h'-3.5p'
.ds BP3.75   \h'-3.75p'
.ds BP4      \h'-4p'
.ds BP4.25   \h'-4.25p'
.ds BP4.5    \h'-4.5p'
.ds BP4.75   \h'-4.75p'
.ds BP5      \h'-5p'
.ds BP5.25   \h'-5.25p'
.ds BP5.5    \h'-5.5p'
.ds BP5.75   \h'-5.75p'
.ds BP6      \h'-6p'
.ds BP6.25   \h'-6.25p'
.ds BP6.5    \h'-6.5p'
.ds BP6.75   \h'-6.75p'
.ds BP7      \h'-7p'
.ds BP7.25   \h'-7.25p'
.ds BP7.5    \h'-7.5p'
.ds BP7.75   \h'-7.75p'
.ds BP8      \h'-8p'
.ds BP8.25   \h'-8.25p'
.ds BP8.5    \h'-8.5p'
.ds BP8.75   \h'-8.75p'
.ds BP9      \h'-9p'
.ds BP9.25   \h'-9.25p'
.ds BP9.5    \h'-9.5p'
.ds BP9.75   \h'-9.75p'
.ds BP10     \h'-10p'
.ds BP10.25  \h'-10.25p'
.ds BP10.5   \h'-10.5p'
.ds BP10.75  \h'-10.75p'
.ds BP11     \h'-11p'
.ds BP11.25  \h'-11.25p'
.ds BP11.5   \h'-11.5p'
.ds BP11.75  \h'-11.75p'
.ds BP12     \h'-12p'
.ds BP12.25  \h'-12.25p'
.ds BP12.5   \h'-12.5p'
.ds BP12.75  \h'-12.75p'
\#
.ds FP.25    \h'.25'
.ds FP.5     \h'.5'
.ds FP.75    \h'.75'
.ds FP1      \h'1p'
.ds FP1.25   \h'1.25p'
.ds FP1.5    \h'1.5p'
.ds FP1.75   \h'1.75p'
.ds FP2      \h'2p'
.ds FP2.25   \h'2.25p'
.ds FP2.5    \h'2.5p'
.ds FP2.75   \h'2.75p'
.ds FP3      \h'3p'
.ds FP3.25   \h'3.25p'
.ds FP3.5    \h'3.5p'
.ds FP3.75   \h'3.75p'
.ds FP4      \h'4p'
.ds FP4.25   \h'4.25p'
.ds FP4.5    \h'4.5p'
.ds FP4.75   \h'4.75p'
.ds FP5      \h'5p'
.ds FP5.25   \h'5.25p'
.ds FP5.5    \h'5.5p'
.ds FP5.75   \h'5.75p'
.ds FP6      \h'6p'
.ds FP6.25   \h'6.25p'
.ds FP6.5    \h'6.5p'
.ds FP6.75   \h'6.75p'
.ds FP7      \h'7p'
.ds FP7.25   \h'7.25p'
.ds FP7.5    \h'7.5p'
.ds FP7.75   \h'7.75p'
.ds FP8      \h'8p'
.ds FP8.25   \h'8.25p'
.ds FP8.5    \h'8.5p'
.ds FP8.75   \h'8.75p'
.ds FP9      \h'9p'
.ds FP9.25   \h'9.25p'
.ds FP9.5    \h'9.5p'
.ds FP9.75   \h'9.75p'
.ds FP10     \h'10p'
.ds FP10.25  \h'10.25p'
.ds FP10.5   \h'10.5p'
.ds FP10.75  \h'10.75p'
.ds FP11     \h'11p'
.ds FP11.25  \h'11.25p'
.ds FP11.5   \h'11.5p'
.ds FP11.75  \h'11.75p'
.ds FP12     \h'12p'
.ds FP12.25  \h'12.25p'
.ds FP12.5   \h'12.5p'
.ds FP12.75  \h'12.75p'
\#
\#
\# WHOLE LINE KERNING (RW and EW)
\# -----------------------------
\#
.ig
The line kerning macros are special instances of track kerning,
used where a complete line needs to be tightened (or relaxed) in
order to accomodate or remove one or two more characters
than the default justification permits.
..
\#
\# *Argument:
\#   <amount of overall "kerning" (letter spacing) to apply to the line>
\# *Function:
\#   Invokes .tkf (track kerning) for the current font with
\#   1 as both the upper and lower point size limits, so that
\#   the value entered by the user applies regardless of point
\#   size.  RW ("Reduce Whitespace") reduces the amount of space
\#   between all characters by an equal amount.  EW ("Extra
\#   Whitespace") increases the amount of space.
\# *Notes:
\#   Decimal values are acceptable.
\#
.ig
The groff documentation is a tad confusing about what unit of
measure is used in track kerning, only that the width of each
character is increased or decreased by the amount(s) passed as
arguments to .tkf, and something about linear function of point
size.  In fact, with the way I've put this macro together, it
doesn't matter.  All the user needs to know is that a value of
one will produce an unacceptably tight or loose line at most text
point sizes; therefore, effective use of RW and EW is in the
fractional range below 1 (e.g. .25, .5).  Given that RW and EW
are for massaging type, a certain amount of experimentation and
previewing is expected and necessary.

\n(.f holds the current font number, which is acceptable to .tkf.

RW and EW must be reset to 0 to cancel their effect on subsequent
output lines.
..
\#
.MAC RW END
.    if \\n[#BR_AT_LINE_KERN] \{\
.       ie \\n[#JUSTIFY]=1 \{ .brp \}
.       el \{ .br \}
.    \}
.    tkf \\n(.f 1 -\\$1 1 -\\$1
.END
\#
\#
.MAC EW END
.    if \\n[#BR_AT_LINE_KERN] \{\
.       ie \\n[#JUSTIFY]=1 \{ .brp \}
.       el \{ .br \}
.    \}
.    tkf \\n(.f 1 \\$1 1 \\$1
.END
\#
\#
\# BREAK AT LINE KERN
\# ------------------
\# *Arguments:
\#   toggle
\# *Function:
\#   Enables/disables .br's before .RW and .EW
\# *Notes:
\#   Mostly, users will want .br's before any kind of line kerning, but
\#   there may be cases where they don't.  BR_BEFORE_LINE_KERN is off by
\#   default and must be invoked explicitly.
\#
.MAC BR_AT_LINE_KERN END
.    ie '\\$1'' \{ .nr #BR_AT_LINE_KERN  1 \}
.    el         \{ .rr #BR_AT_LINE_KERN \}
.END
\#
\# =====================================================================
\#
\# +++HYPHENATION+++
\#
\# AUTO HYPHENATION
\# ----------------
\# *Arguments:
\#   <none> | <anything> | DEFAULT
\#                 or
\#   LINES <n> | MARGIN <n> | SPACE <n>
\# *Function:
\#   Turns auto hyphenation on or off, resets the hyphenation style
\#   to default, or permits the setting of various hyphenation
\#   parameters.
\# *Notes:
\#   HY, by itself, defaults to .hy 14, i.e. no hyphens after the
\#   first two or before the last two characters of a word, and no
\#   hyphenation of the last line prior to a trap (e.g., at the
\#   bottom of a page).
\#
\#   HY DEFAULT resets the hyphenation style to .hy 14 (see
\#   above) if that behaviour is desired after changes have been
\#   made to LINES, MARGIN, or SPACE.
\#
\#   HY LINES <n> sets the number of allowable consecutive hyphenated lines.
\#
\#   HY MARGIN <n> sets the amount of space (ipPcm) allowed at the end
\#   of a line in QUAD mode before hyphenation is tripped (e.g. if there's
\#   only 6 points left, groff won't try to hyphenate the next word).
\#
\#   HY SPACE sets the amount of extra interword space (ipPcm) that can
\#   be added in JUSTIFY mode to prevent a line from being hyphenated.
\#
.MAC HY END
.    ie '\\$1'' \{\
.       hy 14
.       nr #HYPHENATE 1
.    \}
.    el \{\
.       if !'\\$1'LINES'  \{\
.          nh
.          nr #HYPHENATE 0
.       \}
.       if !'\\$1'MARGIN' \{\
.          nh
.          nr #HYPHENATE 0
.       \}
.       if !'\\$1'SPACE'  \{\
.          nh
.          nr #HYPHENATE 0
.       \}
.       if !'\\$1'DEFAULT'  \{\
.          nh
.          nr #HYPHENATE 0
.       \}
.       if '\\$1'LINES'   \{ .hlm \\$2 \}
.       if '\\$1'MARGIN'  \{ .hym \\$2 \}
.       if '\\$1'SPACE'   \{ .hys \\$2 \}
.       if '\\$1'DEFAULT' \{\
.          hlm -1
.          hym 0
.          hys 0
.       \}
.    \}
.END
\#
\#
\# HYPHENATION PARAMETERS
\# ----------------------
\# *Arguments:
\#   <# of lines> | <size of margin> | <amount of interword space>
\# *Function:
\#   Allows user to specify .HY LINES, MARGIN, and SPACE with a single command.
\#
.MAC HY_SET END
.    nr #HY_SET 1
.    hlm \\$1
.    hym \\$2
.    hys \\$3
.END
\#
\# =====================================================================
\#
\# +++VERTICAL SPACING+++
\#
\# ADVANCE LEAD
\# ------------
\# *Argument:
\#   <user supplied lead to advance below current baseline>
\# *Function:
\#   Creates or modifies register #ALD.  Adds user supplied lead
\#   below current baseline.
\# *Notes:
\#   Requires a unit of measure.
\#
.MAC ALD END
.    if \\n(nl=0 \{ .nr #TOP 1 \}
.    if '\\$0'ALD' \{\
.       nr #ALD (\\$1)
.       sp \\n[#ALD]u
.    \}
.    if '\\$0'ADD_SPACE' \{\
.       nr #ALD (\\$1)
.       rs
.       sp \\n[#ALD]u
.    \}
.    if '\\$0'SPACE' \{\
.       sp \\$1u
.    \}
.    if '\\$0'SP' \{\
.       sp \\$1u
.    \}
.END
\#
\#
\# REVERSE LEAD
\# ------------
\# *Argument:
\#   <user supplied lead to reverse above current baseline>
\# *Function:
\#   Creates or modifies register #RLD.  Reverses user supplied
\#   lead above current baseline.
\# *Notes:
\#   Requires a unit of measure.
\#
.MAC RLD END
.    nr #RLD (\\$1)
.    sp -\\n[#RLD]u
.END
\#
\# ALD/RLD STRINGS
\# ---------------
.ig
The strings \*[ALD.25]...\*[ALD12.75] and their corresponding
\*[RLD] forms have been left in for backward compatibility with
documents created using mom-1.1.3c or earlier.  The prefered methods
of advancing and reversing on the page inline are \*[UP <n><unit>]
and \*[DOWN <n><unit>].
..
\#
.ds DOWN      \v'\\$1'
.ds UP        \v'-\\$1'
\#
.ds ALD.25    \v'.25p'
.ds ALD.5     \v'.5p'
.ds ALD.75    \v'.75p'
.ds ALD1      \v'1p'
.ds ALD1.25   \v'1.25p'
.ds ALD1.5    \v'1.5p'
.ds ALD1.75   \v'1.75p'
.ds ALD2      \v'2p'
.ds ALD2.25   \v'2.25p'
.ds ALD2.5    \v'2.5p'
.ds ALD2.75   \v'2.75p'
.ds ALD3      \v'3p'
.ds ALD3.25   \v'3.25p'
.ds ALD3.5    \v'3.5p'
.ds ALD3.75   \v'3.75p'
.ds ALD4      \v'4p'
.ds ALD4.25   \v'4.25p'
.ds ALD4.5    \v'4.5p'
.ds ALD4.75   \v'4.75p'
.ds ALD5      \v'5p'
.ds ALD5.25   \v'5.25p'
.ds ALD5.5    \v'5.5p'
.ds ALD5.75   \v'5.75p'
.ds ALD6      \v'6p'
.ds ALD6.25   \v'6.25p'
.ds ALD6.5    \v'6.5p'
.ds ALD6.75   \v'6.75p'
.ds ALD7      \v'7p'
.ds ALD7.25   \v'7.25p'
.ds ALD7.5    \v'7.5p'
.ds ALD7.75   \v'7.75p'
.ds ALD8      \v'8p'
.ds ALD8.25   \v'8.25p'
.ds ALD8.5    \v'8.5p'
.ds ALD8.75   \v'8.75p'
.ds ALD9      \v'9p'
.ds ALD9.25   \v'9.25p'
.ds ALD9.5    \v'9.5p'
.ds ALD9.75   \v'9.75p'
.ds ALD10     \v'10p'
.ds ALD10.25  \v'10.25p'
.ds ALD10.5   \v'10.5p'
.ds ALD10.75  \v'10.75p'
.ds ALD11     \v'11p'
.ds ALD11.25  \v'11.25p'
.ds ALD11.5   \v'11.5p'
.ds ALD11.75  \v'11.75p'
.ds ALD12     \v'12p'
.ds ALD12.25  \v'12.5p'
.ds ALD12.5   \v'12.5p'
.ds ALD12.75  \v'12.75p'
\#
.ds RLD.25    \v'-.25p'
.ds RLD.5     \v'-.5p'
.ds RLD.75    \v'-.75p'
.ds RLD1      \v'-1p'
.ds RLD1.25   \v'-1.25p'
.ds RLD1.5    \v'-1.5p'
.ds RLD1.75   \v'-1.75p'
.ds RLD2      \v'-2p'
.ds RLD2.25   \v'-2.25p'
.ds RLD2.5    \v'-2.5p'
.ds RLD2.75   \v'-2.75p'
.ds RLD3      \v'-3p'
.ds RLD3.25   \v'-3.25p'
.ds RLD3.5    \v'-3.5p'
.ds RLD3.75   \v'-3.75p'
.ds RLD4      \v'-4p'
.ds RLD4.25   \v'-4.25p'
.ds RLD4.5    \v'-4.5p'
.ds RLD4.75   \v'-4.75p'
.ds RLD5      \v'-5p'
.ds RLD5.25   \v'-5.25p'
.ds RLD5.5    \v'-5.5p'
.ds RLD5.75   \v'-5.75p'
.ds RLD6      \v'-6p'
.ds RLD6.25   \v'-6.25p'
.ds RLD6.5    \v'-6.5p'
.ds RLD6.75   \v'-6.75p'
.ds RLD7      \v'-7p'
.ds RLD7.25   \v'-7.25p'
.ds RLD7.5    \v'-7.5p'
.ds RLD7.75   \v'-7.75p'
.ds RLD8      \v'-8p'
.ds RLD8.25   \v'-8.25p'
.ds RLD8.5    \v'-8.5p'
.ds RLD8.75   \v'-8.75p'
.ds RLD9      \v'-9p'
.ds RLD9.25   \v'-9.25p'
.ds RLD9.5    \v'-9.5p'
.ds RLD9.75   \v'-9.75p'
.ds RLD10     \v'-10p'
.ds RLD10.25  \v'-10.25p'
.ds RLD10.5   \v'-10.5p'
.ds RLD10.75  \v'-10.75p'
.ds RLD11     \v'-11p'
.ds RLD11.25  \v'-11.25p'
.ds RLD11.5   \v'-11.5p'
.ds RLD11.75  \v'-11.75p'
.ds RLD12     \v'-12p'
.ds RLD12.25  \v'-12.5p'
.ds RLD12.5   \v'-12.5p'
.ds RLD12.75  \v'-12.75p'
\#
\# =====================================================================
\#
\# +++REFINEMENTS+++
\#
\# AUTOMATIC LIGATURES
\# -------------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Turns automatic ligature generation on or off.
\# *Notes:
\#   Ligatures may be supplied manually with \(fi, \(fl, etc.
\#
.MAC LIGATURES END
.    ie '\\$1'' \{\
.       lg
.       nr #LIGATURES 1
.    \}
.    el \{\
.       lg 0
.       nr #LIGATURES 0
.    \}
.END
\#
\#
\# SMARTQUOTES
\# -----------
\# *Arguments:
\#   [ ,, ] | [ << ] | [ >> ] | <anything>
\#   or
\#   [ DA | DE | ES | FR | IT | NL | NO | PT | SV ] | <anything>
\# *Function:
\#   Turns smartquotes on (optionally with a quoting style from the
\#   argument list, or off).
\# *Notes:
\#   The " character is read outside the macro when mom is
\#   processed.  The strings for open/close ($QUOTE<n>) are then
\#   defined in the macro.
\#
\#   (Note to myself: code for " is \N'34'.)
\#
.char " \\*[$QUOTE\\n[#OPEN_CLOSE]]\R'#OPEN_CLOSE (1-\\n[#OPEN_CLOSE])'
\#
.MAC SMARTQUOTES END
.    rr #ARGS_TO_SQ
.    ie '\\$1'' \{\
.       nr #OPEN_CLOSE 0
.       ds $QUOTE0 \\[lq]
.       ds $QUOTE1 \\[rq]
.    \}
.    el \{\
.       if '\\$1',,' \{\
.          nr #ARGS_TO_SQ 1
.          ds $QUOTE0 \\[Bq]
.          ds $QUOTE1 \\[lq]
.       \}
.       if '\\$1'<<' \{\
.          nr #ARGS_TO_SQ 1
.          ds $QUOTE0 \\[Fo]
.          ds $QUOTE1 \\[Fc]
.       \}
.       if '\\$1'>>' \{\
.          nr #ARGS_TO_SQ 1
.          ds $QUOTE0 \\[Fc]
.          ds $QUOTE1 \\[Fo]
.       \}
.       if '\\$1'DA' \{\
.          nr #ARGS_TO_SQ 1
.          ds $QUOTE0 \\[Fc]
.          ds $QUOTE1 \\[Fo]
.       \}
.       if '\\$1'DE' \{\
.          nr #ARGS_TO_SQ 1
.          ds $QUOTE0 \\[Bq]
.          ds $QUOTE1 \\[lq]
.       \}
.       if '\\$1'ES' \{\
.          nr #ARGS_TO_SQ 1
.          ds $QUOTE0 \\[lq]
.          ds $QUOTE1 \\[rq]
.       \}
.       if '\\$1'FR' \{\
.          nr #ARGS_TO_SQ 1
.          ds $QUOTE0 \\[Fo]\\|
.          ds $QUOTE1 \\|\\[Fc]
.       \}
.       if '\\$1'IT' \{\
.          nr #ARGS_TO_SQ 1
.          ds $QUOTE0 \\[Fo]\\|
.          ds $QUOTE1 \\|\\[Fc]
.       \}
.       if '\\$1'NL' \{\
.          nr #ARGS_TO_SQ 1
.          ds $QUOTE0 \\[rq]
.          ds $QUOTE1 \\[rq]
.       \}
.       if '\\$1'NO' \{\
.          nr #ARGS_TO_SQ 1
.          ds $QUOTE0 \\[Fo]
.          ds $QUOTE1 \\[Fc]
.       \}
.       if '\\$1'PT' \{\
.          nr #ARGS_TO_SQ 1
.          ds $QUOTE0 \\[Fo]
.          ds $QUOTE1 \\[Fc]
.       \}
.       if '\\$1'SV' \{\
.          nr #ARGS_TO_SQ 1
.          ds $QUOTE0 \\[Fc]
.          ds $QUOTE1 \\[Fc]
.       \}
.       if !r#ARGS_TO_SQ \{\
.          ds $QUOTE0 \\[dq]
.          ds $QUOTE1 \\[dq]
.       \}
.    \}
.END
\#
.ds $QUOTE0 \[dq]
.ds $QUOTE1 \[dq]
\#
\# Strings for foot and inch marks
\#
.ds FOOT \(fm
.ds INCH \(fm\(fm
\#
\# =====================================================================
\#
\# +++LINE BREAKS+++
\#
\# NO-SPACE BREAK
\# --------------
\# *Argument:
\#   <none>
\# *Function:
\#   Breaks a line without advancing.
\# *Notes:
\#   EL is the mnemonic used on older, dedicated typesetting machines
\#   to indicate "process the line, without advancing the galley
\#   medium."  It stands for End Line.
\#
\#   The \c inline must be appended to the end of input lines when in
\#   nofill mode; in fill modes, the \c inline must not be used.
\#
.MAC EL END
.    TRAP OFF
.    if \\n[#PSEUDO_FILL]=1 \&
.    br
.    sp -1v
.    TRAP
.END
\#
\# An inline escape to accomplish the same thing.  Actually
\# preferable, since it works with filled and non-filled copy and
\# doesn't require the user to remember to use (or not use) the \c.
\#
.ds B \h'|0'\c
\#
\# =====================================================================
\#
\# +++FILLING/QUADDING/JUSTIFYING+++
\#
\# JUSTIFY
\# -------
\# *Argument:
\#   <none>
\# *Function:
\#   Turns fill on and sets .ad to b.
\# *Notes:
\#   Justifies text left and right.
\#
.MAC JUSTIFY END
.    if \\n[#TAB_ACTIVE]=0 \{\
.       nr #QUAD 1
.       ds $RESTORE_QUAD_VALUE \\*[$QUAD_VALUE]
.    \}
'    ce 0
.    QUAD J
.    if \\n[#PRINT_STYLE]=1 \{ .QUAD L \}
.    nr #PSEUDO_FILL 0
.END
\#
\#
\# QUAD
\# ----
\# *Arguments:
\#   L | LEFT | R | RIGHT | C | CENTER/CENTRE
\# *Function:
\#   Turns fill on and sets .ad to l, r, or c.
\# *Notes:
\#   Terminology is a problem here.  Some people call quad left
\#   left justified, flush left, or flush left/rag right (and the
\#   reverse for quad right).  Quad center is sometimes called rag
\#   both.  For our purposes, all "quad" modes mean that groff fill
\#   mode is enabled.
\#
.MAC QUAD END
.    ds $QUAD_VALUE \\$1
.    if \\n[#TAB_ACTIVE]=0 \{\
.       nr #QUAD 1
.       ds $RESTORE_QUAD_VALUE \\*[$QUAD_VALUE]
.    \}
'    ce 0
'    fi
.    if '\\*[$QUAD_VALUE]'L'       \{\
.       nr #JUSTIFY 0
.       ad l
.    \}
.    if '\\*[$QUAD_VALUE]'LEFT'    \{\
.       nr #JUSTIFY 0
.       ad l
.    \}
.    if '\\*[$QUAD_VALUE]'R'       \{\
.       nr #JUSTIFY 0
.       ad r
.    \}
.    if '\\*[$QUAD_VALUE]'RIGHT'   \{\
.       nr #JUSTIFY 0
.       ad r
.    \}
.    if '\\*[$QUAD_VALUE]'C'       \{\
.       nr #JUSTIFY 0
.       ad c
.    \}
.    if '\\*[$QUAD_VALUE]'CENTER'  \{\
.       nr #JUSTIFY 0
.       ad c
.    \}
.    if '\\*[$QUAD_VALUE]'CENTRE'  \{\
.       nr #JUSTIFY 0
.       ad c
.    \}
.    if '\\*[$QUAD_VALUE]'J'       \{\
.       nr #JUSTIFY 1
.       ad b
.    \}
.    if '\\*[$QUAD_VALUE]'JUSTIFY' \{\
.       nr #JUSTIFY 1
.       ad b
.    \}
.    nr #PSEUDO_FILL 0
.END
\#
\#
\# LEFT, RIGHT, AND CENTER
\# -----------------------
\#
.ig
The purpose of these macros is to allow the user to enter lines of
text that will be quadded LRC *without* the user having to enter .BR
or .br between lines.  For the sake of consistency, all three appear
to behave similarly (from the point of view of the user), although
the underlying primitives don't.  For this reason, LEFT, RIGHT, and
CENTER must be followed by .QUAD [L R C J] or .JUSTIFY to restore
text to groff fill mode.
..
\#
\# LEFT
\# ----
\# *Argument:
\#   <none>
\# *Function:
\#   Turns fill mode off.  Allows user to quad lines left without
\#   requiring the .BR or .br macro.
\# *Notes:
\#   LEFT simply turns fill off.  Lines that exceed the current LL will
\#   not be broken, just continued (indefinitely) until a return is
\#   encountered.  Note that this behaviour differs from the RIGHT and
\#   CENTER macros.
\#
.MAC LEFT END
.    if \\n[#TAB_ACTIVE]=0 \{\
.       rr #QUAD
.       ds $RESTORE_QUAD_VALUE LEFT
.    \}
.    ce 0
.    nf
.    nr #PSEUDO_FILL 1
.\" Fix for a little conflict with DOCTYPE LETTER 
.    if '\\n(.z'LETTERHEAD1' \{ .rr #DATE_FIRST \}
.END
\#
\#
\# RIGHT
\# -----
\# *Argument:
\#   <none>
\# *Function:
\#   Turns fill on.  Allows user to quad lines right without
\#   requiring the .BR or .br macro.
\# *Notes:
\#   Lines that exceed the current LL will be broken, with the excess
\#   text quadded right.
\#
.MAC RIGHT END
.    if \\n[#TAB_ACTIVE]=0 \{\
.       rr #QUAD
.       ds $RESTORE_QUAD_VALUE RIGHT
.    \}
.    fi
.    rj 100000
.    nr #PSEUDO_FILL 1
.END
\#
\#
\# CENTER
\# ------
\# *Argument:
\#   <none>
\# *Function:
\#   Turns fill on.  Allows user to center lines without
\#   requiring the .BR or .br macro.
\# *Notes:
\#   Lines that exceed the current LL will be broken, with the excess
\#   text centered.
\#
.MAC CENTER END
.    if \\n[#TAB_ACTIVE]=0 \{\
.       rr #QUAD
.       ds $RESTORE_QUAD_VALUE CENTER
.    \}
.    fi
.    ce 100000
.    nr #PSEUDO_FILL 1
.END
\#
\# =====================================================================
\#
\# +++TABS+++
\#
.ig
There are two different kinds of tabs available: typesetting tabs
and string tabs.

Typesetting tabs are set with TAB_SET, which requires a tab number,
an indent (offset) from the left margin and a length (optionally
with a quad direction and an instruction to fill lines).  After tabs
are set with TAB_SET, they are called with .TAB n, where "n"
corresponds to the number passed to TAB_SET as a valid tab number.

String tabs allow the user to mark off tab positions inline.  Tab
indents and lengths are calculated from the beginning and end
positions of the marks.  Up to 19 string tabs may be created,
numbered 1-19.  Once created, they are called with .TAB n,
just like typesetting tabs.

Setting up string tabs is a two-step procedure.  First, the user
enters an input line in which s/he wants to mark off string tabs.
The beginning of a tab is marked with \*[STn], where "n" is
the desired number of the tab.  The end of the the tab is marked
with \*[STnX].  All ST's must have a matching STX.  String tabs
may be nested.

Next, the user invokes .ST n for every string tab defined, and
optionally passes quad information to it.  That done, string tabs
can be called just like typesetting tabs.

String tabs don't preview properly with gxditview.  Use gv instead.
..
\#
\# Strings for string tab inlines
\# ------------------------------
\#
\# Initialize string tab markers numbered 1 to 19.
\#
.nr #LOOP 0 1
.while \n+[#LOOP]<20 \{\
.   ds ST\n[#LOOP] \Ek[#ST\n[#LOOP]_OFFSET]
.\}
\#
.nr #LOOP 0 1
.while \n+[#LOOP]<20 \{\
.   ds ST\n[#LOOP]X \Ek[#ST\n[#LOOP]_MARK]
.\}
.rr #LOOP
\#
\#
\# These are reserved ST numbers for internal use
.ds ST100  \Ek[#ST100_OFFSET]
.ds ST100X \Ek[#ST100_MARK]
.ds ST101  \Ek[#ST101_OFFSET]
.ds ST101X \Ek[#ST101_MARK]
\#
\#
\# QUAD AND SET STRING TABS
\# ------------------------
\# *Arguments:
\#   <stringtab number>  L | R | C | J  [QUAD]
\# *Function:
\#   Creates strings $ST<#>_QUAD_DIR and $ST<#>_FILL, then sets up a
\#   tab based on the collected information.
\# *Notes:
\#   Like TAB_SET, ST invoked without a quad direction will default to LEFT.
\#   If lines should be filled and quadded, use the optional argument QUAD.
\#   N.B. -- indents *must* be turned off before setting string tabs
\#   inside .PAD
\#
.MAC ST END
.    ds $ST\\$1_QUAD_DIR \\$2
.    if \\n[#NUM_ARGS]=3 \{\
.       ds $ST\\$1_FILL QUAD
.    \}
.    nr #ST\\$1_LENGTH \\n[#ST\\$1_MARK]-\\n[#ST\\$1_OFFSET]
.    ie \\n[#IN_TAB] \{\
.       TAB_SET \\$1 \\n[#ST\\$1_OFFSET]u+\\n[#ST_OFFSET]u \\n[#ST\\$1_LENGTH]u \\*[$ST\\$1_QUAD_DIR] \\*[$ST\\$1_FILL]
.    \}
.    el \{\
.       TAB_SET \\$1 \\n[#ST\\$1_OFFSET]u \\n[#ST\\$1_LENGTH]u \\*[$ST\\$1_QUAD_DIR] \\*[$ST\\$1_FILL]
.    \}
.END
\#
\#
\# TAB SET
\# -------
\# *Arguments:
\#   <n>  ident(ipPcm)  length(ipPcm)  [L | R | C | J [QUAD]]
\# *Function:
\#   Creates macros TABn and TAB n, where "n" is any arbitrary number.
\#   TABn is a typesetting tab (i.e. a tab defined as an indent
\#   from the page left offset plus a line length.)
\# *Notes:
\#   n      = arbitrary digit to identify the tab
\#   indent = indent from left margin; unit of measure required
\#   length = length of tab (unit of measure required; can be
\#            \w'<string>'u--if more than one word in string, surround
\#            with double quotes "\w'<three word string>'"
\#   LRCJ   = quad for tab (left, right, center, justified)
\#            If option QUAD afterwards is not given, quad is line for line
\#            (no fill mode), meaning that there's no need for .BR or .br
\#            between lines.
\#   QUAD   = fill tab (so it behaves as if .QUAD LRC or .JUSTIFY
\#            had been given).
\#
\#   N.B. -- indents *must* be turned off before setting tabs
\#
.ig
Examples:
--------

.TAB_SET 1 2P+6p 12P C

means "create a tab numbered 1 that starts 2 picas and 6 points from
the left margin, is 12 picas long, and centre each input line."

.TAB_SET 1 2P+6P 12P C QUAD

means exactly the same thing, except that input lines are joined and
the area delimted by the tab filled with centered text.

TAB n can be called at any time after being set.

Tabs are NOT columnar in behaviour.  If the text inside a
tab runs to several lines, when you call the next tab a break
occurs, meaning that the new tab starts one line below the last
line in the previous tab.  For columnar behaviour, you must
use the multi-column macros in addition to tabs.

If you want tabs to line up bottom-line to bottom-line (most likely
single line tabs), use .TN (provided the tabs are numbered sequentially).
Otherwise, you must use .EL then .TAB <n> if you want them to align.

If you want to reset tabs, you must use .TQ before .TAB_SET.

Note that indents are turned off automatically whenever a new
tab is called with TAB <n>.

Tabs themselves are user-invoked using the TAB macro with a numeric
argument, e.g. TAB 1.

Generally, in order not to get confused, it's a good idea
to make sure all indents are off before setting tabs.
..
\#
.MAC TAB_SET END
.    br
.    nr #TAB_NUMBER \\$1
.    ds $CURRENT_TAB \\n[#TAB_NUMBER]
.    nr #TAB_OFFSET (\\$2)
.    nr #TAB_LENGTH (\\$3)
.    MAC TAB\\n[#TAB_NUMBER] DONE \"Define TAB macro
.        if !\\\\n[#TB+]=1 \{ .br \}
.        if \\\\n[#TB+]=1 \{\
.           EL
.           vpt 0
.           rr #TB+
.        \}
.        in 0
.        nr #TAB_ACTIVE 1
.        nr #CURRENT_TAB \\n[#TAB_NUMBER]
.        ds $CURRENT_TAB \\*[$CURRENT_TAB]
.        nr #TAB_OFFSET\\*[$CURRENT_TAB] \\n[#TAB_OFFSET]
.        nr #ST_OFFSET \\n[#TAB_OFFSET]
.        po \\\\n[#L_MARGIN]u+\\\\n[#TAB_OFFSET\\\\*[$CURRENT_TAB]]u
.        ll \\n[#TAB_LENGTH]u
.        ta \En(.lu
.        ie '\\$5'QUAD' \{\
.           if '\\$4'L' \{ .QUAD L  \}
.           if '\\$4'R' \{ .QUAD R  \}
.           if '\\$4'C' \{ .QUAD C  \}
.           if '\\$4'J' \{ .JUSTIFY \}
.        \}
.        el \{\
.           if '\\$4''  \{ .LEFT    \}
.           if '\\$4'L' \{ .LEFT    \}
.           if '\\$4'R' \{ .RIGHT   \}
.           if '\\$4'C' \{ .CENTER  \}
.           if '\\$4'J' \{ .JUSTIFY \}
.        \}
.        if \\\\n[#TN]=1 \{\
.           TRAP
.           rr #TN
.        \}
.DONE
.    rr #TAB_ACTIVE
.END
\#
\#
\# TAB
\# ---
\# *Arguments:
\#   <tab number to tab into>
\# *Function:
\#   Moves to tab number passed as an argument.
\#
.MAC TAB END
.    ds $TAB_NUMBER \\$1
.    TAB\\*[$TAB_NUMBER]
.    nr #IN_TAB 1
.END
\#
\#
\# TAB NEXT
\# --------
\# *Argument:
\#   <none>
\# *Function:
\#   Automagically moves to TAB<n+1> on the same line as the last
\#   line of the previous tab.
\# *Notes:
\#   The \c inline must be appended to the end of input lines when in
\#   nofill mode; in fill modes, the \c inline must not be used.
\#
.MAC TN END
.    nr #TN 1
.    TRAP OFF
.    sp -1v
.    nr #NEXT_TAB \\n[#CURRENT_TAB]+1
.    TAB\\n[#NEXT_TAB]
.    TRAP
.END
\#
\# An inline escape to accomplish the same thing.  Actually
\# preferable, since it works with filled and non-filled copy and
\# doesn't require the user to remember to use (or not use) the \c.
\#
.ds TB+ "\c\\R'#TB+ 1'\\R'#TN 1'\\R'#NEXT_TAB \\n[#CURRENT_TAB]+1'\\*[TAB\\n[#NEXT_TAB]]\c
\#
\# TAB QUIT
\# --------
\# *Argument:
\#   <none>
\# *Function:
\#   Sets #TAB_ACTIVE to "0" (off).
\#   Resets left margin to value in effect prior to tabs.
\#   Resets line length to value in effect prior to tabs.
\#   Checks #QUAD to see if we were in flush or quad mode
\#   prior to tabs (0=off, 1=on).
\#   Resets QUAD [ L|R|C ], LEFT, RIGHT, CENTER, or JUSTIFY
\#   in effect prior to tabs.
\# *Notes:
\#   TQ *must* come before setting any new tabs if you want the
\#   tabs' indents measured from page left.  Otherwise, the tabs'
\#   indents are measured from the left margin of the tab you're
\#   currently in.
\#
.MAC TQ END
.    br
.    rr #TAB_ACTIVE
.    rr #IN_TAB
.    po \\n[#L_MARGIN]u
.    ll \\n[#L_LENGTH]u
.    ta \\n(.lu
.    ie \\n[#QUAD] \{\
.       ie '\\*[$RESTORE_QUAD_VALUE]'J' \{ .JUSTIFY \}
.       el                              \{ .QUAD \\*[$RESTORE_QUAD_VALUE] \}
.    \}
.    el \{\
.       if '\\*[$RESTORE_QUAD_VALUE]'LEFT'   \{ .LEFT \}
.       if '\\*[$RESTORE_QUAD_VALUE]'RIGHT'  \{ .RIGHT \}
.       if '\\*[$RESTORE_QUAD_VALUE]'CENTER' \{ .CENTER \}
.    \}
.END
\#
\# ====================================================================
\#
\# COLOR HANDLING
\# ==============
\#
\# COLOR
\# -----
\# *Arguments:
\#   <pre-defined NEWCOLOR or XCOLOR>
\# *Function:
\#   Allows the inline escape for setting color to be called
\#   as a macro.
\#
.MAC COLOR END
.ie \\n(.u=1 \{\
\c
\\*[\\$1]\c
.\}
.el \{ \\*[\\$1] \}
.END
\#
\#
\# NEWCOLOR
\# --------
\# *Arguments:
\#   <color name> [<color scheme>] <color definition>
\# *Function:
\#   Based on .defcolor, allows users to name and define colors using
\#   one of the four color schemes rgb, cmy, cmyk and grey.  The new
\#   color is then defined as a string so that it can be called inline
\#   with \*[COLORNAME] or with .COLOR.
\# *Notes:
\#   With only two args, the default color scheme is rgb.
\#
\#   It is highly recommended that users define new colors as
\#   all-cap strings, to differentiate them from x colors, which must
\#   be in lower case.
\#
.MAC NEWCOLOR END
.    if \\n[#NUM_ARGS]=2 \{\
.       defcolor \\$1 rgb \\$2
.    \}
.    if \\n[#NUM_ARGS]=3 \{\
.       if '\\$2'RGB'  .ds $COLOR_SCHEME rgb
.       if '\\$2'CYM'  .ds $COLOR_SCHEME cym
.       if '\\$2'CMYK' .ds $COLOR_SCHEME cmyk
.       if '\\$2'GRAY' .ds $COLOR_SCHEME gray
.       if '\\$2'GREY' .ds $COLOR_SCHEME gray
.       defcolor \\$1  \\*[$COLOR_SCHEME] \\$3
.    \}
.    ds \\$1 \\m[\\$1]
.END
\#
\#
\# XCOLOR
\# ------
\# *Arguments:
\#   <x color name> [<alias>]
\# *Function:
\#   Defines a string of x color name (i.e. a predefined x
\#   color).  If <alias> is given, creates a string of <alias name>
\#   that references the x color name of the first argument.
\# *Notes:
\#   The color name must be a legal color name from rgb.txt, and
\#   must be given entirely in lower case, all one word.
\#
.MAC XCOLOR END
.    ds \\$1 \m[\\$1]
.    if \\n[#NUM_ARGS]=2 .ds \\$2 \m[\\$1]
.END
\#
\# Pre-define xcolors black and white
\#
.ds black \m[black]
.ds BLACK \m[black]
.ds white \m[white]
.ds WHITE \m[WHITE]
\#
\# =====================================================================
\#
\# +++MISCELLANEOUS USEFUL MACROS AND STRINGS+++
\#
\# UNDERLINE
\# ---------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   When on, underlines all letters, words, and digits in a passage,
\#   ignoring punctuation and spaces.
\# *Notes:
\#   Only for use when the font family is COURIER, to simulate
\#   typewriter-style underlining of italic  passages.
\#
.MAC UNDERLINE END
.    ie '\\$1'' \{\
.       nr #UNDERLINE_ON 1
.       char A _A
.       char B _B
.       char C _C
.       char D _D
.       char E _E
.       char F _F
.       char G _G
.       char H _H
.       char I _I
.       char J _J
.       char K _K
.       char L _L
.       char M _M
.       char N _N
.       char O _O
.       char P _P
.       char Q _Q
.       char R _R
.       char S _S
.       char T _T
.       char U _U
.       char V _V
.       char W _W
.       char X _X
.       char Y _Y
.       char Z _Z
.       char \[`A] _\[`A]
.       char \[^A] _\[^A]
.       char \['A] _\['A]
.       char \[:A] _\[:A]
.       char \[oA] _\[oA]
.       char \[~A] _\[~A]
.       char \[AE] _\[AE]
.       char \[`E] _\[`E]
.       char \[^E] _\[^E]
.       char \['E] _\['E]
.       char \[:E] _\[:E]
.       char \[`I] _\[`I]
.       char \[^I] _\[^I]
.       char \['I] _\['I]
.       char \[:I] _\[:I]
.       char \[`O] _\[`O]
.       char \[^O] _\[^O]
.       char \['O] _\['O]
.       char \[:O] _\[:O]
.       char \[~O] _\[~O]
.       char \[/O] _\[/O]
.       char \[`U] _\[`U]
.       char \[^U] _\[^U]
.       char \['U] _\['U]
.       char \[:U] _\[:U]
.       char \[,C] _\[,C]
.       char \[-D] _\[-D]
.       char \[~N] _\[~N]
.       char \[TP] _\[TP]
.       char \['Y] _\['Y]
.       char \[:Y] _\[:Y]
.       char a _a
.       char b _b
.       char c _c
.       char d _d
.       char e _e
.       char f _f
.       char g _g
.       char h _h
.       char i _i
.       char j _j
.       char k _k
.       char l _l
.       char m _m
.       char n _n
.       char o _o
.       char p _p
.       char q _q
.       char r _r
.       char s _s
.       char t _t
.       char u _u
.       char v _v
.       char w _w
.       char x _x
.       char y _y
.       char z _z
.       char \[`a] _\[`a]
.       char \[^a] _\[^a]
.       char \['a] _\['a]
.       char \[:a] _\[:a]
.       char \[oa] _\[oa]
.       char \[~a] _\[~a]
.       char \[ae] _\[ae]
.       char \[`e] _\[`e]
.       char \[^e] _\[^e]
.       char \['e] _\['e]
.       char \[:e] _\[:e]
.       char \[`i] _\[`i]
.       char \[^i] _\[^i]
.       char \['i] _\['i]
.       char \[:i] _\[:i]
.       char \[`o] _\[`o]
.       char \[^o] _\[^o]
.       char \['o] _\['o]
.       char \[:o] _\[:o]
.       char \[~o] _\[~o]
.       char \[/o] _\[/o]
.       char \[`u] _\[`u]
.       char \[^u] _\[^u]
.       char \['u] _\['u]
.       char \[:u] _\[:u]
.       char \[,c] _\[,c]
.       char \[Sd] _\[Sd]
.       char \[~n] _\[~n]
.       char \[Tp] _\[Tp]
.       char \['y] _\['y]
.       char \[:y] _\[:y]
.       char \[ss] _\[ss]
.       char ' _'
.       char 1 _1
.       char 2 _2
.       char 3 _3
.       char 4 _4
.       char 5 _5
.       char 6 _6
.       char 7 _7
.       char 8 _8
.       char 9 _9
.       char 0 _0
.    \}
.    el \{\
.       nr #UNDERLINE_ON 0
.       rchar A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
        a b c d e f g h i j k l m n o p q r s t u v w x y z \
        \[`A] \[^A] \['A] \[:A] \[oA] \[~A] \[AE] \[`E] \[^E] \['E] \[:E] \
        \[`I] \[^I] \['I] \[:I] \[`O] \[^O] \['O] \[:O] \[~O] \[/O] \[`U] \
        \[^U] \['U] \[:U] \[,C] \[-D] \[~N] \[TP] \['Y] \[:Y] \
        \[`a] \[^a] \['a] \[:a] \[oa] \[~a] \[ae] \[`e] \[^e] \['e] \[:e] \[`i] \
        \[^i] \['i] \[:i] \[`o] \[^o] \['o] \[:o] \[~o] \[/o] \[`u] \[^u] \['u] \
        \[:u] \[,c] \[Sd] \[~n] \[Tp] \['y] \[:y] \[ss] \
        ' 1 2 3 4 5 6 7 8 9 0
.    \}
.END
\#
\#
\# UL/ULX
\# ------
\# *Arguments:
\#   <none>
\# *Function:
\#   Underscores all letters, words, and digits in a passage,
\#   ignoring punctuation and spaces.
\# *Notes:
\#   Intended to be called with inline escapes \*[UL] (underline
\#   on) and \*[ULX] (underline off).  Only works when the font family
\#   is COURIER, to simulate typewriter-style underlining of italic
\#   passages.
\#
.MAC UL END
\c\R'#UNDERLINE_ON 1'
.       char A _A
.       char B _B
.       char C _C
.       char D _D
.       char E _E
.       char F _F
.       char G _G
.       char H _H
.       char I _I
.       char J _J
.       char K _K
.       char L _L
.       char M _M
.       char N _N
.       char O _O
.       char P _P
.       char Q _Q
.       char R _R
.       char S _S
.       char T _T
.       char U _U
.       char V _V
.       char W _W
.       char X _X
.       char Y _Y
.       char Z _Z
.       char \[`A] _\[`A]
.       char \[^A] _\[^A]
.       char \['A] _\['A]
.       char \[:A] _\[:A]
.       char \[oA] _\[oA]
.       char \[~A] _\[~A]
.       char \[AE] _\[AE]
.       char \[`E] _\[`E]
.       char \[^E] _\[^E]
.       char \['E] _\['E]
.       char \[:E] _\[:E]
.       char \[`I] _\[`I]
.       char \[^I] _\[^I]
.       char \['I] _\['I]
.       char \[:I] _\[:I]
.       char \[`O] _\[`O]
.       char \[^O] _\[^O]
.       char \['O] _\['O]
.       char \[:O] _\[:O]
.       char \[~O] _\[~O]
.       char \[/O] _\[/O]
.       char \[`U] _\[`U]
.       char \[^U] _\[^U]
.       char \['U] _\['U]
.       char \[:U] _\[:U]
.       char \[,C] _\[,C]
.       char \[-D] _\[-D]
.       char \[~N] _\[~N]
.       char \[TP] _\[TP]
.       char \['Y] _\['Y]
.       char \[:Y] _\[:Y]
.       char a _a
.       char b _b
.       char c _c
.       char d _d
.       char e _e
.       char f _f
.       char g _g
.       char h _h
.       char i _i
.       char j _j
.       char k _k
.       char l _l
.       char m _m
.       char n _n
.       char o _o
.       char p _p
.       char q _q
.       char r _r
.       char s _s
.       char t _t
.       char u _u
.       char v _v
.       char w _w
.       char x _x
.       char y _y
.       char z _z
.       char \[`a] _\[`a]
.       char \[^a] _\[^a]
.       char \['a] _\['a]
.       char \[:a] _\[:a]
.       char \[oa] _\[oa]
.       char \[~a] _\[~a]
.       char \[ae] _\[ae]
.       char \[`e] _\[`e]
.       char \[^e] _\[^e]
.       char \['e] _\['e]
.       char \[:e] _\[:e]
.       char \[`i] _\[`i]
.       char \[^i] _\[^i]
.       char \['i] _\['i]
.       char \[:i] _\[:i]
.       char \[`o] _\[`o]
.       char \[^o] _\[^o]
.       char \['o] _\['o]
.       char \[:o] _\[:o]
.       char \[~o] _\[~o]
.       char \[/o] _\[/o]
.       char \[`u] _\[`u]
.       char \[^u] _\[^u]
.       char \['u] _\['u]
.       char \[:u] _\[:u]
.       char \[,c] _\[,c]
.       char \[Sd] _\[Sd]
.       char \[~n] _\[~n]
.       char \[Tp] _\[Tp]
.       char \['y] _\['y]
.       char \[:y] _\[:y]
.       char \[ss] _\[ss]
.       char ' _'
.       char 1 _1
.       char 2 _2
.       char 3 _3
.       char 4 _4
.       char 5 _5
.       char 6 _6
.       char 7 _7
.       char 8 _8
.       char 9 _9
.       char 0 _0
.END
\#
\#
.MAC ULX END
\c\R'#UNDERLINE_ON 0'
.    rchar A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
     a b c d e f g h i j k l m n o p q r s t u v w x y z \
     \[`A] \[^A] \['A] \[:A] \[oA] \[~A] \[AE] \[`E] \[^E] \['E] \[:E] \
     \[`I] \[^I] \['I] \[:I] \[`O] \[^O] \['O] \[:O] \[~O] \[/O] \[`U] \
     \[^U] \['U] \[:U] \[,C] \[-D] \[~N] \[TP] \['Y] \[:Y] \
     \[`a] \[^a] \['a] \[:a] \[oa] \[~a] \[ae] \[`e] \[^e] \['e] \[:e] \[`i] \
     \[^i] \['i] \[:i] \[`o] \[^o] \['o] \[:o] \[~o] \[/o] \[`u] \[^u] \['u] \
     \[:u] \[,c] \[Sd] \[~n] \[Tp] \['y] \[:y] \[ss] \
     ' 1 2 3 4 5 6 7 8 9 0
.END
\#
\#
\# UNDERSCORE
\# ----------
\# *Arguments:
\#   [points below baseline] "text"
\# *Function:
\#   Places an underscore 2 points under the string if no lead given,
\#   otherwise places underscore under string by user specified amount.
\# *Notes:
\#   When using this macro, the string to be underscored must begin
\#   with double-quotes ("), regardless of whether it's the sole
\#   argument or the second.
\#   E.g.:
\#      .UNDERSCORE "Text to be underscored
\#         or
\#      .UNDERSCORE 2p "Text to be underscored
\#
\#   All text is underscored (including punctuation and spaces).
\#   This is the primary difference between UNDERLINE and UNDERSCORE,
\#   aside from the fact the UNDERLINE only works with Courier.
\#
\#   UNDERSCORE does not work across line breaks.  Each line of
\#   text must be entered separately with UNDERSCORE.  If the
\#   UNDERSCORE begins in the middle of a line and crosses over a
\#   break, the portion before the break must be entered in its own
\#   UNDERSCORE, as must the portion that comes after the break.
\#
.MAC UNDERSCORE END
.    nr #RESTORE_PT_SIZE \\n[#PT_SIZE]
.    ie \\n[#NUM_ARGS]=1 \{ \\$1\\s(12\\v'+2p'\\l'|0'\\v'-2p'\\s[\\n[#RESTORE_PT_SIZE]u] \}
.    el                  \{ \\$2\\s(12\\v'+(\\$1)'\\l'|0'\\v'-(\\$1)'\\s[\\n[#RESTORE_PT_SIZE]u] \}
.    rr #RESTORE_PT_SIZE
.END
\#
\#
\# DOUBLE UNDERSCORE
\# -----------------
\# *Arguments:
\#   [points below baseline] [points distance between rules] "text"
\# *Function:
\#   Same as UNDERSCORE, except it produces a double underscore.  The default
\#   distance between the rules is 2 points.
\# *Notes:
\#   The same double-quote requirement as UNDERSCORE.
\#
.MAC UNDERSCORE2 END
.    nr #RESTORE_PT_SIZE \\n[#PT_SIZE]
.    if \\n[#NUM_ARGS]=1 \{\
.       PRINT \\$1\\s(12\\v'+2p'\\l'|0'\\v'+2p'\\l'|0'\\v'-4p'\\s[\\n[#RESTORE_PT_SIZE]u]
.    \}
.    if \\n[#NUM_ARGS]=2 \{\
.       PRINT \\$2\\s(12\\v'+\\$1'\\l'|0'\\v'+2p'\\l'|0'\\v'-(2p+\\$1)'\\s[\\n[#RESTORE_PT_SIZE]u]
.    \}
.    if \\n[#NUM_ARGS]=3 \{\
.       PRINT \\$3\\s(12\\v'+\\$1'\\l'|0'\\v'+\\$2'\\l'|0'\\v'-(\\$2+\\$1)'\\s[\\n[#RESTORE_PT_SIZE]u]
.    \}
.    rr #RESTORE_PT_SIZE
.END
\#
\#
\# SUPERSCRIPT INLINES
\# -------------------
\# *Function:
\#   Prints everything after invocation as superscript.
\# *Notes:
\#   \*[SUP] and \*[SUPX] turn superscript on and off respectively.
\#   If running type is pseudo-condensed/expanded, invoke the superscript
\#   strings as \*[CONDSUP] or \*[EXTSUP] and turn off with \*[CONDSUPX]
\#   and \*[EXTSUPX] respectively.
\#
.ds SUP \
\R'#PT_SIZE_IN_UNITS \En[.ps]'\
\R'#SUP_PT_SIZE \En[#PT_SIZE_IN_UNITS]u*6u/10u'\
\s[\En[#PT_SIZE_IN_UNITS]u]\v'-.26m'\s[\En[#SUP_PT_SIZE]u]
\#
.ds SUPX \s[\En[#PT_SIZE_IN_UNITS]u]\v'.26m'
\#
.ds CONDSUP \
\R'#PT_SIZE_IN_UNITS \En[.ps]'\
\R'#SUP_PT_SIZE \En[#PT_SIZE_IN_UNITS]u*6u/10u'\
\s[\En[#PT_SIZE_IN_UNITS]u]\v'-.3m'\s[\En[#SUP_PT_SIZE]u]\E*[COND_FOR_SUP]
\#
.ds CONDSUPX \s[\En[#PT_SIZE_IN_UNITS]u]\v'.3m'\E*[COND]
\#
.ds EXTSUP \
\R'#PT_SIZE_IN_UNITS \En[.ps]'\
\R'#SUP_PT_SIZE \En[#PT_SIZE_IN_UNITS]u*6u/10u'\
\s[\En[#PT_SIZE_IN_UNITS]u]\v'-.3m'\s[\En[#SUP_PT_SIZE]u]\E*[EXT_FOR_SUP]
\#
.ds EXTSUPX \s[\En[#PT_SIZE_IN_UNITS]u]\v'.3m'\E*[EXT]
\#
\#
\# SLANT
\# -----
\#
\# SETSLANT
\# --------
\# *Arguments:
\#   <number of degrees> | RESET
\# *Function:
\#   Modifies register #DEGREES for use with \*[SLANT], or resets
\#   it to the default.  Defines string \*[SLANTX]
\# *Notes:
\#   \*[SLANT] permits pseudo-italicizing of a font in cases where
\#   no italic font exists in a particular family.
\#
\#   Default # of degrees is 15.
\#
\#   Do not use unit of measure with arg to SETSLANT.
\#
\#   It may be necessary to adjust the spacing on either side of
\#   [SLANT] and [SLANTX].
\#
\#   In docs, SLANT carries over from para to para.
\#
.nr #DEGREES 15
.ds SLANT \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
.ds SLANTX \ER'#SLANT_ON 0'\ES'0'
\#
.MAC SETSLANT END
.    ie '\\$1'RESET' \{\
.       nr #DEGREES 15
.       if \\n[#PRINT_STYLE]=1 \{\
.          if \\n[#UNDERLINE_SLANT] \{ .return \}
.       \}
.       ds SLANT \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
.    \}
.    el \{\
.       nr #DEGREES \\$1
.       if \\n[#PRINT_STYLE]=1 \{\
.          if \\n[#UNDERLINE_SLANT] \{ .return \}
.       \}
.       ds SLANT \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
.    \}
.    ds SLANTX \ER'#SLANT_ON 0'\ES'0'
.END
\#
\#
\# BOLDER
\# ------
\#
\# SETBOLDER
\# ---------
\# *Arguments:
\#   <amount of emboldening> | RESET
\# *Function:
\#   Modifies register #BOLDER_UNITS for use with \*[BOLDER], or resets
\#   it to the default 700 units.
\# *Notes:
\#   \*[BOLDER] allows pseudo-emboldening of a font where no bold
\#   font exists in a particular family.
\#
\#   Default for SETBOLDER is 700 units.  Do not use unit of measure
\#   with arg to SETBOLDER.
\#
.nr #BOLDER_UNITS 700
\#
.MAC SETBOLDER END
.    if \\n[#IGNORE]=1 \{ .return \}
.    ie '\\$1'RESET' \{ .nr #BOLDER_UNITS 700 \}
.    el \{ .nr #BOLDER_UNITS \\$1 \}
.END
\#
\#
.MAC BOLDER END
\c
.bd \\n(.f \\n[#BOLDER_UNITS]
.END
\#
\#
.MAC BOLDERX END
\c
.bd \\n(.f
.END
\#
\# +++CONDENSE/EXTEND+++
\#
\# CONDENSE/EXTEND
\# ---------------
\# *Arguments:
\#   <percentage to condense/expand type size>
\# *Function:
\#   Stores current point size in z's in #PT_SIZE_IN_UNITS, figures out
\#   new point size (for character width) from arg, and defines string
\#   COND or EXT, which set the type size to the new character width,
\#   and sets the height of type to the value stored in CURRENT_PT_SIZE
\# *Notes:
\#   CONDENSE_OR_EXTEND is invoked from the aliases
\#   CONDENSE and EXTEND.  CONDENSE implies <100, EXTEND
\#   implies >100.  Do not use a percent sign in the argument.
\#
\#   There is no default setting for CONDENSE or EXTEND.
\#   80 is a good approximation of condensed type, 120 is okay
\#   for extended.
\#
\#   The value set by CONDENSE or EXTEND applies to all
\#   subsequent \*[COND] or \*[EXT] escapes until a new value is set.
\#
\#  \*[COND] or \*[EXT] must be turned off before all changes of point
\#  size and reinvoked afterwards (if so desired).  This refers to
\#  changes of point size via control lines AND with via inlines.
\#
.MAC CONDENSE_OR_EXTEND END
.    if '\\$0'CONDENSE' \{\
.       ds $COND_PERCENT \\$1
.       if \\n[#PRINT_STYLE]=1 \{\
.          rm $COND_PERCENT
.          ds $COND_PERCENT 100
.       \}
.       ds COND \
\R'#PT_SIZE_IN_UNITS \En[.ps]'\
\R'#CONDENSE 1'\
\R'#COND_WIDTH (\En[#PT_SIZE_IN_UNITS]u*\E*[$COND_PERCENT]u)/100'\
\Es[\En[#COND_WIDTH]u]\EH'\En[#PT_SIZE_IN_UNITS]u'
.       ds COND_FOR_SUP \
\R'#COND_WIDTH (\En[#SUP_PT_SIZE]u*\E*[$COND_PERCENT]u)/100'\
\Es[\En[#COND_WIDTH]u]\H'\En[#SUP_PT_SIZE]u'
.    \}
.    if '\\$0'EXTEND' \{\
.       ds $EXT_PERCENT \\$1
.       if \\n[#PRINT_STYLE]=1 \{\
.          rm $EXT_PERCENT
.          ds $EXT_PERCENT 100
.       \}
.       ds EXT \
\R'#PT_SIZE_IN_UNITS \En[.ps]'\
\R'#EXTEND 1'\
\R'#EXT_WIDTH (\En[#PT_SIZE_IN_UNITS]u*\E*[$EXT_PERCENT]u)/100'\
\Es[\En[#EXT_WIDTH]u]\EH'\En[#PT_SIZE_IN_UNITS]u'
.       ds EXT_FOR_SUP \
\R'#EXT_WIDTH (\En[#SUP_PT_SIZE]u*\E*[$EXT_PERCENT]u)/100'\
\Es[\En[#EXT_WIDTH]u]\H'\En[#EXT_PT_SIZE]u'
.    \}
.END
\#
.ds CONDX \ER'#CONDENSE 0'\Es0\R'#PT_SIZE_IN_UNITS \En[.ps]'\H'\En[#PT_SIZE_IN_UNITS]u'
.ds EXTX  \ER'#EXTEND   0'\Es0\R'#PT_SIZE_IN_UNITS \En[.ps]'\H'\En[#PT_SIZE_IN_UNITS]u'
\#
\#
\# +++PAD LINES+++ (insert space)
\#
\# PAD MARKER
\# ----------
\# *Arguments:
\#   <character to use for marking pad points>
\# *Function:
\#   Defines string $PAD_MARKER, used in PAD
\# *Notes:
\#   $PAD_MARKER is normally # (the pound sign).
\#
.MAC PAD_MARKER END
.    ds $PAD_MARKER \\$1
.END
\#
\#
\# PAD
\# ---
\# *Argments:
\#   "<string of text with padding markers inserted>"
\# *Function:
\#   Defines and redefines padding character (default=pound sign
\#   unless padding character has been set with PAD_MARKER)
\#   several times so that when the string is output at the end
\#   of the macro, every # has been converted to an equal-sized
\#   amount of padding (blank space) on a line. # is equivalent to
\#   CompuGraphic's old <IS>.
\# *Notes:
\#   String tabs may be marked off during PAD.
\#
.MAC PAD END
.    if \\n(.u=1 \{ .nr #FILL_MODE 1 \}
.    nf
.    if !d$PAD_MARKER .ds $PAD_MARKER #
.    char \\*[$PAD_MARKER] \R'#PAD_COUNT \En[#PAD_COUNT]+1'
.    ds $FAMILY_FOR_PAD \\n[.fam]
\#.    fp \\n[.fp] \\*[$FONT]
.    fp \\n[.fp] \\n[.sty]
.    ds $FONT_FOR_PAD   \\*[$FONT]
.    nr #SIZE_FOR_PAD   \\n[.ps]
.    ds $PAD_STRING \\$1
.    as $PAD_STRING \Ekp
.    di PAD_STRING
.    fam \\*[$FAMILY_FOR_PAD]
\\f[\\*[$FONT_FOR_PAD]]\\s[\\n[#SIZE_FOR_PAD]u]\\*[$PAD_STRING]
.    br
.    di
.    char \\*[$PAD_MARKER] \R'#SPACE_TO_END \En(.l-\Enp'\R'#PAD_SPACE \En[#SPACE_TO_END]/\En[#PAD_COUNT]'
.    di PAD_STRING
.    fam \\*[$FAMILY_FOR_PAD]
\\f]\\*[$FONT_FOR_PAD]]\\s[\\n[#SIZE_FOR_PAD]u]\\*[$PAD_STRING]
.    br
.    di
.    char \\*[$PAD_MARKER] \h'\En[#PAD_SPACE]u'
.    ie \\n[#SILENT] \{\
.       SILENT
.       fam \\*[$FAMILY_FOR_PAD]
\\f[\\*[$FONT_FOR_PAD]]\\s[\\n[#SIZE_FOR_PAD]u]\\*[$PAD_STRING]
.       br
.       SILENT OFF
.    \}
.    el \{\
.       fam \\*[$FAMILY_FOR_PAD]
\\f[\\*[$FONT_FOR_PAD]]\\s[\\n[#SIZE_FOR_PAD]u]\\*[$PAD_STRING]
.       br
.    \}
.    if \\n[#FILL_MODE]=1 \{\
.       fi
.       rr #FILL_MODE
.    \}
.    rr #PAD_COUNT
.    rr #SPACE_TO_END
.    rr #PAD_SPACE
.    rm $PAD_STRING
.    rm PAD_STRING
.    rchar #
.    if '\\$2'NOBREAK' \{\
.       TRAP OFF
.       EOL
.       TRAP
.    \}
.END
\#
\#
\# +++LEADERS+++
\#
.ig
The leader mechanism is primitive, but it works.  Basically, every
macro in this set that includes a line length also sets a single
groff tab stop at the right hand end of the line.  That way,
whenever Ctrl-A is invoked (always at the end of an input line),
leader of the correct length gets deposited.  Ctrl-A is accessed by
the string LEADER (i.e. inline, as \*[LEADER]).  Leaders within tabs
get their length from the tab line length.
..
\#
\# SET LEADER CHARACTER
\# --------------------
\# *Arguments:
\#   <character to use whenever \*[LEADER] is invoked>
\# *Function:
\#   Set leader character.
\#
.MAC LEADER_CHARACTER END
.    lc \\$1
.END
\#
.ds LEADER 
\#
\# +++DROP CAPS+++
\#
\# DROP CAP FAMILY
\# ---------------
\# *Argument:
\#   <family of drop cap>
\# *Function:
\#   Creates or modifies string $DC_FAM.
\#
.MAC DROPCAP_FAMILY END
.    ds $DC_FAM \\$1
.END
\#
\#
\# DROP CAP FONT
\# -------------
\# *Argument:
\#   <font of drop cap>
\# *Function:
\#   Creates or modifies string $DC_FT.
\#
.MAC DROPCAP_FONT END
.    ds $DC_FT \\$1
.END
\#
\#
\# DROPCAP COLOR
\# -------------
\# *Arguments:
\#   <pre-defined XCOLOR or NEWCOLOR>
\# *Function:
\#   Defines string $DC_COLOR to argument.
\# *Notes:
\#   User must define an XCOLOR or NEWCOLOR before using
\#   DC_COLOR.
\#
.MAC DROPCAP_COLOR END
.    if \\n[#PRINT_STYLE]=1 \{ .return \}
.    nr #DC_COLOR 1
.    ds $DC_COLOR \\$1
.END
\#
\#
\# DROP CAP GUTTER
\# ---------------
\# *Argument:
\#   <width of gutter between drop cap and indented text>
\# *Function:
\#   Creates or modifies register #DC_GUT.
\# *Notes:
\#   Requires unit of measure.  Default is 3p.
\#
.MAC DROPCAP_GUTTER END
.    nr #DC_GUT (\\$1)
.END
\#
\#
\# DROP CAP ADJUST
\# ---------------
\# *Argument:
\#   <+|- # of points to in/decrease point size of drop cap letter>
\# *Function:
\#   Creates or modifies string $DC_ADJUST.
\# *Notes:
\#   Despite its best efforts, DROPCAP doesn't always get the point
\#   size of the drop cap critically perfect.  DROPCAP_ADJUST lets
\#   the user add or subtract points (or fractions of points) to
\#   get the size right.
\#
\#   Requires the + or - sign.
\#
.MAC DROPCAP_ADJUST END
.    ds $DC_ADJUST \\$1
.END
\#
\#
\# DROP CAP
\# --------
\# *Arguments:
\#   <dropcap letter> <# of lines> [COND <% to condense> | EXT <% to extend>]
\# *Function:
\#   Calculates point size of dropcap based on # of lines passed as
\#   arg 2.  Sets indent for text based on dropcap width+gutter.
\#   Advances and prints dropcap; reverses and prints indented text
\#   to bottom of dropcap, then resets indent to left margin (plus
\#   any indent that was in effect prior to invoking DROPCAP).
\# *Notes:
\#   Drop caps put a strain on on resource-challenged systems.
\#
\#   Drop caps when using the doc processing macro PP only work with
\#   initial paragraphs (i.e. at doc start, or after heads), only when
\#   DROPCAPS comes immediately after PP, and only when the PRINTSTYLE
\#   is TYPESET.  If these conditions aren't met, DROPCAPS is silently
\#   ignored.
\#
\#   The COND or EXT argument are processed separately from all
\#   other COND or EXT inlines or macros, hence passing COND or
\#   EXT has no effect on running type.
\#
.MAC DROPCAP END
.    if #IGNORE \{ .return \}
.    br
.    if \\n[#DOCS] \{\
.       if \\n[#PRINT_STYLE]=1 \{ .return \}
.       if \\n[#PRINT_STYLE]=2 \{\
.          if \\n[#PP_STYLE]=2 \{ .return \}
.          if \\n[#PP]>1 \{ .return \}
.          ti 0
.       \}
.    \}
.    ds $DROPCAP         \\$1
.    nr #DC_LINES        \\$2-1
.    if \\n[#CONDENSE]=1 \{\
.       ds $RESTORE_COND \\*[$COND_PERCENT]
\\*[CONDX]
.       nr #CONDENSE_WAS_ON 1
.    \}
.    if \\n[#EXTEND]=1 \{\
.       ds $RESTORE_EXT \\*[$EXT_PERCENT]
\\*[EXTX]
.       nr #EXTEND_WAS_ON 1
.    \}
.    if '\\$3'COND'      \{ .CONDENSE \\$4 \}
.    if '\\$3'EXT'       \{ .EXTEND \\$4 \}
.    if !r#DC_GUT        \{ .nr #DC_GUT (3p) \}
.    ds $RESTORE_FAM     \\n[.fam]
.    ds $RESTORE_FT      \\*[$FONT]
.    nr #RESTORE_PT_SIZE \\n[#PT_SIZE]
.    nr #RESTORE_INDENT  \\n(.i
.    SIZESPECS
.    nr #DC_HEIGHT \\n[#DC_LINES]*\\n[#LEAD]+\\n[#CAP_HEIGHT]
.    ie !d$DC_FAM \{ .FAM \\n[.fam] \}
.    el \{ .FAM \\*[$DC_FAM] \}
.    ie !d$DC_FT \{ .FT \\*[$FONT] \}
.    el \{ .FT \\*[$DC_FT] \}
.    while \\n[#GET_DC_HEIGHT]<\\n[#DC_HEIGHT] \{\
.       ps \\n[#PT_SIZE]u+100u
.       SIZESPECS
.       nr #GET_DC_HEIGHT \\n[#CAP_HEIGHT]
.\}
.    if d$DC_ADJUST \{ .ps \\*[$DC_ADJUST]p \}
.    mk x
.    sp \\n[#DC_LINES]v
.    ie \\n[#DC_COLOR]=1 \{\
.       ie !'\\$3'' \{\
.          ie '\\$3'COND' \{ .PRINT \m[\\*[$DC_COLOR]]\\*[COND]\\*[$DROPCAP]\\*[CONDX]\m[] \}
.          el \{ .PRINT \m[\\*[$DC_COLOR]]\\*[EXT]\\*[$DROPCAP]\\*[EXTX]\m[] \}
.       \}
.       el \{ .PRINT \m[\\*[$DC_COLOR]]\\*[$DROPCAP]\m[] \}
.    \}
.    el \{\
.       ie !'\\$3'' \{\
.          ie '\\$3'COND' \{ .PRINT \\*[COND]\\*[$DROPCAP]\\*[CONDX] \}
.          el \{ .PRINT \\*[EXT]\\*[$DROPCAP]\\*[EXTX] \}
.       \}
.       el \{ .PRINT \m[\\*[$DC_COLOR]]\\*[$DROPCAP]\m[] \}
.    \}
.    if '\\$3'COND' \{ \E*[COND] \}
.    if '\\$3'EXT'  \{ \E*[EXT]  \}
.    ie \\n(.i \{ .in +\w'\\*[$DROPCAP]'u+\\n[#DC_GUT]u \}
.    el        \{ .in \w'\\*[$DROPCAP]'u+\\n[#DC_GUT]u \}
.    if '\\$3'COND' \{ \E*[CONDX]\c \}
.    if '\\$3'EXT'  \{ \E*[EXTX]\c \}
.    rt \\nxu
.    FAM \\*[$RESTORE_FAM]
.    FT  \\*[$RESTORE_FT]
.    ps \\n[#RESTORE_PT_SIZE]u
.    if \\n[#CONDENSE_WAS_ON] \{\
.       CONDENSE \\*[$RESTORE_COND]
\\*[COND]\c
.    \}
.    if \\n[#EXTEND_WAS_ON] \{\
.       EXTEND \\*[$RESTORE_EXT]
\\*[EXT]\c
.    \}
.    ie \\n(.u \{ .wh \\n(.du+\\n[#DC_HEIGHT]u-1v DROPCAP_OFF \}
.    el \{ .wh \\n(.du+\\n[#DC_HEIGHT]u DROPCAP_OFF \}
.    rr #CONDENSE_WAS_ON
.    rr #EXTEND_WAS_ON
.    rm $DROPCAP
.    rr #DC_LINES
.    rm $RESTORE_COND
.    rm $RESTORE_EXT
.    rm $RESTORE_FAM
.    rm $RESTORE_FT
.    rr #RESTORE_PT_SIZE
.    rr #RESTORE_INDENT
.    rr #DC_HEIGHT
.    rr #GET_DC_HEIGHT
.    rr x
.END
\#
.MAC DROPCAP_OFF END
'    in \\n[#RESTORE_INDENT]u
.END
\#
\#
\# RULE
\# ----
\# *Argument:
\#   <none>
\# *Function:
\#   Draws a rule the length of the current measure.
\# *Notes:
\#
.MAC RULE END
\c
.    EL
.    if \\n(.u=1 \{\
.       nr #FILL_WAS_ON 1
.       ds $CURRENT_QUAD \\*[$QUAD_VALUE]
.       nf
.    \}
.    ie \\n[#INDENT_ACTIVE] \{\
.       nr #RESTORE_L_LENGTH \\n(.l
.       if \\n[#INDENT_BOTH_ACTIVE] \{ .ll \\n(.lu-\\n[#BL_INDENT]u \}
.       if \\n[#INDENT_LEFT_ACTIVE] \{ .ll \\n(.lu-\\n[#L_INDENT]u \}
.       PRINT \El'\En(.lu'\c
.       ll \\n[#RESTORE_L_LENGTH]u
.       rr #RESTORE_L_LENGTH
.    \}
.    el \{\
.       PRINT \El'\En(.lu'\c
.    \}
.    if r#FILL_WAS_ON \{\
.       fi
.       rr #FILL_WAS_ON
.       QUAD \\*[$CURRENT_QUAD]
.       rm $CURRENT_QUAD
.    \}
.    EL
.END
\#
\# =====================================================================
\#
\# +++WORD AND SENTENCE SPACING+++
\#
\# WORD SPACE CONTROL
\# ------------------
\# *Argument:
\#   <+|->wordspace | DEFAULT
\# *Function:
\#   Increases or decreases interword space by user supplied amount.
\#   If DEFAULT, value is set to 12 (groff default).
\# *Notes:
\#   $WS_CONSTANT is the groff default word space.
\#   $WS_VAR is the user supplied amount by which to in/decrease word space.
\#   $WS is a concatenation of WS_CONSTANT and WS_VAR.
\#
\#   Because the user supplied value requires a literal + or - sign,
\#   the macro argument is stored in a string.
\#
\#   \n[.sss] holds the current sentence space value.
\#
.MAC WS END
.    ds $WS_CONSTANT 12
.    ds $WS_VAR \\$1
.    ie '\\$1'DEFAULT' .ds $WS_VAR +0
.    el                .ds $WS (\\*[$WS_CONSTANT]\\*[$WS_VAR])
.    ie \\n[.sss]=12   \{ .ss \\*[$WS] 12 \}
.    el \{\
.       ss \\*[$WS] (\\*[$WS]\\*[$SS_VAR])
.       SS \\*[$SS_VAR]
.    \}
.END
\#
\#
\# SENTENCE SPACE CONTROL
\# ----------------------
\# *Argument:
\#   <+-sentencespace> | 0 | DEFAULT
\# *Function:
\#   Increases or decreases sentence space by user supplied amount.
\#   If 0, sentence spaces are ignored.  If DEFAULT, value is
\#   set to 12 (groff default).
\# *Notes:
\#   Because the user supplied value requires a literal + or - sign,
\#   the macro argument is stored in a string.
\#
\#   Sentence space applies only to input where sentences are separated
\#   by two spaces (and/or, in fill mode [FLUSH L|R|C or JUSTIFY], an EOL).
\#   Changing .SS when sentences are separated by only one space has
\#   no effect on the space between sentences.
\#
\#   \n[.ss] holds the current wordspace value.
\#   \n[.sss] holds the current sentence space value.
\#
.MAC SS END
.    ie '\\$1'0' \{ .ss \\n[.ss] (\\n[.ss]-\\n[.ss]) \}
.    el \{\
.       ie '\\$1'DEFAULT' \{ .ss \\n[.ss] \}
.       el \{\
.          ds $SS_VAR \\$1
.          ss \\n[.ss] (0\\*[$SS_VAR])
.       \}
.    \}
.END
\#
\#
\# =====================================================================
\#
\# +++INDENTS+++
\#
.ig
There are five styles of indents: left, right, both, temporary,
and hanging.  Each is set/invoked with a different macro.
Indent macros begin with the letter "I", hence .IL means "indent left,"
.IR means "indent right," and so on.

The first time any of the indent macros is used, it requires an
argument--the size of the indent (with a unit of measure).  The
size may also be entered using the \w escape--very useful
for numbered lists using HI.  The unit of measure is required.
Subsequent invocations don't require the argument; the indent
measure remains the same until it's changed by invoking the macro
with an argument again.

If no indents are in effect, the arguments passed to indent macros are
measured from the left and right margins of the page.  If a left indent
or a right indent is already in effect, the arguments passed to
the indent macros are calculated from the current values; in other words,
the arguments are additive.  If you quit an indent and later return
to it, its value will be the value last in effect, unless you pass
it an argument.  If you do pass an argument, it is added to the last
value in effect, unless you cleared the indent with one of
.I<LRB>X/Q macros.

Example
-------

.IL 2P
...some text...
.IL 2P
...some text...
.IQ
...some text...
.IL
...some text...

The first .IL 2P indents text 2P from the left margin.  The second
.IL 2P indents text by an additional 2P, i.e. 4P from the left margin.
.IQ turns the indent off.  The last .IL (which has no argument)
takes its value from the total of all arguments passed to .IL (in
this case, 2P and 2P), therefore it indents 2P+2P from the left
margin, i.e. 4P.  If you wanted the last .IL to indent just 2P,
you'd either have to reset the .IL prior to .IQ (.IL -2P), or pass
the last .IL the argument 2P.

To reverse the sense of an indent added to an indent, you may use
negative values.

Indents can be turned off individually with ILX, IRX, and IBX.
LEFT and RIGHT indents may be combined and manipulated
separately, (e.g. you can have an IL of 2P and an IR of 4P
operative at the same time, and then change, say, the IL to
4P--thereby left indenting 6P--while the IR remains at 4P.

IB automatically turns off IL and IR.  They have to be reinvoked
again when needed. IL and IR automatically turn IB off; it, too,
has to be reinvoked with needed.

All indents can be turned off at once with IQ.  The ILX, IRX, IBX,
and IQ macros simply turn the indents off; the values stored in
the respective indent macros (IL, IR, IB) remain in effect.  If
the user wishes to clear the values, the I<LRB>X macros should be
invoked with the single argument CLEAR.  IQ CLEAR clears out
the values stored for all indent styles.

Indents *must* be turned off before settting string tabs
inside PAD.  Generally, in order not to get confused, it's a
good idea to turn all indents off before setting any tabs.

TI and HI are special cases.  There's no need to turn them off,
since they affect only one line--the first after their
invocation.  Like the other indent styles, the first time
they're invoked, they require a value in iPpcm; each subsequent
invocation without an argument will use the same value.  To
change the value, simply pass a new value.  Values for TI and HI
are *not* additive.

HI presupposes that you already have a left or both indent on.
HI will never hang a line outside the left margin of a document
or column.  In other words, you must have IL or IB on before you
can use HI.
..
\#
\# INDENT LEFT
\# -----------
\#
.MAC IL END
.    if \\n[#INDENT_STYLE_BOTH] \{ .IBX \}
.    nr #INDENT_STYLE_LEFT  1
.    nr #INDENT_ACTIVE      1
.    nr #INDENT_LEFT_ACTIVE 1
.    ie '\\$1'' \{\
.       br
.       in \\n[#L_INDENT]u
.       ta \\n(.lu-\\n[#L_INDENT]u
.    \}
.    el \{\
.       br
.       nr #L_INDENT +(\\$1)
.       in \\n[#L_INDENT]u
.       ta \\n(.lu-\\n[#L_INDENT]u
.    \}
.END
\#
\#
\# +++INDENT RIGHT+++
\#
.MAC IR END
.    if \\n[#INDENT_STYLE_BOTH] \{ .IBX \}
.    nr #INDENT_STYLE_RIGHT   1
.    nr #INDENT_ACTIVE        1
.    nr #INDENT_RIGHT_ACTIVE 1
.    ie '\\$1'' \{\
.       br
.       ie \\n[#TAB_ACTIVE] \{\
.          ll \\n(.lu-\\n[#R_INDENT]u
.          ta \\n(.lu-\\n[#L_INDENT]u
.       \}
.       el \{\
.          ll \\n[#L_LENGTH]u-\\n[#R_INDENT]u
.          ta \\n(.lu-\\n[#L_INDENT]u
.       \}
.    \}
.    el \{\
.       br
.       nr #R_INDENT +(\\$1)
.       ie \\n[#TAB_ACTIVE] \{\
.          ll \\n(.lu-\\n[#R_INDENT]u
.          ta \\n(.lu-\\n[#L_INDENT]u
.       \}
.       el \{\
.          ll \\n[#L_LENGTH]u-\\n[#R_INDENT]u
.          ta \\n(.lu-\\n[#L_INDENT]u
.       \}
.    \}
.END
\#
\#
\# +++INDENT BOTH+++
\#
.MAC IB END
.    if \\n[#INDENT_STYLE_LEFT]  \{ .ILX \}
.    if \\n[#INDENT_STYLE_RIGHT] \{ .IRX \}
.    nr #INDENT_STYLE_BOTH  1
.    nr #INDENT_ACTIVE      1
.    nr #INDENT_BOTH_ACTIVE 1
.    ie '\\$1'' \{\
.       br
.       in \\n[#BL_INDENT]u
.       ie \\n[#TAB_ACTIVE] \{\
.          ll \\n(.lu-\\n[#BR_INDENT]u
.          ta \\n(.lu-\\n[#BR_INDENT]u
.       \}
.       el \{\
.          ll \\n[#L_LENGTH]u-\\n[#BR_INDENT]u
.          ta \\n(.lu-\\n[#BR_INDENT]u
.       \}
.    \}
.    el \{\
.       br
.       nr #BL_INDENT (\\n[#INDENT]+\\$1)
.       ie \\n[#NUM_ARGS]=2 \{ .nr #BR_INDENT +(\\$2) \}
.       el                  \{ .nr #BR_INDENT \\n[#BL_INDENT] \}
.       ie \\n[#TAB_ACTIVE] \{\
.          in \\n[#BL_INDENT]u
.          ll \\n(.lu-\\n[#BR_INDENT]u
.          ta \\n(.lu-\\n[#BL_INDENT]u
.       \}
.       el \{\
.          in \\n[#BL_INDENT]u
.          ll \\n[#L_LENGTH]u-\\n[#BR_INDENT]u
.          ta \\n(.lu-\\n[#BR_INDENT]u
.       \}
.    \}
.END
\#
\#
\# +++TEMPORARY INDENT+++
\#
.MAC TI END
.    br
.    ie '\\$1'' \{\
.       ti \\n[#T_INDENT]u
.       if \\n[#INDENT_LEFT_ACTIVE] \{\
.          ti \\n[#T_INDENT]u+\\n[#L_INDENT]u
.       \}
.       if \\n[#INDENT_BOTH_ACTIVE] \{\
.          ti \\n[#T_INDENT]u+\\n[#BL_INDENT]u
.       \}
.    \}
.    el \{\
.       nr #T_INDENT (\\$1)
.       ti \\n[#T_INDENT]u
.    \}
.END
\#
\#
\# +++HANGING INDENT+++
\#
.MAC HI END
.    ie '\\$1'' \{ .ti -\\n[#HL_INDENT]u \}
.    el \{\
.       nr #HL_INDENT (\\$1)
.       ti -\\n[#HL_INDENT]u
.    \}
.END
\#
\#
\# +++INDENTS OFF+++
\#
.MAC ILX END
.    br
.    in 0
.    rr #INDENT_LEFT_ACTIVE
.    if '\\$1'CLEAR' \{\
.       rr #L_INDENT
.       rr #INDENT_STYLE_LEFT
.    \}
.END
\#
\#
.MAC IRX END
.    br
.    rr #INDENT_RIGHT_ACTIVE
.    ie \\n[#TAB_ACTIVE] \{ .TAB\\n[#CURRENT_TAB] \}
.    el \{\
.       ie \\n[#COLUMNS] \{\
.          ll \\n[#COL_L_LENGTH]u
.          ta \\n(.lu
.       \}
.       el \{\
.          ll \\n[#L_LENGTH]u
.          ta \\n(.lu
.       \}
.    \}
.    if '\\$1'CLEAR' \{\
.       rr #R_INDENT
.       rr #INDENT_STYLE_RIGHT
.    \}
.END
\#
\#
.MAC IBX END
.    br
.    in 0
.    rr #INDENT_BOTH_ACTIVE
.    ie \\n[#TAB_ACTIVE] \{ .TAB\\n[#CURRENT_TAB] \}
.    el \{\
.       ie \\n[#COLUMNS] \{\
.          ll \\n[#COL_L_LENGTH]u
.          ta \\n(.lu
.       \}
.       el \{\
.          ll \\n[#L_LENGTH]u
.          ta \\n(.lu
.       \}
.    \}
.    if '\\$1'CLEAR' \{\
.       rr #BL_INDENT
.       rr #BR_INDENT
.       rr #INDENT_STYLE_BOTH
.    \}
.END
\#
\#
.MAC IX END
.    if '\\$0'IX' \{\
.       if !\\n[#IX_WARN] \{\
.          tm1 "[mom]: Use of .IX is now deprecated.  Use .IQ instead.
.          tm1 "      .IX will continue to behave as before, but to
.          tm1 "       avoid this message, please update your document.
.          nr #IX_WARN 1
.       \}
.    \}
.    br
.    in 0
.    rr #INDENT_LEFT_ACTIVE
.    rr #INDENT_RIGHT_ACTIVE
.    rr #INDENT_BOTH_ACTIVE
.    if \\n[#INDENT_STYLE_RIGHT] \{\
.       ie \\n[#TAB_ACTIVE] \{ .TAB\\n[#CURRENT_TAB] \}
.       el \{\
.          ie \\n[#COLUMNS] \{\
.             ll \\n[#COL_L_LENGTH]u
.             ta \\n(.lu
.          \}
.          el \{\
.             ll \\n[#L_LENGTH]u
.             ta \\n(.lu
.          \}
.       \}
.    \}
.    if \\n[#INDENT_STYLE_BOTH] \{\
.       ie \\n[#TAB_ACTIVE] \{ .TAB\\n[#CURRENT_TAB] \}
.       el \{\
.          ie \\n[#COLUMNS] \{\
.             ll \\n[#COL_L_LENGTH]u
.             ta \\n(.lu
.          \}
.          el \{\
.             ll \\n[#L_LENGTH]u
.             ta \\n(.lu
.          \}
.       \}
.    \}
.    if '\\$1'CLEAR' \{\
.       if \\n[#INDENT_STYLE_RIGHT] \{\
.          ie \\n[#TAB_ACTIVE] \{ .TAB\\n[#CURRENT_TAB] \}
.          el \{\
.             ie \\n[#COLUMNS] \{\
.                ll \\n[#COL_L_LENGTH]u
.                ta \\n(.lu
.             \}
.             el \{\
.                ll \\n[#L_LENGTH]u
.                ta \\n(.lu
.             \}
.          \}
.       \}
.       if \\n[#INDENT_STYLE_BOTH] \{\
.          ie \\n[#TAB_ACTIVE] \{ .TAB\\n[#CURRENT_TAB] \}
.          el \{\
.             ie \\n[#COLUMNS] \{\
.                ll \\n[#COL_L_LENGTH]u
.                ta \\n(.lu
.             \}
.             el \{\
.                ll \\n[#L_LENGTH]u
.                ta \\n(.lu
.             \}
.          \}
.       \}
.       rr #L_INDENT
.       rr #R_INDENT
.       rr #BL_INDENT
.       rr #BR_INDENT
.       rr #T_INDENT
.       rr #H_INDENT
.       rr #INDENT_STYLE_LEFT
.       rr #INDENT_STYLE_RIGHT
.       rr #INDENT_STYLE_BOTH
.    \}
.    rr #INDENT_ACTIVE
.END
\#
\# =====================================================================
\#
\# +++MULTIPLE COLUMNS+++
\#
\# MULTIPLE COLUMNS ON
\# -------------------
\# *Arguments:
\#   <none>
\# *Function:
\#   Marks the top of a column set
\#
.MAC MCO END
.mk c
.END
\#
\# MULTIPLE COLUMN RETURN
\# ----------------------
\# *Arguments:
\#   <none>
\# *Function:
\#   Returns to the top of a column set
\#
.MAC MCR END
.    TRAP OFF
.    sp |\\ncu
.    TRAP
.END
\#
\# MULTIPLE COLUMNS OFF
\# --------------------
\# *Arguments:
\#   <none> | <lead to advance beneath bottom of deepest column>
\# *Function:
\#   Advances to the end of a column set
\# *Notes:
\#   With no argument, advances to the next baseline (at the current
\#   leading value) beneath the longest column.  With an argument
\#   (which requires a unit of measure), advances arg distance
\#   beneath the baseline of the deepest column.  If the argument
\#   is zero, advances to the baseline of the deepest column.
\#
.MAC MCX END
.    ie '\\$1'' \{\
.       TQ
.       sp |\\n(.hu
.    \}
.    el \{\
.       nr #MCX_ALD (\\$1)
.       TQ
.       ie \\n[#MCX_ALD]=0 \{ .sp |\\n(.hu-1v \}
.       el \{ .sp |\\n(.hu+\\n[#MCX_ALD]u \}
.       rr #MCX_ALD
.    \}
.END
\#
\# =====================================================================
\#
\# +++TYPESETTING SUPPORT MACROS+++
\#
\# TRAP
\# ----
\# *Arguments:
\#   toggle
\# *Function:
\#   Enables/disables traps.
\# *Notes:
\#   EL and TN don't function as advertised on the last line before
\#   a trap (when they break the preceding line, they spring the
\#   trap, and groff won't back up to the line preceding the trap).
\#   TRAP is a kludge to get EL and TN work properly on last lines.
\#   The user simply enloses the offending lines in TRAP OFF/TRAP.
\#
.MAC TRAP END
.    ie '\\$1'' \{ .vpt 1 \}
.    el \{ .vpt 0 \}
.END
\#
\#
\# SILENT
\# ------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Diverts text so that it doesn't print, or turns the function off.
\# *Notes:
\#   Useful for setting up autotabs where you don't want the line with
\#   the tab marks to print.
\#
\#   Also aliased as COMMENT, in case user wants to input a batch of
\#   text that doesn't print.
\#
.MAC SILENT END
.    nr #SILENT 1
.    if \\n[#QUAD] \{ .br \}
.    ie '\\$1'' \{ .di NO_FLASH \}
.    el \{\
.       br
.       di
.       rm NO_FLASH
.       rr #SILENT
.    \}
.END
\#
\#
\# PRINT
\# -----
\# *Function:
\#   Prints anything.  A macro that helps keep my code nicely indented.
\#
.MAC PRINT END
.    nop \\$*
.END
\#
\#
\# CAPS
\# ----
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Converts text to caps, or, if OFF, reverts to normal caps/lc.
\#
.MAC CAPS END
.    ie '\\$1'' \{\
.       tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
.       tr à\[`A]
.       tr â\[^A]
.       tr á\['A]
.       tr ä\[:A]
.       tr å\[oA]
.       tr ã\[~A]
.       tr æ\[AE]
.       tr è\[`E]
.       tr ê\[^E]
.       tr é\['E]
.       tr ë\[:E]
.       tr ì\[`I]
.       tr î\[^I]
.       tr í\['I]
.       tr ï\[:I]
.       tr ò\[`O]
.       tr ô\[^O]
.       tr ó\['O]
.       tr ö\[:O]
.       tr õ\[~O]
.       tr ø\[/O]
.       tr ù\[`U]
.       tr û\[^U]
.       tr ú\['U]
.       tr ü\[:U]
.       tr ç\[,C]
.       tr ð\[-D]
.       tr ñ\[~N]
.       tr þ\[TP]
.       tr ý\['Y]
.       tr ÿ\[:Y]
.       nr #CAPS_ON 1
.    \}
.    el \{\
.       tr aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz
.       tr à\[`a]
.       tr â\[^a]
.       tr á\['a]
.       tr ä\[:a]
.       tr å\[oa]
.       tr ã\[~a]
.       tr æ\[ae]
.       tr è\[`e]
.       tr ê\[^e]
.       tr é\['e]
.       tr ë\[:e]
.       tr ì\[`i]
.       tr î\[^i]
.       tr í\['i]
.       tr ï\[:i]
.       tr ò\[`o]
.       tr ô\[^o]
.       tr ó\['o]
.       tr ö\[:o]
.       tr õ\[~o]
.       tr ø\[/o]
.       tr ù\[`u]
.       tr û\[^u]
.       tr ú\['u]
.       tr ü\[:u]
.       tr ç\[,c]
.       tr ð\[Sd]
.       tr ñ\[~n]
.       tr þ\[Tp]
.       tr ý\['y]
.       tr ÿ\[:y]
.       rr #CAPS_ON
.    \}
.END
\#
\# SIZESPECS
\# ---------
\# Argument:
\#   <none>
\# Function:
\#   Gets cap-height, x-height, and descender depth of the
\#   current font at the current point size.
\# *Notes:
\#   The routine is diverted so it remains invisible to output.
\#
.MAC SIZESPECS END
.    di TYPESIZE
E\\R'#CAP_HEIGHT \\n[.cht]'
e\\R'#X_HEIGHT \\n[.cht]'
y\\R'#DESCENDER \\n[.cdp]'
.    br
.    di
.END
\#
\# =====================================================================
\#
\# +++TYPESETTING ALIASES+++
\#
.ALIAS    ADD_SPACE       ALD
.ALIAS    CENTRE          CENTER
.ALIAS    COLOUR          COLOR
.ALIAS    COMMENT         SILENT
.ALIAS    CONDENSE        CONDENSE_OR_EXTEND
.ALIAS    EXTEND          CONDENSE_OR_EXTEND
.ALIAS    FAM             FAMILY
.ALIAS    HYPHENATE       HY
.ALIAS    HYPHENATION     HY
.ALIAS    HYSET           HY_SET
.ALIAS    IBQ             IBX
.ALIAS    ILQ             ILX
.ALIAS    IQ              IX
.ALIAS    IRQ             IRX
.ALIAS    LIG             LIGATURES
.ALIAS    NEWCOLOUR       NEWCOLOR
.ALIAS    PADMARKER       PAD_MARKER
.ALIAS    SP              ALD
.ALIAS    SPACE           ALD
.ALIAS    TABSET          TAB_SET
.ALIAS    TB              TAB
.ALIAS    UNDERSCORE_2    UNDERSCORE2
.ALIAS    XCOLOUR         XCOLOR
\#
\#
\# ====================================================================
\#
\# DOCUMENT PROCESSING MACROS, STRINGS AND ALIASES
\# ===============================================
\#
\# +++PAGE DIMENSIONS+++
\#
\# PAPER SIZE
\# ----------
\# *Arguments:
\#   LETTER | LEGAL | STATEMENT | TABLOID | LEDGER | FOLIO | QUARTO | 10x14 | EXECUTIVE | A3 | A4 | A5 | B4 | B5
\# *Function:
\#   Sets up dimensions for different paper sizes.
\#
.MAC PAPER END
.    ds $PAPER \\$1
.    if '\\*[$PAPER]'LETTER' \{\
.       PAGEWIDTH  8.5i
.       PAGELENGTH 11i
.    \}
.    if '\\*[$PAPER]'LEGAL' \{\
.       PAGEWIDTH  8.5i
.       PAGELENGTH 14i
.    \}
.    if '\\*[$PAPER]'STATEMENT' \{\
.       PAGEWIDTH  5.5i
.       PAGELENGTH 8.5i
.    \}
.    if '\\*[$PAPER]'TABLOID' \{\
.       PAGEWIDTH  11i
.       PAGELENGTH 17i
.    \}
.    if '\\*[$PAPER]'LEDGER' \{\
.       PAGEWIDTH  17i
.       PAGELENGTH 11i
.    \}
.    if '\\*[$PAPER]'FOLIO' \{\
.       PAGEWIDTH  8.5i
.       PAGELENGTH 13i
.    \}
.    if '\\*[$PAPER]'QUARTO' \{\
.       PAGEWIDTH  610p
.       PAGELENGTH 780p
.    \}
.    if '\\*[$PAPER]'10x14' \{\
.       PAGEWIDTH  10i
.       PAGELENGTH 14i
.    \}
.    if '\\*[$PAPER]'EXECUTIVE' \{\
.       PAGEWIDTH  7.25i
.       PAGELENGTH 10.5i
.    \}
.    if '\\*[$PAPER]'A3' \{\
.       PAGEWIDTH  842p
.       PAGELENGTH 1190p
.    \}
.    if '\\*[$PAPER]'A4' \{\
.       PAGEWIDTH  595p
.       PAGELENGTH 842p
.    \}
.    if '\\*[$PAPER]'A5' \{\
.       PAGEWIDTH  421p
.       PAGELENGTH 595p
.    \}
.    if '\\*[$PAPER]'B4' \{\
.       PAGEWIDTH  709p
.       PAGELENGTH 1002p
.    \}
.    if '\\*[$PAPER]'B5' \{\
.       PAGEWIDTH  501p
.       PAGELENGTH 709p
.    \}
.    if !r#L_MARGIN \{ .L_MARGIN \\n(.o \}
.    if !r#R_MARGIN \{ .R_MARGIN 1i \}
.END
\#
\#
\# ====================================================================
\#
\# +++PRINTSTYLE -- TYPEWRITE OR TYPESET+++
\#
\# PRINTSTYLE
\# ----------
\# *Arguments:
\#   TYPESET | TYPEWRITE [SINGLESPACE]
\# *Function:
\#   Sets type specs for typewriter-style or typeset output.
\# *Notes:
\#   Number registers: TYPEWRITE=1, TYPESET=2.
\#
.MAC PRINTSTYLE END
.    if !\\n[#COLLATE]=1 \{\
.       if !d$PAPER \{ .PAPER LETTER \}
.       if '\\$1'TYPEWRITE' \{\
.          nr #PRINT_STYLE 1
.          if !\\n[#DOC_TYPE]=4 \{ .L_MARGIN 6P \}
.          if !\\n[#DOC_TYPE]=4 \{ .R_MARGIN 6P \}
.          TYPEWRITER
.          color 0
.          ie '\\$2'SINGLESPACE' \{\
.             nr #SINGLE_SPACE 1
.             vs 12
.             nr #ORIGINAL_DOC_LEAD \\n(.v
.          \}
.          el \{\
.             vs 24
.             nr #ORIGINAL_DOC_LEAD \\n(.v
.          \}
.          QUAD    L
.          HY      OFF
.          SMARTQUOTES OFF
.          if !\\n[#PP_INDENT] \{\
.             in 3P                 \"Set indent
.             nr #PP_INDENT \\n(.i  \"Read into #PP_INDENT
.             in 0                  \"Remove indent
.          \}
.          HDRFTR_RIGHT_CAPS
.          nr #BOLDER_UNITS 0
.          nr #CONDENSE 0
.          nr #EXTEND 0
.          rm IT
.          rm BD
.          rm BDI
.          rm PREV
.          UNDERLINE_SLANT
.          UNDERLINE_ITALIC
.          UNDERLINE_QUOTES
.          nr #IGNORE_COLUMNS 1
.          char \(em --
.          tr `'
.       \}
.       if '\\$1'TYPESET' \{\
.          nr #PRINT_STYLE 2
.          if !\\n[#DOC_TYPE]=4 \{ .L_MARGIN 6P \}
.          if !\\n[#DOC_TYPE]=4 \{ .R_MARGIN 6P \}
.          FAMILY  T
.          FT      R
.          if !\\n[#DOC_TYPE]=4 \{ .PT_SIZE 12.5 \}
.          if !\\n[#DOC_TYPE]=4 \{ .LS 16 \}
.          JUSTIFY
.          HY
.          HY_SET 2 36p 1p
.          KERN
.          LIG
.          SS 0
.          SMARTQUOTES
.          if !\\n[#PP_INDENT] \{\
.             in 2m                 \"Set indent
.             nr #PP_INDENT \\n(.i  \"Read into #PP_INDENT
.             in 0                  \"Remove indent
.          \}
.          HDRFTR_RIGHT_CAPS
.          rr #IGNORE_COLUMNS
.       \}
.    \}
.END
\#
\#
\# Macros to control behaviour of PRINTSTYLE TYPEWRITE
\#
\# First, a little utility macro.
\#
.MAC TYPEWRITER END
.    fam C
.    ft  R
.    ps  12
.END
\#
\#
\# ITALIC MEANS ITALIC
\# -------------------
\# *Argument:
\#   <none>
\# *Function:
\#   Instructs TYPEWRITE to treat italics as italics, whether
\#   invoked via control lines or inline.
\# *Notes:
\#   ITALIC_MEANS_ITALIC and UNDERLINE_ITALIC are mututally exclusive,
\#   hence invoking the one automatically turns off the other.
\#
.MAC ITALIC_MEANS_ITALIC END
.    if \\n[#PRINT_STYLE]=1 \{\
.       nr #ITALIC_MEANS_ITALIC 1
.       rr #UNDERLINE_ITALIC
.       rm ROM
.       rm IT
.       rm PREV
.       ds ROM  \EfR
.       ds IT   \EfI
.       ds PREV \EfR
.    \}
.END
\#
\#
\# UNDERLINE ITALIC
\# ----------------
\# *Argument:
\#   <none>
\# *Function:
\#   Instructs TYPEWRITE to underline italics, whether invoked
\#   via control lines or inline.
\# *Notes:
\#   UNDERLINE_ITALIC and ITALIC_MEANS_ITALIC are mututally exclusive,
\#   hence invoking the one automatically turns off the other.
\#
\#   UNDERLINE_ITALIC is the default for TYPEWRITE.
\#
.MAC UNDERLINE_ITALIC END
.    if \\n[#PRINT_STYLE]=1 \{\
.       nr #UNDERLINE_ITALIC 1
.       rr #ITALIC_MEANS_ITALIC
.       rm ROM
.       rm IT
.       rm PREV
.       ds ROM  \E*[ULX]
.       ds IT   \E*[UL]
.       ds PREV \E*[ULX]
.    \}
.END
\#
\#
\# UNDERLINE SLANT
\# ---------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Instructs TYPEWRITE to underline occurences of \*[SLANT], or
\#   turns feature off.
\# *Notes:
\#   Users may want \*[SLANT] to mean slant in TYPEWRITE, although
\#   most of the time, \*[SLANT] most likely means the user wanted
\#   italic but didn't have it, ergo the need to tell TYPEWRITE to
\#   treat \*[SLANT] as italic (i.e. underlined).
\#
\#   UNDERLINE_SLANT and SLANT_MEANS_SLANT are mututally exclusive,
\#   hence invoking the one automatically turns off the other.
\#
\#   UNDERLINE_SLANT is the default for TYPEWRITE.
\#
.MAC UNDERLINE_SLANT END
.    if \\n[#PRINT_STYLE]=1 \{\
.       rr #SLANT_MEANS_SLANT
.       nr #UNDERLINE_SLANT 1
.       rm SLANT
.       rm SLANTX
.       ds SLANT  \ER'#SLANT_ON 1'\E*[UL]
.       ds SLANTX \ER'#SLANT_ON 0'\E*[ULX]
.    \}
.END
\#
\#
.MAC SLANT_MEANS_SLANT END
.    if \\n[#PRINT_STYLE]=1 \{\
.       rr #UNDERLINE_SLANT
.       nr #SLANT_MEANS_SLANT 1
.       rm SLANT
.       rm SLANTX
.       ds SLANT  \ER'#SLANT_ON 1'\ES'\En[#DEGREES]'
.       ds SLANTX \ER'#SLANT_ON 0'\ES'0'
.    \}
.END
\#
\#
.MAC IGNORE_COLUMNS END
.    if \\n[#PRINT_STYLE]=1 \{ .nr #NO_COLUMNS 1 \}
.END
\#
\#
\# ====================================================================
\#
\# +++COPY STYLE -- DRAFT OR FINAL+++
\#
\# COPY STYLE
\# ----------
\# *Arguments:
\#   DRAFT | FINAL
\# *Function:
\#   Sets registers that are used to determine what to put
\#   in the default header, and how to number pages.
\# *Notes:
\#   DOCTYPE must come before COPYSTYLE.
\#
.MAC COPYSTYLE END
.    ds $COPY_STYLE \\$1
.    if '\\*[$COPY_STYLE]'DRAFT' \{\
.       nr #COPY_STYLE 1
.       if !d$DRAFT \{ .DRAFT 1 \}
.    \}
.    if '\\*[$COPY_STYLE]'FINAL' \{ .nr #COPY_STYLE 2         \}
.    if !d$CHAPTER_STRING        \{ .CHAPTER_STRING "Chapter" \}
.    if !d$DRAFT_STRING          \{ .DRAFT_STRING "Draft"     \}
.    if !d$REVISION_STRING       \{ .REVISION_STRING "Rev."   \}
.\" Default
.    if \\n[#DOC_TYPE]=1 \{\
.       ie \\n[#COPY_STYLE]=1 \{\
.          ie \\n[#PAGENUM_STYLE_SET] \{ .PAGENUM_STYLE \\*[$PAGENUM_STYLE] \}
.          el \{ .PAGENUM_STYLE roman \}
.          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
.             ie \\n[#DRAFT_WITH_PAGENUM] \{\
.                ds $HDRFTR_CENTER
.             \}
.             el \{\
.                ie '\\*[$REVISION]'' \{\
.                   ds $HDRFTR_CENTER \
                    \\*[$DRAFT_STRING]\\*[$DRAFT]
.                \}
.                el \{\
.                   ds $HDRFTR_CENTER \
                    \\*[$DRAFT_STRING]\\*[$DRAFT], \
                    \\*[$REVISION_STRING] \\*[$REVISION]
.                \}
.             \}
.          \}
.       \}
.       el \{\
.          ie \\n[#PAGENUM_STYLE_SET] \{ .PAGENUM_STYLE \\*[$PAGENUM_STYLE] \}
.          el \{ .PAGENUM_STYLE DIGIT \}
.          if r#DRAFT_WITH_PAGENUM \{ .rr #DRAFT_WITH_PAGENUM \}
.          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
.             ds $HDRFTR_CENTER
.             rr #USER_DEF_HDRFTR_CENTER
.          \}
.       \}
.    \}
.\" Chapter
.    if \\n[#DOC_TYPE]=2 \{\
.\" Copystyle DRAFT
.       ie \\n[#COPY_STYLE]=1 \{\
.          ie \\n[#PAGENUM_STYLE_SET] \{ .PAGENUM_STYLE \\*[$PAGENUM_STYLE] \}
.          el \{ .PAGENUM_STYLE roman \}
.          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
.             ie \\n[#DRAFT_WITH_PAGENUM] \{\
.                ie '\\*[$CHAPTER]'' \{\
.                   ie !'\\*[$CHAPTER_TITLE]'' \{\
.                      ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
.                   \}
.                   el .ds $HDRFTR_CENTER \\*[$CHAPTER_STRING]
.                \}
.                el \{\
.                   ie !'\\*[$CHAPTER_TITLE]'' \{\
.                      ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
.                   \}
.                   el .ds $HDRFTR_CENTER \\*[$CHAPTER_STRING] \\*[$CHAPTER]
.                \}
.             \}
.             el \{\
.                ie '\\*[$REVISION]'' \{\
.                   ie '\\*[$CHAPTER]'' \{\
.                      ie !'\\*[$CHAPTER_TITLE]'' \{\
.                         ie '\\*[$DRAFT]'' \{\
.                            ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
.                         \}
.                         el \{\
.                            ds $HDRFTR_CENTER \
                             \\*[$CHAPTER_TITLE], \
                             \\*[$DRAFT_STRING]\\*[$DRAFT]
.                         \}
.                      \}
.                      el \{\
.                         ie '\\*[$DRAFT]'' \{\
.                            ds $HDRFTR_CENTER \
                             \\*[$CHAPTER_STRING]
.                         \}
.                         el \{\
.                            ds $HDRFTR_CENTER \
                             \\*[$CHAPTER_STRING], \
                             \\*[$DRAFT_STRING]\\*[$DRAFT]
.                         \}
.                      \}
.                   \}
.                   el \{\
.                      ie !'\\*[$CHAPTER_TITLE]'' \{\
.                         ie '\\*[$DRAFT]'' \{\
.                            ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
.                         \}
.                         el \{\
.                            ds $HDRFTR_CENTER \
                             \\*[$CHAPTER_TITLE], \
                             \\*[$DRAFT_STRING]\\*[$DRAFT]
.                         \}
.                      \}
.                      el \{\
.                         ie '\\*[$DRAFT]'' \{\
.                            ds $HDRFTR_CENTER \
                             \\*[$CHAPTER_STRING] \\*[$CHAPTER]
.                         \}
.                         el \{\
.                            ds $HDRFTR_CENTER \
                             \\*[$CHAPTER_STRING] \\*[$CHAPTER], \
                             \\*[$DRAFT_STRING]\\*[$DRAFT]
.                         \}
.                      \}
.                   \}
.                \}
.                el \{\
.                   ie '\\*[$CHAPTER]'' \{\
.                      ie !'\\*[$CHAPTER_TITLE]'' \{\
.                         ie '\\*[$DRAFT]'' \{\
.                            ds $HDRFTR_CENTER \
                             \\*[$CHAPTER_TITLE], \
                             \\*[$REVISION_STRING] \\*[$REVISION] 
.                         \}
.                         el \{\
.                            ds $HDRFTR_CENTER \
                             \\*[$CHAPTER_TITLE], \
                             \\*[$DRAFT_STRING]\\*[$DRAFT], \
                             \\*[$REVISION_STRING] \\*[$REVISION] 
.                         \}
.                      \}
.                      el \{\
.                         ie '\\*[$DRAFT]'' \{\
.                            ds $HDRFTR_CENTER \
                             \\*[$CHAPTER_STRING], \
                             \\*[$REVISION_STRING] \\*[$REVISION] 
.                         \}
.                         el \{\
.                            ds $HDRFTR_CENTER \
                             \\*[$CHAPTER_STRING], \
                             \\*[$DRAFT_STRING]\\*[$DRAFT], \
                             \\*[$REVISION_STRING] \\*[$REVISION] 
.                         \}
.                      \}
.                   \}
.                   el \{\
.                      ie !'\\*[$CHAPTER_TITLE]'' \{\
.                         ie '\\*[$DRAFT]'' \{\
.                            ds $HDRFTR_CENTER \
                             \\*[$CHAPTER_TITLE], \
                             \\*[$REVISION_STRING] \\*[$REVISION] 
.                         \}
.                         el \{\
.                            ds $HDRFTR_CENTER \
                             \\*[$CHAPTER_TITLE], \
                             \\*[$DRAFT_STRING]\\*[$DRAFT], \
                             \\*[$REVISION_STRING] \\*[$REVISION] 
.                         \}
.                      \}
.                      el \{\
.                         ie '\\*[$DRAFT]'' \{\
.                            ds $HDRFTR_CENTER \
                             \\*[$CHAPTER_STRING] \\*[$CHAPTER], \
                             \\*[$REVISION_STRING] \\*[$REVISION] 
.                         \}
.                         el \{\
.                            ds $HDRFTR_CENTER \
                             \\*[$CHAPTER_STRING] \\*[$CHAPTER], \
                             \\*[$DRAFT_STRING]\\*[$DRAFT], \
                             \\*[$REVISION_STRING] \\*[$REVISION] 
.                         \}
.                      \}
.                   \}
.                \}
.             \}
.          \}
.       \}
.\" Copystyle FINAL
.       el \{\
.          if r#DRAFT_WITH_PAGENUM \{ .rr #DRAFT_WITH_PAGENUM \}
.          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
.             ie \\n[#PAGENUM_STYLE_SET] \{ .PAGENUM_STYLE \\*[$PAGENUM_STYLE] \}
.             el \{ .PAGENUM_STYLE DIGIT \}
.             ie '\\*[$CHAPTER]'' \{\
.                ie !'\\*[$CHAPTER_TITLE]'' \{\
.                   ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
.                \}
.                el \{\
.                   ds $HDRFTR_CENTER \\*[$CHAPTER_STRING]
.                \}
.             \}
.             el \{\
.                ie !'\\*[$CHAPTER_TITLE]'' \{\
.                   ds $HDRFTR_CENTER \\*[$CHAPTER_TITLE]
.                \}
.                el \{\
.                   ds $HDRFTR_CENTER \\*[$CHAPTER_STRING] \\*[$CHAPTER]
.                \}
.             \}
.          \}
.       \}
.    \}
.\" Named
.    if \\n[#DOC_TYPE]=3 \{\
.       ie \\n[#COPY_STYLE]=1 \{\
.          ie \\n[#PAGENUM_STYLE_SET] \{ .PAGENUM_STYLE \\*[$PAGENUM_STYLE] \}
.          el \{ .PAGENUM_STYLE roman \}
.          ie \\n[#DRAFT_WITH_PAGENUM] \{\
.             ds $HDRFTR_CENTER \\*[$DOC_TYPE]
.          \}
.          el \{\
.             if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
.                ie '\\*[$REVISION]'' \{\
.                   ie '\\*[$DRAFT]'' \{\
.                      ds $HDRFTR_CENTER \\*[$DOC_TYPE]
.                   \}
.                   el \{\
.                      ds $HDRFTR_CENTER \
                       \\*[$DOC_TYPE], \
                       \\*[$DRAFT_STRING]\\*[$DRAFT]
.                   \}
.                \}
.                el \{\
.                   ie '\\*[$DRAFT]'' \{\
.                      ds $HDRFTR_CENTER \
                       \\*[$DOC_TYPE], \
                       \\*[$REVISION_STRING] \\*[$REVISION]
.                   \}
.                   el \{\
.                      ds $HDRFTR_CENTER \
                       \\*[$DOC_TYPE], \
                       \\*[$DRAFT_STRING]\\*[$DRAFT], \
                       \\*[$REVISION_STRING] \\*[$REVISION]
.                   \}
.                \}
.             \}
.          \}
.       \}
.       el \{\
.          if r#DRAFT_WITH_PAGENUM \{ .rr #DRAFT_WITH_PAGENUM \}
.          if \\n[#USER_DEF_HDRFTR_CENTER]=0 \{\
.             ie \\n[#PAGENUM_STYLE_SET] \{ .PAGENUM_STYLE \\*[$PAGENUM_STYLE] \}
.             el \{ .PAGENUM_STYLE DIGIT \}
.             ds $HDRFTR_CENTER \\*[$DOC_TYPE]
.          \}
.       \}
.    \}
.END
\#
\# ====================================================================
\#
\# +++COLLECT DOC INFO -- STRINGS AND REGISTERS FOR REFERENCE MACROS+++
\#
\# *Arguments:
\#   various string/register arguments
\# *Function:
\#   Collect information about documents.
\#
\#
.MAC DOCTITLE END
.    ds $DOC_TITLE \\$1
.END
\#
.MAC TITLE END \"Document title
.    ds $TITLE \\$1
.END
\#
\#
.MAC SUBTITLE END \"Document sub-title
.    ds $SUBTITLE \\$1
.END
\#
\#
.MAC CHAPTER END \"If document is a chapter, the chapter number
.    ds $CHAPTER \\$1
.END
\#
\#
.MAC CHAPTER_TITLE END \" This defines what comes after Chapter #
.    ds $CHAPTER_TITLE \\$1
.END
\#
\#
.MAC DRAFT END \"Draft number
.    ie '\\$1'' .ds $DRAFT 
.    el         .ds $DRAFT " \\$1
.END
\#
\#
.MAC REVISION END \"Revision number
.    ds $REVISION \\$1
.END
\#
\#
.MAC DRAFT_WITH_PAGENUMBER END \"Attach draft/revision strings to page number
.    nr #DRAFT_WITH_PAGENUM 1
.END
\#
\#
.MAC AUTHOR END \"Author.  Enclose all args fully in double quotes.
.    nr #AUTHOR_NUM -1 1
.    while \\n[#NUM_ARGS]>\\n[#AUTHOR_NUM] \{\
.       ds $AUTHOR_\\n+[#AUTHOR_NUM] \\$\\n[#AUTHOR_NUM]
.\}
.    nr #NUM_AUTHORS \\n[#NUM_ARGS]%2 \"Use mod 2 to test if odd or even # of authors
.    ie \\n[#NUM_AUTHORS]=1 \{ .nr #AUTHOR_LINES 0  \}
.    el \{ .nr #AUTHOR_LINES 1 \}
.END
\#
\#
.MAC COPYRIGHT END \"For use on cover page only
.   ds $COPYRIGHT \[co]\\$1
.END
\#
\#
.MAC MISC END \"For use on cover page only; enclose all args in double quotes
.    nr #MISC_NUM -1 1
.    while \\n[#NUM_ARGS]>\\n[#MISC_NUM] \{\
.       ds $MISC_\\n+[#MISC_NUM] \\$\\n[#MISC_NUM]
.\}
.    nr #NUM_MISCS \\n[#NUM_ARGS]
.END
\#
\#
.MAC PAGENUMBER END \"Page # that appears on page one.
.    nr #n%_AT_PAGENUM_SET \\n%
.    nr #PAGE_NUM_ADJ \\$1-\\n[#n%_AT_PAGENUM_SET]
.    rr #n%_AT_PAGENUM_SET
.    nr #PAGE_NUM_SET 1
.END
\#
\# ====================================================================
\#
\# +++TYPE OF DOCUMENT+++
\#
\# DOCUMENT TYPE
\# -------------
\# *Argument:
\#   DEFAULT | CHAPTER | NAMED "<whatever> | LETTER
\# *Function:
\#   Creates strings and sets registers for document types.
\# *Notes:
\#   Number registers: DEFAULT=1, CHAPTER=2, NAMED=3, LETTER=4
\#
.MAC DOCTYPE END
.    if '\\$1'DEFAULT' \{\
.       nr #DOC_TYPE 1
.    \}
.    if '\\$1'CHAPTER' \{\
.       nr #DOC_TYPE 2
.    \}
.    if '\\$1'NAMED' \{\
.       ds $DOC_TYPE \\$2
.       nr #DOC_TYPE 3
.    \}
.    if '\\$1'LETTER' \{\
.       nr #DOC_TYPE 4
.       L_MARGIN 1.125i
.       R_MARGIN 1.125i
.       PT_SIZE 12
.       LS 13.5
.       DOCHEADER OFF
.       PARA_INDENT 3m
.       INDENT_FIRST_PARAS
.       PARA_SPACE
.       ds $SUITE \En[#SUITE]
.       HEADER_MARGIN 3P+6p
.       HEADER_GAP 3P
.       FOOTERS
.       FOOTER_RULE OFF
.       FOOTER_LEFT ""
.       FOOTER_CENTER ""
.       FOOTER_RIGHT_SIZE +0
.       FOOTER_RIGHT "\&.../\E*[$SUITE]
.       FOOTER_ON_FIRST_PAGE
.       em ALL_DONE
.    \}
.END
\#
\# +++LETTER MACROS+++
\#
\# First, create a register to hold incrementing numbers to be
\# appended to LETTERHEAD.
\#
.nr #FIELD 0 1
\#
\# DATE
\# ----
\# *Arguments:
\#   <none>
\# *Function:
\#   Stores date (entered on the line after .DATE) in diversion
\#   LETTERHEAD<n>
\#
.MAC DATE END
.    if !'\\n(.z'' \{ .di \}
.    di LETTERHEAD\\n+[#FIELD]
.    ie \\n[#FIELD]=1 \{\
.       nr #DATE_FIRST 1
.       RIGHT
.    \}
.    el \{\
.       LEFT
.    \}
.END
\#
\#
\# TO
\# --
\# *Arguments:
\#   <none>
\# *Function:
\#   Stores addressee address (entered on the line after .TO) in
\#   diversion LETTERHEAD<n>
\#
.MAC TO END
.    if !'\\n(.z'' \{ .di \}
.    di LETTERHEAD\\n+[#FIELD]
.    LEFT
.END
\#
\#
\# FROM
\# ----
\# *Arguments:
\#   <none>
\# *Function:
\#   Stores addresser address (entered on the line after .FROM) in
\#   diversion LETTERHEAD<n>
\#
.MAC FROM END
.    if !'\\n(.z'' \{ .di \}
.    di LETTERHEAD\\n+[#FIELD]
.    LEFT
.END
\#
\#
\# GREETING
\# --------
\# *Arguments:
\#   <none>
\# *Function:
\#   Stores greeting (entered on the line after .GREETING) in
\#   diversion LETTERHEAD<n>
\#
.MAC GREETING END
.    if !'\\n(.z'' \{ .di \}
.    di LETTERHEAD\\n+[#FIELD]
.    LEFT
.END
\#
\#
\# CLOSING
\# -------
\# *Arguments:
\#   <closing string>
\# *Function:
\#   Stores greeting in diversion CLOSING.
\#
.MAC CLOSING END
.    br
.    nr #CLOSING 1
.    di CLOSING
.    LEFT
.END
\#
\#
\# NO SUITE
\# --------
\# *Arguments:
\#   <none>
\# *Function:
\#   Redefines $FOOTER_RIGHT to blank so that a suite number doesn't
\#   appear at the bottom of letter pages.
\#
.MAC NO_SUITE END
.    FOOTER_RIGHT ""
.END
\#
\# ====================================================================
\#
\# +++DEFAULTS+++
\#
\# TYPE-STYLE CONTROL MACROS
\# -------------------------
\#
.ig
The control macros for family, font, size, quad and color are here
grouped together.  Each (e.g. _FAMILY or _FONT) tests for a calling
alias before performing the action(s) appropriate to the calling
macro.  Defaults for all these guys are set in DEFAULTS, and listed
in the "Control Macros" section of the documentation pertinent to
the macro whose style is to be changed.
..
\#
.MAC _FAMILY END
.    if '\\$0'AUTHOR_FAMILY'                  .ds $AUTHOR_FAM \\$1
.    if '\\$0'BIBLIOGRAPHY_FAMILY'            .ds $BIB_FAM \\$1
.    if '\\$0'BIBLIOGRAPHY_STRING_FAMILY'     .ds $BIB_STRING_FAM \\$1
.    if '\\$0'BLOCKQUOTE_FAMILY'              .ds $BQUOTE_FAM \\$1
.    if '\\$0'CITATION_FAMILY'                .ds $BQUOTE_FAM \\$1
.    if '\\$0'CITE_FAMILY'                    .ds $BQUOTE_FAM \\$1
.    if '\\$0'CHAPTER_TITLE_FAMILY'           .ds $CHAPTER_TITLE_FAM \\$1
.    if '\\$0'COVER_AUTHOR_FAMILY'            .ds $COVER_AUTHOR_FAM \\$1
.    if '\\$0'COVER_CHAPTER_TITLE_FAMILY'     .ds $COVER_CHAPTER_TITLE_FAM \\$1
.    if '\\$0'COVER_COPYRIGHT_FAMILY'         .ds $COVER_COPYRIGHT_FAM \\$1
.    if '\\$0'COVER_DOCTYPE_FAMILY'           .ds $COVER_DOCTYPE_FAM \\$1
.    if '\\$0'COVER_FAMILY'                   .ds $COVER_FAM \\$1
.    if '\\$0'COVER_SUBTITLE_FAMILY'          .ds $COVER_SUBTITLE_FAM \\$1
.    if '\\$0'COVER_TITLE_FAMILY'             .ds $COVER_TITLE_FAM \\$1
.    if '\\$0'DOC_COVER_AUTHOR_FAMILY'        .ds $DOC_COVER_AUTHOR_FAM \\$1
.    if '\\$0'DOC_COVER_CHAPTER_TITLE_FAMILY' .ds $DOC_COVER_CHAPTER_TITLE_FAM \\$1
.    if '\\$0'DOC_COVER_COPYRIGHT_FAMILY'     .ds $DOC_COVER_COPYRIGHT_FAM \\$1
.    if '\\$0'DOC_COVER_DOCTYPE_FAMILY'       .ds $DOC_COVER_DOCTYPE_FAM \\$1
.    if '\\$0'DOC_COVER_FAMILY'               .ds $DOC_COVER_FAM \\$1
.    if '\\$0'DOC_COVER_SUBTITLE_FAMILY'      .ds $DOC_COVER_SUBTITLE_FAM \\$1
.    if '\\$0'DOC_COVER_TITLE_FAMILY'         .ds $DOC_COVER_TITLE_FAM \\$1
.    if '\\$0'DOCHEADER_FAMILY'               .ds $DOCHEADER_FAM \\$1
.    if '\\$0'DOCTYPE_FAMILY'                 .ds $DOCTYPE_FAM \\$1
.    if '\\$0'ENDNOTE_FAMILY'                 .ds $EN_FAM \\$1
.    if '\\$0'ENDNOTE_NUMBER_FAMILY'          .ds $EN_NUMBER_FAM \\$1
.    if '\\$0'ENDNOTE_LINENUMBER_FAMILY'      .ds $EN_LN_FAM \\$1
.    if '\\$0'ENDNOTE_STRING_FAMILY'          .ds $EN_STRING_FAM \\$1
.    if '\\$0'ENDNOTE_TITLE_FAMILY'           .ds $EN_TITLE_FAM \\$1
.    if '\\$0'EPIGRAPH_FAMILY'                .ds $EPI_FAM \\$1
.    if '\\$0'FOOTNOTE_FAMILY'                .ds $FN_FAM \\$1
.    if '\\$0'HDRFTR_CENTER_FAMILY'           .ds $HDRFTR_CENTER_FAM \\$1
.    if '\\$0'HDRFTR_FAMILY' \{\
.       ds $HDRFTR_FAM        \\$1
.       ds $HDRFTR_LEFT_FAM   \\$1
.       ds $HDRFTR_CENTER_FAM \\$1
.       ds $HDRFTR_RIGHT_FAM  \\$1
.    \}
.    if '\\$0'HDRFTR_LEFT_FAMILY'             .ds $HDRFTR_LEFT_FAM \\$1
.    if '\\$0'HDRFTR_RIGHT_FAMILY'            .ds $HDRFTR_RIGHT_FAM \\$1
.    if '\\$0'HEAD_FAMILY'                    .ds $HEAD_FAM \\$1
.    if '\\$0'PAGENUM_FAMILY'                 .ds $PAGE_NUM_FAM \\$1
.    if '\\$0'PARAHEAD_FAMILY'                .ds $PH_FAM \\$1
.    if '\\$0'QUOTE_FAMILY'                   .ds $QUOTE_FAM \\$1
.    if '\\$0'SUBHEAD_FAMILY'                 .ds $SH_FAM \\$1
.    if '\\$0'SUBTITLE_FAMILY'                .ds $SUBTITLE_FAM \\$1
.    if '\\$0'TITLE_FAMILY'                   .ds $TITLE_FAM \\$1
.    if '\\$0'TOC_FAMILY'                     .ds $TOC_FAM \\$1
.    if '\\$0'TOC_FAM'                        .ds $TOC_FAM \\$1
.    if '\\$0'TOC_HEADER_FAMILY'              .ds $TOC_HEADER_FAM \\$1
.    if '\\$0'TOC_HEAD_FAMILY'                .ds $TOC_HEAD_FAM \\$1
.    if '\\$0'TOC_PARAHEAD_FAMILY'            .ds $TOC_PH_FAM \\$1
.    if '\\$0'TOC_PN_FAMILY'                  .ds $TOC_PN_FAM \\$1
.    if '\\$0'TOC_SUBHEAD_FAMILY'             .ds $TOC_SH_FAM \\$1
.    if '\\$0'TOC_TITLE_FAMILY'               .ds $TOC_TITLE_FAM \\$1
.END
\#
\#
.MAC _FONT END
.    if '\\$0'AUTHOR_FONT'                  .ds $AUTHOR_FT \\$1
.    if '\\$0'BIBLIOGRAPHY_FONT'            .ds $BIB_FT \\$1
.    if '\\$0'BIBLIOGRAPHY_STRING_FONT'     .ds $BIB_STRING_FT \\$1
.    if '\\$0'BLOCKQUOTE_FONT'              .ds $BQUOTE_FT \\$1
.    if '\\$0'CITATION_FONT'                .ds $BQUOTE_FT \\$1
.    if '\\$0'CITE_FONT'                    .ds $BQUOTE_FT \\$1
.    if '\\$0'CHAPTER_TITLE_FONT'           .ds $CHAPTER_TITLE_FT \\$1
.    if '\\$0'COVER_AUTHOR_FONT'            .ds $COVER_AUTHOR_FT \\$1
.    if '\\$0'COVER_CHAPTER_TITLE_FONT'     .ds $COVER_CHAPTER_TITLE_FT \\$1
.    if '\\$0'COVER_COPYRIGHT_FONT'         .ds $COVER_COPYRIGHT_FT \\$1
.    if '\\$0'COVER_DOCTYPE_FONT'           .ds $COVER_DOCTYPE_FT \\$1
.    if '\\$0'COVER_SUBTITLE_FONT'          .ds $COVER_SUBTITLE_FT \\$1
.    if '\\$0'COVER_TITLE_FONT'             .ds $COVER_TITLE_FT \\$1
.    if '\\$0'DOC_COVER_AUTHOR_FONT'        .ds $DOC_COVER_AUTHOR_FT \\$1
.    if '\\$0'DOC_COVER_CHAPTER_TITLE_FONT' .ds $DOC_COVER_CHAPTER_TITLE_FT \\$1
.    if '\\$0'DOC_COVER_COPYRIGHT_FONT'     .ds $DOC_COVER_COPYRIGHT_FT \\$1
.    if '\\$0'DOC_COVER_DOCTYPE_FONT'       .ds $DOC_COVER_DOCTYPE_FT \\$1
.    if '\\$0'DOC_COVER_SUBTITLE_FONT'      .ds $DOC_COVER_SUBTITLE_FT \\$1
.    if '\\$0'DOC_COVER_TITLE_FONT'         .ds $DOC_COVER_TITLE_FT \\$1
.    if '\\$0'DOCTYPE_FONT'                 .ds $DOCTYPE_FT \\$1
.    if '\\$0'ENDNOTE_FONT'                 .ds $EN_FT \\$1
.    if '\\$0'ENDNOTE_NUMBER_FONT'          .ds $EN_NUMBER_FT \\$1
.    if '\\$0'ENDNOTE_LINENUMBER_FONT'      .ds $EN_LN_FT \\$1
.    if '\\$0'ENDNOTE_STRING_FONT'          .ds $EN_STRING_FT \\$1
.    if '\\$0'ENDNOTE_TITLE_FONT'           .ds $EN_TITLE_FT \\$1
.    if '\\$0'EPIGRAPH_FONT'                .ds $EPI_FT \\$1
.    if '\\$0'FOOTNOTE_FONT'                .ds $FN_FT \\$1
.    if '\\$0'HDRFTR_CENTER_FONT'           .ds $HDRFTR_CENTER_FT \\$1
.    if '\\$0'HDRFTR_LEFT_FONT'             .ds $HDRFTR_LEFT_FT \\$1
.    if '\\$0'HDRFTR_RIGHT_FONT'            .ds $HDRFTR_RIGHT_FT \\$1
.    if '\\$0'HEAD_FONT'                    .ds $HEAD_FT \\$1
.    if '\\$0'PAGENUM_FONT'                 .ds $PAGE_NUM_FT \\$1
.    if '\\$0'PARAHEAD_FONT'                .ds $PH_FT \\$1
.    if '\\$0'QUOTE_FONT'                   .ds $QUOTE_FT \\$1
.    if '\\$0'SUBHEAD_FONT'                 .ds $SH_FT \\$1
.    if '\\$0'SUBTITLE_FONT'                .ds $SUBTITLE_FT \\$1
.    if '\\$0'TITLE_FONT'                   .ds $TITLE_FT \\$1
.    if '\\$0'TOC_HEADER_FONT'              .ds $TOC_HEADER_FT \\$1
.    if '\\$0'TOC_HEAD_FONT'                .ds $TOC_HEAD_FT \\$1
.    if '\\$0'TOC_PARAHEAD_FONT'            .ds $TOC_PH_FT \\$1
.    if '\\$0'TOC_PN_FONT'                  .ds $TOC_PN_FT \\$1
.    if '\\$0'TOC_SUBHEAD_FONT'             .ds $TOC_SH_FT \\$1
.    if '\\$0'TOC_TITLE_FONT'               .ds $TOC_TITLE_FT \\$1
.END
\#
\#
.MAC _SIZE END
.    if '\\$0'AUTHOR_SIZE'                  .ds $AUTHOR_SIZE_CHANGE \\$1
.    if '\\$0'BIBLIOGRAPHY_STRING_SIZE'     .ds $BIB_STRING_SIZE_CHANGE \\$1
.    if '\\$0'BLOCKQUOTE_SIZE'              .ds $BQUOTE_SIZE_CHANGE \\$1
.    if '\\$0'CITATION_SIZE'                .ds $BQUOTE_SIZE_CHANGE \\$1
.    if '\\$0'CITE_SIZE'                    .ds $BQUOTE_SIZE_CHANGE \\$1
.    if '\\$0'CHAPTER_TITLE_SIZE'           .ds $CHAPTER_TITLE_SIZE_CHANGE \\$1
.    if '\\$0'COVER_AUTHOR_SIZE'            .ds $COVER_AUTHOR_SIZE_CHANGE \\$1
.    if '\\$0'COVER_CHAPTER_TITLE_SIZE'     .ds $COVER_CHAPTER_TITLE_SIZE_CHANGE \\$1
.    if '\\$0'COVER_COPYRIGHT_SIZE'         .ds $COVER_COPYRIGHT_SIZE_CHANGE \\$1
.    if '\\$0'COVER_DOCTYPE_SIZE'           .ds $COVER_DOCTYPE_SIZE_CHANGE \\$1
.    if '\\$0'COVER_SUBTITLE_SIZE'          .ds $COVER_SUBTITLE_SIZE_CHANGE \\$1
.    if '\\$0'COVER_TITLE_SIZE'             .ds $COVER_TITLE_SIZE_CHANGE \\$1
.    if '\\$0'DOC_COVER_AUTHOR_SIZE'        .ds $DOC_COVER_AUTHOR_SIZE_CHANGE \\$1
.    if '\\$0'DOC_COVER_CHAPTER_TITLE_SIZE' .ds $DOC_COVER_CHAPTER_TITLE_SIZE_CHANGE \\$1
.    if '\\$0'DOC_COVER_COPYRIGHT_SIZE'     .ds $DOC_COVER_COPYRIGHT_SIZE_CHANGE \\$1
.    if '\\$0'DOC_COVER_DOCTYPE_SIZE'       .ds $DOC_COVER_DOCTYPE_SIZE_CHANGE \\$1
.    if '\\$0'DOC_COVER_SUBTITLE_SIZE'      .ds $DOC_COVER_SUBTITLE_SIZE_CHANGE \\$1
.    if '\\$0'DOC_COVER_TITLE_SIZE'         .ds $DOC_COVER_TITLE_SIZE_CHANGE \\$1
.    if '\\$0'DOCTYPE_SIZE'                 .ds $DOCTYPE_SIZE_CHANGE \\$1
.    if '\\$0'ENDNOTE_NUMBER_SIZE'          .ds $EN_NUMBER_SIZE_CHANGE \\$1
.    if '\\$0'ENDNOTE_LINENUMBER_SIZE'      .ds $EN_LN_SIZE_CHANGE \\$1
.    if '\\$0'ENDNOTE_STRING_SIZE'          .ds $EN_STRING_SIZE_CHANGE \\$1
.    if '\\$0'ENDNOTE_TITLE_SIZE'           .ds $EN_TITLE_SIZE_CHANGE \\$1 
.    if '\\$0'EPIGRAPH_SIZE'                .ds $EPI_SIZE_CHANGE \\$1
.    if '\\$0'FOOTNOTE_SIZE'                .ds $FN_SIZE_CHANGE \\$1
.    if '\\$0'HDRFTR_CENTER_SIZE'           .ds $HDRFTR_CENTER_SIZE_CHANGE \\$1
.    if '\\$0'HDRFTR_LEFT_SIZE'             .ds $HDRFTR_LEFT_SIZE_CHANGE \\$1
.    if '\\$0'HDRFTR_RIGHT_SIZE'            .ds $HDRFTR_RIGHT_SIZE_CHANGE \\$1
.    if '\\$0'HDRFTR_SIZE'                  .ds $HDRFTR_SIZE_CHANGE \\$1
.    if '\\$0'HEAD_SIZE'                    .ds $HEAD_SIZE_CHANGE \\$1
.    if '\\$0'PAGENUM_SIZE'                 .ds $PAGE_NUM_SIZE_CHANGE \\$1
.    if '\\$0'PARAHEAD_SIZE'                .ds $PH_SIZE_CHANGE \\$1
.    if '\\$0'QUOTE_SIZE'                   .ds $QUOTE_SIZE_CHANGE \\$1
.    if '\\$0'SUBHEAD_SIZE'                 .ds $SH_SIZE_CHANGE \\$1
.    if '\\$0'SUBTITLE_SIZE'                .ds $SUBTITLE_SIZE_CHANGE \\$1
.    if '\\$0'TITLE_SIZE'                   .ds $TITLE_SIZE_CHANGE \\$1
.    if '\\$0'TOC_HEADER_SIZE'              .ds $TOC_HEADER_SIZE_CHANGE \\$1
.    if '\\$0'TOC_HEAD_SIZE'                .ds $TOC_HEAD_SIZE_CHANGE \\$1
.    if '\\$0'TOC_PARAHEAD_SIZE'            .ds $TOC_PH_SIZE_CHANGE \\$1
.    if '\\$0'TOC_PN_SIZE'                  .ds $TOC_PN_SIZE_CHANGE \\$1
.    if '\\$0'TOC_SUBHEAD_SIZE'             .ds $TOC_SH_SIZE_CHANGE \\$1
.    if '\\$0'TOC_TITLE_SIZE'               .ds $TOC_TITLE_SIZE_CHANGE \\$1
.END
\#
\#
.MAC _COLOR END
.    if \\n[#PRINT_STYLE]=1 \{ .return \}
.    if '\\$0'ATTRIBUTE_COLOR' \{\
.       nr #ATTRIBUTE_COLOR 1
.       ds $ATTRIBUTE_COLOR \\$1
.    \}
.    if '\\$0'AUTHOR_COLOR' \{\
.       nr #AUTHOR_COLOR 1
.       ds $AUTHOR_COLOR \\$1
.    \}
.    if '\\$0'BLOCKQUOTE_COLOR' \{\
.       nr #BQUOTE_COLOR 1
.       ds $BQUOTE_COLOR \\$1
.    \}
.    if '\\$0'CITATION_COLOR' \{\
.       nr #BQUOTE_COLOR 1
.       ds $BQUOTE_COLOR \\$1
.    \}
.    if '\\$0'CITE_COLOR' \{\
.       nr #BQUOTE_COLOR 1
.       ds $BQUOTE_COLOR \\$1
.    \}
.    if '\\$0'CHAPTER_TITLE_COLOR' \{\
.       nr #CHAPTER_TITLE_COLOR 1
.       ds $CHAPTER_TITLE_COLOR \\$1
.    \}
.    if '\\$0'COVER_ATTRIBUTE_COLOR' \{\
.       nr #COVER_ATTRIBUTE_COLOR 1
.       ds $COVER_ATTRIBUTE_COLOR \\$1
.    \}
.    if '\\$0'COVER_AUTHOR_COLOR' \{\
.       nr #COVER_AUTHOR_COLOR 1
.       ds $COVER_AUTHOR_COLOR \\$1
.    \}
.    if '\\$0'COVER_CHAPTER_TITLE_COLOR' \{\
.       nr #COVER_CHAPTER_TITLE_COLOR 1
.       ds $COVER_CHAPTER_TITLE_COLOR \\$1
.    \}
.    if '\\$0'COVER_COLOR' \{\
.       nr #COVER_COLOR 1
.       ds $COVER_COLOR \\$1
.    \}
.    if '\\$0'COVER_COPYRIGHT_COLOR' \{\
.       nr #COVER_COPYRIGHT_COLOR 1
.       ds $COVER_COPYRIGHT_COLOR \\$1
.    \}
.    if '\\$0'COVER_MISC_COLOR' \{\
.       nr #COVER_MISC_COLOR 1
.       ds $COVER_MISC_COLOR \\$1
.    \}
.    if '\\$0'COVER_TITLE_COLOR' \{\
.       nr #COVER_TITLE_COLOR 1
.       ds $COVER_TITLE_COLOR \\$1
.    \}
.    if '\\$0'COVER_SUBTITLE_COLOR' \{\
.       nr #COVER_SUBTITLE_COLOR 1
.       ds $COVER_SUBTITLE_COLOR \\$1
.    \}
.    if '\\$0'COVER_DOCTYPE_COLOR' \{\
.       nr #COVER_DOCTYPE_COLOR 1
.       ds $COVER_DOCTYPE_COLOR \\$1
.    \}
.    if '\\$0'DOC_COVER_ATTRIBUTE_COLOR' \{\
.       nr #DOC_COVER_ATTRIBUTE_COLOR 1
.       ds $DOC_COVER_ATTRIBUTE_COLOR \\$1
.    \}
.    if '\\$0'DOC_COVER_AUTHOR_COLOR' \{\
.       nr #DOC_COVER_AUTHOR_COLOR 1
.       ds $DOC_COVER_AUTHOR_COLOR \\$1
.    \}
.    if '\\$0'DOC_COVER_CHAPTER_TITLE_COLOR' \{\
.       nr #DOC_COVER_CHAPTER_TITLE_COLOR 1
.       ds $DOC_COVER_CHAPTER_TITLE_COLOR \\$1
.    \}
.    if '\\$0'DOC_COVER_COLOR' \{\
.       nr #DOC_COVER_COLOR 1
.       ds $DOC_COVER_COLOR \\$1
.    \}
.    if '\\$0'DOC_COVER_COPYRIGHT_COLOR' \{\
.       nr #DOC_COVER_COPYRIGHT_COLOR 1
.       ds $DOC_COVER_COPYRIGHT_COLOR \\$1
.    \}
.    if '\\$0'DOC_COVER_MISC_COLOR' \{\
.       nr #DOC_COVER_MISC_COLOR 1
.       ds $DOC_COVER_MISC_COLOR \\$1
.    \}
.    if '\\$0'DOC_COVER_TITLE_COLOR' \{\
.       nr #DOC_COVER_TITLE_COLOR 1
.       ds $DOC_COVER_TITLE_COLOR \\$1
.    \}
.    if '\\$0'DOC_COVER_SUBTITLE_COLOR' \{\
.       nr #DOC_COVER_SUBTITLE_COLOR 1
.       ds $DOC_COVER_SUBTITLE_COLOR \\$1
.    \}
.    if '\\$0'DOC_COVER_DOCTYPE_COLOR' \{\
.       nr #DOC_COVER_DOCTYPE_COLOR 1
.       ds $DOC_COVER_DOCTYPE_COLOR \\$1
.    \}
.    if '\\$0'DOCHEADER_COLOR' \{\
.       nr #DOCHEADER_COLOR 1
.       ds $DOCHEADER_COLOR \\$1
.    \}
.    if '\\$0'DOCTYPE_COLOR' \{\
.       nr #DOCTYPE_COLOR 1
.       ds $DOCTYPE_COLOR \\$1
.    \}
.    if '\\$0'EPIGRAPH_COLOR' \{\
.       nr #EPI_COLOR 1
.       ds $EPI_COLOR \\$1
.    \}
.    if '\\$0'FINIS_COLOR' \{\
.       nr #FINIS_COLOR 1
.       ds $FINIS_COLOR \\$1
.    \}
.    if '\\$0'FOOTNOTE_COLOR' \{\
.       nr #FOOTNOTE_COLOR 1
.       ds $FOOTNOTE_COLOR \\$1
.    \}
.    if '\\$0'HDRFTR_CENTER_COLOR' \{\
.       nr #HDRFTR_CENTER_COLOR 1
.       ds $HDRFTR_CENTER_COLOR \\$1
.    \}
.    if '\\$0'HDRFTR_COLOR' \{\
.       nr #HDRFTR_COLOR 1
.       ds $HDRFTR_COLOR \\$1
.    \}
.    if '\\$0'HDRFTR_LEFT_COLOR' \{\
.       nr #HDRFTR_LEFT_COLOR 1
.       ds $HDRFTR_LEFT_COLOR \\$1
.    \}
.    if '\\$0'HDRFTR_RIGHT_COLOR' \{\
.       nr #HDRFTR_RIGHT_COLOR 1
.       ds $HDRFTR_RIGHT_COLOR \\$1
.    \}
.    if '\\$0'HDRFTR_RULE_COLOR' \{\
.       nr #HDRFTR_RULE_COLOR 1
.       ds $HDRFTR_RULE_COLOR \\$1
.    \}
.    if '\\$0'HEAD_COLOR' \{\
.       nr #HEAD_COLOR 1
.       ds $HEAD_COLOR \\$1
.    \}
.    if '\\$0'LINEBREAK_COLOR' \{\
.       nr #LINEBREAK_COLOR 1
.       ds $LINEBREAK_COLOR \\$1
.    \}
.    if '\\$0'PAGENUM_COLOR' \{\
.       nr #PAGE_NUM_COLOR 1
.       ds $PAGENUM_COLOR \\$1
.    \}
.    if '\\$0'PARAHEAD_COLOR' \{\
.       nr #PH_COLOR 1
.       ds $PH_COLOR \\$1
.    \}
.    if '\\$0'QUOTE_COLOR' \{\
.       nr #QUOTE_COLOR 1
.       ds $QUOTE_COLOR \\$1
.    \}
.    if '\\$0'SUBHEAD_COLOR' \{\
.       nr #SH_COLOR 1
.       ds $SH_COLOR \\$1
.    \}
.    if '\\$0'SUBTITLE_COLOR' \{\
.       nr #SUBTITLE_COLOR 1
.       ds $SUBTITLE_COLOR \\$1
.    \}
.    if '\\$0'TITLE_COLOR' \{\
.       nr #TITLE_COLOR 1
.       ds $TITLE_COLOR \\$1
.    \}
.END
\#
\#
.MAC _QUAD END
.    if '\\$0'BIBLIOGRAPHY_QUAD' \{\
.       ds $BIB_QUAD \\$1
.       if '\\*[$BIB_QUAD]'R' .ab Fatal error: \\$0 must be set to either L or J
.       if '\\*[$BIB_QUAD]'C' .ab Fatal error: \\$0 must be set to either L or J
.    \}
.    if '\\$0'BIBLIOGRAPHY_STRING_QUAD' .ds $BIB_STRING_QUAD \\$1
.    if '\\$0'BLOCKQUOTE_QUAD'          .ds $BQUOTE_QUAD \\$1
.    if '\\$0'CITATION_QUAD'            .ds $BQUOTE_QUAD \\$1
.    if '\\$0'CITE_QUAD'                .ds $BQUOTE_QUAD \\$1
.    if '\\$0'COVER_COPYRIGHT_QUAD'     .ds $COVER_COPYRIGHT_QUAD \\$1
.    if '\\$0'COVER_MISC_QUAD'          .ds $COVER_MISC_QUAD \\$1
.    if '\\$0'DOC_COVER_COPYRIGHT_QUAD' .ds $DOC_COVER_COPYRIGHT_QUAD \\$1
.    if '\\$0'DOC_COVER_MISC_QUAD'      .ds $DOC_COVER_MISC_QUAD \\$1
.    if '\\$0'DOC_QUAD' \{\
.        ds $DOC_QUAD \\$1
.        QUAD \\*[$DOC_QUAD]
.    \}
.    if '\\$0'ENDNOTE_QUAD' \{\
.       ds $EN_QUAD \\$1
.       if '\\*[$EN_QUAD]'R' .ab Fatal error: \\$0 must be set to either L or J
.       if '\\*[$EN_QUAD]'C' .ab Fatal error: \\$0 must be set to either L or J
.    \}
.    if '\\$0'ENDNOTE_STRING_QUAD'      .ds $EN_STRING_QUAD \\$1
.    if '\\$0'ENDNOTE_TITLE_QUAD'       .ds $EN_TITLE_QUAD \\$1
.    if '\\$0'EPIGRAPH_QUAD'            .ds $EPI_QUAD \\$1
.    if '\\$0'FOOTNOTE_QUAD'            .ds $FN_QUAD \\$1
.    if '\\$0'HEAD_QUAD'                .ds $HEAD_QUAD \\$1
.    if '\\$0'SUBHEAD_QUAD'             .ds $SH_QUAD \\$1
.    if '\\$0'TOC_HEADER_QUAD'          .ds $TOC_HEADER_QUAD \\$1
.END
\#
\#
\# DEFAULTS
\# --------
\# *Arguments:
\#   <none>
\# *Function:
\#   Sets up defaults if no values are entered prior to START.
\# *Notes:
\#   The defaults for $CHAPTER_STRING, $DRAFT_STRING, and
\#   $REVISION_STRING are in the COPYSTYLE macro.
\#
.MAC DEFAULTS END
.    if !d$PAPER \{ .PAPER LETTER \}
.    if !\\n[#DOC_TYPE]   \{ .DOCTYPE DEFAULT \}
.    ie \\n[#PAGENUM_STYLE_SET] \{ .PAGENUM_STYLE \\*[$PAGENUM_STYLE] \}
.    el \{\
.       if !\\n[#COPY_STYLE]=1 \{ .PAGENUM_STYLE DIGIT \}
.    \}
.    if !\\n[#COPY_STYLE] \{ .COPYSTYLE FINAL \}
.    if \\n[#DRAFT_WITH_PAGENUM] \{ .COPYSTYLE \\*[$COPY_STYLE] \}
.    if \\n[#DOC_TYPE]=4 \{\
.       if !\\n[#USER_SET_L_LENGTH] \{\
.          R_MARGIN \\n[#R_MARGIN]u
.          rr #USER_SET_L_LENGTH
.       \}
.       if \\n[#PRINT_STYLE]=1 \{ .PRINTSTYLE TYPEWRITE SINGLESPACE \}
.    \}
.    if \\n[#COPY_STYLE]=1 \{\
.       COPYSTYLE DRAFT
.       PAGENUMBER 1
.    \}
.    if !r#DOC_HEADER \{ .DOCHEADER  \}
.    if !r#HEADERS_ON \{ .HEADERS    \}
.    if !r#PAGINATE   \{ .PAGINATE   \}
.    if \\n[#FOOTERS_ON] \{\
.       HEADERS OFF
.       if \\n[#PAGE_NUM_POS_SET]=0 \{ .PAGENUM_POS TOP CENTER \}
.    \}
.    if !r#HEADER_MARGIN \{ .HEADER_MARGIN 4P+6p \}
.    if !r#HEADER_GAP    \{ .HEADER_GAP    3P    \}
.    if \\n[#FOOTERS_ON] \{\
.       if \\n[#PAGINATE]=0 \{\
.          if !r#T_MARGIN \{ .T_MARGIN 6P \}
.       \}
.    \}
.    if \\n[#HEADERS_ON]=0    \{\
.       if \\n[#FOOTERS_ON]=0 \{\
.          if !r#T_MARGIN \{ .T_MARGIN 6P \}
.       \}
.    \}
.    if !r#T_MARGIN          \{ .T_MARGIN \\n[#HEADER_MARGIN]+\\n[#HEADER_GAP] \}
.    if !r#DOCHEADER_ADVANCE \{ .nr #DOCHEADER_ADVANCE \\n[#T_MARGIN] \}
.    if !r#FOOTER_MARGIN     \{ .FOOTER_MARGIN 3P \}
.    if !r#FOOTER_GAP        \{ .FOOTER_GAP    3P \}
.    if !r#B_MARGIN          \{ .B_MARGIN \\n[#FOOTER_MARGIN]u+\\n[#FOOTER_GAP]u \}
.    if (\\n[#FOOTER_MARGIN]+\\n(.v)>\\n[#B_MARGIN] \{\
.       tm1 "[mom]: Your chosen bottom margin for running text is too close to the footer margin.
.       tm1 "       No footers or bottom-of-page page numbers will be printed.
.       tm1 "       Please reset B_MARGIN or FOOTER_MARGIN to allow enough space.
.       tm1 "       If no footers or bottom-of-page page numbers are required,
.       tm1 "       type in .FOOTER_MARGIN 0 before .START
.    \}
.    if !r#HDRFTR_RULE_GAP   \{\
.       if \\n[#HEADERS_ON]  \{ .HDRFTR_RULE_GAP 4p \}
.       if \\n[#FOOTERS_ON]  \{ .HDRFTR_RULE_GAP 4p \}
.    \}
.    if !r#HDRFTR_RULE       \{ .HDRFTR_RULE        \}
.    if !r#PAGE_NUM_SET      \{ .PAGENUMBER 1       \}
.\" Read in number registers and strings for type parameters
.    nr #DOC_L_MARGIN \\n[#L_MARGIN]
.    nr #DOC_L_LENGTH \\n[#L_LENGTH]
.    nr #DOC_R_MARGIN \\n[#PAGE_WIDTH]-(\\n[#DOC_L_MARGIN]+\\n[#L_LENGTH])
.    ds $DOC_FAM      \\*[$FAMILY]
.    nr #DOC_PT_SIZE  \\n[#PT_SIZE]
.    nr #DOC_LEAD     \\n[#LEAD]
.\" #SAVED_DOC_LEAD is set in COLLATE
.    if r#SAVED_DOC_LEAD \{\
.       if !\\n[#DOC_LEAD]=\\n[#SAVED_DOC_LEAD] \{ .nr #RERUN_TRAPS 1 \}
.    \}
.    ie \\n[#ADJ_DOC_LEAD]=1 \{ . \}
.    el \{\
.       if !\\n[#DOC_LEAD_ADJUST_OFF] \{\
.          DOC_LEAD_ADJUST
.       \}
.    \}
.    ds $DOC_QUAD     \\*[$QUAD_VALUE]
.    ds $PP_FT        \\*[$FONT]
.\" Counters
.    nr #PP 0
.    nr #FN_NUMBER 0 1
.    nr #EN_NUMBER 0 1
.    nr #FN_COUNT_FOR_COLS 0 1
.    nr #DONE_ONCE 0 1
.    RESET_HEAD_NUMBER
.    RESET_SUBHEAD_NUMBER
.    RESET_PARAHEAD_NUMBER
.\" General style defaults for both PRINTSTYLEs
.    nr #PP_STYLE 1
.    PARA_INDENT \\n[#PP_INDENT]u
.    if !d$HDRFTR_FAM           \{ .HDRFTR_FAMILY  \\*[$DOC_FAM] \}
.    if !d$HDRFTR_SIZE_CHANGE   \{ .HDRFTR_SIZE    +0            \}
.    if !d$PAGE_NUM_FAM         \{ .PAGENUM_FAMILY \\*[$DOC_FAM] \}
.    if !d$PAGE_NUM_FT          \{ .PAGENUM_FONT   R             \}
.    if !d$PAGE_NUM_SIZE_CHANGE \{ .PAGENUM_SIZE   +0            \}
.    if !r#PAGE_NUM_POS_SET     \{ .PAGENUM_POS BOTTOM CENTER    \}
.    ie \\n[#PAGE_NUM_HYPHENS_SET] \{\
.       if \\n[#PAGE_NUM_HYPHENS]=0  \{ .PAGENUM_HYPHENS OFF \}
.       if \\n[#PAGE_NUM_HYPHENS]=1  \{ .PAGENUM_HYPHENS     \}
.    \}
.    el \{ .PAGENUM_HYPHENS \}
.    if !d$HEAD_QUAD         \{ .HEAD_QUAD CENTER  \}
.    if !r#HEAD_CAPS         \{ .HEAD_CAPS         \}
.    if !r#HEAD_UNDERLINE    \{ .HEAD_UNDERLINE    \}
.    if !d$SH_QUAD           \{ .SUBHEAD_QUAD LEFT \}
.    if !r#HDRFTR_RIGHT_CAPS \{ .HDRFTR_RIGHT_CAPS \}
.    if \\n[#HDRFTR_RIGHT_CAPS]=0 \{\
.       if !d$HDRFTR_RIGHT_SIZE_CHANGE \{ .HDRFTR_RIGHT_SIZE +0 \}
.    \}
.    if !d$FN_FAM               \{ .FOOTNOTE_FAMILY \\*[$DOC_FAM]      \}
.    if !d$FN_FT                \{ .FOOTNOTE_FONT R                    \}
.    if !d$FN_QUAD              \{ .FOOTNOTE_QUAD \\*[$DOC_QUAD]       \}
.    if !r#FN_RULE              \{ .FOOTNOTE_RULE                      \}
.    if !r#FN_MARKERS           \{ .FOOTNOTE_MARKERS                   \}
.    if !\\n[#FN_MARKER_STYLE]  \{ .FOOTNOTE_MARKER_STYLE STAR         \}
.    if !\\n[#EN_MARKER_STYLE]  \{ .ENDNOTE_MARKER_STYLE NUMBER        \}
.    if !d$EN_PN_STYLE          \{ .ENDNOTES_PAGENUM_STYLE digit       \}
.    if !d$EN_FAM               \{ .ENDNOTE_FAMILY \\*[$DOC_FAM]       \}
.    if !d$EN_FT                \{ .ENDNOTE_FONT R                     \}
.    if !d$EN_QUAD              \{ .ENDNOTE_QUAD \\*[$DOC_QUAD]        \}
.    if !d$EN_STRING            \{ .ENDNOTE_STRING "Endnotes"          \}
.    if !d$EN_STRING_FAM        \{ .ENDNOTE_STRING_FAMILY \\*[$EN_FAM] \}
.    if !d$EN_STRING_QUAD       \{ .ENDNOTE_STRING_QUAD CENTER         \}
.    if !r#EN_STRING_UNDERSCORE \{ .ENDNOTE_STRING_UNDERSCORE 2        \}
.    if !r#EN_STRING_CAPS       \{ .ENDNOTE_STRING_CAPS                \}
.    if !d$EN_TITLE \{\
.       ie \\n[#DOC_TYPE]=2 \{\
.          ie '\\*[$CHAPTER]'' \{ .ENDNOTE_TITLE "\\*[$CHAPTER_STRING]" \}
.          el \{ .ENDNOTE_TITLE "\\*[$CHAPTER_STRING] \\*[$CHAPTER]"    \}
.       \}
.       el \{ .ENDNOTE_TITLE "\\*[$TITLE]" \}
.    \}
.    if !d$EN_TITLE_FAM          \{ .ENDNOTE_TITLE_FAMILY \\*[$EN_FAM]  \}
.    if !d$EN_TITLE_QUAD         \{ .ENDNOTE_TITLE_QUAD LEFT            \}
.    if !r#EN_TITLE_UNDERSCORE   \{ .ENDNOTE_TITLE_UNDERSCORE           \}
.    if !d$EN_NUMBER_FAM         \{ .ENDNOTE_NUMBER_FAMILY \\*[$EN_FAM] \}
.    if !r#EN_NUMBERS_ALIGN_LEFT \{\
.       if !r#EN_NUMBERS_ALIGN_RIGHT \{ .ENDNOTE_NUMBERS_ALIGN_RIGHT 2  \}
.    \}
.    if !d$EN_LN_GAP             \{ .ENDNOTE_LINENUMBER_GAP 1.5n              \}
.    if !d$BIB_PN_STYLE          \{ .BIBLIOGRAPHY_PAGENUM_STYLE digit         \}
.    if !d$BIB_FAM               \{ .BIBLIOGRAPHY_FAMILY \\*[$DOC_FAM]        \}
.    if !d$BIB_FT                \{ .BIBLIOGRAPHY_FONT R                      \}
.    if !d$BIB_QUAD              \{ .BIBLIOGRAPHY_QUAD \\*[$DOC_QUAD]         \}
.    if !d$BIB_STRING            \{ .BIBLIOGRAPHY_STRING "Bibliography"       \}
.    if !d$BIB_STRING_FAM        \{ .BIBLIOGRAPHY_STRING_FAMILY \\*[$BIB_FAM] \}
.    if !d$BIB_STRING_QUAD       \{ .BIBLIOGRAPHY_STRING_QUAD CENTER          \}
.    if !r#BIB_STRING_UNDERSCORE \{ .BIBLIOGRAPHY_STRING_UNDERSCORE 2         \}
.    if !r#BIB_STRING_CAPS       \{ .BIBLIOGRAPHY_STRING_CAPS                 \}
.    if !d$TOC_HEADER_STRING     \{ .TOC_HEADER_STRING "Contents"  \}
.    if !d$TOC_HEADER_QUAD       \{ .TOC_HEADER_QUAD LEFT          \}
.    if !d$TOC_PN_STYLE          \{ .TOC_PAGENUM_STYLE roman       \}
.    if !r#TOC_PN_PADDING        \{ .TOC_PADDING   3               \}
.    if !r#TOC_TITLE_INDENT      \{ .TOC_TITLE_INDENT    0         \}
.    if !r#TOC_HEAD_INDENT       \{ .TOC_HEAD_INDENT     18p       \}
.    if !r#TOC_SH_INDENT         \{ .TOC_SUBHEAD_INDENT  30p       \}
.    if !r#TOC_PH_INDENT         \{ .TOC_PARAHEAD_INDENT 42p       \}
.\" String defaults for both PRINTSTYLEs
.    ie \\n[#DOC_TYPE]=1 \{\
.       ie '\\*[$DOC_TITLE]'' \{\
.          if \\n[#USER_DEF_HDRFTR_LEFT]=0  .ds $HDRFTR_LEFT \\*[$AUTHOR_1]
.          rr #USER_DEF_HDRFTR_LEFT
.          if \\n[#USER_DEF_HDRFTR_RIGHT]=0 .ds $HDRFTR_RIGHT \\*[$TITLE]
.          rr #USER_DEF_HDRFTR_RIGHT
.       \}
.       el \{\
.          if \\n[#COPY_STYLE]=1 \{ .DRAFT_WITH_PAGENUMBER \}
.          if \\n[#USER_DEF_HDRFTR_LEFT]=0   .ds $HDRFTR_LEFT \\*[$AUTHOR_1]
.          rr #USER_DEF_HDRFTR_LEFT
.          if \\n[#USER_DEF_HDRFTR_CENTER]=0 .ds $HDRFTR_CENTER \\*[$TITLE]
.          rr #USER_DEF_HDRFTR_CENTER
.          if \\n[#USER_DEF_HDRFTR_RIGHT]=0  .ds $HDRFTR_RIGHT \\*[$DOC_TITLE]
.          rr #USER_DEF_HDRFTR_RIGHT
.       \}
.    \}
.    el \{\
.       if \\n[#USER_DEF_HDRFTR_LEFT]=0  .ds $HDRFTR_LEFT \\*[$AUTHOR_1]
.       rr #USER_DEF_HDRFTR_LEFT
.       if \\n[#USER_DEF_HDRFTR_RIGHT]=0 .ds $HDRFTR_RIGHT \\*[$TITLE]
.       rr #USER_DEF_HDRFTR_RIGHT
.    \}
.    if !d$ATTRIBUTE_STRING         \{ .ATTRIBUTE_STRING "by" \}
.    if !d$FINIS_STRING             \{ .FINIS_STRING "END"    \}
.\" Covers
.    if !r#DOC_COVERS_OFF           \{ .nr #DOC_COVERS 1           \}
.    if !r#COVERS_OFF               \{ .nr #COVERS 1               \}
.    if !d$COVER_COPYRIGHT_QUAD     \{ .COVER_COPYRIGHT_QUAD R     \}
.    if !d$COVER_MISC_QUAD          \{ .COVER_MISC_QUAD L          \}
.    if !d$DOC_COVER_COPYRIGHT_QUAD \{ .DOC_COVER_COPYRIGHT_QUAD R \}
.    if !d$DOC_COVER_MISC_QUAD      \{ .DOC_COVER_MISC_QUAD L      \}
.\" Defaults for printstyle TYPEWRITE
.    if \\n[#PRINT_STYLE]=1 \{\
.       if \\n[#UNDERLINE_QUOTES]=1 \{ .UNDERLINE_QUOTES         \}
.       if \\n[#UNDERLINE_QUOTES]=0 \{ .UNDERLINE_QUOTES OFF     \}
.\" +Quotes and blockquotes
.       if !r#Q_OFFSET_VALUE        \{ .QUOTE_INDENT      2      \}
.\" +Epigraphs
.       if !r#EPI_OFFSET_VALUE      \{ .EPIGRAPH_INDENT   2      \}
.\" +Linebreaks
.       if !d$LINEBREAK_CHAR        \{ .LINEBREAK_CHAR    * 3 2p \}
.\" +Footnotes
.       if !d$FN_SIZE_CHANGE        \{ .FOOTNOTE_SIZE     +0     \}
.       if !r#FN_RULE_LENGTH        \{ .FOOTNOTE_RULE_LENGTH 2i  \}
.\" +Paragraph heads
.       if !r#PH_INDENT    \{ .PARAHEAD_INDENT \\n[#PP_INDENT]u/2u \}
.\" +Endnotes
.       if !r#EN_PP_INDENT \{ .ENDNOTE_PARA_INDENT \\n[#PP_INDENT] \}
.\" +Footnotes
.       if !r#FN_RULE_ADJ           \{ .FOOTNOTE_RULE_ADJ  6p    \}
.\" +Slant stuff
.       if !r#SLANT_MEANS_SLANT \{\
.          ie \\n[#UNDERLINE_SLANT]=1 \{ .UNDERLINE_SLANT \}
.          el \{ .UNDERLINE_SLANT OFF \}
.       \}
.    \}
.\" Defaults for printstyle TYPESET
.    if \\n[#PRINT_STYLE]=2 \{\
.       if !d$DOCHEADER_LEAD_ADJ \{\
.          ie !'\\*[$CHAPTER_TITLE]'' \{\
.             ie !'\\*[$CHAPTER_STRING]'' \{\
.                DOCHEADER_LEAD +4
.             \}
.             el \{ .DOCHEADER_LEAD +0 \}
.          \}
.          el \{ .DOCHEADER_LEAD +0 \}
.       \}
.\" +Cover
.       if !d$COVER_LEAD_ADJ \{ .COVER_LEAD +0 \}
.       if !d$COVER_FAM \{ .COVER_FAMILY \\*[$DOC_FAM] \}
.\" (title)
.       if !d$COVER_TITLE_FAM \{\
.          ie !d$COVER_FAM \{ .COVER_TITLE_FAMILY \\*[$DOC_FAM] \}
.          el            \{ .COVER_TITLE_FAMILY \\*[$COVER_FAM] \}
.       \}
.       if !d$COVER_TITLE_FT          \{ .COVER_TITLE_FONT B    \}
.       if !d$COVER_TITLE_SIZE_CHANGE \{ .COVER_TITLE_SIZE +3.5 \}
.\" (chapter title)
.       if !d$COVER_CHAPTER_TITLE_FAM \{\
.          ie !d$COVER_FAM \{ .COVER_CHAPTER_TITLE_FAMILY \\*[$DOC_FAM] \}
.          el            \{ .COVER_CHAPTER_TITLE_FAMILY \\*[$COVER_FAM] \}
.       \}
.       if !d$COVER_CHAPTER_TITLE_FT          \{ .COVER_CHAPTER_TITLE_FONT BI \}
.       if !d$COVER_CHAPTER_TITLE_SIZE_CHANGE \{ .COVER_CHAPTER_TITLE_SIZE +4 \}
.\" (subtitle)
.       if !d$COVER_SUBTITLE_FAM \{\
.          ie !d$COVER_FAM \{ .COVER_SUBTITLE_FAMILY \\*[$DOC_FAM] \}
.          el            \{ .COVER_SUBTITLE_FAMILY \\*[$COVER_FAM] \}
.       \}
.       if !d$COVER_SUBTITLE_FT          \{ .COVER_SUBTITLE_FONT R  \}
.       if !d$COVER_SUBTITLE_SIZE_CHANGE \{ .COVER_SUBTITLE_SIZE +0 \}
.\" (attribution and author[s])
.       if !d$COVER_AUTHOR_FAM \{\
.          ie !d$COVER_FAM \{ .COVER_AUTHOR_FAMILY \\*[$DOC_FAM] \}
.          el      \{ .COVER_AUTHOR_FAMILY \\*[$COVER_FAM] \}
.       \}
.       if !d$COVER_AUTHOR_FT          \{ .COVER_AUTHOR_FONT I  \}
.       if !d$COVER_AUTHOR_SIZE_CHANGE \{ .COVER_AUTHOR_SIZE +0 \}
.\" (doctype if "named")
.       if !d$COVER_DOCTYPE_FAM \{\
.          ie !d$COVER_FAM \{ .COVER_DOCTYPE_FAMILY \\*[$DOC_FAM] \}
.          el            \{ .COVER_DOCTYPE_FAMILY \\*[$COVER_FAM] \}
.       \}
.       if !d$COVER_DOCTYPE_FT          \{ .COVER_DOCTYPE_FONT BI \}
.       if !d$COVER_DOCTYPE_SIZE_CHANGE \{ .COVER_DOCTYPE_SIZE +3 \}
.\" (copyright)
.       if !d$COVER_COPYRIGHT_FAM \{\
.          ie !d$COVER_FAM \{ .COVER_COPYRIGHT_FAMILY \\*[$DOC_FAM] \}
.          el            \{ .COVER_COPYRIGHT_FAMILY \\*[$COVER_FAM] \}
.       \}
.       if !d$COVER_COPYRIGHT_FT          \{ .COVER_COPYRIGHT_FONT R  \}
.       if !d$COVER_COPYRIGHT_SIZE_CHANGE \{ .COVER_COPYRIGHT_SIZE -2 \}
.\" +Doc cover
.       if !d$DOC_COVER_LEAD_ADJ \{ .DOC_COVER_LEAD +0 \}
.       if !d$DOC_COVER_FAM \{ .DOC_COVER_FAMILY \\*[$DOC_FAM] \}
.\" (title)
.       if !d$DOC_COVER_TITLE_FAM \{\
.          ie !d$DOC_COVER_FAM \{ .DOC_COVER_TITLE_FAMILY \\*[$DOC_FAM] \}
.          el            \{ .DOC_COVER_TITLE_FAMILY \\*[$DOC_COVER_FAM] \}
.       \}
.       if !d$DOC_COVER_TITLE_FT          \{ .DOC_COVER_TITLE_FONT B    \}
.       if !d$DOC_COVER_TITLE_SIZE_CHANGE \{ .DOC_COVER_TITLE_SIZE +3.5 \}
.\" (chapter title)
.       if !d$DOC_COVER_CHAPTER_TITLE_FAM \{\
.          ie !d$DOC_COVER_FAM \{ .DOC_COVER_CHAPTER_TITLE_FAMILY \\*[$DOC_FAM] \}
.          el            \{ .DOC_COVER_CHAPTER_TITLE_FAMILY \\*[$DOC_COVER_FAM] \}
.       \}
.       if !d$DOC_COVER_CHAPTER_TITLE_FT          \{ .DOC_COVER_CHAPTER_TITLE_FONT BI \}
.       if !d$DOC_COVER_CHAPTER_TITLE_SIZE_CHANGE \{ .DOC_COVER_CHAPTER_TITLE_SIZE +4 \}
.\" (subtitle)
.       if !d$DOC_COVER_SUBTITLE_FAM \{\
.          ie !d$DOC_COVER_FAM \{ .DOC_COVER_SUBTITLE_FAMILY \\*[$DOC_FAM] \}
.          el            \{ .DOC_COVER_SUBTITLE_FAMILY \\*[$DOC_COVER_FAM] \}
.       \}
.       if !d$DOC_COVER_SUBTITLE_FT          \{ .DOC_COVER_SUBTITLE_FONT R  \}
.       if !d$DOC_COVER_SUBTITLE_SIZE_CHANGE \{ .DOC_COVER_SUBTITLE_SIZE +0 \}
.\" (attribution and author[s])
.       if !d$DOC_COVER_AUTHOR_FAM \{\
.          ie !d$DOC_COVER_FAM \{ .DOC_COVER_AUTHOR_FAMILY \\*[$DOC_FAM] \}
.          el            \{ .DOC_COVER_AUTHOR_FAMILY \\*[$DOC_COVER_FAM] \}
.       \}
.       if !d$DOC_COVER_AUTHOR_FT          \{ .DOC_COVER_AUTHOR_FONT I  \}
.       if !d$DOC_COVER_AUTHOR_SIZE_CHANGE \{ .DOC_COVER_AUTHOR_SIZE +0 \}
.\" (doctype if "named")
.       if !d$DOC_COVER_DOCTYPE_FAM \{\
.          ie !d$DOC_COVER_FAM \{ .DOC_COVER_DOCTYPE_FAMILY \\*[$DOC_FAM] \}
.          el            \{ .DOC_COVER_DOCTYPE_FAMILY \\*[$DOC_COVER_FAM] \}
.       \}
.       if !d$DOC_COVER_DOCTYPE_FT          \{ .DOC_COVER_DOCTYPE_FONT BI \}
.       if !d$DOC_COVER_DOCTYPE_SIZE_CHANGE \{ .DOC_COVER_DOCTYPE_SIZE +3 \}
.\" (copyright)
.       if !d$DOC_COVER_COPYRIGHT_FAM \{\
.          ie !d$DOC_COVER_FAM \{ .DOC_COVER_COPYRIGHT_FAMILY \\*[$DOC_FAM] \}
.          el            \{ .DOC_COVER_COPYRIGHT_FAMILY \\*[$DOC_COVER_FAM] \}
.       \}
.       if !d$DOC_COVER_COPYRIGHT_FT          \{ .DOC_COVER_COPYRIGHT_FONT R  \}
.       if !d$DOC_COVER_COPYRIGHT_SIZE_CHANGE \{ .DOC_COVER_COPYRIGHT_SIZE -2 \}
.\" +Docheader
.       if !d$DOCHEADER_FAM \{ .DOCHEADER_FAMILY \\*[$DOC_FAM] \}
.       if !d$TITLE_FAM \{\
.          ie !d$DOCHEADER_FAM \{ .TITLE_FAMILY \\*[$DOC_FAM]       \}
.          el                  \{ .TITLE_FAMILY \\*[$DOCHEADER_FAM] \}
.       \}
.       if !d$TITLE_FT \{ .TITLE_FONT B \}
.       if !d$TITLE_SIZE_CHANGE \{\
.          ie \\n[#DOC_TYPE]=2 \{ .TITLE_SIZE +4 \}
.          el \{ .TITLE_SIZE +3.5 \}
.       \}
.       if !d$CHAPTER_TITLE_FAM \{\
.          ie !d$DOCHEADER_FAM \{ .CHAPTER_TITLE_FAMILY \\*[$DOC_FAM]       \}
.          el                  \{ .CHAPTER_TITLE_FAMILY \\*[$DOCHEADER_FAM] \}
.       \}
.       if !d$CHAPTER_TITLE_FT          \{ .CHAPTER_TITLE_FONT   BI \}
.       if !d$CHAPTER_TITLE_SIZE_CHANGE \{ .CHAPTER_TITLE_SIZE  +4  \}
.       if !d$SUBTITLE_FAM \{\
.          ie !d$DOCHEADER_FAM \{ .SUBTITLE_FAMILY \\*[$DOC_FAM]       \}
.          el                  \{ .SUBTITLE_FAMILY \\*[$DOCHEADER_FAM] \}
.       \}
.       if !d$SUBTITLE_FT          \{ .SUBTITLE_FONT      R  \}
.       if !d$SUBTITLE_SIZE_CHANGE \{ .SUBTITLE_SIZE     +0  \}
.       if !d$AUTHOR_FAM \{\
.          ie !d$DOCHEADER_FAM \{ .AUTHOR_FAMILY \\*[$DOC_FAM]       \}
.          el                  \{ .AUTHOR_FAMILY \\*[$DOCHEADER_FAM] \}
.       \}
.       if !d$AUTHOR_FT          \{ .AUTHOR_FONT  I \}
.       if !d$AUTHOR_SIZE_CHANGE \{ .AUTHOR_SIZE +0 \}
.       if !d$DOCTYPE_FAM \{\
.          ie !d$DOCHEADER_FAM \{ .DOCTYPE_FAMILY \\*[$DOC_FAM]       \}
.          el                  \{ .DOCTYPE_FAMILY \\*[$DOCHEADER_FAM] \}
.       \}
.       if !d$DOCTYPE_FT           \{ .DOCTYPE_FONT       BI \}
.       if !d$DOCTYPE_SIZE_CHANGE  \{ .DOCTYPE_SIZE       +3 \}
.\" +Headers and footers
.       if !d$HDRFTR_LEFT_FAM      \{ .HDRFTR_LEFT_FAMILY \\*[$DOC_FAM] \}
.       if !d$HDRFTR_LEFT_FT       \{ .HDRFTR_LEFT_FONT R               \}
.       if \\n[#HDRFTR_LEFT_CAPS]  \{\
.          if !d$HDRFTR_LEFT_SIZE_CHANGE \{ .HDRFTR_LEFT_SIZE  -2 \}
.       \}
.       if !d$HDRFTR_LEFT_SIZE_CHANGE \{ .HDRFTR_LEFT_SIZE     -.5           \}
.       if !d$HDRFTR_CENTER_FAM       \{ .HDRFTR_CENTER_FAMILY \\*[$DOC_FAM] \}
.       if !d$HDRFTR_CENTER_FT        \{ .HDRFTR_CENTER_FONT   I             \}
.       if \\n[#HDRFTR_CENTER_CAPS] \{\
.          if !d$HDRFTR_CENTER_SIZE_CHANGE \{ .HDRFTR_CENTER_SIZE -2 \}
.       \}
.       if !d$HDRFTR_CENTER_SIZE_CHANGE \{ .HDRFTR_CENTER_SIZE -.5            \}
.       if !d$HDRFTR_RIGHT_FAM          \{ .HDRFTR_RIGHT_FAMILY \\*[$DOC_FAM] \}
.       if !d$HDRFTR_RIGHT_FT           \{ .HDRFTR_RIGHT_FONT   R             \}
.       if \\n[#HDRFTR_RIGHT_CAPS] \{\
.          if !d$HDRFTR_RIGHT_SIZE_CHANGE \{ .HDRFTR_RIGHT_SIZE -2 \}
.       \}
.       if !d$HDRFTR_RIGHT_SIZE_CHANGE  \{ .HDRFTR_RIGHT_SIZE  -.5              \}
.\" +Heads
.       if !d$HEAD_FAM                  \{ .HEAD_FAMILY        \\*[$DOC_FAM]    \}
.       if !d$HEAD_FT                   \{ .HEAD_FONT          B                \}
.       if !d$HEAD_SIZE_CHANGE          \{ .HEAD_SIZE          +1               \}
.       if !r#HEAD_SPACE                \{ .HEAD_SPACE                          \}
.\" +Subheads
.       if !d$SH_FAM                    \{ .SUBHEAD_FAMILY     \\*[$DOC_FAM]    \}
.       if !d$SH_FT                     \{ .SUBHEAD_FONT       B                \}
.       if !d$SH_SIZE_CHANGE            \{ .SUBHEAD_SIZE       +.5              \}
.\" +Paragraph heads
.       if !d$PH_FAM                    \{ .PARAHEAD_FAMILY    \\*[$DOC_FAM]    \}
.       if !d$PH_FT                     \{ .PARAHEAD_FONT      BI               \}
.       if !d$PH_SIZE_CHANGE            \{ .PARAHEAD_SIZE      -.25             \}
.       if !r#PH_INDENT                 \{ .PARAHEAD_INDENT \\n[#PP_INDENT]u/2u \}
.\" +Quotes
.       if !d$QUOTE_FAM                 \{ .QUOTE_FAMILY       \\*[$DOC_FAM]    \}
.       if !d$QUOTE_FT                  \{ .QUOTE_FONT         I                \}
.       if !d$QUOTE_SIZE_CHANGE         \{ .QUOTE_SIZE         +0               \}
.       if !r#Q_OFFSET_VALUE            \{ .QUOTE_INDENT       3                \}
.\" +Blockquotes
.\"  Note: the leading for quotes and blockquotes is set after .DEFAULTS in START
.       if !d$BQUOTE_FAM                \{ .BLOCKQUOTE_FAMILY  \\*[$DOC_FAM]    \}
.       if !d$BQUOTE_FT                 \{ .BLOCKQUOTE_FONT    R                \}
.       if !d$BQUOTE_SIZE_CHANGE        \{ .BLOCKQUOTE_SIZE    -1               \}
.       if !d$BQUOTE_QUAD               \{ .BLOCKQUOTE_QUAD    LEFT             \}
.\" +Epigraphs
.       if !d$EPI_FAM                   \{ .EPIGRAPH_FAMILY    \\*[$DOC_FAM]    \}
.       if !d$EPI_FT                    \{ .EPIGRAPH_FONT      R                \}
.       if !d$EPI_SIZE_CHANGE           \{ .EPIGRAPH_SIZE      -1.5             \}
.       if !r#EPI_AUTOLEAD              \{ .EPIGRAPH_AUTOLEAD  2                \}
.       if !d$EPI_QUAD                  \{ .EPIGRAPH_QUAD      \\*[$DOC_QUAD]   \}
.       if !r#EPI_OFFSET_VALUE          \{ .EPIGRAPH_INDENT    3                \}
.\" +Linebreaks
.       if !d$LINEBREAK_CHAR            \{ .LINEBREAK_CHAR     * 3 3p           \}
.\" +Footnotes
.       if !r#FN_RULE_LENGTH            \{ .FOOTNOTE_RULE_LENGTH 4P             \}
.       if !r#FN_RULE_ADJ               \{ .FOOTNOTE_RULE_ADJ  3p               \}
.       if !d$FN_SIZE_CHANGE            \{ .FOOTNOTE_SIZE      -2               \}
.       if !r#FN_AUTOLEAD               \{ .FOOTNOTE_AUTOLEAD  2                \}
.\" +Endnotes
.       if !r#EN_PS                     \{ .ENDNOTE_PT_SIZE \\n[#DOC_PT_SIZE]u  \}
.       if !d$EN_STRING_FT              \{ .ENDNOTE_STRING_FONT B               \}
.       if !d$EN_STRING_SIZE_CHANGE     \{ .ENDNOTE_STRING_SIZE +1              \}
.       if !d$EN_TITLE_FT               \{ .ENDNOTE_TITLE_FONT  B               \}
.       if !d$EN_TITLE_SIZE_CHANGE      \{ .ENDNOTE_TITLE_SIZE  +0              \}
.       if !d$EN_NUMBER_FT              \{ .ENDNOTE_NUMBER_FONT B               \}
.       if !d$EN_NUMBER_SIZE_CHANGE     \{ .ENDNOTE_NUMBER_SIZE +0              \}
.       if !r#EN_PP_INDENT              \{ .ENDNOTE_PARA_INDENT 1.5m            \}
.\" +Bibliography
.       if !r#BIB_LIST                  \{ .BIBLIOGRAPHY_TYPE LIST .                \}
.       if !r#BIB_PS                    \{ .BIBLIOGRAPHY_PT_SIZE \\n[#DOC_PT_SIZE]u \}
.       if !d$BIB_STRING_FT             \{ .BIBLIOGRAPHY_STRING_FONT B              \}
.       if !d$BIB_STRING_SIZE_CHANGE    \{ .BIBLIOGRAPHY_STRING_SIZE +1             \}
.\" +Table of contents
.       if !d$TOC_FAM                   \{ .TOC_FAMILY  \\*[$DOC_FAM]           \}
.       if !r#TOC_PS                    \{ .TOC_PT_SIZE \\n[#DOC_PT_SIZE]u      \}
.       if !r#TOC_LEAD                  \{ .TOC_LEAD    \\n[#DOC_LEAD]u ADJUST  \}
.       if !d$TOC_HEADER_FAM            \{ .TOC_HEADER_FAMILY \\*[$TOC_FAM]     \}
.       if !d$TOC_HEADER_SIZE_CHANGE    \{ .TOC_HEADER_SIZE +4                  \}
.       if !d$TOC_HEADER_FT             \{ .TOC_HEADER_FONT  B                  \}
.       if !d$TOC_TITLE_FAM             \{ .TOC_TITLE_FAMILY \\*[$TOC_FAM]      \}
.       if !d$TOC_PN_FAM                \{ .TOC_PN_FAMILY    \\*[$TOC_FAM]      \}
.       if !d$TOC_HEAD_FAM              \{ .TOC_HEAD_FAMILY  \\*[$TOC_FAM]      \}
.       if !d$TOC_SH_FAM                \{ .TOC_SUBHEAD_FAMILY  \\*[$TOC_FAM]   \}
.       if !d$TOC_PH_FAM                \{ .TOC_PARAHEAD_FAMILY \\*[$TOC_FAM]   \}
.       if !d$TOC_TITLE_FT              \{ .TOC_TITLE_FONT    BI                \}
.       if !d$TOC_PN_FT                 \{ .TOC_PN_FONT       R                 \}
.       if !d$TOC_HEAD_FT               \{ .TOC_HEAD_FONT     B                 \}
.       if !d$TOC_SH_FT                 \{ .TOC_SUBHEAD_FONT  R                 \}
.       if !d$TOC_PH_FT                 \{ .TOC_PARAHEAD_FONT I                 \}
.       if !d$TOC_TITLE_SIZE_CHANGE     \{ .TOC_TITLE_SIZE    +.5               \}
.       if !d$TOC_PN_SIZE_CHANGE        \{ .TOC_PN_SIZE       +0                \}
.       if !d$TOC_HEAD_SIZE_CHANGE      \{ .TOC_HEAD_SIZE     +.5               \}
.       if !d$TOC_SH_SIZE_CHANGE        \{ .TOC_SUBHEAD_SIZE  +0                \}
.       if !d$TOC_PH_SIZE_CHANGE        \{ .TOC_PARAHEAD_SIZE +0                \}
.    \}
.\" +Refer support
.    if !r#ENDNOTE_REFS \{ .nr #FN_REFS 1 \} 
.    if '\\*[$REF_FN_INDENT]'' \{\
.       if \\n[#PRINT_STYLE]=1 \{ .INDENT_REFS FOOTNOTE 2m   \}
.       if \\n[#PRINT_STYLE]=2 \{ .INDENT_REFS FOOTNOTE 1.5m \}
.    \}
.    if '\\*[$REF_EN_INDENT]'' \{\
.       if \\n[#PRINT_STYLE]=1 \{ .INDENT_REFS ENDNOTE 2m   \}
.       if \\n[#PRINT_STYLE]=2 \{ .INDENT_REFS ENDNOTE 1.5m \}
.    \}
.    if '\\*[$REF_BIB_INDENT]'' \{\
.       if \\n[#PRINT_STYLE]=1 \{ .INDENT_REFS BIBLIO 2m    \}
.       if \\n[#PRINT_STYLE]=2 \{ .INDENT_REFS BIBLIO 1.5m  :\}
.    \}
.\" Adjust doc leading for PRINTSTYLE TYPESET
.    if \\n[#PRINT_STYLE]=2 \{\
.       ie \\n[#ADJ_DOC_LEAD]=1 \{ .DOC_LEAD_ADJUST \}
.       el \{ . \}
.    \}
.\" This diversion is to get a value for #FN_AUTOLEAD
.    di NULL
.       ev NULL
.       if \\n[#PRINT_STYLE]=1 \{\
.          ps 12
.          ie \\n[#SINGLE_SPACE]=1 \{ .vs \\n[#ORIGINAL_DOC_LEAD]u \}
.          el \{ .vs \\n[#ORIGINAL_DOC_LEAD]u/2u \}
.       \}
.       if \\n[#PRINT_STYLE]=2 \{\
.          PT_SIZE  \\n[#DOC_PT_SIZE]u\\*[$FN_SIZE_CHANGE]
.          AUTOLEAD \\n[#FN_AUTOLEAD]
.       \}
.       nr #FN_LEAD \\n[#LEAD]
.       if \\n[#PRINT_STYLE]=2 \{ .LS \\n[#DOC_LEAD]u \}
.       ev
.    di
.    ie !\\n[#COLLATE] \{\
.\" DOC_LEAD adjusted (or not) here
.       TRAPS
.       rr #DOC_LEAD_ADJUST_OFF
.\" Endnote, bibliography and toc leading
.       nr #OK_PROCESS_LEAD 1
.       nr #RESTORE_DOC_LEAD \\n(.v
.       nr #RESTORE_B_MARGIN \\n[#B_MARGIN]
.       if \\n[#PRINT_STYLE]=1 \{\
.          ie \\n[#SINGLE_SPACE] \{\
.             ENDNOTE_LEAD 12 ADJUST
.             BIBLIOGRAPHY_LEAD 12 ADJUST
.          \}
.          el \{\
.             ie \\n[#EN_SINGLESPACE] \{ .ENDNOTE_LEAD 12 ADJUST \}
.             el \{ .ENDNOTE_LEAD 24 ADJUST \}
.             ie \\n[#BIB_SINGLESPACE] \{ .BIBLIOGRAPHY_LEAD 12 ADJUST \}
.             el \{ .BIBLIOGRAPHY_LEAD 24 ADJUST \}
.          \}
.       \}
.       if \\n[#PRINT_STYLE]=2 \{\
.          ie !d$EN_LEAD \{ .ENDNOTE_LEAD 14 ADJUST \}
.          el \{ .ENDNOTE_LEAD \\*[$EN_LEAD] \\*[$ADJUST_EN_LEAD] \}
.          ie !d$BIB_LEAD \{ .BIBLIOGRAPHY_LEAD 14 ADJUST \}
.          el \{ .BIBLIOGRAPHY_LEAD \\*[$BIB_LEAD] \\*[$ADJUST_BIB_LEAD] \}
.          ie !d$TOC_LEAD \{ .TOC_LEAD \\n[#RESTORE_DOC_LEAD]u \}
.          el \{ .TOC_LEAD \\*[$TOC_LEAD] \\*[$ADJUST_TOC_LEAD] \}
.          rm $ADJUST_EN_LEAD
.          rm $ADJUST_BIB_LEAD
.          rm $ADJUST_TOC_LEAD
.       \}
.       ie !d$BIB_SPACE \{ .BIBLIOGRAPHY_SPACING 1v \}
.       el \{\
.          if \\n[#DEFER_BIB_SPACING]=1 \{\
.             BIBLIOGRAPHY_SPACING \\*[$BIB_SPACE]
.             rr #DEFER_BIB_SPACING
.          \}
.       \}
.       DOC_LEAD \\n[#RESTORE_DOC_LEAD]u
.       nr #B_MARGIN \\n[#RESTORE_B_MARGIN]
.    \}
.    el \{\
.       if \\n[#COLLATE] \{\
.          if !\\n[#PRINT_STYLE]=1 \{\
.             if \\n[#RERUN_TRAPS] \{ .TRAPS \}
.          \}
.       \}
.    \}
.    if \\n[#PRINT_STYLE]=1 \{ .nr #IGNORE 1 \}
.END
\#
\# ====================================================================
\#
\# +++START THE DOCUMENT+++
\#
\# THE START MACRO
\# ---------------
\# *Arguments:
\#   <none>
\# *Function:
\#   Reads in default document style parameters and any parameter
\#   the user has changed before issuing START.
\#   Using the information gathered in the opening macros,
\#   prints appropriate title (or chapter #), subtitle, author
\#   and document type (if appropriate).
\# *Notes:
\#   The .PRINT \& (zero-width character) is required to get the
\#   subsequent .sp request to work as advertised.
\#
\#   The overall document line length, family, and point-size
\#   are stored in #DOC_L_LENGTH, $DOC_FAM, and #DOC_PT_SIZE for
\#   use in the HEADER and FOOTER macros.
\#
\#  First, define some strings for point sizes
\#
\# Doc cover
.ds $DOC_COVER_AUTHOR_PT_SIZE        \\n[#DOC_PT_SIZE]u\\*[$DOC_COVER_AUTHOR_SIZE_CHANGE]
.ds $DOC_COVER_CHAPTER_TITLE_PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$DOC_COVER_CHAPTER_TITLE_SIZE_CHANGE]
.ds $DOC_COVER_COPYRIGHT_PT_SIZE     \\n[#DOC_PT_SIZE]u\\*[$DOC_COVER_COPYRIGHT_SIZE_CHANGE]
.ds $DOC_COVER_DOCTYPE_PT_SIZE       \\n[#DOC_PT_SIZE]u\\*[$DOC_COVER_DOCTYPE_SIZE_CHANGE]
.ds $DOC_COVER_SUBTITLE_PT_SIZE      \\n[#DOC_PT_SIZE]u\\*[$DOC_COVER_SUBTITLE_SIZE_CHANGE]
.ds $DOC_COVER_TITLE_PT_SIZE         \\n[#DOC_PT_SIZE]u\\*[$DOC_COVER_TITLE_SIZE_CHANGE]
\# Cover
.ds $COVER_AUTHOR_PT_SIZE        \\n[#DOC_PT_SIZE]u\\*[$COVER_AUTHOR_SIZE_CHANGE]
.ds $COVER_CHAPTER_TITLE_PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$COVER_CHAPTER_TITLE_SIZE_CHANGE]
.ds $COVER_COPYRIGHT_PT_SIZE     \\n[#DOC_PT_SIZE]u\\*[$COVER_COPYRIGHT_SIZE_CHANGE]
.ds $COVER_DOCTYPE_PT_SIZE       \\n[#DOC_PT_SIZE]u\\*[$COVER_DOCTYPE_SIZE_CHANGE]
.ds $COVER_SUBTITLE_PT_SIZE      \\n[#DOC_PT_SIZE]u\\*[$COVER_SUBTITLE_SIZE_CHANGE]
.ds $COVER_TITLE_PT_SIZE         \\n[#DOC_PT_SIZE]u\\*[$COVER_TITLE_SIZE_CHANGE]
\# Docheader
.ds $AUTHOR_PT_SIZE         \\n[#DOC_PT_SIZE]u\\*[$AUTHOR_SIZE_CHANGE]
.ds $CHAPTER_TITLE_PT_SIZE  \\n[#DOC_PT_SIZE]u\\*[$CHAPTER_TITLE_SIZE_CHANGE]
.ds $COPYRIGHT_PT_SIZE      \\n[#DOC_PT_SIZE]u\\*[$COPYRIGHT_SIZE_CHANGE]
.ds $DOCTYPE_PT_SIZE        \\n[#DOC_PT_SIZE]u\\*[$DOCTYPE_SIZE_CHANGE]
.ds $SUBTITLE_PT_SIZE       \\n[#DOC_PT_SIZE]u\\*[$SUBTITLE_SIZE_CHANGE]
.ds $TITLE_PT_SIZE          \\n[#DOC_PT_SIZE]u\\*[$TITLE_SIZE_CHANGE]
\#
\# Next, some utility macros for various routines to prevent repetition
\#
.MAC PRINT_AUTHORS END
.    nr #AUTHORS \\n[#AUTHOR_NUM]
.    nr #NEXT_AUTHOR 0 1
.    ie r#DOING_COVER \{\
.       if \\n[#COVER]=1 \{\
.          while \\n[#AUTHORS]>\\n[#NEXT_AUTHOR] \{\
.             ie \\n[#COVER_AUTHOR_COLOR]=1 \{\
.                PRINT \m[\\*[$COVER_AUTHOR_COLOR]]\\*[$AUTHOR_\\n+[#NEXT_AUTHOR]]\m[]
.             \}
.             el \{ .PRINT \\*[$AUTHOR_\\n+[#NEXT_AUTHOR]] \}
.\}
.       \}
.       if \\n[#DOC_COVER]=1 \{\
.          while \\n[#AUTHORS]>\\n[#NEXT_AUTHOR] \{\
.             ie \\n[#DOC_COVER_AUTHOR_COLOR]=1 \{\
.                PRINT \m[\\*[$DOC_COVER_AUTHOR_COLOR]]\\*[$AUTHOR_\\n+[#NEXT_AUTHOR]]\m[]
.             \}
.             el \{ .PRINT \\*[$AUTHOR_\\n+[#NEXT_AUTHOR]] \}
.\}
.       \}
.    \}
.    el \{\
.       while \\n[#AUTHORS]>\\n[#NEXT_AUTHOR] \{\
.          ie \\n[#AUTHOR_COLOR]=1 \{\
.             PRINT \m[\\*[$AUTHOR_COLOR]]\\*[$AUTHOR_\\n+[#NEXT_AUTHOR]]\m[]
.          \}
.          el \{ .PRINT \\*[$AUTHOR_\\n+[#NEXT_AUTHOR]] \}
.\}
.    \}
.END
\#
.MAC DEFAULT_DOCHEADER END
.    CENTER
.    FAMILY  \\*[$TITLE_FAM]
.    FT      \\*[$TITLE_FT]
.    PT_SIZE \\*[$TITLE_PT_SIZE]
.    LS      \\n[#DOCHEADER_LEAD]u
.    ie \\n[#TITLE_COLOR]=1 \{\
.       PRINT \m[\\*[$TITLE_COLOR]]\\*[$TITLE]\m[]
.    \}
.    el \{ .PRINT \\*[$TITLE] \}
.    if !'\\*[$SUBTITLE]'' \{\
.       FAMILY  \\*[$SUBTITLE_FAM]
.       FT      \\*[$SUBTITLE_FT]
.       PT_SIZE \\*[$SUBTITLE_PT_SIZE]
.       ie \\n[#SUBTITLE_COLOR]=1 \{\
.          PRINT \m[\\*[$SUBTITLE_COLOR]]\\*[$TITLE]\m[]
.       \}
.       el \{ .PRINT \\*[$SUBTITLE] \}
.    \}
.    if !'\\*[$AUTHOR_1]'' \{\
.       FAMILY  \\*[$AUTHOR_FAM]
.       FT      \\*[$AUTHOR_FT]
.       PT_SIZE \\*[$AUTHOR_PT_SIZE]
.       if !'\\*[$ATTRIBUTE_STRING]'' \{\
.          ie \\n[#ATTRIBUTE_COLOR]=1 \{\
.             PRINT \m[\\*[$ATTRIBUTE_COLOR]]\\*[$ATTRIBUTE_STRING]\m[]
.          \}
.          el \{ .PRINT \\*[$ATTRIBUTE_STRING] \}
.       \}
.       PRINT_AUTHORS
.    \}
.END
\#
\#
.MAC CHAPTER_DOCHEADER END
.    CENTER
.    FAMILY  \\*[$TITLE_FAM]
.    FT      \\*[$TITLE_FT]
.    PT_SIZE \\*[$TITLE_PT_SIZE]
.    LS      \\n[#DOCHEADER_LEAD]u
.\" Chapter title only
.    ie '\\*[$CHAPTER]'' \{\
.       ie !'\\*[$CHAPTER_TITLE]'' \{\
.          if \\n[#PRINT_STYLE]=2 \{\
.             FAMILY  \\*[$CHAPTER_TITLE_FAM]
.             FT      \\*[$CHAPTER_TITLE_FT]
.             PT_SIZE \\*[$CHAPTER_TITLE_PT_SIZE]
.             LS      \\n[#DOCHEADER_LEAD]u
.          \}
.          ie \\n[#TITLE_COLOR]=1 \{\
.             PRINT \m[\\*[$TITLE_COLOR]]\\*[$CHAPTER_TITLE]\m[]
.          \}
.          el \{ .PRINT \\*[$CHAPTER_TITLE] \}
.       \}
.       el \{\
.          ie \\n[#TITLE_COLOR]=1 \{\
.             PRINT \m[\\*[$TITLE_COLOR]]\\*[$CHAPTER_STRING]\m[]
.          \}
.          el \{ .PRINT \\*[$CHAPTER_STRING] \}
.       \}
.    \}
.\" Chapter string, possibly with a chapter title
.    el \{\
.       ie \\n[#TITLE_COLOR]=1 \{\
.          PRINT \m[\\*[$TITLE_COLOR]]\\*[$CHAPTER_STRING] \\*[$CHAPTER]\m[]
.       \}
.       el \{ .PRINT \\*[$CHAPTER_STRING] \\*[$CHAPTER] \}
.       if !'\\*[$CHAPTER_TITLE]'' \{\
.          if \\n[#PRINT_STYLE]=1 \{ .PRINT \\*[$CHAPTER_TITLE] \}
.          if \\n[#PRINT_STYLE]=2 \{\
.             FAMILY  \\*[$CHAPTER_TITLE_FAM]
.             FT      \\*[$CHAPTER_TITLE_FT]
.             PT_SIZE \\*[$CHAPTER_TITLE_PT_SIZE]
.             LS      \\n[#DOCHEADER_LEAD]u
.             ie \\n[#CHAPTER_TITLE_COLOR]=1 \{\
.                PRINT \m[\\*[$CHAPTER_TITLE_COLOR]]\\*[$CHAPTER_TITLE]\m[]
.             \}
.             el \{ .PRINT \\*[$CHAPTER_TITLE] \}
.             RLD \\n[#DOC_LEAD]u \" Just looks better this way
.          \}
.       \}
.    \}
.END
\#
\#
.MAC NAMED_DOCHEADER END
.    CENTER
.    FAMILY  \\*[$TITLE_FAM]
.    FT      \\*[$TITLE_FT]
.    PT_SIZE \\*[$TITLE_PT_SIZE]
.    LS      \\n[#DOCHEADER_LEAD]u
.    ie \\n[#TITLE_COLOR]=1 \{\
.       PRINT \m[\\*[$TITLE_COLOR]]\\*[$TITLE]\m[]
.    \}
.    el \{ .PRINT \\*[$TITLE] \}
.    if !'\\*[$SUBTITLE]'' \{\
.       FAMILY  \\*[$SUBTITLE_FAM]
.       FT      \\*[$SUBTITLE_FT]
.       PT_SIZE \\*[$SUBTITLE_PT_SIZE]
.       ie \\n[#SUBTITLE_COLOR]=1 \{\
.          PRINT \m[\\*[$SUBTITLE_COLOR]]\\*[$TITLE]\m[]
.       \}
.       el \{ .PRINT \\*[$SUBTITLE] \}
.    \}
.    if !'\\*[$AUTHOR_1]'' \{\
.       FAMILY  \\*[$AUTHOR_FAM]
.       FT      \\*[$AUTHOR_FT]
.       PT_SIZE \\*[$AUTHOR_PT_SIZE]
.       if !'\\*[$ATTRIBUTE_STRING]'' \{\
.          ie \\n[#ATTRIBUTE_COLOR]=1 \{\
.             PRINT \m[\\*[$ATTRIBUTE_COLOR]]\\*[$ATTRIBUTE_STRING]\m[]
.          \}
.          el \{ .PRINT \\*[$ATTRIBUTE_STRING] \}
.       \}
.       PRINT_AUTHORS
.    \}
.    FAMILY  \\*[$DOCTYPE_FAM]
.    FT      \\*[$DOCTYPE_FT]
.    PT_SIZE \\*[$DOCTYPE_PT_SIZE]
.    LS      \\n[#DOCHEADER_LEAD]u
.    ALD     \\n[#DOCHEADER_LEAD]u
.    ie \\n[#DOCTYPE_COLOR]=1 \{\
.       COLOR \\*[$DOCTYPE_COLOR]
.       UNDERSCORE "\\*[$DOC_TYPE]
.    \}
.    el .UNDERSCORE "\\*[$DOC_TYPE]
.END
\#
\#
\# COVER PAGE
\# ----------
\# *Arguments:
\#   TITLE | DOCTITLE | CHAPTER | CHAPTER_TITLE | CHAPTER+TITLE | COVERTITLE ...
\#   ... [ SUBTITLE AUTHOR DOCTYPE COPYRIGHT MISC ]
\# *Function:
\#   Toggles the number register for each cover page element
\#   passed as an argument.
\# *Notes:
\#   TITLE, DOCTITLE, CHAPTER, CHAPTER_TITLE or CHAPTER+TITLE must
\#   be supplied.  After that, users may enter as many or as few of
\#   the arguments as they like; however, the arguments must appear
\#   in the order given above.
\#
\#   If called as DOC_COVER, performs the same operations, but
\#   applies everything to a doc cover.
\#
.MAC COVER END
.    ie '\\$0'DOC_COVER' \{\
.       nr #DOC_COVER 1
.       if '\\$1'TITLE'         \{ .nr #DOC_COVER_TITLE     1 \}
.       if '\\$1'DOCTITLE'      \{ .nr #DOC_COVER_TITLE     2 \}
.       if '\\$1'CHAPTER'       \{ .nr #DOC_COVER_TITLE     3 \}
.       if '\\$1'CHAPTER_TITLE' \{ .nr #DOC_COVER_TITLE     4 \}
.       if '\\$1'CHAPTER+TITLE' \{ .nr #DOC_COVER_TITLE     5 \}
.       if '\\$1'COVERTITLE'    \{ .nr #DOC_COVER_TITLE     6 \}
.       if '\\$2'SUBTITLE'      \{ .nr #DOC_COVER_SUBTITLE  1 \}
.       if '\\$2'AUTHOR'        \{ .nr #DOC_COVER_AUTHOR    1 \}
.       if '\\$2'DOCTYPE'       \{ .nr #DOC_COVER_DOCTYPE   1 \}
.       if '\\$2'COPYRIGHT'     \{ .nr #DOC_COVER_COPYRIGHT 1 \}
.       if '\\$2'MISC'          \{ .nr #DOC_COVER_MISC      1 \}
.       if '\\$3'AUTHOR'        \{ .nr #DOC_COVER_AUTHOR    1 \}
.       if '\\$3'DOCTYPE'       \{ .nr #DOC_COVER_DOCTYPE   1 \}
.       if '\\$3'COPYRIGHT'     \{ .nr #DOC_COVER_COPYRIGHT 1 \}
.       if '\\$3'MISC'          \{ .nr #DOC_COVER_MISC      1 \}
.       if '\\$4'DOCTYPE'       \{ .nr #DOC_COVER_DOCTYPE   1 \}
.       if '\\$4'COPYRIGHT'     \{ .nr #DOC_COVER_COPYRIGHT 1 \}
.       if '\\$4'MISC'          \{ .nr #DOC_COVER_MISC      1 \}
.       if '\\$5'COPYRIGHT'     \{ .nr #DOC_COVER_COPYRIGHT 1 \}
.       if '\\$5'MISC'          \{ .nr #DOC_COVER_MISC      1 \}
.       if '\\$6'MISC'          \{ .nr #DOC_COVER_MISC      1 \}
.    \}
.    el \{\
.       nr #COVER 1
.       if '\\$1'TITLE'         \{ .nr #COVER_TITLE     1 \}
.       if '\\$1'DOCTITLE'      \{ .nr #COVER_TITLE     2 \}
.       if '\\$1'CHAPTER'       \{ .nr #COVER_TITLE     3 \}
.       if '\\$1'CHAPTER_TITLE' \{ .nr #COVER_TITLE     4 \}
.       if '\\$1'CHAPTER+TITLE' \{ .nr #COVER_TITLE     5 \}
.       if '\\$1'COVERTITLE'    \{ .nr #COVER_TITLE     6 \}
.       if '\\$2'SUBTITLE'      \{ .nr #COVER_SUBTITLE  1 \}
.       if '\\$2'AUTHOR'        \{ .nr #COVER_AUTHOR    1 \}
.       if '\\$2'DOCTYPE'       \{ .nr #COVER_DOCTYPE   1 \}
.       if '\\$2'COPYRIGHT'     \{ .nr #COVER_COPYRIGHT 1 \}
.       if '\\$2'MISC'          \{ .nr #COVER_MISC      1 \}
.       if '\\$3'AUTHOR'        \{ .nr #COVER_AUTHOR    1 \}
.       if '\\$3'DOCTYPE'       \{ .nr #COVER_DOCTYPE   1 \}
.       if '\\$3'COPYRIGHT'     \{ .nr #COVER_COPYRIGHT 1 \}
.       if '\\$3'MISC'          \{ .nr #COVER_MISC      1 \}
.       if '\\$4'DOCTYPE'       \{ .nr #COVER_DOCTYPE   1 \}
.       if '\\$4'COPYRIGHT'     \{ .nr #COVER_COPYRIGHT 1 \}
.       if '\\$4'MISC'          \{ .nr #COVER_MISC      1 \}
.       if '\\$5'COPYRIGHT'     \{ .nr #COVER_COPYRIGHT 1 \}
.       if '\\$5'MISC'          \{ .nr #COVER_MISC      1 \}
.       if '\\$6'MISC'          \{ .nr #COVER_MISC      1 \}
.    \}
.END
\#
\#
.MAC COVERTITLE END
.    ie '\\$0'DOC_COVERTITLE' .ds $DOC_COVER_TITLE \\$1
.    el .ds $COVER_TITLE \\$1
.END
\#
\#
\# COVER PAGE LEADING
\# ------------------
\# *Arguments:
\#   <+|- amount by which to in/decrease leading of cover/doc cover>
\# *Function:
\#   Stores user supplied lead in/decrease in string $COVER_LEAD_ADJ
\#   or $DOC_COVER_LEAD_ADJ, depending on whether the macro was called
\#   with an alias (DOC_COVER_LEAD).
\# *Notes:
\#   A unit of measure must be supplied.  Decimal fractions OK.
\#   Default is +0, i.e. same as DOC_LEAD.
\#
.MAC COVER_LEAD END
.    ie '\\$0'DOC_COVER_LEAD' \{\
.       ds $DOC_COVER_LEAD_ADJ \\$1
.    \}
.    el \{\
.       ds $COVER_LEAD_ADJ \\$1
.    \}
.END
\#
\#
\# COVER PAGE START POSITION
\# -------------------------
\# *Arguments:
\#   <distance from page top at which to start cover/doc cover>
\# *Function:
\#   Stores user supplied lead in/decrease in #COVER_START_POS
\#   or #DOC_COVER_START_POS, depending on whether the macro was
\#   called by an alias (DOC_COVER_ADVANCE).
\# *Notes:
\#   A unit of measure must be supplied.  Decimal fractions OK.
\#   If user doesn't invoke this macro, the default starting
\#   position for both covers and doc covers is 1/3 of the way
\#   down the page (setup in DO_COVER).
\#
.MAC COVER_ADVANCE END
.    ie '\\$0'DOC_COVER_ADVANCE' \{\
.       nr #DOC_COVER_START_POS (\\$1)
.    \}
.    el \{\
.       nr #COVER_START_POS (\\$1)
.    \}
.END
\#
\#
\# COVERS - WHETHER TO PRINT
\# -------------------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Creates or removes registers #COVERS and #COVERS_OFF, checked for
\#   in DEFAULTS (in START) prior to printing
\#
.MAC COVERS END
.    ie '\\$0'DOC_COVERS' \{\
.       ie '\\$1'' \{\
.          rr #DOC_COVERS_OFF
.          nr #DOC_COVERS 1
.       \}
.       el \{\
.          rr #DOC_COVERS
.          nr #DOC_COVERS_OFF 1
.       \}
.    \}
.    el \{\
.       ie '\\$1'' \{\
.          rr #COVERS_OFF
.          nr #COVERS 1
.       \}
.       el \{\
.          rr #COVERS
.          nr #COVERS_OFF 1
.       \}
.    \}
.END
\#
\#
.MAC DO_COVER END
.    nr #DOING_COVER 1
.    ev COVER
.    evc 0
.    TRAP OFF
.    if \\n[#PAGINATE]=1 \{\
.       nr #PAGINATION_WAS_ON 1
.       rr #PAGINATE
.    \}
.    if \\n[#HEADERS_ON]=1 \{\
.       nr #HEADERS_WERE_ON 1
.       HEADERS OFF
.    \}
.    if \\n[#FOOTERS_ON]=1 \{\
.       nr #FOOTERS_WERE_ON 1
.       FOOTERS OFF
.    \}
.    if \\n[#COLUMNS]=1 \{\
.       nr #COLUMNS_WERE_ON 1
.       rr #COLUMNS
.    \}
.\" Doc cover
.    ie '\\$0'DO_DOC_COVER' \{\
.       if !r#DOC_COVER_START_POS \{\
.          nr #DOC_COVER_START_POS \\n[#PAGE_LENGTH]/3
.       \}
.       if \\n[#PRINT_STYLE]=1 \{\
.          ie \\n[#SINGLE_SPACE]=1 \{ .vs \\n[#DOC_LEAD]u*2u \}
.          el \{ .vs \\n[#DOC_LEAD]u \}
.       \}
.       if \\n[#PRINT_STYLE]=2 \{\
.          LS \\n[#DOC_LEAD]u\\*[$DOC_COVER_LEAD_ADJ]
.          nr #DOC_COVER_LEAD \\n[#LEAD]
.       \}
.       PRINT \&
.       sp |\\n[#DOC_COVER_START_POS]u-1v
.       if \\n[#DOC_COVER_COLOR]=1 \{\
.          nf
\m[\\*[$DOC_COVER_COLOR]]
.          EOL
.       \}
.       CENTER
.       FAMILY  \\*[$DOC_COVER_TITLE_FAM]
.       FT      \\*[$DOC_COVER_TITLE_FT]
.       PT_SIZE \\*[$DOC_COVER_TITLE_PT_SIZE]
.       LS      \\n[#DOC_COVER_LEAD]u
.       if \\n[#PRINT_STYLE]=1 \{ .TYPEWRITER \}
.       if \\n[#DOC_COVER_TITLE]=1 \{\
.          ie \\n[#PRINT_STYLE]=1 \{\
.             CAPS
.             UNDERSCORE "\\*[$TITLE]"
.             CAPS OFF
.          \}
.          el \{\
.             ie \\n[#DOC_COVER_TITLE_COLOR]=1 \{\
.                PRINT \m[\\*[$DOC_COVER_TITLE_COLOR]]\\*[$TITLE]\m[]
.             \}
.             el \{ .PRINT \\*[$TITLE] \}
.          \}
.       \}
.       if \\n[#DOC_COVER_TITLE]=2 \{\
.          ie \\n[#PRINT_STYLE]=1 \{\
.             CAPS
.             UNDERSCORE "\\*[$DOC_TITLE]"
.             CAPS OFF
.          \}
.          el \{\
.             ie \\n[#DOC_COVER_TITLE_COLOR]=1 \{\
.                PRINT \m[\\*[$DOC_COVER_TITLE_COLOR]]\\*[$DOC_TITLE]\m[]
.             \}
.             el \{ .PRINT \\*[$DOC_TITLE] \}
.          \}
.       \}
.       if \\n[#DOC_COVER_TITLE]=3 \{\
.          ie \\n[#PRINT_STYLE]=1 \{\
.             CAPS
.             PRINT \\*[$CHAPTER_STRING] \\*[$CHAPTER]
.             CAPS OFF
.          \}
.          el \{\
.             ie \\n[#DOC_COVER_TITLE_COLOR]=1 \{\
.                PRINT \m[\\*[$DOC_COVER_TITLE_COLOR]]\\*[$CHAPTER_STRING] \\*[$CHAPTER]\m[]
.             \}
.             el \{ .PRINT \\*[$CHAPTER_STRING] \\*[$CHAPTER] \}
.          \}
.       \}
.       if \\n[#DOC_COVER_TITLE]=4 \{\
.          ie \\n[#PRINT_STYLE]=1 \{\
.             CAPS
.             UNDERSCORE "\\*[$CHAPTER_TITLE]"
.             CAPS OFF
.          \}
.          el \{\
.             ie \\n[#DOC_COVER_TITLE_COLOR]=1 \{\
.                PRINT \m[\\*[$DOC_COVER_TITLE_COLOR]]\\*[$CHAPTER_TITLE]\m[]
.             \}
.             el \{ .PRINT \\*[$CHAPTER_TITLE] \}
.          \}
.       \}
.       if \\n[#DOC_COVER_TITLE]=5 \{\
.          ie \\n[#PRINT_STYLE]=1 \{\
.             CAPS
.             PRINT \\*[$CHAPTER_STRING] \\*[$CHAPTER]
.             CAPS OFF
.          \}
.          el \{\
.             ie \\n[#DOC_COVER_TITLE_COLOR]=1 \{\
.                PRINT \m[\\*[$DOC_COVER_TITLE_COLOR]]\\*[$CHAPTER_STRING] \\*[$CHAPTER]\m[]
.             \}
.             el \{ .PRINT \\*[$CHAPTER_STRING] \\*[$CHAPTER] \}
.          \}
.          if !'\\*[$CHAPTER_TITLE]'' \{\
.             ie \\n[#PRINT_STYLE]=1 \{\
.                UNDERSCORE "\\*[$CHAPTER_TITLE]"
.             \}
.             el \{\
.                FAMILY  \\*[$DOC_COVER_CHAPTER_TITLE_FAM]
.                FT      \\*[$DOC_COVER_CHAPTER_TITLE_FT]
.                PT_SIZE \\*[$DOC_COVER_CHAPTER_TITLE_PT_SIZE]
.                ie \\n[#DOC_COVER_CHAPTER_TITLE_COLOR]=1 \{\
.                   PRINT \m[\\*[$DOC_COVER_CHAPTER_TITLE_COLOR]]\\*[$CHAPTER_TITLE]\m[]
.                \}
.                el \{ .PRINT \\*[$CHAPTER_TITLE] \}
.             \}
.          \}
.       \}
.       if \\n[#DOC_COVER_TITLE]=6 \{\
.          ie \\n[#PRINT_STYLE]=1 \{\
.             CAPS
.             UNDERSCORE "\\*[$DOC_COVER_TITLE]"
.             CAPS OFF
.          \}
.          el \{\
.             ie \\n[#DOC_COVER_TITLE_COLOR]=1 \{\
.                PRINT \m[\\*[$DOC_COVER_TITLE_COLOR]]\\*[$DOC_COVER_TITLE]\m[]
.             \}
.             el \{ .PRINT \\*[$DOC_COVER_TITLE] \}
.          \}
.       \}
.       if \\n[#DOC_COVER_SUBTITLE]=1 \{\
.          FAMILY  \\*[$DOC_COVER_SUBTITLE_FAM]
.          FT      \\*[$DOC_COVER_SUBTITLE_FT]
.          PT_SIZE \\*[$DOC_COVER_SUBTITLE_PT_SIZE]
.          if \\n[#PRINT_STYLE]=1 \{ .TYPEWRITER \}
.          ie \\n[#DOC_COVER_SUBTITLE_COLOR]=1 \{\
.             PRINT \m[\\*[$DOC_COVER_SUBTITLE_COLOR]]\\*[$SUBTITLE]\m[]
.          \}
.          el \{ .PRINT \\*[$SUBTITLE] \}
.       \}
.       if \\n[#PRINT_STYLE]=1 \{\
.          if !r#DOC_COVER_SUBTITLE \{ .SP \}
.       \}
.       if \\n[#DOC_COVER_AUTHOR]=1 \{\
.          FAMILY  \\*[$DOC_COVER_AUTHOR_FAM]
.          FT      \\*[$DOC_COVER_AUTHOR_FT]
.          PT_SIZE \\*[$DOC_COVER_AUTHOR_PT_SIZE]
.          if \\n[#PRINT_STYLE]=1 \{\
.             TYPEWRITER
.             vs \\n[#DOC_LEAD]u/2u
.          \}
.          if !'\\*[$ATTRIBUTE_STRING]'' \{\
.             ie \\n[#DOC_COVER_ATTRIBUTE_COLOR]=1 \{\
.                PRINT \m[\\*[$DOC_COVER_ATTRIBUTE_COLOR]]\\*[$ATTRIBUTE_STRING]\m[]
.             \}
.             el \{ .PRINT \\*[$ATTRIBUTE_STRING] \}
.          \}
.          PRINT_AUTHORS
.       \}
.       FAMILY  \\*[$DOC_COVER_DOCTYPE_FAM]
.       FT      \\*[$DOC_COVER_DOCTYPE_FT]
.       PT_SIZE \\*[$DOC_COVER_DOCTYPE_PT_SIZE]
.       SP
.       if \\n[#DOC_COVER_DOCTYPE]=1 \{\
.          ie \\n[#PRINT_STYLE]=1 \{\
.             TYPEWRITER
.             vs \\n[#DOC_LEAD]u
.             UNDERSCORE2 "\\*[$DOC_TYPE]
.          \}
.          el \{\
.             ie \\n[#DOC_COVER_DOCTYPE_COLOR]=1 \{\
.                COLOR \\*[$DOC_COVER_DOCTYPE_COLOR]
.                UNDERSCORE "\\*[$DOC_TYPE]
.             \}
.             el .UNDERSCORE "\\*[$DOC_TYPE]
.          \}
.       \}
.       sp |\\n[#VISUAL_B_MARGIN]u+\\n[#DOC_LEAD]u
.       ie \\n[#PRINT_STYLE]=1 \{\
.          TYPEWRITER
.          ie \\n[#SINGLE_SPACE]=1 \{ .vs \\n[#DOC_LEAD]u \}
.          el \{ .vs \\n[#DOC_LEAD]u/2u \}
.       \}
.       el \{\
.          FAMILY  \\*[$DOC_COVER_COPYRIGHT_FAM]
.          FT      \\*[$DOC_COVER_COPYRIGHT_FT]
.          AUTOLEAD 2
.          PT_SIZE \\*[$DOC_COVER_COPYRIGHT_PT_SIZE]
.       \}
.       if \\n[#DOC_COVER_COPYRIGHT]=1 \{\
.          QUAD \\*[$DOC_COVER_COPYRIGHT_QUAD]
.          ie \\n[#DOC_COVER_COPYRIGHT_COLOR]=1 \{\
.             PRINT \m[\\*[$DOC_COVER_COPYRIGHT_COLOR]]\\*[$COPYRIGHT]\m[]
.          \}
.          el \{ .PRINT \\*[$COPYRIGHT] \}
.       \}
.       sp |\\n[#VISUAL_B_MARGIN]u+\\n[#DOC_LEAD]u
.       if \\n[#DOC_COVER_MISC]=1 \{\
.          QUAD \\*[$DOC_COVER_MISC_QUAD]
.          nr #MISCS \\n[#MISC_NUM]
.          sp -\\n[#MISCS]+1
.          nr #NEXT_MISC 0 1
.          while \\n[#MISCS]>\\n[#NEXT_MISC] \{\
.             ie \\n[#DOC_COVER_MISC_COLOR]=1 \{\
.                PRINT \m[\\*[$DOC_COVER_MISC_COLOR]]\\*[$MISC_\\n+[#NEXT_MISC]]\m[]
.                br
.             \}
.             el \{\
.                PRINT \\*[$MISC_\\n+[#NEXT_MISC]]
.                br
.             \}
.\}
.       \}
.    \}
.\" Cover
.    el \{\
.       if !r#COVER_START_POS \{\
.          nr #COVER_START_POS \\n[#PAGE_LENGTH]/3
.       \}
.       if \\n[#PRINT_STYLE]=1 \{\
.          ie \\n[#SINGLE_SPACE]=1 \{ .vs \\n[#DOC_LEAD]u*2u \}
.          el \{ .vs \\n[#DOC_LEAD]u \}
.       \}
.       if \\n[#PRINT_STYLE]=2 \{\
.          LS \\n[#DOC_LEAD]u\\*[$COVER_LEAD_ADJ]
.          nr #COVER_LEAD \\n[#LEAD]
.       \}
.       PRINT \&
.       sp |\\n[#COVER_START_POS]u-1v
.       if \\n[#COVER_COLOR]=1 \{\
.          nf
\m[\\*[$COVER_COLOR]]
.          EOL
.       \}
.       CENTER
.       FAMILY  \\*[$COVER_TITLE_FAM]
.       FT      \\*[$COVER_TITLE_FT]
.       PT_SIZE \\*[$COVER_TITLE_PT_SIZE]
.       LS      \\n[#COVER_LEAD]u
.       if \\n[#PRINT_STYLE]=1 \{ .TYPEWRITER \}
.       if \\n[#COVER_TITLE]=1 \{\
.          ie \\n[#PRINT_STYLE]=1 \{\
.             CAPS
.             UNDERSCORE "\\*[$TITLE]"
.             CAPS OFF
.          \}
.          el \{\
.             ie \\n[#COVER_TITLE_COLOR]=1 \{\
.                PRINT \m[\\*[$COVER_TITLE_COLOR]]\\*[$TITLE]\m[]
.             \}
.             el \{ .PRINT \\*[$TITLE] \}
.          \}
.       \}
.       if \\n[#COVER_TITLE]=2 \{\
.          ie \\n[#PRINT_STYLE]=1 \{\
.             CAPS
.             UNDERSCORE "\\*[$DOC_TITLE]"
.             CAPS OFF
.          \}
.          el \{\
.             ie \\n[#COVER_TITLE_COLOR]=1 \{\
.                PRINT \m[\\*[$COVER_TITLE_COLOR]]\\*[$DOC_TITLE]\m[]
.             \}
.             el \{ .PRINT \\*[$DOC_TITLE] \}
.          \}
.       \}
.       if \\n[#COVER_TITLE]=3 \{\
.          ie \\n[#PRINT_STYLE]=1 \{\
.             CAPS
.             PRINT \\*[$CHAPTER_STRING] \\*[$CHAPTER]
.             CAPS OFF
.          \}
.          el \{\
.             ie \\n[#COVER_TITLE_COLOR]=1 \{\
.                PRINT \m[\\*[$COVER_TITLE_COLOR]]\\*[$CHAPTER_STRING] \\*[$CHAPTER]\m[]
.             \}
.             el \{ .PRINT \\*[$CHAPTER_STRING] \\*[$CHAPTER] \}
.          \}
.       \}
.       if \\n[#COVER_TITLE]=4 \{\
.          ie \\n[#PRINT_STYLE]=1 \{\
.             CAPS
.             UNDERSCORE "\\*[$CHAPTER_TITLE]"
.             CAPS OFF
.          \}
.          el \{\
.             ie \\n[#COVER_TITLE_COLOR]=1 \{\
.                PRINT \m[\\*[$COVER_TITLE_COLOR]]\\*[$CHAPTER_TITLE]\m[]
.             \}
.             el \{ .PRINT \\*[$CHAPTER_TITLE] \}
.          \}
.       \}
.       if \\n[#COVER_TITLE]=5 \{\
.          ie \\n[#PRINT_STYLE]=1 \{\
.             CAPS
.             PRINT \\*[$CHAPTER_STRING] \\*[$CHAPTER]
.             CAPS OFF
.          \}
.          el \{\
.             ie \\n[#COVER_TITLE_COLOR]=1 \{\
.                PRINT \m[\\*[$COVER_TITLE_COLOR]]\\*[$CHAPTER_STRING] \\*[$CHAPTER]\m[]
.             \}
.             el \{ .PRINT \\*[$CHAPTER_STRING] \\*[$CHAPTER] \}
.          \}
.          if !'\\*[$CHAPTER_TITLE]'' \{\
.             ie \\n[#PRINT_STYLE]=1 \{\
.                UNDERSCORE "\\*[$CHAPTER_TITLE]"
.             \}
.             el \{\
.                FAMILY  \\*[$COVER_CHAPTER_TITLE_FAM]
.                FT      \\*[$COVER_CHAPTER_TITLE_FT]
.                PT_SIZE \\*[$COVER_CHAPTER_TITLE_PT_SIZE]
.                ie \\n[#COVER_CHAPTER_TITLE_COLOR]=1 \{\
.                   PRINT \m[\\*[$COVER_CHAPTER_TITLE_COLOR]]\\*[$CHAPTER_TITLE]\m[]
.                \}
.                el \{ .PRINT \\*[$CHAPTER_TITLE] \}
.             \}
.          \}
.       \}
.       if \\n[#COVER_TITLE]=6 \{\
.          ie \\n[#PRINT_STYLE]=1 \{\
.             CAPS
.             UNDERSCORE "\\*[$COVER_TITLE]"
.             CAPS OFF
.          \}
.          el \{\
.             ie \\n[#COVER_TITLE_COLOR]=1 \{\
.                PRINT \m[\\*[$COVER_TITLE_COLOR]]\\*[$COVER_TITLE]\m[]
.             \}
.             el \{ .PRINT \\*[$COVER_TITLE] \}
.          \}
.       \}
.       if \\n[#COVER_SUBTITLE]=1 \{\
.          FAMILY  \\*[$COVER_SUBTITLE_FAM]
.          FT      \\*[$COVER_SUBTITLE_FT]
.          PT_SIZE \\*[$COVER_SUBTITLE_PT_SIZE]
.          if \\n[#PRINT_STYLE]=1 \{ .TYPEWRITER \}
.          ie \\n[#COVER_SUBTITLE_COLOR]=1 \{\
.             PRINT \m[\\*[$COVER_SUBTITLE_COLOR]]\\*[$SUBTITLE]\m[]
.          \}
.          el \{ .PRINT \\*[$SUBTITLE] \}
.       \}
.       if \\n[#PRINT_STYLE]=1 \{\
.          if !r#COVER_SUBTITLE \{ .SP \}
.       \}
.       if \\n[#COVER_AUTHOR]=1 \{\
.          FAMILY  \\*[$COVER_AUTHOR_FAM]
.          FT      \\*[$COVER_AUTHOR_FT]
.          PT_SIZE \\*[$COVER_AUTHOR_PT_SIZE]
.          if \\n[#PRINT_STYLE]=1 \{\
.             TYPEWRITER
.             vs \\n[#DOC_LEAD]u/2u
.          \}
.          if !'\\*[$ATTRIBUTE_STRING]'' \{\
.             ie \\n[#COVER_ATTRIBUTE_COLOR]=1 \{\
.                PRINT \m[\\*[$COVER_ATTRIBUTE_COLOR]]\\*[$ATTRIBUTE_STRING]\m[]
.             \}
.             el \{ .PRINT \\*[$ATTRIBUTE_STRING] \}
.          \}
.          PRINT_AUTHORS
.       \}
.       FAMILY  \\*[$COVER_DOCTYPE_FAM]
.       FT      \\*[$COVER_DOCTYPE_FT]
.       PT_SIZE \\*[$COVER_DOCTYPE_PT_SIZE]
.       SP
.       if \\n[#COVER_DOCTYPE]=1 \{\
.          ie \\n[#PRINT_STYLE]=1 \{\
.             TYPEWRITER
.             vs \\n[#DOC_LEAD]u
.             UNDERSCORE2 "\\*[$DOC_TYPE]
.          \}
.          el \{\
.             ie \\n[#COVER_DOCTYPE_COLOR]=1 \{\
.                COLOR \\*[$COVER_DOCTYPE_COLOR]
.                UNDERSCORE "\\*[$DOC_TYPE]
.             \}
.             el .UNDERSCORE "\\*[$DOC_TYPE]
.          \}
.       \}
.       sp |\\n[#VISUAL_B_MARGIN]u+\\n[#DOC_LEAD]u
.       ie \\n[#PRINT_STYLE]=1 \{\
.          TYPEWRITER
.          ie \\n[#SINGLE_SPACE]=1 \{ .vs \\n[#DOC_LEAD]u \}
.          el \{ .vs \\n[#DOC_LEAD]u/2u \}
.       \}
.       el \{\
.          FAMILY  \\*[$COVER_COPYRIGHT_FAM]
.          FT      \\*[$COVER_COPYRIGHT_FT]
.          AUTOLEAD 2
.          PT_SIZE \\*[$COVER_COPYRIGHT_PT_SIZE]
.       \}
.       if \\n[#COVER_COPYRIGHT]=1 \{\
.          QUAD \\*[$COVER_COPYRIGHT_QUAD]
.          ie \\n[#COVER_COPYRIGHT_COLOR]=1 \{\
.             PRINT \m[\\*[$COVER_COPYRIGHT_COLOR]]\\*[$COPYRIGHT]\m[]
.          \}
.          el \{ .PRINT \\*[$COPYRIGHT] \}
.       \}
.       sp |\\n[#VISUAL_B_MARGIN]u+\\n[#DOC_LEAD]u
.       if \\n[#COVER_MISC]=1 \{\
.          QUAD \\*[$COVER_MISC_QUAD]
.          nr #MISCS \\n[#MISC_NUM]
.          sp -\\n[#MISCS]+1
.          nr #NEXT_MISC 0 1
.          while \\n[#MISCS]>\\n[#NEXT_MISC] \{\
.             ie \\n[#COVER_MISC_COLOR]=1 \{\
.                PRINT \m[\\*[$COVER_MISC_COLOR]]\\*[$MISC_\\n+[#NEXT_MISC]]\m[]
.                br
.             \}
.             el \{\
.                PRINT \\*[$MISC_\\n+[#NEXT_MISC]]
.                br
.             \}
.\}
.       \}
.    \}
.    EOL
.    TRAP
.    NEWPAGE
.    ev
.    if \\n[#PAGINATION_WAS_ON] \{\
.       rr #PAGINATION_WAS_ON
.       PAGINATE
.       PAGENUMBER \\n%+\\n[#PAGE_NUM_ADJ]-1
.    \}
.    if \\n[#HEADERS_WERE_ON] \{\
.       rr #HEADERS_WERE_ON
.       HEADERS
.    \}
.    if \\n[#FOOTERS_WERE_ON] \{\
.       rr #FOOTERS_WERE_ON
.       FOOTERS
.    \}
.    if \\n[#COLUMNS_WERE_ON]=1 \{\
.       rr #COLUMNS_WERE_ON 1
.       nr #COLUMNS 1
.    \}
.    rr #DOING_COVER
.END
\#
\#
.MAC START END
.    if !\\n[#PRINT_STYLE] \{\
.       PRINTSTYLE TYPEWRITE
.       PRINT \&
.       po 6P
.       ll 39P
.       ta \\n(.lu
.       sp |1i-1v
.       CENTER
.       PRINT "You neglected to enter a PRINTSTYLE"
.       fl
.       ab PRINTSTYLE missing
.    \}
.    nr #DOCS 1
.    if \\n[#LINENUMBERS]=1 \{\
.       NUMBER_LINES OFF
.       nr #LINENUMBERS 2
.    \}
.    if \\n[#COLLATE] \{\
.       COPYSTYLE \\*[$COPY_STYLE]
.       nr #HEADERS_ON \\n[#HEADER_STATE]
.       if \\n[#PAGE_NUM_V_POS]=1 \{ .nr #PAGINATE \\n[#PAGINATION_STATE] \}
.       sp |\\n[#HEADER_MARGIN]u
.       PRINT \&
.       if !'\\*[$RESTORE_PAGENUM_STYLE]'' \{\
.          PAGENUM_STYLE \\*[$RESTORE_PAGENUM_STYLE]
.          rm $RESTORE_PAGENUM_STYLE
.       \}
.    \}
.    DEFAULTS
.\" Quote and blockquote default leads are the same as #DOC_LEAD, so
.\" they have to be set after DEFAULTS (where DOC_LEAD is finalized)
.    if !r#Q_AUTOLEAD     \{ .nr #Q_LEAD \\n[#DOC_LEAD]    \}
.    if !r#BQ_AUTOLEAD    \{ .nr #BQ_LEAD \\n[#DOC_LEAD]   \}
.    if !r#EN_Q_AUTOLEAD  \{ .nr #EN_Q_LEAD \\n[#EN_LEAD]  \}
.    if !r#EN_BQ_AUTOLEAD \{ .nr #EN_BQ_LEAD \\n[#EN_LEAD] \}
.\" Covers and doc covers
.    if \\n[#DOC_COVERS]=1 \{\
.       if \\n[#DOC_COVER]=1 \{\
.          DO_DOC_COVER
.          rr #DOC_COVER
.          rr #DOC_COVER_TITLE
.          rr #DOC_COVER_SUBTITLE
.          rr #DOC_COVER_AUTHOR
.          rr #DOC_COVER_DOCTYPE
.          rr #DOC_COVER_COPYRIGHT
.          rr #DOC_COVER_MISC
.       \}
.    \}
.    if \\n[#COVERS]=1 \{\
.       if \\n[#COVER]=1 \{\
.          DO_COVER
.          rr #COVER
.          rr #COVER_TITLE
.          rr #COVER_SUBTITLE
.          rr #COVER_AUTHOR
.          rr #COVER_DOCTYPE
.          rr #COVER_COPYRIGHT
.          rr #COVER_MISC
.       \}
.    \}
.\" Collate related stuff
.    ie \\n[#COLLATED_DOC]=1 \{\
.\" Collect TITLE for TOC.
.       nr #TOC_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
.       af #TOC_ENTRY_PN \\g[#PAGENUMBER]
.       ie \\n[#USER_SET_TITLE_ITEM] \{\
.          ds $TOC_TITLE_ITEM \\*[$USER_SET_TITLE_ITEM]\\|
.          rr #USER_SET_TITLE_ITEM
.          rm $USER_SET_TITLE_ITEM
.       \}
.       el \{\
.          ie \\n[#DOC_TYPE]=2 \{\
.             ie '\\*[$CHAPTER_TITLE]'' \{\
.                ds $TOC_TITLE_ITEM \\*[$CHAPTER_STRING] \\*[$CHAPTER]\\|
.             \}
.             el \{\
.                ie '\\*[$CHAPTER]'' \{\
.                   ds $TOC_TITLE_ITEM \\*[$CHAPTER_TITLE]\\|
.                \}
.                el \{\
.                   ds $TOC_TITLE_ITEM \\*[$CHAPTER_STRING] \\*[$CHAPTER]: \\*[$CHAPTER_TITLE]\\|
.                \}
.             \}
.          \}
.          el \{\
.             ds $TOC_TITLE_ITEM \\*[$TITLE]\\|
.          \}
.       \}
.       if \\n[#TOC_AUTHORS]=1 \{\
.          ie '\\*[$TOC_AUTHORS]'' \{\
.             as $TOC_TITLE_ITEM /\\|\\*[$AUTHOR_1]\\|
.          \}
.          el \{\
.             as $TOC_TITLE_ITEM /\\|\\*[$TOC_AUTHORS]\\|
.             rm $TOC_AUTHORS
.          \}
.       \}
.\" Note the use of \!, which transparently embeds the macros used
.\" in the TOC_ENTRIES diversion.  The elements they control must be
.\" processed literally when the diversion is output.
.       ev TOC_EV
.       da TOC_ENTRIES
.       if \\n[#PRINT_STYLE]=1 \{\
\!.        fam C
\!.        ft  R
\!.        ps  12
.       \}
.       if \\n[#PRINT_STYLE]=2 \{\
\!.        FAMILY  \\*[$TOC_TITLE_FAM]
\!.        FT      \\*[$TOC_TITLE_FT]
\!.        PT_SIZE \\n[#TOC_PS]u\\*[$TOC_TITLE_SIZE_CHANGE]
.       \}
\!.     TRAP OFF
.       ie \\n[#PRINT_STYLE]=1 \{\
\!.        PAD "\\*[$TOC_TITLE_ITEM]\\*[$TOC_PN_TYPEWRITE]" 
.       \}
.       el \{\
\!.        PAD "\\h'\\n[#TOC_TITLE_INDENT]u'\\*[$TOC_TITLE_ITEM]\\*[$TOC_PN]"
.       \}
\!.    EOL
\!.    ST 100 L
\!.    ST 101 R
.      if \\n[#PRINT_STYLE]=2 \{\
\!.       FAMILY  \\*[$TOC_PN_FAM]
\!.       FT      \\*[$TOC_PN_FT]
\!.       PT_SIZE \\n[#TOC_PS]u\\*[$TOC_PN_SIZE_CHANGE]
.      \}
\!.    TAB 100
\!.    PRINT \\*[LEADER]
\!.    TN
\!.    TRAP
\!.    PRINT \\n[#TOC_ENTRY_PN]
\!.    TQ
.      di       
.      ev
.    \}
.    el \{\
.       nr #FIRST_DOC_TITLE_PN \\n%+\\n[#PAGE_NUM_ADJ]
.       af #FIRST_DOC_TITLE_PN \\g[#PAGENUMBER]
.       nr #FIRST_DOC_TOC_PN_PADDING \\n[#TOC_PN_PADDING]
.    \}
.\" End TITLE collection
.    if \\n[#PRINT_PAGENUM_ON_PAGE_1] \{\
.       sp |\\n[#HEADER_MARGIN]u
.       PRINT_PAGE_NUMBER
.    \}
.    rr #COLLATE
.    rr #PAGINATION_STATE
.\" End collate stuff
.    ie \\n[#DOC_HEADER]=0 \{\
.       PRINT \&
.       if \\n[#DOC_TYPE]=4 \{\
.          if !'\\n(.z'' \{ .di \}
.       \}
.       nr #STORED_PP_INDENT \\n[#PP_INDENT]
.       PARA_INDENT 0
.       PP
.       PARA_INDENT \\n[#STORED_PP_INDENT]u
.       rr #STORED_PP_INDENT
.       ie r#ADVANCE_FROM_TOP \{\
.          sp |\\n[#ADVANCE_FROM_TOP]u-1v
.          if \\n[#ADJ_DOC_LEAD]=1 \{ .SHIM \}
.       \}
.       el \{ .sp |\\n[#T_MARGIN]u-1v \}
.       if \\n[#COLUMNS] \{\
.          mk dc
.          nr #COL_NUM 0 1
.          po \\n[#COL_\\n+[#COL_NUM]_L_MARGIN]u
.          nr #L_MARGIN \\n(.o
.          ll \\n[#COL_L_LENGTH]u
.       \}
.       nr #PP 0
.       rr #DOC_HEADER
.       if r#ADVANCE_FROM_TOP \{ .rr #ADVANCE_FROM_TOP \}
.    \}
.    el \{\
.       if \\n[#PRINT_STYLE]=2 \{ .LS \\n[#DOC_LEAD]u\\*[$DOCHEADER_LEAD_ADJ] \}
.       nr #DOCHEADER_LEAD \\n[#LEAD]
.\" Default
.       if \\n[#DOC_TYPE]=1 \{\
.          PRINT \&
.          sp |\\n[#DOCHEADER_ADVANCE]u-1v
.          ev DOCHEADER
.          if \\n[#DOCHEADER_COLOR]=1 \{\
.             nf
\m[\\*[$DOCHEADER_COLOR]]
.             EOL
.          \}
.          L_MARGIN \\n[#DOC_L_MARGIN]u
.          LL       \\n[#DOC_L_LENGTH]u
.          ta \\n(.lu
.          if \\n[#PRINT_STYLE]=1 \{\
.             CENTER
.             TYPEWRITER
.             ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u*2u \}
.             el \{ .vs \\n[#DOC_LEAD]u \}
.             CAPS
.             if !'\\*[$TITLE]'' \{ .UNDERSCORE "\\*[$TITLE]\}
.             CAPS OFF
.             if !'\\*[$SUBTITLE]'' \{\
.                ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u*2u \}
.                el \{ .vs \\n[#DOC_LEAD]u \}
.             PRINT \\*[$SUBTITLE]
.             \}
.             if '\\*[$SUBTITLE]'' \{\
.                ALD \\n[#DOC_LEAD]u
.             \}
.             ie !'\\*[$AUTHOR_1]'' \{\
.                ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u \}
.                el \{ .vs \\n[#DOC_LEAD]u/2u \}
.                if !d$SUBTITLE \{\
.                   ie \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
.                   el \{ .ALD \\n[#DOC_LEAD]u*2u \}
.                \}
.                PRINT \\*[$ATTRIBUTE_STRING]
.                nr #AUTHORS \\n[#AUTHOR_NUM]
.                nr #NEXT_AUTHOR 0 1
.                while \\n[#AUTHORS]>\\n[#NEXT_AUTHOR] \{\
.                   PRINT \\*[$AUTHOR_\\n+[#NEXT_AUTHOR]]
.\}
.                if \\n[#AUTHOR_LINES]=1 \{\
.                    ie \\n[#SINGLE_SPACE] \{ .RLD \\n[#DOC_LEAD]u \}
.                    el \{ .ALD \\n[#DOC_LEAD]u/2u \}
.                \}
.             \}
.             el \{\
.                ie !d$SUBTITLE \{\
.                   ie \\n[#SINGLE_SPACE] \{ .RLD \\n[#DOC_LEAD]u*2u \}
.                   el \{ .RLD \\n[#DOC_LEAD]u \}
.                \}
.                el \{\
.                   ie \\n[#SINGLE_SPACE] \{ .RLD \\n[#DOC_LEAD]u*2u \}
.                   el \{ .ALD \\n[#DOC_LEAD]u \}
.                \}
.             \}
.          \}
.          if \\n[#PRINT_STYLE]=2 \{\
.             DEFAULT_DOCHEADER
.             di DOCHEADER_DIVERSION \" This diversion is only
.             br                     \" necessary to find the depth of the
.             DEFAULT_DOCHEADER      \" docheader
.             br
.             di
.             nr #DOCHEADER_DEPTH \\n(dn-\\n[#DOCHEADER_LEAD] \"Storing the depth (height) of the diversion
.                                                             \"in #DOCHEADER_DEPTH
.             rm DOCHEADER_DIVERSION                          \" Removing the diversion macro
.          \}
.          ev
.       \}
.\" Chapter
.       if \\n[#DOC_TYPE]=2 \{\
.          PRINT \&
.          sp |\\n[#DOCHEADER_ADVANCE]u-1v
.          ev DOCHEADER
.          if \\n[#DOCHEADER_COLOR]=1 \{\
.             nf
\m[\\*[$DOCHEADER_COLOR]]
.             EOL
.          \}
.          L_MARGIN \\n[#DOC_L_MARGIN]u
.          LL       \\n[#DOC_L_LENGTH]u
.          ta \\n(.lu
.          if \\n[#PRINT_STYLE]=1 \{\
.             CENTER
.             TYPEWRITER
.             vs \\n[#DOC_LEAD]u
.             ie '\\*[$CHAPTER]'' \{\
.                CAPS
.                ie !'\\*[$CHAPTER_TITLE]'' \{\
.                   PRINT \\*[$CHAPTER_TITLE]
.                \}
.                el \{\
.                   CAPS
.                   PRINT \\*[$CHAPTER_STRING]
.                \}
.                CAPS OFF
.             \}
.             el \{\
.                CAPS
.                PRINT \\*[$CHAPTER_STRING] \\*[$CHAPTER]
.                CAPS OFF
.                if !'\\*[$CHAPTER_TITLE]'' \{\
.                   if \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
.                   UNDERSCORE "\\*[$CHAPTER_TITLE]
.                \}
.             \}
.             if \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
.          \}
.          if \\n[#PRINT_STYLE]=2 \{\
.             CHAPTER_DOCHEADER
.             di DOCHEADER_DIVERSION \" This diversion is only
.             br                     \" necessary to find the depth of the
.             CHAPTER_DOCHEADER      \" docheader
.             br
.             di
.             nr #DOCHEADER_DEPTH \\n(dn-\\n[#DOCHEADER_LEAD] \" Storing the depth (height) of the diversion
.                                                             \" in #DOCHEADER_DEPTH
.             rm DOCHEADER_DIVERSION                          \" Removing the diversion macro
.          \}
.          ev
.       \}
.\" Named
.       if \\n[#DOC_TYPE]=3 \{\
.          PRINT \&
.          sp |\\n[#DOCHEADER_ADVANCE]u-1v
.          ev DOCHEADER
.          if \\n[#DOCHEADER_COLOR]=1 \{\
.             nf
\m[\\*[$DOCHEADER_COLOR]]
.             EOL
.          \}
.          L_MARGIN \\n[#DOC_L_MARGIN]u
.          LL       \\n[#DOC_L_LENGTH]u
.          ta \\n(.lu
.          if \\n[#PRINT_STYLE]=1 \{\
.             CENTER
.             TYPEWRITER
.             ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u*2u \}
.             el \{ .vs \\n[#DOC_LEAD]u \}
.             CAPS
.             if !'\\*[$TITLE]'' \{ .UNDERSCORE "\\*[$TITLE]\}
.             CAPS OFF
.             if !'\\*[$SUBTITLE]'' \{\
.                ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u*2u \}
.                el \{ .vs \\n[#DOC_LEAD]u \}
.                PRINT \\*[$SUBTITLE]
.             \}
.             if '\\*[$SUBTITLE]'' \{\
.                ALD \\n[#DOC_LEAD]u
.             \}
.             ie !'\\*[$AUTHOR_1]'' \{\
.                ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u \}
.                el \{ .vs \\n[#DOC_LEAD]u/2u \}
.                if !d$SUBTITLE \{\
.                   ie \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
.                   el \{ .ALD \\n[#DOC_LEAD]u*2u \}
.                \}
.                PRINT \\*[$ATTRIBUTE_STRING]
.                nr #AUTHORS \\n[#AUTHOR_NUM]
.                nr #NEXT_AUTHOR 0 1
.                while \\n[#AUTHORS]>\\n[#NEXT_AUTHOR] \{\
.                   PRINT \\*[$AUTHOR_\\n+[#NEXT_AUTHOR]]
.\}
.                if \\n[#AUTHOR_LINES]=1 \{\
.                    ie \\n[#SINGLE_SPACE] \{ .RLD \\n[#DOC_LEAD]u \}
.                    el \{ .ALD \\n[#DOC_LEAD]u/2u \}
.                 \}
.             vs  \\n[#DOC_LEAD]u
.             \}
.             el \{\
.                ie !d$SUBTITLE \{\
.                   ie \\n[#SINGLE_SPACE] \{ .RLD \\n[#DOC_LEAD]u*2u \}
.                   el \{ .RLD \\n[#DOC_LEAD]u \}
.                \}
.                el \{\
.                   ie \\n[#SINGLE_SPACE] \{ . \}
.                   el \{ .RLD \\n[#DOC_LEAD]u \}
.                \}
.             \}
.             ie \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u*2u \}
.             el \{ .ALD \\n[#DOC_LEAD]u \}
.             UNDERSCORE2 "\\*[$DOC_TYPE]
.             if \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
.          \}
.          if \\n[#PRINT_STYLE]=2 \{\
.             NAMED_DOCHEADER
.             di DOCHEADER_DIVERSION \" This diversion is only
.             br                     \" necessary to find the depth of the
.             NAMED_DOCHEADER        \" docheader
.             br
.             di
.             nr #DOCHEADER_DEPTH \\n(dn-\\n[#DOCHEADER_LEAD] \"Storing the depth (height) of the diversion
.                                                             \"in #DOCHEADER_DEPTH
.             rm DOCHEADER_DIVERSION                          \" Removing the diversion macro
.          \}
.          ev
.       \}
.       if !\\n[#DOC_TYPE]=4 \{\
.          if \\n[#PRINT_STYLE]=1 \{ .ALD \\n[#DOC_LEAD]u \}
.          nr #DOCHEADER_SPACE_ADJ \\n[#DOCHEADER_DEPTH]%\\n[#DOC_LEAD]
.          ie !\\n[#DOCHEADER_SPACE_ADJ]=0 \{ .nr #DOCHEADER_EXTRA_SPACE \\n[#DOC_LEAD]-\\n[#DOCHEADER_SPACE_ADJ] \}
.          el \{ .nr #DOCHEADER_EXTRA_SPACE 0 \}
.          if \\n[#PRINT_STYLE]=2 \{ .ALD (\\n[#DOC_LEAD]u*2u)+\\n[#DOCHEADER_EXTRA_SPACE]u \}
.          if \\n[#COLUMNS] \{\
.             nr #COL_NUM 0 1
.             nr #L_LENGTH_FOR_EPI \\n[#L_LENGTH]
.             po \\n[#COL_\\n+[#COL_NUM]_L_MARGIN]u
.             nr #L_MARGIN \\n(.o
.             LL \\n[#COL_L_LENGTH]u
.             ta \\n(.lu
.             mk dc
.          \}
.       \}
.    \}
.    LS \\n[#DOC_LEAD]u
.    if \\n[#ADJ_DOC_LEAD]=1 \{ .SHIM \}
.    QUAD \\*[$DOC_QUAD]
.    CLEANUP_DEFAULTS
.    nr #START_FOR_FOOTERS 1
.    if \\n[#COLLATED_DOC]=1 \{\
.       if !\\n[MNinit_DEFERRED]=1 \{\
.          MN_INIT rerun
.       \}
.    \}
.    if \\n[#MNinit_DEFERRED]=1 \{\
.       rr #MNinit_DEFERRED
.       nr #START_FOR_MNinit 1
.       MN_INIT \\*[$MN-arg1] \\*[$MN-arg2] \\*[$MN-arg3] \\*[$MN-arg4] \\*[$MN-arg5] \\*[$MN-arg6] \\*[$MN-arg7] \\*[$MN-arg8] \\*[$MN-arg9]
.    \}
.    nr #START_FOR_MNinit 2
.    if !\\n[#DOC_TYPE]=4 \{ .em TERMINATE \}
.    if \\n[#LINENUMBERS]=2 \{\
.       NUMBER_LINES RESUME
.       nr #LINENUMBERS 1
.    \}
.    if \\n[#RUN_ON]=1 \{\
.       if \\n[#FN_MARKER_STYLE]=1 \{ .RUNON_WARNING \}
.       if \\n[#FN_MARKER_STYLE]=2 \{ .RUNON_WARNING \}
.    \}
.END
\#
.MAC CLEANUP_DEFAULTS END
.    nr #START 1
.\" Family strings for docheader
.    rm $AUTHOR_FAM
.    rm $CHAPTER_TITLE_FAM
.    rm $DOCTYPE_FAM
.    rm $SUBTITLE_FAM
.    rm $TITLE_FAM
.\" Family strings for cover
.    rm $COVER_AUTHOR_FAM
.    rm $COVER_CHAPTER_TITLE_FAM
.    rm $COVER_COPYRIGHT_FAM
.    rm $COVER_DOCTYPE_FAM
.    rm $COVER_LEAD_ADJ
.    rm $COVER_SUBTITLE_FAM
.    rm $COVER_TITLE_FAM
.\" Family strings for doc cover
.    rm $DOC_COVER_AUTHOR_FAM
.    rm $DOC_COVER_CHAPTER_TITLE_FAM
.    rm $DOC_COVER_COPYRIGHT_FAM
.    rm $DOC_COVER_DOCTYPE_FAM
.    rm $DOC_COVER_LEAD_ADJ
.    rm $DOC_COVER_SUBTITLE_FAM
.    rm $DOC_COVER_TITLE_FAM
.\" Quad args to copyright and misc
.    rm $COVER_COPYRIGHT_QUAD
.    rm $COVER_MISC_QUAD
.    rm $DOC_COVER_COPYRIGHT_QUAD
.    rm $DOC_COVER_MISC_QUAD
.\" Miscellaneous strings
.    rm $TOC_TITLE_ITEM
.    rm $DOCHEADER_LEAD_ADJ
.\" Various registers
.    rr #ADJ_DOC_LEAD
.    rr #ADVANCE_FROM_TOP
.    rr #AUTHOR_NUM
.    rr #AUTHORS
.    rr #COVER_LEAD
.    rr #DEPTH_1
.    rr #DEPTH_2
.    rr #DOC_COVER_LEAD
.    rr #DOCHEADER_ADVANCE
.    rr #DOCHEADER_EXTRA_SPACE
.    rr #DOCHEADER_LEAD
.    rr #DOCHEADER_SPACE_ADJ
.    rr #MISC_NUM
.    rr #MISCS
.    rr #NEXT_AUTHOR
.    rr #NEXT_MISC
.    rr #NUM_AUTHORS
.END
\#
\# ====================================================================
\#
\# +++MACROS TO CHANGE SOME DEFAULTS+++
\#
\# DOCUMENT HEADER
\# ---------------
\# *Argument:
\#   <none> | <anything> [distance to advance from top of page]
\# *Function:
\#   Turns printing of document header on or off.  If a second argument
\#   in units of measure is given, advances that distance from the
\#   top of the page without printing the document header.
\# *Notes:
\#   Default is on.  If the 1st argument is <anything> (which turns
\#   document headers off), the optional 2nd argument may be given
\#   (with a unit of measure).
\#
.MAC DOCHEADER END
.    ie '\\$1'' \{ .nr #DOC_HEADER 1 \}
.    el \{\
.       if !'\\$2'' \{ .nr #ADVANCE_FROM_TOP (\\$2) \}
.       nr #DOC_HEADER 0
.    \}
.END
\#
\#
\# DOCUMENT HEADER LEADING
\# -----------------------
\# *Arguments:
\#   <+|- amount by which to in/decrease leading of doc header>
\# *Function:
\#   Stores user supplied lead in/decrease in string $DOCHEADER_LEAD_ADJ.
\# *Notes:
\#   A unit of measure must be supplied.  Decimal fractions OK.
\#   Default is +0, i.e. same as DOC_LEAD.
\#
.MAC DOCHEADER_LEAD END
.    ds $DOCHEADER_LEAD_ADJ \\$1
.END
\#
\#
\# DOCHEADER ADVANCE
\# -----------------
\# *Arguments:
\#   <docheader start position>
\# *Function:
\#   Creates register #DOCHEADER_ADVANCE, used in START.
\# *Notes:
\#   Unit of measure required.
\#   Default is same as T_MARGIN.
\#
.MAC DOCHEADER_ADVANCE END
.    nr #DOCHEADER_ADVANCE (\\$1)
.END
\#
\#
\# DOCUMENT LEFT MARGIN
\# --------------------
\# *Argument:
\#   <left margin of document>
\# *Function:
\#   Creates or modifies register #DOC_L_MARGIN.
\# *Notes:
\#   Affects EVERYTHING on the page.
\#
.MAC DOC_LEFT_MARGIN END
.    br
.    nr #DOC_L_MARGIN (\\$1)
.    L_MARGIN \\n[#DOC_L_MARGIN]u
.END
\#
\#
\# DOCUMENT RIGHT MARGIN
\# ---------------------
\# *Argument:
\#   <right margin of document>
\# *Function:
\#   Creates or modifies register #DOC_R_MARGIN.
\# *Notes:
\#   Affects EVERYTHING on the page.
\#
.MAC DOC_RIGHT_MARGIN END
.    br
.    nr #DOC_R_MARGIN (\\$1)
.    R_MARGIN \\n[#DOC_R_MARGIN]
.    nr #DOC_L_LENGTH \\n[#L_LENGTH]
.END
\#
\#
\# DOCUMENT LINE LENGTH
\# --------------------
\# *Argument:
\#   <line length of document>
\# *Function:
\#   Creates or modifies string $DOC_L_LENGTH.
\# *Notes:
\#   Affects EVERYTHING on the page.
\#
.MAC DOC_LINE_LENGTH END
.    br
.    nr #DOC_L_LENGTH (\\$1)
.    LL \\n[#DOC_L_LENGTH]u
.    ta \\n(.lu
.END
\#
\#
\# DOCUMENT FAMILY
\# ---------------
\# *Argument:
\#   <family of running text>
\# *Function:
\#   Creates or modifies string $DOC_FAM.
\# *Notes:
\#   Affects everything EXCEPT headers and footers.
\#
.MAC DOC_FAMILY END
.    br
.    ds $DOC_FAM       \\$1
.    ds $FAMILY        \\*[$DOC_FAM]
.    TITLE_FAMILY      \\*[$DOC_FAM]
.    SUBTITLE_FAMILY   \\*[$DOC_FAM]
.    AUTHOR_FAMILY     \\*[$DOC_FAM]
.    DOCTYPE_FAMILY    \\*[$DOC_FAM]
.    HEAD_FAMILY       \\*[$DOC_FAM]
.    SUBHEAD_FAMILY    \\*[$DOC_FAM]
.    QUOTE_FAMILY      \\*[$DOC_FAM]
.    BLOCKQUOTE_FAMILY \\*[$DOC_FAM]
.    EPIGRAPH_FAMILY   \\*[$DOC_FAM]
.    HDRFTR_FAMILY     \\*[$DOC_FAM]
.    FOOTNOTE_FAMILY   \\*[$DOC_FAM]
.END
\#
\#
\# DOCUMENT POINT SIZE
\# -------------------
\# *Argument:
\#   <point size of running text>
\# *Function:
\#   Creates or modifies register #DOC_PT_SIZE.
\# *Notes:
\#   DOC_PT_SIZE is the basis for calculating all type sizes in
\#   a document.
\#
.MAC DOC_PT_SIZE END
.    if \\n[#IGNORE] \{ .return \}
.    br
.    PT_SIZE \\$1
.    nr #DOC_PT_SIZE \\n[#PT_SIZE]
.END
\#
\#
\# DOCUMENT LEAD
\# -------------
\# *Argument:
\#   <lead (".vs") of running text> [ADJUST]
\# *Function:
\#   Creates or modifies register #DOC_LEAD.  If the optional
\#   ADJUST argument is given, adjusts leading so that the last
\#   line of text falls exactly on #B_MARGIN.
\# *Notes:
\#   DOC_LEAD is the basis for calculating all leading changes in
\#   a document.  Default for TYPESET is 16; 24 for TYPEWRITE.
\#
\#   Because the visible bottom or footer margin of a page depends
\#   on the overall document lead supplied by the register #DOC_LEAD,
\#   DOC_LEAD, in the body of a document, should always be associated
\#   with the start of a new page (in other words, just before or
\#   just after a manual NEWPAGE).
\#
.MAC DOC_LEAD END
.    if \\n[#IGNORE] \{ .return \}
.    br
.    vs \\$1
.    nr #DOC_LEAD \\n[#LEAD]
.    if '\\$2'ADJUST' \{ .TRAPS \}
.END
\#
\#
\# ADJUST DOCUMENT LEAD
\# --------------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Adjusts document lead so that the last line of text falls exactly
\#   on #B_MARGIN.
\#
.MAC DOC_LEAD_ADJUST END
.    ie '\\$1'' \{\
.       nr #ADJ_DOC_LEAD 1
.    \}
.    el \{\
.       nr #ADJ_DOC_LEAD 0
.       nr #DOC_LEAD_ADJUST_OFF 1
.    \}
.END
\#
\#
\# SHIM
\# ----
\# *Argument:
\#   None
\# *Function:
\#   Advances to the next "legal" baseline.
\# *Notes:
\#   If a user plays around with spacing in a doc (say, with ALD),
\#   it isn't easy to get mom back on track so she can achieve
\#   perfectly flush bottom margins.  Any time SHIM is used, it
\#   ensures that the next output line falls on a legal baseline.
\#
\# First, a little convenience macro
\#
.MAC PROCESS_SHIM END
.    while \\n+[#LEGAL_BASELINE]<\\n[#CURRENT_V_POS] \{\
.
.\}
.    nr #SHIM \\n[#LEGAL_BASELINE]-\\n[#CURRENT_V_POS]
.END
\#
\#
.MAC SHIM END
.    nr #LEGAL_BASELINE \\n[#T_MARGIN]-1v \\n[#DOC_LEAD]
.    if !r#CURRENT_V_POS \{ .nr #CURRENT_V_POS \\n(.d \}
.    ie r#ADVANCE_FROM_TOP \{\
.       ie \\n[#CURRENT_V_POS]<(\\n[#T_MARGIN]-1v) \{\
.          while \\n-[#LEGAL_BASELINE]>\\n[#CURRENT_V_POS] \{\
.
.\}
.          nr #LEGAL_BASELINE +\\n[#DOC_LEAD]
.          nr #SHIM \\n[#LEGAL_BASELINE]-\\n[#CURRENT_V_POS]
.       \}
.       el \{\
.          PROCESS_SHIM
.       \}
.    \}
.    el \{\
.       PROCESS_SHIM
.    \}
.    ALD \\n[#SHIM]u
.    rr #CURRENT_V_POS
.END
\#
\#
\#
\# ====================================================================
\#
\# +++INTERNATIONALIZATION+++
\#
\# ATTRIBUTE STRING
\# ----------------
\# *Argument:
\#   <what goes in the "by" slot before author in the document header>
\# *Function:
\#   Creates or modifies string $ATTRIBUTE_STRING.
\# *Notes:
\#   Default is "by".  A blank string ("") may be used if no
\#   attribution is desired.
\#
.MAC ATTRIBUTE_STRING END
.    ds $ATTRIBUTE_STRING \\$1
.END
\#
\#
\# CHAPTER STRING
\# --------------
\# *Argument:
\#   <what to print any time the word "chapter" is required>
\# *Function:
\#   Creates or modifies string $CHAPTER_STRING.
\# *Notes:
\#   Default is "chapter".
\#
.MAC CHAPTER_STRING END
.    ds $CHAPTER_STRING \\$1
.END
\#
\#
\# DRAFT STRING
\# ------------
\# *Argument:
\#   <what to print any time the word "draft" is required>
\# *Function:
\#   Creates or modifies string $DRAFT_STRING.
\# *Notes:
\#   Default is "draft".
\#
.MAC DRAFT_STRING END
.    ds $DRAFT_STRING \\$1
.END
\#
\#
\# REVISION STRING
\# ---------------
\# *Argument:
\#   <what to print any time the word "revision" is required>
\# *Function:
\#   Creates or modifies string $REVISION_STRING.
\# *Notes:
\#   Default is "revision".
\#
.MAC REVISION_STRING END
.    ds $REVISION_STRING \\$1
.END
\#
\#
\# FINIS STRING
\# ------------
\# *Argument:
\#   <what to print with the finis macro>
\# *Function:
\#   Creates or modifies string $FINIS_STRING.
\# *Notes:
\#   Default is "END".
\#
.MAC FINIS_STRING END
.    nr #FINIS 1
.    CAPS
.    ds $FINIS_STRING \\$1
.    CAPS OFF
.END
\#
\#
\# ====================================================================
\#
\# +++RECTO/VERSO+++
\#
\# RECTO_VERSO
\# -----------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Switches HDRFTR_LEFT and HDRFTR_RIGHT on alternate pages.  Also
\#   switches page numbers left and right if either is chosen rather
\#   than the default centered page numbers.  Switches left and right
\#   margins if differing values have been entered.
\# *Notes:
\#   Default is OFF.
\#
.MAC RECTO_VERSO END
.    ie '\\$1'' \{ .nr #RECTO_VERSO 1 \}
.    el \{ .nr #RECTO_VERSO 0 \}
.END
\#
\# ====================================================================
\#
\# +++EPIGRAPHS+++
\#
\# EPIGRAPH INDENT
\# ---------------
\# *Argument:
\#   <value by which to multiply PP_INDENT for block epigraphs>
\# *Function:
\#   Creates or modifies register #EPI_OFFSET_VALUE.
\# *Notes:
\#   Default is 2 for TYPEWRITE, 3 for TYPESET.
\#
.MAC EPIGRAPH_INDENT END
.    nr #EPI_OFFSET_VALUE \\$1
.END
\#
\#
\# EPIGRAPH AUTOLEAD
\# -----------------
\# *Argument:
\#   <amount of lead to add to the epigraph ps for epigraph leading>
\# *Function:
\#   Creates or modifies register #EPI_AUTOLEAD.
\# *Notes:
\#   Default is 2 (for TYPESET; TYPEWRITE doesn't require this).
\#
.MAC EPIGRAPH_AUTOLEAD END
.    nr #EPI_AUTOLEAD \\$1
.END
\#
\#
\# EPIGRAPH
\# --------
\# *Arguments:
\#   BLOCK | <anything>
\# *Function:
\#   Places an epigraph before the document's text, after the
\#   document header, or after a HEAD.
\# *Notes:
\#   #EPIGRAPH 1 = centered; 2 = block
\#
\#   By default, epigraphs are centered, allowing the user
\#   to input them on a line per line basis.  To change this
\#   behaviour, the user can supply the argument BLOCK, which
\#   will produce indented, filled text similar to BLOCKQUOTE.
\#
\#   If a block epigraph contains more than one para, ALL paras of
\#   the epigraph must be preceded by PP.  Otherwise, PP is optional.
\#
.MAC EPIGRAPH END
.    nr #PP_STYLE 2
.    nr #Q_PP     0
.    if \\n[#LINENUMBERS]=1 \{\
.       NUMBER_LINES OFF
.       nr #LINENUMBERS 2
.    \}
.    if \\n[#START] \{\
.       if \\n[#PRINT_STYLE]=1 \{\
.          if \\n[#AUTHOR_LINES]=1 \{ .ALD \\n[#DOC_LEAD]u \}
.       \}
.    \}
.    ie '\\$1'' \{\
.       nr #EPIGRAPH 1
.       ev EPIGRAPH
.       nr #IN_DIVER 1
.       ll \\n[#L_LENGTH]u
.       ta \\n(.lu
.       CHECK_INDENT
.       if \\n[#COLUMNS] \{\
.          ie \\n[#START] \{\
.              ll \\n[#DOC_L_LENGTH]u
.              ta \\n(.lu
.          \}
.          el \{\
.             ll \\n[#COL_L_LENGTH]u
.             ta \\n(.lu
.          \}
.       \}
.       CENTER
.       if \\n[#PRINT_STYLE]=1 \{\
.          fam C
.          ft  R
.          if '\\*[$EPI_FT]'I' \{\
.             FT I
.          \}
.          ps  12
.          ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u \}
.          el \{ .vs  \\n[#DOC_LEAD]u/2u \}
.          nr #EPI_LEAD      \\n[#LEAD]
.          nr #EPI_LEAD_DIFF \\n[#DOC_LEAD]-\\n[#EPI_LEAD]
.       \}
.       if \\n[#PRINT_STYLE]=2 \{\
.          FAMILY   \\*[$EPI_FAM]
.          FT       \\*[$EPI_FT]
.          PT_SIZE  \\n[#DOC_PT_SIZE]u\\*[$EPI_SIZE_CHANGE]
.          if \\n[#EPI_COLOR]=1 \{\
.             nf
\m[\\*[$EPI_COLOR]]
.             EOL
.          \}
.          AUTOLEAD \\n[#EPI_AUTOLEAD]
.          nr #EPI_LEAD      \\n[#LEAD]
.          nr #EPI_LEAD_DIFF \\n[#DOC_LEAD]-\\n[#EPI_LEAD]
.       \}
.       di EPI_TEXT
.       nr #DIVERSIONS_HY_MARGIN (p;\\n[.ps]u*2.75)/1000
.       HY_SET 1 \\n[#DIVERSIONS_HY_MARGIN]u (\\n[#PT_SIZE]u/1000u/8u)p
.       hy 14
.       nr #EPI_ACTIVE 1
.    \}
.    el \{\
.       ie '\\$1'BLOCK' \{\
.          nr #EPIGRAPH 2
.          ev EPIGRAPH
.          ie \\n[#START] \{\
.             ie \\n[#COLUMNS] \{\
.                ll \\n[#L_LENGTH_FOR_EPI]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
.                ta \\n(.lu
.             \}
.             el \{\
.                ll \\n[#L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
.                ta \\n(.lu
.             \}
.          \}
.          el \{\
.             ll \\n[#L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
.             ta \\n(.lu
.             if \\n[#COLUMNS] \{\
.                ll \\n[#COL_L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#EPI_OFFSET_VALUE]u*2u))
.                ta \\n(.lu
.             \}
.             CHECK_INDENT
.          \}
.          if \\n[#PRINT_STYLE]=1 \{\
.             fam C
.             ft  R
.             if '\\*[$EPI_FT]'I' \{\
.                FT I
.             \}
.             ps  12
.             ie \\n[#SINGLE_SPACE] \{ .vs \\n[#DOC_LEAD]u \}
.             el \{ .vs  \\n[#DOC_LEAD]u/2u \}
.             QUAD LEFT
.             HY OFF
.             nr #EPI_LEAD \\n[#LEAD]
.             nr #EPI_LEAD_DIFF \\n[#DOC_LEAD]-\\n[#EPI_LEAD]
.             di EPI_TEXT
.             nr #EPI_ACTIVE 1
.          \}
.          if \\n[#PRINT_STYLE]=2 \{\
.             FAMILY   \\*[$EPI_FAM]
.             FT       \\*[$EPI_FT]
.             PT_SIZE  \\n[#DOC_PT_SIZE]u\\*[$EPI_SIZE_CHANGE]
.          if \\n[#EPI_COLOR]=1 \{\
.             nf
\m[\\*[$EPI_COLOR]]
.             EOL
.          \}
.             AUTOLEAD \\n[#EPI_AUTOLEAD]
.             QUAD     \\*[$EPI_QUAD]
.             nr #DIVERSIONS_HY_MARGIN (p;\\n[.ps]u*2.75)/1000
.             HY_SET 1 \\n[#DIVERSIONS_HY_MARGIN]u (\\n[#PT_SIZE]u/1000u/8u)p
.             hy 14
.             nr #EPI_LEAD \\n[#LEAD]
.             nr #EPI_LEAD_DIFF \\n[#DOC_LEAD]-\\n[#EPI_LEAD]
.             di EPI_TEXT
.             nr #EPI_ACTIVE 1
.          \}
.       \}
.       el \{\
.          DO_EPIGRAPH
.       \}
.    \}
.END
\#
\#
\# DO EPIGRAPH
\# -----------
\# *Arguments:
\#   <none>
\# *Function:
\#   Ends diversion started in EPIGRAPH.  Makes spacing
\#   adjustments to compensate for the difference between epigraph
\#   leading and overall document leading, so that the bottom of
\#   the pages remain flush.
\# *Notes:
\#   In addition to its usual place at the beginning of a
\#   document, EPIGRAPH may also be used after HEAD.
\#
.MAC DO_EPIGRAPH END
.    br
.    di
.    rr #IN_DIVER
.    if \\n[#RESET_FN_COUNTERS]=2 \{\
.       if !\\n[#FN_COUNT]=1 \{\
.          if ((\\n[#PAGE_LENGTH]+\\n[#VARIABLE_FOOTER_POS])+\\n[#DIVER_DEPTH])>(\\n[#PAGE_LENGTH]+\\n[#VARIABLE_FOOTER_POS]) \{\
.             DIVER_FN_2_POST
.             rr #RESET_FN_COUNTERS
.          \}
.       \}
.    \}
.    nr #SAVED_FN_NUMBER \\n[#FN_NUMBER]
.    nr #DONE_ONCE 0 1
.    REMOVE_INDENT
.    ev
.    nr #EPI_DEPTH \\n[#DIVER_DEPTH]-\\n[#EPI_LEAD]
.    nr #EPI_LINES \\n[#EPI_DEPTH]/\\n[#EPI_LEAD]
.    ie \\n[#START] \{\
.       RLD \\n[#SHIM]u
.       nr #EPI_WHITESPACE (\\n[#DOC_LEAD]*\\n[#EPI_LINES])-\\n[#EPI_DEPTH]
.       while \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
.             nr #EPI_WHITESPACE -\\n[#DOC_LEAD]
.\}
.       if \\n[#PRINT_STYLE]=2 \{\
.          RLD \\n[#DOC_LEAD]u
.          if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \{\
.             ALD \\n[#EPI_LEAD_DIFF]u+(\\n[#EPI_WHITESPACE]u/2u)
.          \}
.          if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
.             ALD \\n[#EPI_LEAD_DIFF]u+(\\n[#EPI_WHITESPACE]u/2u)-\\n[#DOC_LEAD]u
.          \}
.       \}
.    \}
.    el \{\
.       ie \\n[#EPI_DEPTH]<\\n[#TRAP_DISTANCE] \{\
.          nr #EPI_FITS 1
.          nr #EPI_WHITESPACE (\\n[#DOC_LEAD]*\\n[#EPI_LINES])-\\n[#EPI_DEPTH]
.          while \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
.                nr #EPI_WHITESPACE -\\n[#DOC_LEAD]
.\}
.          ie \\n[#PRINT_STYLE]=1 \{\
.             if \\n[#EPI_WHITESPACE]=\\n[#DOC_LEAD] \{ .ALD \\n[#EPI_WHITESPACE]u/2u \}
.          \}
.          el \{\
.             if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \{\
.                ALD \\n[#EPI_LEAD_DIFF]u+(\\n[#EPI_WHITESPACE]u/2u)
.             \}
.             if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
.                ALD \\n[#EPI_LEAD_DIFF]u+(\\n[#EPI_WHITESPACE]u/2u)-\\n[#DOC_LEAD]u
.             \}
.          \}
.          if \\n[#DIVER_FN]=2 \{ .rr #DIVER_FN \}
.       \}
.       el \{\
.          nr #EPI_LINES_TO_TRAP 0 1
.          while \\n[#EPI_LEAD]*\\n+[#EPI_LINES_TO_TRAP]<\\n[#TRAP_DISTANCE] \{\
.                nr #LOOP 1
.\}
.          nr #EPI_LINES_TO_TRAP -1
.          nr #EPI_WHITESPACE (\\n[#EPI_LINES_TO_TRAP]*\\n[#DOC_LEAD])-(\\n[#EPI_LINES_TO_TRAP]*\\n[#EPI_LEAD])
.          while \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
.                nr #EPI_WHITESPACE -\\n[#DOC_LEAD]
.\}
.          if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \{ .ALD \\n[#EPI_WHITESPACE]u \}
.          if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{ .ALD \\n[#EPI_WHITESPACE]u-\\n[#DOC_LEAD]u \}
.      \}
.    \}
.    if \\n[#EPIGRAPH]=1 \{\
.       po \\n[#L_MARGIN]u
.       if \\n[#COLUMNS] \{\
.          po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
.          nr #L_MARGIN \\n(.o
.       \}
.    \}
.    if \\n[#EPIGRAPH]=2 \{\
.       nr #EPI_OFFSET \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
.       if \\n[#COLUMNS] \{\
.          nr #EPI_OFFSET \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
.       \}
.       po \\n[#EPI_OFFSET]u
.    \}
.    nf
.    EPI_TEXT
.    br
.    ie \\n[#START] \{\
.       if \\n[#PRINT_STYLE]=1 \{\
.          ie \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
.          el \{\
.             ie \\n[#EPI_LINES]%2=1 \{ .ALD \\n[#DOC_LEAD]u \}
.             el \{ .ALD \\n[#DOC_LEAD]u/2u \}
.          \}
.          SHIM
.       \}
.       if \\n[#PRINT_STYLE]=2 \{\
.          if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \{\
.             ALD \\n[#EPI_WHITESPACE]u/2u
.          \}
.          if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
.             ALD (\\n[#EPI_WHITESPACE]u/2u)-\\n[#DOC_LEAD]u
.          \}
.          SHIM
.       \}
.    \}
.    el \{\
.       rr #EPI_ACTIVE
.       ie \\n[#EPI_FITS] \{\
.          ie \\n[#FN_FOR_EPI] \{\
.             nr #EPI_LINES_TO_END 1
.             nr #EPI_WHITESPACE (\\n[#EPI_LINES_TO_END]*\\n[#DOC_LEAD])-(\\n[#EPI_LINES_TO_END]*\\n[#EPI_LEAD])
.             while \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
.                   nr #EPI_WHITESPACE -\\n[#DOC_LEAD]
.\}
.             ALD \\n[#EPI_WHITESPACE]u-(\\n[#DOC_LEAD]u-\\n[#EPI_LEAD]u)
.          \}
.          el \{\
.             ie \\n[#PRINT_STYLE]=1 \{\
.                if \\n[#EPI_WHITESPACE]=\\n[#DOC_LEAD] \{ .ALD \\n[#EPI_WHITESPACE]u \}
.             \}
.             el \{\
.                if \\n[#EPI_WHITESPACE]<\\n[#DOC_LEAD] \{\
.                   ALD \\n[#EPI_WHITESPACE]u/2u
.                \}
.                if \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
.                   ALD (\\n[#EPI_WHITESPACE]u/2u)-\\n[#DOC_LEAD]u
.                \}
.             \}
.          \}
.       \}
.       el \{\
.          nr #EPI_LINES_TO_END \\n[#EPI_LINES]-\\n[#EPI_LINES_TO_TRAP]
.          if \\n[#LOOP] \{ .nr #EPI_LINES_TO_END +1 \}
.          rr #LOOP
.          nr #EPI_WHITESPACE (\\n[#EPI_LINES_TO_END]*\\n[#DOC_LEAD])-(\\n[#EPI_LINES_TO_END]*\\n[#EPI_LEAD])
.          while \\n[#EPI_WHITESPACE]>\\n[#DOC_LEAD] \{\
.                nr #EPI_WHITESPACE -\\n[#DOC_LEAD]
.\}
.          ALD \\n[#EPI_WHITESPACE]u-(\\n[#DOC_LEAD]u-\\n[#EPI_LEAD]u)
.          if \\n[#PRINT_STYLE]=1 \{\
.             if !\\n[#SINGLE_SPACE] \{\
.                nr #EPI_LINES_EVEN \\n[#EPI_LINES_TO_END]%2
.                ie \\n[#EPI_LINES_EVEN] \{ .ALD .5v \}
.                el \{ .RLD .5v \}
.                rr #EPI_LINES_EVEN
.             \}
.          \}
.       \}
.    \}
.    nr #PP_STYLE 1
.    rr #EPI_FITS
.    ALD \\n[#DOC_LEAD]u
.    QUAD \\*[$DOC_QUAD]
.    po \\n[#L_MARGIN]u
.    if \\n[#COLUMNS] \{\
.       po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
.       nr #L_MARGIN \\n(.o
.    \}
.    if \\n[#START] \{\
.       if \\n[#COLUMNS] \{\
.          po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
.          nr #L_MARGIN \\n(.o
.          mk dc
.       \}
.    \}
.    if \\n[#LINENUMBERS]=2 \{\
.       NUMBER_LINES RESUME
.       nr #LINENUMBERS 1
.    \}
.END
\#
\# ====================================================================
\#
\# +++FINIS MACRO+++
\#
\# FINIS
\# -----
\# *Arguments:
\#   <none>
\# *Function:
\#   Deposits --END-- at the end of a document.
\#
.MAC FINIS END
.    br
.    ev FINIS
.    evc 0
.    if \\n[#TAB_ACTIVE] \{ .TQ \}
.    if \\n[#INDENT_ACTIVE] \{ .IQ CLEAR \}
.    nr #EM_ADJUST (1m/8)
.    if \\n[#COLUMNS] \{\
.       po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
.       nr #L_MARGIN \\n(.o
.    \}
.    ALD \\n[#DOC_LEAD]u
.    CENTER
.    if \\n[#PRINT_STYLE]=1 \{ .PRINT "--\\*[$FINIS_STRING]--\}
.    if \\n[#PRINT_STYLE]=2 \{\
.       ie \\n[#FINIS_COLOR] \{\
.          PRINT "\m[\\*[$FINIS_COLOR]]\v'-\\n[#EM_ADJUST]u'\(em\v'+\\n[#EM_ADJUST]u'\\*[$FINIS_STRING]\v'-\\n[#EM_ADJUST]u'\*[FU1]\(em\m[]
.       \}
.       el \{ .PRINT \v'-\\n[#EM_ADJUST]u'\(em\v'+\\n[#EM_ADJUST]u'\\*[$FINIS_STRING]\v'-\\n[#EM_ADJUST]u'\*[FU1]\(em\m[] \}
.    \}
.    ev
.END
\#
\# ====================================================================
\#
\# +++HEADERS/FOOTERS+++
\#
\# Define a string so that the current page number can be incorporated
\# into the strings for hdrftr left, right, and center.  NOTE: This is
\# not the same thing as using the shortform # in hdrftr strings.
\#
.ds PAGE# \En[#PAGENUMBER]
\#
\#
\# HDRFTR RULE GAP
\# ---------------
\# *Argument:
\#   <amount of space between header/footer and header/footer rule>
\# *Function:
\#   Creates or modifies register #HDRFTR_RULE_GAP to hold amount
\#   of space between header/footer and header/footer rule.
\# *Notes:
\#   Default is 4p.
\#
.MAC HDRFTR_RULE_GAP END
.    nr #HDRFTR_RULE_GAP (\\$1)
.END
\#
\#
\# HDRFTR LEFT
\# -----------
\# *Argument:
\#   <what to put in the left position of page header/footers>
\# *Function:
\#   Creates or modifies string $HDRFTR_LEFT.
\#   Creates register #USER_DEF_HDRFTR_LEFT, which, if 1,
\#   overrides the $HDRFTR_LEFT string created by default
\#   in DEFAULTS.
\# *Notes:
\#   Especially useful if doc has more than one author, and a list
\#   of authors by last name is desired in header/footers.
\#   Default is author.
\#
\#   If the argument is the # character, simply prints the current
\#   page number.
\#
\#   If the user wants to *incorporate* the page number into the string,
\#   \*[PAGE#] must be used.  For example, if the user wants to put
\#   an elipsis before the page number in the string, s/he should use
\#   ...\*[PAGE#], not ...#
\#
.MAC HDRFTR_LEFT END
.    nr #USER_DEF_HDRFTR_LEFT 1
.    ds $HDRFTR_LEFT \\$1
.END
\#
\#
\# HDRFTR LEFT CAPS
\# ----------------
\# *Argument:
\#   <none> | <anything>
\# *Function:
\#   Turns capitalisation of $HDRFTR_LEFT (typically, the author of
\#   the document) on or off.
\# *Notes:
\#   Default is on.
\#
.MAC HDRFTR_LEFT_CAPS END
.    ie '\\$1'' \{\
.        nr #HDRFTR_LEFT_CAPS 1
.    \}
.    el \{\
.       nr #HDRFTR_LEFT_CAPS 0
.       ds $HDRFTR_LEFT_SIZE_CHANGE +0
.    \}
.END
\#
\#
\# HDRFTR CENTER
\# -------------
\# *Argument:
\#   <what to put in the centre position of page header/footers>
\# *Function:
\#   Creates or modifies string $HDRFTR_CENTER.
\#   Creates register #USER_DEF_HDRFTR_CENTER, which, if 1,
\#   overrides the $HDRFTR_CENTER string created by default
\#   in COPYSTYLE.
\# *Notes:
\#   Default is document type if DOCTYPE NAMED, Chapter # if DOCTYPE
\#   CHAPTER, draft and revision number if COPYSTYLE DRAFT.
\#
\#   If the argument is the # character, simply prints the current
\#   page number.
\#
\#   If the user wants to *incorporate* the page number into the string,
\#   \*[PAGE#] must be used.  For example, if the user wants to put
\#   an elipsis before the page number in the string, s/he should use
\#   ...\*[PAGE#], not ...#
\#
.MAC HDRFTR_CENTER END
.    nr #USER_DEF_HDRFTR_CENTER 1
.    if '\\$0'FOOTER_CENTER' \{\
.       ds $HDRFTR_CENTER_OLD \\*[$HDRFTR_CENTER]
.       ds $HDRFTR_CENTER_NEW \\$1
.    \}
.    if '\\$0'FOOTER_CENTRE' \{\
.       ds $HDRFTR_CENTER_OLD \\*[$HDRFTR_CENTER]
.       ds $HDRFTR_CENTER_NEW \\$1
.    \}
.    ds $HDRFTR_CENTER \\$1
.END
\#
\#
\# HDRFTR CENTER CAPS
\# ------------------
\# *Argument:
\#   <none> | <anything>
\# *Function:
\#   Turns capitalisation of $HDRFTR_CENTER (typically, doctype of
\#   the document) on or off.
\# *Notes:
\#   Default is on.
\#
.MAC HDRFTR_CENTER_CAPS END
.    ie '\\$1'' \{\
.       nr #HDRFTR_CENTER_CAPS 1
.    \}
.    el \{\
.       nr #HDRFTR_CENTER_CAPS 0
.       ds $HDRFTR_CENTER_SIZE_CHANGE +0
.    \}
.END
\#
\#
\# HDRFTR CENTER PADDING
\# ---------------------
\# *Argument:
\#   LEFT | RIGHT <amount of padding to put left or right of hdrftr
\#   center string>
\# *Function:
\#   Creates or modifies registers #HDRFTR_CTR_PAD_LEFT or
\#   #HDRFTR_CTR_PAD_RIGHT.
\# *Notes:
\#   By default, the HDRFTR_CENTER string is centered on the doc
\#   line length.  Long titles or long author names can screw up
\#   visual centering, or create overprints.  This macro allows the
\#   user to pad the center string by the specified amount of space
\#   to fix these problems.  Use only one of LEFT or RIGHT.
\#
\#   A unit of measure is required.
\#
.MAC HDRFTR_CENTER_PAD END
.    if '\\$1'LEFT' \{\
.       nr #HDRFTR_CTR_PAD_LEFT (\\$2)
.    \}
.    if '\\$1'RIGHT' \{\
.       nr #HDRFTR_CTR_PAD_RIGHT (\\$2)
.    \}
.END
\#
\#
\# SWITCH HDRFTR CENTER PADDING SIDE - support macro
\# --------------------------------
\# *Argument:
\#   <none>
\# *Function:
\#   Switches the padding side of hdrftr center padding.
\# *Notes:
\#   Required to keep spacing around hdrftr string constant
\#   in recto/verso documents.
\#
.MAC SWITCH_HDRFTR_CENTER_PAD END
.    nr #HDRFTR_CTR_PAD_TMP  \\n[#HDRFTR_CTR_PAD_LEFT]
.    HDRFTR_CENTER_PAD LEFT  \\n[#HDRFTR_CTR_PAD_RIGHT]u
.    HDRFTR_CENTER_PAD RIGHT \\n[#HDRFTR_CTR_PAD_TMP]u
.END
\#
\#
\# HDRFTR RIGHT
\# ------------
\# *Argument:
\#   <what to put in the right position of page header/footers>
\# *Function:
\#   Creates or modifies string $HDRFTR_RIGHT.
\#   Creates register #USER_DEF_HDRFTR_RIGHT, which, if 1,
\#   overrides the $HDRFTR_RIGHT string created by default
\#   in DEFAULTS.
\# *Notes:
\#   Default is document title.
\#
\#   If the argument is the # character, simply prints the current
\#   page number.
\#
\#   If the user wants to *incorporate* the page number into the string,
\#   \*[PAGE#] must be used.  For example, if the user wants to put
\#   an elipsis before the page number in the string, s/he should use
\#   ...\*[PAGE#], not ...#
\#
.MAC HDRFTR_RIGHT END
.    nr #USER_DEF_HDRFTR_RIGHT 1
.    ds $HDRFTR_RIGHT \\$1
.END
\#
\#
\# HDRFTR RIGHT CAPS
\# -----------------
\# *Argument:
\#   <none> | <anything>
\# *Function:
\#   Turns capitalisation of $HDRFTR_RIGHT (typically, the title of
\#   the document) on or off.
\# *Notes:
\#   Default is on.
\#
.MAC HDRFTR_RIGHT_CAPS END
.    ie '\\$1'' \{\
.       nr #HDRFTR_RIGHT_CAPS 1
.    \}
.    el \{\
.       nr #HDRFTR_RIGHT_CAPS 0
.       ds $HDRFTR_RIGHT_SIZE_CHANGE +0
.    \}
.END
\#
\#
\# HDRFTR RULE
\# -----------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   If invoked via the alias HDRFTR_RULE_INTERNAL in HDRFTR, prints a rule
\#   under the header/over the footer.  Otherwise, turns HDRFTR_RULE
\#    on or off.
\#
.MAC HDRFTR_RULE END   \"To print rule under header/over footer.
.    ie '\\$0'HDRFTR_RULE_INTERNAL' \{\
.       ie \\n[#USERDEF_HDRFTR] \{\
.          nr #CAP_HEIGHT_ADJUST \\n[#HDRFTR_HEIGHT]
.          ps 12
.          if \\n[#HEADERS_ON] \{\
.             rt \\nyu
.             ALD \\n[#HDRFTR_RULE_GAP]u
.          \}
.          if \\n[#FOOTERS_ON] \{\
.              rt \\nyu
.              RLD \\n[#HDRFTR_RULE_GAP]u+\\n[#CAP_HEIGHT_ADJUST]u+1p
.          \}
.          ie \\n[#HDRFTR_RULE_COLOR]=1 \{\
.             PRINT \m[\\*[$HDRFTR_RULE_COLOR]]\\l'\\n[#DOC_L_LENGTH]u'\m[]
.          \}
.          el \{\
.             PRINT \\l'\\n[#DOC_L_LENGTH]u'
.          \}
.          br
.       \}
.       el \{\
.          if \\n[#PRINT_STYLE]=1 \{\
.             nr #CAP_HEIGHT_ADJUST \\n[#CAP_HEIGHT]
.          \}
.          if \\n[#PRINT_STYLE]=2 \{\
.             ie \\n[#LEFT_CAP_HEIGHT]>\\n[#CENTER_CAP_HEIGHT] \{\
.                nr #CAP_HEIGHT_ADJUST \\n[#LEFT_CAP_HEIGHT]
.             \}
.             el \{ .nr #CAP_HEIGHT_ADJUST \\n[#CENTER_CAP_HEIGHT] \}
.             ie \\n[#CAP_HEIGHT_ADJUST]>\\n[#RIGHT_CAP_HEIGHT] \{\
.                nr #CAP_HEIGHT_ADJUST \\n[#CAP_HEIGHT_ADJUST]
.             \}
.             el \{ .nr #CAP_HEIGHT_ADJUST \\n[#RIGHT_CAP_HEIGHT] \}
.          \}
.          ps 12
.          if \\n[#HEADERS_ON] \{\
.             rt \\nyu
.             ALD \\n[#HDRFTR_RULE_GAP]u
.          \}
.          if \\n[#FOOTERS_ON] \{\
.             rt \\nyu
.             RLD \\n[#HDRFTR_RULE_GAP]u+\\n[#CAP_HEIGHT_ADJUST]u+1p
.          \}
.          ie \\n[#HDRFTR_RULE_COLOR]=1 \{\
.             PRINT \m[\\*[$HDRFTR_RULE_COLOR]]\\l'\\n[#DOC_L_LENGTH]u'\m[]
.          \}
.          el \{\
.             PRINT \\l'\\n[#DOC_L_LENGTH]u'
.          \}
.          br
.       \}
.    \}
.    el \{\
.       ie '\\$1'' \{ .nr #HDRFTR_RULE 1 \}
.       el \{ .nr #HDRFTR_RULE 0 \}
.    \}
.END
\#
\#
.ALIAS HDRFTR_RULE_INTERNAL HDRFTR_RULE
\#
\#
\# HDRFTR PLAIN
\# ------------
\# *Arguments:
\#   <none>
\# *Function:
\#   Sets the family, font, and point size of all strings in
\#   header/footers to the same family and point size as running
\#   text.  Font for the header/footer becomes roman throughout.
\#
.MAC HDRFTR_PLAIN END
.    HDRFTR_FAMILY        \\*[$DOC_FAM]
.    HDRFTR_PT_SIZE       \\n[#DOC_PT_SIZE]
.    HDRFTR_LEFT_FAMILY   \\*[$DOC_FAM]
.    HDRFTR_LEFT_FONT     R
.    HDRFTR_LEFT_SIZE     +0
.    HDRFTR_LEFT_CAPS     OFF
.    HDRFTR_CENTER_FAMILY \\*[$DOC_FAM]
.    HDRFTR_CENTER_FONT   R
.    HDRFTR_CENTER_SIZE   +0
.    HDRFTR_CENTER_CAPS   OFF
.    HDRFTR_RIGHT_FAMILY  \\*[$DOC_FAM]
.    HDRFTR_RIGHT_FONT    R
.    HDRFTR_RIGHT_SIZE    +0
.    HDRFTR_RIGHT_CAPS    OFF
.END
\#
\#
\# SWITCH HDRFTR
\# -------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Creates or modifies register #SWITCH_HDRFTR, used to switch
\#   default location of HDRFTR_LEFT and HDRFTR_RIGHT.
\# *Notes:
\#
.ig
Typically, the author string appears at the left of header/footers,
and the title string appears at the right.  This switches the
location of the two.  Useful in conjuction with RECTO_VERSO to tweak
switches on alternate pages to come out as the user wishes.  The
assumption of RECTO_VERSO is that the first page of the document
(recto) is odd, and even though it has no header/footer, if it did
have one, it would print as AUTHOR...CENTER...TITLE (or whatever
strings the user has supplied for HDRFTR_LEFT/RIGHT), meaning that
the next page, which does have a header/footer, will come out as
TITLE...CENTER...AUTHOR (or whatever strings the user has supplied
for HDRFTR_LEFT/RIGHT).  SWITCH_HDRFTRS allows the user to get the
desired string in the desired place on the desired recto/verso page.

Default is OFF.
..
\#
.MAC SWITCH_HDRFTR END
.    ie '\\$1'' \{ .nr #SWITCH_HDRFTR 1 \}
.    el \{ .nr #SWITCH_HDRFTR 0 \}
.END
\#
\#
\# USER DEFINED HDRFTR RECTO
\# -------------------------
\# *Arguments:
\#   L | LEFT | C | CENTER | CENTER | R | RIGHT <hdrftr_recto_string>
\# *Function:
\#   Toggles #USERDEF_HDRFTR on, stores quad as #USERDEF_HDRFTR_RECTO_QUAD,
\#   stores string in $USERDEF_HDRFTR_RECTO.
\# *Notes:
\#   For use when users don't want 3-part headers/footers, but rather
\#   want to design their own headers/footers and need different
\#   headers/footers on recto and verso pages.  Using just
\#   HEADER_RECTO, even when recto/verso is not on, allows users to
\#   design their own headers/footers for doc pages.
\#
.MAC HDRFTR_RECTO END
.    nr #USERDEF_HDRFTR 1
.    if '\\$1'L'      \{ .nr #USERDEF_HDRFTR_RECTO_QUAD 1 \}
.    if '\\$1'LEFT'   \{ .nr #USERDEF_HDRFTR_RECTO_QUAD 1 \}
.    if '\\$1'C'      \{ .nr #USERDEF_HDRFTR_RECTO_QUAD 2 \}
.    if '\\$1'CENTER' \{ .nr #USERDEF_HDRFTR_RECTO_QUAD 2 \}
.    if '\\$1'CENTRE' \{ .nr #USERDEF_HDRFTR_RECTO_QUAD 2 \}
.    if '\\$1'R'      \{ .nr #USERDEF_HDRFTR_RECTO_QUAD 3 \}
.    if '\\$1'RIGHT'  \{ .nr #USERDEF_HDRFTR_RECTO_QUAD 3 \}
.    ds $USERDEF_HDRFTR_RECTO \\$2
.END
\#
\#
\# USER DEFINED HDRFTR VERSO
\# -------------------------
\# *Arguments:
\#   L | LEFT | C | CENTER | CENTER | R | RIGHT <hdrftr_verso_string>
\# *Function:
\#   Toggles #USERDEF_HDRFTR on, stores quad as #USERDEF_HDRFTR_VERSO_QUAD,
\#   stores string in $USERDEF_HDRFTR_VERSO.
\# *Notes:
\#   For use when users don't want 3-part headers/footers, but rather
\#   want to design their own headers/footers and need different
\#   headers/footers on recto and verso pages.
\#
.MAC HDRFTR_VERSO END
.    nr #USERDEF_HDRFTR 1
.    if '\\$1'L'      \{ .nr #USERDEF_HDRFTR_VERSO_QUAD 1 \}
.    if '\\$1'LEFT'   \{ .nr #USERDEF_HDRFTR_VERSO_QUAD 1 \}
.    if '\\$1'C'      \{ .nr #USERDEF_HDRFTR_VERSO_QUAD 2 \}
.    if '\\$1'CENTER' \{ .nr #USERDEF_HDRFTR_VERSO_QUAD 2 \}
.    if '\\$1'CENTRE' \{ .nr #USERDEF_HDRFTR_VERSO_QUAD 2 \}
.    if '\\$1'R'      \{ .nr #USERDEF_HDRFTR_VERSO_QUAD 3 \}
.    if '\\$1'RIGHT'  \{ .nr #USERDEF_HDRFTR_VERSO_QUAD 3 \}
.    ds $USERDEF_HDRFTR_VERSO \\$2
.END
\#
\#
\# PRINT FOOTER ON FIRST PAGE
\# --------------------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Toggles register #PRINT_FOOTER_ON_PAGE_1
\# *Notes:
\#   Lets user choose whether to print footer on first
\#   page of doc.
\#
.MAC FOOTER_ON_FIRST_PAGE END
.    ie '\\$1'' \{ .nr #PRINT_FOOTER_ON_PAGE_1 1 \}
.    el \{ .rr #PRINT_FOOTER_ON_PAGE_1 \}
.END
\#
\#
\# PRINT PAGE NUMBER ON FIRST PAGE
\# -------------------------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Toggles register #PRINT_PAGENUM_ON_PAGE_1
\# *Notes:
\#   Lets user choose whether to print page number on first
\#   page of doc and after collate when footers are on or page numbering
\#   has been user set at top of page.
\#
.MAC PAGENUM_ON_FIRST_PAGE END
.    ie '\\$1'' \{ .nr #PRINT_PAGENUM_ON_PAGE_1 1 \}
.    el \{ .rr #PRINT_PAGENUM_ON_PAGE_1 \}
.END
\#
\#
\# PRINT HEADER/FOOTER
\# -------------------
\# *Arguments:
\#   <none>
\# *Function:
\#   Based on defaults or values entered by user, prints a
\#   three-part title at either the top or the bottom of the page.
\# *Notes:
\#   Called from within either HEADER or FOOTER.
\#
.MAC PRINT_HDRFTR END
.    if \\n[#DOC_TYPE]=4 \{\
.       nr #SUITE \En[.pn]
.    \}
.    if \\n[#FOOTERS_ON] \{\
.       if \\n[#START_FOR_FOOTERS] \{\
.          rr #START_FOR_FOOTERS
.          if !\\n[#PRINT_FOOTER_ON_PAGE_1] \{ .return \}
.       \}
.    \}
.    if \\n[#USERDEF_HDRFTR] \{\
.       PRINT_USERDEF_HDRFTR
.       return
.    \}
.    if \\n[#SWITCH_HDRFTR] \{\
.       ds $HDRFTR_TMP_SWITCH             \\*[$HDRFTR_LEFT]
.       ds $HDRFTR_LEFT                   \\*[$HDRFTR_RIGHT]
.       ds $HDRFTR_RIGHT                  \\*[$HDRFTR_TMP_SWITCH]
.       ds $HDRFTR_TMP_SIZE_CHANGE_SWITCH \\*[$HDRFTR_LEFT_SIZE_CHANGE]
.       ds $HDRFTR_LEFT_SIZE_CHANGE       \\*[$HDRFTR_RIGHT_SIZE_CHANGE]
.       ds $HDRFTR_RIGHT_SIZE_CHANGE      \\*[$HDRFTR_TMP_SIZE_CHANGE_SWITCH]
.       nr #HDRFTR_TMP_CAPS_SWITCH        \\n[#HDRFTR_LEFT_CAPS]
.       nr #HDRFTR_LEFT_CAPS              \\n[#HDRFTR_RIGHT_CAPS]
.       nr #HDRFTR_RIGHT_CAPS             \\n[#HDRFTR_TMP_CAPS_SWITCH]
.       ds $HDRFTR_TMP_COLOR_SWITCH       \\*[$HDRFTR_LEFT_COLOR]
.       ds $HDRFTR_LEFT_COLOR             \\*[$HDRFTR_RIGHT_COLOR]
.       ds $HDRFTR_RIGHT_COLOR            \\*[$HDRFTR_TMP_COLOR_SWITCH]
.       rr #HDRFTR_TMP_CAPS_SWITCH
.       rm $HDRFTR_TMP_SWITCH
.       rm $HDRFTR_TMP_SIZE_CHANGE_SWITCH
.       rm $HDRFTR_TMP_COLOR_SWITCH
.       nr #SWITCH_HDRFTR 0
.    \}
.    nr #PAGENUMBER \\n%+\\n[#PAGE_NUM_ADJ]
.    if \\n[#ENDNOTES] \{ .PAGENUM_STYLE \\*[$EN_PN_STYLE] \}
.    if \\n[#PRINT_STYLE]=1 \{\
.       if \\n[#FOOTERS_ON] \{\
.          di NULL
.          SIZESPECS
.          nr #LEFT_CAP_HEIGHT \\n[#CAP_HEIGHT]
.          di
.       \}
.       if o                        \{ .RIGHT \}
.       if e                        \{ .LEFT  \}
.       if \\n[#RECTO_VERSO]=0      \{ .LEFT  \}
.       if \\n[#HDRFTR_LEFT_CAPS]   \{ .CAPS  \}
.       ie '\\*[$HDRFTR_LEFT]'#' \{\
.           PRINT \\n[#PAGENUMBER]
.       \}
.       el \{\
.          ie !'\\*[$HDRFTR_LEFT]'' \{ . PRINT \\*[$HDRFTR_LEFT] \}
.          el \{ .PRINT \& \}
.       \}
.       if \\n[#HDRFTR_LEFT_CAPS] \{ .CAPS OFF \}
.       CENTER
.       if \\n[#HDRFTR_CENTER_CAPS] \{ .CAPS \}
.       rt \\nyu
.       ie '\\*[$HDRFTR_CENTER]'#' \{\
.           PRINT \\h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\n[#PAGENUMBER]\\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'
.       \}
.       el \{\
.          ie !'\\*[$HDRFTR_CENTER]'' \{ .PRINT \\h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\*[$HDRFTR_CENTER]\\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u' \}
.          el \{ .PRINT \& \}
.       \}
.       if \\n[#HDRFTR_CENTER_CAPS] \{ .CAPS OFF \}
.       if o                       \{ .LEFT  \}
.       if e                       \{ .RIGHT \}
.       if \\n[#RECTO_VERSO]=0     \{ .RIGHT \}
.       if \\n[#HDRFTR_RIGHT_CAPS] \{ .CAPS  \}
.       rt \\nyu
.       ie '\\*[$HDRFTR_RIGHT]'#' \{\
.           PRINT \\n[#PAGENUMBER]
.       \}
.       el \{\
.          ie !'\\*[$HDRFTR_RIGHT]'' \{ .PRINT \\*[$HDRFTR_RIGHT] \}
.          el \{ .PRINT \& \}
.       \}
.       if \\n[#HDRFTR_RIGHT_CAPS] \{ .CAPS OFF \}
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
.       if \\n[#HDRFTR_COLOR]=1 \{\
.          nf
\m[\\*[$HDRFTR_COLOR]]
.          EOL
.       \}
.       fam     \\*[$HDRFTR_LEFT_FAM]
.       ft      \\*[$HDRFTR_LEFT_FT]
.       ps      \\n[#HDRFTR_PT_SIZE]u\\*[$HDRFTR_LEFT_SIZE_CHANGE]
.       vs      12
.       if \\n[#FOOTERS_ON] \{\
.          di NULL
.          SIZESPECS
.          nr #LEFT_CAP_HEIGHT \\n[#CAP_HEIGHT]
.          di
.       \}
.       if o                      \{ .LEFT  \}
.       if e                      \{ .RIGHT \}
.       if \\n[#RECTO_VERSO]=0    \{ .LEFT  \}
.       if \\n[#HDRFTR_LEFT_CAPS] \{ .CAPS  \}
.       ie '\\*[$HDRFTR_LEFT]'#' \{\
.          ie \\n[#HDRFTR_LEFT_COLOR]=1 \{\
.             PRINT \m[\\*[$HDRFTR_LEFT_COLOR]]\\n[#PAGENUMBER]\m[]
.          \}
.          el \{\
.             PRINT \\n[#PAGENUMBER]
.          \}
.       \}
.       el \{\
.          ie !'\\*[$HDRFTR_LEFT]'' \{\
.             ie \\n[#HDRFTR_LEFT_COLOR]=1 \{\
.                 PRINT \m[\\*[$HDRFTR_LEFT_COLOR]]\\*[$HDRFTR_LEFT]\m[]
.             \}
.             el \{\
.                 PRINT \\*[$HDRFTR_LEFT]
.             \}
.          \}
.          el \{ .PRINT \& \}
.       \}
.       if \\n[#HDRFTR_LEFT_CAPS] \{ .CAPS OFF \}
.       fam     \\*[$HDRFTR_CENTER_FAM]
.       ft      \\*[$HDRFTR_CENTER_FT]
.       ps      \\n[#HDRFTR_PT_SIZE]u\\*[$HDRFTR_CENTER_SIZE_CHANGE]
.       vs      12
.       if \\n[#FOOTERS_ON] \{\
.          di NULL
.          SIZESPECS
.          nr #CENTER_CAP_HEIGHT \\n[#CAP_HEIGHT]
.          di
.       \}
.       CENTER
.       if \\n[#HDRFTR_CENTER_CAPS] \{ .CAPS \}
.       rt \\nyu
.       ie '\\*[$HDRFTR_CENTER]'#' \{\
.           ie \\n[#HDRFTR_CENTER_COLOR]=1 \{\
.              PRINT \\h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\m[\\*[$HDRFTR_CENTER_COLOR]]\\n[#PAGENUMBER]\\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'\m[]
.           \}
.           el \{\
.              PRINT \\h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\n[#PAGENUMBER]\\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'
.           \}
.       \}
.       el \{\
.          ie !'\\*[$HDRFTR_CENTER]'' \{\
.             ie \\n[#HDRFTR_CENTER_COLOR]=1 \{\
.                PRINT \\h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\m[\\*[$HDRFTR_CENTER_COLOR]]\\*[$HDRFTR_CENTER]\\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'\m[]
.             \}
.             el \{\
.                PRINT \\h'\\n[#HDRFTR_CTR_PAD_LEFT]u'\\*[$HDRFTR_CENTER]\\h'\\n[#HDRFTR_CTR_PAD_RIGHT]u'
.             \}
.          \}
.          el \{ .PRINT \& \}
.       \}
.       if \\n[#HDRFTR_CENTER_CAPS] \{ .CAPS OFF \}
.       fam     \\*[$HDRFTR_RIGHT_FAM]
.       ft      \\*[$HDRFTR_RIGHT_FT]
.       ps      \\n[#HDRFTR_PT_SIZE]u\\*[$HDRFTR_RIGHT_SIZE_CHANGE]
.       vs      12
.       if \\n[#FOOTERS_ON] \{\
.          di NULL
.          SIZESPECS
.          nr #RIGHT_CAP_HEIGHT \\n[#CAP_HEIGHT]
.          di
.       \}
.       if o                       \{ .RIGHT \}
.       if e                       \{ .LEFT  \}
.       if \\n[#RECTO_VERSO]=0     \{ .RIGHT \}
.       if \\n[#HDRFTR_RIGHT_CAPS] \{ .CAPS  \}
.       rt \\nyu
.       ie '\\*[$HDRFTR_RIGHT]'#' \{\
.          ie \\n[#HDRFTR_RIGHT_COLOR]=1 \{\
.             PRINT \m[\\*[$HDRFTR_RIGHT_COLOR]]\\n[#PAGENUMBER]\m[]
.          \}
.          el \{\
.             PRINT \\n[#PAGENUMBER]
.          \}
.       \}
.       el \{\
.          ie !'\\*[$HDRFTR_RIGHT]'' \{\
.             ie \\n[#HDRFTR_RIGHT_COLOR]=1 \{\
.                PRINT \m[\\*[$HDRFTR_RIGHT_COLOR]]\\*[$HDRFTR_RIGHT]\m[]
.             \}
.             el \{\
.                PRINT \\*[$HDRFTR_RIGHT]
.             \}
.          \}
.          el \{ .PRINT \& \}
.       \}
.       if \\n[#HDRFTR_RIGHT_CAPS] \{ .CAPS OFF \}
.    \}
.    if \\n[#HDRFTR_RULE] \{\
.       HDRFTR_RULE_INTERNAL
.    \}
.    br
.END
\#
\#
\# PRINT USER DEFINED HEADER/FOOTER
\# --------------------------------
\# *Arguments:
\#   <none>
\# *Function:
\#   Based on defaults or values entered by user, prints a single part
\#   (i.e. not 3-part) title at either the top or the bottom of the page.
\# *Notes:
\#   Called from within PRINT_HDRFTR.
\#
.MAC PRINT_USERDEF_HDRFTR END
.    nr #PAGENUMBER \\n%+\\n[#PAGE_NUM_ADJ]
.    fc ^ #
.    if \\n[#PRINT_STYLE]=2 \{\
.       FAMILY  \\*[$HDRFTR_FAM]
.       FT      R
.       PT_SIZE \\n[#HDRFTR_PT_SIZE]u
.       if \\n[#HDRFTR_COLOR]=1 \{\
.          nf
.          COLOR \\*[$HDRFTR_COLOR]
.       \}
.    \}
.    ie \\n[#RECTO_VERSO] \{\
.       if o \{\
.          if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=1 \{ .LEFT   \}
.          if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=2 \{ .CENTER \}
.          if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=3 \{ .RIGHT  \}
.          PRINT \\*[$USERDEF_HDRFTR_RECTO]
.          EOL
.          if \\n[#FOOTERS_ON] \{\
.             di NULL
.             SIZESPECS
.             nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
.             di
.          \}
.       \}
.       if e \{\
.          ie !'\\*[$USERDEF_HDRFTR_VERSO]'' \{\
.             if \\n[#USERDEF_HDRFTR_VERSO_QUAD]=1 \{ .LEFT   \}
.             if \\n[#USERDEF_HDRFTR_VERSO_QUAD]=2 \{ .CENTER \}
.             if \\n[#USERDEF_HDRFTR_VERSO_QUAD]=3 \{ .RIGHT  \}
.             PRINT \\*[$USERDEF_HDRFTR_VERSO]
.             EOL
.             if \\n[#FOOTERS_ON] \{\
.                di NULL
.                SIZESPECS
.                nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
.                di
.             \}
.          \}
.          el \{\
.             if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=1 \{ .LEFT   \}
.             if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=2 \{ .CENTER \}
.             if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=3 \{ .RIGHT  \}
.             PRINT \\*[$USERDEF_HDRFTR_RECTO]
.             EOL
.             if \\n[#FOOTERS_ON] \{\
.                di NULL
.                SIZESPECS
.                nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
.                di
.             \}
.          \}
.       \}
.    \}
.    el \{\
.       if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=1 \{ .LEFT   \}
.       if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=2 \{ .CENTER \}
.       if \\n[#USERDEF_HDRFTR_RECTO_QUAD]=3 \{ .RIGHT  \}
.       PRINT \\*[$USERDEF_HDRFTR_RECTO]
.       EOL
.       if \\n[#FOOTERS_ON] \{\
.          di NULL
.          SIZESPECS
.          nr #HDRFTR_HEIGHT \\n[#CAP_HEIGHT]
.          di
.       \}
.    \}
.    fc
.    if \\n[#PRINT_STYLE]=2 \{\
.       ie \\n[#HDRFTR_COLOR]=1 \m[\\*[$HDRFTR_COLOR]]
.       el \m[black]
.    \}
.    if \\n[#HDRFTR_RULE] \{\
.       HDRFTR_RULE_INTERNAL
.    \}
.END
\#
\#
\# +++HEADERS+++
\#
\# HEADERS (off or on)
\# -------------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Turns headers at the top of the page off or on.
\# *Notes:
\#   Default is on.
\#
.MAC HEADERS END
.    ie '\\$1'' \{ .nr #HEADERS_ON 1 \}
.    el \{ .nr #HEADERS_ON 0 \}
.END
\#
\#
\# HEADER MARGIN
\# -------------
\# *Argument:
\#   <amount of space between top of page and header>
\# *Function:
\#   Creates or modifies register #HEADER_MARGIN to hold amount
\#   of space between top of page and header.
\# *Notes:
\#   Requires unit of measure.  Default is 4P+6p, measured top-of-page
\#   to baseline.
\#
.MAC HEADER_MARGIN END
.    nr #HEADER_MARGIN (\\$1)
.END
\#
\#
\# HEADER GAP
\# ----------
\# *Argument:
\#   <amount of space between header and running text>
\# *Function:
\#   Creates or modifies register #HEADER_GAP to hold amount
\#   of space between header and running text.
\# *Notes:
\#   Default is 1P+6p.
\#
.MAC HEADER_GAP END
.    nr #HEADER_GAP (\\$1)
.END
\#
\#
\# HEADER
\# ------
\# *Arguments:
\#   <none>
\# *Function:
\#   Prints header appropriate to DOC_TYPE, PRINTSTYLE, and COPYSTYLE.
\# *Notes:
\#   In order to convert the title string to caps in the header (in the
\#   event that the user enters .TITLE in caps/lc), I've used
\#   quad left, quad centre, and quad right to arrange the three bits
\#   of the header, rather than .tl.  This allows the use of the CAPS macro.
\#   The downside is that I have to add \\v'-(\\n[#LEAD]u*<n>) in order
\#   for -Tlatin1 output to align the header/footer strings on the baseline.
\#   The console output still isn't brilliant, but at least it's
\#   comprehensible.
\#
.MAC HEADER END
.    MNtop
.    rr #FROM_FOOTER
.    nr #FROM_HEADER 1
.    nr #LAST_FN_COUNT_FOR_COLS \\n[#FN_COUNT_FOR_COLS]
.    if \\n[#FN_DEPTH] \{ .PROCESS_FN_LEFTOVER \}
.    rr #RULED
.    if \\n[#RESET_FN_NUMBER] \{ .nr #FN_NUMBER 0 1 \}
.    po \\n[#DOC_L_MARGIN]u
.    if \\n[#RECTO_VERSO] \{\
.       if !\\n[#TOC_RV_SWITCH] \{\
.          nr #DOC_LR_MARGIN_TMP \\n[#DOC_L_MARGIN]
.          DOC_LEFT_MARGIN  \\n[#DOC_R_MARGIN]u
.          DOC_RIGHT_MARGIN \\n[#DOC_LR_MARGIN_TMP]u
.          SWITCH_HDRFTR_CENTER_PAD
.       \}
.       rr #TOC_RV_SWITCH
.    \}
.    ev HEADER
.    if \\n[#PAGE_NUM_V_POS]=1 \{ .vs 0 \}
.    sp |\\n[#HEADER_MARGIN]u-1v
.    mk y
.    ll \\n[#DOC_L_LENGTH]u
.    ta \\n(.lu
.    if \\n[#PRINT_STYLE]=1 \{\
.       fam C
.       ft  R
.       ps  12\\*[$HDRFTR_SIZE_CHANGE]
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
.      fam \\*[$HDRFTR_FAM]
.      ft  R
.      ps  \\n[#DOC_PT_SIZE]u\\*[$HDRFTR_SIZE_CHANGE]
.      vs  12
.    \}
.    nr #HDRFTR_PT_SIZE \\n[#PT_SIZE]
.    if \\n[#CAPS_ON] \{\
.       nr #CAPS_WAS_ON 1
.       CAPS OFF
.    \}
.    if \\n[#UNDERLINE_ON] \{\
.       nr #UNDERLINE_WAS_ON 1
.       UNDERLINE OFF
.    \}
.    if \\n[#PRINT_STYLE]=1 \{\
.       if \\n[#ENDNOTES]=1 \{\
.\" Single-spaced endotes have a different lead
.          if \\n[#EN_SINGLESPACE] \{\
.             nr #RESTORE_DOC_LEAD \\n[#DOC_LEAD]
.             nr #DOC_LEAD \\n[#EN_LEAD]u
.          \}
.       \}
.    \}
.    ie \\n[#HEADERS_ON] \{\
.       PRINT_HDRFTR
.       sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
.    \}
.    el \{\
.       ie \\n[#PAGE_NUM_V_POS]=1 \{\
.          ie \\n[#PAGINATE] \{\
.             PRINT_PAGE_NUMBER
.             sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
.          \}
.          el \{ .sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u \}
.       \}
.       el \{ .sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u \}
.    \}
.    if \\n[#PRINT_STYLE]=1 \{\
.       if \\n[#ENDNOTES]=1 \{\
.          if \\n[#EN_SINGLESPACE] \{\
.             nr #DOC_LEAD \\n[#RESTORE_DOC_LEAD]u
.             rr #RESTORE_DOC_LEAD
.          \}
.       \}
.    \}
.    nr #PAGE_TOP \\n(nl
.    ev
.    po \\n[#L_MARGIN]u
.    if \\n[#RECTO_VERSO] \{\
.       nr #L_MARGIN +\\n[#L_MARGIN_DIFF]
.    \}
.    if \\n[#CAPS_WAS_ON] \{\
.       CAPS
.       rr #CAPS_WAS_ON
.    \}
.    if \\n[#UNDERLINE_WAS_ON] \{\
.       UNDERLINE
.       rr #UNDERLINE_WAS_ON
.    \}
.    if \\n[#TAB_ACTIVE] \{ .TAB \\n[#CURRENT_TAB] \}
.    if \\n[#QUOTE] \{\
.       ie \\n[#TAB_ACTIVE] \{ .TAB \\n[#CURRENT_TAB] \}
.       el \{\
.          nr #Q_OFFSET \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE])
.          po \\n[#Q_OFFSET]u
.       \}
.       ALD \\n[#Q_LEAD_DIFF]u
.    \}
.    if \\n[#EPIGRAPH] \{\
.       ie \\n[#TAB_ACTIVE] \{ .TAB \\n[#CURRENT_TAB] \}
.       el \{\
.          nr #EPI_OFFSET \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
.          po \\n[#EPI_OFFSET]u
.       \}
.    \}
.    ie \\n[#EPIGRAPH] \{\
.       ie !\\n[#EPI_ACTIVE] \{\
.          ns
.          rr #EPI_ACTIVE
.       \}
.       el \{\
.          ie \\n[#EPI_FITS] \{ .ns \}
.          el \{ .ALD \\n[#DOC_LEAD]u-\\n[#EPI_LEAD]u \}
.       \}
.    \}
.    el \{ .ns \}
.    ns
.    if \\n[#COLUMNS] \{\
.       nr #FN_COUNT_FOR_COLS 0 1
.       nr #L_MARGIN \\n[#DOC_L_MARGIN]
.       if \\n[#RECTO_VERSO] \{ .COLUMNS \\n[#NUM_COLS] \\n[#GUTTER]u \}
.       nr #COL_NUM 0 1
.       mk dc
.       po \\n[#COL_\\n+[#COL_NUM]_L_MARGIN]u
.       nr #L_MARGIN \\n(.o
.       if \\n[#TAB_ACTIVE] \{ .TAB \\n[#CURRENT_TAB] \}
.       ll \\n[#COL_L_LENGTH]u
.       ta \\n(.lu
.       if \\n[#QUOTE] \{\
.          po +(\\n[#PP_INDENT]u*\\n[#Q_OFFSET_VALUE]u)
.       \}
.       if \\n[#EPIGRAPH] \{\
.          if \\n[#EPI_ACTIVE] \{\
.             ie \\n[#EPI_FITS] \{ . \}
.             el \{ .nr dc -\\n[#EPI_LEAD_DIFF] \}
.          \}
.          po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u+(\\n[#PP_INDENT]u*\\n[#EPI_OFFSET_VALUE]u)
.       \}
.    \}
.    if \\n[#RESET_FN_COUNTERS]=1 \{\
.       rr #RESET_FN_COUNTERS
.       PROCESS_FN_IN_DIVER
.       nr #FN_COUNT \\n[#SAVED_FN_COUNT] 1
.       if \\n[#COLUMNS]=1 \{ .nr #FN_COUNT_FOR_COLS \\n[#SAVED_FN_COUNT_FOR_COLS] 1 \}
.       ie \\n[#RESET_FN_NUMBER]=1 \{ .nr #FN_NUMBER \\n[#SAVED_FN_NUMBER] 1 \}
.       el \{ .nr #FN_NUMBER \\n[#FN_NUMBER] 1 \}
.       rm FN_IN_DIVER
.       if dRUNON_FN_IN_DIVER \{ .rm RUNON_FN_IN_DIVER \}
.    \}
.    if \\n[#PRINT_STYLE]=1 \{\
.       if \\n[#SLANT_ON] \{\
.          if \\n[#UNDERLINE_SLANT] \{ .UNDERLINE \}
.       \}
.    \}
.    rr #FROM_HEADER
.    rr #DEFER_SPACE_ADDED
.    if !\\n[#FN_DEPTH] \{\
.       if r#DIVERTED \{ .rr #DIVERTED \}
.    \}
.    if \\n[#MN_OVERFLOW_LEFT]=1 \{\
.       MN LEFT
.       nf
.       MN_OVERFLOW_LEFT
.       MN
.    \}
.    if \\n[#MN_OVERFLOW_RIGHT]=1 \{\
.       MN RIGHT
.       nf
.       MN_OVERFLOW_RIGHT
.       MN
.    \}
.    rm MN_OVERFLOW_LEFT
.    rr #MN_OVERFLOW_LEFT
.    rr #no-repeat-MN-left
.    rm MN_OVERFLOW_RIGHT
.    rr #MN_OVERFLOW_RIGHT
.    rr #no-repeat-MN-right
.END
\#
\# ====================================================================
\#
\# +++FOOTERS+++
\#
\# FOOTERS (off or on)
\# -------------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Turns footers at the bottom of the page off or on.
\# *Notes:
\#   Default is off.  If on, page numbers automatically go at
\#   the top, centered, unless pagination has been turned off,
\#   or the pagenumber position has been changed to left or right.
\#
.MAC FOOTERS END
.    ie '\\$1''   \{\
.       nr #FOOTERS_ON 1
.       PAGE_NUM_POS TOP CENTER
.    \}
.    el \{ .nr #FOOTERS_ON 0 \}
.END
\#
\#
\# FOOTER MARGIN
\# -------------
\# *Argument:
\#   <footer margin>
\# *Function:
\#   Creates or modifies register #FOOTER_MARGIN which holds the
\#   amount of space to leave between the page number and the bottom
\#   of the page.
\# *Notes:
\#   Unit of measure required.  Default is 3P.
\#
.MAC FOOTER_MARGIN END
.    ie \\n%>0 \{ .nr #FOOTER_MARGIN (\\$1) \}
.    el \{ . \}
.END
\#
\#
\# FOOTER GAP
\# ----------
\# *Argument:
\#   <distance from end of running text to page # or footer>
\# *Function:
\#   Creates or modifies register #FOOTER_GAP which holds the
\#   amount of space to leave between running text and the page number.
\# *Notes:
\#   Requires unit of measure.  Default is 3P.  Measured baseline to
\#   baseline.
\#
.MAC FOOTER_GAP END
.    ie \\n%>0 \{ .nr #FOOTER_GAP (\\$1) \}
.    el \{ . \}
.END
\#
\#
\# FOOTER
\# ------
\# *Arguments:
\#   <none>
\# *Function:
\#   Places footer at bottom of page if #FOOTERS=1, otherwise
\#   places page number at bottom of page (if #PAGINATE=1).
\#   Page numbers are in arabic or roman according to COPYSTYLE.
\#   DRAFT starts the document at page 1 regardless of PAGENUMBER.
\#   FINAL respects PAGENUMBER.
\#
.MAC FOOTER END
.    ev PAGE_TRANSITION
.    if \\n[MN-left]>0 \{\
.       if !\\n[#no-repeat-MN-left]=1 \{\
.          MNbottom-left
.          nr #no-repeat-MN-left 1
.       \}
.       if '\\n(.z'MN_OVERFLOW_LEFT' \{\
.          di
.          nr #MN_OVERFLOW_LEFT 1
.          rr #OVERFLOW_LEFT
.       \}
.    \}
.    if \\n[MN-right]>0 \{\
.       if (\\n[MN-right] > 0) \{\
.          if !\\n[#no-repeat-MN-right]=1 \{\
.             MNbottom-right
.          \}
.       \}
.       if '\\n(.z'MN_OVERFLOW_RIGHT' \{\
.          di
.          nr #MN_OVERFLOW_RIGHT 1
.          rr #OVERFLOW_RIGHT
.       \}
.    \}
.    ch MN_OVERFLOW_TRAP
.    nr #SAVED_LEAD \\n(.v
.    nr #L_MARGIN_DIFF \\n[#L_MARGIN]-\\n[#DOC_L_MARGIN]
.    if !\\n[#FN_DEFER] \{\
.       nr #DIVER_DEPTH 0
.       if \\n[#FN_DEPTH] \{\
.          if \\n[#DIVERTED]=3 \{ .nr #FN_DEPTH +\\n[#VFP_DIFF] \}
.          vpt 0
.          sp |\\n[#PAGE_LENGTH]u-(\\n[#B_MARGIN]u+\\n[#FN_DEPTH]u-\\n[#DOC_LEAD]u)
.          vpt 1
.          po \\n[#DOC_L_MARGIN]u
.          if \\n[#COLUMNS] \{\
.             po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
.             nr #L_MARGIN \\n(.o
.             nr #FROM_FOOTER 1
.          \}
.          nf
.          FOOTNOTES
.          rm FOOTNOTES
.          if dRUNON_FOOTNOTES \{ .rm RUNON_FOOTNOTES \}
.          if \\n[#PRINT_STYLE]=1 \{ .vs \\n[#SAVED_LEAD]u \}
.          if \\n[#PRINT_STYLE]=2 \{ .LS \\n[#SAVED_LEAD]u \}
.          if '\\n(.z'FN_OVERFLOW' \{\
.              di
.              nr #FN_OVERFLOW_DEPTH \\n[#DIVER_DEPTH]
.          \}
.          nr #FN_COUNT_AT_FOOTER \\n[#FN_COUNT]
.          nr #FN_COUNT 0
.          if \\n[#COL_NEXT] \{\
.             ie !\\n[#COL_NUM]=\\n[#NUM_COLS] \{ .nr #COL_NUM \\n-[#COL_NUM] \}
.             el \{ .nr #COL_NUM \\n[#NUM_COLS] 1 \}
.          \}
.       \}
.       rr #DIVERTED
.    \}
.    ie \\n[#COLUMNS]=1 \{\
.       ie \\n[#COL_NUM]=\\n[#NUM_COLS] \{ .DO_FOOTER \}
.       el \{\
.          ie \\n[#ENDNOTES] \{ .sp |\\n(ecu-\\n[#EN_LEAD]u \}
.          el \{ .sp |\\n(dcu \}
.          po \\n[#COL_\\n+[#COL_NUM]_L_MARGIN]u
.          nr #L_MARGIN \\n(.o
.          if \\n[#FN_DEPTH] \{ .PROCESS_FN_LEFTOVER \}
.          LS \\n[#SAVED_LEAD]u
.          if \\n[#PREV_FN_DEFERRED] \{\
.             nr #PREV_FN_DEFERRED 2
.          \}
.          rr #RULED
.          if !\\n[#EPIGRAPH] \{ .rr #COL_NEXT \}
.          if !\\n[#QUOTE]    \{ .rr #COL_NEXT \}
.          if \\n[#RESET_FN_COUNTERS]=1 \{\
.             rr #RESET_FN_COUNTERS
.             PROCESS_FN_IN_DIVER
.             LS \\n[#SAVED_LEAD]u
.             nr #FN_COUNT \\n[#FN_COUNT] 1
.             nr #FN_COUNT_FOR_COLS \\n[#FN_COUNT_FOR_COLS] 1
.             rm FN_IN_DIVER
.             if dRUNON_FN_IN_DIVER \{ .rm RUNON_FN_IN_DIVER \}
.          \}
.          rr #DEFER_SPACE_ADDED
.          if \\n[#TAB_ACTIVE] \{ .TAB \\n[#CURRENT_TAB] \}
.          if \\n[#QUOTE] \{\
.             ie \\n[#TAB_ACTIVE] \{ .TAB \\n[#CURRENT_TAB] \}
.             el \{\
.                nr #Q_OFFSET \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE])
.                if \\n[#COLUMNS] \{ .nr #Q_OFFSET \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE]) \}
.                po \\n[#Q_OFFSET]u
.             \}
.          \}
.          if \\n[#EPIGRAPH] \{\
.             ie \\n[#TAB_ACTIVE] \{ .TAB \\n[#CURRENT_TAB] \}
.             el \{\
.                nr #EPI_OFFSET \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE])
.                if \\n[#COLUMNS] \{ .nr #EPI_OFFSET \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+(\\n[#PP_INDENT]*\\n[#EPI_OFFSET_VALUE]) \}
.                po \\n[#EPI_OFFSET]u
.             \}
.          \}
.          ie \\n[#EPIGRAPH] \{\
.             ie !\\n[#EPI_ACTIVE] \{\
.                ns
.                rr #EPI_ACTIVE
.             \}
.             el \{\
.                sp |\\n(dcu+(\\n[#DOC_LEAD]u-\\n[#EPI_LEAD]u)
.                rr #EPI_ACTIVE
.             \}
.          \}
.          el \{ .ns \}
.          ev
.       \}
.       ns
.       rr #DIVERTED
.    \}
.    el \{ .DO_FOOTER \}
.END
\#
\#
\# PROCESS FOOTER
\# --------------
\# *Arguments:
\#   <none>
\# *Function:
\#   Prints footer (page number, or 3-part footer).
\#   Resets CAPS and UNDERLINE if they were on.
\#
.MAC DO_FOOTER END
.\" Have to change position of FN_OVERFLOW_TRAP or it screws up the
.\" placement of page numbers (or footers).  It's reset to its original
.\" position at the end of the macro.
.    if r#SAVED_FOOTER_POS \{ .ch FOOTER \\n[#SAVED_FOOTER_POS]u \}
.    rr #SAVED_FOOTER_POS
.    ie (\\n[#FOOTER_MARGIN]+\\n(.v)>\\n[#B_MARGIN] \{\
.       nr #SKIP_FOOTER 1
.    \}
.    el \{\
.       vpt 0
.       sp |\\n[#PAGE_LENGTH]u-\\n[#FOOTER_MARGIN]u-1v
.       mk y
.       vpt 1
.    \}
.    ev FOOTER
.    po \\n[#DOC_L_MARGIN]u
.    ll \\n[#DOC_L_LENGTH]u
.    ta \\n(.lu
.    FAMILY  \\*[$HDRFTR_FAM]
.    FT      R
.    PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$HDRFTR_SIZE_CHANGE]
.    if \\n[#PRINT_STYLE]=1 \{\
.       TYPEWRITER
.    \}
.    LS \\n[#SAVED_LEAD]u
.    nr #HDRFTR_PT_SIZE \\n[#PT_SIZE]
.    if \\n[#CAPS_ON] \{\
.       nr #CAPS_WAS_ON 1
.       CAPS OFF
.    \}
.    if \\n[#UNDERLINE_ON] \{\
.       nr #UNDERLINE_WAS_ON 1
.       UNDERLINE OFF
.    \}
.    ie \\n[#FOOTERS_ON] \{\
.       if !\\n[#SKIP_FOOTER]=1 \{ .PRINT_HDRFTR \}
.    \}
.    el \{\
.       if \\n[#PAGINATE] \{\
.          if \\n[#PAGE_NUM_V_POS]=2 \{\
.             if !\\n[#SKIP_FOOTER]=1 \{ .PRINT_PAGE_NUMBER \}
.          \}
.       \}
.    \}
.    rr #SKIP_FOOTER
.    if \\n[#CAPS_WAS_ON] \{\
.       CAPS
.       rr #CAPS_WAS_ON
.    \}
.    if \\n[#UNDERLINE_WAS_ON] \{\
.       UNDERLINE
.       rr #UNDERLINE_WAS_ON
.    \}
.    ev
.    rr #SAVED_LEAD
.    bp
.\" This ev pops the PAGE_TRANSITION environment still active at the
.\" end of HEADER
.    ev
.END
\#
\# ====================================================================
\#
\# +++HEADS+++
\#
\# ---Head numbers---
\#
\# NUMBER HEADS
\# ------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Toggles register #NUMBER_HEAD; sets incrementing register #HEAD_NUM.
\# *Notes:
\#   Default is OFF.
\#
.MAC NUMBER_HEADS END
.    ie '\\$1'' \{\
.       nr #NUMBER_HEAD 1
.       if !\\n[#HEAD_NUM] \{ .nr #HEAD_NUM 0 1 \}
.    \}
.    el \{ .rr #NUMBER_HEAD \}
.END
\#
\#
\# RESET HEAD NUMBER
\# -----------------
\# *Arguments:
\#   <none> | <desired head number>
\# *Function:
\#   Resets incrementing register #HEAD_NUM to 1 or, if there's
\#   an argument, to user supplied number.
\# *Notes:
\#   Also resets subhead and parahead numbers.  If this is not
\#   desired, subhead and parahead numbers may be reset individually.
\#
.MAC RESET_HEAD_NUMBER END
.    ie '\\$1'' \{\
.       nr #HEAD_NUM 0 1
.       nr #SH_NUM   0 1
.       nr #PH_NUM   0 1
.    \}
.    el \{\
.       nr #HEAD_NUM \\$1-1 1
.       nr #SH_NUM   0 1
.       nr #PH_NUM   0 1
.    \}
.END
\#
\#
\# NUMBER SUBHEADS
\# ---------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Toggles register #NUMBER_SH; sets incrementing register #SH_NUM.
\# *Notes:
\#   Default is OFF.
\#
.MAC NUMBER_SUBHEADS END
.    ie '\\$1'' \{\
.       nr #NUMBER_SH 1
.       if !\\n[#SH_NUM] \{ .nr #SH_NUM 0 1 \}
.    \}
.    el \{ .rr #NUMBER_SH \}
.END
\#
\#
\# RESET SUBHEAD NUMBER
\# --------------------
\# *Arguments:
\#   <none> | <desired subhead number>
\# *Function:
\#   Resets incrementing register #SH_NUM to 1 or, if there's
\#   an argument, to user supplied number.
\# *Notes:
\#   When the subhead number is reset, it resets the parahead number as
\#   well.  If this behaviour is not what's wanted, RESET_SUBHEAD_NUMBER
\#   allows the user to set the parahead number to whatever s/he desires.
\#
.MAC RESET_SUBHEAD_NUMBER END
.    ie '\\$1'' \{ .nr #SH_NUM 0 1 \}
.    el \{\
.       nr #SH_NUM \\$1-1 1
.       nr #PH_NUM 0 1
.       \}
.END
\#
\#
\# NUMBER PARAHEADS
\# ----------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Toggles register #NUMBER_PH; sets incrementing register #PH_NUM.
\# *Notes:
\#   Default is OFF.
\#
.MAC NUMBER_PARAHEADS END
.    ie '\\$1'' \{\
.       nr #NUMBER_PH 1
.       if !\\n[#PH_NUM] \{ .nr #PH_NUM 0 1 \}
.    \}
.    el \{ .rr #NUMBER_PH \}
.END
\#
\#
\# RESET PARAHEAD NUMBER
\# ---------------------
\# *Arguments:
\#   <none> | <desired parahead number>
\# *Function:
\#   Resets incrementing register #PH_NUM to 1 or, if there's
\#   an argument, to user supplied number.
\# *Notes:
\#   Resetting the parahead number resets the parahead number
\#   only.
\#
.MAC RESET_PARAHEAD_NUMBER END
.    ie '\\$1'' \{ .nr #PH_NUM 0 1 \}
.    el \{ nr #SH_NUM \\$1-1 1 \}
.END
\#
\#
\# ---Main heads---
\#
\# HEAD CAPS
\# ---------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Creates or modifies register #HEAD_CAPS.
\# *Notes:
\#   Default is on.
\#
.MAC HEAD_CAPS END
.    ie '\\$1'' \{ .nr #HEAD_CAPS 1 \}
.    el \{ .nr #HEAD_CAPS 0 \}
.END
\#
\#
\# HEAD SPACE
\# ----------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Creates register #HEAD_SPACE, which toggles whether the space
\#   before heads is 1 extra line space ("off") or 2 ("on").  Used only
\#   in PRINTSTYLE TYPESET.
\# *Notes:
\#   Default is on.
\#
.MAC HEAD_SPACE END
.    ie '\\$1'' \{ .nr #HEAD_SPACE 1 \}
.    el \{ .nr #HEAD_SPACE 0 \}
.END
\#
\#
\# HEAD UNDERLINE
\# --------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Creates or modifies register #HEAD_UNDERLINE.
\# *Notes:
\#   Default is on.
\#
.MAC HEAD_UNDERLINE END
.    ie '\\$1'' \{ .nr #HEAD_UNDERLINE 1 \}
.    el \{ .nr #HEAD_UNDERLINE 0 \}
.END
\#
\#
\# MAIN HEAD
\# ---------
\# *Arguments:
\#   "text of main head" ["text of main head"] ...
\# *Function:
\#   In TYPEWRITE, prints main heads centered, all caps, underlined.
\#   In TYPESET, prints bold main heads 1 point larger than running
\#   text, all caps, underlined.
\# *Notes:
\#   The HEAD macro requires that double-quotes (") surround
\#   each line of text.
\#
.MAC HEAD END
.    br
.\" Collect head for TOC.
.    nr #ARG_NUM 0 1
.    nr #TOC_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
.    af #TOC_ENTRY_PN \\g[#PAGENUMBER]
.    while \\n[#ARG_NUM]<\\n[#NUM_ARGS] \{\
.       ie \\n[#ARG_NUM]=\\n[#NUM_ARGS] \{\
.          as $TOC_HEAD_ITEM \\$[\\n+[#ARG_NUM]]\\|
.       \}
.       el \{\
.\" Note that in the .as lines, below, \ at the end has a literal
.\" space after it.
.          ie \\n[#NUMBER_HEAD] \{\
.             ie \\n[#ARG_NUM]=0 \{\
.                as $TOC_HEAD_ITEM \\n+[#HEAD_NUM].\0\\$[\\n+[#ARG_NUM]]\ 
.                nr #HEAD_NUM \\n-[#HEAD_NUM]
.             \}
.             el \{\
.                as $TOC_HEAD_ITEM \\$[\\n+[#ARG_NUM]]\ 
.             \}
.          \}
.          el \{\
.             as $TOC_HEAD_ITEM \\$[\\n+[#ARG_NUM]]\ 
.          \}
.       \}
.\}
.\" Note the use of \!, which transparently embeds the macros used
.\" in the TOC_ENTRIES diversion.  The elements they control must be
.\" processed literally when the diversion is output.
.    ev TOC_EV
.    da TOC_ENTRIES
.    if \\n[#PRINT_STYLE]=1 \{\
\!.     fam C
\!.     ft  R
\!.     ps  12
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
\!.     FAMILY  \\*[$TOC_HEAD_FAM]
\!.     FT      \\*[$TOC_HEAD_FT]
\!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_HEAD_SIZE_CHANGE]
.    \}
\!.  TRAP OFF
.    ie \\n[#PRINT_STYLE]=1 \{\
\!.     PAD "\\h'2m'\\*[$TOC_HEAD_ITEM]\\*[$TOC_PN_TYPEWRITE]"
.    \}
.    el \{\
\!.     PAD "\\h'\\n[#TOC_HEAD_INDENT]u'\\*[$TOC_HEAD_ITEM]\\*[$TOC_PN]"
.    \}
\!.  EOL
\!.  ST 100 L
\!.  ST 101 R
.    if \\n[#PRINT_STYLE]=2 \{\
\!.     FAMILY  \\*[$TOC_PN_FAM]
\!.     FT      \\*[$TOC_PN_FT]
\!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_PN_SIZE_CHANGE]
.    \}
\!.  TAB 100
\!.  PRINT \\*[LEADER]
\!.  TN
\!.  TRAP
\!.  PRINT \\n[#TOC_ENTRY_PN]
\!.  TQ
.    di       
.    ev
.\" End collection of head for TOC
.\" Process head
.    nr #HEAD 1
.    ev HEAD
.    ll \\n[#L_LENGTH]u
.    ta \\n(.lu
.    if \\n[#COLUMNS] \{\
.       ll \\n[#COL_L_LENGTH]u
.       ta \\n(.lu
.    \}
.    CHECK_INDENT
.    QUAD \\*[$HEAD_QUAD]
.    if \\n[#PRINT_STYLE]=1 \{\
.       TYPEWRITER
.       vs  \\n[#DOC_LEAD]u
.       UNDERLINE OFF
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
.       FAMILY  \\*[$HEAD_FAM]
.       FT      \\*[$HEAD_FT]
.       PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$HEAD_SIZE_CHANGE]
.       LS      \\n[#DOC_LEAD]u
.    \}
.    if r#QUOTE             \{ .rr #QUOTE \}
.    if r#EPIGRAPH          \{ .rr #EPIGRAPH \}
.    if \\n[#PRINT_STYLE]=1 \{ .ne \\n[#NUM_ARGS]+2 \}
.    if \\n[#PRINT_STYLE]=2 \{\
.       ie \\n[#HEAD_SPACE] \{ .ne \\n[#NUM_ARGS]+3 \}
.       el \{ .ne \\n[#NUM_ARGS]+2 \}
.    \}
.    ie \\n[#START] \{\
.       if \\n[#DOC_HEADER]=0 \{ .RLD 1v \}
.    \}
.    el \{\
.       if \\n[#PRINT_STYLE]=1 \{\
.          if !\\n[#LINEBREAK] \{\
.             ALD \\n[#DOC_LEAD]u
.             if \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
.          \}
.       \}
.       if \\n[#PRINT_STYLE]=2 \{\
.          ie \\n[#PP_SPACE] \{\
.             ie \\n[#END_QUOTE] \{ . \}
.             el \{\
.                if !\\n[#LINEBREAK] \{\
.                   if \\n[#HEAD_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
.                \}
.             \}
.          \}
.          el \{\
.             ie \\n[#HEAD_SPACE] \{ .ALD \\n[#DOC_LEAD]u*2u \}
.             el \{ .ALD \\n[#DOC_LEAD]u \}
.          \}
.          if \\n[#END_QUOTE] \{\
.             if !\\n[#Q_FITS] \{\
.                RLD \\n[#DOC_LEAD]u
.                if \\n[#PP_ACTIVE] \{ .ALD \\n[#DOC_LEAD]u \}
.             \}
.             if \\n[#Q_AT_TOP] \{\
.                RLD \\n[#DOC_LEAD]u
.                if \\n[#Q_AT_TOP] \{ .ALD \\n[#DOC_LEAD]u \}
.             \}
.          \}
.          if \\n[#LINEBREAK] \{\
.             if \\n[#HEAD_SPACE] \{ .RLD \\n[#DOC_LEAD]u \}
.          \}
.       \}
.    \}
.\" Print head
.    nr #ARG_NUM 0 1
.    if \\n[#HEAD_CAPS] \{ .CAPS \}
.    if \\n[#PRINT_STYLE]=2 \{\
.       if \\n[#HEAD_COLOR]=1 \{\
.          TRAP OFF
.          COLOR \\*[$HEAD_COLOR]
.          EOL
.          TRAP
.       \}
.    \}
.    while \\n[#ARG_NUM]<\\n[#NUM_ARGS] \{\
.       ie \\n[#NUMBER_HEAD] \{\
.          ie \\n[#ARG_NUM]=0 \{\
.             br
.             ie \\n[#HEAD_UNDERLINE]=0 \{ .PRINT "\\n+[#HEAD_NUM].\0\\$[\\n+[#ARG_NUM]]\}
.             el \{ .UNDERSCORE "\\n+[#HEAD_NUM].\0\\$[\\n+[#ARG_NUM]]\}
.             br
.          \}
.          el \{\
.             br
.             ie \\n[#HEAD_UNDERLINE]=0 \{ .PRINT "\\$[\\n+[#ARG_NUM]]\}
.             el \{ .UNDERSCORE "\\$[\\n+[#ARG_NUM]]\}
.             br
.          \}
.       \}
.       el \{\
.          br
.          ie \\n[#HEAD_UNDERLINE]=0 \{ .PRINT "\\$[\\n+[#ARG_NUM]]\}
.          el \{ .UNDERSCORE "\\$[\\n+[#ARG_NUM]]\}
.          br
.       \}
.\}
.    REMOVE_INDENT
.    CAPS OFF
.    ev
.    ALD \\n[#DOC_LEAD]u
.    RESET_SUBHEAD_NUMBER
.    RESET_PARAHEAD_NUMBER
.    if r#START      \{ .rr #START     \}
.    if r#EPIGRAPH   \{ .rr #EPIGRAPH  \}
.    if r#QUOTE      \{ .rr #QUOTE     \}
.    if r#Q_FITS     \{ .rr #Q_FITS    \}
.    if r#END_QUOTE  \{ .rr #END_QUOTE \}
.    if r#LINEBREAK  \{ .rr #LINEBREAK \}
.    if r#Q_AT_TOP   \{ .rr #Q_AT_TOP  \}
.    if r#PP_ACTIVE  \{ .rr #PP_ACTIVE \}
.    rr #ARG_NUM
.    rm $TOC_HEAD_ITEM
.    nr #PP 0
.END
\#
\#
\# ---Subheads---
\#
\# SUBHEAD
\# -------
\# *Arguments:
\#   "text of subhead" ["text of subhead"] ...
\# *Function:
\#   In TYPEWRITE, prints subheads underlined.
\#   In TYPESET, prints subheads bold, .5 points larger than running
\#   text.
\#   In both styles, a line space precedes the subhead, and a small
\#   amount of lead comes after.
\# *Notes:
\#   As with the HEAD macro, double-quotes (") must surround
\#   each line of text.
\#
.MAC SUBHEAD END
.    br
.\" Collect subhead for TOC.
.    nr #ARG_NUM 0 1
.    nr #TOC_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
.    while \\n[#ARG_NUM]<\\n[#NUM_ARGS] \{\
.       ie \\n[#ARG_NUM]=\\n[#NUM_ARGS] \{\
.          as $TOC_SH_ITEM \\$[\\n+[#ARG_NUM]]\\|
.       \}
.       el \{\
.\" Note that in the .as lines, below, \ at the end has a literal
.\" space after it.
.          ie \\n[#NUMBER_SH] \{\
.             ie \\n[#ARG_NUM]=0 \{\
.                as $TOC_SH_ITEM \\n+[#SH_NUM].\0\\$[\\n+[#ARG_NUM]]\ 
.                nr #SH_NUM \\n-[#SH_NUM]
.             \}
.             el \{\
.                as $TOC_SH_ITEM \\$[\\n+[#ARG_NUM]]\ 
.             \}
.          \}
.          el \{\
.             as $TOC_SH_ITEM \\$[\\n+[#ARG_NUM]]\ 
.          \}
.       \}
.\}
.\" Note the use of \!, which transparently embeds the macros used
.\" in the TOC_ENTRIES diversion.  The elements they control must be
.\" processed literally when the diversion is output.
.    ev TOC_EV
.    da TOC_ENTRIES
.    if \\n[#PRINT_STYLE]=1 \{\
\!.     fam C
\!.     ft  R
\!.     ps  12
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
\!.     FAMILY  \\*[$TOC_SH_FAM]
\!.     FT      \\*[$TOC_SH_FT]
\!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_SH_SIZE_CHANGE]
.    \}
\!.  TRAP OFF
.    ie \\n[#PRINT_STYLE]=1 \{\
\!.     PAD "\\h'4m'\\*[$TOC_SH_ITEM]\\*[$TOC_PN_TYPEWRITE]"
.    \}
.    el \{\
\!.     PAD "\\h'\\n[#TOC_SH_INDENT]u'\\*[$TOC_SH_ITEM]\\*[$TOC_PN]"
.    \}
\!.  EOL
\!.  ST 100 L
\!.  ST 101 R
.    if \\n[#PRINT_STYLE]=2 \{\
\!.     FAMILY  \\*[$TOC_PN_FAM]
\!.     FT      \\*[$TOC_PN_FT]
\!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_PN_SIZE_CHANGE]
.    \}
\!.  TAB 100
\!.  PRINT \\*[LEADER]
\!.  TN
\!.  TRAP
\!.  PRINT \\n[#TOC_ENTRY_PN]
\!.  TQ
.    di       
.    ev
.\" End collection of head for TOC
.\" Process subhead
.    nr #ARG_NUM 0 1
.    if r#QUOTE    \{ .rr #QUOTE    \}
.    if r#Q_AT_TOP \{ .rr #Q_AT_TOP \}
.    ev SUBHEAD
.    ll \\n[#L_LENGTH]u
.    ta \\n(.lu
.    if \\n[#COLUMNS] \{\
.       ll \\n[#COL_L_LENGTH]u
.       ta \\n(.lu
.    \}
.    CHECK_INDENT
.    if \\n[#PRINT_STYLE]=1 \{\
.       TYPEWRITER
.       vs  \\n[#DOC_LEAD]u
.       QUAD   \\*[$SH_QUAD]
.       UNDERLINE OFF
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
.       FAMILY  \\*[$SH_FAM]
.       FT      \\*[$SH_FT]
.       PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$SH_SIZE_CHANGE]
.       LS      \\n[#DOC_LEAD]u
.       QUAD    \\*[$SH_QUAD]
.    \}
.    if \\n[#PRINT_STYLE]=1 \{ .nr #SH_LEAD_ADJUST \\n[#LEAD]/5 \}
.    if \\n[#PRINT_STYLE]=2 \{ .nr #SH_LEAD_ADJUST \\n[#LEAD]/8 \}
.    ie \\n[#START] \{ .RLD 1v \}
.    el \{\
.       ie ( \\n[#TRAP_DISTANCE] < (\\n[#DOC_LEAD]*(\\n[#NUM_ARGS]+1)) ) \{\
.          ie \\n[#COLUMNS] \{ .COL_NEXT \}
.          el \{ .bp \}
.       \}
.       el \{\
.          ie \\n[#HEAD]=1 \{ . \}
.          el \{\
.             if \\n[#PRINT_STYLE]=1 \{\
.                if !\\n[#LINEBREAK] \{ .ALD \\n[#DOC_LEAD]u \}
.             \}
.             if \\n[#PRINT_STYLE]=2 \{\
.                ie \\n[#PP_SPACE]=1 \{\
.                   ie !\\n[#LINEBREAK] \{ .ALD \\n[#DOC_LEAD]u \}
.                   el \{ .RLD \\n[#DOC_LEAD]u \}
.                \}
.                el \{\
.                   if !\\n[#LINEBREAK] \{ .ALD \\n[#DOC_LEAD]u \}
.                \}
.             \}
.          \}
.       \}
.    \}
.\" Print subhead
.    if \\n[#PRINT_STYLE]=1 \{\
.       while \\n[#ARG_NUM]<\\n[#NUM_ARGS] \{\
.          ie \\n[#NUMBER_SH] \{\
.             ie \\n[#ARG_NUM]=0 \{\
.                ie \\n[#NUMBER_HEAD] \{\
.                   br
.                   UNDERSCORE "\v'-\\n[#SH_LEAD_ADJUST]u'\\n[#HEAD_NUM].\\n+[#SH_NUM]\0\\$[\\n+[#ARG_NUM]]
.                   br
.                \}
.                el \{\
.                   br
.                   UNDERSCORE "\v'-\\n[#SH_LEAD_ADJUST]u'\\n+[#SH_NUM].\0\\$[\\n+[#ARG_NUM]]
.                   br
.                \}
.             \}
.             el \{\
.                br
.                ie \\n[#HEAD_UNDERLINE]=0 \{ .PRINT "\v'-\\n[#SH_LEAD_ADJUST]u'\\$[\\n+[#ARG_NUM]]\}
.                el \{ .UNDERSCORE "\v'-\\n[#SH_LEAD_ADJUST]u'\\$[\\n+[#ARG_NUM]]\}
.                br
.             \}
.          \}
.          el \{\
.             br
.             UNDERSCORE "\v'-\\n[#SH_LEAD_ADJUST]u'\\$[\\n+[#ARG_NUM]]
.             br
.          \}
.\}
.    \}
.    if \\n[#PRINT_STYLE]=1 \{\
.       if \\n[#SINGLE_SPACE] \{ .ALD \\n[#DOC_LEAD]u \}
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
.       if \\n[#SH_COLOR]=1 \{ .COLOR \\*[$SH_COLOR] \}
.       ie \\n[#PP_SPACE]=0 \{\
.          while \\n[#ARG_NUM]<\\n[#NUM_ARGS] \{\
.             ie \\n[#NUMBER_SH] \{\
.                ie \\n[#ARG_NUM]=0 \{\
.                   ie \\n[#NUMBER_HEAD] \{\
.                      br
.                      PRINT "\v'-\\n[#SH_LEAD_ADJUST]u'\\n[#HEAD_NUM].\\n+[#SH_NUM]\0\\$[\\n+[#ARG_NUM]]
.                      br
.                   \}
.                   el \{\
.                      br
.                      PRINT "\v'-\\n[#SH_LEAD_ADJUST]u'\\n+[#SH_NUM].\0\\$[\\n+[#ARG_NUM]]
.                      br
.                   \}
.                \}
.                el \{\
.                   br
.                   PRINT "\\v'-\\n[#SH_LEAD_ADJUST]u'\\$[\\n+[#ARG_NUM]]
.                   br
.                \}
.             \}
.             el \{\
.                br
.                PRINT "\\v'-\\n[#SH_LEAD_ADJUST]u'\\$[\\n+[#ARG_NUM]]
.                br
.             \}
.\}
.       \}
.       el \{\
.          ALD \\n[#DOC_LEAD]u
.          if \\n[#HEAD]=1      \{ .RLD \\n[#DOC_LEAD]u \}
.          if \\n[#END_QUOTE]   \{ .RLD \\n[#DOC_LEAD]u \}
.          if \\n[#EPIGRAPH]    \{ .RLD \\n[#DOC_LEAD]u \}
.          while \\n[#ARG_NUM]<\\n[#NUM_ARGS] \{\
.             PRINT "\\$[\\n+[#ARG_NUM]]
.\}
.          ALD \\n[#DOC_LEAD]u
.       \}
.    \}
.    REMOVE_INDENT
.    ev
.    RESET_PARAHEAD_NUMBER
.    if r#START     \{ .rr #START     \}
.    if r#EPIGRAPH  \{ .rr #EPIGRAPH  \}
.    if r#Q_FITS    \{ .rr #Q_FITS    \}
.    if r#END_QUOTE \{ .rr #END_QUOTE \}
.    if r#LINEBREAK \{ .rr #LINEBREAK \}
.    rm $TOC_SH_ITEM
.    nr #PP 0
.    nr #HEAD 2
.END
\#
\# ---Paragraph heads---
\#
\# PARAHEAD INDENT
\# ---------------
\# *Argument:
\#   <size of indent>
\# *Function:
\#   Creates or modifies register #PH_INDENT.
\# *Notes:
\#   Default is 1/2 #PP_INDENT for TYPESET and TYPEWRITE.
\#
.MAC PARAHEAD_INDENT END
.    nr #PH_INDENT (\\$1)
.END
\#
\#
\# PARAHEAD
\# --------
\# *Arguments:
\#   "<para head>"
\# *Function:
\#   Deposits a paragraph head at the start and into the body of a
\#   paragraph.
\# *Notes:
\#   PARAHEAD *must* come after PP.
\#
.MAC PARAHEAD END
.\" Collect parahead for TOC.
.    nr #TOC_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
.    ie \\n[#NUMBER_PH] \{\
.       ds $TOC_PH_ITEM \\n+[#PH_NUM].\0\\$1\\|
.       nr #PH_NUM \\n-[#PH_NUM]
.    \}
.    el \{\
.       ds $TOC_PH_ITEM \\$1\\|
.    \}
.    ev TOC_EV
.    da TOC_ENTRIES
.    if \\n[#PRINT_STYLE]=1 \{\
\!.       fam C
\!.       ft  R
\!.       ps  12
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
\!.     FAMILY  \\*[$TOC_PH_FAM]
\!.     FT      \\*[$TOC_PH_FT]
\!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_PH_SIZE_CHANGE]
.    \}
\!.  TRAP OFF
.    ie \\n[#PRINT_STYLE]=1 \{\
\!.     PAD "\\h'6m'\\*[$TOC_PH_ITEM]\\*[$TOC_PN_TYPEWRITE]" 
.    \}
.    el \{\
\!.     PAD "\\h'\\n[#TOC_PH_INDENT]u'\\*[$TOC_PH_ITEM]\\*[$TOC_PN]"
.    \}
\!.  EOL
\!.  ST 100 L
\!.  ST 101 R
.    if \\n[#PRINT_STYLE]=2 \{\
\!.     FAMILY  \\*[$TOC_PN_FAM]
\!.     FT      \\*[$TOC_PN_FT]
\!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_PN_SIZE_CHANGE]
.    \}
\!.  TAB 100
\!.  PRINT \\*[LEADER]
\!.  TN
\!.  TRAP
\!.  PRINT \\n[#TOC_ENTRY_PN]
\!.  TQ
.    di       
.    ev
.\" End collection of parahead for TOC
.\" Process parahead
.    if \\n[#SLANT_ON] \{\
.       nr #SLANT_WAS_ON 1
\E*[SLANTX]
.    \}
.    ie \\n[#PP]=1 \{\
.       if \\n[#INDENT_FIRST_PARAS] \{\
.          ti \\n[#PH_INDENT]u
.       \}
.    \}
.    el \{ .ti \\n[#PH_INDENT]u \}
.    if \\n[#PRINT_STYLE]=1 \{\
.       TYPEWRITER
.       UNDERLINE OFF
.       ie \\n[#NUMBER_PH] \{\
.          if \\n[#NUMBER_HEAD] \{\
.             ie \\n[#NUMBER_SH] \{\
.                UNDERSCORE "\R'#NUMBERED 1'\\n[#HEAD_NUM].\\n[#SH_NUM].\\n+[#PH_NUM].\\ \\$1"
\0
.             \}
.             el \{\
.                UNDERSCORE "\R'#NUMBERED 1'\\n[#HEAD_NUM].\\n+[#PH_NUM].\\ \\$1
\0
.             \}
.          \}
.          ie \\n[#NUMBER_SH] \{\
.             if !\\n[#NUMBERED] \{\
.                UNDERSCORE "\\n[#SH_NUM].\\n+[#PH_NUM].\\ \\$1
\0
.             \}
.          \}
.          el \{\
.             if !\\n[#NUMBERED] \{\
.                UNDERSCORE "\\n+[#PH_NUM].\\ \\$1
\0
.             \}
.          \}
.       \}
.       el \{\
.          UNDERSCORE "\\$1
\0
.       \}
.       if \\n[#SLANT_WAS_ON] \{\
.          if \\n[#UNDERLINE_SLANT] \{ .UNDERLINE \}
.          if \\n[#SLANT_MEANS_SLANT] \{\
\E*[SLANT]\c
.          \}
.          rr #SLANT_WAS_ON
.       \}
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
.       FAM     \\*[$PH_FAM]
.       FT      \\*[$PH_FT]
.       PT_SIZE \\*[$PH_SIZE_CHANGE]
.       if \\n[#PH_COLOR]=1 \{ .COLOR \\*[$PH_COLOR] \}
.          ie \\n[#NUMBER_PH] \{\
.             if \\n[#NUMBER_HEAD] \{\
.                ie \\n[#NUMBER_SH] \{\
.                   PRINT "\R'#NUMBERED 1'\\n[#HEAD_NUM].\\n[#SH_NUM].\\n+[#PH_NUM].\0\\$1\h'.6m'\c"
.                \}
.                el \{\
.                   PRINT "\R'#NUMBERED 1'\\n[#HEAD_NUM].\\n+[#PH_NUM].\0\\$1\h'.6m'\c"
.                \}
.             \}
.             ie \\n[#NUMBER_SH] \{\
.                if !\\n[#NUMBERED] \{\
.                   PRINT "\\n[#SH_NUM].\\n+[#PH_NUM].\0\\$1\h'.6m'\c"
.                \}
.             \}
.             el \{\
.                if !\\n[#NUMBERED] \{\
.                   PRINT "\\n+[#PH_NUM].\0\\$1\h'.6m'\c"
.                \}
.             \}
.          \}
.          el \{\
.             PRINT "\\$1\h'.6m'\c"
.          \}
.       \}
.    FAMILY  \\*[$DOC_FAM]
.    FT      \\*[$PP_FT]
.    PT_SIZE \\n[#DOC_PT_SIZE]u
.    if \\n[#PH_COLOR]=1 \m[]\c
.    if \\n[#SLANT_WAS_ON] \{\
.       rr #SLANT_WAS_ON
\E*[SLANT]\c
.    \}
.    rr #NUMBERED
.    rm $TOC_PH_ITEM
.END
\#
\#
\# ====================================================================
\#
\# +++LINE BREAKS+++
\#
\# LINEBREAK CHARACTER
\# -------------------
\# *Arguments:
\#   [character] [iterations] [vertical adjustment]
\# *Function:
\#   Allows user to specify a line break character and the number
\#   of times to repeat it horiontally.
\# *Notes:
\#   Without an argument, LINEBREAK_CHAR will deposit a blank line.
\#
\#   Vertical adjustment requires a unit of measure (most likely
\#   "p"), and has to be preceded by +|-
\#
.MAC LINEBREAK_CHAR END
.    nr #REPEAT 1
.    ds $LINEBREAK_CHAR \\$1
.    ds $LINEBREAK_CHAR_V_ADJ \\$3
.    if '\\*[$LINEBREAK_CHAR_V_ADJ]'' \{\
.       ds $LINEBREAK_CHAR_V_ADJ +0
.    \}
.    while \\$2>\\n[#REPEAT] \{\
.       as $LINEBREAK_CHAR "\\ \\$1
.       nr #REPEAT \\n[#REPEAT]+1
.\}
.   rr #REPEAT
.END
\#
\#
\# LINE BREAK
\# ----------
\# *Arguments:
\#   <none>
\# *Function:
\#   Deposits line break character.
\# *Notes:
\#   If $LINEBREAK_CHAR is blank, simply advances 2 line spaces.
\#
.MAC LINEBREAK END
.    if r#Q_AT_TOP \{ .rr #Q_AT_TOP \}
.    po \\n[#DOC_L_MARGIN]u
.    ie  '\\*[$LINEBREAK_CHAR]'' \{ .ALD \\n[#DOC_LEAD]u*2 \}
.    el \{\
.       if \\n[#PRINT_STYLE]=1 \{\
.          ie \\n[#END_QUOTE] \{ . \}
.          el \{ .ALD \\n[#DOC_LEAD]u \}
.       \}
.       if \\n[#PRINT_STYLE]=2 \{\
.          ie \\n[#END_QUOTE] \{ . \}
.          el \{ .ALD \\n[#DOC_LEAD]u \}
.       \}
.       ev LINEBREAK
.       evc 0
.       CENTER
.       PRINT \m[\\*[$LINEBREAK_COLOR]]\\v'\\*[$LINEBREAK_CHAR_V_ADJ]'\\*[$LINEBREAK_CHAR]\\v'\\*[$LINEBREAK_CHAR_V_ADJ]'\m[]
.       if \\n[#PRINT_STYLE]=1 \{ .ALD \\n[#DOC_LEAD]u \}
.       if \\n[#PRINT_STYLE]=2 \{ .ALD \\n[#DOC_LEAD]u \}
.       ev
.       QUAD \\*[$DOC_QUAD]
.    \}
.    nr #LINEBREAK 1
.    if r#QUOTE     \{ .rr #QUOTE     \}
.    if r#END_QUOTE \{ .rr #END_QUOTE \}
.    nr #PP 0
.END
\#
\# ====================================================================
\#
\# +++PARAGRAPHS+++
\#
\# PARAGRAPH FONT
\# --------------
\# *Argument:
\#   <font of running text>
\# *Function:
\#   Creates or modifies string $PP_FT.
\# *Notes:
\#   Affects all paragraphs.
\#
.MAC PP_FONT END
.    if \\n[#IGNORE] \{ .return \}
.    br
.    ds $PP_FT \\$1
.    FT \\*[$PP_FT]
.END
\#
\#
\# PARAGRAPH INDENT
\# ----------------
\# *Argument:
\#   <amount to indent paragraphs in running text (ipPcm)>
\# *Function:
\#   Allows user to change the default para indent.  The change will
\#   affect the indent of QUOTEs and BLOCKQUOTEs as well.
\# *Notes:
\#   Default for printstyle TYPEWRITE is 1/2-inch.  Default for
\#   printstyle TYPESET is 2 ems.  The defaults are set in
\#   PRINTSTYLE, not DEFAULTS.
\#
.MAC PARA_INDENT END
.    nr #PP_INDENT (\\$1)
.END
\#
\#
\# INDENT FIRST PARAGRAPHS
\# -----------------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   By default, the first para of a document, as well as the first
\#   paras of blockquotes and block-style epigraphs are not indented.
\#   When invoked, this macro will indent all paras.
\# *Notes:
\#   Default is OFF.
\#
.MAC INDENT_FIRST_PARAS END
.    ie '\\$1'' \{ .nr #INDENT_FIRST_PARAS 1 \}
.    el \{ .rr #INDENT_FIRST_PARAS   \}
.END
\#
\#
\# INTER-PARAGRAPH SPACING
\# -----------------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Adds a line space between paragraphs in body text.  Block quotes
\#   are unaffected.
\# *Notes:
\#   Default is OFF.  PARA_SPACE ON is not recommended for use
\#   with PRINTSTYLE TYPEWRITE.
\#
.MAC PARA_SPACE END
.    ie '\\$1'' \{ .nr #PP_SPACE 1 \}
.    el \{ .rr #PP_SPACE   \}
.END
\#
\#
\# PARAGRAPH
\# ---------
\# *Arguments:
\#   <none>
\# *Function:
\#   Figures out what to do with paragraphs under differing conditions.
\# *Notes:
\#   For the time being, there's no automatic widow/orphan control.
\#   Controlling them isn't just a matter of establishing an arbitrary
\#   number of lines needed for a para, since groff doesn't then
\#   handle single line paragraphs gracefully.  Usually, the whole
\#   page needs to be tweaked.
\#
\#   Note the use of transparent line break (\!.br) to get
\#   PP to work within blockquotes and epigraphs.
\#
\#   PP_STYLE 1 = regular paras; 2 = blockquotes, epigraphs
\#
.MAC PP END
.    br
.    if \\n[#DOC_TYPE]=4 \{\
.       if !'\\n(.z'' \{ .di \}
.       nr #TOTAL_FIELDS \\n[#FIELD]
.       nr #FIELD        0 1
.       nr #NUM_FIELDS   0 1
.       if \\n[#TOTAL_FIELDS]>0 \{\
.          while \\n+[#NUM_FIELDS]<=\\n[#TOTAL_FIELDS] \{\
.             nf
.             LETTERHEAD\\n+[#FIELD]
.             QUAD \\*[$DOC_QUAD]
.             ALD \\n[#DOC_LEAD]u
.             if \\n[#DATE_FIRST]=1 \{ .ALD \\n[#DOC_LEAD]u \}
.             rr #DATE_FIRST
.             rm LETTERHEAD\\n[#FIELD]
.\}
.          rr #FIELD
.          rr #NUM_FIELDS
.          rr #TOTAL_FIELDS
.       \}
.    \}
.    rr #PP_ACTIVE
.    if r#Q_AT_TOP \{ .rr #Q_AT_TOP \}
.    if \\n[#PP_STYLE]=1 \{\
.       if \\n[#ENDNOTE] \{\
.          nr #RESET_PARA_SPACE \\n[#PP_SPACE]
.          ie \\n[#EN_PP_SPACE] \{ .PARA_SPACE \}
.          el \{ .PARA_SPACE OFF \}
.       \}
.       br
.       if !\\n[#ENDNOTE] \{ .po \\n[#L_MARGIN]u \}
.       if \\n[#COLUMNS] \{\
.          if !\\n[#ENDNOTE] \{\
.             po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
.             nr #L_MARGIN \\n(.o
.          \}
.       \}
.       if \\n[#TAB_ACTIVE] \{ .TAB \\n[#CURRENT_TAB] \}
.       ie \\n[#PRINT_STYLE]=1 \{\
.          TYPEWRITER
.          ie \\n[#ENDNOTE] \{ .vs \\n[#EN_LEAD]u \}
.          el \{ .vs \\n[#DOC_LEAD]u \}
.          QUAD \\*[$DOC_QUAD]
.          UNDERLINE OFF
.          if \\n[#SLANT_ON] \{\
.             if \\n[#UNDERLINE_SLANT] \{ .UNDERLINE \}
.          \}
.       \}
.       el \{\
.          ie \\n[#ENDNOTE] \{\
.             FAMILY  \\*[$EN_FAM]
.             FT      \\*[$EN_FT]
.             PT_SIZE \\n[#EN_PS]u
.             vs      \\n[#EN_LEAD]u
.             QUAD    \\*[$EN_QUAD]
.          \}
.          el \{\
.             FAMILY  \\*[$DOC_FAM]
.             FT      \\*[$PP_FT]
.             PT_SIZE \\n[#DOC_PT_SIZE]u
.             LS      \\n[#DOC_LEAD]u
.             QUAD    \\*[$DOC_QUAD]
.          \}
.       \}
.       ie \\n[#PP]=0 \{\
.          if \\n[#INDENT_FIRST_PARAS] \{\
.             ie \\n[#INDENT_ACTIVE] \{ .ti \\n[#INDENT]u+\\n[#PP_INDENT]u \}
.             el \{ .ti \\n[#PP_INDENT]u \}
.             if '\\n(.z'END_NOTES' \{\
.                ti \\n[#EN_PP_INDENT]u+\\n[#EN_TEXT_INDENT]u
.             \}
.          \}
.          if r#END_QUOTE \{\
.             if \\n[#END_QUOTE] \{\
.                if !\\n[#LINEBREAK] \{\
.                   ie \\n[#INDENT_ACTIVE] \{ .ti \\n[#INDENT]u+\\n[#PP_INDENT]u \}
.                   el \{ .ti \\n[#PP_INDENT]u \}
.                   if '\\n(.z'END_NOTES' \{\
.                      ti \\n[#EN_PP_INDENT]u+\\n[#EN_TEXT_INDENT]u
.                   \}
.                \}
.             \}
.          \}
.       \}
.       el \{\
.          br
.          if \\n[#PP_SPACE] \{\
.             if \\n[#PRINT_STYLE]=2 \{\
.                ie \\n[#END_QUOTE] \{\
.                   ALD \\n[#DOC_LEAD]u
.                   rr #END_QUOTE
.                   nr #NO_SPACE 1
.                   nr #BASELINE_MARK \\n(nl
.                \}
.                el \{\
.                   if \\n[#NO_SPACE]=1 \{\
.                      rr #NO_SPACE
.                   \}
.                   if !\\n(nl=\\n[#BASELINE_MARK] \{\
.                      ALD \\n[#DOC_LEAD]u
.                      rr #BASELINE_MARK
.                   \}
.                \}
.             \}
.          \}
.          ie \\n[#INDENT_ACTIVE] \{ .ti \\n[#INDENT]u+\\n[#PP_INDENT]u \}
.          el \{ .ti \\n[#PP_INDENT]u \}
.          if '\\n(.z'END_NOTES' \{\
.             ti \\n[#EN_PP_INDENT]u+\\n[#EN_TEXT_INDENT]u
.          \}
.       \}
.       if r#START     \{ .rr #START     \}
.       if r#QUOTE     \{ .rr #QUOTE     \}
.       if r#END_QUOTE \{ .rr #END_QUOTE \}
.       if r#HEAD      \{ .rr #HEAD      \}
.       if r#EPIGRAPH  \{ .rr #EPIGRAPH  \}
.       if r#Q_FITS    \{ .rr #Q_FITS    \}
.       if r#LINEBREAK \{ .rr #LINEBREAK \}
.       if \\n[#ENDNOTE] \{\
.          ie \\n[#RESET_PARA_SPACE] \{ .PARA_SPACE \}
.          el \{ .PARA_SPACE OFF \}
.       \}
.       if \\n[#CONDENSE] \{\
\E*[COND]\c
.       \}
.       if \\n[#EXTEND]=1 \{\
\E*[EXT]\c
.       \}
.       nr #PP +1
.    \}
.    if \\n[#PP_STYLE]=2 \{\
\!.     br
.       if \\n[#BROKEN_QUOTE] \{\
.          ie \\n(nl=\\n[#PAGE_TOP] \{ .nr #Q_PP 1 \}
.          el \{ .nr #Q_PP 0 \}
.          rr #BROKEN_QUOTE
.       \}
.       ie \\n[#Q_PP]=0 \{\
.          if \\n[#INDENT_FIRST_PARAS] \{\
.             ti \\n[#PP_INDENT]u/2u
.          \}
.          if \\n[#ENDNOTE] \{\
.             ie \\n[#INDENT_FIRSTS] \{ .ti \\n[#PP_INDENT]u/2u \}
.             el \{ .ti 0 \}
.          \}
.       \}
.       el \{\
.          ti \\n[#PP_INDENT]u/2u
.       \}
.       if \\n[#CONDENSE] \{\
\E*[COND]\c
.       \}
.       if \\n[#EXTEND]=1 \{\
\E*[EXT]\c
.       \}
.    nr #Q_PP +1
.    \}
.    nr #PP_ACTIVE 1
.END
\#
\# ====================================================================
\#
\# +++QUOTES+++
\#
\# ---Line for line quotes, i.e. poetry or code snippets---
\#
\# UNDERLINE QUOTES
\# ----------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Creates or modifies register #UNDERLINE_QUOTES (toggle).
\#   If on, line for line quotes are underlined when printstyle
\#   is TYPEWRITE.
\# *Notes:
\#   Default is ON for printstyle TYPEWRITE.
\#
.MAC UNDERLINE_QUOTES END
.    ie '\\$1'' \{ .nr #UNDERLINE_QUOTES 1 \}
.    el \{ .rr #UNDERLINE_QUOTES   \}
.END
\#
\#
\# QUOTE INDENT
\# ------------
\# *Argument:
\#   <value by which to multiply PP_INDENT for indented quoted text>
\# *Function:
\#   Creates or modifies register #Q_OFFSET_VALUE.
\# *Notes:
\#   Default is 3 for typeset; 2 for typewrite
\#
.MAC QUOTE_INDENT END
.    nr #Q_OFFSET_VALUE \\$1
.END
\#
\#
\# QUOTE_AUTOLEAD
\# --------------
\# *Arguments:
\#   <autolead value>
\# *Function:
\#   Sets autolead for quotes and/or blockquotes.
\#
.MAC QUOTE_AUTOLEAD END
.    if '\\$0'QUOTE_AUTOLEAD'      \{ .nr #Q_AUTOLEAD \\$1 \}
.    if '\\$0'BLOCKQUOTE_AUTOLEAD' \{ .nr #BQ_AUTOLEAD \\$1 \}
.    if '\\$0'ENDNOTE_QUOTE_AUTOLEAD'      \{ .nr #EN_Q_AUTOLEAD \\$1 \}
.    if '\\$0'ENDNOTE_BLOCKQUOTE_AUTOLEAD' \{ .nr #EN_BQ_AUTOLEAD \\$1 \}
.END
\#
.ALIAS BLOCKQUOTE_AUTOLEAD         QUOTE_AUTOLEAD
.ALIAS ENDNOTE_QUOTE_AUTOLEAD      QUOTE_AUTOLEAD
.ALIAS ENDNOTE_BLOCKQUOTE_AUTOLEAD QUOTE_AUTOLEAD
\#
\# ALWAYS FULLSPACE QUOTES
\# -----------------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Toggles register #FULLSPACE_QUOTES.
\# *Notes:
\#   If user doesn't like the default 1/2 line space above and below
\#   quotes, s/he can turn it off here.  Has no effect in TYPEWRITE.
\#
.MAC ALWAYS_FULLSPACE_QUOTES END
.    if '\\$1'' \{ .nr #FULLSPACE_QUOTES 1 \}
.    el \{ .rr #FULLSPACE_QUOTES \}
.END
\#
\#
\# QUOTE
\# -----
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Indents quoted text on a line for line basis, or turns QUOTE off.
\# *Notes:
\#   Owing to the need to bottom align TYPESET pages, quoted text gets
\#   diverted so its depth can be measured (in DO_QUOTE) for determining
\#   how much space to put before and after.
\#
.MAC QUOTE END
.    br
.    if \\n[#LINENUMBERS]=1 \{\
.       nr #LINENUMBERS 2
.       nr #NEXT_LN \\n(ln
.       nm
.    \}
.    ie '\\$1'' \{\
.       ev QUOTE
.       if \\n[#LINENUMBERS]=2 \{\
.          if \\n[#SILENT_QUOTE_LN]=1 \{ .nm \\n[#NEXT_LN] 1000 -4 \}
.       \}
.       nr #IN_DIVER 1
.       nr #QUOTE 1
.       di P_QUOTE
.       ll \\n[#L_LENGTH]u-(\\n[#PP_INDENT]u*\\n[#Q_OFFSET_VALUE]u)
.       if \\n[#LINENUMBERS]=2 \{\
.          if \\n[#QUOTE_LN]=1 \{\
.             nm \\n(ln "" \\*[$Q_LN_GUTTER] -3-\\*[$Q_LN_GUTTER]
.          \}
.       \}
.       ta \\n(.lu
.       if \\n[#COLUMNS] \{\
.          ll \\n[#COL_L_LENGTH]u-(\\n[#PP_INDENT]u*\\n[#Q_OFFSET_VALUE]u)
.          ta \\n(.lu
.       \}
.       if \\n[#PRINT_STYLE]=1 \{\
.          TYPEWRITER
.          vs \\n[#DOC_LEAD]u
.          LEFT
.       \}
.       if \\n[#PRINT_STYLE]=2 \{\
.          FAMILY  \\*[$QUOTE_FAM]
.          FT      \\*[$QUOTE_FT]
.          PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$QUOTE_SIZE_CHANGE]
.          ie !r#Q_AUTOLEAD  \{ .LS \\n[#Q_LEAD]u \}
.          el \{\
.             AUTOLEAD \\n[#Q_AUTOLEAD]
.             nr #Q_LEAD \\n(.v
.          \}
.          if \\n[#ENDNOTE] \{\
.             PT_SIZE \\n[#EN_PS]u\\*[$QUOTE_SIZE_CHANGE]
.             ie !r#EN_Q_AUTOLEAD  \{ .LS \\n[#EN_Q_LEAD]u \}
.             el \{\
.                AUTOLEAD \\n[#EN_Q_AUTOLEAD]
.                nr #EN_Q_LEAD \\n(.v
.             \}
.          \}
.          nr #Q_LEAD_REAL \\n(.v
.          LEFT
.          if \\n[#QUOTE_COLOR]=1 \{\
.             nf
\m[\\*[$QUOTE_COLOR]]
.             EOL
.          \}
.       \}
.       if \\n[#LINENUMBERS]=2 \{\
.          ie \\n[#QUOTE_LN]=1 \{\
.             if '\\*[$Q_LN_GUTTER]'' .ds $Q_LN_GUTTER \\*[$LN_GUTTER]
.             nm \\n(ln "" \\*[$Q_LN_GUTTER] -3-\\*[$Q_LN_GUTTER]
.          \}
.          el \{\
.             if !\\n[#SILENT_QUOTE_LN] \{ .NUMBER_LINES OFF \}
.          \}
.       \}
.       nr #Q_TOP \\n(nl
.       if \\n[#PRINT_STYLE]=1 \{\
.          if \\n[#UNDERLINE_QUOTES] \{\
.               FT I
.          \}
.       \}
.    \}
.    el \{ .DO_QUOTE \}
.END
\#
\# ---Blockquotes---
\#
\# BLOCKQUOTE
\# ----------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Indents quoted text in fill mode and shortens line length
\#   equivalently, or turns BLOCKQUOTE off.
\# *Notes:
\#   Owing to the need to bottom align TYPESET pages, quoted text gets
\#   diverted so its depth can be measured (in DO_QUOTE) for determining
\#   how much space to put before and after.
\#
\#   .PP after blockquote is optional if there's only one para,
\#   but REQUIRED if there's more than one.
\#
.MAC BLOCKQUOTE END
.    br
.    if \\n[#LINENUMBERS]=1 \{\
.       nr #LINENUMBERS 2
.       nr #NEXT_LN \\n(ln
.       nm
.    \}
.    ie '\\$1'' \{\
.       ev BLOCKQUOTE
.       if \\n[#LINENUMBERS]=2 \{\
.          if \\n[#SILENT_BQUOTE_LN]=1 \{ .nm \\n[#NEXT_LN] 1000 -4 \}
.       \}
.       nr #IN_DIVER 1
.       nr #QUOTE    2
.       nr #PP_STYLE 2
.       nr #Q_PP     0
.       di B_QUOTE
.       ll \\n[#L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#Q_OFFSET_VALUE]u*2u))
.       if \\n[#ENDNOTE] \{\
.          if \\n[#EN_NUMBERS_ALIGN_RIGHT] \{\
.             ll \\n[#RESET_L_LENGTH]u-\\n[#EN_TEXT_INDENT]u-(\\n[#EN_PP_INDENT]u*(\\n[#Q_OFFSET_VALUE]u*2u))
.          \}
.          if \\n[#EN_NUMBERS_ALIGN_LEFT] \{\
.             ll \\n[#L_LENGTH]u-(\\n[#EN_PP_INDENT]u*(\\n[#Q_OFFSET_VALUE]u*2u))
.          \}
.       \}
.       ta \\n(.lu
.       CHECK_INDENT
.       if \\n[#COLUMNS] \{\
.          ll \\n[#COL_L_LENGTH]u-(\\n[#PP_INDENT]u*(\\n[#Q_OFFSET_VALUE]u*2u))
.          if \\n[#ENDNOTE] \{\
.             if \\n[#EN_NUMBERS_ALIGN_RIGHT] \{\
.                ll \\n[#RESET_L_LENGTH]u-\\n[#EN_TEXT_INDENT]u-(\\n[#EN_PP_INDENT]u*(\\n[#Q_OFFSET_VALUE]u*2u))
.             \}
.             if \\n[#EN_NUMBERS_ALIGN_LEFT] \{\
.                ll \\n[#COL_L_LENGTH]u-(\\n[#EN_PP_INDENT]u*(\\n[#Q_OFFSET_VALUE]u*2u))
.             \}
.          \}
.          ta \\n(.lu
.       \}
.       if \\n[#PRINT_STYLE]=1 \{\
.          TYPEWRITER
.          vs \\n[#DOC_LEAD]u
.          QUAD LEFT
.          HY OFF
.       \}
.       if \\n[#PRINT_STYLE]=2 \{\
.          FAMILY  \\*[$BQUOTE_FAM]
.          FT      \\*[$BQUOTE_FT]
.          PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$BQUOTE_SIZE_CHANGE]
.          ie !\\n[#BQ_AUTOLEAD] \{ .LS \\n[#BQ_LEAD]u \}
.          el \{\
.             AUTOLEAD \\n[#BQ_AUTOLEAD]
.             nr #BQ_LEAD \\n(.v
.          \}
.          if \\n[#ENDNOTE] \{\
.             PT_SIZE \\n[#EN_PS]u\\*[$BQUOTE_SIZE_CHANGE]
.             ie !r#EN_BQ_AUTOLEAD  \{ .LS \\n[#EN_BQ_LEAD]u \}
.             el \{\
.                AUTOLEAD \\n[#EN_BQ_AUTOLEAD]
.                nr #EN_BQ_LEAD \\n(.v
.             \}
.          \}
.          nr #Q_LEAD_REAL \\n(.v
.          if \\n[#BQUOTE_COLOR]=1 \{\
.             nf
\m[\\*[$BQUOTE_COLOR]]
.             EOL
.          \}
.          QUAD \\*[$BQUOTE_QUAD]
.          nr #DIVERSIONS_HY_MARGIN (p;\\n[.ps]u*2.75)/1000
.          HY_SET 1 \\n[#DIVERSIONS_HY_MARGIN]u (\\n[#PT_SIZE]u/1000u/8u)p
.          hy 14
.       \}
.       if \\n[#LINENUMBERS]=2 \{\
.          ie \\n[#BQUOTE_LN]=1 \{\
.             if '\\*[$BQ_LN_GUTTER]'' .ds $BQ_LN_GUTTER \\*[$LN_GUTTER]
.             nm \\n(ln "" \\*[$BQ_LN_GUTTER] -3-\\*[$BQ_LN_GUTTER]
.          \}
.          el \{\
.             if !\\n[#SILENT_BQUOTE_LN] \{ .NUMBER_LINES OFF \}
.          \}
.       \}
.       nr #Q_TOP \\n(nl
.       if \\n[#INDENT_FIRST_PARAS] \{\
.          ie !\\n[#ENDNOTE] \{\
.             if \\n[#PRINT_STYLE]=1 \{ .ti \\n[#PP_INDENT]u/2u \}
.             if \\n[#PRINT_STYLE]=2 \{ .ti \\n[#PP_INDENT]u/2u \}
.          \}
.          el \{\
.             if \\n[#INDENT_FIRSTS]=1 \{\
.                if \\n[#PRINT_STYLE]=1 \{ .ti \\n[#EN_PP_INDENT]u/2u \}
.                if \\n[#PRINT_STYLE]=2 \{ .ti \\n[#EN_PP_INDENT]u/2u \}
.             \}
.          \}
.       \}
.    \}
.    el \{ .DO_QUOTE \}
.END
\#
\#
\# DO QUOTE
\# --------
\# *Arguments:
\#   <none>
\# *Function:
\#   Ends the diversion P_QUOTE or B_QUOTE.  Spaces them according to
\#   PRINTSTYLE, whether there's inter-paragraph spacing, and page
\#   position.  TYPEWRITE treats spacing the same way in all circumstance
\#   (viz. an extra line space).  TYPESET puts in only half
\#   line spaces if the entire quote plus 1 line of body under the quote
\#   fits on the the page; otherwise it puts in a full extra blank
\#   line.  (This is to ensure the page remains bottom aligned).
\#
.MAC DO_QUOTE END
.    br
.    if \\n[#DIVER_LN_OFF] \{\
\!.     NUMBER_LINES OFF
.       rr #DIVER_LN_OFF
.    \}
.    di
.    rr #IN_DIVER
.    if \\n[#RESET_FN_COUNTERS]=2 \{\
.       if !\\n[#FN_COUNT]=1 \{\
.          if ((\\n[#PAGE_LENGTH]+\\n[#VARIABLE_FOOTER_POS])+\\n[#DIVER_DEPTH])>(\\n[#PAGE_LENGTH]+\\n[#VARIABLE_FOOTER_POS]) \{\
.             DIVER_FN_2_POST
.             rr #RESET_FN_COUNTERS
.          \}
.       \}
.    \}
.    nr #SAVED_FN_NUMBER \\n[#FN_NUMBER]
.    nr #DONE_ONCE 0 1
.    REMOVE_INDENT
.    ev
.    nr #Q_DEPTH (\\n[#DIVER_DEPTH]-\\n[#Q_LEAD_REAL])+\\n[#LEAD]
.    nr #Q_LEAD_DIFF \\n[#LEAD]-\\n[#Q_LEAD_REAL]
.    SILENT
.    br
.    nf
.    nr #CURRENT_V_POS \\n(nl+\\n[#Q_LEAD_DIFF]+(\\n[#DIVER_DEPTH]-\\n[#Q_DEPTH_REAL])
.    SHIM
.    SILENT OFF
.    nr #Q_SPACE_ADJ \\n[#SHIM]/2
.    nr #TRAP \\n(.t-1
.    if \\n[#ENDNOTE] \{\
.       nr #RESET_QUOTE_SPACING \\n[#FULLSPACE_QUOTES]
.       ALWAYS_FULLSPACE_QUOTES
.    \}
.    if \\n[#PRINT_STYLE]=1 \{\
.       if \\n[#START]=1 \{ . \}
.       if \\n[#START]=0 \{\
.          if !\\n[#LINEBREAK] \{ .ALD \\n[#DOC_LEAD]u \}
.       \}
.       if \\n[#HEAD] \{\
.          if \\n[#HEAD]=1 \{ .RLD \\n[#DOC_LEAD]u \}
.       \}
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
.       ie \\n[#PP_SPACE] \{\
.          ie \\n[#HEAD]>0 \{ . \}
.          el \{\
.             ie \\n[#START] \{ . \}
.             el \{ .ALD \\n[#DOC_LEAD]u \}
.          \}
.       \}
.       el \{\
.          ie \\n[#Q_DEPTH]<(\\n[#TRAP_DISTANCE]-1) \{\
.             ie (\\n[#TRAP_DISTANCE]-1)-\\n[#Q_DEPTH]<\\n[#DOC_LEAD] \{\
.                Q_NOFIT
.             \}
.             el \{\
.                Q_FITS
.             \}
.          \}
.          el \{\
.             Q_NOFIT
.          \}
.       \}
.    \}
.    nr #Q_OFFSET \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE])
.    if \\n[#COLUMNS] \{\
.       nr #Q_OFFSET \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE])
.    \}
.    if !\\n[#ENDNOTE] \{ .po \\n[#Q_OFFSET]u \}
.    if \\n[#ENDNOTE] \{\
.       in +\\n[#EN_PP_INDENT]u*\\n[#Q_OFFSET_VALUE]u
.    \}
.    ie \\n[#START]=1 \{\
.       ie !\\n[#Q_LEAD_DIFF]<0 \{ .ALD \\n[#Q_SPACE_ADJ]u \}
.       el \{ .RLD 0-\\n[#Q_LEAD_DIFF]u \}
.    \}
.    el \{\
.       ALD \\n[#Q_SPACE_ADJ]u
.    \}
.    if \\n[#QUOTE]=1 \{\
.       nf
.       P_QUOTE
.       if !\\n[#START] \{ .rr #QUOTE \}
.    \}
.    if \\n[#QUOTE]=2 \{\
.       nf
.       B_QUOTE
.    \}
.    if \\n[#PRINT_STYLE]=1 \{\
.       ALD \\n[#DOC_LEAD]u
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
.       ie \\n[#START] \{\
.          ie \\n[#PP_SPACE] \{\
.
.          \}
.          el \{\
.             ALD \\n[#DOC_LEAD]u
.             SHIM
.          \}
.       \}
.       el \{\
.          ie \\n[#PP_SPACE] \{ . \}
.          el \{\
.             ie \\n[#HEAD]=1 \{\
.                ALD \\n[#DOC_LEAD]u
.                SHIM
.             \}
.             el \{\
.                ie \\n[#FULLSPACE_QUOTES] \{\
.                   ie \\n[#ENDNOTE] \{ .ALD \\n[#EN_LEAD]u \}
.                   el \{ .ALD \\n[#DOC_LEAD]u \}
.                \}
.                el \{ .ALD (\\n[#DOC_LEAD]u/2u) \}
.                ie \\n[#Q_FITS] \{\
.                   ie \\n[#Q_TOP]=\\n[#PAGE_TOP] \{\
.                      nr #Q_AT_TOP 1
.                      nr #DELAY_SHIM 1
.                   \}
.                   el \{ .SHIM \}
.                \}
.                el \{\
.                   SHIM
.\" Make sure that Q_LEAD_DIFF is not added to the first line of
.\" normal text at the top of any page following output of a quote
.\" whose last line falls on B_MARGIN of the previous page.
.                   if \\n(nl=(\\n[#T_MARGIN]-\\n[#DOC_LEAD]+\\n[#Q_LEAD_DIFF]) \{\
.                      PRINT \&
.                      br
.                      sp -1v-\\n[#Q_LEAD_DIFF]u
.                   \}
.                \}
.             \}
.          \}
.       \}
.    \}
.    if \\n[#LINENUMBERS]=2 \{\
.       nr #LINENUMBERS 1
.       ie \\n[#RESTORE_LN_NUM]=1 \{ .nm \\n[#NEXT_LN] \}
.       el \{ .nm +0 \}
.    \}
.    if \\n[#ENDNOTE] \{ .nr #FULLSPACE_QUOTES \\n[#RESET_QUOTE_SPACING] \}
.    if r#HEAD        \{ .rr #HEAD     \}
.    if r#EPIGRAPH    \{ .rr #EPIGRAPH \}
.    rr #Q_PP
.    rr #LINEBREAK
.    nr #PP_STYLE  1
.    nr #END_QUOTE 1
.    if !\\n[#ENDNOTE] \{ .po \\n[#L_MARGIN]u \}
.    if \\n[#ENDNOTE] \{\
.       in \\n[#EN_TEXT_INDENT]u
.    \}
.    if \\n[#COLUMNS] \{\
.       if !\\n[#ENDNOTE] \{\
.          po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
.          nr #L_MARGIN \\n(.o
.       \}
.       if \\n[#ENDNOTE] \{\
.          in \\n[#EN_TEXT_INDENT]u
.       \}
.    \}
.    ie !\\n[#ENDNOTE] \{\
.       nr #RESET_PP_INDENT \\n[#PP_INDENT]
.       PARA_INDENT 0
.       PP
.       PARA_INDENT \\n[#RESET_PP_INDENT]u
.       QUAD \\*[$DOC_QUAD]
.    \}
.    el \{\
.       nr #RESET_EN_PP_INDENT \\n[#EN_PP_INDENT]
.       ENDNOTE_PARA_INDENT 0
.       PP
.       ENDNOTE_PARA_INDENT \\n[#RESET_EN_PP_INDENT]u
.       QUAD \\*[EN_QUAD]
.    \}
.    if r#DELAY_SHIM \{\
.       SHIM
.       rr #DELAY_SHIM
.    \}
.END
\#
\#
\# Utility macros for DO_QUOTE
\# ---------------------------
\#
.MAC Q_FITS END
.    nr #Q_FITS 1
.    ie \\n[#HEAD]=1 \{\
.       ALD \\n[#Q_LEAD_DIFF]u
.    \}
.    el \{\
.       ie \\n[#START] \{ . \}
.       el \{\
.          ie \\n[#FULLSPACE_QUOTES] \{\
.             ie \\n[#ENDNOTE] \{ .ALD \\n[#EN_LEAD]u+\\n[#Q_LEAD_DIFF]u \}
.             el \{ .ALD \\n[#DOC_LEAD]u+\\n[#Q_LEAD_DIFF]u \}
.          \}
.          el \{\
.\" This seems to be the only way to get the baseline of quotes that start
.\" at the top of the page to fall on the first line of the "grid" (i.e on
.\" the first legal baseline of the page).
.             ie \\n[#Q_TOP]=\\n[#PAGE_TOP] \{\
.                if \\n[#QUOTE]=1 \{\
.                   rn P_QUOTE Q_TEMP
.                   di P_QUOTE
.                   vs \\n[#Q_LEAD]u
.                   PRINT \&
.                   sp -1v+\\n[#Q_LEAD_DIFF]u
.                   Q_TEMP
.                   di
.                \}
.                if \\n[#QUOTE]=2 \{\
.                   rn B_QUOTE Q_TEMP
.                   di B_QUOTE
.                   vs \\n[#BQ_LEAD]u
.                   PRINT \&
.                   sp -1v+\\n[#Q_LEAD_DIFF]u
.                   Q_TEMP
.                   di
.                \}
.                rm Q_TEMP
.             \}
.             el \{\
.                ALD (\\n[#DOC_LEAD]u/2u)+\\n[#Q_LEAD_DIFF]u
.             \}
.          \}
.       \}
.       if \\n[#DIVER_FN]=2 \{ .rr #DIVER_FN \}
.    \}
.END
\#
.MAC Q_NOFIT END
.    rr #Q_FITS
.    ie r#HEAD \{\
.       if \\n[#HEAD]=1 \{ . \}
.    \}
.    el \{\
.       ie \\n[#FULLSPACE_QUOTES] \{\
.          ie \\n[#ENDNOTE] \{ .ALD \\n[#EN_LEAD]u+\\n[#Q_LEAD_DIFF]u \}
.          el \{ .ALD \\n[#DOC_LEAD]u+\\n[#Q_LEAD_DIFF]u \}
.       \}
.       el \{ .ALD (\\n[#DOC_LEAD]u/2u)+\\n[#Q_LEAD_DIFF]u \}
.       nr #Q_PARTIAL_DEPTH 0 \\n[#Q_LEAD_REAL]
.       while \\n+[#Q_PARTIAL_DEPTH]<(\\n[#TRAP_DISTANCE]-1) \{\
.
.\}
.       nr #Q_PARTIAL_DEPTH -\\n[#Q_LEAD_REAL]
.       nr #Q_SPACE_ADJ (\\n[#TRAP_DISTANCE]-1)-\\n[#Q_PARTIAL_DEPTH]+\\n[#Q_LEAD_DIFF]u
.\" Hack to deal with the fact that even though the above routine
.\" makes the bottom line of the quote fall exactly on the bottom
.\" margin when traps are disabled, it refuses to do so when traps
.\" are on.  The difference by which it's off is #Q_LEAD_DIFF
.\" (the +\\n[#Q_LEAD_DIFF] at the end of the line, above).  Hack
.\" solution: temporarily lower the FOOTER trap position.
.       nr #SAVED_FOOTER_POS \\n[#VARIABLE_FOOTER_POS]
.       ch FOOTER \\n[#VARIABLE_FOOTER_POS]u+.25v
.    \}
.END
\#
\# ====================================================================
\#
\# BREAK QUOTE
\# -----------
\# *Arguments:
\#   <none>
\# *Function:
\#   Ends the diversion P_QUOTE or B_QUOTE, breaks to a new
\#   page, and reinvokes BLOCKQUOTE.
\# *Notes:
\#   Because quotes go into a diversion before they're output,
\#   footnotes in quotes that cross pages behave erratically.  The footnote
\#   isn't processed until the diversion ends, hence the footnote
\#   marker in the quote isn't always correct for the new page (it's
\#   picked up from the old one).  BREAK_QUOTE is a workaround for
\#   this problem.
\#
.MAC BREAK_QUOTE END
.    br
.    di
.    nr #BROKEN_QUOTE 1
.    REMOVE_INDENT
.    ev
.    nr #Q_DEPTH \\n[#DIVER_DEPTH]+\\n[#LEAD]
.    if \\n[#PRINT_STYLE]=1 \{\
.       if !\\n[#LINEBREAK] \{ .ALD \\n[#DOC_LEAD]u \}
.       if \\n[#HEAD] \{\
.          if \\n[#HEAD]=1 \{ .RLD \\n[#DOC_LEAD]u \}
.       \}
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
.       ie \\n[#PP_SPACE] \{\
.          ie \\n[#HEAD]=1 \{ . \}
.          el \{\
.             if !\\n[#LINEBREAK] \{ .ALD \\n[#DOC_LEAD]u \}
.          \}
.       \}
.       el \{\
.          rr #Q_FITS
.          ie r#HEAD \{\
.             if \\n[#HEAD]=1 \{ . \}
.          \}
.          el \{ .ALD \\n[#DOC_LEAD]u \}
.       \}
.    \}
.    nr #Q_OFFSET \\n[#L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE])
.    if \\n[#COLUMNS] \{ .nr #Q_OFFSET \\n[#COL_\\n[#COL_NUM]_L_MARGIN]+(\\n[#PP_INDENT]*\\n[#Q_OFFSET_VALUE]) \}
.    po \\n[#Q_OFFSET]u
.    if \\n[#QUOTE]=1 \{\
.       nf
.       P_QUOTE
.    \}
.    if \\n[#QUOTE]=2 \{\
.       nf
.       B_QUOTE
.    \}
.    if r#HEAD     \{ .rr #HEAD     \}
.    if r#EPIGRAPH \{ .rr #EPIGRAPH \}
.    rr #Q_PP
.    rr #LINEBREAK
.    nr #PP_STYLE  1
.    nr #END_QUOTE 1
.    if \\n[#PRINT_STYLE]=1 \{\
.       if \\n[#UNDERLINE_QUOTES] \{\
.          UNDERLINE OFF
.       \}
.    \}
.    po \\n[#L_MARGIN]u
.    if \\n[#COLUMNS] \{\
.       po \\n[#COL_\\n[#COL_NUM]_L_MARGIN]u
.       nr #L_MARGIN \\n(.o
.    \}
.    QUAD \\*[$DOC_QUAD]
.    sp |\\n[#PAGE_LENGTH]u  \" To trip footer/header
.    BLOCKQUOTE
.END
\#
\# ====================================================================
\#
\# +++PAGINATION+++
\#
\# PAGINATE
\# --------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Turns page numbering off or on during document processing.
\# *Notes:
\#   Default is on.
\#
.MAC PAGINATE END
.    ie '\\$1'' \{ .nr #PAGINATE 1 \}
.    el \{ .nr #PAGINATE 0 \}
.END
\#
\#
\# SUSPEND PAGINATION (before ENDNOTES)
\# ------------------
\# *Argument:
\#   <none>
\# *Function:
\#   Creates register #SUSPEND_PAGINATION
\# *Notes:
\#   Useful only to suspend pagination before outputting endnotes.
\#
.MAC SUSPEND_PAGINATION END
.    nr #SUSPEND_PAGINATION 1
.END
\#
\# RESTORE PAGINATION (after ENDNOTES)
\# ------------------
\# *Argument:
\#   <none>
\# *Function:
\#   Removes register #SUSPEND_PAGINATION.  Creates register
\#   #DEFER_PAGINATION
\# *Notes:
\#   Useful only to restore pagination after outputting endnotes.
\#
.MAC RESTORE_PAGINATION END
.    rr #SUSPEND_PAGINATION
.    if \\n[#PAGE_NUM_V_POS]=1 \{ .PAGINATE \}
.    if \\n[#PAGE_NUM_V_POS]=2 \{ .nr #DEFER_PAGINATION 1 \}
.END
\#
\#
\# PAGE NUMBER FORMAT
\# ------------------
\# *Arguments:
\#   DIGIT | ROMAN | roman | ALPHA | alpha
\# *Function:
\#   Assigns user entered format to #PAGENUMBER.
\#
.MAC PAGENUM_STYLE END
.    nr #PAGENUM_STYLE_SET 1
.    if '\\$1'DIGIT'  \{\
.       ds $PAGENUM_STYLE \\$1
.       af #PAGENUMBER 1
.    \}
.    if '\\$1'ROMAN'  \{\
.       ds $PAGENUM_STYLE \\$1
.       af #PAGENUMBER I
.    \}
.    if '\\$1'roman'  \{\
.       ds $PAGENUM_STYLE \\$1
.       af #PAGENUMBER i
.    \}
.    if '\\$1'ALPHA'  \{\
.       ds $PAGENUM_STYLE \\$1
.       af #PAGENUMBER A
.    \}
.    if '\\$1'alpha'  \{\
.       ds $PAGENUM_STYLE \\$1
.       af #PAGENUMBER a
.    \}
.END
\#
\#
\# HYPHENS AROUND PAGE NUMBERS
\# ---------------------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Creates or modifies register #PAGE_NUM_HYPHENS.
\#   Used to dis/enable hyphens on either side of page numbers.
\# *Notes:
\#   Default is on.
\#
.MAC PAGENUM_HYPHENS END
.    nr #PAGE_NUM_HYPHENS_SET 1
.    ie '\\$1'' \{ .nr #PAGE_NUM_HYPHENS 1 \}
.    el \{ .rr #PAGE_NUM_HYPHENS   \}
.END
\#
\#
\# PAGENUMBER POSITION
\# -------------------
\# *Arguments:
\#   TOP | BOTTOM  LEFT | CENTER | RIGHT
\# *Function:
\#   Creates or modifies various PAGE_NUM_H | V_POS registers.
\#   Used to position page numbers.
\# *Notes:
\#   Default is center/bottom.
\#
.MAC PAGENUM_POS END
.    nr #PAGE_NUM_POS_SET 1
.    if '\\$1'TOP'    \{ .nr #PAGE_NUM_V_POS 1 \}
.    if '\\$1'BOTTOM' \{ .nr #PAGE_NUM_V_POS 2 \}
.    if '\\$2'LEFT'   \{ .nr #PAGE_NUM_H_POS 1 \}
.    if '\\$2'CENTER' \{ .nr #PAGE_NUM_H_POS 2 \}
.    if '\\$2'CENTRE' \{ .nr #PAGE_NUM_H_POS 2 \}
.    if '\\$2'RIGHT'  \{ .nr #PAGE_NUM_H_POS 3 \}
.END
\#
\#
.MAC PN_WITH_HYPHENS END
.    nr #HYPHEN_ADJ \\n[#CAP_HEIGHT]/12
.    ds $HYPHEN \v'-\En[#HYPHEN_ADJ]u'-\v'\En[#HYPHEN_ADJ]u'
.    PRINT \m[\\*[$PAGENUM_COLOR]]\\*[$HYPHEN]\|\\n[#PAGENUMBER]\|\\*[$HYPHEN]
.br
.END
\#
\#
\# PRINT PAGE NUMBER
\# -----------------
\# *Arguments:
\#   <none>
\# *Function:
\#   Prints page number if PAGINATE=1.
\#
.MAC PRINT_PAGE_NUMBER END
.    ev PAGENUMBER
.    nf
.    na
.    po \\n[#DOC_L_MARGIN]u
.    ll \\n[#DOC_L_LENGTH]u
.    ta \\n(.lu
.    FAMILY  \\*[$PAGE_NUM_FAM]
.    FT      \\*[$PAGE_NUM_FT]
.    PT_SIZE \\n[#DOC_PT_SIZE]u\\*[$PAGE_NUM_SIZE_CHANGE]
.    if \\n[#PRINT_STYLE]=1 \{\
.       TYPEWRITER
.    \}
.    if \\n[#PAGE_NUM_V_POS]=1 \{ .vs 0 \}
.    if o \{\
.       ie \\n[#PAGE_NUM_H_POS]=1 \{ .LEFT  \}
.       el                        \{ .RIGHT \}
.    \}
.    if e \{\
.       ie \\n[#PAGE_NUM_H_POS]=1 \{ .RIGHT  \}
.       el                        \{ .LEFT   \}
.    \}
.    if \\n[#PAGE_NUM_H_POS]=2    \{ .CENTER \}
.    if \\n[#RECTO_VERSO]=0 \{\
.       if \\n[#PAGE_NUM_H_POS]=1 \{ .LEFT   \}
.       if \\n[#PAGE_NUM_H_POS]=2 \{ .CENTER \}
.       if \\n[#PAGE_NUM_H_POS]=3 \{ .RIGHT  \}
.    \}
.    nr #PAGENUMBER \\n%+\\n[#PAGE_NUM_ADJ]
.    if \\n[#EN_FIRST_PAGE] \{\
.       if \\n[#EN_FIRST_PN] \{ .PAGENUMBER \\n[#EN_FIRST_PN] \}
.       rr #EN_FIRST_PAGE
.    \}
.    if \\n[#BIB_FIRST_PAGE] \{\
.       if \\n[#BIB_FIRST_PN] \{ .PAGENUMBER \\n[#BIB_FIRST_PN] \}
.       rr #BIB_FIRST_PAGE
.    \}
.    if \\n[#TOC_FIRST_PAGE] \{\
.       PAGENUMBER 1
.       rr #TOC_FIRST_PAGE
.    \}
.    ie \\n[#DRAFT_WITH_PAGENUM] \{\
.       ie '\\*[$REVISION]'' \{\
.          PRINT "\\*[$DRAFT_STRING]\\*[$DRAFT] / \\n[#PAGENUMBER]"
.       \}
.       el \{\
.          ie '\\*[$DRAFT]'' \{\
.             PRINT "\\*[$REVISION_STRING] \\*[$REVISION] / \\n[#PAGENUMBER]"
.          \}
.          el \{\
.             PRINT "\\*[$DRAFT_STRING]\\*[$DRAFT], \\*[$REVISION_STRING] \\*[$REVISION] / \\n[#PAGENUMBER]"
.          \}
.       \}
.    \}
.    el \{\
.       ie \\n[#PAGE_NUM_HYPHENS] \{\
.          if '\\*[$PAGENUM_STYLE]'DIGIT' \{\
.             di NULL
1\\R'#CAP_HEIGHT \\n[.cht]'
.             di
.             PN_WITH_HYPHENS
.          \}
.          if '\\*[$PAGENUM_STYLE]'ROMAN' \{\
.             di NULL
I\\R'#CAP_HEIGHT \\n[.cht]'
.             di
.             PN_WITH_HYPHENS
.          \}
.          if '\\*[$PAGENUM_STYLE]'ALPHA' \{\
.             di NULL
E\\R'#CAP_HEIGHT \\n[.cht]'
.             di
.             PN_WITH_HYPHENS
.          \}
.          if '\\*[$PAGENUM_STYLE]'roman' \{\
.             PRINT \m[\\*[$PAGENUM_COLOR]]-\|\\n[#PAGENUMBER]\|-
.          \}
.          if '\\*[$PAGENUM_STYLE]'alpha' \{\
.             PRINT "\m[\\*[$PAGENUM_COLOR]]-\|\\n[#PAGENUMBER]\|-"
.          \}
.       \}
.       el \{ .PRINT "\m[\\*[$PAGENUM_COLOR]]\\n[#PAGENUMBER]" \}
.    \}
.    ev
.END
\#
\# ====================================================================
\#
\# +++FOOTNOTES+++
\#
.ig
Mom's footnote handling is baroque, to say the least.  There are
redundancies in a number of the macros involved, as well as some
registers that probably don't get used anymore.  The baggage is left
in in case some new footnote oddity/challenge gets thrown my way.

The macros are heavily commented.
..
\#
\# FOOTNOTE AUTOLEAD
\# -----------------
\# *Arguments:
\#   <autolead value for footnotes>
\# *Function:
\#   Creates or modifies register #FN_AUTOLEAD.
\# *Notes:
\#   Default is #DOC_LEAD/2 for TYPEWRITE; 2 for TYPESET
\#
.MAC FOOTNOTE_AUTOLEAD END
.    nr #FN_AUTOLEAD \\$1
.END
\#
\#
\# FOOTNOTE MARKERS
\# ----------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Turns generation of footnote markers on or off.
\# *Notes:
\#   Default is on.
\#
.MAC FOOTNOTE_MARKERS END
.    ie '\\$1'' \{ .nr #FN_MARKERS 1 \}
.    el \{ .nr #FN_MARKERS 0 \}
.END
\#
\#
\# FOOTNOTE MARKER STYLE
\# ---------------------
\# *Arguments:
\#   STAR | NUMBER | LINE
\# *Function:
\#   Sets register #FN_MARKER_STYLE, used in FOOTNOTE to determine
\#   the style of footnote markers.
\# *Notes:
\#   1=STAR; 2=NUMBER; 3=LINE.  LINE means "use output line numbers".
\#   Default is STAR.
\#
.MAC FOOTNOTE_MARKER_STYLE END
.    if '\\$1'STAR' \{\
.       if \\n[#FN_MARKER_STYLE]=3 \{\
.          if !\\n[#NEWPAGE]=1 \{\
.             tm1 "[mom]: Your current FOOTNOTE_MARKER STYLE is LINE.  
.             tm1 "       You cannot change footnote marker style without
.             tm1 "       first breaking to a new page with NEWPAGE.
.             tm1 "       Ignoring request FOOTNOTE_MARKER_STYLE STAR at line \\n(.c.
.             return
.          \}
.       \}
.       if \\n[#RUN_ON]=1 \{\
.          tm1 "[mom]: FOOTNOTE_MARKER_STYLE STAR at line \\n(.c is incompatible
.          tm1 "       with RUN_ON footnotes.  Ignoring request.
.          return
.       \}
.       nr #FN_MARKER_STYLE 1
.       if \\n[#NEWPAGE]=1 \{ .rr #NEWPAGE \}
.       FOOTNOTE_MARKERS
.    \}
.    if '\\$1'NUMBER' \{\
.       if \\n[#FN_MARKER_STYLE]=3 \{\
.          if !\\n[#NEWPAGE]=1 \{\
.             tm1 "[mom]: Your current FOOTNOTE_MARKER STYLE is NUMBER.  
.             tm1 "       You cannot change footnote marker style without
.             tm1 "       first breaking to a new page with NEWPAGE.
.             tm1 "       Ignoring request FOOTNOTE_MARKER_STYLE NUMBER at line \\n(.c.
.             return
.          \}
.       \}
.       if \\n[#RUN_ON]=1 \{\
.          tm1 "[mom]: FOOTNOTE_MARKER_STYLE NUMBER at line \\n(.c is incompatible
.          tm1 "       with RUN_ON footnotes.  Ignoring request.
.          return
.       \}
.       nr #FN_MARKER_STYLE 2
.       if \\n[#NEWPAGE]=1 \{ .rr #NEWPAGE \}
.       FOOTNOTE_MARKERS
.    \}
.    if '\\$1'LINE' \{\
.       nr #FN_MARKER_STYLE 3
.       FOOTNOTE_MARKERS OFF
.       if !\\n[#FN_LN_SEP] \{\
.          if !\\n[#FN_LN_BRACKETS] \{ .FOOTNOTE_LINENUMBER_BRACKETS SQUARE \}
.       \}
.    \}
.END
\#
\#
\# FOOTNOTE LINENUMBER MARK
\# ------------------------
\# *Function:
\#   This string, when called inline, stores the current output line
\#   number in register #FN_MARK for use with FOOTNOTE.
\#
.ds FN-MARK \R'#FN_MARK \En(ln'
\#
\#
\# FOOTNOTE LINENUMBER SEPARATOR
\# -----------------------------
\# *Argument:
\#   <user-defined separator>
\# *Function:
\#   Stores user-defined separator (for use then
\#   FOOTNOTE_MARKER_STYLE is LINE) in string $FN_LN_SEP.  The
\#   separator is intended to be used when the user wishes a
\#   separator, rather than the choice of brackets offered by
\#   FOOTNOTE_LINENUMBER_BRACKETS.
\#
.MAC FOOTNOTE_LINENUMBER_SEPARATOR END
.    rr #FN_LN_BRACKETS
.    nr #FN_LN_SEP 1
.    ds $FN_LN_SEP "\\$1
.END
\#
\#
\# FOOTNOTE LINENUMBER BRACKETS
\# ----------------------------
\# *Argument:
\#   PARENS | SQUARE | BRACES or ( | [ | {
\# *Function:
\#   Sets register #FN_LN_BRACKETS to 1, and creates strings
\#   $FN_OPEN_BRACKET and $FN_CLOSE_BRACKET according to the given
\#   argument.
\#
.MAC FOOTNOTE_LINENUMBER_BRACKETS END
.    rr #FN_LN_SEP
.    nr #FN_LN_BRACKETS 1
.    if '\\$1'PARENS' \{\
.       ds $FN_OPEN_BRACKET (
.       ds $FN_CLOSE_BRACKET )
.    \}
.    if '\\$1'(' \{\
.       ds $FN_OPEN_BRACKET (
.       ds $FN_CLOSE_BRACKET )
.    \}
.    if '\\$1'SQUARE' \{\
.       ds $FN_OPEN_BRACKET [
.       ds $FN_CLOSE_BRACKET ]
.    \}
.    if '\\$1'[' \{\
.       ds $FN_OPEN_BRACKET [
.       ds $FN_CLOSE_BRACKET ]
.    \}
.    if '\\$1'BRACES' \{\
.       ds $FN_OPEN_BRACKET {
.       ds $FN_CLOSE_BRACKET }
.    \}
.    if '\\$1'{' \{\
.       ds $FN_OPEN_BRACKET {
.       ds $FN_CLOSE_BRACKET }
.    \}
.END
\#
\#   
\# RESET FOOTNOTE NUMBER
\# ---------------------
\# *Arguments:
\#   <none> | PAGE
\# *Function:
\#   Resets register #FN_NUMBER to 1.  If argument is PAGE, creates
\#   toggle #RESET_FN_NUMBER which is checked in HEADER.  If 1,
\#   numbered footnotes on every page start at 1.
\#
.MAC RESET_FOOTNOTE_NUMBER END
.    ie '\\$1'' \{ .nr #FN_NUMBER 0 1 \}
.    el \{ .nr #RESET_FN_NUMBER 1 \}
.END
\#
\#
\# FOOTNOTE RULE LENGTH
\# --------------------
\# *Arguments:
\#   <length of rule used to separate footnotes from running text>
\# *Function:
\#   Creates or modifies registers #FN_RULE_LENGTH.
\# *Notes:
\#   Requires unit of measure (iPpcm).
\#   Default is 4P for both PRINTSTYLEs.
\#
.MAC FOOTNOTE_RULE_LENGTH END
.    nr #FN_RULE_LENGTH (\\$1)
.END
\#
\#
\# FOOTNOTE_RULE_ADJ
\# -----------------
\# *Arguments:
\#   <number of points to raise footnote rule from it's baseline position>
\# *Function:
\#   Creates or modifies register #FN_RULE_ADJ.
\# *Notes:
\#   Default is 3p for both TYPESTYLES.
\#
\#   Requires unit of measure.
\#
.MAC FOOTNOTE_RULE_ADJ END
.    nr #FN_RULE_ADJ (\\$1)
.END
\#
\#
\# FOOTNOTE RULE
\# -------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Turns printing of footnote separator rule on or off.  If invoked as
\#   PRINT_FOOTNOTE_RULE, prints footnote separator rule.
\# *Notes:
\#   Default is on.
\#
\#   Invoked in FOOTNOTE (as PRINT_FOOTNOTE_RULE) as 1st line of a footnote
\#   if the footnote number (#FN_COUNT) is 1.
\#
.MAC FOOTNOTE_RULE END
.    ie '\\$0'PRINT_FOOTNOTE_RULE' \{\
.       if \\n[#FN_RULE]=0 \{ .RLD 1v \}
\!.     PT_SIZE 12
.       RLD 1v
.       LEFT
.       PRINT \v'-\\n[#FN_RULE_ADJ]u'\l'\\n[#FN_RULE_LENGTH]u'\v'+\\n[#FN_RULE_ADJ]u'
\!.     PT_SIZE \\n[#DOC_PT_SIZE]u\\*$[FN_SIZE_CHANGE]
.       QUAD \\*[$FN_QUAD]
.    \}
.    el \{\
.       ie '\\$1'' \{ .nr #FN_RULE 1 \}
.       el \{ .nr #FN_RULE 0 \}
.    \}
.END
\#
\#
\# FOOTNOTE SPACING
\# ----------------
\# *Arguments:
\#   <per item post footnote spacing> | <anything>
\# *Function:
\#   Enables printing of post footnote spacing.
\# *Notes:
\#   Default is no space.
\#
.MAC FOOTNOTE_SPACING END
.    ie \B'\\$1' \{ .nr #FN_SPACE (\\$1) \}
.    el \{ .nr #FN_SPACE 0 \}
.END
\#
\#
\# RUN ON FOOTNOTES
\# ----------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Toggles run-on footnotes on or off.
\#
.MAC FOOTNOTES_RUN_ON END
.    ie '\\$1'' \{\
.       if \\n[#FN_COUNT]>0 \{\
.          tm1 "[mom]: Switching to run-on footnotes at line \\n(.c will cause
.          tm1 "       you to loose footnotes already formatted for this page.
.          tm1 "       Ignoring request FOOTNOTES_RUN_ON.
.          rr #RUN_ON
.          return
.       \}
.       nr #RUN_ON 1
.       if \\n[#FN_MARKER_STYLE]=1 \{ .RUNON_WARNING \}
.       if \\n[#FN_MARKER_STYLE]=2 \{ .RUNON_WARNING \}
.    \}
.    el \{\
.       if \\n[#FN_COUNT]>0 \{\
.          if \\n[#RUN_ON]=1 \{\
.             tm1 "[mom]: Switching off run-on footnotes at line \\n(.c will cause
.             tm1 "       you to loose footnotes already formatted for this page.
.             tm1 "       Ignoring request FOOTNOTES_RUN_ON \\$1.
.             return
.          \}
.       \}
.       rr #RUN_ON
.    \}
.END
\#
\#
.MAC RUNON_WARNING END
.    if \\n[#FN_MARKER_STYLE]=1 \{\
.       tm1 "[mom]: The footnote marker style active at line \\n(.c is STAR,
.       tm1 "       which is incompatible with run-on footnotes.  Please change
.       tm1 "       the footnote marker style to LINE.  Continuing to process,
.       tm1 "       but ignoring request FOOTNOTES_RUN_ON.
.       rr #RUN_ON
.    \}
.    if \\n[#FN_MARKER_STYLE]=2 \{\
.       tm1 "[mom]: The footnote marker style active at line \\n(.c is NUMBER,
.       tm1 "       which is incompatible with run-on footnotes.  Please change
.       tm1 "       the footnote marker style to LINE.  Continuing to process,
.       tm1 "       but ignoring request FOOTNOTES_RUN_ON.
.       rr #RUN_ON
.    \}
.END
\#
\# FOOTNOTE
\# --------
\# *Arguments:
\#   <none> | INDENT  L|LEFT|R|RIGHT|B|BOTH  <indent value> | <anything>
\# *Function:
\#   Begins collecting and diverting footnote text if no argument
\#   given.  Otherwise, ends diversion FOOTNOTES, measures footnote
\#   depth, and sets footnote trap.
\# *Notes:
\#   The input line preceding a footnote call MUST terminate with \c
\#   or the footnote marker will be spaced away from the word it
\#   should be joined to.
\#
\#   If FOOTNOTE is invoked with INDENT, the footnote will
\#   be indented.  An indent style and an indent value must be given.
\#   Subsequent footnotes will NOT be indented; INDENT must be given
\#   for each footnote the user wants indented.
\#
.MAC FOOTNOTE END
.    if !\\n(.u \{ .nr #ADD_BREAK 1 \}
.    ie '\\$1'' \{\
.       if \\n[#FN_MARKER_STYLE]=3 \{\
.          if !\\n[#LINENUMBERS] \{\
.             tm1 "[mom]: Line numbering must be enabled with NUMBER_LINES when
.             tm1 "       FOOTNOTE_MARKER_STYLE is LINE.
.             ab Aborting on FOOTNOTE at line \\n(.c.
.          \}
.          if \\n[#FN_MARK]=0 \{ .nr #FN_MARK \\n(ln \}
.          nr #FN_MARK_2 \\n(ln
.          if '\\n(.z'P_QUOTE' \{\
.             nr #FN_MARK -1
.             nr #FN_MARK_2 -1
.          \}
.          if \\n[#IN_DIVER]=1 \{\
.             if '\\n(.z'P_QUOTE' \{\
.                if !\\n[#QUOTE_LN]=1 \{\
.                   if !\\n[#SILENT_QUOTE_LN]=1 \{\
.                      tm1 "[mom]: You have requested a line-numbered footnote inside a
.                      tm1 "       QUOTE at line \\n(.c, but line-numbering has not been enabled
.                      tm1 "       for QUOTES.  Printing footnote with label "0".
.                      rr #FN_MARK
.                      rr #FN_MARK_2
.                   \}
.                \}
.             \}
.             if '\\n(.z'B_QUOTE' \{\
.                if !\\n[#BQUOTE_LN]=1 \{\
.                   if !\\n[#SILENT_BQUOTE_LN]=1 \{\
.                      tm1 "[mom]: You have requested a line-numbered footnote inside a
.                      tm1 "       BLOCKQUOTE at line \\n(.c, but line-numbering has not been enabled
.                      tm1 "       for BLOCKQUOTES.  Printing footnote with label "0".
.                      rr #FN_MARK
.                      rr #FN_MARK_2
.                   \}
.                \}
.             \}
.          \}
.       \}
.\" Begin processing footnotes that occur inside QUOTE, BLOCKQUOTE
.\" or EPIGRAPH.
.       if \\n[#IN_DIVER]=1 \{\
.          nr #PAGE_POS \\n(nl+\\n(.d+\\n[#DOC_LEAD]
.          nr #FOOTER_POS \\n[#PAGE_LENGTH]+(\\n[#VARIABLE_FOOTER_POS]-1)
.          nr #SPACE_TO_FOOTER \\n[#FOOTER_POS]-\\n[#PAGE_POS]
.\" Are we on a "defer" line?  If so, defer the text of the footnote.
.          ie \\n[#SPACE_TO_FOOTER]=\\n[#DOC_LEAD]:\\n[#SPACE_TO_FOOTER]=0 \{\
.             nr #DIVER_FN 2 \" treat like a normal deferred footnote
.          \}
.          el \{\
.             nr #DIVER_FN 2 \" treat like a normal footnote
.          \}
.          if \\n[#PAGE_POS]>\\n[#FOOTER_POS] \{\
.             nr #DIVER_FN 1 \" move this footnote
.          \}
.\" Test for situation where, because a final line of QUOTE, BLOCKQUOTE
.\" or EPIGRAPH isn't yet adjusted at this point, the last word on the
.\" line may *seem* to belong to the final line of the page, but will,
.\" in fact, become the first word of the subsequent page.  In such
.\" circumstances, we want the the footnote to be treated as a "moved"
.\" diversion footnote.
.          if \\n(.k>\\n(.l \{ .nr #DIVER_FN 1 \}
.          if r#DIVER_FN \{\
.             if !\\n[#DIVER_FN]=2 \{ .\\n+[#DONE_ONCE] \}
.\" A footnote inside a diversion will become the 1st footnote on the
.\" following page/column.
.             if \\n[#DIVER_FN]=1 \{ .DIVER_FN_1_PRE \}
.\" A footnote inside a diversion that should be treated like a
.\" normal footnote (including defers.)
.             if \\n[#DIVER_FN]=2 \{ .DIVER_FN_2_PRE \}
.          \}
.          nr #SAVED_FN_COUNT \\n[#FN_COUNT]+1
.          nr #SAVED_FN_COUNT_FOR_COLS \\n[#FN_COUNT_FOR_COLS]+1
.       \}
.\" End processing footnotes that occur inside QUOTE, BLOCKQUOTE or
.\" EPIGRAPH.
.\"
.\" Test for situation where, because a final line of running text
.\" isn't yet adjusted at this point, the last word on the line may
.\" *seem* to belong to the final line of the page, but will, in
.\" fact, become the first word of the subsequent page.  In such
.\" circumstances, we want the the footnote marker in running text to
.\" be the correct one for the 1st footnote on the page.
.       if \\n(.k>\\n(.l \{\
.          if (\\n(nl+\\n[#DOC_LEAD])>(\\n[#PAGE_LENGTH]+\\n[#VARIABLE_FOOTER_POS]) \{\
.             ie \\n[#COLUMNS]=1 \{\
.                if \\n[#COL_NUM]=\\n[#NUM_COLS] \{\
.                   if \\n[#FN_MARKER_STYLE]=1 \{\
.                      nr #FN_COUNT_FOR_COLS 0 1
.                   \}
.                   if \\n[#FN_MARKER_STYLE]=2 \{\
.                      if \\n[#RESET_FN_NUMBER] \{\
.                         nr #FN_NUMBER 0 1
.                         nr #NOT_YET_ADJUSTED 1
.                      \}
.                   \}
.                \}
.             \}
.             el \{\
.                if \\n[#FN_MARKER_STYLE]=1 \{\
.                   nr #FN_COUNT 0 1
.                \}
.                if \\n[#FN_MARKER_STYLE]=2 \{\
.                   if \\n[#RESET_FN_NUMBER] \{\
.                      nr #FN_NUMBER 0 1
.                      nr #NOT_YET_ADJUSTED 1
.                   \}
.                \}
.             \}
.          \}
.       \}
.       if \\n[#FN_MARKERS] \{\
.\" Housekeeping
.          if \\n[#CONDENSE] \{ \*[CONDX]\c \}
.          if \\n[#EXTEND]   \{ \*[EXTX]\c  \}
.          if \\n[#PRINT_STYLE]=1 \{\
.             if \\n[#UNDERLINE_ON] \{\
.                nr #UNDERLINE_WAS_ON 1
.                UNDERLINE OFF
.             \}
.          \}
.\" Add footnote markers to running text...
.          if !\\n[#NO_FN_MARKER] \{\
.\" ...but not if TERMINATE has not been called
.             if !r#TERMINATE \{\
.\" Marker style star/dagger/double-dagger
.                if \\n[#FN_MARKER_STYLE]=1 \{\
.\" Columnar docs either move col to col, or last col to next page.
.\" They require their own special FN_COUNT because regular FN_COUNT
.\" is used to figure out things like whether or not to put a rule
.\" above footnotes (in addition to keeping track of the footnote
.\" count in non-columnar docs).
.                   ie \\n[#COLUMNS]=1 \{\
.                      if \\n[#FN_COUNT_FOR_COLS]=0 \{ .PRINT \*[BU2]*\c            \}
.                      if \\n[#FN_COUNT_FOR_COLS]=1 \{ .PRINT \*[BU1]\(dg\c         \}
.                      if \\n[#FN_COUNT_FOR_COLS]=2 \{ .PRINT \(dd\c                \}
.                      if \\n[#FN_COUNT_FOR_COLS]=3 \{ .PRINT \*[BU2]**\c           \}
.                      if \\n[#FN_COUNT_FOR_COLS]=4 \{ .PRINT \*[BU1]\(dg\(dg\c     \}
.                      if \\n[#FN_COUNT_FOR_COLS]=5 \{ .PRINT \(dd\(dd\c            \}
.                      if \\n[#FN_COUNT_FOR_COLS]=6 \{ .PRINT \*[BU2]***\c          \}
.                      if \\n[#FN_COUNT_FOR_COLS]=7 \{ .PRINT \*[BU1]\(dg\(dg\(dg\c \}
.                      if \\n[#FN_COUNT_FOR_COLS]=8 \{ .PRINT \(dd\(dd\(dd\c        \}
.                      if \\n[#FN_COUNT_FOR_COLS]=9 \{ .PRINT \*[BU2]****\c         \}
.                   \}
.                   el \{\
.                      if \\n[#FN_COUNT]=0 \{ .PRINT \*[BU2]*\c            \}
.                      if \\n[#FN_COUNT]=1 \{ .PRINT \*[BU1]\(dg\c         \}
.                      if \\n[#FN_COUNT]=2 \{ .PRINT \(dd\c                \}
.                      if \\n[#FN_COUNT]=3 \{ .PRINT \*[BU2]**\c           \}
.                      if \\n[#FN_COUNT]=4 \{ .PRINT \*[BU1]\(dg\(dg\c     \}
.                      if \\n[#FN_COUNT]=5 \{ .PRINT \(dd\(dd\c            \}
.                      if \\n[#FN_COUNT]=6 \{ .PRINT \*[BU2]***\c          \}
.                      if \\n[#FN_COUNT]=7 \{ .PRINT \*[BU1]\(dg\(dg\(dg\c \}
.                      if \\n[#FN_COUNT]=8 \{ .PRINT \(dd\(dd\(dd\c        \}
.                      if \\n[#FN_COUNT]=9 \{ .PRINT \*[BU2]****\c         \}
.                   \}
.                \}
.\" Marker style superscript numbers
.                if \\n[#FN_MARKER_STYLE]=2 \{\
.                   if \\n[#PRINT_STYLE]=1 \{ .PRINT "\s-2\v'-\\n[#DOC_LEAD]u/5u'\\n+[#FN_NUMBER]\v'+\\n[#DOC_LEAD]u/5u'\s+2\c" \}
.                   if \\n[#PRINT_STYLE]=2 \{ .PRINT "\*[SUP]\\n+[#FN_NUMBER]\*[SUPX]\c" \}
.                \}
.             \}
.          \}
.       \}
.\" More housekeeping
.\"
.\" #SPACE_REMAINING is the space left between where we are
.\" on the page and the bottom margin.  It's used to determine whether
.\" or not the footnote will overflow, and how many lines of
.\" footnotes will fit on the page if some have to overflow.
.       ie \\n[#DIVER_FN]=2 \{\
.          nr #SPACE_REMAINING (\\n[#PAGE_LENGTH]-\\n[#B_MARGIN])-(\\n[#PAGE_POS])
.       \}
.       el \{\
.          nr #SPACE_REMAINING (\\n[#PAGE_LENGTH]-\\n[#B_MARGIN])-\\n(nl
.       \}
.       if \\n[#FROM_DIVERT_FN]=1 \{\
.          nr #SPACE_REMAINING \\n[#PAGE_LENGTH]-\\n[#B_MARGIN]
.          rr #FROM_DIVERT_FN
.       \}
.       nr #PP_STYLE_PREV \\n[#PP_STYLE]
.       nr #PP_STYLE 2
.       if \\n[#INDENT_FIRST_PARAS] \{ .nr #INDENT_FIRSTS 1 \}
.       INDENT_FIRST_PARAS
.\" Prepare FOOTNOTE to receive footnote text.
.       ev FOOTNOTES
.       ll \\n[#DOC_L_LENGTH]u
.       ta \\n(.lu
.       if \\n[#COLUMNS]=1 \{\
.          ll \\n[#COL_L_LENGTH]u
.          ta \\n(.lu
.       \}
.       if \\n[#FN_R_INDENT]  \{\
.          ll -\\n[#FN_R_INDENT]u
.          ta \\n(.lu
.       \}
.       if \\n[#FN_BR_INDENT] \{\
.          ll -\\n[#FN_BR_INDENT]u
.          ta \\n(.lu
.       \}
.       FAMILY   \\*[$FN_FAM]
.       FT       \\*[$FN_FT]
.       PT_SIZE  \\n[#DOC_PT_SIZE]u\\*[$FN_SIZE_CHANGE]
.       AUTOLEAD \\n[#FN_AUTOLEAD]
.       QUAD     \\*[$FN_QUAD]
.       if \\n[#PRINT_STYLE]=1 \{\
.          TYPEWRITER
.          ie \\n[#SINGLE_SPACE] \{ .vs \\n[#ORIGINAL_DOC_LEAD]u \}
.          el \{ .vs \\n[#ORIGINAL_DOC_LEAD]u/2u \}
.          QUAD LEFT
.          HY OFF
.       \}
.       nr #FN_LEAD \\n[#LEAD]
.\" Begin diversion FOOTNOTES or FN_IN_DIVER
.       ie r#COUNTERS_RESET \{\
.          ie \\n[#DONE_ONCE]=1 \{\
.             ie \\n[#RUN_ON] \{\
.                di RUNON_FN_IN_DIVER
.                nr #RUNON_FN_IN_DIVER 1
.             \}
.             el \{ .di FN_IN_DIVER \}
.          \}
.          el \{\
.             ie \\n[#RUN_ON] \{\
.                da RUNON_FN_IN_DIVER
.                nr #RUNON_FN_IN_DIVER 1
.             \}
.             el \{ .da FN_IN_DIVER \}
.          \}
.       \\n+[#DONE_ONCE]
.       \}
.       el \{\
.          ie \\n[#RUN_ON] \{\
.             da RUNON_FOOTNOTES
.             nr #RUNON_FOOTNOTES 1
.          \}
.          el \{ .da FOOTNOTES \}
.       \}
.       if \\n[#FOOTNOTE_COLOR]=1 \{\
.          TRAP OFF
.          nf
\m[\\*[$FOOTNOTE_COLOR]]
.          EOL
.          fi
.          TRAP
.       \}
.       if \\n[#EPIGRAPH] \{ .nr #FN_FOR_EPI 1 \}
.\" When a deferred footnote is also the 1st footnote on the page,
.\" and when the page it's output on also has footnotes, some
.\" whitespace is needed between the deferred footnote and the
.\" first footnote belonging to the output page so that there's
.\" no confusion when two stars (or two number 1s) appear in
.\" footnotes...
.       if \\n[#FN_DEFER_SPACE] \{\
.\" ...but only add the extra space if TERMINATE has not been called
.          if !r#TERMINATE \{\
.\" ...and not if defer space has already been added
.             if !\\n[#DEFER_SPACE_ADDED] \{\
.\" ...and not if the footnote count the last time we checked for
.\" a defer situation inside a diversion is greater than 1.
.                if !\\n[#SAVED_DIVER_FN_COUNT]>1 \{\
.                   if \\n[#FN_MARKER_STYLE]=1 \{ .ALD 1v \}
.                   if \\n[#RESET_FN_NUMBER] \{ .ALD 1v \}
.                   nr #DEFER_SPACE_ADDED 1
.                \}
.             \}
.          \}
.          rr #FN_DEFER_SPACE
.          rr #SAVED_DIVER_FN_COUNT
.       \}
.       if \\n[#DIVERTED]=3 \{\
.          if \\n[#FN_COUNT]>0 \{\
\!.           RLD 1v
.          \}
.       \}
.\" Add footnote rule (or, if no rule, some whitespace).
.\" N.B.- this line increments #FN_COUNT each and every time FOOTNOTE
.\" is run.
.       if \\n+[#FN_COUNT]=1 \{\
.\" If a footnote is called in a diversion, and the footnote has to
.\" be moved, don't put in the rule now (it's taken care of when
.\" FN_IN_DIVER is output into FOOTNOTE in PROCESS_FN_IN_DIVER).
.          if !\\n[#DONT_RULE_ME]=1 \{\
.             if !\\n[#FN_DEPTH] \{\
.                if \\n[#PRINT_STYLE]=1 \{\
.                   if !\\n[#RUN_ON] \{ .ALD \\n[#DOC_LEAD]u \}
.                \}
.                ie \\n[#FN_RULE]=1 \{\
.                   if !\\n[#RUN_ON] \{ .PRINT_FOOTNOTE_RULE \}
.                \}
.                el \{ .ALD 1v \}
.                nr #RULED 1
.             \}
.          \}
.       \}
.       rr #DONT_RULE_ME
.\" Add footnote markers to footnote text...
.       ie \\n[#FN_MARKERS] \{\
.          if \\n[#FN_SPACE]>0 \{\
.             if \\n[#FN_COUNT]>0 \{\
.                ALD \\n[#FN_SPACE]u
.             \}
.          \}
.          if !\\n[#NO_FN_MARKER] \{\
.\" ...but not if TERMINATE has been called.
.             if !r#TERMINATE \{\
.                if \\n[#REF]=1 \{\
\!.                 in +\\*[$REF_FN_INDENT]
\!.                 ti -\\*[$REF_FN_INDENT]
.                \}
.                if \\n[#FN_MARKER_STYLE]=1 \{\
.                   ie \\n[#COLUMNS]=1 \{\
.                      \\n+[#FN_COUNT_FOR_COLS]
.                      if \\n[#FN_COUNT_FOR_COLS]=1  \{ .PRINT *\c            \}
.                      if \\n[#FN_COUNT_FOR_COLS]=2  \{ .PRINT \(dg\c         \}
.                      if \\n[#FN_COUNT_FOR_COLS]=3  \{ .PRINT \(dd\c         \}
.                      if \\n[#FN_COUNT_FOR_COLS]=4  \{ .PRINT **\c           \}
.                      if \\n[#FN_COUNT_FOR_COLS]=5  \{ .PRINT \(dg\(dg\c     \}
.                      if \\n[#FN_COUNT_FOR_COLS]=6  \{ .PRINT \(dd\(dd\c     \}
.                      if \\n[#FN_COUNT_FOR_COLS]=7  \{ .PRINT ***\c          \}
.                      if \\n[#FN_COUNT_FOR_COLS]=8  \{ .PRINT \(dg\(dg\(dg\c \}
.                      if \\n[#FN_COUNT_FOR_COLS]=9  \{ .PRINT \(dd\(dd\(dd\c \}
.                      if \\n[#FN_COUNT_FOR_COLS]=10 \{ .PRINT ****\c         \}
.                   \}
.                   el \{\
.                      if \\n[#FN_COUNT]=1  \{ .PRINT *\c            \}
.                      if \\n[#FN_COUNT]=2  \{ .PRINT \(dg\c         \}
.                      if \\n[#FN_COUNT]=3  \{ .PRINT \(dd\c         \}
.                      if \\n[#FN_COUNT]=4  \{ .PRINT **\c           \}
.                      if \\n[#FN_COUNT]=5  \{ .PRINT \(dg\(dg\c     \}
.                      if \\n[#FN_COUNT]=6  \{ .PRINT \(dd\(dd\c     \}
.                      if \\n[#FN_COUNT]=7  \{ .PRINT ***\c          \}
.                      if \\n[#FN_COUNT]=8  \{ .PRINT \(dg\(dg\(dg\c \}
.                      if \\n[#FN_COUNT]=9  \{ .PRINT \(dd\(dd\(dd\c \}
.                      if \\n[#FN_COUNT]=10 \{ .PRINT ****\c         \}
.                   \}
.                \}
.                if \\n[#FN_MARKER_STYLE]=2 \{\
.                   if \\n[#COLUMNS]=1 \{\
.                      \\n+[#FN_COUNT_FOR_COLS]
.                   \}
.                   if \\n[#NOT_YET_ADJUSTED]=1 \{\
.                      nr #FN_NUMBER 1 1
.                      rr #NOT_YET_ADJUSTED
.                   \}
.                   if \\n[#PRINT_STYLE]=1 \{ .PRINT "(\\n[#FN_NUMBER])\c" \}
.                   if \\n[#PRINT_STYLE]=2 \{ .PRINT "\*[SUP]\\n[#FN_NUMBER]\*[SUPX]\*[FU 2]\c" \}
.                \}
.             \}
.          \}
.       \}
.       el \{\
.\" Line-numbered footnotes handling
.          if \\n[#FN_MARKER_STYLE]=3 \{\
.             if \\n[#FN_SPACE]>0 \{\
.                if !\\n[#RUN_ON]=1 \{\
.                   if \\n[#FN_COUNT]>0 \{\
.                      ALD \\n[#FN_SPACE]u
.                   \}
.                \}
.             \}
.             if \\n[#REF]=1 \{\
.                if !\\n[#RUN_ON]=1 \{\
\!.                 in +\\*[$REF_FN_INDENT]
\!.                 ti -\\*[$REF_FN_INDENT]
.                \}
.             \}
.             ie \\n[#FN_LN_BRACKETS]=1 \{\
.                ds $FN_LINENUMBER \v'-.085m'\\*[$FN_OPEN_BRACKET]\v'.085m'
.                ie \\n[#FN_MARK_2]=\\n[#FN_MARK] \{\
.                   as $FN_LINENUMBER \\n[#FN_MARK]\v'-.085m'\\*[$FN_CLOSE_BRACKET]\v'.085m' \"
.                \}
.                el \{\
.                   as $FN_LINENUMBER \\n[#FN_MARK]\v'-.1m'-\v'.1m'\\n[#FN_MARK_2]\v'-.085m'\\*[$FN_CLOSE_BRACKET]\v'.085m' \"
.                \}
.             \}
.             el \{\
.                ie \\n[#FN_MARK_2]=\\n[#FN_MARK] \{\
.                   ds $FN_LINENUMBER \\n[#FN_MARK]\\*[$FN_LN_SEP]
.                \}
.                el \{\
.                   ds $FN_LINENUMBER \\n[#FN_MARK]\v'-.1m'-\v'.1m'\\n[#FN_MARK_2]\\*[$FN_LN_SEP]
.                \}
.             \}
.             if !\\n[#NO_FN_MARKER] \{\
.                PRINT \\*[$FN_LINENUMBER]\c
.             \}
.             rm $FN_LINENUMBER
.             nr #FN_MARK 0
.          \}
.       \}
.    \}
.\" If INDENT arg is passed to FOOTNOTE, calculate the indent...
.    el \{\
.       ie '\\$1'INDENT' \{\
.          ev FOOTNOTES
.          if '\\$2'L'     \{ .in (\\$3)  \}
.          if '\\$2'LEFT'  \{ .in (\\$3)  \}
.          if '\\$2'R'     \{ .nr #FN_R_INDENT (\\$3) \}
.          if '\\$2'RIGHT' \{ .nr #FN_R_INDENT (\\$3) \}
.          if '\\$2'B' \{\
.             nr #FN_BL_INDENT (\\$3)
.             ie '\\$4'' \{ .nr #FN_BR_INDENT \\n[#FN_BL_INDENT] \}
.             el \{ .nr #FN_BR_INDENT (\\$4) \}
.             in \\n[#FN_BL_INDENT]u
.          \}
.          if '\\$2'BOTH' \{\
.             nr #FN_BL_INDENT (\\$3)
.             ie '\\$4'' \{ .nr #FN_BR_INDENT \\n[#FN_BL_INDENT] \}
.             el \{ .nr #FN_BR_INDENT (\\$4) \}
.             in \\n[#FN_BL_INDENT]u
.          \}
.          ev
.\" ...then re-run FOOTNOTE without an argument.
.          FOOTNOTE
.       \}
.       el \{\
.          br
.\" Add "defer space" if the previously diverted footnote was the
.\" 1st footnote proper to its page (i.e. it looks like a deferred
.\" footnote but it's really an overflow).
.          if \\n[#DIVERTED] \{\
.             if \\n[#PREV_FN_DEFERRED]=1 \{\
.                if \\n[#FN_MARKER_STYLE]=1 \{ .ALD \\n[#FN_LEAD]u \}
.                if \\n[#RESET_FN_NUMBER] \{ .ALD \\n[#FN_LEAD]u \}
.                nr #PREV_FN_DEFERRED 2
.             \}
.          \}
.          if \\n[#REF]=1 \{\
\!.           in 
.          \}
.\" Terminate FOOTNOTES or FN_IN_DIVER diversion
.          di
.          HY_SET 1 \\n[#DIVERSIONS_HY_MARGIN]u (\\n[#PT_SIZE]u/1000u/8u)p
.          hy 14
.\" More housekeeping
.\" Turn off indent possibly set by FOOTNOTE INDENT
.          in 0
.\" Restore sentence spacing
.       if \\n[#PRINT_STYLE]=2 \{\
.          if d$RESTORE_SS_VAR \{ .SS \\*[$RESTORE_SS_VAR] \}
.          rm $RESTORE_SS_VAR
.       \}
.          if \\n[#PRINT_STYLE]=1 \{\
.             if \\n[#UNDERLINE_WAS_ON] \{\
.                UNDERLINE
.                rr #UNDERLINE_WAS_ON
.             \}
.          \}
.          ev
.          rr #FN_R_INDENT
.          rr #FN_BR_INDENT
.          nr #PP_STYLE \\n[#PP_STYLE_PREV]
.          if !\\n[#INDENT_FIRSTS] \{ .INDENT_FIRST_PARAS OFF \}
.          rr #INDENT_FIRSTS
.\" Calculate footnote depth, but not if #COUNTERS_RESET (created in
.\" DIVER_FN_1_PRE) to instruct FOOTNOTES to skip this step for now
.\" (it's taken care of when FN_IN_DIVER is output into FOOTNOTES in
.\" PROCESS_FN_IN_DIVER).
.          ie r#COUNTERS_RESET \{\
.             rr #COUNTERS_RESET
.          \}
.          el \{\
.             nr #GET_DEPTH 1
.\" If the footnote is the 1st on the page and it falls too close
.\" to the bottom margin, defer the footnote text to the next page...
.             if (\\n[#SPACE_REMAINING]-1)<=(\\n[#DOC_LEAD]) \{\
.\" ...but not if PROCESS_FN_LEFTOVER has set #PREV_FN_DEFERRED to 1
.                if !\\n[#PREV_FN_DEFERRED]=1 \{\
.                   nr #FN_DEFER 1
.                   nr #FN_DEPTH +\\n[#DIVER_DEPTH]
.                   rr #GET_DEPTH
.\" This is required so that the defer space clause can distinguish
.\" a real #FN_COUNT=1 from one generated if FOOTNOTE is run inside
.\" QUOTE, BLOCKQUOTE or EPIGRAPH
.                   if \\n[#DIVER_FN]=2 \{\
.                      nr #SAVED_DIVER_FN_COUNT \\n[#FN_COUNT]
.                      rr #DIVER_FN
.                   \}
.                \}
.             \}
.\" Calculate the footnote depth.
.             if \\n[#GET_DEPTH]=1 \{\
.\" Save the previous footnote depth (for use when there will be
.\" some overflowed footnote text).
.                nr #SAVED_FN_DEPTH_1 \\n[#FN_DEPTH]
.\" Add the depth of the current footnote to any already existent
.\" footnotes.
.                nr #FN_DEPTH +\\n[#DIVER_DEPTH]
.\" Special handling for run-on footnotes
.                if \\n[#RUN_ON]=1 \{\
.                   if \\n[#RUNON_FOOTNOTES] \{\
.                      unformat RUNON_FOOTNOTES
.                   \}
.                   if \\n[#RUNON_FN_IN_DIVER] \{\
.                      unformat RUNON_FN_IN_DIVER
.                   \}
.                   ev FOOTNOTES
.\" Recreate FOOTNOTES with rule followed by text of unformatted
.\" run-on footnotes.
.                   di FOOTNOTES
.                   ie \\n[#FN_RULE]=0 \{ .RLD 1v \}
.                   el \{\
.                      PRINT \v'-\\n[#FN_RULE_ADJ]u'\l'\\n[#FN_RULE_LENGTH]u'\v'+\\n[#FN_RULE_ADJ]u'
.                   \}
.                   br
.                   if \\n[#RUNON_FOOTNOTES] \{\
.                      RUNON_FOOTNOTES
.                      rr #RUNON_FOOTNOTES
.                   \}
.                   if \\n[#RUNON_FN_IN_DIVER] \{\
.                      RUNON_FN_IN_DIVER
.                      rr #RUNON_FN_IN_DIVER
.                   \}
.                   br
.                   di
.                   ev
.                   nr #FN_DEPTH \\n[#DIVER_DEPTH]
.                   nr #SAVED_VFP 0+\\n[#VARIABLE_FOOTER_POS]
.                   nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]u
.                \}
.\" Save the new depth
.                nr #SAVED_FN_DEPTH_2 \\n[#FN_DEPTH]
.\" Signal that defer space should be added when PROCESS_FN_LEFTOVER
.\" processes deferred footnotes.
.                if \\n[#FN_DEFER] \{\
.                   if \\n[#FN_COUNT]=2 \{\
.                      ie \\n[#COLUMNS] \{\
.                         if !\\n[#FROM_FOOTER] \{\
.                            if \\n[#FN_DEFER]=1 \{ .nr #FN_DEFER_SPACE 1 \}
.                            if \\n[#FN_COUNT_FOR_COLS]>=1 \{ .rr #FN_DEFER_SPACE \}
.                            if \\n[#FROM_HEADER] \{ .nr #FN_DEFER_SPACE 1 \}
.                         \}
.                      \}
.                      el \{\
.                         nr #FN_DEFER_SPACE 1
.                      \}
.                   \}
.                   rr #FN_DEFER
.                \}
.\" If the depth of the whole footnote won't fit in the space
.\" between where we are on the page and the bottom margin, calculate
.\" how much of it will fit.
.                if \\n[#FN_DEPTH]>\\n[#SPACE_REMAINING] \{\
.                   nr #FN_LINES 0 1
.                   while (\\n+[#FN_LINES]*\\n[#FN_LEAD])<\\n[#SPACE_REMAINING] \{\
.                      nr #FN_DEPTH (\\n[#FN_LINES]*\\n[#FN_LEAD])
.\}
.                   nr #VFP_DIFF \\n[#FN_DEPTH]-\\n[#SAVED_FN_DEPTH_1]
.                   nr #OVERFLOW 1
.\" Very occasionally, #VFP_DIFF, on a 1st footnote that isn't to
.\" be deferred, comes up with a depth equal to exactly 1 line
.\" of footnotes, i.e. enough room to print the rule and nothing
.\" else.  The following tests for such a condition, and rather than
.\" attempting to treat the footnote as an overflow, it tells mom to
.\" treat it as a special kind of deferred footnote (#FN_DEFER 2).
.                   if \\n[#SAVED_FN_DEPTH_1]=0 \{\
.                      if \\n[#FN_DEPTH]=\\n[#FN_LEAD] \{\
.                         nr #FN_DEFER 2
.                         nr #FN_DEPTH \\n[#SAVED_FN_DEPTH_2]
.                         rr #OVERFLOW
.                      \}
.                   \}
.                \}
.\" Calculate VFP based on whether the footnote overflows, or is to
.\" be treated normally.
.                ie \\n[#OVERFLOW]=1 \{\
.                   if \\n[#RUN_ON] \{\
.                      rr #VARIABLE_FOOTER_POS
.                      nr #VARIABLE_FOOTER_POS \\n[#SAVED_VFP]
.                   \}
.                   ie \\n[#FN_COUNT]=1 \{\
.                      ie \\n[#RULED]=1 \{\
.                         ie \\n[#COLUMNS]=1 \{\
.                            ie \\n[#COL_NUM]=\\n[#NUM_COLS] \{\
.                               ie \\n[#FROM_FOOTER] \{\
.                                  ie \\n[#FN_COUNT_FOR_COLS]>1 \{\
.                                     nr #FN_DEPTH -\\n[#FN_DEPTH]
.                                     if \\n[#DIVERTED]=1 \{ .nr #DIVERTED 3 \}
.                                     if !\\n[#PREV_FN_DEFERRED]=1 \{\
.                                        nr #FN_DEPTH -\\n[#VFP_DIFF]
.                                     \}
.                                  \}
.                                  el \{\
.                                     nr #VARIABLE_FOOTER_POS -\\n[#FN_DEPTH]
.                                     if \\n[#DIVERTED]=1 \{ .nr #DIVERTED 3 \}
.                                  \}
.                               \}
.                               el \{\
.                                  nr #VARIABLE_FOOTER_POS -(\\n[#FN_DEPTH])
.                               \}
.                            \}
.                            el \{\
.                               nr #VARIABLE_FOOTER_POS -(\\n[#FN_DEPTH])
.                            \}
.                         \}
.                         el \{ .nr #VARIABLE_FOOTER_POS -(\\n[#FN_DEPTH]) \}
.                      \}
.                      el \{\
.                         nr #VARIABLE_FOOTER_POS -\\n[#VFP_DIFF]
.                         if \\n[#DIVERTED]=1 \{ .nr #DIVERTED 3 \}
.                         if !\\n[#PREV_FN_DEFERRED]=1 \{\
.                            ie \\n[#COLUMNS]=1 \{\
.                               if !\\n[#FROM_FOOTER] \{\
.
.                               \}
.                            \}
.                            el \{\
.                               nr #FN_DEPTH -\\n[#VFP_DIFF]
.                            \}
.                         \}
.                         if \\n[#DIVERTED]=3 \{\
.                            if !\\n[#PREV_FN_DEFERRED] \{\
.                               if !\\n[#FROM_FOOTER] \{\
.                                  if \\n[#FN_COUNT]=1 \{\
.                                     if !\\n[#VFP_DIFF] \{\
.                                        if \\n[#FN_MARKER_STYLE]=1 \{\
.                                           da FOOTNOTES
\!.                                            ALD \\n[#FN_LEAD]u
.                                           di
.                                        \}
.                                        if \\n[#RESET_FN_NUMBER] \{\
.                                           da FOOTNOTES
\!.                                            ALD \\n[#FN_LEAD]u
.                                           di
.                                        \}
.                                     \}
.                                  \}
.                               \}
.                            \}
.                         \}
.                      \}
.                      nr #VARIABLE_FOOTER_POS -\\n[#VFP_DIFF]
.                      nr #FN_DEPTH \\n[#SAVED_FN_DEPTH_1]+\\n[#VFP_DIFF]
.                   \}
.                   el \{\
.                      nr #VARIABLE_FOOTER_POS -\\n[#VFP_DIFF]
.                      nr #FN_DEPTH \\n[#SAVED_FN_DEPTH_1]+\\n[#VFP_DIFF]
.                   \}
.                   rr #OVERFLOW
.                   rr #RULED
.                \}
.                el \{\
.                   nr #VARIABLE_FOOTER_POS -\\n[#DIVER_DEPTH]
.                   if \\n[#PREV_FN_DEFERRED]=1 \{\
.                      if \\n[#DIVERTED] \{\
.                         if !\\n[#FN_DEPTH]=\\n[#SAVED_FN_DEPTH_1] \{\
.                            nr #FN_DEPTH +\\n[#FN_LEAD]
.                            nr #VARIABLE_FOOTER_POS -\\n[#FN_LEAD] 
.                            rr #PREV_FN_DEFERRED
.                         \}
.                      \}
.                   \}
.                   if \\n[#FN_COUNT]>1 \{\
.                      nr #NO_BACK_UP 1
.                      rr #DIVERTED
.                      rr #RULED
.                   \}
.                \}
.             \}
.          \}
.          ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
.\" See VFP_CHECK for an explanation of the next lines.
.\" The trap has to be removed, prior to setting it, each time
.\" FOOTNOTE is run.
.          if \\n[#PRINT_STYLE]=2 \{\
.             ch VFP_CHECK
.             wh \\n[#VARIABLE_FOOTER_POS]u-\\n[#DOC_LEAD]u VFP_CHECK
.          \}
.\" If we have a footnote whose text has to be deferred to the next
.\" page, reset the FOOTER trap to its original location.
.          if \\n[#FN_DEFER] \{\
.             nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]u
.             ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
.          \}
.       \}
.       nr #NO_FN_MARKER 0
.    \}
.    if \\n[#ADD_BREAK] \{\
.       br
.       rr #ADD_BREAK
.    \}
.END
\#
\# Utility macros to manage footnotes that occur inside diversions
\# ---------------------------------------------------------------
\#
.ig
There are some redundancies here; they're left in in case unforeseen
footnote situations crop up in the future that might require
manipulation of them.
..
\#
\# 1. Pre-footnote processing for footnotes in diversions
\#
\# a) A footnote inside a diversion will be moved entirely (marker
\# in running text and text of footnote) to the next page/column.
\# 
.MAC DIVER_FN_1_PRE END
.    nr #RESET_FN_COUNTERS 1
.    nr #COUNTERS_RESET 1
.    if \\n[#DONE_ONCE]=1 \{\
.       if \\n[#FN_DEFER] \{\
.          if \\n[#SAVED_DIVER_FN_COUNT]=1 \{\
.             ie \\n[#COLUMNS]=1 \{\
.                if \\n[#COL_NUM]=\\n[#NUM_COLS] \{ .nr #FN_DEFER_SPACE 1 \}
.             \}
.             el \{\
.                nr #FN_DEFER_SPACE 1
.             \}
.          \}
.       \}
.       if \\n[#FN_MARKER_STYLE]=1 \{\
.          if \\n[#FN_COUNT]>0 \{ .nr #FN_COUNT 0 1 \}
.          if \\n[#COLUMNS]=1 \{\
.             if \\n[#COL_NUM]=\\n[#NUM_COLS] \{\
.                nr #FN_COUNT_FOR_COLS 0 1
.             \}
.          \}
.       \}
.       if \\n[#FN_MARKER_STYLE]=2 \{\
.          if \\n[#RESET_FN_NUMBER]=1 \{\
.             ie \\n[#COLUMNS]=1 \{\
.                if \\n[#COL_NUM]=\\n[#NUM_COLS] \{ .nr #FN_NUMBER 0 1 \}
.             \}
.             el \{\
.                nr #FN_NUMBER 0 1
.             \}
.          \}
.       \}
.    \}
.END
\#
\# b) Treat as a normal footnote, including defers.
\#
.MAC DIVER_FN_2_PRE END
.    nr #RESET_FN_COUNTERS 2
.END
\#
\# 2. Post-footnote processing for footnotes in diversions
\#
\# Even when a footnote inside a diversion is treated as
\# "normal," some manipulation of registers is required.  The
\# macro is called in DO_QUOTE (i.e. at the termination of
\# quotes and blockquotes) and in DO_EPIGRAPH.
\#
.MAC DIVER_FN_2_POST END
.    if \\n[#DONE_ONCE]=1 \{\
.       if \\n[#FN_MARKER_STYLE]=1 \{\
.          if \\n[#FN_COUNT]=0 \{\
.             nr #DONT_RULE_ME 1
.          \}
.          if \\n[#FN_COUNT]>0 \{\
.             nr #FN_COUNT 0 1
.          \}
.          if \\n[#COLUMNS]=1 \{\
.             if \\n[#COL_NUM]=\\n[#NUM_COLS] \{ .nr #FN_COUNT_FOR_COLS 0 1 \}
.             if !\\n[#COL_NUM]=\\n[#NUM_COLS] \{\
.             \}
.          \}
.       \}
.       if \\n[#FN_MARKER_STYLE]=2 \{\
.          if \\n[#FN_COUNT]=0 \{\
.             nr #DONT_RULE_ME 1
.          \}
.          if \\n[#FN_COUNT]>0 \{\
.             nr #FN_COUNT 0 1
.          \}
.          if \\n[#RESET_FN_NUMBER]=1 \{\
.             ie \\n[#COLUMNS]=1 \{\
.                if \\n[#COL_NUM]=\\n[#NUM_COLS] \{ .nr #FN_NUMBER 0 1 \}
.             \}
.             el \{\
.                nr #FN_NUMBER 0 1
.             \}
.          \}
.       \}
.    \}
.END
\#
\# The main macros that handle footnote processing.
\# -----------------------------------------------
\#
.ig
Sometimes, #VARIABLE_FOOTER_POS sets FOOTER at a location that gives
the impression another line of running text could fit on the page.
VFP_CHECK is always set to the line just above the one where FOOTER
will be sprung, and checks for this condition.  If it exists, FOOTER
is set one line lower on the page, thus squeezing in an extra line
of running text.  This is a judgment call on my part, but seems to
work well.  If there are problems (e.g. footnotes really do look
jammed), the user should probably adjust FOOTNOTE_AUTOLEAD and/or
FOOTNOTE_RULE_ADJ.

The macro has to be run in its own environment, otherwise the first
word of the last line before the footnotes gets chopped.
..
\#
.MAC VFP_CHECK END
.    ev VFP_CHECK
.\" The trap also has to be removed each time VFP_CHECK is run
.    if \\n[#PRINT_STYLE]=2 \{\
.       ch VFP_CHECK
.       SIZESPECS
.       ie !\\n[#IN_DIVER] \{ .nr #PAGE_POS \\n(nl \}
.       el \{ .nr #PAGE_POS \\n(nl+\\n(.d+(\\n[#DOC_LEAD]) \}
.       nr #FOOTER_POS \\n[#PAGE_LENGTH]+(\\n[#VARIABLE_FOOTER_POS])
.       nr #SPACE_TO_FOOTER \\n[#FOOTER_POS]-\\n[#PAGE_POS]
.       nr #FN_GAP \\n[#SPACE_TO_FOOTER]%\\n[#DOC_LEAD]
.       if !\\n[#FN_GAP]<0 \{\
.          if \\n[#FN_GAP]<\\n[#DOC_LEAD] \{\
.             ie (\\n[#PAGE_POS]+(\\n[#FN_DEPTH]+\\n[#FN_GAP]))>(\\n[#VISUAL_B_MARGIN]) \{\
.                nr #VARIABLE_FOOTER_POS 0+\\n[#VARIABLE_FOOTER_POS]
.             \}
.             el \{\
.                ie \\n[#DOC_LEAD]-\\n[#FN_GAP]<\\n[#DESCENDER] \{\
.                   nr #VARIABLE_FOOTER_POS +\\n[#DOC_LEAD]
.                   ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
.                \}
.                el \{\
.                   nr #VARIABLE_FOOTER_POS 0+\\n[#VARIABLE_FOOTER_POS]
.                \}
.             \}
.          \}
.       \}
.    \}
.    ev
.END
\#
.ig
FN_OVERFLOW_TRAP starts off "underneath" FOOTER, but is revealed
as #VARIABLE_FOOTER_POSITION changes the position of FOOTER.
FN_OVERFLOW_TRAP simply starts diversion FN_OVERFLOW to "catch"
the overflow.  The diversion is ended in FOOTER, immediately after
FOOTER outputs the diversion, FOOTNOTES, before PROCESS_FN_LEFTOVER
is run (either in HEADER, or in FOOTER if moving col to col).
..
\#
.MAC FN_OVERFLOW_TRAP END 
.    if \\n[#FN_COUNT] \{\
.       di FN_OVERFLOW
.       ie !\\n[#NO_BACK_UP]=1 \{\
.          if \\n[#PREV_FN_DEFERRED] \{\
.             ie \\n[#COLUMNS]=1 \{\
.                if \\n[#FROM_FOOTER] \{\
.                   if \\n[#PREV_FN_DEFERRED] \{\
.                      if !\\n[#COL_NUM]=\\n[#NUM_COLS] \{\
.                      rr #PREV_FN_DEFERRED
.                      \}
.                   \}
.                \}
.                if !\\n[#FROM_FOOTER] \{\
.                   if !\\n[#COL_NUM]=\\n[#NUM_COLS] \{\
.                      if !\\n[#LAST_FN_COUNT_FOR_COLS]>1 \{\
\!.                       RLD \\n[#FN_LEAD]u
.                      \}
.                   \}
.                \}
.             \}
.             el \{\
\!.              RLD \\n[#FN_LEAD]u
.             \}
.          \}
.       \}
.       el \{\
.          rr #NO_BACK_UP
.          rr #PREV_FN_DEFERRED
.       \}
.    \}
.\" When #FROM_DIVERT_FN is 1, it signals to FOOTNOTE, when run from
.\" within DIVERT_FN_LEFTOVER, to set #SPACE_REMAINING to the total
.\" area allowable for running text.
.    nr #FROM_DIVERT_FN 1
.END
\#
.ig
PROCESS_FN_LEFTOVER is called at the top of HEADER, and in
FOOTER if we're moving from one column to the next (i.e. after
outputting FOOTNOTES).  It checks for whether we have a "deferred
footnote" situation, and resets counters and number registers
accordingly.  Lastly, if we have some footnote overflow, it calls
DIVERT_FN_OVERFLOW.
..
\#
.MAC PROCESS_FN_LEFTOVER END
.    if \\n[#PREV_FN_DEFERRED]=2 \{\
.       if \\n[#FN_COUNT_AT_FOOTER]>1 \{ .rr #PREV_FN_DEFERRED \}
.    \}
.    if !\\n[#FN_DEFER] \{\
.       nr #FN_COUNT 0 1
.       nr #FN_DEPTH 0
.       nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]
.    \}
.    if r#FN_DEFER \{\
.       if \\n[#FN_DEFER]=1 \{\
.          nr #VARIABLE_FOOTER_POS -\\n[#FN_DEPTH]
.       \}
.       if \\n[#FN_DEFER]=2 \{\
.          nr #FN_DEPTH 0
.          nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]
.       \}
.    \}
.    nr #SPACE_REMAINING 0
.    ch FOOTER -\\n[#B_MARGIN]u
.    if \\n[#FN_DEFER] \{\
.       nr #NO_FN_MARKER 1
.       FOOTNOTE
.       nf
.       FOOTNOTE OFF
.       ie \\n[#COLUMNS]=1 \{\
.          if \\n[#COL_NUM]=\\n[#NUM_COLS] \{\
.             if !\\n[#FROM_FOOTER] \{\
.                if \\n[#FN_COUNT_FOR_COLS]=1 \{ .nr #PREV_FN_DEFERRED 1 \}
.             \}
.          \}
.       \}
.       el \{ .nr #PREV_FN_DEFERRED 1 \}
.    \}
.    if !\\n[#FN_DEFER] \{\
.       if \\n[#FN_OVERFLOW_DEPTH] \{\
.          DIVERT_FN_LEFTOVER
.       \}
.    \}
.    ie \\n[#COLUMNS]=1 \{\
.       if \\n[#COL_NUM]>1 \{\
.          if \\n[#COL_NUM]=\\n[#NUM_COLS] \{ .nr #FN_COUNT 0 1 \}
.       \}
.    \}
.    el \{ .nr #FN_COUNT 0 1 \}
.    if \\n[#DIVER_FN]=2 \{ .rr #DIVER_FN \}
.    rr #FROM_DIVERT_FN
.END
\#
.ig
DIVERT_FN_LEFTOVER is called in PROCESS_FN_LEFTOVER (at
the top of HEADER, and in FOOTER if we're moving from one column
to the next).
..
\#
.MAC DIVERT_FN_LEFTOVER END
.    nr #NO_FN_MARKER 1
.    nr #DIVERTED 1
.    FOOTNOTE
.    nf
.    FN_OVERFLOW
.    FOOTNOTE OFF
.    if \\n[#PREV_FN_DEFERRED] \{\
.       nr #FN_DEPTH -\\n[#FN_LEAD]
.       nr #VARIABLE_FOOTER_POS +\\n[#FN_LEAD]  
.       ch FOOTER \\n[#VARIABLE_FOOTER_POS]u
.       if \\n[#PREV_FN_DEFERRED]=2 \{\
.          nr #PREV_FN_DEFERRED 1
.          rr #DIVERTED
.       \}
.    \}
.    rr #FN_OVERFLOW_DEPTH
.END
\#
.ig
This is a special macro to deal with footnotes that are set inside
diversions (QUOTE, BLOCKQUOTE and EPIGRAPH).  It's called in HEADER
(and in FOOTER, if we're moving from column to column), and comes
after PROCESS_FOOTNOTE_LEFTOVER in those two macros.
..
\#
.MAC PROCESS_FN_IN_DIVER END
.    nr #SPACE_REMAINING 0
.    ch FOOTER -\\n[#B_MARGIN]u
.    nr #NO_FN_MARKER 1
.    if !\\n[#RESET_FN_COUNTERS]=2 \{\
.       rr #RESET_FN_COUNTERS
.    \}
.    FOOTNOTE
.    if \\n[#FN_OVERFLOW_DEPTH] \{ .nf \}
.    ie dRUNON_FN_IN_DIVER \{\
.       RUNON_FN_IN_DIVER
.       rm RUNON_FN_IN_DIVER
.    \}
.    el \{\
.       nf
.       FN_IN_DIVER
.    \}
.    FOOTNOTE OFF
.    rr #DIVER_FN
.END
\#
\# ====================================================================
\#
\# +++ENDNOTES+++
\#
.ig
When endnotes are output, the spacing between the notes is always
1 extra linespace.  This can have bottom margin consequences.  If
this doesn't bother you, don't worry about it.  If it does bother
you, and you want to adjust the spacing between any two endnotes (as
they're output), make the spacing adjustments (.ALD/.RLD) at the
*end* of endnotes (i.e. just before .ENDNOTE OFF), not at the top.

Endnotes must be output manually with .ENDNOTES. This allows user
the flexibility to output endnotes at the end of each collated
document, or to output them at the end of the entire document.
..
\#
\# Control macros
\#
\# ENDNOTE POINT SIZE
\# ------------------
\# *Argument:
\#   <base point size for endnotes>
\# *Function:
\#   Creates or modifies register #EN_PS.
\# *Notes:
\#   Default is same as running text in body of document.
\#
\#   This size control macro differs from other size control macros
\#   in that it sets an absolute point size, not a relative one.  This
\#   is because a) endnotes always appear separate from the body of
\#   a document and therefore don't need to be relative to the body
\#   of the document, and b) there are quite a few elements of the
\#   endnotes page(s) that need to be relative to the base point size
\#   of that page.  If the base endnote point size were relative to
\#   the body of the document (i.e. a _SIZE macro taking a +|- value)
\#   getting the rest of the endnote elements sized properly could
\#   become very confusing.
\#
.MAC ENDNOTE_PT_SIZE END
.    nr #EN_PS (p;\\$1)
.END
\#
\#
\# ENDNOTE LEAD
\# ------------
\# *Argument:
\#   <base leading to use in endnotes> [ ADJUST ]
\# *Function:
\#   Creates or modifies register #EN_LEAD.  Creates or removes
\#   register #ADJ_EN_LEAD.  Stores arguments in strings if ENDNOTE_LEAD
\#   set before START.
\# *Notes:
\#   Default is 14 points for TYPESET, adjusted; 24 for TYPEWRITE.
\#
.MAC ENDNOTE_LEAD END
.    if !\\n[#OK_PROCESS_LEAD] \{\
.       ds $EN_LEAD \\$1
.       if !'\\$2'' \{\
.           ds $ADJUST_EN_LEAD \\$2
.       \}
.       return
.    \}
.    rr #ADJ_EN_LEAD
.    nr #EN_LEAD (p;\\$1)
.    if '\\$2'ADJUST' \{\
.       nr #ORIG_DOC_LEAD \\n[#DOC_LEAD]
.       nr #RESTORE_ADJ_DOC_LEAD \\n[#ADJ_DOC_LEAD]
.       nr #ADJ_DOC_LEAD 1
.       nr #ADJ_EN_LEAD 1
.       nr #NO_TRAP_RESET 1
.       DOC_LEAD \\n[#EN_LEAD]u ADJUST
.       nr #EN_LEAD \\n[#DOC_LEAD]
.       DOC_LEAD \\n[#ORIG_DOC_LEAD]u
.       rr #NO_TRAP_RESET
.       nr #ADJ_DOC_LEAD \\n[#RESTORE_ADJ_DOC_LEAD]
.       rr #ORIG_DOC_LEAD
.    \}
.END
\#
\#
\# ENDNOTES_HDRFTR_CENTER
\# ----------------------
\# *Argument:
\#   toggle
\# *Function:
\#   Creates or removes toggle register #EN_HDRFTR_CENTER, used to
\#   determine whether mom should print a/the hdrftr center string
\#   on the endnotes page.  Primarily to enable/disable printing of the
\#   chapter name in hdrftrs when DOCTYPE CHAPTER.
\# *Notes:
\#   Default is OFF
\#
.MAC ENDNOTES_HDRFTR_CENTER END
.    ie '\\$1'' \{ .nr #EN_HDRFTR_CENTER 1 \}
.    el         \{ .rr #EN_HDRFTR_CENTER   \}
.END
\#
\#
\# ENDNOTE STRING 
\# --------------
\# *Argument:
\#   <title for endnotes page>
\# *Function:
\#   Creates or modifies string $EN_STRING.
\# *Notes:
\#   Default is "Endnotes"
\#
.MAC ENDNOTE_STRING END
.    ds $EN_STRING \\$1
.END
\#
\#
\# ENDNOTE STRING UNDERSCORE
\# -------------------------
\# *Arguments:
\#   toggle | 2
\# *Function:
\#   Turns underscoring of endnote main title on or off.  If the argument
\#   is the digit "2", turns on double-underscoring.
\# *Notes:
\#   Default is double-underscored.
\#
.MAC ENDNOTE_STRING_UNDERSCORE END
.    ie '\\$1'' \{ .nr #EN_STRING_UNDERSCORE 1 \}
.    el \{\
.       ie '\\$1'2' \{ .nr #EN_STRING_UNDERSCORE 2 \}
.       el \{ .nr #EN_STRING_UNDERSCORE 0 \}
.    \}
.END
\#
\#
\# ENDNOTE STRING CAPS
\# -------------------
\# *Arguments:
\#   <none> | <anything>
\# *Function:
\#   Turns capitalization of the endnotes pages title string
\#   "Endnotes" on or off.
\# *Notes:
\#   Users may want the endnotes pages title string to be in caps,
\#   but the toc entry for endnotes in lower case.  If the argument
\#   to ENDNOTE_STRING is in lower case and ENDNOTE_STRING_CAPS is
\#   turned on, this is exactly what will happen.
\#
\#   Default is on.
\#
.MAC ENDNOTE_STRING_CAPS END
.   ie '\\$1'' \{ .nr #EN_STRING_CAPS 1 \}
.   el \{ .rr #EN_STRING_CAPS \}
.END
\#
\#
\# ENDNOTE TITLE
\# -------------
\# *Argument:
\#   <string that appears before the first endnote pertaining to any document>
\# *Function:
\#   Creates string $EN_TITLE_STRING.
\# *Notes:
\#   Default is the document title, or, if doc is a chapter, "Chapter #"
\#
.MAC ENDNOTE_TITLE END
.    ds $EN_TITLE \\$1
.END
\#
\#
.MAC ENDNOTE_TITLE_SPACE END
.    nr #EN_TITLE_SPACE (\\$1)
.END
\#
\#
\# ENDNOTE TITLE UNDERSCORE
\# ------------------------
\# *Argument:
\#   toggle
\# *Function:
\#   Creates or removes register #EN_TITLE_UNDERSCORE.
\# *Notes:
\#   Default is to underscore the endnote titles.
\#
.MAC ENDNOTE_TITLE_UNDERSCORE END
.    ie '\\$1'' \{ .nr #EN_TITLE_UNDERSCORE 1 \}
.    el \{ .rr #EN_TITLE_UNDERSCORE \}
.END
\#
\#
\# ENDNOTE MARKER STYLE
\# --------------------
\# *Arguments:
\#   NUMBER | LINE
\# *Function:
\#   Sets register #EN_MARKER_STYLE, used in ENDNOTE to determine
\#   the style of endnote markers (labels).
\# *Notes:
\#   1=NUMBER; 2=LINE.  LINE means "use output line numbers".
\#   Default is NUMBER.
\#
.MAC ENDNOTE_MARKER_STYLE END
.    if '\\$1'NUMBER' \{\
.       nr #EN_MARKER_STYLE 1
.    \}
.    if '\\$1'LINE' \{\
.       nr #EN_MARKER_STYLE 2
.       if !\\n[#EN_LN_SEP] \{\
.          if !\\n[#EN_LN_BRACKETS] \{ .ENDNOTE_LINENUMBER_BRACKETS SQUARE \}
.       \}
.    \}
.END
\#
\#
\# ENDNOTE LINENUMBER MARK
\# -----------------------
\# *Function:
\#   This string, when called inline, stores the current output line
\#   number in register #EN_MARK for use with ENDNOTE.
\#
.ds EN-MARK \R'#EN_MARK \En(ln'
\#
\#
\# ENDNOTE LINENUMBER SEPARATOR
\# ----------------------------
\# *Argument:
\#   <user-defined separator>
\# *Function:
\#   Stores user-defined separator (for use then
\#   ENDNOTE_MARKER_STYLE is LINE) in string $EN_LN_SEP.  The
\#   separator is intended to be used when the user wishes a
\#   separator, rather than the choice of brackets offered by
\#   ENDNOTE_LINENUMBER_BRACKETS.
\#
.MAC ENDNOTE_LINENUMBER_SEPARATOR END
.    rr #EN_LN_BRACKETS
.    nr #EN_LN_SEP 1
.    ds $EN_LN_SEP "\\$1
.END
\#
\#
\# ENDNOTE LINENUMBER BRACKETS
\# ---------------------------
\# *Argument:
\#   PARENS | SQUARE | BRACES or ( | [ | {
\# *Function:
\#   Sets register #EN_LN_BRACKETS to 1, and creates strings
\#   $EN_OPEN_BRACKET and $EN_CLOSE_BRACKET according to the given argument.
\#
.MAC ENDNOTE_LINENUMBER_BRACKETS END
.    rr #EN_LN_SEP
.    nr #EN_LN_BRACKETS 1
.    if '\\$1'PARENS' \{\
.       ds $EN_OPEN_BRACKET (
.       ds $EN_CLOSE_BRACKET )
.    \}
.    if '\\$1'(' \{\
.       ds $EN_OPEN_BRACKET (
.       ds $EN_CLOSE_BRACKET )
.    \}
.    if '\\$1'SQUARE' \{\
.       ds $EN_OPEN_BRACKET [
.       ds $EN_CLOSE_BRACKET ]
.    \}
.    if '\\$1'[' \{\
.       ds $EN_OPEN_BRACKET [
.       ds $EN_CLOSE_BRACKET ]
.    \}
.    if '\\$1'BRACES' \{\
.       ds $EN_OPEN_BRACKET {
.       ds $EN_CLOSE_BRACKET }
.    \}
.    if '\\$1'{' \{\
.       ds $EN_OPEN_BRACKET {
.       ds $EN_CLOSE_BRACKET }
.    \}
.END
\#
\#
\# ENDNOTE LINENUMBER GAP
\# ----------------------
\# *Argument:
\#   <space between line-number labels and endnotes text>
\# *Function:
\#   Defines string $EN_LN_GAP, used during printing of line-number
\#   labels in ENDNOTE.
\#
.MAC ENDNOTE_LINENUMBER_GAP END
.    ds $EN_LN_GAP \\$1
.END
\#
\#   
\# ENDNOTE NUMBERS ALIGN RIGHT
\# ---------------------------
\# *Argument:
\#   <max. number of digit placeholders that will appear in endnotes>
\# *Function:
\#   Toggles register #EN_NUMBERS_ALIGN_RIGHT on; creates register
\#   #EN_NUMBER_PLACEHOLDERS.
\# *Notes:
\#   Default is for footnote numbers to be right aligned to 2 placeholders.
\#
.MAC ENDNOTE_NUMBERS_ALIGN_RIGHT END
.    rr #EN_NUMBERS_ALIGN_LEFT
.    nr #EN_NUMBERS_ALIGN_RIGHT 1
.    nr #EN_NUMBER_PLACEHOLDERS \\$1
.END
\#
\#
\# ENDNOTE NUMBERS ALIGN LEFT
\# --------------------------
\# *Argument:
\#   none
\# *Function:
\#   Toggles register #EN_NUMBERS_ALIGN_LEFT on.
\# *Notes:
\#   Default is for footnote numbers to be right aligned to 2 placeholders
\#   (i.e. not left aligned).
\#
.MAC ENDNOTE_NUMBERS_ALIGN_LEFT END
.    rr #EN_NUMBERS_ALIGN_RIGHT
.    nr #EN_NUMBERS_ALIGN_LEFT 1
.END
\#
\#
\# ENDNOTE PARAGRAPH INDENT
\# ------------------------
\# *Argument:
\#   <first line indent of paras subsequent to 1st in endnotes>
\# *Function:
\#   Creates register #EN_PP_INDENT for use in .PP.
\# *Notes:
\#   Requires a unit of measure.
\#
\#   Default is 1.5m for TYPESET; same indent as PARA_INDENT for TYPEWRITE.
\#
.MAC ENDNOTE_PARA_INDENT END
.    nr #EN_PP_INDENT (\\$1)
.END
\#
\#
\# TURN OFF COLUMN MODE FOR ENDNOTES
\# ---------------------------------
\# *Argument:
\#   <none> | <anything>
\# *Function:
\#   Creates or removes register #EN_NO_COLS
\# *Notes:
\#   Allows user to tell mom not to set endnotes in columnar
\#   documents in columns.  Default is to set endnotes in columns.
\#
.MAC ENDNOTES_NO_COLUMNS END
.    ie '\\$1'' \{ .nr #EN_NO_COLS 1 \}
.    el \{ .rr #EN_NO_COLS \}
.END
\#
\#
\# NO FIRST PAGE NUMBER ON ENDNOTES FIRST PAGE
\# -------------------------------------------
\# *Argument:
\#   <none> | <anything>
\# *Function:
\#   Creates or removes register #EN_NO_FIRST_PN
\# *Notes:
\#   For use if FOOTERS are on.  Tells ENDNOTES not to put a page
\#   number on the first endnotes page.  Some users may want this.
\#   Default is to print a page number at the top of the first
\#   endnotes page when footers are on.
\#
.MAC ENDNOTES_NO_FIRST_PAGENUM END
.    ie '\\$1'' \{ .nr #EN_NO_FIRST_PN 1 \}
.    el \{ .rr #EN_NO_FIRST_PN \}
.END
\#
\#
\# PAGE HEADERS ON ENDNOTES PAGES
\# ------------------------------
\# *Argument:
\#   <none> | ALL
\# *Function:
\#   Creates or removes register #EN_ALLOWS_HEADERS or
\#   #EN_ALLOWS_HEADERS_ALL
\# *Notes:
\#   Whether ENDNOTES puts a page header at the top of endnotes
\#   pages if page headers are used throughout the document.
\#   Default is to insert the page headers, but not on the first
\#   page.  If the optional argument ALL is given, ENDNOTES puts a
\#   page header on the first page as well.
\#
.MAC ENDNOTES_ALLOWS_HEADERS END
.    ie '\\$1'' \{ .nr #EN_ALLOWS_HEADERS 1 \}
.    el \{\
.       ie '\\$1'ALL' \{\
.          nr #EN_ALLOWS_HEADERS 1
.          nr #EN_ALLOWS_HEADERS_ALL 1
.       \}
.       el \{\
.          rr #EN_ALLOWS_HEADERS
.          rr #EN_ALLOWS_HEADERS_ALL
.       \}
.    \}
.END
\#
\#
\# ENDNOTES PAGES PAGE NUMBERING STYLE
\# -----------------------------------
\# *Argument:
\#   DIGIT | ROMAN | roman | ALPHA | alpha
\# *Function:
\#   Creates or modifies $EN_PN_STYLE.
\# *Notes:
\#   Allows user to define what style should be used for endnotes
\#   pages page numbering.  Arguments are the same as for
\#   PAGENUM_STYLE.
\#
\#   Default is DIGIT.
\#
.MAC ENDNOTES_PAGENUM_STYLE END
.    ds $EN_PN_STYLE \\$1
.END
\#
\#
\# FIRST PAGE NUMBER FOR ENDNOTES
\# ------------------------------
\# *Argument:
\#   <page number that appears on page 1 of endnotes pages>
\# *Function:
\#   Creates or modifies string $EN_FIRST_PN
\# *Notes:
\#   To be used with caution, only if all endnotes
\#   are to be output at once, i.e. not at the end of the separate
\#   docs of a collated doc
\#
.MAC ENDNOTES_FIRST_PAGENUMBER END
.    nr #EN_FIRST_PN \\$1
.END
\#
\# SINGLESPACE ENDNOTES
\# --------------------
\# *Argument:
\#   <none> | <anything>
\# *Function:
\#   Sets lead of endnotes pages in TYPEWRITE to 12 points,
\#   adjusted.
\# *Notes:
\#   Default is to double-space endnotes pages.
\#
.MAC SINGLESPACE_ENDNOTES END
.    if \\n[#PRINT_STYLE]=1 \{\
.       ie \\n[#SINGLE_SPACE] \{\
.          nr #EN_SINGLESPACE 1
.          rr #IGNORE
.          if \\n[#OK_PROCESS_LEAD] \{\
.             ENDNOTE_LEAD 12 ADJUST
.             nr #IGNORE 1
.          \}
.       \}
.       el \{\
.          ie '\\$1'' \{\
.             nr #EN_SINGLESPACE 1
.             rr #IGNORE
.             if \\n[#OK_PROCESS_LEAD] \{\
.                ENDNOTE_LEAD 12 ADJUST
.                nr #IGNORE 1
.             \}
.          \}
.          el \{\
.             rr #EN_SINGLESPACE
.             rr #IGNORE
.             if \\n[#OK_PROCESS_LEAD] \{\
.                ENDNOTE_LEAD 24 ADJUST
.                nr #IGNORE 1
.             \}
.          \}
.       \}
.    \}
.END
\#
\#
\# ENDNOTE PARAGRAPH SPACE
\# -----------------------
\# *Argument:
\#   toggle
\# *Function:
\#   Creates toggle register #EN_PP_SPACE for use in .PP.
\# *Notes:
\#   Like PARA_SPACE.  Default is not to space endnote paras.
\#
.MAC ENDNOTE_PARA_SPACE END
.    ie '\\$1'' \{ .nr #EN_PP_SPACE 1 \}
.    el \{ .rr #EN_PP_SPACE \}
.END
\#
\#
\# ENDNOTE
\# -------
\# *Argument:
\#   toggle
\# *Function:
\#   Places superscript endnote number in text, then collects and
\#   processes endnote in diversion END_NOTES.
\# *Notes:
\#   \c must be appended to the word immediately preceding .ENDNOTE
\#   when ENDNOTE_MARKER_STYLE is NUMBER.
\#
.MAC ENDNOTE END
.    if !\\n(.u \{ .nr #ADD_BREAK 1 \}
.    ie '\\$1'' \{\
.       nr #ENDNOTE 1
.       if \\n[#EN_MARKER_STYLE]=1 \{\
.          if \\n[#CONDENSE] \{ \*[CONDX]\c \}
.          if \\n[#EXTEND]   \{ \*[EXTX]\c  \}
.          if \\n[#PRINT_STYLE]=1 \{\
.             if \\n[#UNDERLINE_ON] \{\
.                nr #UNDERLINE_WAS_ON 1
.                UNDERLINE OFF
.             \}
.             if \\n[#SLANT_ON] \{\
.                 nr #SLANT_WAS_ON 1
\*[SLANTX]\c
.             \}
.             PRINT "\s-2\v'-\\n[#DOC_LEAD]u/5u'\\n+[#EN_NUMBER]\v'+\\n[#DOC_LEAD]u/5u'\s+2\c"
.          \}
.          if \\n[#PRINT_STYLE]=2 \{ .PRINT "\*[SUP]\\n+[#EN_NUMBER]\*[SUPX]\c" \}
.       \}
.       if \\n[#EN_MARKER_STYLE]=2 \{\
.          if !\\n[#LINENUMBERS] \{\
.             tm1 "[mom]: Line numbering must be enabled with NUMBER_LINES when
.             tm1 "       ENDNOTE_MARKER_STYLE is LINE.
.             ab Aborting on ENDNOTE at line \\n(.c.
.          \}
.          if \\n[#EN_MARK]=0 \{ .nr #EN_MARK \\n(ln \}
.          nr #EN_MARK_2 \\n(ln
.          if '\\n(.z'P_QUOTE' \{\
.             nr #EN_MARK -1
.             nr #EN_MARK_2 -1
.          \}
.       \}
.       nr #PP_STYLE_PREV \\n[#PP_STYLE]
.       nr #PP_STYLE 1
.       if \\n[#INDENT_FIRST_PARAS] \{ .nr #INDENT_FIRSTS 1 \}
.       INDENT_FIRST_PARAS
.       ev EN
.       da END_NOTES
.       LL \\n[#DOC_L_LENGTH]u
.       ta \\n(.lu
.       if \\n[#COLUMNS] \{\
.          ie \\n[#EN_NO_COLS] \{ .LL \\n[#DOC_L_LENGTH]u \}
.          el \{ .LL \\n[#COL_L_LENGTH]u \}
.          ta \\n(.lu
.       \}
.       vs \\n[#EN_LEAD]u
.       if \\n[#EN_NUMBER]=1 \{\
\!.        ne 3
.          if \\n[#PRINT_STYLE]=1 \{\
.             TYPEWRITER
.          \}
.          if \\n[#PRINT_STYLE]=2 \{\
.             FAMILY  \\*[$EN_TITLE_FAM]
.             FT      \\*[$EN_TITLE_FT]
.             PT_SIZE \\n[#EN_PS]u\\*[$EN_TITLE_SIZE_CHANGE]
.          \}
.          sp
.          if !'\\*[$EN_TITLE]'' \{\
.             if '\\*[$EN_TITLE_QUAD]'L'      \{ .LEFT   \}
.             if '\\*[$EN_TITLE_QUAD]'LEFT'   \{ .LEFT   \}
.             if '\\*[$EN_TITLE_QUAD]'C'      \{ .CENTER \}
.             if '\\*[$EN_TITLE_QUAD]'CENTER' \{ .CENTER \}
.             if '\\*[$EN_TITLE_QUAD]'CENTRE' \{ .CENTER \}
.             if '\\*[$EN_TITLE_QUAD]'R'      \{ .RIGHT  \}
.             if '\\*[$EN_TITLE_QUAD]'RIGHT'  \{ .RIGHT  \}
.             ie \\n[#EN_TITLE_UNDERSCORE] \{\
.                UNDERSCORE "\\*[$EN_TITLE]
.             \}
.             el \{\
.                PRINT "\\*[$EN_TITLE]
.             \}
.          \}
.       \}
.       ie \\n[#EN_NUMBER]=1 \{\
.          if !'\\*[$EN_TITLE]'' \{ .sp \}
.       \}
.       el \{ .sp \}
.       if \\n[#PRINT_STYLE]=1 \{\
.          TYPEWRITER
.       \}
.       if \\n[#PRINT_STYLE]=2 \{\
.          if \\n[#EN_MARKER_STYLE]=1 \{\
.             FAMILY  \\*[$EN_NUMBER_FAM]
.             FT      \\*[$EN_NUMBER_FT]
.             PT_SIZE \\n[#EN_PS]u\\*[$EN_NUMBER_SIZE_CHANGE]
.          \}
.          if \\n[#EN_MARKER_STYLE]=2 \{\
.             FAMILY  \\*[$EN_LN_FAM]
.             FT      \\*[$EN_LN_FT]
.             PT_SIZE \\n[#EN_PS]u\\*[$EN_LN_SIZE_CHANGE]
.          \}
.       \}
.       if \\n[#EN_MARKER_STYLE]=2 \{\
.          ENDNOTE_NUMBERS_ALIGN_LEFT
.          ie \\n[#EN_LN_BRACKETS]=1 \{\
.             ds $EN_LINENUMBER \v'-.085m'\\*[$EN_OPEN_BRACKET]\v'.085m'
.             ie \\n[#EN_MARK_2]=\\n[#EN_MARK] \{\
.                as $EN_LINENUMBER \\n[#EN_MARK]\v'-.085m'\\*[$EN_CLOSE_BRACKET]\v'.085m' \"
.             \}
.             el \{\
.                as $EN_LINENUMBER \\n[#EN_MARK]\v'-.1m'-\v'.1m'\\n[#EN_MARK_2]\v'-.085m'\\*[$EN_CLOSE_BRACKET]\v'.085m' \"
.             \}
.          \}
.          el \{\
.             ie \\n[#EN_MARK_2]=\\n[#EN_MARK] \{\
.                ds $EN_LINENUMBER \\n[#EN_MARK]\\*[$EN_LN_SEP]
.             \}
.             el \{\
.                ds $EN_LINENUMBER \\n[#EN_MARK]\v'-.1m'-\v'.1m'\\n[#EN_MARK_2]\\*[$EN_LN_SEP]
.             \}
.          \}
.          nr #EN_MARK 0
.       \}
\!.     TRAP OFF
.       nr #RESET_L_LENGTH \\n(.l
.       ie \\n[#EN_NUMBERS_ALIGN_RIGHT] \{\
.          nr #EN_NUMBER_L_LENGTH \w'\0'*\\n[#EN_NUMBER_PLACEHOLDERS]+\w'.'
.          RIGHT
.       \}
.       el \{\
.          nr #EN_NUMBER_L_LENGTH \w'\En[#EN_NUMBER].\0'
.          LEFT
.       \}
.       if \\n[#EN_MARKER_STYLE]=2 \{\
.          if !\\n[#EN_NUMBERS_ALIGN_RIGHT] \{\
.             nr #EN_NUMBER_L_LENGTH \w'\\*[$EN_LINENUMBER]'+\\*[$EN_LN_GAP]
.             LEFT
.          \}
.       \}
.       ll \\n[#EN_NUMBER_L_LENGTH]u
.       if \\n[#EN_MARKER_STYLE]=1 \{\
\En[#EN_NUMBER].
.       \}
.       if \\n[#EN_MARKER_STYLE]=2 \{\
\\*[$EN_LINENUMBER]
.          rm $EN_LINENUMBER
.       \}
.       EOL
.       ll \\n[#RESET_L_LENGTH]u
.       nr #EN_FIGURE_SPACE \w'\0.'
.       ie \\n[#EN_NUMBERS_ALIGN_RIGHT] \{\
.          in \\n[#EN_NUMBER_L_LENGTH]u+\\n[#EN_FIGURE_SPACE]u
.       \}
.       el \{\
.          ti \\n[#EN_NUMBER_L_LENGTH]u
.       \}
.       nr #EN_TEXT_INDENT \\n(.i
.       QUAD \\*[$EN_QUAD]
\!.     TRAP
.       if \\n[#PRINT_STYLE]=1 \{\
.          TYPEWRITER
.       \}
.       if \\n[#PRINT_STYLE]=2 \{\
.          FAMILY  \\*[$EN_FAM]
.          FT      \\*[$EN_FT]
.          PT_SIZE \\n[#EN_PS]u
.       \}
.       if \\n[#REF]=1 \{\
.          ie !\\n[#EN_MARKER_STYLE]=2 \{\
.             if \\n[#EN_NUMBERS_ALIGN_LEFT] \{\
.                in \\*[$REF_EN_INDENT]
.                ti -(\\*[$REF_EN_INDENT]-\\n[#EN_NUMBER_L_LENGTH]u)
.             \}
.             if \\n[#EN_NUMBERS_ALIGN_RIGHT] \{\
.                in \\*[$REF_EN_INDENT]
.                ti -(\\*[$REF_EN_INDENT]-\\n[#EN_NUMBER_L_LENGTH]u-\\n[#EN_FIGURE_SPACE]u)
.             \}
.          \}
.          el \{\
.             if \\n[#EN_NUMBERS_ALIGN_LEFT] \{\
.                in \\*[$REF_EN_INDENT]
.                ti -(\\*[$REF_EN_INDENT]-\\n[#EN_NUMBER_L_LENGTH]u)
.             \}
.          \}
.       \}
.    \}
.    el \{\
.       br
.          in 0
.       if \\n[#EN_MARKER_STYLE]=2 \{\
\!.        in 0
.       \}
.       di
.\" Restore sentence spacing
.       if \\n[#PRINT_STYLE]=2 \{\
.          if d$RESTORE_SS_VAR \{ .SS \\*[$RESTORE_SS_VAR] \}
.          rm $RESTORE_SS_VAR
.       \}
.       ev
.       nr #PP_STYLE \\n[#PP_STYLE_PREV]
.       if !\\n[#INDENT_FIRSTS] \{ .INDENT_FIRST_PARAS OFF \}
.       rr #INDENT_FIRSTS
.       rr #ENDNOTE
.       if \\n[#PRINT_STYLE]=1 \{\
.          if \\n[#UNDERLINE_WAS_ON] \{\
.             rr #UNDERLINE_WAS_ON
.             UNDERLINE
.          \}
.       \}
.       if \\n[#SLANT_WAS_ON] \{\
.          rr #SLANT_WAS_ON
\*[SLANT]\c
.       \}
.    \}
.    if \\n[#ADD_BREAK] \{\
.       br
.       rr #ADD_BREAK
.    \}
.END
\#
\#
\# ENDNOTES
\# --------
\# *Arguments:
\#   none
\# *Function:
\#   Sets new document leading from #EN_LEAD, breaks to a new page,
\#   sets up an endnotes page based on registers and strings associated
\#   with endnotes, then outputs diversion END_NOTES.
\#
.MAC ENDNOTES END
.    nr #ENDNOTES 1
.    nr #EN_FIRST_PAGE 1
.    nr #HEADER_STATE \\n[#HEADERS_ON]
.    ds $RESTORE_PAGENUM_STYLE \\*[$PAGENUM_STYLE]
.    if \\n[#LINENUMBERS]=1 \{\
.       NUMBER_LINES OFF
.       nr #LINENUMBERS 2
.    \}
.    if \\n[#HEADERS_ON]=1 \{\
.       if !\\n[#EN_ALLOWS_HEADERS_ALL] \{ .HEADERS OFF \}
.    \}
.    if \\n[#HEADER_STATE]=1 \{\
.       ie \\n[#EN_HDRFTR_CENTER]=1 \{ . \}
.       el \{ .rm $HDRFTR_CENTER  \}
.    \}
.    ie !\\n[#SUSPEND_PAGINATION] \{\
.       if \\n[#PAGINATE]=1 \{\
.          if \\n[#PAGE_NUM_V_POS]=1 \{\
.             PAGENUM_STYLE \\*[$EN_PN_STYLE]
.             if \\n[#EN_FIRST_PN] \{ .PAGENUMBER \\n[#EN_FIRST_PN]-1 \}
.             if r#EN_NO_FIRST_PN \{ .nr #PAGINATE 0 \}
.          \}
.       \}
.    \}
.    el \{\
.       ie \\n[#PAGE_NUM_V_POS]=2 \{ .nr #PAGINATE 1 \}
.       el \{ .nr #PAGINATE 0 \}
.    \}
.    if \\n[#FOOTERS_ON]=1 \{\
.       if !'\\*[$HDRFTR_CENTER_OLD]'' .ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_OLD]
.    \}
.    NEWPAGE
.    if \\n[#FOOTERS_ON]=1 \{\
.       ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_NEW]
.       rm $HDRFTR_CENTER_OLD
.       rm $HDRFTR_CENTER_NEW
.    \}
.    ie !\\n[#SUSPEND_PAGINATION] \{\
.       if \\n[#PAGE_NUM_V_POS]=1 \{\
.          if r#EN_NO_FIRST_PN \{\
.             if \\n[#PAGINATION_STATE]=1 \{\
.                nr #PAGINATE 1
.             \}
.          \}
.       \}
.    \}
.    el \{\
.       if \\n[#PAGE_NUM_V_POS]=2 \{ .nr #PAGINATE 0 \}
.    \}
.    rr #PAGINATION_STATE
.    PAGENUM_STYLE \\*[$EN_PN_STYLE]
.    if \\n[#EN_FIRST_PN] \{ .PAGENUMBER \\n[#EN_FIRST_PN] \}
.    if \\n[#HEADER_STATE]=1 \{\
.       if \\n[#EN_ALLOWS_HEADERS] \{ .HEADERS \}
.    \}
.\" Collect endnotes title string for TOC
.    nr #TOC_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
.    af #TOC_ENTRY_PN \\g[#PAGENUMBER]
.    ds $TOC_TITLE_ITEM \\*[$EN_STRING]\\|
.    ev TOC_EV
.    da TOC_ENTRIES
.    if \\n[#PRINT_STYLE]=1 \{\
.       TYPEWRITER
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
\!.     FAMILY  \\*[$TOC_TITLE_FAM]
\!.     FT      \\*[$TOC_TITLE_FT]
\!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_TITLE_SIZE_CHANGE]
.    \}
\!.  TRAP OFF
.    ie \\n[#PRINT_STYLE]=1 \{\
\!.     PAD "\\*[$TOC_TITLE_ITEM]\\*[$TOC_PN_TYPEWRITE]" 
.    \}
.    el \{\
\!.     PAD "\\h'\\n[#TOC_TITLE_INDENT]u'\\*[$TOC_TITLE_ITEM]\\*[$TOC_PN]"
.    \}
\!.  EOL
\!.  ST 100 L
\!.  ST 101 R
.    if \\n[#PRINT_STYLE]=2 \{\
\!.     FAMILY  \\*[$TOC_PN_FAM]
\!.     FT      \\*[$TOC_PN_FT]
\!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_PN_SIZE_CHANGE]
.    \}
\!.  TAB 100
\!.  PRINT \\*[LEADER]
\!.  TN
\!.  TRAP
\!.  PRINT \\n[#TOC_ENTRY_PN]
\!.  TQ
.    di       
.    ev
.\" End collection of endnotes title string for TOC
.\" Process endnotes
.    if \\n[#PRINT_STYLE]=1 \{ .vs \\n[#EN_LEAD]u \}
.    if \\n[#PRINT_STYLE]=2 \{\
.       if \\n[#EN_NO_COLS] \{\
.          if \\n[#COLUMNS] \{ .nr #COLUMNS_WERE_ON 1 \}
.          nr #COLUMNS 0
.       \}
.       nr #RESTORE_DOC_LEAD \\n[#DOC_LEAD]
.       ie \\n[#ADJ_EN_LEAD] \{\
.          nr #DOC_LEAD \\n[#EN_LEAD]
.       \}
.       el \{ .DOC_LEAD \\n[#EN_LEAD]u \}
.    \}
.    PRINT \&
.    ie r#EN_TITLE_SPACE \{ .sp |\\n[#EN_TITLE_SPACE]u \}
.    el \{ .sp |\\n[#T_MARGIN]u \}
.    mk ec
.    if \\n[#SLANT_ON] \{\
\*[SLANTX]\c
.    \}
.    ev ENDNOTES
.    if !'\\*[$EN_STRING]'' \{\
.       if \\n[#PRINT_STYLE]=1 \{\
.          TYPEWRITER
.          vs \\n[#EN_LEAD]u
.       \}
.       if \\n[#PRINT_STYLE]=2 \{\
.          LL \\n[#DOC_L_LENGTH]u
.          ta \\n(.lu
.          if \\n[#COLUMNS] \{\
.             ie \\n[#EN_NO_COLS] \{ .LL \\n[#DOC_L_LENGTH]u \}
.             el \{ .LL \\n[#COL_L_LENGTH]u \}
.             ta \\n(.lu
.          \}
.          FAMILY  \\*[$EN_STRING_FAM]
.          FT      \\*[$EN_STRING_FT]
.          PT_SIZE \\n[#EN_PS]u\\*[$EN_STRING_SIZE_CHANGE]
.          vs      \\n[#EN_LEAD]u
.       \}
.       if '\\*[$EN_STRING_QUAD]'L'      \{ .LEFT   \}
.       if '\\*[$EN_STRING_QUAD]'LEFT'   \{ .LEFT   \}
.       if '\\*[$EN_STRING_QUAD]'C'      \{ .CENTER \}
.       if '\\*[$EN_STRING_QUAD]'CENTER' \{ .CENTER \}
.       if '\\*[$EN_STRING_QUAD]'CENTRE' \{ .CENTER \}
.       if '\\*[$EN_STRING_QUAD]'R'      \{ .RIGHT  \}
.       if '\\*[$EN_STRING_QUAD]'RIGHT'  \{ .RIGHT  \}
.       EOL
.       if \\n[#EN_STRING_CAPS] \{ .CAPS \}
.       ie \\n[#EN_STRING_UNDERSCORE] \{\
.          ie \\n[#EN_STRING_UNDERSCORE]=2 \{\
.             UNDERSCORE2 "\\*[$EN_STRING]
.          \}
.          el \{\
.             UNDERSCORE "\\*[$EN_STRING]
.          \}
.       \}
.       el \{\
.          PRINT "\\*[$EN_STRING]
.       \}
.    \}
.    CAPS OFF
.    if \\n[#PRINT_STYLE]=1 \{\
.       ie \\n[#SINGLE_SPACE]=1 \{\
.          ALD \\n[#EN_LEAD]u*2u
.       \}
.       el \{\
.          ie \\n[#EN_SINGLESPACE]=1 \{\
.              ALD \\n[#EN_LEAD]u*2
.          \}
.          el \{\
.
.          \}
.       \}
.    \}
.    if \\n[#PRINT_STYLE]=2 \{ .ALD \\n[#EN_LEAD]u \}
.    QUAD \\*[$EN_QUAD]
.    nf
.    END_NOTES
.    br
.    ev
.    rm END_NOTES
.    if \\n[#PRINT_STYLE]=1 \{ .vs \\n[#DOC_LEAD]u \}
.    if \\n[#PRINT_STYLE]=2 \{\
.       ie \\n[#ADJ_EN_LEAD] \{\
.          nr #DOC_LEAD \\n[#RESTORE_DOC_LEAD]
.       \}
.       el \{ .DOC_LEAD \\n[#RESTORE_DOC_LEAD]u \}
.       rr #RESTORE_DOC_LEAD
.    \}
.    if \\n[#COLUMNS_WERE_ON] \{ .nr #COLUMNS 1 \}
.    if \\n[#HEADER_STATE]=1 \{ .HEADERS \}
.    if \\n[#LINENUMBERS]=2 \{\
.       NUMBER_LINES RESUME
.       nr #LINENUMBERS 1
.    \}
.    rr #ENDNOTES
.END
\#
\# ====================================================================
\#
\# +++BIBLIOGRAPHY+++
\#
.ig
Mom treats bibliographies and endnotes very similarly.  The chief
difference is that endnotes are collected and formatted inside a
diversion, while bibliographies are built "by hand."  ENDNOTES sets
up the endnotes page and outputs the formatted diversion.
BIBLIOGRAPHY sets up the bibliography page, then awaits refer
commands.

All of the bibliography control macros have their exact
counterparts in the endnotes control macros.  It was tempting to do
fancy stuff with aliases to avoid the repetition, but for reasons
of my own sanity, and for the benefit of anyone wanting to play
around with the bibliography control macros, I decided to keep them
separate.

Because the bibliography control macros all have endnotes
equivalents, refer to the appropriate, similar endnote macro for
Arguments, Function and Notes.
..
\# Bibliography control macros
\#
.MAC BIBLIOGRAPHY_PT_SIZE END
.    nr #BIB_PS (p;\\$1)
.END
\#
.MAC BIBLIOGRAPHY_LEAD END
.    if !\\n[#OK_PROCESS_LEAD] \{\
.       ds $BIB_LEAD \\$1
.       if !'\\$2'' \{\
.           ds $ADJUST_BIB_LEAD \\$2
.       \}
.       return
.    \}
.    rr #ADJ_BIB_LEAD
.    nr #BIB_LEAD (p;\\$1)
.    if '\\$2'ADJUST' \{\
.       nr #ORIG_DOC_LEAD \\n[#DOC_LEAD]
.       nr #RESTORE_ADJ_DOC_LEAD \\n[#ADJ_DOC_LEAD]
.       nr #ADJ_DOC_LEAD 1
.       nr #ADJ_BIB_LEAD 1
.       nr #NO_TRAP_RESET 1
.       DOC_LEAD \\n[#BIB_LEAD]u ADJUST
.       nr #BIB_LEAD \\n[#DOC_LEAD]
.       DOC_LEAD \\n[#ORIG_DOC_LEAD]u
.       rr #NO_TRAP_RESET
.       nr #ADJ_DOC_LEAD \\n[#RESTORE_ADJ_DOC_LEAD]
.       rr #ORIG_DOC_LEAD
.    \}
.END
\#
.MAC BIBLIOGRAPHY_HDRFTR_CENTER END
.    ie '\\$1'' \{ .nr #BIB_HDRFTR_CENTER 1 \}
.    el         \{ .rr #BIB_HDRFTR_CENTER   \}
.END
\#
.MAC BIBLIOGRAPHY_STRING END
.    ds $BIB_STRING \\$1
.END
\#
.MAC BIBLIOGRAPHY_STRING_UNDERSCORE END
.    ie '\\$1'' \{ .nr #BIB_STRING_UNDERSCORE 1 \}
.    el \{\
.       ie '\\$1'2' \{ .nr #BIB_STRING_UNDERSCORE 2 \}
.       el \{ .nr #BIB_STRING_UNDERSCORE 0 \}
.    \}
.END
\#
.MAC BIBLIOGRAPHY_STRING_CAPS END
.   ie '\\$1'' \{ .nr #BIB_STRING_CAPS 1 \}
.   el \{ .rr #BIB_STRING_CAPS \}
.END
\#
.MAC BIBLIOGRAPHY_NO_COLUMNS END
.    ie '\\$1'' \{ .nr #BIB_NO_COLS 1 \}
.    el \{ .rr #BIB_NO_COLS \}
.END
\#
.MAC BIBLIOGRAPHY_NO_FIRST_PAGENUM END
.    ie '\\$1'' \{ .nr #BIB_NO_FIRST_PN 1 \}
.    el \{ .rr #BIB_NO_FIRST_PN \}
.END
\#
.MAC BIBLIOGRAPHY_ALLOWS_HEADERS END
.    ie '\\$1'' \{ .nr #BIB_ALLOWS_HEADERS 1 \}
.    el \{\
.       ie '\\$1'ALL' \{\
.          nr #BIB_ALLOWS_HEADERS 1
.          nr #BIB_ALLOWS_HEADERS_ALL 1
.       \}
.       el \{\
.          rr #BIB_ALLOWS_HEADERS
.          rr #BIB_ALLOWS_HEADERS_ALL
.       \}
.    \}
.END
\#
.MAC BIBLIOGRAPHY_PAGENUM_STYLE END
.    ds $BIB_PN_STYLE \\$1
.END
\#
.MAC BIBLIOGRAPHY_FIRST_PAGENUMBER END
.    nr #BIB_FIRST_PN \\$1
.END
\#
.MAC SINGLESPACE_BIBLIOGRAPHY END
.    if \\n[#PRINT_STYLE]=1 \{\
.       ie \\n[#SINGLE_SPACE] \{\
.          nr #BIB_SINGLESPACE 1
.          rr #IGNORE
.          if \\n[#OK_PROCESS_LEAD] \{\
.             BIBLIOGRAPHY_LEAD 12 ADJUST
.             nr #IGNORE 1
.          \}
.       \}
.       el \{\
.          ie '\\$1'' \{\
.             nr #BIB_SINGLESPACE 1
.             rr #IGNORE
.             if \\n[#OK_PROCESS_LEAD] \{\
.                BIBLIOGRAPHY_LEAD 12 ADJUST
.                nr #IGNORE 1
.             \}
.          \}
.          el \{\
.             rr #BIB_SINGLESPACE
.             rr #IGNORE
.             if \\n[#OK_PROCESS_LEAD] \{\
.                BIBLIOGRAPHY_LEAD 24 ADJUST
.                nr #IGNORE 1
.             \}
.          \}
.       \}
.    \}
.END
\#
\#
\# Style for outputting collected bibliographic references
\# -------------------------------------------------------
\# *Argument:
\#   LIST | PLAIN [ <list separator> ] [ <list prefix> ]
\# *Function:
\#   Sets #BIB_LIST to 1 for numbered list style, 0 for plain output
\# *Notes:
\#   Technically, user is supposed to enter PLAIN if s/he wants an
\#   unumbered bibliography, but the el clause says "any arg but
\#   LIST means unumbered."  Effectively, any arg but LIST produces
\#   a "plain" bibliographic list.
\#
\#   The 2nd and 3rd args have the same options as the 2nd arg to LIST.
\#
.MAC BIBLIOGRAPHY_TYPE END
.    ie '\\$1'LIST' \{\
.       nr #BIB_LIST 1
.       ie '\\$2'' \{\
.          if '\\*[$BIB_LIST_SEPARATOR]'' .ds $BIB_LIST_SEPARATOR .
.       \}
.       el .ds $BIB_LIST_SEPARATOR \\$2
.       ie '\\$3'' .ds $BIB_LIST_PREFIX
.       el .ds $BIB_LIST_PREFIX \\$3
.    \}
.    el \{ .nr #BIB_LIST 0 \}
.END
\#
\# Spacing between items in bibliographies
\# ---------------------------------------
\# *Argument:
\#   <amount of space>
\# *Function:
\#   Gets value for #BIB_SPACE in units.
\# *Notes:
\#   Requires a unit of measure.
\#
.MAC BIBLIOGRAPHY_SPACING END
.    ds $BIB_SPACE \\$1
.    if \\n[#BIB_LEAD]=0 \{\
.       nr #DEFER_BIB_SPACING 1
.       return
.    \}
.    ds $EVAL_BIB_SPACE \\*[$BIB_SPACE]
.    substring $EVAL_BIB_SPACE -1
.    ie '\\*[$EVAL_BIB_SPACE]'v' \{\
.       substring $BIB_SPACE 0 0
.       nr #BIB_SPACE \\n[#BIB_LEAD]*\\*[$BIB_SPACE]
.    \}
.    el \{\
.       nr #BIB_SPACE (\\$1)
.    \}
.END
\#
\# Set up bibliography page
\# ------------------------
\# *Function:
\#   Sets up a new page, with title, ready to accept the output
\#   of refer's $LIST$ or .R1 bibliography .R2
\# *Notes:
\#   Bibliography pages are set up almost identically to endnotes pages.
\#
.MAC BIBLIOGRAPHY END
.    nr #BIBLIOGRAPHY 1
.    nr #BIB_FIRST_PAGE 1
.    nr #HEADER_STATE \\n[#HEADERS_ON]
.    ds $RESTORE_PAGENUM_STYLE \\*[$PAGENUM_STYLE]
.    if \\n[#LINENUMBERS]=1 \{\
.       NUMBER_LINES OFF
.       nr #LINENUMBERS 2
.    \}
.    if \\n[#HEADERS_ON]=1 \{\
.       if !\\n[#BIB_ALLOWS_HEADERS_ALL] \{ .HEADERS OFF \}
.    \}
.    if \\n[#HEADER_STATE]=1 \{\
.       ie \\n[#BIB_HDRFTR_CENTER]=1 \{ . \}
.       el \{ .rm $HDRFTR_CENTER  \}
.    \}
.    ie !\\n[#SUSPEND_PAGINATION] \{\
.       if \\n[#PAGINATE]=1 \{\
.          if \\n[#PAGE_NUM_V_POS]=1 \{\
.             PAGENUM_STYLE \\*[$BIB_PN_STYLE]
.             if \\n[#BIB_FIRST_PN] \{ .PAGENUMBER \\n[#BIB_FIRST_PN]-1 \}
.             if r#BIB_NO_FIRST_PN \{ .nr #PAGINATE 0 \}
.          \}
.       \}
.    \}
.    el \{\
.       ie \\n[#PAGE_NUM_V_POS]=2 \{ .nr #PAGINATE 1 \}
.       el \{ .nr #PAGINATE 0 \}
.    \}
.    if \\n[#FOOTERS_ON]=1 \{\
.       if !'\\*[$HDRFTR_CENTER_OLD]'' .ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_OLD]
.    \}
.    NEWPAGE
.    if \\n[#FOOTERS_ON]=1 \{\
.       ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_NEW]
.       rm $HDRFTR_CENTER_OLD
.       rm $HDRFTR_CENTER_NEW
.    \}
.    ie !\\n[#SUSPEND_PAGINATION] \{\
.       if \\n[#PAGE_NUM_V_POS]=1 \{\
.          if r#BIB_NO_FIRST_PN \{\
.             if \\n[#PAGINATION_STATE]=1 \{\
.                nr #PAGINATE 1
.             \}
.          \}
.       \}
.    \}
.    el \{\
.       if \\n[#PAGE_NUM_V_POS]=2 \{ .nr #PAGINATE 0 \}
.    \}
.    rr #PAGINATION_STATE
.    PAGENUM_STYLE \\*[$BIB_PN_STYLE]
.    if \\n[#BIB_FIRST_PN] \{ .PAGENUMBER \\n[#BIB_FIRST_PN] \}
.    if \\n[#HEADER_STATE]=1 \{\
.       if \\n[#BIB_ALLOWS_HEADERS] \{ .HEADERS \}
.    \}
.\" Collect bibliography title string for TOC
.    nr #TOC_ENTRY_PN \\n%+\\n[#PAGE_NUM_ADJ]
.    af #TOC_ENTRY_PN \\g[#PAGENUMBER]
.    ds $TOC_TITLE_ITEM \\*[$BIB_STRING]\\|
.    ev TOC_EV
.    da TOC_ENTRIES
.    if \\n[#PRINT_STYLE]=1 \{\
.       TYPEWRITER
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
\!.     FAMILY  \\*[$TOC_TITLE_FAM]
\!.     FT      \\*[$TOC_TITLE_FT]
\!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_TITLE_SIZE_CHANGE]
.    \}
\!.  TRAP OFF
.    ie \\n[#PRINT_STYLE]=1 \{\
\!.     PAD "\\*[$TOC_TITLE_ITEM]\\*[$TOC_PN_TYPEWRITE]" 
.    \}
.    el \{\
\!.     PAD "\\h'\\n[#TOC_TITLE_INDENT]u'\\*[$TOC_TITLE_ITEM]\\*[$TOC_PN]"
.    \}
\!.  EOL
\!.  ST 100 L
\!.  ST 101 R
.    if \\n[#PRINT_STYLE]=2 \{\
\!.     FAMILY  \\*[$TOC_PN_FAM]
\!.     FT      \\*[$TOC_PN_FT]
\!.     PT_SIZE \\n[#TOC_PS]u\\*[$TOC_PN_SIZE_CHANGE]
.    \}
\!.  TAB 100
\!.  PRINT \\*[LEADER]
\!.  TN
\!.  TRAP
\!.  PRINT \\n[#TOC_ENTRY_PN]
\!.  TQ
.    di       
.    ev
.\" End collection of bibliography title string for TOC
.\" Process bibliography
.    if \\n[#PRINT_STYLE]=1 \{ .vs \\n[#BIB_LEAD]u \}
.    if \\n[#PRINT_STYLE]=2 \{\
.       if \\n[#BIB_NO_COLS] \{\
.          if \\n[#COLUMNS] \{ .nr #COLUMNS_WERE_ON 1 \}
.          nr #COLUMNS 0
.       \}
.       nr #RESTORE_DOC_LEAD \\n[#DOC_LEAD]
.       ie \\n[#ADJ_BIB_LEAD] \{\
.          nr #DOC_LEAD \\n[#BIB_LEAD]
.       \}
.       el \{ .DOC_LEAD \\n[#BIB_LEAD]u \}
.    \}
.    PRINT \&
.    ie r#BIB_TITLE_SPACE \{ .sp |\\n[#BIB_TITLE_SPACE]u \}
.    el \{ .sp |\\n[#T_MARGIN]u \}
.    mk ec
.    if \\n[#SLANT_ON] \{\
\*[SLANTX]\c
.    \}
.    if !'\\*[$BIB_STRING]'' \{\
.       if \\n[#PRINT_STYLE]=1 \{\
.          TYPEWRITER
.          vs \\n[#BIB_LEAD]u
.       \}
.       if \\n[#PRINT_STYLE]=2 \{\
.          LL \\n[#DOC_L_LENGTH]u
.          ta \\n(.lu
.          if \\n[#COLUMNS] \{\
.             ie \\n[#BIB_NO_COLS] \{ .LL \\n[#DOC_L_LENGTH]u \}
.             el \{ .LL \\n[#COL_L_LENGTH]u \}
.             ta \\n(.lu
.          \}
.          FAMILY  \\*[$BIB_STRING_FAM]
.          FT      \\*[$BIB_STRING_FT]
.          PT_SIZE \\n[#BIB_PS]u\\*[$BIB_STRING_SIZE_CHANGE]
.          vs      \\n[#BIB_LEAD]u
.       \}
.       if '\\*[$BIB_STRING_QUAD]'L'      \{ .LEFT   \}
.       if '\\*[$BIB_STRING_QUAD]'LEFT'   \{ .LEFT   \}
.       if '\\*[$EN_STRING_QUAD]'C'       \{ .CENTER \}
.       if '\\*[$BIB_STRING_QUAD]'CENTER' \{ .CENTER \}
.       if '\\*[$BIB_STRING_QUAD]'CENTRE' \{ .CENTER \}
.       if '\\*[$BIB_STRING_QUAD]'R'      \{ .RIGHT  \}
.       if '\\*[$BIB_STRING_QUAD]'RIGHT'  \{ .RIGHT  \}
.       EOL
.       if \\n[#BIB_STRING_CAPS] \{ .CAPS \}
.       ie \\n[#BIB_STRING_UNDERSCORE] \{\
.          ie \\n[#BIB_STRING_UNDERSCORE]=2 \{\
.             UNDERSCORE2 "\\*[$BIB_STRING]
.          \}
.          el \{\
.             UNDERSCORE "\\*[$BIB_STRING]
.          \}
.       \}
.       el \{\
.          PRINT "\\*[$BIB_STRING]
.       \}
.    \}
.    CAPS OFF
.    FAMILY \\*[$BIB_FAMILY]
.    FT \\*[$BIB_FT]
.    PT_SIZE -\\*[$BIB_STRING_SIZE_CHANGE]
.    if \\n[#PRINT_STYLE]=1 \{\
.       ie \\n[#SINGLE_SPACE]=1 \{\
.          ALD \\n[#BIB_LEAD]*3u
.       \}
.       el \{\
.          ie \\n[#BIB_SINGLESPACE]=1 \{\
.             ALD \\n[#BIB_LEAD]u*3u
.          \}
.          el \{\
.             ALD \\n[#BIB_LEAD]u
.          \}
.       \}
.    \}
.    if \\n[#PRINT_STYLE]=2 \{ .ALD \\n[#BIB_LEAD]u*2u \}
.    QUAD \\*[$BIB_QUAD]
.    if \\n[#PRINT_STYLE]=1 \{\
.       ie \\n[#SINGLE_SPACE]=1 \{\
.          vs \\n[#BIB_LEAD]u
.       \}
.       el \{\
.          ie \\n[#BIB_SINGLESPACE]=1 \{\
.             vs \\n[#BIB_LEAD]u
.          \}
.          el \{\
.             vs \\n[#BIB_LEAD]u
.          \}
.       \}
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
.       ie \\n[#ADJ_BIB_LEAD] \{\
.          nr #DOC_LEAD \\n[#RESTORE_DOC_LEAD]
.       \}
.       el \{ .DOC_LEAD \\n[#RESTORE_DOC_LEAD]u \}
.       rr #RESTORE_DOC_LEAD
.    \}
.    if \\n[#COLUMNS_WERE_ON] \{ .nr #COLUMNS 1 \}
.    if \\n[#HEADER_STATE]=1 \{ .HEADERS \}
.    rr #BIBLIOGRAPHY
.    if \\n[#LINENUMBERS]=2 \{\
.       NUMBER_LINES RESUME
.       nr #LINENUMBERS 1
.    \}
.END
\#
\# ====================================================================
\#
\# +++TABLE OF CONTENTS+++
\#
\# Strings to allocate space for leaders and entry page numbers
\#
.ds $TOC_PN \\*[ST100]\\F[\\*[$TOC_PN_FAM]]\\f[\\*[$TOC_PN_FT]]\\s[\\n[#TOC_PS]u]#\\*[ST100X]\\*[ST101]\\s[\\*[$TOC_PN_SIZE_CHANGE]]\\|\\h'\\w'0'u*\\n[#TOC_PN_PADDING]u'\*[ST101X]
.ds $TOC_PN_TYPEWRITE \\*[ST100]#\\*[ST100X]\\*[ST101]\\|\\h'\\w'0'u*\\n[#TOC_PN_PADDING]u'\\*[ST101X]
\#
\# TOC ENTRIES PAGE NUMBERS PADDING
\# --------------------------------
\# *Argument:
\#   <number of placeholders for toc entries page numbers>
\# *Function:
\#   Creates or modifies register #TOC_PN_PADDING.
\# *Notes:
\#   "Placeholders" is the maximum number of digits in a page
\#   number numeral.
\#
\#   Default is 3.
\#
.MAC TOC_PADDING END
.    nr #TOC_PN_PADDING \\$1
.END
\#
\#
\# PAGINATE TOC
\# ------------
\# *Argument:
\#   <none> | <anything>
\# *Function:
\#   Creates or removes register #PAGINATE_TOC.
\# *Notes:
\#   Default is to paginate toc.
\#
.MAC PAGINATE_TOC END
.    ie '\\$1'' \{ .nr #PAGINATE_TOC 1 \}
.    el \{ .nr #PAGINATE_TOC 0 \}
.END
\#
\#
\# TOC POINT SIZE
\# --------------
\# *Argument:
\#   <base point size for toc pages>
\# *Function:
\#   Creates or modifies register #TOC_PS.
\# *Notes:
\#   This size control macro differs from other size control macros
\#   in that it sets an absolute point size, not a relative one.
\#   See notes for ENDNOTE_PT_SIZE for explanation.  No unit of
\#   measure required.
\#
\#   No unit of measure required (points assumed).  Default is 11.5
\#   for TYPESET.
\#
.MAC TOC_PT_SIZE END
.    nr #TOC_PS (p;\\$1)
.END
\#
\#
\# TOC LEADING
\# -----------
\# *Argument:
\#   <leading for toc pages> [ADJUST]
\# *Function:
\#   Creates or modifies register #TOC_LEAD. If optional ADJUST
\#   given, adjusts lead to fill page.  If #OK_PROCESS_LEAD doesn't
\#   exist, stores arguments for when it's okay to run the macro.
\# *Notes:
\#   No unit of measure required (points assumed).
\#
\#   Default is same as DOC_LEAD.
\#
.MAC TOC_LEAD END
.    if !\\n[#OK_PROCESS_LEAD] \{\
.       ds $TOC_LEAD \\$1
.       if !'\\$2'' \{\
.           ds $ADJUST_TOC_LEAD \\$2
.       \}
.       return
.    \}
.    rr #ADJ_TOC_LEAD
.    nr #TOC_LEAD (p;\\$1)
.    if '\\$2'ADJUST' \{\
.       nr #ORIG_DOC_LEAD \\n[#DOC_LEAD]
.       nr #RESTORE_ADJ_DOC_LEAD \\n[#ADJ_DOC_LEAD]
.       nr #ADJ_DOC_LEAD 1
.       nr #ADJ_TOC_LEAD 1
.       nr #NO_TRAP_RESET 1
.       DOC_LEAD \\n[#TOC_LEAD]u ADJUST
.       nr #TOC_LEAD \\n[#DOC_LEAD]
.       DOC_LEAD \\n[#ORIG_DOC_LEAD]u
.       rr #NO_TRAP_RESET
.       nr #ADJ_DOC_LEAD \\n[#RESTORE_ADJ_DOC_LEAD]
.       rr #ORIG_DOC_LEAD
.    \}
.END
\#
\#
\# TOC PAGES PAGE-NUMBERING STYLE
\# ------------------------------
\# *Argument:
\#   DIGIT | ROMAN | roman | ALPHA | alpha
\# *Function:
\#   Creates or modifies string $TOC_PN_STYLE
\# *Notes:
\#   Page numbering style for page numbers that appear in the
\#   headers/footers of toc pages.  See notes for PAGENUM_STYLE.  
\#
\#   Default is roman.
\#
.MAC TOC_PAGENUM_STYLE END
.    ds $TOC_PN_STYLE \\$1
.END
\#
\#
\# TOC RECTO_VERSO SWITCH
\# ----------------------
\# *Argument:
\#   <none> | <anything>
\# *Function:
\#   Creates or removes register #TOC_RV_SWITCH
\# *Notes:
\#   Allows switching of L/R margins if a doc is recto/verso and
\#   the first toc page happens to fall the wrong way
\#
.MAC TOC_RV_SWITCH END
.    ie '\\$1'' \{ .nr #TOC_RV_SWITCH 1 \}
.    el \{ .rr #TOC_RV_SWITCH \}
.END
\#
\# - for TOC "doc header" (i.e. "Contents")
\#
\# TOC HEADER STRING
\# -----------------
\# *Argument:
\#   <string for "doc header" of first toc page>
\# *Function:
\#   Creates or modifies string $TOC_HEADER_STRING
\# *Notes:
\#   Default is "Contents".
\#
.MAC TOC_HEADER_STRING END
.    ds $TOC_HEADER_STRING \\$1
.END
\#
\# - for TOC entries page number numerals
\#
\# Control macros for toc doc titles, heads, subheads and paraheads 
\# ----------------------------------------------------------------
\#
\# All these control macros behave the same way, setting the family,
\# font, point size and indent from the left margin of the different
\# kinds of entries that can appear in the toc.  The way they
\# operate is identical to all other _FAMILY, _FONT and _SIZE
\# control macros.  _INDENT takes an absolute value.
\# TOC_APPENDS_AUTHORS is unique in this section.
\# 
\# - for title entries
\#
.MAC TOC_TITLE_INDENT END
.    nr #TOC_TITLE_INDENT (\\$1)
.END
\#
\#
.MAC TOC_TITLE_ENTRY END
.    nr #USER_SET_TITLE_ITEM 1
.    ds $USER_SET_TITLE_ITEM \\$1
.END
\#
\#
\# APPEND AUTHOR(S) TO TOC DOC TITLE ENTRIES
\# -----------------------------------------
\# *Argument:
\#   <none> | <name(s) of author(s) as they should appear in toc doc title entries>
\# *Function:
\#   Creates register #TOC_AUTHORS (to tell TOC to append authors
\#   to toc doc title entries).  Optionally creates string
\#   $TOC_AUTHORS.
\# *Notes:
\#   Normally, TOC does not append the author(s) to a toc doc title
\#   entry.  This special macro instructs TOC to do so.
\#
\#   If user has multiple authors for each doc when collating,
\#   TOC_APPENDS_AUTHOR "<string>" must be inserted somewhere between
\#   COLLATE and START in each doc.  Otherwise, mom prints only the
\#   first author given to AUTHOR.
\#
.MAC TOC_APPENDS_AUTHOR END
.    nr #TOC_AUTHORS 1
.    if !'\\$1'' \{\
.       ds $TOC_AUTHORS \\$1
.    \}
.END
\#
\# - for head entries
\#
.MAC TOC_HEAD_INDENT END
.    nr #TOC_HEAD_INDENT (\\$1)
.END
\#
\# - for subhead entries
\#
.MAC TOC_SUBHEAD_INDENT END
.    nr #TOC_SH_INDENT (\\$1)
.END
\#
\# - for parahead entries
\#
.MAC TOC_PARAHEAD_INDENT END
.    nr #TOC_PH_INDENT (\\$1)
.END
\#
\#
.MAC TOC END
.    if \\n[#LINENUMBERS]=1 \{\
.       NUMBER_LINES OFF
.       nr #LINENUMBERS 2
.    \}
.    if !r#PAGINATE_TOC \{ .PAGINATE_TOC \}
.    nr #TOC_FIRST_PAGE 1
.    if \\n[#FINIS] \{\
.       if \\n[#FOOTERS_WERE_ON] \{\
.          FOOTERS \" Have to turn FOOTERS on for next bit to work, so we can't skip this step
.       \}
.    \}
.    if \\n[#FOOTERS_ON]=1 \{\
.       if !'\\*[$HDRFTR_CENTER_OLD]'' .ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_OLD]
.       ie \\n[#PAGINATE_TOC]=1 \{ .PAGINATE \}
.       el \{ .PAGINATION OFF \}
.    \}
.    if \\n[#FOOTERS_WERE_ON] \{ .FOOTERS OFF \} \" But have to turn FOOTERS off again so they don't print when FINIS was called
.    COLLATE
.    if \\n[#FINIS] \{\
.       if \\n[#FOOTERS_WERE_ON] \{ .FOOTERS \} \" Finally, turn footers on if they were on
.       rr #FOOTERS_WERE_ON
.       if \\n[#PAGINATION_WAS_ON] \{\
.          nr #PAGINATE 1
.          rr #PAGINATION_WAS_ON
.       \}
.       rr #FINIS
.    \}
.    ie \\n[#PAGINATE_TOC]=1 \{ .PAGINATE \}
.    el \{ .PAGINATION OFF \}
.    if \\n[#FOOTERS_ON]=1 \{\
.       ds $HDRFTR_CENTER \\*[$HDRFTR_CENTER_NEW]
.       rm $HDRFTR_CENTER_OLD
.       rm $HDRFTR_CENTER_NEW
.    \}
.    rr #COLLATED_DOC
.    DOCHEADER OFF
.    PAGENUMBER 1
.    if \\n[#PRINT_STYLE]=1 \{\
.       rr #IGNORE
.       DOC_LEAD 24 ADJUST
.       nr #IGNORE 1
.    \}
.    if \\n[#LINENUMBERS]=2 \{ .nr #LINENUMBERS 3 \}
.    START
.    PP
.    nr #COLUMNS 0
.    if \\n[#PRINT_STYLE]=2 \{\
.       ie r#ADJ_TOC_LEAD \{\
.          nr #NO_TRAP_RESET 1
.          DOC_LEAD \\n[#TOC_LEAD]u ADJUST
.          rr #NO_TRAP_RESET
.       \}
.       el \{ .DOC_LEAD \\n[#TOC_LEAD]u \}
.    \}
.    sp |\\n[#T_MARGIN]u-\\n[#DOC_LEAD]u
.    if \\n[#SLANT_ON] \{\
\*[SLANTX]\c
.    \}
.    DOC_LINE_LENGTH \\n[#DOC_L_LENGTH]u
.    QUAD \\*[$TOC_HEADER_QUAD]
.    PAGENUM_STYLE \\*[$TOC_PN_STYLE]
.    if \\n[#PRINT_STYLE]=1 \{\
.       TYPEWRITER
.    \}
.    if \\n[#PRINT_STYLE]=2 \{\
.       FAMILY  \\*[$TOC_HEADER_FAM]
.       FT      \\*[$TOC_HEADER_FT]
.       PT_SIZE \\n[#TOC_PS]u\\*[$TOC_HEADER_SIZE_CHANGE]
.    \}
.    ie \\n[#PRINT_STYLE]=1 \{\
.       CAPS
.       UNDERLINE
.       PRINT "\\*[$TOC_HEADER_STRING]"
.       UNDERLINE OFF
.       CAPS      OFF
.    \}
.    el \{\
.       PRINT "\\*[$TOC_HEADER_STRING]"
.    \}
.    LEFT
.    SP
.\" In collated docs, this bit inserts the first doc's title
.\" underneath the TOC header, before the TOC_ENTRIES diversion
.\" gets output.
.    nf
.    if d$FIRST_DOC_TITLE \{\
.    nr #RESTORE_TOC_PN_PADDING \\n[#TOC_PN_PADDING]
.    TOC_PADDING \\n[#FIRST_DOC_TOC_PN_PADDING]
.       if \\n[#PRINT_STYLE]=2 \{\
.          FAMILY  \\*[$TOC_TITLE_FAM]
.          FT      \\*[$TOC_TITLE_FT]
.          PT_SIZE \\n[#TOC_PS]u\\*[$TOC_TITLE_SIZE_CHANGE]
.       \}
.       ie \\n[#PRINT_STYLE]=1 \{\
.          PAD "\\*[$FIRST_DOC_TITLE]\\*[$TOC_PN_TYPEWRITE]" 
.       \}
.       el \{\
.          PAD "\\h'\\n[#TOC_TITLE_INDENT]u'\\*[$FIRST_DOC_TITLE]\\*[$TOC_PN]"
.       \}
.       EOL
.       ST 100 L
.       ST 101 R
.       if \\n[#PRINT_STYLE]=2 \{\
.          FAMILY  \\*[$TOC_PN_FAM]
.          FT      \\*[$TOC_PN_FT]
.          PT_SIZE \\n[#TOC_PS]u\\*[$TOC_PN_SIZE_CHANGE]
.       \}
.       TAB 100
.       PRINT \\*[LEADER]
.       TN
.       PRINT \\n[#FIRST_DOC_TITLE_PN]
.       TQ
.    \}
.    TOC_PADDING \\n[#RESTORE_TOC_PN_PADDING]
.    nf
.    TOC_ENTRIES
.    br
.    rr #TOC
.    if \\n[#LINENUMBERS]=3 \{\
.       NUMBER_LINES RESUME
.       nr #LINENUMBERS 1
.       nn 1
.    \}
.END
\#
\# ====================================================================
\#
\# +++COLUMNS+++
\#
\# COLUMNS
\# -------
\# *Arguments:
\#   <number of columns>  <width of gutters>
\# *Function:
\#   Creates registers associated with setting docs in columns.
\#   Calculates column line lengths and offsets
\# *Notes:
\#   COLUMNS, if used, s/b the last macro invoked before START.
\#
.MAC COLUMNS END
.    if \\n[#IGNORE_COLUMNS]=1 \{ .return \}
.    nr #COLUMNS 1
.    nr #NUM_COLS \\$1
.    nr #GUTTER (\\$2)
.    nr #COL_L_LENGTH \\n[#L_LENGTH]-(\\n[#GUTTER]*(\\n[#NUM_COLS]-1))/\\n[#NUM_COLS]
.    nr #COL_TOTAL 0 \\n[#COL_L_LENGTH]+\\n[#GUTTER]
.    nr #COL_NUM 0 1
.    while !\\n[#COL_NUM]=\\n[#NUM_COLS] \{\
.       nr #COL_\\n+[#COL_NUM]_L_MARGIN \\n[#L_MARGIN]+\\n[#COL_TOTAL]
.       nr #COL_TOTAL \\n+[#COL_TOTAL]
.\}
.    if \\n[#NUM_COLS]=1 \{\
.       if !\\n[#COLLATE]=1 \{ .MN_INIT \}
.    \}
.    rr #COL_TOTAL
.    rr #COL_NUM
.END
\#
\#
\# NEXT COLUMN
\# -----------
\# *Arguments:
\#   <none>
\# *Function:
\#   Breaks current column and moves to next column.
\#   If current column is the last on the page, breaks
\#   to a new page.
\#
.MAC COL_NEXT END
.    if \\n[#COLUMNS] \{\
.       nr #COL_NEXT 1
.       ie '\\$0'COL_NEXT' \{ .br  \}
.       el \{\
.          brp
.          RLD 1v
.       \}
.       ie \\n[#COL_NUM]=\\n[#NUM_COLS] \{\
.          bp
.       \}
.       el \{ .FOOTER \}
.    \}
.END
\#
\# ====================================================================
\#
\# +++LISTS+++
\#
\# LIST
\# ----
\# *Arguments:
\#   [ BULLET | DASH | DIGIT | alpha | ALPHA | roman | ROMAN | USER ] [ <separator> | NONE ] [ <prefix> ] [ <anything> ]
\# *Function:
\#   Stores indent information in effect prior to invocation and
\#   initializes a list with the supplied enumerator (and separator).
\# *Notes:
\#   Default enumerator is a bullet.
\#
\#   Enumerator *must* be supplied for every list that's to the
\#   right of another list, every time, unless the default bullet is
\#   desired.
\#
\#   <anything> moves back one list level intuitively, or exits lists
\#   completely if the level in which it's invoked is the first.
\#
.MAC LIST END
.    ds $1ST_LETTER \\$1
.    substring $1ST_LETTER 0 0
.    if '\\*[$1ST_LETTER]'r' .ds $1ST_LETTER R
.    ie '\\*[$1ST_LETTER]'R' \{\
.       ds $LAST_CHAR \\$1
.       substring $LAST_CHAR -1
.       if !\B'\\*[$LAST_CHAR]' \{\
.          tm1 "[mom]: You must append a number to the \\$1 argument to LIST at line \\n(.c.
.          tm1 "       The number should be the total number of items in this list.
.          tm1 "       See the documentation.
.          ab Aborting LIST
.       \}
.       ds $ROMAN_WIDTH \\$1
.          substring $ROMAN_WIDTH 1
.       while !\B'\\*[$ROMAN_WIDTH]' \{\
.          substring $ROMAN_WIDTH 1
.\}
.       length #ROMAN_LENGTH \\*[$ROMAN_WIDTH]
.       ds $LIST_ARG_1 \\$1
.       substring $LIST_ARG_1 0 -(\\n[#ROMAN_LENGTH]+1)
.    \}
.    el \{\
.       ds $LIST_ARG_1 \\$1
.    \}
.    if !r#DEPTH \{\
.       nr #STORED_HL_INDENT \\n[#HL_INDENT]
.       nr #STORED_T_INDENT  \\n[#T_INDENT]
.       nr #CURRENT_L_LENGTH \\n(.l
.       nr #DEPTH 0 1
.       if \\n[#INDENT_ACTIVE]=1 \{\
.          if \\n[#INDENT_LEFT_ACTIVE]=1 \{\
.             nr #STORED_L_INDENT \\n[#L_INDENT]
.             nr #RESTORE_PREV_INDENT 1
.          \}
.          if \\n[#INDENT_BOTH_ACTIVE]=1 \{\
.             nr #STORED_BL_INDENT \\n[#BL_INDENT]
.             nr #STORED_BR_INDENT \\n[#BR_INDENT]
.             IBX
.             nr #ORIG_L_LENGTH \\n(.l
.             IB
.             nr #RESTORE_PREV_INDENT 2
.          \}
.          if \\n[#INDENT_RIGHT_ACTIVE]=1 \{\
.             nr #STORED_R_INDENT \\n[#R_INDENT]
.             IRX
.             nr #ORIG_L_LENGTH \\n(.l
.             IR
.             nr #RESTORE_PREV_INDENT 3
.             if \\n[#INDENT_LEFT_ACTIVE]=1 \{ .nr #RESTORE_PREV_INDENT 4 \}
.          \}
.       \}
.    \}
.    if \\n[#NUM_ARGS]=0 \{\
.       nr #ARGS_TO_LIST 1 \" So default behaves as if LIST BULLET
.       ds $ENUMERATOR\\n+[#DEPTH] \(bu
.       ds $ENUMERATOR_TYPE\\n[#DEPTH] other
.       ds $SEPARATOR
.    \}
.    if \\n[#NUM_ARGS]>0 \{\
.       rr #ARGS_TO_LIST \" Clear this before processing arg 1.
.       if '\\*[$LIST_ARG_1]'DASH'   \{\
.          nr #ARGS_TO_LIST 1
.          ds $ENUMERATOR\\n+[#DEPTH] \(en
.          ds $ENUMERATOR_TYPE\\n[#DEPTH] other
.          ds $SEPARATOR\\n[#DEPTH]
.       \}
.       if '\\*[$LIST_ARG_1]'BULLET' \{\
.          nr #ARGS_TO_LIST 1
.          ds $ENUMERATOR\\n+[#DEPTH] \(bu
.          ds $ENUMERATOR_TYPE\\n[#DEPTH] other
.          ds $SEPARATOR\\n[#DEPTH]
.       \}
.       if '\\*[$LIST_ARG_1]'DIGIT'  \{\
.          nr #ARGS_TO_LIST 1
.          nr #ENUMERATOR\\n+[#DEPTH] 0 1
.          ds $ENUMERATOR_TYPE\\n[#DEPTH] register
.          ds $SEPARATOR\\n[#DEPTH] .
.          ds $PREFIX\\n[#DEPTH]
.          if \\n[#NUM_ARGS]>=2 \{\
.             ie '\\$2'NONE' .ds $SEPARATOR\\n[#DEPTH]
.             el             .ds $SEPARATOR\\n[#DEPTH] \\$2
.             if \\n[#NUM_ARGS]=3 \{\
.                ds $PREFIX\\n[#DEPTH] \\$3
.             \}
.          \}
.       \}
.       if '\\*[$LIST_ARG_1]'alpha'  \{\
.          nr #ARGS_TO_LIST 1
.          nr #ENUMERATOR\\n+[#DEPTH] 0 1
.          af #ENUMERATOR\\n[#DEPTH] a
.          ds $ENUMERATOR_TYPE\\n[#DEPTH] register
.          ds $SEPARATOR\\n[#DEPTH] )
.          ds $PREFIX\\n[#DEPTH]
.          if \\n[#NUM_ARGS]>=2 \{\
.             ie '\\$2'NONE' .ds $SEPARATOR\\n[#DEPTH]
.             el             .ds $SEPARATOR\\n[#DEPTH] \\$2
.             if \\n[#NUM_ARGS]=3 \{\
.                ds $PREFIX\\n[#DEPTH] \\$3
.             \}
.          \}
.       \}
.       if '\\*[$LIST_ARG_1]'ALPHA'  \{\
.          nr #ARGS_TO_LIST 1
.          nr #ENUMERATOR\\n+[#DEPTH] 0 1
.          af #ENUMERATOR\\n[#DEPTH] A
.          ds $ENUMERATOR_TYPE\\n[#DEPTH] register
.          ds $SEPARATOR\\n[#DEPTH] )
.          ds $PREFIX\\n[#DEPTH]
.          if \\n[#NUM_ARGS]>=2 \{\
.             ie '\\$2'NONE' .ds $SEPARATOR\\n[#DEPTH]
.             el             .ds $SEPARATOR\\n[#DEPTH] \\$2
.             if \\n[#NUM_ARGS]=3 \{\
.                ds $PREFIX\\n[#DEPTH] \\$3
.             \}
.          \}
.       \}
.       if '\\*[$1ST_LETTER]'R'  \{\
.          nr #ARGS_TO_LIST 1
.          nr #ENUMERATOR\\n+[#DEPTH] 0 1
.          if '\\*[$LIST_ARG_1]'roman' \{\
.             af #ENUMERATOR\\n[#DEPTH] i
.          \}
.          if '\\*[$LIST_ARG_1]'ROMAN' \{\
.             af #ENUMERATOR\\n[#DEPTH] I
.          \}
.          ds $ENUMERATOR_TYPE\\n[#DEPTH] roman
.          ds $SEPARATOR\\n[#DEPTH] )
.          ds $PREFIX\\n[#DEPTH]
.          if \\n[#NUM_ARGS]>=2 \{\
.             ie '\\$2'NONE' .ds $SEPARATOR\\n[#DEPTH]
.             el             .ds $SEPARATOR\\n[#DEPTH] \\$2
.             if \\n[#NUM_ARGS]=3 \{\
.                ds $PREFIX\\n[#DEPTH] \\$3
.             \}
.          \}
.       \}
.       if '\\*[$LIST_ARG_1]'USER'   \{\
.          nr #ARGS_TO_LIST 1
.          ds $ENUMERATOR\\n+[#DEPTH] \\$2
.          ds $ENUMERATOR_TYPE\\n[#DEPTH] other
.          ds $SEPARATOR\\n[#DEPTH]
.          ds $PREFIX\\n[#DEPTH]
.       \}
.       if \\n[#NUM_ARGS]=1 \{\
.          if !r#ARGS_TO_LIST \{\
.             ie \\n[#DEPTH]=1 \{\
.                ie \\n[#NEXT_DEPTH_BACK]=0 \{\
.                   SET_LIST_INDENT
.                   if \\n[#QUIT]=1 \{\
.                      QUIT_LISTS
.                      return
.                   \}
.                   return
.                \}
.                el \{\
.                   QUIT_LISTS
.                   return
.                \} 
.             \}
.             el \{\
.                SET_LIST_INDENT
.                return
.             \}
.          \}
.       \}
.    \}
.    nr #TOTAL_LISTS \\n[#DEPTH]
.    if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'register' \{\
.       nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]m\\*[$SEPARATOR\\n[#DEPTH]]\ '
.       if '\\*[$LIST_ARG_1]'ALPHA'\{\
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]M\\*[$SEPARATOR\\n[#DEPTH]]\ '
.       \}
.    \}
.    if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'roman' \{\
.       GET_ROMAN_INDENT
.    \}
.    if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'other' \{\
.       nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$ENUMERATOR\\n[#DEPTH]]\0'
.    \}
.    LL \\n[#CURRENT_L_LENGTH]u
.    ie \\n[#DEPTH]=1 \{\
.       ie \\n[#INDENT_ACTIVE]=1 \{\
.          if \\n[#INDENT_LEFT_ACTIVE]=1 \{\
.             nr #L_INDENT \\n[#L_INDENT]+\\n[#LIST_INDENT\\n[#DEPTH]]
.             nr #HL_INDENT\\n[#DEPTH] \\n[#LIST_INDENT\\n[#DEPTH]]
.             nr #LIST_INDENT\\n[#DEPTH] \\n[#L_INDENT]
.          \}
.          if \\n[#INDENT_BOTH_ACTIVE]=1 \{\
.             nr #L_INDENT \\n[#BL_INDENT]+\\n[#LIST_INDENT\\n[#DEPTH]]
.             nr #HL_INDENT\\n[#DEPTH] \\n[#LIST_INDENT\\n[#DEPTH]]
.             nr #LIST_INDENT\\n[#DEPTH] \\n[#L_INDENT]
.          \}
.          if \\n[#INDENT_RIGHT_ACTIVE]=1 \{\
.             ie \\n[#INDENT_LEFT_ACTIVE]=1 \{\
.             \" Don't do anything; we already have a left indent
.             \}
.             el \{\
.                nr #L_INDENT +\\n[#LIST_INDENT\\n[#DEPTH]]
.                nr #HL_INDENT\\n[#DEPTH] \\n[#LIST_INDENT\\n[#DEPTH]]
.             \}
.          \}
.       \}
.       el \{\
.          nr #L_INDENT +\\n[#LIST_INDENT\\n[#DEPTH]]
.          nr #HL_INDENT\\n[#DEPTH] \\n[#LIST_INDENT\\n[#DEPTH]]
.       \}
.    \}
.    el \{\
.       nr #L_INDENT +\\n[#LIST_INDENT\\n[#DEPTH]]
.       nr #HL_INDENT\\n[#DEPTH] \\n[#LIST_INDENT\\n[#DEPTH]]
.    \}
.END
\#
\#
\# ITEM
\# ----
\# *Arguments:
\#   none
\# *Function:
\#   Prints enumerator for a given list depth and prepares mom to
\#   receive the text of an item.
\#
.MAC ITEM END
.    if \\n[#LINENUMBERS]=1 \{\
.       NUMBER_LINES OFF
.       nr #LINENUMBERS 2
.    \}
.    if \\n[#KERN]=1 \{\
.       nr #KERN_WAS_ON 1
.       KERN OFF
.    \}
.    IL 
.    ll \\n[#CURRENT_L_LENGTH]u \" Set ll again because IL turns IB off.
.    TRAP OFF
.    HI \\n[#HL_INDENT\\n[#DEPTH]]u
.    if '\\*[$SEPARATOR\\n[#DEPTH]]')' \{ .nr #SEP_TYPE 1 \}
.    if '\\*[$SEPARATOR\\n[#DEPTH]]']' \{ .nr #SEP_TYPE 1 \}
.    if '\\*[$SEPARATOR\\n[#DEPTH]]'}' \{ .nr #SEP_TYPE 1 \}
.    ie \\n[#IN_BIB_LIST]=1 \{\
.       ie \\n[#ENUMERATOR\\n[#DEPTH]]<9 \{\
.          ie \\n[#SEP_TYPE]=1 \{\
.             PRINT \v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\\n+[#ENUMERATOR\\n[#DEPTH]]\v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
.          \}
.          el \{\
.             PRINT \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
.          \}
.       \}
.       el \{\
.          ie \\n[#SEP_TYPE]=1 \{\
.             PRINT \h'-\w'\0'u'\v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\\n+[#ENUMERATOR\\n[#DEPTH]]\v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
.          \}
.          el \{\
.             PRINT \h'-\w'\0'u'\\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
.          \}
.       \}
.    \}
.    el \{\
.       ie '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'register' \{\
.\" DIGIT
.          ie '\\g[#ENUMERATOR\\n[#DEPTH]]'0' \{\
.             ie \\n[#PAD_LIST_DIGITS\\n[#DEPTH]]=1 \{\
.                ie \\n[#ENUMERATOR\\n[#DEPTH]]<9 \{\
.                   ie \\n[#SEP_TYPE]=1 \{\
.                      PRINT \0\v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\\n+[#ENUMERATOR\\n[#DEPTH]]\v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
.                   \}
.                   el \{\
.                      PRINT \0\\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
.                   \}
.                \}
.                el \{\
.                   ie \\n[#SEP_TYPE]=1 \{\
.                      PRINT \v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\\n+[#ENUMERATOR\\n[#DEPTH]]\v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
.                   \}
.                   el \{\
.                      PRINT \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
.                   \}
.                \}
.             \}
.             el \{\
.                ie \\n[#SEP_TYPE]=1 \{\
.                   PRINT \v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\\n+[#ENUMERATOR\\n[#DEPTH]]\v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
.                \}
.                el \{\
.                   PRINT \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
.                \}
.             \}
.          \}
.          el \{\
.\" ALPHA
.             ie '\\g[#ENUMERATOR\\n[#DEPTH]]'A' \{\
.                ie \\n[#SEP_TYPE]=1 \{\
.                   PRINT \v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\\n+[#ENUMERATOR\\n[#DEPTH]]\v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
.                \}
.                el \{\
.                   PRINT \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
.                \}
.             \}
.\" alpha
.             el \{\
.                PRINT \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
.             \}
.          \}
.       \}
.    \}
.    el \{\
.       if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'roman' \{\
.          ie \\n[#PAD_LIST_DIGITS\\n[#DEPTH]]=1 \{\
.\" ROMAN I, padded
.             ie '\\g[#ENUMERATOR\\n[#DEPTH]]'I' \{\
.                ie \\n[#SEP_TYPE]=1 \{\
.                   PRINT "\h'\\n[#LIST_INDENT\\n[#DEPTH]]u'\h'-\w'\\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\n[#SEPARATOR\\n[#DEPTH]]\ 'u'\v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\\n[#ENUMERATOR\\n[#DEPTH]]\v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
.                \}
.                el \{\
.                   PRINT "\h'\\n[#LIST_INDENT\\n[#DEPTH]]u'\h'-\w'\\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\n[#SEPARATOR\\n[#DEPTH]]\ 'u'\\*[$PREFIX\\n[#DEPTH]]\\n[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
.                \}
.             \}
.\" roman i, padded
.             el \{\
.                PRINT "\h'\\n[#LIST_INDENT\\n[#DEPTH]]u'\h'-\w'\\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\n[#SEPARATOR\\n[#DEPTH]]\ 'u'\\*[$PREFIX\\n[#DEPTH]]\\n[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
.             \}
.          \}
.\" No pad
.          el \{\
.\" ROMAN I, no pad
.             ie '\\g[#ENUMERATOR\\n[#DEPTH]]'I' \{\
.                ie \\n[#SEP_TYPE]=1 \{\
.                   PRINT \v'-.085m'\\*[$PREFIX\\n[#DEPTH]]\v'.085m'\\n+[#ENUMERATOR\\n[#DEPTH]]\v'-.085m'\\*[$SEPARATOR\\n[#DEPTH]]\v'.085m'
.                \}
.                el \{\
.                   PRINT \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
.                \}
.             \}
.\" roman i, no pad
.             el \{\
.                PRINT \\*[$PREFIX\\n[#DEPTH]]\\n+[#ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
.             \}
.          \}
.       \}
.       if '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'other' \{\
.          PRINT \\*[$ENUMERATOR\\n[#DEPTH]]\\*[$SEPARATOR\\n[#DEPTH]]
.       \}
.    \}
.    rr #SEP_TYPE
.    EOL
.    if \\n[#REF]=1 \{\
.       IL +\\*[$REF_BIB_INDENT]
.       ti \\n[#L_INDENT]u-\\*[$REF_BIB_INDENT]
.    \}
.    TRAP
.    if \\n[#KERN_WAS_ON]=1 \{\
.       KERN
.       rr #KERN_WAS_ON
.    \}
.    if \\n[#LINENUMBERS]=2 \{\
.       NUMBER_LINES RESUME
.       nr #LINENUMBERS 1
.    \}
.END
\#
\# A utility macro that determines the space to reserve for
\# roman numeral enumerated lists.  Limit is 20 roman numerals
\# per list.  If this isn't enough, the user can add to the
\# macro.
\#
.MAC GET_ROMAN_INDENT END
.    if '\\*[$LIST_ARG_1]'roman' \{\
.       if '\\*[$ROMAN_WIDTH]'1'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 1
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]i\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'2'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 2
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]ii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'3'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 3
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]iii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'4'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 4
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]iii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'5'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 5
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]iii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'6'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 6
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]iii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'7'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 7
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]vii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'8'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 8
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]viii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'9'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 9
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]viii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'10'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 10
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]viii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'11'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 11
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]viii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'12'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 12
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]viii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'13'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 13
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]xiii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'14'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 14
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]xiii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'15'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 15
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]xiii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'16'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 16
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]xiii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'17'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 17
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]xvii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'18'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 18
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]xviii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'19'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 19
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]xviii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'20'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 20
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]xviii\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.    \}
.    if '\\*[$LIST_ARG_1]'ROMAN' \{\
.       if '\\*[$ROMAN_WIDTH]'1'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 1
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]I\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'2'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 2
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]II\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'3'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 3
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]III\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'4'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 4
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]IV\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'5'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 5
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]IV\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'6'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 6
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]IV\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'7'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 7
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]VII\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'8'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 8
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]VIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'9'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 9
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]VIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'10'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 10
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]VIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'11'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 11
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]VIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'12'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 12
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]VIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'13'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 13
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]XIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'14'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 14
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]XIV\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'15'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 15
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]XIV\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'16'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 16
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]XIV\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'17'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 17
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]XVII\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'18'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 18
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]XVIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'19'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 19
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]XVIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.       if '\\*[$ROMAN_WIDTH]'20'  \{\
.          ds $ROMAN_WIDTH\\n[#DEPTH] 20
.          nr #LIST_INDENT\\n[#DEPTH] \w'\\*[$PREFIX\\n[#DEPTH]]XVIII\\*[$SEPARATOR\\n[#DEPTH]]\0'
.       \}
.    \}
.END
\#
\# SHIFT LIST
\# ----------
\# *Arguments:
\#   <amount by which to indent a list to the right>
\# *Function:
\#   Adds the value of the arg to the current list's indent.
\# *Notes:
\#   Requires a unit of measure.
\#
.MAC SHIFT_LIST END
.    ie '\\*[$ENUMERATOR_TYPE\\n[#DEPTH]]'roman' \{\
.       nr #SHIFT_LIST\\n[#DEPTH] (\\$1)
.       nr #LIST_INDENT\\n[#DEPTH] \\n(.i+\\n[#L_INDENT]+\\n[#SHIFT_LIST\\n[#DEPTH]]
.       nr #L_INDENT \\n[#LIST_INDENT\\n[#DEPTH]]
.    \}
.    el \{\
.       nr #LIST_INDENT\\n[#DEPTH] \\n[#L_INDENT]+(\\$1)
.       nr #L_INDENT \\n[#LIST_INDENT\\n[#DEPTH]]
.    \}
.END
\#
\#
\# PAD LIST DIGITS
\# ---------------
\# *Arguments:
\#   [ LEFT ]
\# *Function:
\#   Adds a figure space to a list's hanging and left indent.  If
\#   LEFT is given, sets reg. #PAD_LIST_DIGITS to 1 for use in ITEM.
\#
.MAC PAD_LIST_DIGITS END
.    if '\\g[#ENUMERATOR\\n[#DEPTH]]'0' \{\
.       nr #LIST_INDENT\\n[#DEPTH] +\\w'\\0'
.       nr #L_INDENT \\n[#LIST_INDENT\\n[#DEPTH]]+\\n[#LIST_INDENT\\n-[#DEPTH]]
.       nr #HL_INDENT\\n+[#DEPTH] +\\w'\\n[#ENUMERATOR\\n[#DEPTH]]'
.       if '\\$1'LEFT' \{ .nr #PAD_LIST_DIGITS\\n[#DEPTH] 1 \}
.    \}
.    if '\\g[#ENUMERATOR\\n[#DEPTH]]'i' \{\
.       if '\\$1'LEFT' \{ .nr #PAD_LIST_DIGITS\\n[#DEPTH] 1 \}
.    \}
.    if '\\g[#ENUMERATOR\\n[#DEPTH]]'I' \{\
.       if '\\$1'LEFT' \{ .nr #PAD_LIST_DIGITS\\n[#DEPTH] 1 \}
.    \}
.END
\#
\#
\# RESET LIST
\# ----------
\# *Arguments:
\#   none
\# *Function:
\#   Resets register enumerators to 1 or a.
\#
.MAC RESET_LIST END
.    ie '\\$1'' \{ .nr #ENUMERATOR\\n[#DEPTH] 0 1 \}
.    el \{ .nr #ENUMERATOR\\n[#DEPTH] \\$1-1 1 \}
.END
\#
\#
\# QUIT LISTS
\# ----------
\# *Arguments:
\#   none
\# *Function:
\#   Exits lists cleanly and restores any indents that were in
\#   effect prior to LIST.
\#
.MAC QUIT_LISTS END
.   IQ CLEAR
.   nr #HL_INDENT \\n[#STORED_HL_INDENT]
.   nr #T_INDENT  \\n[#STORED_T_INDENT]
.   rr #STORED_HL_INDENT
.   if \\n[#RESTORE_PREV_INDENT]=1 \{\
.      nr #L_INDENT  \\n[#STORED_L_INDENT]
.      IL
.      rr #STORED_L_INDENT
.   \}
.   if \\n[#RESTORE_PREV_INDENT]=2 \{\
.      nr #BL_INDENT \\n[#STORED_BL_INDENT]
.      nr #BR_INDENT \\n[#STORED_BR_INDENT]
.      LL \\n[#ORIG_L_LENGTH]u
.      IB
.      rr #STORED_BL_INDENT
.      rr #STORED_BR_INDENT
.   \}
.   if \\n[#RESTORE_PREV_INDENT]=3 \{\
.      nr #R_INDENT \\n[#STORED_R_INDENT]
.      LL \\n[#ORIG_L_LENGTH]u
.      IR
.      rr #STORED_R_INDENT
.   \}
.   if \\n[#RESTORE_PREV_INDENT]=4 \{\
.      nr #R_INDENT \\n[#STORED_R_INDENT]
.      nr #L_INDENT \\n[#STORED_L_INDENT]
.      LL \\n[#ORIG_L_LENGTH]u
.      IR
.      IL
.      rr #STORED_R_INDENT
.      rr #STORED_L_INDENT
.   \}
.\" Clean up after exiting last depth of list
.   nr #REMOVE 0 1
.   while \\n+[#REMOVE]<=\\n[#TOTAL_LISTS] \{\
.      rr #LIST_INDENT\\n[#REMOVE]
.      rr #ENUMERATOR\\n[#REMOVE]
.      rm $ENUMERATOR\\n[#REMOVE]
.      rr #SEPARATOR\\n[#REMOVE]
.      rm $ENUMERATOR_TYPE\\n[#REMOVE]
.      rr #PAD_LIST_DIGITS\\n[#REMOVE]
.\}
.   rr #REMOVE
.   rr #TOTAL_LISTS
.   rr #QUIT
.   rr #DEPTH
.   rr #NEXT_DEPTH_BACK
.   rr #RESTORE_PREV_INDENT
.   rr #ORIG_L_LENGTH
.   rr #CURRENT_L_LENGTH
.END
\#
\#
\# SET LIST INDENT
\# ---------------
\# *Arguments:
\#   none
\# *Function:
\#   Restores indent of prev. list in nested lists.  Also sets the
\#   #QUIT register if an invocation of LIST OFF applies to the first
\#   level of list.
\#
.MAC SET_LIST_INDENT END
.    nr #NEXT_DEPTH_BACK \\n[#DEPTH]-1
.    if \\n[#NEXT_DEPTH_BACK]=0 \{\
.       nr #QUIT 1
.       return
.    \}
.    nr #L_INDENT -\\n[#LIST_INDENT\\n[#DEPTH]]
.    nr #HL_INDENT \\n[#HL_INDENT\\n-[#DEPTH]]
.END
\#
\# ====================================================================
\#
\# +++DOCUMENT PROCESSING MISC AND SUPPORT MACROS+++
\#
\# COLLATE
\# -------
\# *Arguments:
\#   <none>
\# *Function:
\#   Turns headers off (if on) and saves header state, sets register
\#   #COLLATE to 1 (toggle), and breaks to a new page.
\# *Notes:
\#   COLLATE exists primarily to allow putting multiple chapters in
\#   a single file, although it can be used for any document type.  After
\#   COLLATE, any of the macros that normally precede START may be
\#   used, and should behave as expected.
\#
\#   N.B.--the START macro *must* be used after COLLATE (and any other
\#   macros that alter mom's behaviour).
\#
.MAC COLLATE END
.    nr #COLLATE 1
.    nr #HEADER_STATE \\n[#HEADERS_ON]
.    HEADERS OFF
.    if \\n[#PAGE_NUM_V_POS]=1 \{\
.       nr #PAGINATION_STATE \\n[#PAGINATE]
.       PAGINATION OFF
.    \}
.    IQ CLEAR
.    TQ
.\" Collect first doc's title for TOC
.    if \\n[#COLLATED_DOC]=0 \{\
.       ie \\n[#USER_SET_TITLE_ITEM] \{\
.          ds $FIRST_DOC_TITLE \\*[$USER_SET_TITLE_ITEM]\\|
.          rr #USER_SET_TITLE_ITEM
.          rm $USER_SET_TITLE_ITEM
.       \}
.       el \{\
.          ie \\n[#DOC_TYPE]=2 \{\
.             ie '\\*[$CHAPTER_TITLE]'' \{\
.                ds $FIRST_DOC_TITLE \\*[$CHAPTER_STRING] \\*[$CHAPTER]\\|
.             \}
.             el \{\
.                ie '\\*[$CHAPTER]'' \{\
.                   ds $FIRST_DOC_TITLE \\*[$CHAPTER_TITLE]\\|
.                \}
.                el \{\
.                   ds $FIRST_DOC_TITLE \\*[$CHAPTER_STRING] \\*[$CHAPTER]: \\*[$CHAPTER_TITLE]\\|
.                \}
.             \}
.          \}
.          el \{\
.             ds $FIRST_DOC_TITLE \\*[$TITLE]\\|
.          \}
.       \}
.       if \\n[#TOC_AUTHORS]=1 \{\
.          ie '\\*[$TOC_AUTHORS]'' \{\
.             as $FIRST_DOC_TITLE /\\|\\*[$AUTHOR_1]\\|
.          \}
.          el \{\
.             as $FIRST_DOC_TITLE /\\|\\*[$TOC_AUTHORS]\\|
.             rm $TOC_AUTHORS
.          \}
.       \}
.       nr #COLLATED_DOC 1
.    \}
.\" End title collection for TOC
.    LL \\n[#DOC_L_LENGTH]u
.    QUAD $DOC_QUAD
.    nr #SAVED_DOC_LEAD \\n[#DOC_LEAD]
.    LS \\n[#DOC_LEAD]u
\*[SLANTX]
\*[CONDX]
\*[EXTX]
'    NEWPAGE
.    if \\n[#DEFER_PAGINATION] \{ .PAGINATE \}
.    if !'\\*[$RESTORE_PAGENUM_STYLE]'' \{\
.       PAGENUM_STYLE \\*[$RESTORE_PAGENUM_STYLE]
.       rm $RESTORE_PAGENUM_STYLE
.    \}
.    rm $EN_TITLE
.    rr #PAGENUM_STYLE_SET
.END
\#
\#
\# NUMBER_LINES
\# ------------
\# *Arguments:
\#   <starting line number> [ <increment> [ <gutter> ] ]
\#   or
\#   <anything> | RESUME
\# *Function:
\#   Begin, suspend/turn off, or resume numbering of output lines.
\#
.MAC NUMBER_LINES END
.    br
.    if '\\n(.z'EPI_TEXT' \{ .return \}
.    if '\\$1'' \{\
.       tm1 "[mom]: NUMBER_LINES at line \\n(.c has no argument.
.       tm1 "       Most likely, you have forgotten to give it a starting line number.
.       ab Aborting on NUMBER_LINES.
.    \}
.    if !\\n[#LINENUMBERS]=2 \{ .nr #LINENUMBERS 1 \}
.\" Test whether the first arg is a digit.
.    if \B'\\$1' \{\
.       nr #LN \\$1
.       ds $LN_NUM \\$1
.       if !'\\n(.z'' \{ .nr #RESTORE_LN_NUM 1 \}
.       ie '\\$2'' \{\
.          if '\\*[$LN_INC]'' .ds $LN_INC 1
.       \}
.       el .ds $LN_INC \\$2
.       ie '\\$3'' \{\
.          if '\\*[$LN_GUTTER]'' .ds $LN_GUTTER 2
.       \}
.       el .ds $LN_GUTTER \\$3
.    \}
.    ie !\\n[#LN] \{\
.\" In other words, the first arg was not a digit.
.       rr #LN
.       ie '\\$1'RESUME' \{\
.          nm +0
.       \}
.       el \{\
.          nm
.          if !\\n[#LINENUMBERS]=2 \{ .rr #LINENUMBERS \}
.       \}
.    \}
.    el \{\
.       nm \\*[$LN_NUM] \\*[$LN_INC] \\*[$LN_GUTTER] -3-\\*[$LN_GUTTER]
.       if !'\\n(.z'' \{ .nr #DIVER_LN_OFF 1 \}
.    \}
.    rr #LN
.END
\#
\#
\# NUMBER QUOTE AND BLOCKQUOTE LINES AS PART OF RUNNING TEXT
\# ---------------------------------------------------------
\# *Argument:
\#   <gutter> | <anything>
\# *Function:
\#   Sets #(B)QUOTE_LN to 1 if no argument, or a single numeric
\#   argument, is given; otherwise, turns (BLOCK)QUOTE linenumbering
\#   off.
\# *Notes:
\#   #(B)QUOTE is checked for in QUOTE and BLOCKQUOTE.
\#   The single numeric argument allows establishing a different gutter from
\#   the one used for line numbers in running text.
\#
.MAC NUMBER_QUOTE_LINES END
.    ie \\n[#NUM_ARGS]=0 \{ .nr #QUOTE_LN 1 \}
.    el \{\
.       ie \B'\\$1' \{\
.          nr #QUOTE_LN 1
.          ds $Q_LN_GUTTER \\$1
.       \}
.       el \{\
.          ie '\\$1'SILENT' \{ .nr #SILENT_QUOTE_LN 1 \}
.          el \{\
.             rr #QUOTE_LN
.             rr #SILENT_QUOTE_LN
.          \}
.       \}
.    \}
.END
\#
\#
.MAC NUMBER_BLOCKQUOTE_LINES END
.    ie \\n[#NUM_ARGS]=0 \{ .nr #BQUOTE_LN 1 \}
.    el \{\
.       ie \B'\\$1' \{\
.          nr #BQUOTE_LN 1
.          ds $BQ_LN_GUTTER \\$1
.       \}
.       el \{\
.          ie '\\$1'SILENT' \{ .nr #SILENT_BQUOTE_LN 1 \}
.          el \{\
.             rr #BQUOTE_LN
.             rr #SILENT_BQUOTE_LN
.          \}
.       \}
.    \}
.END
\#
\# OUTPUT BLANK PAGES
\# ------------------
\# *Argument:
\#   <number of blank pages to output>
\# *Function:
\#   Outputs blank pages.
\# *Notes:
\#   If recto/verso, each page is recto/verso, even if there's
\#   nothing on it.
\#
\#   The argument to BLANKPAGE is non-optional.
\#
.MAC BLANKPAGE END
.    nr #HOW_MANY \\$1
.    nr #PAGES 0 1
.    while \\n+[#PAGES]<=\\n[#HOW_MANY] \{\
.       if \\n[#HEADERS_ON]=1 \{\
.          nr #HEADERS_WERE_ON 1
.          HEADERS OFF
.       \}
.       if \\n[#PAGE_NUM_V_POS]=1 \{\
.          if \\n[#PAGINATE]=1 \{ .nr #PAGINATE_WAS_ON 1 \}
.          PAGINATION OFF
.       \}
.       NEWPAGE
.       PRINT \&
.       if \\n[#FOOTERS_ON]=1 \{\
.          nr #FOOTERS_WERE_ON 1
.          FOOTERS OFF
.       \}
.       if \\n[#PAGE_NUM_V_POS]=2 \{\
.          if \\n[#PAGINATE]=1 \{ .nr #PAGINATE_WAS_ON 1 \}
.          PAGINATION OFF
.       \}
.       if \\n[#HEADERS_WERE_ON] \{ .HEADERS \}
.       if \\n[#PAGE_NUM_V_POS]=1 \{\
.          if \\n[#PAGINATE_WAS_ON] \{ .PAGINATE \}
.       \}
.\}
.    NEWPAGE
.    if \\n[#FOOTERS_WERE_ON] \{ .FOOTERS \}
.    if \\n[#PAGE_NUM_V_POS]=2 \{\
.       if \\n[#PAGINATE_WAS_ON] \{ .PAGINATE \}
.    \}
.    rr #HEADERS_WERE_ON
.    rr #FOOTERS_WERE_ON
.    rr #PAGINATE_WAS_ON
.END
\#
\#
\# SET TRAPS FOR HEADERS/FOOTERS/FOOTNOTES
\# ---------------------------------------
\# *Arguments:
\#   <none>
\# *Function:
\#   Sets header/footer/footnotes/etc... traps.
\#
\#   Calculates the number of lines that actually fit on a
\#   page based on #B_MARGIN and resets page bottom trap to coincide
\#   with the depth of that number of lines, or, if #ADJ_DOC_LEAD=1,
\#   adjusts #DOC_LEAD so that the last line of text on a page falls
\#   exactly on #B_MARGIN.
\#
.MAC TRAPS END
.\" Remove all header/footer traps
.    if !\\n[#NO_TRAP_RESET] \{\
.       ch DO_T_MARGIN
.       ch DO_B_MARGIN
.       ch HEADER
.       ch FOOTER
.       ch FN_OVERFLOW_TRAP
.\" Plant header trap
.       wh 0 HEADER
.    \}
.\" Adjust lead so last line of text falls on B_MARGIN,...
.    ie \\n[#ADJ_DOC_LEAD]=1 \{\
.       nr #LINES_PER_PAGE 0 1
.       nr #DOC_LEAD_ADJ 0 1
.       nr #DEPTH_TO_B_MARGIN \\n[#PAGE_LENGTH]-\\n[#ORIGINAL_B_MARGIN]-1v
.\" Get the number of unadjusted lines that fit on the page; always a
.\" bit short of the bottom margin
.       while \\n[#T_MARGIN]+(\\n[#DOC_LEAD]*\\n+[#LINES_PER_PAGE])<\\n[#DEPTH_TO_B_MARGIN] \{\
.
.\}
.       nr #LINES_PER_PAGE -1
.\" Add machine units, 1 at a time, increasing the leading until the 
.\" new leading fills the page properly
.       while \\n[#T_MARGIN]+(\\n[#DOC_LEAD]+\\n+[#DOC_LEAD_ADJ]*\\n[#LINES_PER_PAGE])<\\n[#DEPTH_TO_B_MARGIN] \{\
.
.\}
.       DOC_LEAD \\n[#DOC_LEAD]u+\\n[#DOC_LEAD_ADJ]u
.\" The "visual" bottom margin is what \n(nl would report on the
.\" last line before the FOOTER trap is sprung
.       nr #VISUAL_B_MARGIN \\n[#T_MARGIN]+(\\n[#LINES_PER_PAGE]*\\n[#DOC_LEAD])
.\" Get the difference between #B_MARGIN and #VISUAL_B_MARGIN
.       nr #FOOTER_DIFF (\\n[#PAGE_LENGTH]-\\n[#B_MARGIN])-\\n[#VISUAL_B_MARGIN]
.\" Set #B_MARGIN to 1 machine unit lower on the page than #VISUAL_B_MARGIN
.       nr #B_MARGIN \\n[#B_MARGIN]+(\\n[#FOOTER_DIFF]-1)
.\" Set the FN_OVERFLOW_TRAP position
.       nr #FN_OVERFLOW_TRAP_POS \\n[#B_MARGIN]u-\\n[#FN_LEAD]
.       if \\n[#PRINT_STYLE]=1 .nr #FN_OVERFLOW_TRAP_POS \\n[#ORIGINAL_B_MARGIN]u
.    \}
.\" ...or calculate new B_MARGIN based on # of lines (at #DOC_LEAD) that fit
.\" on the page.
.    el \{\
.       nr #LINES_PER_PAGE 0 1
.       nr #DEPTH_TO_B_MARGIN \\n[#PAGE_LENGTH]-\\n[#B_MARGIN]-1v
.       while \\n[#T_MARGIN]+(\\n[#DOC_LEAD]*\\n+[#LINES_PER_PAGE])<\\n[#DEPTH_TO_B_MARGIN] \{\
.
.\}
.       nr #VISUAL_B_MARGIN \\n[#T_MARGIN]+(\\n[#LINES_PER_PAGE]*\\n[#DOC_LEAD]-1v)
.       nr #FOOTER_DIFF (\\n[#PAGE_LENGTH]-\\n[#B_MARGIN])-\\n[#VISUAL_B_MARGIN]
.       nr #B_MARGIN \\n[#B_MARGIN]+(\\n[#FOOTER_DIFF]-1)
.       nr #FN_OVERFLOW_TRAP_POS \\n[#B_MARGIN]u-\\n[#FN_LEAD]
.    \}
.\" Set footer and footnote overflow traps
.    if !\\n[#NO_TRAP_RESET] \{\
.       nr #FN_COUNT 0 1
.       nr #SPACE_REMAINING 0
.       nr #FN_DEPTH 0
.       nr #VARIABLE_FOOTER_POS 0-\\n[#B_MARGIN]u
.       wh 20i FOOTER
.       wh -(\\n[#FN_OVERFLOW_TRAP_POS]u) FN_OVERFLOW_TRAP
.       ch FOOTER -\\n[#B_MARGIN]u
.    \}
.END
\#
\#
\# CHECK INDENT
\# ------------
\# *Arguments:
\#   <none>
\# *Function:
\#   Adds left, right, or both indent values to document elements
\#   like heads and subheads that are processed in environments.
\#
.MAC CHECK_INDENT END
.    if \\n[#INDENT_LEFT_ACTIVE] \{\
.       in \\n[#L_INDENT]u
.       if \\n[#QUOTE] \{\
.          in -\\n[#L_INDENT]u \"Because you added an indent in 2nd line of macro
.          ll -\\n[#L_INDENT]u
.          ta \\n(.lu
.       \}
.       if \\n[#EPIGRAPH] \{\
.          in -\\n[#L_INDENT]u
.          ll -\\n[#L_INDENT]u
.          ta \\n(.lu
.       \}
.    \}
.    if \\n[#INDENT_RIGHT_ACTIVE] \{\
.       ll -\\n[#R_INDENT]u
.       ta \\n(.lu
.    \}
.    if \\n[#INDENT_BOTH_ACTIVE] \{\
.       in \\n[#BL_INDENT]u
.       ll -\\n[#BR_INDENT]u
.       ta \\n(.lu
.       if \\n[#QUOTE] \{\
.          in -\\n[#BL_INDENT]u
.          ie \\n[#BR_INDENT]=\\n[#BL_INDENT] \{\
.             ll -\\n[#BR_INDENT]u
.             ta \\n(.lu
.          \}
.          el \{\
.             ll -(\\n[#BR_INDENT]u/2u)
.             ta \\n(.lu
.          \}
.       \}
.       if \\n[#EPIGRAPH] \{\
.          in -\\n[#BL_INDENT]u
.          ie \\n[#BR_INDENT]=\\n[#BL_INDENT] \{\
.             ll -\\n[#BR_INDENT]u
.             ta \\n(.lu
.          \}
.          el \{\
.             ll -(\\n[#BR_INDENT]u/2u)
.             ta \\n(.lu
.          \}
.       \}
.    \}
.END
\#
\#
\# REMOVE INDENT
\# -------------
\# *Arguments:
\#   <none>
\# *Function:
\#   Removes left, right, or both indent values from document elements
\#   like heads and subheads that are processed in environments.
\#
.MAC REMOVE_INDENT END
.    in 0
.    ll \\n[#L_LENGTH]u
.    ta \\n(.lu
.END
\#
\#
\# This .em (for all DOC_TYPEs except 4 [LETTER]) ensures that
\# deferred footnotes that happen on the 2nd to last page get
\# output.
\#
.MAC TERMINATE END
.    ie \\n[#FN_DEPTH] \{\
.       ie \\n[#FN_DEFER] \{\
.          br
.          nr #TERMINATE 1
.          FOOTNOTE
.          nf
.          FOOTNOTE OFF
.       \}
.       el \{\
.          br
.          ch FN_OVERFLOW_TRAP
.          DO_B_MARGIN
.       \}
.    \}
.    el \{\
.       br
.       ch FN_OVERFLOW_TRAP
.       DO_B_MARGIN
.    \}
.END
\#
\# END MACRO FOR LETTERS
\# ---------------------
\# *Arguments:
\#   none
\# *Function:
\#   The .em macro executed at the end of letters.  Turns footers
\#   and pagination off, terminates and outputs diversion CLOSING
\#   (indented with the author's name underneath).
\#
.MAC ALL_DONE END
.    br
.    FOOTERS OFF
.    PAGINATION OFF
.    if \\n[#DOC_TYPE]=4 \{\
.       br
.       if !'\\n(.z'' \{ .di \}
.       IQ CLEAR
.       TQ
.       TAB_SET 1 \\n[#DOC_L_LENGTH]u/2u \\n[#DOC_L_LENGTH]u/2u LEFT
.       ALD \\n[#DOC_LEAD]u*2u
.       TAB 1
.       if \\n[#CLOSING] \{\
.          nf
.          CLOSING
.       \}
.       ALD \\n[#DOC_LEAD]u*3u
.       PRINT \\*[$AUTHOR_1]
.    \}
.    DO_FOOTER
.END
\#
\# Set up a default papersize of US letter
\#
.PAPER LETTER
\#
\# ====================================================================
\#
\# +++DOCUMENT PROCESSING ALIASES+++
\#
\# Aliases to make life easier for users: synonyms, short forms
\# and alternate spellings.
\#
.ALIAS   BREAK_BLOCKQUOTE    BREAK_QUOTE
.ALIAS   BREAK_CITATION      BREAK_QUOTE
.ALIAS   BREAK_CITE          BREAK_QUOTE
.ALIAS   BLOCKQUOTE_INDENT   QUOTE_INDENT
.ALIAS   CITATION            BLOCKQUOTE
.ALIAS   CITATION_FAMILY     BLOCKQUOTE_FAMILY
.ALIAS   CITATION_FONT       BLOCKQUOTE_FONT
.ALIAS   CITATION_SIZE       BLOCKQUOTE_SIZE
.ALIAS   CITATION_COLOR      BLOCKQUOTE_COLOR
.ALIAS   CITATION_QUAD       BLOCKQUOTE_QUAD
.ALIAS   CITE                BLOCKQUOTE
.ALIAS   CITE_FAMILY         BLOCKQUOTE_FAMILY
.ALIAS   CITE_FONT           BLOCKQUOTE_FONT
.ALIAS   CITE_SIZE           BLOCKQUOTE_SIZE
.ALIAS   CITE_COLOR          BLOCKQUOTE_COLOR
.ALIAS   CITE_QUAD           BLOCKQUOTE_QUAD
.ALIAS   DOC_R_MARGIN        DOC_RIGHT_MARGIN
.ALIAS   DOC_L_MARGIN        DOC_LEFT_MARGIN
.ALIAS   DOC_L_LENGTH        DOC_LINE_LENGTH
.ALIAS   DOC_RMARGIN         DOC_RIGHT_MARGIN
.ALIAS   DOC_LMARGIN         DOC_LEFT_MARGIN
.ALIAS   DOC_LLENGTH         DOC_LINE_LENGTH
.ALIAS   DOC_FAM             DOC_FAMILY
.ALIAS   DOC_LS              DOC_LEAD
.ALIAS   DOC_PS              DOC_PT_SIZE
.ALIAS   FILL                QUAD
.ALIAS   PAGENUM             PAGENUMBER
.ALIAS   PAGINATION          PAGINATE
.ALIAS   PP_FT               PP_FONT
.ALIAS   REF_INDENT          INDENT_REFS
.ALIAS   TOC_PS              TOC_PT_SIZE
\#
\# HEADER and FOOTER macros
\# ------------------------
\# Because the type-style of headers and footers are managed
\# identically, and the type-style macros (_<type parameter>) all
\# require the correct name of the calling macro, it's necessary
\# to create HEADER_ and FOOTER_ macros here.  They're basically
\# "aliases" of HDRFTR_, but required because you can't alias an
\# alias.
\#
.MAC FOOTER_CENTER_COLOR END
.    HDRFTR_CENTER_COLOR \\$1
.END
\#
.MAC FOOTER_CENTER_COLOUR END
.    HDRFTR_CENTER_COLOR \\$1
.END
\#
.MAC FOOTER_CENTER_FAM END
.    HDRFTR_CENTER_FAMILY \\$1
.END
\#
.MAC FOOTER_CENTER_FAMILY END
.    HDRFTR_CENTER_FAMILY \\$1
.END
\#
.MAC FOOTER_CENTER_FONT END
.    HDRFTR_CENTER_FONT \\$1
.END
\#
.MAC FOOTER_CENTER_FT END
.    HDRFTR_CENTER_FONT \\$1
.END
\#
.MAC FOOTER_CENTER_PS END
.    HDRFTR_CENTER_SIZE \\$1
.END
\#
.MAC FOOTER_CENTER_SIZE END
.    HDRFTR_CENTER_SIZE \\$1
.END
\#
.MAC FOOTER_CENTRE_CAPS END
.    HDRFTR_CENTER_CAPS \\$1
.END
\#
.MAC FOOTER_CENTRE_COLOR END
.    HDRFTR_CENTRE_COLOR \\$1
.END
\#
.MAC FOOTER_CENTRE_COLOUR END
.    HDRFTR_CENTRE_COLOR \\$1
.END
\#
.MAC FOOTER_CENTRE_FAM END
.    HDRFTR_CENTER_FAMILY \\$1
.END
\#
.MAC FOOTER_CENTRE_FAMILY END
.    HDRFTR_CENTER_FAMILY \\$1
.END
\#
.MAC FOOTER_CENTRE_FONT END
.    HDRFTR_CENTER_FONT \\$1
.END
\#
.MAC FOOTER_CENTRE_FT END
.    HDRFTR_CENTER_FONT \\$1
.END
\#
.MAC FOOTER_CENTRE_PS END
.    HDRFTR_CENTER_SIZE \\$1
.END
\#
.MAC FOOTER_CENTRE_SIZE END
.    HDRFTR_CENTER_SIZE \\$1
.END
\#
.MAC FOOTER_COLOR END
.    HDRFTR_COLOR \\$1
.END
\#
.MAC FOOTER_COLOUR END
.    HDRFTR_COLOR \\$1
.END
\#
.MAC FOOTER_FAM END
.    HDRFTR_FAMILY \\$1
.END
\#
.MAC FOOTER_FAMILY END
.    HDRFTR_FAMILY \\$1
.END
\#
.MAC FOOTER_LEFT_COLOR END
.    HDRFTR_LEFT_COLOR \\$1
.END
\#
.MAC FOOTER_LEFT_COLOUR END
.    HDRFTR_LEFT_COLOR \\$1
.END
\#
.MAC FOOTER_LEFT_FAM END
.    HDRFTR_LEFT_FAMILY \\$1
.END
\#
.MAC FOOTER_LEFT_FAMILY END
.    HDRFTR_LEFT_FAMILY \\$1
.END
\#
.MAC FOOTER_LEFT_FONT END
.    HDRFTR_LEFT_FONT \\$1
.END
\#
.MAC FOOTER_LEFT_FT END
.    HDRFTR_LEFT_FONT \\$1
.END
\#
.MAC FOOTER_LEFT_PS END
.    HDRFTR_LEFT_SIZE \\$1
.END
\#
.MAC FOOTER_LEFT_SIZE END
.    HDRFTR_LEFT_SIZE \\$1
.END
\#
.MAC FOOTER_RIGHT_COLOR END
.    HDRFTR_RIGHT_COLOR \\$1
.END
\#
.MAC FOOTER_RIGHT_COLOUR END
.    HDRFTR_RIGHT_COLOR \\$1
.END
\#
.MAC FOOTER_RIGHT_FAM END
.    HDRFTR_RIGHT_FAMILY \\$1
.END
\#
.MAC FOOTER_RIGHT_FAMILY END
.    HDRFTR_RIGHT_FAMILY \\$1
.END
\#
.MAC FOOTER_RIGHT_FONT END
.    HDRFTR_RIGHT_FONT \\$1
.END
\#
.MAC FOOTER_RIGHT_FT END
.    HDRFTR_RIGHT_FONT \\$1
.END
\#
.MAC FOOTER_RIGHT_PS END
.    HDRFTR_RIGHT_SIZE \\$1
.END
\#
.MAC FOOTER_RIGHT_SIZE END
.    HDRFTR_RIGHT_SIZE \\$1
.END
\#
.MAC FOOTER_RULE_COLOR END
.    HDRFTR_RULE_COLOR \\$1
.END
\#
.MAC FOOTER_SIZE END
.    HDRFTR_SIZE \\$1
.END
\#
.MAC HEADER_CENTER_COLOR END
.    HDRFTR_CENTER_COLOR \\$1
.END
\#
.MAC HEADER_CENTER_COLOUR END
.    HDRFTR_CENTER_COLOR \\$1
.END
\#
.MAC HEADER_CENTER_FAM END
.    HDRFTR_CENTER_FAMILY \\$1
.END
\#
.MAC HEADER_CENTER_FAMILY END
.    HDRFTR_CENTER_FAMILY \\$1
.END
\#
.MAC HEADER_CENTER_FONT END
.    HDRFTR_CENTER_FONT \\$1
.END
\#
.MAC HEADER_CENTER_FT END
.    HDRFTR_CENTER_FONT \\$1
.END
\#
.MAC HEADER_CENTER_PS END
.    HDRFTR_CENTER_SIZE \\$1
.END
\#
.MAC HEADER_CENTER_SIZE END
.    HDRFTR_CENTER_SIZE \\$1
.END
\#
.MAC HEADER_CENTRE_COLOR END
.    HDRFTR_CENTRE_COLOR \\$1
.END
\#
.MAC HEADER_CENTRE_COLOUR END
.    HDRFTR_CENTRE_COLOR \\$1
.END
\#
.MAC HEADER_CENTRE_FAM END
.    HDRFTR_CENTER_FAMILY \\$1
.END
\#
.MAC HEADER_CENTRE_FAMILY END
.    HDRFTR_CENTER_FAMILY \\$1
.END
\#
.MAC HEADER_CENTRE_FONT END
.    HDRFTR_CENTER_FONT \\$1
.END
\#
.MAC HEADER_CENTRE_FT END
.    HDRFTR_CENTER_FONT \\$1
.END
\#
.MAC HEADER_CENTRE_PS END
.    HDRFTR_CENTER_SIZE \\$1
.END
\#
.MAC HEADER_CENTRE_SIZE END
.    HDRFTR_CENTER_SIZE \\$1
.END
\#
.MAC HEADER_COLOR END
.    HDRFTR_COLOR \\$1
.END
\#
.MAC HEADER_COLOUR END
.    HDRFTR_COLOR \\$1
.END
\#
.MAC HEADER_FAM END
.    HDRFTR_FAMILY \\$1
.END
\#
.MAC HEADER_FAMILY END
.    HDRFTR_FAMILY \\$1
.END
\#
.MAC HEADER_LEFT_COLOR END
.    HDRFTR_LEFT_COLOR \\$1
.END
\#
.MAC HEADER_LEFT_COLOUR END
.    HDRFTR_LEFT_COLOR \\$1
.END
\#
.MAC HEADER_LEFT_FAM END
.    HDRFTR_LEFT_FAMILY \\$1
.END
\#
.MAC HEADER_LEFT_FAMILY END
.    HDRFTR_LEFT_FAMILY \\$1
.END
\#
.MAC HEADER_LEFT_FONT END
.    HDRFTR_LEFT_FONT \\$1
.END
\#
.MAC HEADER_LEFT_FT END
.    HDRFTR_LEFT_FONT \\$1
.END
\#
.MAC HEADER_LEFT_PS END
.    HDRFTR_LEFT_SIZE \\$1
.END
\#
.MAC HEADER_LEFT_SIZE END
.    HDRFTR_LEFT_SIZE \\$1
.END
\#
.MAC HEADER_RIGHT_COLOR END
.    HDRFTR_RIGHT_COLOR \\$1
.END
\#
.MAC HEADER_RIGHT_COLOUR END
.    HDRFTR_RIGHT_COLOR \\$1
.END
\#
.MAC HEADER_RIGHT_FAM END
.    HDRFTR_RIGHT_FAMILY \\$1
.END
\#
.MAC HEADER_RIGHT_FAMILY END
.    HDRFTR_RIGHT_FAMILY \\$1
.END
\#
.MAC HEADER_RIGHT_FONT END
.    HDRFTR_RIGHT_FONT \\$1
.END
\#
.MAC HEADER_RIGHT_FT END
.    HDRFTR_RIGHT_FONT \\$1
.END
\#
.MAC HEADER_RIGHT_PS END
.    HDRFTR_RIGHT_SIZE \\$1
.END
\#
.MAC HEADER_RIGHT_SIZE END
.    HDRFTR_RIGHT_SIZE \\$1
.END
\#
.MAC HEADER_RULE_COLOR END
.    HDRFTR_RULE_COLOR \\$1
.END
\#
.MAC HEADER_SIZE END
.    HDRFTR_SIZE \\$1
.END
\#
\# HEADER and FOOTER aliases for HDRFTR macros.
\#
.ALIAS   BIBLIOGRAPHY_FOOTER_CENTER    BIBLIOGRAPHY_HDRFTR_CENTER
.ALIAS   BIBLIOGRAPHY_FOOTER_CENTRE    BIBLIOGRAPHY_HDRFTR_CENTRE
.ALIAS   BIBLIOGRAPHY_HEADER_CENTER    BIBLIOGRAPHY_HDRFTR_CENTER
.ALIAS   BIBLIOGRAPHY_HEADER_CENTRE    BIBLIOGRAPHY_HDRFTR_CENTRE
.ALIAS   ENDNOTES_FOOTER_CENTER    ENDNOTES_HDRFTR_CENTER
.ALIAS   ENDNOTES_FOOTER_CENTRE    ENDNOTES_HDRFTR_CENTRE
.ALIAS   ENDNOTES_HEADER_CENTER    ENDNOTES_HDRFTR_CENTER
.ALIAS   ENDNOTES_HEADER_CENTRE    ENDNOTES_HDRFTR_CENTRE
.ALIAS   FOOTER_CENTER_CAPS        HDRFTR_CENTER_CAPS
.ALIAS   FOOTER_CENTER             HDRFTR_CENTER
.ALIAS   FOOTER_CENTER_PAD         HDRFTR_CENTER_PAD
.ALIAS   FOOTER_CENTRE             HDRFTR_CENTER
.ALIAS   FOOTER_CENTRE_PAD         HDRFTR_CENTER_PAD
.ALIAS   FOOTER_LEFT_CAPS          HDRFTR_LEFT_CAPS
.ALIAS   FOOTER_LEFT               HDRFTR_LEFT
.ALIAS   FOOTER_PLAIN              HDRFTR_PLAIN
.ALIAS   FOOTER_RECTO              HDRFTR_RECTO
.ALIAS   FOOTER_RIGHT_CAPS         HDRFTR_RIGHT_CAPS
.ALIAS   FOOTER_RIGHT              HDRFTR_RIGHT
.ALIAS   FOOTER_RULE_GAP           HDRFTR_RULE_GAP
.ALIAS   FOOTER_RULE               HDRFTR_RULE
.ALIAS   FOOTER_VERSO              HDRFTR_VERSO
.ALIAS   HEADER_CENTER_CAPS        HDRFTR_CENTER_CAPS
.ALIAS   HEADER_CENTER             HDRFTR_CENTER
.ALIAS   HEADER_CENTER_PAD         HDRFTR_CENTER_PAD
.ALIAS   HEADER_CENTRE_CAPS        HDRFTR_CENTER_CAPS
.ALIAS   HEADER_CENTRE             HDRFTR_CENTER
.ALIAS   HEADER_CENTRE_PAD         HDRFTR_CENTER_PAD
.ALIAS   HEADER_LEFT_CAPS          HDRFTR_LEFT_CAPS
.ALIAS   HEADER_LEFT               HDRFTR_LEFT
.ALIAS   HEADER_PLAIN              HDRFTR_PLAIN
.ALIAS   HEADER_RECTO              HDRFTR_RECTO
.ALIAS   HEADER_RIGHT_CAPS         HDRFTR_RIGHT_CAPS
.ALIAS   HEADER_RIGHT              HDRFTR_RIGHT
.ALIAS   HEADER_RULE_GAP           HDRFTR_RULE_GAP
.ALIAS   HEADER_RULE               HDRFTR_RULE
.ALIAS   HEADER_VERSO              HDRFTR_VERSO
.ALIAS   SWITCH_FOOTERS            SWITCH_HDRFTR
.ALIAS   SWITCH_HEADERS            SWITCH_HDRFTR
\#
\# Type-style aliases
\#
.ALIAS   AUTHOR_FAMILY                    _FAMILY
.ALIAS   BIBLIOGRAPHY_FAMILY              _FAMILY
.ALIAS   BIBLIOGRAPHY_STRING_FAMILY       _FAMILY
.ALIAS   BLOCKQUOTE_FAMILY                _FAMILY
.ALIAS   CHAPTER_TITLE_FAMILY             _FAMILY
.ALIAS   COVER_AUTHOR_FAMILY              _FAMILY
.ALIAS   COVER_CHAPTER_TITLE_FAMILY       _FAMILY
.ALIAS   COVER_COPYRIGHT_FAMILY           _FAMILY
.ALIAS   COVER_DOCTYPE_FAMILY             _FAMILY
.ALIAS   COVER_FAMILY                     _FAMILY
.ALIAS   COVER_SUBTITLE_FAMILY            _FAMILY
.ALIAS   COVER_TITLE_FAMILY               _FAMILY
.ALIAS   DOC_COVER_AUTHOR_FAMILY          _FAMILY
.ALIAS   DOC_COVER_CHAPTER_TITLE_FAMILY   _FAMILY
.ALIAS   DOC_COVER_COPYRIGHT_FAMILY       _FAMILY
.ALIAS   DOC_COVER_DOCTYPE_FAMILY         _FAMILY
.ALIAS   DOC_COVER_FAMILY                 _FAMILY
.ALIAS   DOC_COVER_SUBTITLE_FAMILY        _FAMILY
.ALIAS   DOC_COVER_TITLE_FAMILY           _FAMILY
.ALIAS   DOCHEADER_FAMILY                 _FAMILY
.ALIAS   DOCTYPE_FAMILY                   _FAMILY
.ALIAS   ENDNOTE_FAMILY                   _FAMILY
.ALIAS   ENDNOTE_NUMBER_FAMILY            _FAMILY
.ALIAS   ENDNOTE_LINENUMBER_FAMILY        _FAMILY
.ALIAS   ENDNOTE_STRING_FAMILY            _FAMILY
.ALIAS   ENDNOTE_TITLE_FAMILY             _FAMILY
.ALIAS   EPIGRAPH_FAMILY                  _FAMILY
.ALIAS   FOOTNOTE_FAMILY                  _FAMILY
.ALIAS   HDRFTR_CENTER_FAMILY             _FAMILY
.ALIAS   HDRFTR_FAMILY                    _FAMILY
.ALIAS   HDRFTR_LEFT_FAMILY               _FAMILY
.ALIAS   HDRFTR_RIGHT_FAMILY              _FAMILY
.ALIAS   HEAD_FAMILY                      _FAMILY
.ALIAS   PAGENUM_FAMILY                   _FAMILY
.ALIAS   PARAHEAD_FAMILY                  _FAMILY
.ALIAS   QUOTE_FAMILY                     _FAMILY
.ALIAS   SUBHEAD_FAMILY                   _FAMILY
.ALIAS   SUBTITLE_FAMILY                  _FAMILY
.ALIAS   TITLE_FAMILY                     _FAMILY
.ALIAS   TOC_FAM                          _FAMILY
.ALIAS   TOC_FAMILY                       _FAMILY
.ALIAS   TOC_HEADER_FAMILY                _FAMILY
.ALIAS   TOC_HEAD_FAMILY                  _FAMILY
.ALIAS   TOC_PARAHEAD_FAMILY              _FAMILY
.ALIAS   TOC_PN_FAMILY                    _FAMILY
.ALIAS   TOC_SUBHEAD_FAMILY               _FAMILY
.ALIAS   TOC_TITLE_FAMILY                 _FAMILY
\#
.ALIAS   AUTHOR_FONT                    _FONT
.ALIAS   BIBLIOGRAPHY_STRING_FONT       _FONT
.ALIAS   BIBLIOGRAPHY_FONT              _FONT
.ALIAS   BLOCKQUOTE_FONT                _FONT
.ALIAS   CHAPTER_TITLE_FONT             _FONT
.ALIAS   COVER_AUTHOR_FONT              _FONT
.ALIAS   COVER_CHAPTER_TITLE_FONT       _FONT
.ALIAS   COVER_COPYRIGHT_FONT           _FONT
.ALIAS   COVER_DOCTYPE_FONT             _FONT
.ALIAS   COVER_SUBTITLE_FONT            _FONT
.ALIAS   COVER_TITLE_FONT               _FONT
.ALIAS   DOC_COVER_AUTHOR_FONT          _FONT
.ALIAS   DOC_COVER_CHAPTER_TITLE_FONT   _FONT
.ALIAS   DOC_COVER_COPYRIGHT_FONT       _FONT
.ALIAS   DOC_COVER_DOCTYPE_FONT         _FONT
.ALIAS   DOC_COVER_SUBTITLE_FONT        _FONT
.ALIAS   DOC_COVER_TITLE_FONT           _FONT
.ALIAS   DOCTYPE_FONT                   _FONT
.ALIAS   ENDNOTE_FONT                   _FONT
.ALIAS   ENDNOTE_NUMBER_FONT            _FONT
.ALIAS   ENDNOTE_LINENUMBER_FONT        _FONT
.ALIAS   ENDNOTE_STRING_FONT            _FONT
.ALIAS   ENDNOTE_TITLE_FONT             _FONT
.ALIAS   EPIGRAPH_FONT                  _FONT
.ALIAS   FOOTNOTE_FONT                  _FONT
.ALIAS   HDRFTR_CENTER_FONT             _FONT
.ALIAS   HDRFTR_LEFT_FONT               _FONT
.ALIAS   HDRFTR_RIGHT_FONT              _FONT
.ALIAS   HEAD_FONT                      _FONT
.ALIAS   PAGENUM_FONT                   _FONT
.ALIAS   PARAHEAD_FONT                  _FONT
.ALIAS   QUOTE_FONT                     _FONT
.ALIAS   SUBHEAD_FONT                   _FONT
.ALIAS   SUBTITLE_FONT                  _FONT
.ALIAS   TITLE_FONT                     _FONT
.ALIAS   TOC_HEADER_FONT                _FONT
.ALIAS   TOC_HEAD_FONT                  _FONT
.ALIAS   TOC_PARAHEAD_FONT              _FONT
.ALIAS   TOC_PN_FONT                    _FONT
.ALIAS   TOC_SUBHEAD_FONT               _FONT
.ALIAS   TOC_TITLE_FONT                 _FONT
\#
.ALIAS   AUTHOR_SIZE                    _SIZE
.ALIAS   BIBLIOGRAPHY_STRING_SIZE       _SIZE
.ALIAS   BLOCKQUOTE_SIZE                _SIZE
.ALIAS   CHAPTER_TITLE_SIZE             _SIZE
.ALIAS   COVER_AUTHOR_SIZE              _SIZE
.ALIAS   COVER_CHAPTER_TITLE_SIZE       _SIZE
.ALIAS   COVER_COPYRIGHT_SIZE           _SIZE
.ALIAS   COVER_DOCTYPE_SIZE             _SIZE
.ALIAS   COVER_SUBTITLE_SIZE            _SIZE
.ALIAS   COVER_TITLE_SIZE               _SIZE
.ALIAS   DOC_COVER_AUTHOR_SIZE          _SIZE
.ALIAS   DOC_COVER_CHAPTER_TITLE_SIZE   _SIZE
.ALIAS   DOC_COVER_COPYRIGHT_SIZE       _SIZE
.ALIAS   DOC_COVER_DOCTYPE_SIZE         _SIZE
.ALIAS   DOC_COVER_SUBTITLE_SIZE        _SIZE
.ALIAS   DOC_COVER_TITLE_SIZE           _SIZE
.ALIAS   DOCTYPE_SIZE                   _SIZE
.ALIAS   ENDNOTE_NUMBER_SIZE            _SIZE
.ALIAS   ENDNOTE_LINENUMBER_SIZE        _SIZE
.ALIAS   ENDNOTE_STRING_SIZE            _SIZE
.ALIAS   ENDNOTE_TITLE_SIZE             _SIZE
.ALIAS   EPIGRAPH_SIZE                  _SIZE
.ALIAS   FOOTNOTE_SIZE                  _SIZE
.ALIAS   HDRFTR_CENTER_SIZE             _SIZE
.ALIAS   HDRFTR_LEFT_SIZE               _SIZE
.ALIAS   HDRFTR_RIGHT_SIZE              _SIZE
.ALIAS   HDRFTR_SIZE                    _SIZE
.ALIAS   HEAD_SIZE                      _SIZE
.ALIAS   PAGENUM_SIZE                   _SIZE
.ALIAS   PARAHEAD_SIZE                  _SIZE
.ALIAS   QUOTE_SIZE                     _SIZE
.ALIAS   SUBHEAD_SIZE                   _SIZE
.ALIAS   SUBTITLE_SIZE                  _SIZE
.ALIAS   TITLE_SIZE                     _SIZE
.ALIAS   TOC_HEADER_SIZE                _SIZE
.ALIAS   TOC_HEAD_SIZE                  _SIZE
.ALIAS   TOC_PARAHEAD_SIZE              _SIZE
.ALIAS   TOC_PN_SIZE                    _SIZE
.ALIAS   TOC_SUBHEAD_SIZE               _SIZE
.ALIAS   TOC_TITLE_SIZE                 _SIZE
\#
.ALIAS   ATTRIBUTE_COLOR                 _COLOR
.ALIAS   AUTHOR_COLOR                    _COLOR
.ALIAS   BLOCKQUOTE_COLOR                _COLOR
.ALIAS   CHAPTER_TITLE_COLOR             _COLOR
.ALIAS   COVER_ATTRIBUTE_COLOR           _COLOR
.ALIAS   COVER_AUTHOR_COLOR              _COLOR
.ALIAS   COVER_CHAPTER_TITLE_COLOR       _COLOR
.ALIAS   COVER_COLOR                     _COLOR
.ALIAS   COVER_COPYRIGHT_COLOR           _COLOR
.ALIAS   COVER_DOCTYPE_COLOR             _COLOR
.ALIAS   COVER_MISC_COLOR                _COLOR
.ALIAS   COVER_SUBTITLE_COLOR            _COLOR
.ALIAS   COVER_TITLE_COLOR               _COLOR
.ALIAS   DOC_COVER_ATTRIBUTE_COLOR       _COLOR
.ALIAS   DOC_COVER_AUTHOR_COLOR          _COLOR
.ALIAS   DOC_COVER_CHAPTER_TITLE_COLOR   _COLOR
.ALIAS   DOC_COVER_COLOR                 _COLOR
.ALIAS   DOC_COVER_COPYRIGHT_COLOR       _COLOR
.ALIAS   DOC_COVER_DOCTYPE_COLOR         _COLOR
.ALIAS   DOC_COVER_MISC_COLOR            _COLOR
.ALIAS   DOC_COVER_SUBTITLE_COLOR        _COLOR
.ALIAS   DOC_COVER_TITLE_COLOR           _COLOR
.ALIAS   DOCHEADER_COLOR                 _COLOR
.ALIAS   DOCTYPE_COLOR                   _COLOR
.ALIAS   EPIGRAPH_COLOR                  _COLOR
.ALIAS   FINIS_COLOR                     _COLOR
.ALIAS   FOOTNOTE_COLOR                  _COLOR
.ALIAS   HDRFTR_CENTER_COLOR             _COLOR
.ALIAS   HDRFTR_COLOR                    _COLOR
.ALIAS   HDRFTR_LEFT_COLOR               _COLOR
.ALIAS   HDRFTR_RIGHT_COLOR              _COLOR
.ALIAS   HDRFTR_RULE_COLOR               _COLOR
.ALIAS   HEAD_COLOR                      _COLOR
.ALIAS   LINEBREAK_COLOR                 _COLOR
.ALIAS   PAGENUM_COLOR                   _COLOR
.ALIAS   PARAHEAD_COLOR                  _COLOR
.ALIAS   QUOTE_COLOR                     _COLOR
.ALIAS   SUBHEAD_COLOR                   _COLOR
.ALIAS   SUBTITLE_COLOR                  _COLOR
.ALIAS   TITLE_COLOR                     _COLOR
\#
.ALIAS   BIBLIOGRAPHY_QUAD          _QUAD
.ALIAS   BIBLIOGRAPHY_STRING_QUAD   _QUAD
.ALIAS   BLOCKQUOTE_QUAD            _QUAD
.ALIAS   COVER_COPYRIGHT_QUAD       _QUAD
.ALIAS   COVER_MISC_QUAD            _QUAD
.ALIAS   DOC_COVER_COPYRIGHT_QUAD   _QUAD
.ALIAS   DOC_COVER_MISC_QUAD        _QUAD
.ALIAS   DOC_QUAD                   _QUAD
.ALIAS   ENDNOTE_QUAD               _QUAD
.ALIAS   ENDNOTE_STRING_QUAD        _QUAD
.ALIAS   ENDNOTE_TITLE_QUAD         _QUAD
.ALIAS   EPIGRAPH_QUAD              _QUAD
.ALIAS   FOOTNOTE_QUAD              _QUAD
.ALIAS   HEAD_QUAD                  _QUAD
.ALIAS   SUBHEAD_QUAD               _QUAD
.ALIAS   TOC_HEADER_QUAD            _QUAD
\#
\# Support aliases
\#
.ALIAS   COL_BREAK             COL_NEXT
.ALIAS   DOC_COVER_ADVANCE     COVER_ADVANCE 
.ALIAS   DOC_COVER             COVER
.ALIAS   DOC_COVERS            COVERS
.ALIAS   DOC_COVER_LEAD        COVER_LEAD
.ALIAS   DOC_COVERTITLE        COVERTITLE
.ALIAS   DO_DOC_COVER          DO_COVER
.ALIAS   PRINT_FOOTNOTE_RULE   FOOTNOTE_RULE
\#
\# Miscellaneous aliases
.ALIAS  SECTION       LINEBREAK
.ALIAS  SECTION_CHAR  LINEBREAK_CHAR
\#
\# Miscellaneous macros to take care of backward compatibility
\# -----------------------------------------------------------
\#
\# As of 1.1.9, EL and TN got changed to make TRAP...TRAP OFF
\# unnecessary for users.  However, I used both macros extensively
\# throughout this file (in conjunction with TRAP...TRAP OFF).
\# EOL is the "old" EL, for the personal use of om.tmac
\#
.MAC EOL END
.    br
.    sp -1v
.END
\#
\# REFER SUPPORT
\# -------------
\#
\# Footnote references
\# -------------------
\# *Function:
\#   Instruct REF to put references in footnotes.
\#
.MAC FOOTNOTE_REFS END
.    if r#EN_REF \{ .rr #EN_REF \}
.    nr #FN_REF 1
.END
\#
\# Endnote references
\# ------------------
\# *Function:
\#   Instruct REF to collect references for endnotes output.
\#
.MAC ENDNOTE_REFS END
.    if r#FN_REF \{ .rr #FN_REF \}
.    nr #EN_REF 1
.END
\#
\# Prepare mom for a reference
\# ---------------------------
\# *Argument:
\#   <none> | INDENT  L|LEFT|R|RIGHT|B|BOTH  <indent value>
\# *Function:
\#   Calls FOOTNOTE or ENDNOTE, depending on whether #REF_FN or
\#   #REF_EN is set to 1.
\# *Notes:
\#   For convenience, REF is a toggle.
\#
\#   REF optionally takes the same arguments as FOOTNOTE, allowing
\#   users to indent references that go in footnotes when footnote
\#   indenting is required.  FOOTNOTE_REFS must be on for this.
\#
.MAC REF END
.    ie \\n[#FN_REF]+\\n[#EN_REF]=0 \{\
.       if !\\n[#REF_WARNING]=1 \{\
.          tm1 "[mom]: Before REF at line \\n(.c, neither FOOTNOTE_REFS nor ENDNOTE_REFS
.          tm1 "       has been selected.  If "sort" and "accumulate" are in your refer
.          tm1 "       commands, references will be collected for later output with $LIST$.
.          tm1 "       Otherwise, they will disappear.
.          nr #REF_WARNING 1
.       \}
.    \}
.    el \{\
.    ie \\n[#REF]=1 \{\
.       if \\n[#FN_REF]=1 \{ .FOOTNOTE OFF \}
.       if \\n[#EN_REF]=1 \{ .ENDNOTE OFF  \}
.       rr #REF
.    \}
.    el \{\
.       rr #REF_WARNING
.       nr #REF 1
.       if \\n[#FN_REF]=1 \{ .FOOTNOTE \\$1 \\$2 \\$3 \}
.       if \\n[#EN_REF]=1 \{ .ENDNOTE  \}
.    \}
.    \}
.END
\#
\# Embedded references in text (with brackets)
\# -------------------------------------------
\#
.MAC REF_BRACKETS_START END
.    ds $CURRENT_EV \\n[.ev]
.    ev REFERENCE
.    evc  \\*[$CURRENT_EV]
.    di REFERENCE
.END
\#
.MAC REF_BRACKETS_END END
.    br
.    di
.    ev
.    chop REFERENCE
.    unformat REFERENCE
.    if '\\$0'REF)' \{ .nop (\\*[REFERENCE]) \}
.    if '\\$0'REF]' \{ .nop [\\*[REFERENCE]] \}
.    if '\\$0'REF}' \{ .nop {\\*[REFERENCE]} \}
.END
\#
\# These three pairs of aliases allow users to embed references in
\# text and have them surrounded by (), [] or {}.
\#
.ALIAS REF( REF_BRACKETS_START
.ALIAS REF) REF_BRACKETS_END
\#
.ALIAS REF[ REF_BRACKETS_START
.ALIAS REF{ REF_BRACKETS_START
\#
.ALIAS REF} REF_BRACKETS_END
.ALIAS REF] REF_BRACKETS_END
\#
\# Second-line indent for refs
\# ---------------------------
\# *Argument:
\#   FOOTNOTE | ENDNOTE | BIBLIO <indent for 2nd and subsequent lines of discrete reference entries>
\# *Function:
\#   Sets strings $REF_FN_INDENT, $REF_EN_INDENT or $REF_BIB_INDENT.
\# *Notes:
\#   Indent value requires a unit of measure.
\#
.MAC INDENT_REFS END
.    if '\\$1'FOOTNOTE' .ds $REF_FN_INDENT \\$2
.    if '\\$1'ENDNOTE'  .ds $REF_EN_INDENT \\$2
.    if '\\$1'BIBLIO'   .ds $REF_BIB_INDENT \\$2
.END
\#
\# Hyphenation of references
\# -------------------------
\# *Argument:
\#   <none> | <anything>
\# *Function:
\#   Sets register #REF_HYPHENATE
\#
.MAC HYPHENATE_REFS END
.    ie '\\$1'' \{ .nr #REF_HYPHENATE 1 \}
.    el \{\
.       if r#REF_HY \{ .rr #REF_HY \}
.    \}
.END
\#
.ig
The remainder of the definitions in this section are modified
versions of the definitions found in the refer module of s.tmac.
..
\#
\# This one is directly from s.tmac.
.de @error
.tm \\n(.F:\\n(.c: macro error: \\$*
..
\#
.ig
The following strings define the order of entries for different
types of references.  Each letter in the string refers to a database
field (A for author, T1/T2 for article and book titles, etc).
Mom is set up for MLA-style bibliographies.  Other styles can be
implemented here by re-ordering the fields.
..
\# Book - type 2
.ds ref*spec!2 Q A T1 d t l r E S e V a C I D P O
\# Article within book - type 3
.ds ref*spec!3 Q A T2 B d t l r E S e V a C I D P O
\# Journal article - type 1
.ds ref*spec!1 Q A T2 J S N D P O
\# Tech report - type 4
.ds ref*spec!4 Q A T1 R G C I D P O
\# Internet site - type 0
.ds ref*spec!0 Q A T2 s E c d o a u O
\#
\# Refer's "1st" macro.  Since it is possible to define database
\# fields using any single letter, we remove all possible string
\# definitions of the form [X and [x
\#
.de ]-
.rm [A [B [C [D [E [F [G [H [I [J [K [L [M \
    [N [O [P [Q [R [S [T [U [V [W [X [Y [Z \
.   [a [b [c [d [e [f [g [h [i [j [k [l [m \
    [n [o [p [q [r [s [t [u [v [w [x [y [z
.rm ref*string
.rr ref*type
..
\#
\# Refer's "2nd" macro; builds up a reference with ref*build, and
\# prints it with ref*print.
\#
.de ][
.nr ref*type \\$1
.if \\n[ref*type]=3 \{\
.   if !'\\*([R'' \{\
.      nr ref*type 4
.      ds ref*spec!4 Q A T2 B R C I D P O
.   \}
.   if !'\\*([G'' \{\
.      nr ref*type 4
.      ds ref*spec!4 Q A T2 B G C I D P O
.   \}
.\}
.if r [T \{\
.   als [T1 [T
.   als [T2 [T
.\}
.ie d ref*spec!\\n[ref*type] .ref*build \\*[ref*spec!\\n[ref*type]]
.el \{\
.   @error unknown reference type `\\n[ref*type]'
.   ref*build \\*[ref*spec!0]
.\}
.if !\\n[.hy]=0 \{\
.nr #RESTORE_HY \\n[.hy]
.if !r#REF_HY .nh
.\}
.ref*print
.if !\\n[#RESTORE_HY]=0 .hy \\n[#RESTORE_HY]
.rr #RESTORE_HY
.rm ref*string
.rm [F [T1 [T2
..
\#
\# Refer's "3rd" macros, which set up and terminate the output
\# of collected references
\#
.de ]<
.als ref*print ref*end-print
.nr #REF 1
.if \\n[#BIB_LIST]=1 \{\
.   nr #IN_BIB_LIST 1
.   LIST DIGIT \\*[$BIB_LIST_SEPARATOR] \\*[$BIB_LIST_PREFIX]
.\}
..
\#
.de ]>
.LIST OFF
.rr #REF
.rr #IN_BIB_LIST
.als ref*print ref*normal-print
..
\#
\# Output
\# ------
\#
\# Output normal, non-collected refs
\#
.de ref*normal-print
.nr #CURRENT_HY \\n[.hy]
\\*[ref*string]
..
\#
\# Output collected refs
\#
.de ref*end-print
.\" 10 is abritrary
.nn 10
.ie \\n[#BIB_LIST]=0 \{\
.in +\\*[$REF_BIB_INDENT]
.ti -\\*[$REF_BIB_INDENT]
.\}
.el .ITEM
\\*[ref*string]
.sp \\n[#BIB_SPACE]u
.ie \\n[#BIB_LIST]=0 .in
.el .IL -\\*[$REF_BIB_INDENT]u
.nn 0
..
\#
.als ref*print ref*normal-print
\#
\# Build up the ref*string
\#
.ig
Correct MLA "typewritten" style (printstyle TYPEWRITE) demands
two spaces after each period.  The spaces are hardwired into the
string definitions (ref*add-<x>), so we have to make sure that there
aren't two spaces when the printstyle is TYPESET.  Since I find that
references look a bit crowded with 0 sentence space, I've bumped it
up to +4.  User's sentence spacing is reset in FOOTNOTES and ENDNOTES.
..
\#
.de ref*build
.if \\n[#PRINT_STYLE]=2 \{\
.   ds $RESTORE_SS_VAR \\*[$SS_VAR]
.   SS +4
.\}
.rm ref*string ref*post-punct
.nr ref*suppress-period 1
.while \\n[.$] \{\
.   if d [\\$1 \{\
.      ie d ref*add-\\$1 .ref*add-\\$1
.      el .ref*add-dflt \\$1
.   \}
.   shift
.\}
.\" now add a final period
.ie d ref*string \{\
.   if !\\n[ref*suppress-period] .as ref*string .
.   if d ref*post-punct \{\
.      as ref*string "\\*[ref*post-punct]
.      rm ref*post-punct
.   \}
.\}
.el .ds ref*string
..
\#
\# The following macros determine how entries are formatted WRT
\# punctuation, type style, additional strings, etc.
\#
.ig
o First argument is the database field letter.
o Second argument is the punctuation character to use to separate this
  field from the previous field.
o Third argument is a string with which to prefix this field.
o Fourth argument is a string with which to postfix this field.
o Fifth argument is a string to add after the punctuation character
  supplied by the next field.
..
\#
\# %A Author(s)
.de ref*add-A
.ref*field A ,
.if r [A .nr ref*suppress-period \\n([A
..
\# %T Title (generic)
.de ref*add-T1
.ref*field T . " \E*[IT]" "" \E*[PREV]
.if \\n([T .nr ref*suppress-period \\n([T
..
\# %T Title of a chapter or article
.de ref*add-T2
.ref*field T . " \(lq" "" "\(rq"
.if \\n([T .nr ref*suppress-period \\n([T
..
\# %B Book title (when citing an article from a book)
.de ref*add-B
.ie \\n([T .ref*field B "" ".\E*[IT]" "" \E*[PREV]
.el .ref*field B . " \E*[IT]" "" \E*[PREV]
\# refer doesn't set reg [T to 1 for these book titles, so we do it here
.ds eval*[B \\*([B
.substring eval*[B -1
.rr [T
.if '\\*[eval*[B]'!' .nr [T 1
.if '\\*[eval*[B]'?' .nr [T 1
.rm eval*[B
..
\# %R Report number for technical reports
.de ref*add-R
.ref*field R . " "
..
\# %J Journal name
.de ref*add-J
.ie \\n([T .ref*field J "" " \E*[IT]" "" \E*[PREV]
.el .ref*field J . " \E*[IT]" "" \E*[PREV]
..
\# %E Editor(s)
.de ref*add-E
.ie !\\n[ref*type]=0 \{\
.   ie \\n([E>0 \{\
.      ie \\n([T .ref*field E "" " Eds. "
.      el .ref*field E . " Eds. "
.   \}
.   el \{\
.      ie \\n([T .ref*field E "" " Ed. "
.      el .ref*field E . " Ed. "
.   \}
.\}
.el \{\
.   ie \\n([T .ref*field E "" " "
.   el .ref*field E . " "
.\}
.rr [T
..
\# %e Edition
.de ref*add-e
.ie \\n([T .ref*field e "" " " " edition"
.el .ref*field e . " " " edition"
.rr [T
..
\# %V Volume (of a journal, or series of books)
.de ref*add-V
.if \\n[ref*type]=1 \{\
.   ref*field V 
.\}
.if \\n[ref*type]=2 \{\
.   ie \\n([T .ref*field V "" " "
.   el .ref*field V . " "
.\}
.if \\n[ref*type]=3 \{\
.   ie \\n([T .ref*field V "" " "
.   el .ref*field V . " "
.\}
.rr [T
..
\# %N Journal number
.de ref*add-N
.ref*field N 
..
\# %S Series (books or journals)
.de ref*add-S
.if \\n[ref*type]=1 \{\
.   ref*field S
.\}
.if \\n[ref*type]=2 \{\
.   ie \\n([T .ref*field S "" " "
.   el .ref*field S . " "
.\}
.if \\n[ref*type]=3 \{\
.   ie \\n([T .ref*field S "" " "
.   el .ref*field S . " "
.\}
.rr [T
\# refer doesn't set reg [T to 1 for series titles, so we do it here
.ds eval*[S \\*([S
.substring eval*[S -1
.if '\\*[eval*[S]'!' .nr [T 1
.if '\\*[eval*[S]'?' .nr [T 1
.rm eval*[S
..
\# %C City
.de ref*add-C
.ie \\n([T .ref*field C "" " "
.el .ref*field C . " "
.rr [T
..
\# %I Publisher (I stands for Issuer)
.de ref*add-I
.ie !'\\*([C'' .ref*field I :
.el \{\
.   ie \\n([T .ref*field I "" " "
.   el .ref*field I . " "
.\}
.rr [T
..
\# %D Date of publication
.de ref*add-D
.if \\n[ref*type]=1 \{\
.   ie !'\\*([V''.ref*field D "" "(" ")"
.   el .ref*field D
.\}
.if \\n[ref*type]=2 .ref*field D ,
.if \\n[ref*type]=3 \{\
.   ie '\\*([C'' \{\
.      ie '\\*([I'' .ref*field D . " "
.      el .ref*field D ,
.   \}
.   el .ref*field D ,
.\}
.if \\n[ref*type]=4 .ref*field D ,
..
\# %P Page number(s)
.de ref*add-P
.ie \\n[ref*type]=1 .ref*field P : 
.el .ref*field P . " "
..
\# %G Gov't. ordering number
.de ref*add-G
.ref*field G . " "
..
\# %O Other (usually goes at end of ref)
.de ref*add-O
.ref*field O . " "
.ie r [O .nr ref*suppress-period \\n([O
.el .nr ref*suppress-period 1
..
\#
.de ref*add-dflt
.ref*field \\$1 ,
..
\#
\# Book reprints
\# -------------
\# %d date of publication (the orignal date of publication)
.de ref*add-d
.ie \\n([T .ref*field d "" " "
.el .ref*field d . " "
.rr [T
..
\# %a additions (such as a new intro to reprints)
.de ref*add-a
.ie \\n([T .ref*field a "" " "
.el .ref*field a . " "
.rr [T
..
\# %t title, if different from original title (the T field, which s/b
\# the original title)
.de ref*add-t
.ie \\n([T .ref*field t "" " Rpt. as \E*[IT]" "" \E*[PREV]
.el .ref*field t . " Rpt. as \E*[IT]" "" \E*[PREV]
.rr [T
..
\#
\# Translated works
\# ----------------
\# %l Trans(l)ator
.de ref*add-l
.ie \\n([T .ref*field l "" " Trans. "
.el .ref*field l . " Trans. "
.rr [T
..
\# %r Translato(r) and edito(r)
.de ref*add-r
.ie \\n([T .ref*field r "" " Trans. and Ed. "
.el .ref*field r . " Trans. and Ed. " 
.rr [T
..
\#
\# Internet
\# --------
\# %s Site name
.de ref*add-s
.ie \\n([s .ref*field s "" ".\E*[IT]" "" \E*[PREV]
.el .ref*field s . " \E*[IT]" "" \E*[PREV]
.\" refer doesn't set reg [T to 1 for these book titles, so we do it here
.ds eval*[s \\*([s
.substring eval*[s -1
.rr [T
.if '\\*[eval*[s]'!' .nr [T 1
.if '\\*[eval*[s]'?' .nr [T 1
.rm eval*[s
..
\# %c content of site, if unclear (i.e. advertisement, cartoon,
\# interview, etc.)
.de ref*add-c
.ie \\n([T .ref*field c "" " "
.el .ref*field c . " "
.rr [T
..
\# %o organization, group or sponsor of site
.de ref*add-o
.ie \\n([T .ref*field o "" " "
.el .ref*field o . " "
.rr [T
..
\# %a access date, i.e. the date you read it
.de ref*add-a
.ie \\n([T .ref*field a "" " "
.el .ref*field a . " "
.rr [T
..
\# %u URL
.de ref*add-u
.ref*field u "" " <" ">"
.rr [T
..
\#
\# Build up reference string from ref*add-<x> macros.
\#
.de ref*field
.if d ref*string \{\
.   ie d ref*post-punct \{\
.      as ref*string "\\$2\\*[ref*post-punct] \"
.      rm ref*post-punct
.   \}
.   el .as ref*string "\\$2 \"
.\}
.as ref*string "\\$3\\*([\\$1\\$4
.if \\n[.$]>4 .ds ref*post-punct "\\$5
.nr ref*suppress-period 0
..
\#
\# MARGIN NOTES
\# ------------
\# This is a wrapper for MNinit.
\#
\# I could use a 'while' loop to assign args to strings, but too many
\# 'while' loops are slowing things down.
\#
.MAC MN_INIT END
.    if !'\\$1'rerun' \{\
.    ds $MN-arg1 \\$1
.    ds $MN-arg2 \\$2
.    ds $MN-arg3 \\$3
.    ds $MN-arg4 \\$4
.    ds $MN-arg5 \\$5
.    ds $MN-arg6 \\$6
.    ds $MN-arg7 \\$7
.    ds $MN-arg8 \\$8
.    ds $MN-arg9 \\$9
.    \}
.    ie \\n[#START_FOR_MNinit]=0 \{\
.       nr #MNinit_DEFERRED 1
.       nr #START_FOR_MNinit 1
.       return
.    \}
.    el \{\
.       MNinit \\*[$MN-arg1] \\*[$MN-arg2] \\*[$MN-arg3] \\*[$MN-arg4] \\*[$MN-arg5] \\*[$MN-arg6] \\*[$MN-arg7] \\*[$MN-arg8] \\*[$MN-arg9]
.    \}
.END
\#
.MAC MN_OVERFLOW_TRAP END
.    if \\n[#OVERFLOW_LEFT]=1  \{\
.       nr #no-repeat-MN-left 1
.       di MN_OVERFLOW_LEFT
.    \}
.    if \\n[#OVERFLOW_RIGHT]=1 \{\
.       nr #no-repeat-MN-right 1
.       di MN_OVERFLOW_RIGHT
.    \}
.    rr #OVERFLOW_LEFT
.    rr #OVERFLOW_RIGHT
.END
\#
.ig
The remainder of the margin notes macros and routines are adapted
from Werner Lemberg's MN.tmac.
..
\#
\# MNinit
\# ------
\# Usage:
\# MNinit [ragged|symmetric] \
\#        left-width right-width separation \
\#        font fontsize vertical-spacing \
\#        color hyphenation-flags
\#
\# Initialize margin notes.  Empty arguments (denoted with "") set
\# default values.  If the first argument is the string `ragged',
\# left and right margin notes are printed ragged-right.  If it is
\# `symmetric', left margin notes are printed ragged-left and right
\# margin notes ragged-right.  If omitted, margin notes are left
\# and right adjusted.
\#
\#
.de MNinit
.  nr #MNinit 1
.  ds MN-left-ad b\"
.  ds MN-right-ad b\"
.  if '\\$1'RAGGED' \{\
.    ds MN-left-ad l\"
.    ds MN-right-ad l\"
.    shift
.  \}
.  if '\\$1'SYMMETRIC' \{\
.    ds MN-left-ad r\"
.    ds MN-right-ad l\"
.    shift
.  \}
.  ie \B'\\$3' \
.    nr MN-sep (n;\\$3)
.  el \
.    nr MN-sep 1m
.  if ((\\n[.o] - \\n[MN-sep]) < 1n) \
.    ab MN: Left margin too small (<1n) for requested margin notes separation.
.  ie \B'\\$1' \{\
.    nr MN-left-width (n;\\$1)
.    nr MN-left-start (\\n[.o] - \\n[MN-sep] - \\n[MN-left-width])
.  \}
.  el \{\
.    nr MN-left-width (\\n[.o] - \\n[MN-sep])
.    nr MN-left-start 0
.  \}
.  if (\\n[MN-left-start] < 0) \
.    ab MN: Left margin too small for requested margin notes settings.
.  if (\\n[MN-left-width] < 1n) \
.    ab MN: Left margin notes width too small (<1n).
.
.  ie \B'\\$2' \{\
.    nr MN-right-width (n;\\$2)
.    nr MN-right-start (\\n[.o] + \\n[.l] + \\n[MN-sep])
.    if \\n[#COLUMNS]=1 \{\
.      if !\\n[#NUM_COLS]=1 \{\
.        nr MN-right-start (\\n[#COL_2_L_MARGIN] + \\n[#COL_L_LENGTH] + \\n[MN-sep])
.      \}
.    \}
.  \}
.  el \{\
.    nr MN-right-width \\n[MN-left-width]
.    nr MN-right-start (\\n[.o] + \\n[.l] + \\n[MN-sep])
.    if \\n[#COLUMNS]=1 \{\
.      if !\\n[#NUM_COLS]=1 \{\
.        nr MN-right-start (\\n[#COL_2_L_MARGIN] + \\n[#COL_L_LENGTH] + \\n[MN-sep])
.      \}
.    \}
.  \}
.  ie \A'\\$4' \{\
.    ds MN-font \\$4\"
.    if \\n[#PRINT_STYLE]=1 .ds MN-font CR
.  \}
.  el \{\
.    ds MN-font \\*[$PP_FT]
.    if \\n[#PRINT_STYLE]=1 .ds MN-font CR
.  \}
.  ie \B'\\$5' \{\
.    ps \\$5
.    nr MN-size \\n[.ps]
.    ps
.    if \\n[#PRINT_STYLE]=1 \{\
.       ps 12
.       nr MN-size \\n[.ps]
.       ps
.    \}
.  \}
.  el \{\
.    nr MN-size \\n[#DOC_PT_SIZE]
.  \}
.  ie \B'\\$6' \{\
'    vs \\$6
.    nr MN-spacing \\n(.v
'    vs
.    if '\\$6'DOC' \{ .nr MN-spacing \\n[#DOC_LEAD] \}
.    if \\n[#PRINT_STYLE]=1 \{\
.       nr MN-spacing \\n[#DOC_LEAD]
.    \}
.  \}
.  el \{\
.    nr MN-spacing \\n[#DOC_LEAD]
.  \}
.  ie \A'\\$7' \
.    if !\\n[#PRINT_STYLE]=1 .ds MN-color \\$7\"
.  el \
.    if !\\n[#PRINT_STYLE]=1 .ds MN-color
.  ie \B'\\$8' \
.    nr MN-hy \\$8
.  el \
.    nr MN-hy \\n[.hy]
.  ev MNbottom-left-env
.  if \A'\\*[MN-font]' \
.    ft \\*[MN-font]
.  if \\n[MN-size] \
.    ps \\n[MN-size]u
.  if \\n[MN-spacing] \
.    vs \\n[MN-spacing]u
.  ll \\n[MN-left-width]u
.  ad \\*[MN-left-ad]
.  hy \\n[MN-hy]
'  in 0
.  nop \m[\\*[MN-color]]\c
.  ev
.  ev MNbottom-right-env
.  if \A'\\*[MN-font]' \
.    ft \\*[MN-font]
.  if \\n[MN-size] \
.    ps \\n[MN-size]u
.  if \\n[MN-spacing] \
.    vs \\n[MN-spacing]u
.  ll \\n[MN-right-width]u
.  ad \\*[MN-right-ad]
.  hy \\n[MN-hy]
'  in 0
.  nop \m[\\*[MN-color]]\c
.  ev
.  nr MN-active 0
..
\# MN
\# --
\# Usage:
\# 
\#   MN LEFT|RIGHT
\#   margin note text
\#   MN
\#
\# With a parameter, start a margin note, otherwise end a margin note.
\# If the parameter is the string `left', define a left margin note,
\# otherwise define a right margin note.
\#
.de MN
.ds MN-dir \\$1
.if \\n[#COLUMNS]=1 \{\
.  if \\n[#NUM_COLS]>2 \{\
.    tm MN: More than two columns.  Ignoring margin notes.
.    return
.  \}
.  if !\\n[#NUM_COLS]=1 \{\
.    ie \\n[#COL_NUM]=1 .ds MN-dir LEFT
.    el .ds MN-dir RIGHT
.  \}
.\}
.  if !\\n[#MNinit]=1 \{\
.    tm MN: You must set parameters with MN_INIT before using MN. 
.    ab Aborting
.  \}
.  ie !'\\$1'' \{\
.    if \\n[MN-active] \{\
.      tm MN: Can't handle nested margin notes.
.      return
.    \}
.    nr MN-active 1
.    ev MN-env
.    ie '\\*[MN-dir]'LEFT' \{\
.      nr MN-left +1
.      ds MN-curr l-\\n[MN-left]\"
.      evc MNbottom-left-env
.    \}
.    el \{\
.      nr MN-right +1
.      ds MN-curr r-\\n[MN-right]\"
.      evc MNbottom-right-env
.    \}
.    mk MN-mk-\\*[MN-curr]
.    di MN-div-\\*[MN-curr]
.  \}
.  el \{\
.    if \\n[MN-active] \{\
.      br
.      di
.      nr MN-div-\\*[MN-curr]-depth \\n(dn
.      ev
.    \}
.    nr MN-active 0
.  \}
..
\#
\# MNtop
\# -----
\# Resets these registers (called in HEADER)
.de MNtop
.  nr MN-left 0
.  nr MN-right 0
.  nr MN-active 0
..
\#
\# MNbottom-left
\# -------------
\# The "left" half of Werner's original MNbottom.
\#
.de MNbottom-left
.  nr MN-curr 0
.  nr MN-last-pos 0
.  nr MN-lead-adj \\n[#DOC_LEAD]-\\n[MN-spacing]
.  vpt 0
.  mk MN-curr-pos
.  if \\n[MN-active] \{\
.    di
.    tm MN: Margin note finished by new page.  Ignored.
.  \}
.  po \\n[MN-left-start]u
.  ev MNbottom-left-env
.  nr #P \\n%+\\n[#PAGE_NUM_ADJ]
.  while (\\n[MN-curr] < \\n[MN-left]) \{\
.    nr MN-curr +1
.    ie (\\n[MN-last-pos] < \\n[MN-mk-l-\\n[MN-curr]]) \
.      sp |\\n[MN-mk-l-\\n[MN-curr]]u+\\n[MN-lead-adj]u
.    el \{\
.      nr MN-shifted 1
.      sp 1v
.      SHIM
.      if \\n[#SHIM]u>\\n[MN-spacing] .sp -(1v+\\n[MN-lead-adj]u)
.      tm MN: Warning: Left margin note #\\n[MN-curr] on page \\n[#P] shifted down.
.    \}
.\" If last margin note doesn't fit
.    if ( (\\n(nl+\\n[MN-div-l-\\n[MN-curr]-depth]) > (\\n(.p+\\n[#VARIABLE_FOOTER_POS]) ) \{\
.      if \\n[MN-shifted]=1 \{\
.        sp -(1v+\\n[#SHIM]u)
.        rm MN-div-l-\\n[MN-curr]
.        tm1 "[mom]: No room to start left margin note #\\n[MN-curr] on page \\n[#P] on page \\n[#P].
.        tm1 "       Ignoring margin note.
.        rr MN-shifted
.      \}
.      nr #no-repeat-MN-left 1
.      nr #OVERFLOW_LEFT 1
.      wh \\n[.p]u+\\n[#VARIABLE_FOOTER_POS]u-1u MN_OVERFLOW_TRAP
.      vpt 1
.    \}
.    MN-div-l-\\n[MN-curr]
.    br
.    nr MN-last-pos \\n[nl]
.\}
.  ev
.  po
.  if !\\n[#no-repeat-MN-left]=1 \{\
.     if \\n[MN-right]=0 .vpt 1
.  \}
..
\#
\# MNbottom-right
\# --------------
\# The "right" half of Werner's original MNbottom.
\#
.de MNbottom-right
.  nr MN-curr 0
.  nr MN-last-pos 0
.  nr MN-lead-adj \\n[#DOC_LEAD]-\\n[MN-spacing]
.  vpt 0
.  po \\n[MN-right-start]u
.  ev MNbottom-right-env
.  nr #P \\n%+\\n[#PAGE_NUM_ADJ]
.  while (\\n[MN-curr] < \\n[MN-right]) \{\
.    nr MN-curr +1
.    ie (\\n[MN-last-pos] < \\n[MN-mk-r-\\n[MN-curr]]) \
.      sp |\\n[MN-mk-r-\\n[MN-curr]]u+\\n[MN-lead-adj]u
.    el \{\
.      nr MN-shifted 1
.      sp 1v
.      SHIM
.      tm MN: Warning: Right margin note #\\n[MN-curr] on page \\n[#P] shifted down.
.    \}
.\" If last margin note doesn't fit
.    if ( (\\n(nl+\\n[MN-div-r-\\n[MN-curr]-depth]) > (\\n(.p+\\n[#VARIABLE_FOOTER_POS]) ) \{\
.      if \\n[MN-shifted]=1 \{\
.        sp -(1v+\\n[#SHIM]u)
.        rm MN-div-r-\\n[MN-curr]
.        tm1 "[mom]: No room to start right margin note #\\n[MN-curr] on page \\n[#P] on page \\n[#P].
.        tm1 "       Ignoring margin note.
.        rr MN-shifted
.      \}
.      nr #no-repeat-MN-right 1
.      nr #OVERFLOW_RIGHT 1
.      wh \\n[.p]u+\\n[#VARIABLE_FOOTER_POS]u-1u MN_OVERFLOW_TRAP
.      vpt 1
.    \}
.    MN-div-r-\\n[MN-curr]
.    br
.    nr MN-last-pos \\n[nl]
.\}
.  ev
.  po
'  sp |\\n[MN-curr-pos]u
.  if !\\n[#no-repeat-MN-right]=1 .vpt 1
..