summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/edmac/edmac.doc
blob: 6327dbac6fc42850b0996cd26e6f4c2cd14bb8f3 (plain)
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
%  \iffalse     This is a METACOMMENT
%
%     Macro file `EDMAC' for use with Plain TeX.
%
%     Copyright (C) 1990-1996 John Lavagnino and Dominik Wujastyk.
%
%     This program 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 of the License, or
%     (at your option) any later version.
%
%     This program 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 this program; if not, write to the Free Software
%     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%
%     John Lavagnino and Dominik Wujastyk may be contacted at the email
%     and paper mail addresses given later in this file, after the
%     string "\author".
% \fi
%
% \CheckSum{3106}
{\catcode`\$=9
\gdef\fileversion{ $Revision:   3.17  $ }
\gdef\filedate{ $Date:   12 Jun 1996 17:15:00  $ }}
\def\docdate{12 June 1996}
% \hyphenation{man-u-script man-u-scripts}
%
%% \CharacterTable
%%  {Upper-case    \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
%%   Lower-case    \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
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
%
% \title{Critical Edition Typesetting\\ The {\tt EDMAC} format for
% P{\small LAIN}\,\TeX\thanks{This file is\fileversion\unskip,
% \filedate\unskip.}}
%
% \author{John Lavagnino\thanks{%
% Women Writers Project,
% Brown University,
% Box 1841,
% Providence, RI 02912, USA.
% Internet: {\tt John\_Lavagnino@brown.edu}.}
% \and Dominik Wujastyk\thanks{%
% Wellcome Institute for the History of Medicine,
% 183 Euston Road,
% London NW1 2BE, UK.
% Internet: {\tt D.Wujastyk@ucl.ac.uk}.}}
% \date{}
% \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty}
% \DoNotIndex{\@flushglue,\@input}
% \DoNotIndex{\@makefnmark,\@makeother,\@maketitle}
% \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa}
% \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue}
% \DoNotIndex{\@thanks,\@thefnmark,\@topnum}
% \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin}
% \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces}
% \DoNotIndex{\|,\~,\ ,\active,\advance,\aftergroup,\begingroup,\bgroup}
% \DoNotIndex{\mathcal,\csname,\def,\documentstyle,\dospecials,\edef}
% \DoNotIndex{\egroup}
% \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist}
% \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global}
% \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn}
% \DoNotIndex{\ifcase}
% \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item}
% \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower}
% \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing}
% \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc}
% \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut}
% \DoNotIndex{\strutbox}
% \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt}
% \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@}
% \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim}
% \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary}
% \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle}
% \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode}
% \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip}
% \DoNotIndex{\nopagebreak}
% \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle}
% \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb}
% \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar}
% \DoNotIndex{\[,\{,\},\]}
% \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode}
% \DoNotIndex{\baselineskip,\begin,\tw@}
% \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q}
% \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H}
% \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z}
% \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0}
% \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_}
% \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother}
% \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment}
% \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined}
% \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc}
% \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar}
% \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode}
% \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting}
% \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf}
% \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse}
% \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault}
% \DoNotIndex{\bfdefault}
%
%  \iffalse     This is a METACOMMENT
%           Everything up to the next `\ fi' (without a blank) will
%           be ignored. This is necessary because `%' may no longer
%           be a comment mark when this file is read in.
%
%  HISTORY:
%
% $Log:   D:/EDMAC/VCS/EDMAC.DOV  $
% 
%    Rev 3.17   12 Jun 1996 17:15:00
% o  changed JL's and TUG's addresses;
% o  updated publication details of works produced with EDMAC;
% o  tidied up a bad cross-reference, etc.
% o  added several ftp and http references
% o  added the GNU license; moved (C) statement to top of file;
%    made the banner displayed when EDMAC is run conform to the GPL.
% o  added reference to CET.
% 
%    Rev 3.16   19 Jul 1994 11:17:04
% o  corrected space bug in \getref@num (thanks to Bernt Karasch);
%    changed documentation of how to use NFSS to point to an external
%    description ed-nfss.tex.
% 
%    Rev 3.15   13 May 1994 18:03:44
% o  added more comment to \morenoexpands;
% o  added example of \printlines after Sanskrit example;
% o  added more info on editions being done with EDMAC;
% o  minor tidying.
% 
%    Rev 3.14   11 May 1994 15:03:04
% o  removed a spurious space from \@lab; corrected a typo in docs.
% 
%    Rev 3.13   11 May 1994 14:01:28
% o   defined \list@clear and \list@create separately;
% o   swapped the subsections on fonts back, so NFSS is described first;
% o   rephrased all sentences with the word "default" to avoid its use.
% 
%    Rev 3.12   11 May 1994 12:03:10
% o  capitalized the footnote and endnote series letters: a-e > A-E.
% 
%    Rev 3.11   10 May 1994 15:19:54
% o  removed the optional braces from the second argument of \text
%    in the examples, and altered the documentation to match.
% 
%    Rev 3.10   10 May 1994 14:31:30
% o  changes to documentation;
% o  made \list@create same as \list@clear;
% o  added \f@encoding and \fontencoding;
% o  corrected \getref@num and \label@parse;
% o  brought the appendix examples more up to date and checked them;
% o  added more cross-references;
% o  added \selectfont to the end of NFSS-\select@@lemmafont.
%
%    Rev 3.9   03 May 1994 11:42:36
% o  Full incorporation of edmacfss.doc. Appropriate changes in
%    documentation. New \morenoexpands macro. New \list@create
%    and \list@clear in anticipation of faster list handling.
%    Numerous running changes.
% 
%    Rev 3.8   14 Apr 1994 12:02:22
% o  revised the cross-referencing macros, which weren't working.
%
%    Rev 3.7   31 Aug 1993 15:57:20
% o  Further changes in response to reviewer's observations. Correct
%    explanation of recursion problem with (some) aliases for \text.
%    Changed several more {\tt ...} strings to "..."; added some
%    \mbox{}s for italic in mathmode (wanted by NFSS2).
%
%    Rev 3.6   27 Aug 1993 16:50:42
% o  made changes as recommended in the TUG publication reviewer's report.
%    Mostly changes to docs; added \edmac@warning.
% o  Added a paragraph to Known Bugs highlighting problem of line breaking
%    in paragraphed footnotes.
%
%    Rev 3.5   23 Mar 1993 15:03:34
% o  added the corrections spotted by Gyula Mayer: some word duplications
%    and important changes to slhh.tex to make it compatible with the
%    current level of edmac.
%
%    Rev 3.4   12 Mar 1993 13:47:32
% o  added appendix material: inclusion of EDMACFSS.DOC and
%    example page of Arabic from Klaus Lagally.
% o  cosmetic changes to some \index entries, and removal of
%    some unnecessary \Make/DeleteShortVerb statements.
%
%    Rev 3.3   11 Mar 1993 12:56:34
% o  John's formatting revisions:
%    Fold long code lines so they don't overrun the measure.
%    Subsubsections changed to paragraphs.
%
%    Rev 3.2   26 Feb 1993 17:55:12
% o  correction to def'n of \@adv: spotted by Klaus Lagally.
%
%    Rev 3.1   25 Feb 1993 15:15:00
% o  small changes to documentation.
%
%    Rev 3.1   25 Feb 1993 12:17:12
% o  small changes to documentation.
%
%    Rev 3.0   25 Jun 1992 12:38:00
%    No change.
%
%    Rev 2.25   25 Jun 1992 12:29:20
% o  cosmetic changes to examples and \ipn@skip use.
%
%    Rev 2.24   22 Jun 1992 13:33:12
% o  cosmetic corrections.
%
%    Rev 2.23   22 Jun 1992 11:22:52
% o  changed \interparanoteglue to calculate its value once and
%    stick it into a skip register, instead of evaluating afresh
%    in each footnote.
%
%    Rev 2.22   19 Jun 1992 23:25:42
% o  added refreshed versions of arden.sty and features.tex; upgraded
%    the fonts section to a \subsection.
%
%    Rev 2.21   19 Jun 1992 21:07:46
% o  numerous small changes by JL; \ifnumbering@ now becomes
%    \ifnumbering since users may want access to it.
%
%    Rev 2.20   29 May 1992 13:04:26
% o  correction to ballast.
% o  brought "New to TeX?" section back into the document by default.
%
%    Rev 2.19   26 May 1992 16:14:34
% o  tidied up the \rightskip and \leftskip code in the footstart
%    and vfootnote macros for the different kinds of notes, and
%    documented it (these skips are now zeroed in the vfootnote
%    code, not in footfmt);  small corrections to docs.
%
%    Rev 2.18   22 May 1992 17:35:02
% o  further revisions to the paragraph footnote code and documentation;
%    inserted the \ballast macros.
%
%    Rev 2.17   18 May 1992 13:32:04
% o  more changes to the para-footnote code.  Added @ to para@footgroup
%    and para@vfootnote, since I would not expect these to be easily
%    modified; managed to get para@footgroup back to pre-2.16 code,
%    i.e., as in TeXbook, with just an added \unpenalty; changed
%    \parafootfmt's parfillskip to put proper \interparanoteglue glue
%    between notes; used Michael Downes's \unvxh in para@vfootnote.
%
%    Rev 2.16   08 May 1992 21:12:12
% o  applied several suggestions based on Wayne Sullivan's change
%    file of 27 April 1992.  These included changing \normal@pars
%    to include resetting leftskip and rightskip to zero, and
%    setting \parfillskip to normal; changed \paravfootnote
%    to put the paragraphed footnotes into a \vbox rather
%    than an \hbox (reasons explained in the documentation);
%    changed \parafootgroup quite substantially in order to get
%    the para notes properly unboxed; cosmetic changes to
%    \@add and \everypar; added the macro \edfont@info to make
%    things simpler in edmacfss.doc;
% o  began to write in the \ballast macros.
%
%    Rev 2.15   16 Apr 1992 17:16:52
% o  corrected minor spelling errors
%
%    Rev 2.14   09 Dec 1991 16:56:46
% o  revision of \splitoff to get column vspacing right.
% o  more tidying of documentation and examples.
%
%    Rev 2.13   05 Dec 1991 15:24:48
% o  changed \off@autopar to \normal@pars; changed \verb"xxx" to
%    just "xxx" globally, and put \MakeShortVerb{"} into the
%    driver file, edmacdoc.tex (this change requires the newdoc.sty
%    file, which supplements the doc.sty file);  stripped out the
%    examples in the appendix, and put in new ones, tailored to fit
%    the changes in edmac.doc (removal of verbose definitions of
%    \eightpoint, etc.); changed \two- and \threecolfootgroup to
%    reduce the amount of boxing and reboxing of the footnote insertions
%    done in the output routine (not wholly sure about this); added
%    the periph4.tex file in the appendix (don't know how it got left
%    out in previous versions); small changes to columnar footnote
%    macros, and generally to the documentation.
%
%    Rev 2.12   04 Dec 1991 17:13:22
% o  added Wayne Sullivan's new cross referencing macros.
%
%    Rev 2.11   03 Dec 1991 10:17:48
% o  have added \eightpoint, and \notefontsetup; more work on
%    documentation of fonts, mentioned edmacfss.doc; put calls to
%    \notefontsetup into footnote macros, so default is now to
%    small notes; took out the separate \twocol@foottopskip etc.
%    macros, and put \notefontsetup in the right place to govern
%    \ht\footstrut.
%
%    Rev 2.9   15 Nov 1991 17:46:06
% o  more macro name revisions; the bigee was \m@j -> \@l.  All
%    list macros are now called ...@list.  Modified \beginnumbering
%    to zero counters before reading the file, and took the zeroing
%    out of \readlinelist.  Then added \pausenumbering and
%    \resumenumbering.  More documentation.  Added \endashchar,
%    \fullstop, \rbracket, and put \rbracket after the lemma in all
%    footnote commands (a better default, I think).
%
%    Rev 2.8   12 Nov 1991 16:06:56
% o  major overhaul of macro names (w@rdw@rd -> word@word, etc.);
%    changed references to \count0 and \count255 (\count@) to
%    \@tempcntb and \@tempcnta;  Changed the bitwise stuff in
%    \printlines to be done with new scratch counters.
%
%    Rev 2.7   26 Aug 1991 18:06:10
% o  addition of line-number locking features.
% o  \global added to a few instances of \noteschanged@true.
% o  \@lnmoutstatus replaced by \first@lnmout@true and associated
%    macros.
%
%    Rev 2.6   25 Jul 1991 11:27:52
% o  inserted new arden.sty and arden.tex (1 May 1991)
% o  altered the \rigidbalance definition to do away with spaces
%    in the arguments.
% o  added the \twocol@splittopskip and \threecol@splittopskip
%    dimensions to correct the vertical alignment in columnar
%    footnotes (reported by Paul Wackers).
%
%    Rev 2.5   22 Apr 1991  9:11:40
% o  correction by W. Sullivan to addpenalties, avoiding use of \count0.
%
%    Rev 2.4   08 Feb 1991 16:43:16
% o  added a fix to \addpenalti@s provided by Wayne Sullivan
%
%    Rev 2.3   10 Jan 1991 20:47:34
% o  reduced the spacing around itemized lists.
%
%    Rev 2.2   11 Dec 1990 23:02:16
% o  added the "general features" and "Periphyseon" examples.
%
%    Rev 2.1   16 Oct 1990 15:35:42
% o  JL minor revisions to documentation, and editing of
%    the example files iocasta, gg, and arden.
%
%    Rev 2.0   03 Oct 1990 14:19:38
% No change.
%
%    Rev 1.26   03 Oct 1990 12:49:20
% o  Did away with \inputverbatim, and wrote the example files
%    into edmac.doc itself.  Added small amount of text to the Appendix.
%
%    Rev 1.24   25 Sep 1990 15:45:06
% o  made a new \parafootstart, moving the \rightskip etc. from
%    \parafootfmt.
%
%    Rev 1.23   25 Sep 1990 12:39:32
% o  Merged DW and JL changes; moved examples to \appendix; other
%    small changes to documentation.
%
%    Rev 1.21   19 Sep 1990 22:23:02
% o  DW changes to documentation; changed "n@" to "@num" when it
%    meant "number"; likewise rationalized and slightly shortened
%    other macros;  added parallel examples and picture of page.
%
%    Rev 1.20   14 Sep 1990 12:39:58
% o  JL near final revision of documentation.
%
%    Rev 1.18   22 Aug 1990 15:52:48
% o  revised crop mark code; small changes to documentation.
%
%    Rev 1.18   20 Aug 1990 16:39:38
% o  Revised crop mark code
%
%    Rev 1.17   20 Aug 1990 13:06:06
% o  Extensive changes in documentation.
% o  solved the \clubpenalty and \widowpenalty glitch
%
%    Rev 1.16   13 Aug 1990
% o  \ignorespaces in \text and associated macros, to skip over any
%    stray spaces within #2.
% o  Crop marks, \autopar.
% o  More sensible error messages.
%
%    Rev 1.15   03 Aug 1990 14:41:06
% o  Added two- and three- column footnotes.
% o  Corrected minor bugs in \parafootsetup and \parafootfmt.
%
%    Rev 1.14   01 Aug 1990 17:58:08
% o  Added \label, \pageref, \lineref and \sublineref cross-referencing
%    commands and documentation.  Small changes to documentation.
%
%    Rev 1.13   27 Jul 1990 10:46:30
% o  Major revision by JL. (for earlier history log, see rev. 1.12)
%
% \fi
%
% \maketitle
%
% \iffalse           % We're dropping the abstract for the book version.
% \begin{abstract}
% {\tt EDMAC} is a set of \PlainTeX\ macros providing the
% ability to format critical editions of texts in the traditional
% way, i.e., similar to the Oxford Classical Texts, Teubner, Arden
% Shakespeare and other series. The principal functions that are
% added are marginal line numbering and multiple series of
% footnotes and endnotes keyed to line numbers. While {\tt EDMAC}'s
% inner workings are necessarily esoteric, it seeks to provide
% relatively simple macros to enable you to control the exact
% format of the edition, taking into account the need to vary the
% format for different sorts of texts.
% \end{abstract}
% \fi
%
% ^^A \addtocontents{toc}{\protect\begin{multicols}{2}}
%
% {\parskip 0pt                ^^A We have to reset \parskip
%                              ^^A (bug in \LaTeX)
% \tableofcontents
% }
%
%
% \section{Introduction}
% \subsection{Overview}
%
% The "EDMAC" macros, together with \TeX, provide several
% important facilities for formatting critical editions of texts in
% a traditional manner. Major features include:
% \begin{itemize}\addtolength{\itemsep}{-1ex}
% \item automatic stepped line numbering, by page or by chapter;
% \item sub-lineation within the main series of line numbers;
% \item variant readings automatically keyed to line numbers;
% \item multiple series of footnotes and endnotes;
% \item block or columnar formatting of footnotes.
% \end{itemize}
%
% "EDMAC" allows the scholar engaged in preparing a critical
% edition to focus attention wholly on the task of creating the
% critical text and evaluating the variant readings, text-critical
% notes and testimonia. \TeX{} and "EDMAC" will take care of
% the formatting and visual correlation of all the disparate types
% of information.
%
% "EDMAC" works together with the \PlainTeX{} format, and with
% the exception of footnote-related commands, virtually all plain
% \TeX{} commands are available for use in the normal way. Other
% languages and fonts (Sanskrit, Greek, Russian,
% etc.),\footnote{See, e.g., {\em TUGboat\/} {\bf 9} (1988),
% pp.\,131--151.} can be incorporated.
%
% While "EDMAC" can be used ``out of the box'', with little or
% no customization, you may also go to the other extreme and view
% it as a collection of tools.  Critical editions are amongst the
% most idiosyncratic of books (like their authors), so we have made
% "EDMAC" deliberately bland in some ways, while also trying to
% document it reasonably well so that you can find out how to make
% it do what you want.
%
% This documentation assumes the ``manual'' use of "EDMAC". But
% "EDMAC" has also successfully been used (with \TeX, of
% course) as the formatting engine or ``back end'' for the output
% of an automatic manuscript collation program. "COLLATE" runs
% on the Apple Macintosh, can collate simultaneously up to a
% hundred manuscripts of any length, and provides facilities for
% the scholar to tailor the collation
% interactively.\footnote{"COLLATE" was created by Peter
% Robinson\protect\index{Robinson, Peter} at The Computers and
% Variant Texts Project, Oxford University Computing Service, 13 Banbury
% Road, Oxford OX2 6NN, England. Email: "peterr@vax.oxford.ac.uk".
% See "<URL http://www.shef.ac.uk/uni/projects/ctp/Main/collate.html>".}
%
% Another package which mediates between you as editor and the raw "EDMAC"
% codes is Bernt Karasch's ``Critical Edition Typesetter'' (CET).
% CET\label{CET}\index{Karasch, Bernt}
% provides a menu-driven front end for "EDMAC" and the other programs
% connected with \TeX.  CET does not do any collation: you still have to
% type the edition and the apparatus yourself.\footnote{For more details,
% see "<URL http://s.top.ruhr-uni-bochum.de/cet.htm>".}
%
% This book contains a general description of how to use "EDMAC"
% (in section~\ref{howto}); the complete source code for the package,
% with extensive documentation (in sections~\ref{overview}
% through \ref{end}); a series of examples (in
% Appendix~\ref{examples}); and an Index to the
% source code (in Appendix~B). We do not suggest that you need to
% read the source code for this package in order to use it; we
% provide this code primarily for reference, and many of our
% comments on it repeat material that is also found in
% section~\ref{howto}. But no documentation, however
% thorough, can cover every question that comes up, and many can be
% answered quickly by consultation of the code. On a first reading,
% then, you should skip from the general documentation of
% section~\ref{howto} to the examples in Appendix~\ref{examples},
% unless you are particularly interested in the innards of "EDMAC".
%
% \subsubsection{Availability}
%
% The "EDMAC" macros are available from CTAN, the Comprehensive \TeX\
% Archive Network.\footnote{See "<URL http://jasper.ora.com/ctan.html/>".}
% And "EDMAC" has it's own home page on the world wide web: see
% "<URL http://www.ucl.ac.uk/~ucgadkw/edmac.html>".
%
% \subsection{History}
%
% The original version of "EDMAC" was "TEXTED.TEX", written
% by John Lavagnino in late 1987 and early 1988 for formatting
% critical editions of English plays.
%
% John passed these macros on to Dominik Wujastyk who, in
% September--October 1988, added the footnote paragraphing mechanism,
% margin swapping and other changes to suit his own purposes, making the
% style more like that traditionally used for classical texts in Latin and
% Greek (e.g., the Oxford Classical Texts series). He also wrote some
% extra documentation and sent the files out to several people. This
% version of the macros was the first to be called "EDMAC".
%
% The present version was developed in the summer of 1990, with the
% intent of adding necessary features, streamlining and documenting
% the code, and further generalizing it to make it easily adaptable
% to the needs of editors in different disciplines.  John did most
% of the general reworking and documentation, with the financial
% assistance of the Division of the Humanities and Social Sciences,
% California Institute of Technology.  Dominik adapted the code to
% the conventions of Frank Mittelbach's\index{Mittelbach, Frank}
% "doc" option, and added some documentation, multiple-column
% footnotes, cross-references, and crop marks.\footnote{This version of
% the macros was used to format the Sanskrit text in volume I of {\em
% Metarules of P\=a\d ninian Grammar\/} by Dominik Wujastyk (Groningen:
% Forsten, 1993).} A description by John and Dominik of this version of
% "EDMAC" was published as ``An overview of "EDMAC": a \PlainTeX\
% format for critical editions'', {\em TUGboat\/} {\bf 11} (1990),
% pp.\,623--643.
%
% From 1991 through 1994, the macros continued
% to evolve, and were tested at a
% number of sites.  We are very grateful to all the members of the
% (now defunct)
% "edmac@mailbase.ac.uk" discussion group who helped us with
% smoothing out bugs and infelicities in the macros.
% Ron Whitney\index{Whitney, Ron} and our anonymous reviewer at
% the TUG were both of great help in ironing out last-minute
% wrinkles, while Ron made some important suggestions which may help
% to make future versions of "EDMAC" even more efficient.
% Wayne
% Sullivan,\index{Sullivan, Wayne} in particular, provided several
% important fixes and contributions, including adapting the
% Mittelbach\slash
% Sch\"opf\index{Sch\"opf, Rainer}\index{Mittelbach, Frank} ``New
% Font Selection Scheme'' for use with \PlainTeX\ and "EDMAC" (see
% p.\,\pageref{edmacnfss} below).  Another project Wayne has worked
% on is a "DVI" post-processor which works with an "EDMAC"
% that has been slightly modified to output "\special"s.  This
% combination enables you to recover to some extent the text of
% each line, as {\sc ascii} code, facilitating the creation of
% concordances, an {\em index verborum}, etc.
%
% At the time of writing, we are pleased to be able to say that "EDMAC"
% is used for real-life book production.  Several interesting
% editions have appeared in print or are underway, such as
% the Latin texts of Euclid's {\sl
% Elements},\footnote{Gerhard Brey\index{Brey, Gerhard} used "EDMAC" in
% the production of Hubert L. L. Busard\index{Busard, Hubert L. L.} and
% Menso Folkerts,\index{Folkerts, Menso} {\em Robert of Chester's
% (?)\index{Chester, Robert of} Redaction of Euclid's\index{Euclid} {\em
% Elements}, the so-called Adelard II\index{Adelard II} Version}, 2 vols.,
% (Basel, Boston, Berlin: Birkh\"auser, 1992).} an edition of the letters
% of Nicolaus Copernicus,\footnote{Being prepared at the German Copernicus
% Research Institute, Munich, under the general editorship of Heribert
% M. Nobis\index{Nobis, Heribert M.} and Menso Folkerts\index{Folkerts,
% Menso}; volume 1 has appeared as {\em Documenta Copernicana: Briefe
% (Texte und \"{U}bersetzungen)}, edited by Andreas
% K\"{u}hne\index{Kuehne, Andreas}, et al. (Berlin: Akademie Verlag,
% 1994).}\index{Copernicus, Nicolaus} Simon
% Bredon's\index{Bredon, Simon} {\em Arithmetica},\footnote{Being prepared
% by Menso Folkerts {\em et al.}, at the Institut f\"ur Geschichte der
% Naturwissenschaften in Munich.} a Latin translation by Plato of
% Tivoli\index{Plato of Tivoli} of an Arabic astrolabe
% text,\footnote{Richard Lorch,\index{Lorch, Richard} Gerhard
% Brey\index{Brey, Gerhard}, Stefan Kirschner\index{Kirschner, Stefan},
% and Christoph Sch\"{o}ner\index{Schoener, Christoph},
% `Ibn-a\d{s}-\d{S}aff\={a}rs Traktat \"{u}ber das Astrolab in der
% \"{U}bersetzung von Plato von Tivoli,' in {\em Cosmographica et
% Geographica}, ed.\ Bernhard Fritscher\index{Fritscher, Bernhard} and
% Gerhard Brey\index{Brey, Gerhard}, (M\"{u}nchen: Instit\"{u}t f\"ur
% Geschichte der Naturwissenschaften, 1994), vol.\,1, pp.\,125--180.} a
% Latin
% translation of part II of the Arabic {\em Algebra\/} by Ab\=u K\=amil
% Shuj\=a' b. Aslam,\index{Abu Kamil Shuja' b. Aslam}\footnote{Richard
% Lorch, `Ab\=u K\=amil on the Pentagon and Decagon' in {\em Vestigia
% Mathematica}, ed.\ M. Folkerts\index{Folkerts, Menso} and J. P.
% Hogendijk\index{Hogendijk, J. P.} (Amsterdam, Atlanta:
% Rodopi, 1993).} the Latin {\em Rithmachia\/} of Werinher von
% Tegernsee,\footnote{Menso Folkerts, `Die {\em Rithmachia\/} des Werinher
% von Tegernsee', ibid.} a middle-Dutch romance epic on the
% Crusades,\footnote{Geert H. M. Claassens,\index{Claassens, Geert H. M.}
% {\em De Middelnederlandse Kruisvaartromans}, (Amsterdam: Schiphower en
% Brinkman, 1993).}
% Johann Widmann's German arithmetic of 1489,\footnote{{\em Behend vnd
% h\"upsch Rechnung vff allen Kauffmanschafften}, being prepared at the
% University of Heidelberg by Barbara G\"artner\index{Gaertner, Barbara}.}
% a seventeenth-century Hungarian politico-philosophical
% tract,\footnote{Emil Hargittay, {\em Cs\'aky Istv\'an: Politica
% philosophiai Okoskod\'as-szerint val\'o rendes \'eletnek p\'eld\'aja
% (1664--1674)\/} (Budapest: Argumentum Kiad\'o, 1992).} an anonymous
% Latin compilation of Christian sermons from Hungary\footnote{{\em
% Sermones Compilati in Studio Gererali Quinqeecclesiensi in Regno
% Ungarie}, ed.\ Eduardo Petrovich\index{Petrovich, Eduardo} and Paulus
% Ladislaus Timkovics\index{Timkovics, Paulus Ladislaus} (Budapest:
% Akad\'emiai Kiad\'o, 1993), typeset, as was the previous book, by Gyula
% Mayer\index{Mayer, Gyula}.} the collected letters and papers of
% Leibniz,\index{Leibniz}\footnote{Leibniz, {\em S\"amtliche Schriften und
% Briefe}, series {\sc I, III, VII,} being edited by Dr.\ H.
% Breger\index{Breger, Herbert} and Dr. N. G\"adeke\index{G\"adeke, Nora}
% at the Leibniz-Archiv, Nieders\"achsische Landesbibliothek, Hannover.}
% Theodosius's\index{Theodosius} {\em Spherics}, the German {\em
% Algorismus} of Sacrobosco,\index{Sacrobosco} the Sanskrit text of the
% {\em Skandapur\=a\d{na}},\footnote{Being prepared at the University of
% Groningen by Hans Bakker,\index{Bakker, Hans} Roelf
% Adriaensen,\index{Adriaensen, Roelf} and
% Harunaga Isaacson.\index{Isaacson, Harunaga}} and the English texts of
% Thomas Middleton's\index{Middleton, Thomas} collected
% works\footnote{{\em The Collected Works of Thomas Middleton}, Gary
% Taylor, general editor, and John Lavagnino, electronics editor (Oxford:
% Oxford University Press, forthcoming).}, as well as the editions by
% Wayne Sullivan\index{Sullivan, Wayne}, Mac Pigman\index{Pigman,
% III$^{rd}$, G. W.}, and Dominik Wujastyk\index{Wujastyk, Dominik} which
% are illustrated in Appendix~\ref{examples}.
%
% \subsection{New to \TeX?}
%
% If you are coming to "EDMAC" primarily as the editor of a
% text, but have not thought about using \TeX\ before, you should
% find someone to help you get started with the program.  It is not
% really hard, but there are some points where a bit of good advice
% might save you some time.  \TeX{} is available in versions that
% run on most computers, and many implementations of \TeX\ are
% available free, or at a very low cost.  The output of \TeX\ can
% be printed without change on most printers and phototypesetting
% machines.  \TeX\ produces very high quality typesetting, and is
% particularly strong in the areas of typesetting complex
% mathematical formulae and multilingual texts.
%
% The \TeX{} Users Group (TUG) can advise you on all matters
% related to \TeX. If you are not already a member of the group, it
% is well worth joining. One of the most useful things TUG will do
% for you initially is give you a membership list, so you can find
% out who your local \TeX\ guru is.  The address is:
% \begin{quote}
% \TeX{} Users Group,\\* 1850 Union Street, Suite 1637,\\*
% San Francisco, CA 94123\\* USA.\\* Email: "tug@tug.org"\\*
% Home page: "<URL http://www.tug.org/>".
% \end{quote}
%
% This document does not include a \TeX{} tutorial.
% Recent years have seen the publication of numerous excellent books on
% how to learn and use \TeX, and the main implementations of \TeX, such as
% em\TeX\ by Eberhard Mattes\index{Mattes, Eberhard}, come with first
% class documentation. In brief, when
% you use "EDMAC" the main text to be edited is typed into a
% computer file as a plain text, with blank lines marking paragraph
% breaks, and with all formatting, accented characters, and other
% special requirements indicated by \TeX{} macros. {\em The \TeX
% book\/}\footnote{Reading, MA: Addison-Wesley, 1984.} by
% Donald E.~Knuth gives guidelines on various formatting commands
% for headings, page size, etc., and is a necessary
% reference for users of "EDMAC".
%
%
% \section{How to use {\tt EDMAC}}\label{howto}
% \subsection{Introduction}
%
% A document that uses "EDMAC" will use many standard \TeX{}
% commands, along with special "EDMAC" commands. This chapter
% describes the usage of all the "EDMAC" commands; the name of
% each will be printed in the margin as it is introduced. We assume
% a basic familiarity with \TeX{} conventions; if you are not
% conversant with \TeX{}, you should be able to form an idea of
% the specific capabilities of "EDMAC" from this account, but
% (we repeat) you will not be able to use "EDMAC" without first
% learning some \TeX{}.
%
% All you need to do to invoke "EDMAC" is to include the line
% "\input EDMAC.DOC" at the top of your document, and to have the
% file "EDMAC.DOC" somewhere on your disk that is ``visible''
% to \TeX{} for input.  It takes only a few
% seconds for \TeX\ to read "EDMAC.DOC", but if you
% are going to use it frequently, as will certainly be the case if
% you are doing a real edition, you will find it convenient to
% compile it into a \TeX\ format file, loading it after
% "PLAIN.TEX" and any other private macros.
%
% "EDMAC" {\em is a three-pass system}, like
% \LaTeX.\footnote{Oh yes it is, if you have a table of contents,
% lists of figures, etc.} Although your textual apparatus and line
% numbers will be printed even on the first run, it takes two more
% passes through \TeX\ to be sure that everything gets to its right
% place. Any changes you make to the input file may similarly
% require three passes to get everything to the right place, if the
% changes alter the number of lines or notes. "EDMAC" will tell
% you that you need to make more runs, when it notices, but it does
% not expend the labor to check this thoroughly. If you have
% problems with a line or two misnumbered at the top of a page, try
% running \TeX{} once or twice more.
%
% A file may mix {\em numbered\/} and {\em unnumbered\/} text.
% Numbered text is printed with marginal line numbers and can include
% footnotes and endnotes that are referenced to those line numbers:
% this is how you'll want to print the text that you're editing.
% Unnumbered text is not printed with line numbers, and you can't
% use "EDMAC"'s note commands with it: this is appropriate for
% introductions and other material added by the editor around the
% edited text.
%
% \paragraph{The choice of editing program}
% The careful choice of a good text editing program can make the
% preparation of texts for "EDMAC" much easier.  In common with
% most \TeX\ documents, a file formatted with "EDMAC" macros
% will have many sets of braces, often nested, and often enclosing
% material that will end up at the bottom of the page as notes.
% Some word processors or editors have the ability to ``fold'' text
% out of sight. This means that on the computer screen a particular
% string or passage can be hidden, perhaps behind a symbol.  Most
% modern word-processors handle footnotes in this way.  When you want
% to type a note, a window opens up; you type the note, and the
% window closes, leaving a highlighted number to remind you that
% a note is there.  There are several  folding editors available
% commercially and in the public domain, which would allow you to
% see only the main text of your work on the computer screen, while
% the notes and variants, etc., would be hidden from view.\footnote{One
% cross-platform public domain folding editor is ``Andys Editor'' which is
% available from the well-known Hobbes Internet site,
% "<URL http://hobbes.nmsu.edu/os2/editors/>" as the file "ae.zip".}
% GNU "Emacs" has an "outline" mode which could probably be
% modified to work like this.  (It is important, of course, that
% the editor doesn't pepper your text with unwanted control codes,
% or that if it does, they can easily be removed.)
%
% Another helpful feature to look for in your editing program is
% syntax-highlighting.  This means that the editor displays \TeX\ codes in
% a different colour from the textual matter.  This is enormously helpful
% in keeping clear what is what: you eye easily sees opening and closing
% braces, text and note commands, etc.  One editor which combines this and
% other valuable features, as well as being available for most operating
% systems, is "JED", by John E. Davis.\footnote{JED's home page on the
% web is "<URL http://space.mit.edu/~davis/jed.html>".}
% The CET system mentioned above (p.\,\pageref{CET} uses a simplified set
% of tags for marking up the text, and includes a pre-processor which
% turns these into actual "EDMAC" markup.
%
% An editor or system like this can be extremely helpful in keeping your
% text in good order, and allowing you to concentrate on the edition.
%
% \subsection{General markup}
%
% \DescribeMacro{\beginnumbering}
% \DescribeMacro{\endnumbering}
% Each section of numbered text must be preceded by
% "\beginnumbering" and followed by "\endnumbering":
% \begin{samepage}
% \smallskip
%
% "\beginnumbering"
%
% $\langle${\em text\/}$\rangle$
%
% "\endnumbering"
% \end{samepage}
%
% The "\beginnumbering" macro resets the line number to zero,
% reads an auxiliary file called \meta{filename}"."\meta{nn} (where
% {\it filename\/} is the name of the main input file for this job,
% and {\it nn\/} is "1" for the first numbered section, "2" for
% the second section, and so on), and then creates a new version of
% this auxiliary file to collect information during this run. The
% first instance of "\beginnumbering" also opens a file called
% \meta{filename}".end" to receive the text of the endnotes.
% "\endnumbering" closes the \meta{filename}"."\meta{nn} file.
%
% If the line numbering of a text is to be continuous from start to end,
% then the whole text will be typed between one pair of
% "\beginnumbering" and "\endnumbering" commands. But your text
% will most often contain chapter or other divisions marking sections
% that should be independently numbered, and these will be appropriate
% places to begin new numbered sections. "EDMAC" has to read and store
% in memory
% a certain amount of information about the entire section when it
% encounters a "\beginnumbering" command, so it speeds up the
% processing and reduces memory use when a text is divided into a larger
% number of sections (at the expense of multiplying the number of
% external files that are generated).
%
% \DescribeMacro{\pstart}
% \DescribeMacro{\pend}
% Within a numbered section, each paragraph of numbered text must
% be marked using the "\pstart" and "\pend" commands:
% \begin{samepage}
% \smallskip
%
% "\pstart"
%
% $\langle${\em paragraph of text\/}$\rangle$
%
% "\pend"
%
% \end{samepage}
%
% Text that appears within a numbered section but isn't marked with
% "\pstart" and "\pend" will not be numbered.
%
% The following example shows the proper section and paragraph
% markup, and the kind of output that would typically be generated:
% \egstart
% \begin{verbatim}
% \beginnumbering
% \pstart
% This is a sample paragraph, with
% lines numbered automatically.
% \pend
%
% \pstart
% This paragraph too has its
% lines automatically numbered.
% \pend
%
% The lines of this paragraph are
% not numbered.
%
% \pstart
% And here the numbering begins
% again.
% \pend
% \endnumbering
% \end{verbatim}
% \egmid
% {\parskip0pt \count255=0
% \everypar={\advance \count255 by 1 \hbox to 1.5em{\the\count255\hfil}}
% This is a sample paragraph\par
% with lines numbered\par
% automatically.\smallskip
%
% This paragraph too\par
% has its lines automatically\par
% numbered.\smallskip
%
% \everypar={\hbox to 1.5em{\hfil}}
% The lines of this paragraph\par
% are not numbered.\smallskip
%
% \everypar={\advance \count255 by 1 \hbox to 1.5em{\the\count255\hfil}}
% And here the numbering\par
% begins again.\par}
% \egend
%
% \DescribeMacro{\autopar}
% You can use "\autopar" to avoid the nuisance of this paragraph markup
% and still have every paragraph automatically numbered.  The scope of the
% "\autopar" command needs to be limited by keeping it within a group, as
% follows:
% \egstart
% \begin{verbatim}
% \begingroup
%   \beginnumbering
%   \autopar
%
%   A paragraph of numbered text.
%
%   Another paragraph of numbered
%   text.
%
%   \endnumbering
% \endgroup
% \end{verbatim}
% \egmid
% {\parskip0pt \count255=0
% \everypar={\advance \count255 by 1 \hbox to 1.5em{\the\count255\hfil}}
% A paragraph of numbered\par
% text.\smallskip
%
% Another paragraph of\par
% numbered text.\par}
% \egend
% "\autopar" fails, however, on paragraphs that start with a
% "{" or with any other command that starts a new group before it
% generates any text. Such paragraphs need to be started explicitly,
% before the new group is opened,
% using "\indent", "\noindent", or "\leavevmode", or using
% "\pstart" itself.\footnote{For a detailed study of the
% reasons for this restriction, see Barbara Beeton, ``Initiation
% rites'', {\em TUGboat\/} {\bf 12} (1991),
% pp.\,257--258.\protect\index{Beeton, Barbara Ann Neuhaus Friend}}
%
% \DescribeMacro{\pausenumbering}
% \DescribeMacro{\resumenumbering}
% \label{pause}\relax
% "EDMAC" stores a lot of information about line numbers and
% footnotes in memory as it goes through a numbered section.  But
% at the end of such a section, it empties its memory out, so to
% speak.  If your text has a very long numbered section it is
% possible that your \TeX\ may reach its memory limit.  There are
% two solutions to this.  The first is to get a new \TeX\ with
% increased memory.  There are several Big\TeX\ implementations
% easily available today, both commercial and public-domain,
% depending on your operating system.  The second solution is to
% split your long section into several smaller ones.  The trouble
% with this is that your line numbering will start again at zero
% with each new section.  To avoid this problem, we provide
% "\pausenumbering" and "\resumenumbering" which are just
% like "\endnumbering" and "\beginnumbering", except that
% they arrange for your line numbering to continue across the break.
% Use "\pausenumbering" only between numbered paragraphs:
% \egstart
% \begin{verbatim}
% \beginnumbering
% \pstart
% Paragraph of text.
% \pend
% \pausenumbering
%
% \resumenumbering
% \pstart
% Another paragraph.
% \pend
% \endnumbering
% \bye
% \end{verbatim}
% \egmid
% {\parskip0pt \count255=0
% \everypar={\advance \count255 by 1 \hbox to 1.5em{\the\count255\hfil}}
% Paragraph of\par
% text.\medskip
%
% Another paragraph.\par}
%
% \egend
%
% We have
% defined these commands as two macros, in case you find it necessary
% to insert text between numbered sections without disturbing the
% line numbering.  But if you are really just using these macros to
% save memory, you might as well say
% \begin{verbatim}
% \def\memorybreak{\pausenumbering\resumenumbering}
% \end{verbatim}
% and say "\memorybreak" between the relevant "\pend" and
% "\pstart".
%
%
%
% \subsection{The apparatus}
%
% \DescribeMacro{\text}
% Within numbered paragraphs, all footnotes and endnotes are generated
% by forms of the "\text" macro:
% \begin{verse}
% "\text{"\meta{lemma}"}"\meta{commands}"/"
% \end{verse}
%
% The \meta{lemma} argument is the lemma in the main text: "\text"
% both prints this as part of the text, and makes it available to the
% \meta{commands} you specify to generate notes. The "/" at the
% end terminates the command; it is part of the macro's definition so
% that spaces after the macro will be treated as significant.
%
% For example:
% \egstart
% \begin{verbatim}
% I saw my friend \text{Smith}
% \Afootnote{Jones C, D.}/
% on Tuesday.
% \end{verbatim}
% \egmid
% 1\enspace I saw my friend\\
% 2\enspace Smith on Tuesday.\smallskip
% \hrule width 1.5cm
% \strut {\bf 2} Smith] Jones C, D.
% \egend
%
% The lemma "Smith" is printed as part of this sentence in
% the text, and is also made available to the footnote
% that specifies a variant, "Jones C, D". The footnote macro
% is supplied with the line number at which the lemma appears
% in the main text.
%
% The \meta{lemma} may contain further "\text" commands; this is the
% other reason why "\text"'s arguments are terminated by "/".  Nesting makes
% it possible to print an explanatory note on a long passage together with
% notes on variants for individual words within the passage. For
% example:
% \egstart
% \begin{verbatim}
% \text{I saw my friend
%   \text{Smith}\Afootnote{Jones
%   C, D.}/ on Tuesday.}
%   \Bfootnote{The date was
%   July 16, 1954.}
% /
% \end{verbatim}
% \egmid
% 1\enspace I saw my friend\\
% 2\enspace Smith on Tuesday.\smallskip
% \hrule width 1.5cm
% \strut {\bf 2} Smith] Jones C, D.\smallskip
% \hrule width 1.5cm
% \strut {\bf 1--2} I saw my friend \\
% Smith on Tuesday.] The\\ date was
% July 16, 1954.
% \egend
%
% However, "\text" cannot handle overlapping but unnested
% notes---for example, one note covering lines 10--15, and another
% covering 12--18; a "\text" that starts in the \meta{lemma}
% argument of another "\text" must end there, too. (The
% "\lemma" and "\linenum" commands may be used to
% generate overlapping notes if necessary.)
%
% \paragraph{Commands used in {\tt\protect\bslash text}'s second argument}
%
% The second argument of the "\text" macro, \meta{commands},
% may contain a series of subsidiary commands that generate
% various kinds of notes.
%
% \DescribeMacro{\Afootnote}
% \DescribeMacro{\Bfootnote}
% \DescribeMacro{\Cfootnote}
% \DescribeMacro{\Dfootnote}
% \DescribeMacro{\Efootnote}
% Five separate series of footnotes are maintained; when all five
% are used, the "A" notes appear in a layer just below the main
% text, followed by the rest in turn, down to the "E" notes at
% the bottom.  These are the main macros that you will use to construct
% the critical apparatus of your text.  "EDMAC" provides five
% layers of notes in the belief that this will be adequate for
% the most demanding editions.  But it is not hard to add further
% layers of notes to "EDMAC" should they be required.
%
% \DescribeMacro{\Aendnote}
% \DescribeMacro{\Bendnote}
% \DescribeMacro{\Cendnote}
% \DescribeMacro{\Dendnote}
% \DescribeMacro{\Eendnote}
% "EDMAC" also maintains five separate series of endnotes.
% Normally, none of them is printed: you must use the
% "\doendnotes" macro described below
% (p.\,\pageref{doendnotes}) to call for their
% output at the appropriate point in your document.
%
% \DescribeMacro{\lemma}
% Sometimes you want to change the lemma that gets passed to the notes.
% You can do this by using "\lemma" within the second argument to
% "\text", before the note commands.
% \begin{verse}
% "\lemma{"\meta{alternative lemma}"}"
% \end{verse}
% The most common use of this command is to abbreviate the lemma that's
% printed in the notes. For example:
% \egstart
% \begin{verbatim}
% \text{I saw my friend
%   \text{Smith}\Afootnote{Jones
%   C, D.}/ on Tuesday.}
%   \lemma{I \dots\ Tuesday.}
%   \Bfootnote{The date was
%   July 16, 1954.}
% /
% \end{verbatim}
% \egmid
% 1\enspace I saw my friend\\
% 2\enspace Smith on Tuesday.\smallskip
% \hrule width 1.5cm
% \strut {\bf 2} Smith] Jones C, D.\smallskip
% \hrule width 1.5cm
% \strut {\bf 1--2} I \dots\ Tuesday.] \\
% The date was July 16, 1954.
% \egend
%
% \DescribeMacro{\linenum}
% \label{linenum}\relax
% You can use "\linenum" to change the line numbers passed to
% the notes. The notes are actually given seven parameters: the page,
% line, and sub-line number for the start of the lemma; the same
% three numbers for the end of the lemma; and the font specifier
% for the lemma. As argument to "\linenum", you specify
% those seven parameters in that order, separated by vertical bars
% (the "|" character). However, you can retain the value
% computed by "EDMAC" for any number by simply omitting it; and
% you can omit a sequence of vertical bars at the end of the
% argument.  For example, "\linenum{|||23}" changes one number,
% the ending page number of the current lemma.
%
% This command doesn't change the marginal line numbers in any way;
% it just changes the numbers passed to the footnotes. Its use comes in
% situations that "\text" has trouble dealing with for
% whatever reason. If you need notes for overlapping passages that
% aren't nested, for instance, you can use "\lemma" and
% "\linenum" to generate such notes despite the limitations of
% "\text".  If the \meta{lemma} argument to "\text" is
% extremely long, you may run out of memory; here again you can
% specify a note with an abbreviated lemma using "\lemma" and
% "\linenum". The numbers used in "\linenum" need not be
% entered manually; you can use the ``"x-"'' symbolic cross-referencing
% commands below (p.\,\pageref{crossref}) to compute them
% automatically.
%
% Similarly, being able to manually change the lemma's font specifier
% in the notes might be important if you were using multiple scripts or
% languages. The form of the font specifier depends on the font
% selection scheme you are using (see section~\ref{fonts} below).
% If you're using Plain, it is the
% ``font family'' number; if you're using NFSS, it is actually three
% separate codes separated by "/" characters, giving the family,
% series, and shape codes as defined within NFSS.
%
% \paragraph{Changing the names of these commands}
%
% The commands for generating the apparatus have been given
% rather bland names, because editors in different fields have
% widely divergent notions of what sort of notes are required, where
% they should be printed, and what they should be called. But this
% doesn't mean you have to type "\Afootnote" when you'd rather
% say something you find more meaningful, like "\variant". We
% recommend that you create a series of such aliases and use them
% instead of the names chosen here; all you have to do is put commands
% of this form at the start of your file:
% \begin{verbatim}
% \let\variant=\Afootnote
% \let\explanatory=\Bfootnote
% \let\trivial=\Aendnote
% \let\testimonia=\Cfootnote
% \end{verbatim}
%
% It is also possible to define aliases for "\text", which
% can be easier to type. You can make a single character substitute
% for "\text" by saying this:
% \begin{verbatim}
% \catcode`\<=\active
% \let<=\text
% \end{verbatim}
%
% Then you might say "<{Smith}\variant{Jones}/". This of course
% destroys the ability to use "<" in any new macro definitions, so
% long as it remains in effect; hence it should be used with care.
%
% Changing the character at the end of the command requires more work:
% \begin{verbatim}
% \catcode`\<=\active
% \def\xtext#1#2>{\text{#1}{#2}/}
% \let<=\xtext
% \end{verbatim}
% This allows you to say "<{Smith}\Afootnote{Jones}>".
%
% Aliases for "\text"
% of the first kind shown here also can't be nested---that is,
% you can't use the alias in the text that forms the first argument
% to "\text". (See section~\ref{text} to find out why.) Aliases of
% the second kind may be nested without any problem.
%
% \subsection{Lineation commands}
%
% \DescribeMacro{\lineation}
% "EDMAC" can number lines either by page or by section; you specify
% this using the "\lineation{"\meta{arg}"}"
% macro, where \meta{arg} is either
% "page" or "section". You may only use this command at places
% where numbering is not in effect; you can't change the lineation system
% within a section. You can change it between sections: they don't all
% have to use the same lineation system. The line-of-section system is
% "EDMAC"'s standard setting.
%
% \DescribeMacro{\linenummargin}
% The marginal line numbers will be printed in the "left",
% "right", "inner", or "outer" margin, depending on which you
% specify as argument to the "\linenummargin"
% command: for example, "\linenummargin{inner}".
% Normally, line numbers appear
% in the left margin. You can change this whenever you're not in the
% middle of making a paragraph.
%
% \DescribeMacro{\firstlinenum}
% \DescribeMacro{\linenumincrement}
% \DescribeMacro{\firstsublinenum}
% \DescribeMacro{\sublinenumincrement}
% In most cases, you will not want a number printed for every
% single line of the text. Four \TeX{} "count" registers control
% the printing of marginal numbers.
% "\firstlinenum" specifies the number of the first line in a
% section to number, and "\linenumincrement" is the increment
% between numbered lines. "\firstsublinenum" and
% "\sublinenumincrement" do the same for
% sub-lines.  Initially, all these counters are set equal to $5$.
%
% \DescribeMacro{\leftlinenum}
% \DescribeMacro{\rightlinenum}
% \DescribeMacro{\linenumsep}
% When a marginal line number is to be printed, there are a
% lot of ways to display it.
% You can redefine "\leftlinenum" and "\rightlinenum" to
% change the way marginal line numbers are printed in the
% left and right margins respectively; the initial
% versions print the number in font "\numlabfont" (described
% below) at a distance "\linenumsep" (initially set to one pica)
% from the text.
%
% \subsection{Changing the line numbers}
%
% Normally the line numbering starts at 1 for the first line of
% a section and steps up by one for each line thereafter. There
% are various common modifications of this system, however; the
% commands described here allow you to put such modifications
% into effect.
%
% \DescribeMacro{\startsub}
% \DescribeMacro{\endsub}
% You insert the "\startsub" and "\endsub" commands in your text
% to turn sub-lineation on and off. In plays, for
% example, stage directions are often numbered with sub-line
% numbers: as line $10.1$, $10.2$,
% $10.3$, rather than as $11$, $12$, and $13$.
% Titles and headings are sometimes numbered with sub-line numbers
% as well.
%
% When sub-lineation is in effect, the line number counter is
% frozen and the sub-line counter advances instead. If one of these
% commands appears in the middle of a line, it doesn't take effect
% until the next line; in other words, a line is counted as a line
% or sub-line depending on what it started out as, even if that
% changes in the middle.
%
% \DescribeMacro{\startlock}
% \DescribeMacro{\endlock}
% The "\startlock" command, used in running text, locks the
% line number at its current value, until you say "\endlock".
% It can tell for itself whether you are in a patch of line or
% sub-line numbering. One use for line-number locking is in printing
% poetry: there the line numbers should be those of verse lines
% rather than of printed lines, even when a verse line requires several
% printed lines.
%
% \DescribeMacro{\lockdisp}
% When line-number locking is used,
% several printed lines may have the same line number, and you have to
% specify whether you want the number attached to the first printed
% line or the last, or whether you just want the number printed by
% them all. (This assumes that, on the basis of the settings of
% the previous parameters, it is necessary to display a line number for
% this line.)  You specify your preference using "\lockdisp"; its
% argument is a word, either "first", "last", or "all".
% "EDMAC" initially sets this to "first".
%
% \DescribeMacro{\setline}
% \DescribeMacro{\advanceline}
% In some cases you may want to modify the line numbers that are
% automatically calculated: if you are printing only fragments
% of a work but want to print line numbers appropriate to a complete
% version, for example. The "\setline" and "\advanceline" commands
% may be used to change the current line's number (or the sub-line
% number, if sub-lineation is currently on). They change both the
% marginal line numbers and the line numbers passed to the notes.
% "\setline" takes one argument, the value to which you want
% the line number set; it must be $0$ or greater. "\advanceline"
% takes one argument, an amount that should be added to the current
% line number; it may be positive or negative.
%
% \subsection{Alternate footnote formatting}
% If you just launch into "EDMAC" using the commands outlined
% above, you will get a standard layout for your text and notes.  You
% may be happy to accept this at the very beginning, while you
% get the hang of things, but the standard layout is not particularly
% pretty, and you will certainly want to modify it in due course.
% "EDMAC" provides ways of changing the fonts and layout of
% your text, but these are not aimed at being totally comprehensive.
% They are enough to deal with simple variations from the norm, and
% to exemplify how you might go on to make more swingeing changes.
%
% \DescribeMacro{\footparagraph}
% \DescribeMacro{\foottwocol}
% \DescribeMacro{\footthreecol}
% All footnotes will normally be formatted as a series of separate
% paragraphs in one column. But there are three other formats
% available for notes, and using these macros you can select a
% different format for a series of notes. "\footparagraph" formats
% all the footnotes of a series as a single paragraph (see
% figs.~\ref{iocasta-out}, \ref{periphyseon-out} and \pageref{vyadi},
% pp.\,\pageref{iocasta-out}, \pageref{periphyseon-out}, and
% \pageref{vyadi}); "\foottwocol" formats them as separate paragraphs,
% but in two columns (see bottom notes in fig.~\ref{arden-out},
% p.\,\pageref{arden-out});
% "\footthreecol", in three columns (see second layer of notes in
% fig.\ref{features-out}, p.\,\pageref{features-out}). Each of these
% macros
% takes one argument: a letter (between "A" and "E") for
% the series of notes you want changed.
% So a text with three layers of notes might begin thus:
% \begin{verbatim}
% \footnormal{A}
% \footthreecol{B}
% \footparagraph{C}
% \end{verbatim}
% This would make the A-notes ordinary, B-notes would be in three
% columns, and the bottom layer of notes would be formed into
% a paragraph on each page.
%
% \DescribeMacro{\interparanoteglue}
% If you use paragraphed footnotes, the macro "\interparanoteglue"
% defines the glue appearing in between footnotes in the paragraph.
% It is a macro whose argument is the glue you want, and its
% initial setting is (see p.\,\pageref{interparanoteglue}):
% \begin{verbatim}
% \interparanoteglue{1em plus .4em minus .4em}
% \end{verbatim}
%
% You should set "\hsize" for the text, and the "\baselineskip" of
% the footnotes (this is done for you if you use the standard
% "\notefontsetup"), before you call any
% of these macros, because their action depends on those values;
% too much or too little space will be allotted for the notes on
% the page if these macros use the wrong
% values.\footnote{\label{nobreaks}There
% is one tiny proviso about using paragraphed notes: you shouldn't
% force any explicit line-breaks inside such notes: do not use
% {\tt \bslash par},
% {\tt \bslash break}, or {\tt \bslash penalty=-10000}.  If
% you must have a line-break for some obscure reason, just suggest
% the break very strongly: {\tt \bslash penalty=-9999} will do
% the trick. Page \pageref{nobreak} explains why this restriction
% is necessary.}
%
% \subsection{Fonts}\label{fonts}
% One of the most important features of the appearance of the notes,
% and indeed of your whole document, will be the fonts used. Because
% the demands of critical editions tax the font-handling system of
% \PlainTeX, we provide both that system and an alternative, the
% New Font Selection System (NFSS) developed for \LaTeX. We will
% first describe the commands that give you control over the
% use of fonts in the different structural elements of the document,
% especially within the notes, and then in
% subsequent sections specify how these commands are used with each
% of the font-handling systems.
%
% (For those who are setting up "EDMAC" for a large job, here is
% a list of the complete set of "EDMAC" macros relating to fonts that
% are intended for manipulation by the user: "\endashchar", "\fullstop",
% "\headlinefont", "\notefontsetup", "\notenumfont",
% "\numlabfont", and "\rbracket". "EDMAC" also assumes that "\rm" has
% been defined so as to select a roman font in the current size,
% and that some reasonable standard font has been selected before
% the package is loaded.)
%
% \DescribeMacro{\notefontsetup}
% \label{notefonts}\relax
% The "\notefontsetup" macro defines the standard set of
% fonts for all your footnotes. This command redefines such commands as
% "\it" so that they refer to an appropriate family of fonts, typically
% different from that used for the main text;
% normally, "EDMAC" chooses eight-point
% fonts for your footnotes, as against ten-point fonts for the main
% text.
%
% \DescribeMacro{\notenumfont}
% The "\notenumfont" macro specifies the font used for the line
% numbers printed in notes. This will typically be a command like
% "\bf" ("EDMAC"'s initial value is "\sevenrm") that selects a
% distinctive style for the
% note numbers, but leaves the choice of a size up to
% "\notefontsetup".
%
% \DescribeMacro{\numlabfont}
% Line numbers for the main text
% are usually printed in a smaller font in the margin.
% The "\numlabfont" macro is provided as a standard name for
% that font: it is initially set to be a seven-point roman font.
% You might wish to use a different font if, for example,
% you preferred to have these line numbers printed using
% old-style numerals.
%
% \DescribeMacro{\select@lemmafont}
% We will briefly discuss "\select@lemmafont"
% here because it is important to know about
% it now, although it is not one of the macros you would expect to
% change in the course of a simple job. Hence it is ``protected''
% by having the @-sign in its name.
%
% When you use the "\text" macro to mark a word in your text
% as a lemma, that word will normally be printed again in your
% apparatus.  If the word in the text happens to be in a font such
% as italic or bold you would probably expect it to appear in the
% apparatus in the same font.  This becomes an absolute necessity
% if the font is actually a different script, such as Arabic or
% Cyrillic.  "\select@lemmafont" does the work of
% decoding "EDMAC"'s data about the fonts used to print the lemma in
% the main text and calling up those fonts for printing the lemma in
% the note.
%
% "\select@lemmafont" is a macro that takes one long
% argument---the cluster of line numbers passed to the note
% commands. This cluster ends with a code indicating what
% fonts were in use at the start of the lemma.
% "\select@lemmafont" selects the appropriate font for the
% note using that font specifier.
%
% "EDMAC" uses "\select@lemmafont" in a standard footnote
% format macro called "\normalfootfmt".  The footnote formats
% for each of the layers "A" to "E" are "\let" equal
% to "\normalfootfmt".  So all the layers of footnotes are
% formatted in the same way.
%
% But it is also likely that you might want to have different fonts
% for just, say, the note numbers in layers "A" and "B" of
% your apparatus.  To do this, make two copies of the
% "\normalfootfmt" macro (see p.\,\pageref{normalfootfmt})---or
% "\twocolfootfmt", or the other appropriate macro ending in
% "-footfmt", depending on what footnote format you have
% selected---and give these macros the names "\Afootfmt" and
% "\Bfootfmt".  Then, in these new macros, change the font
% specifications (and spacing, or whatever) to your liking.
%
% \DescribeMacro{\endashchar}
% \DescribeMacro{\fullstop}
% \DescribeMacro{\rbracket}
% \font\teni=cmmi10
% A relatively trivial matter relates to punctuation.  In your
% footnotes, there will sometimes be spans of line numbers like
% this: 12--34, or lines with sub-line numbers like this: 55.6. The
% en-dash and the full stop are taken from the same font as the
% numbers, and it all works nicely.  But what if you wanted to use
% old-style numbers, like {\teni12} and {\teni34}?  These look nice
% in an edition, but when you use the fonts provided by \PlainTeX\
% they are taken from a math font which does not
% have the en-dash or full stop in the same places as a text font.
% If you (or your macros) just typed "$\oldstyle 12--34$" or
% "$\oldstyle 55.6$" you would get ``{\teni12--34}''and
% ``{\teni55.6}''.  So we define "\endashchar" and
% "\fullstop", which produce an en-dash and a full stop
% respectively from the "\rm" font, whatever font you are using
% for the numbers. These two macros are used in the
% macros which format the line numbers in the margins and
% footnotes, instead of explicit punctuation.
%  We also define an "\rbracket" macro for the
% right square bracket printed at the end of the lemma in many
% styles of textual notes (including "EDMAC"'s standard style).
%
% \subsubsection{The New Font Selection Scheme}
% \label{edmacnfss}\relax
%
% While the handling the fonts in \PlainTeX\ works for simple cases, it
% quickly gets inadequate if you want \TeX\ to load many different
% fonts, or if you frequently change font sizes, languages, etc.  We
% recommend that for all but the simplest editions you consider using the
% New Font Selection Scheme.
%
% The New Font Selection Scheme (NFSS) is a major piece of programming by
% Frank Mittelbach\index{Mittelbach, Frank} and Rainer
% Sch\"opf\index{Sch\"opf, Rainer} which completely rewrites the way \TeX\
% macros handle fonts.  It was first published in {\em TUGboat} in
% 1989.\footnote{{\em TUGboat\/} {\bf 10} (1989), pp.\,222--238.}
% Initially, the NFSS was aimed at replacing the \LaTeX\ system of font
% handling, as contained in "lfonts.tex".\footnote{See {\em TUGboat} {\bf
% 11} (1990), pp.\,297--305.} Later it became part of a major revision of
% the whole of \LaTeX, and is now documented in {\em The \LaTeX\
% Companion}\footnote{By Michel Goossens, Frank Mittelbach and Alexander
% Samarin (Reading, etc.: Addison Wesley, 1994).  See especially
% chapter~7.} and in the files distributed with \LaTeX\
% itself.\footnote{Of the files in the \LaTeXe\ distribution, you should
% especially read "features.tex" and "fontcmds.dtx".}  Another reason why
% you might wish to use the NFSS is that you may already be accustomed to
% using it if you are using \LaTeX\ for other parts of your book, or for
% other publications.
%
% Wayne Sullivan\index{Sullivan, Wayne} adapted an early release of the
% NFSS for separate use with \PlainTeX\ and "EDMAC".\footnote{See the file
% "plainfss.zip" available from internet archive sites of \TeX-related
% material.}  Since then, the NFSS has become more closely integrated
% into \LaTeX.  So today, if you wish to use the NFSS, you should start by
% installing the latest version of \LaTeX.  This does not mean that
% "EDMAC" is compatible with \LaTeX\ in general: it isn't.  But the
% accompanying file "ed-nfss.tex" contains instructions about a simple way
% in which "EDMAC" can use just those parts of \LaTeX\ that define the
% NFSS.\label{ed-nfss}  We have kept these instructions separate because
% \LaTeX\ is in a period of evolution, and things may work differently in
% future. But "EDMAC" itself does contain the `hooks' required to access
% the NFSS if it has been defined.
%
% What will you gain by using the NFSS with "EDMAC"?  {\em The \LaTeX\
% Companion}, referred to above, makes the general case for NFSS in clear
% terms at the beginning of chapter~7.  More specifically, if you
% read the documentation below, you will come across several places
% where we highlight how hamstrung we felt, being limited to the
% font macros available in \PlainTeX.  See the discussion of
% "\select@lemmafont" in particular
% (p.\,\pageref{selectlemmafont}).  If you are happy with the CM
% fonts used by \PlainTeX, plus just a very few others, then you could
% stay with "EDMAC" as it is.  But if you want to use
% completely different families of fonts, such as PostScript fonts,
% or if you plan to use several different languages or alphabets
% such as Armenian or Greek, then your work will be made much easier
% by the NFSS.
%
% Here are some examples of how you might define some of the font
% macros when you use NFSS.
% \begin{verbatim}
%   \def\notefontsetup{\fontsize{7}{8}\selectfont}
%   \let\notenumfont=\rm
% \end{verbatim}
% These commands select seven-point fonts on eight-point baselines
% for the notes, and choose a roman font for the line numbers
% within notes.
%
% \subsubsection{The Plain font selection scheme}
%
% If you run ordinary \TeX\ with "edmac.doc", the
% main font commands of \PlainTeX\ will be available in the normal way
% (see the {\em \TeX book}, chapter 4).
%
% "EDMAC" also defines a set of macros (modelled on some of the "manmac"
% macros from appendix E of {\em The \TeX book}) to
% invoke eight-point fonts, and an "\eightpoint" macro to select
% a whole set of fonts at that size; when the Plain font selection
% scheme is used, this is the initial value of "\notefontsetup". If you
% want to use some other font size for the notes, you will need to
% load the appropriate fonts in your file, and then
% define your own macro on the model of "\eightpoint" that will
% properly assign the baseline spacing, set the various font
% families, and redefine the commands "\rm", "\it", etc.
%
% If your document requires font shapes other than those found
% in \PlainTeX, you will need to go further and modify the
% "\select@lemmafont" macro to handle these shapes:
% see its use on
% p.\,\pageref{selectlemmafont} for more details.  As you will see
% from that description, if you are using some new, outlandish font
% such as Devan\=agar\=\i, you should assign it a new font family,
% in order for "\select@lemmafont" to be able to handle it
% this way. But once you get to this level of complexity, it
% might be better to switch over to the New Font Selection Scheme
% anyway. Note that our use of the Plain font selection scheme makes
% a use of the ``font family'' specifier that is not what was
% intended; and because \TeX's maximum font-family number is $15$,
% it is possible to run out of font families if your text has many
% different kinds of font or uses other macro packages that also
% define new font families. When "EDMAC" uses NFSS, it does not
% meddle with font-family numbers in this way.
%
% Because "\notefontsetup" sets up the whole set of fonts used
% within notes that are likely to change font shapes, it needs
% to be equated to a complex macro like "\eightpoint". But the
% other "EDMAC" font macros---"\notenumfont" and
% "\numlabfont"---are used for text which should not contain any
% font changes, and it is usually good enough to equate one of
% these to a command that selects a specific font at a specific
% size. For example, saying "\let\numlabfont=\seveni" selects
% a seven-point math italic font for marginal line numbers, so
% that the numbers will be printed using old-style figures.
%
% \subsection{Crop marks}
%
% Publishers usually like crop marks on the camera-ready copy for
% works of this kind, so a facility for generating them has been
% incorporated into "EDMAC".
%
% Publishers specify crop marks (or trim lines, etc.) in terms of
% two dimensions, height and width, and they also usually specify
% back and head margins.
%
% The ``head margin'' is the distance between the top of the printed
% text and the top crop marks; it is normally measured
% from the top of the running head, \PlainTeX's
% "\headline". The ``back margins'' (or ``gutter margins'') are
% the right margins of even-numbered pages, and the left margins of
% odd-numbered pages. If you hold a book open in front of you, they
% are the margins in the middle of the opening.
% \begin{figure}
% \unitlength=0.80mm
% \linethickness{0.4pt}
% \begin{picture}(138.00,90.00)
% \put(64.00,80.00){\line(-1,0){5.00}}
% \put(14.01,80.00){\line(1,0){5.00}}
% \put(14.00,15.00){\line(1,0){5.00}}
% \put(59.00,15.00){\line(1,0){5.00}}
% \put(20.01,81.00){\line(0,1){5.00}}
% \put(58.00,86.00){\line(0,-1){5.00}}
% \put(20.00,9.00){\line(0,1){5.00}}
% \put(58.00,14.00){\line(0,-1){5.00}}
% \put(25.00,20.00){\dashbox{2.00}(29.00,45.00)[cc]{}}
% \put(25.00,70.00){\dashbox{2.00}(29.00,2.00)[cc]{{\tiny headline}}}
% \put(10.00,5.00){\framebox(60.00,85.00)[cc]{\shortstack{\strut even\\
%  \strut page\\ \strut text}}}
% \put(133.00,80.00){\line(-1,0){5.00}}
% \put(83.00,80.00){\line(1,0){5.00}}
% \put(83.00,15.00){\line(1,0){5.00}}
% \put(128.00,15.00){\line(1,0){5.00}}
% \put(89.00,81.00){\line(0,1){5.00}}
% \put(127.00,86.00){\line(0,-1){5.00}}
% \put(89.00,9.00){\line(0,1){5.00}}
% \put(127.00,14.00){\line(0,-1){5.00}}
% \put(93.00,20.00){\dashbox{2.00}(29.00,45.00)[cc]{}}
% \put(93.00,70.00){\dashbox{2.00}(29.00,2.00)[cc]{{\tiny headline}}}
% \put(78.00,5.00){\framebox(60.00,85.00)[cc]{\shortstack{\strut odd\\
%  \strut page\\ \strut text}}}
% \put(25.00,77.00){\vector(0,-1){5.00}}
% \put(25.00,77.00){\vector(0,1){3.00}}
% \put(54.03,41.97){\makebox(0,0)[lb]{{\tiny back margin}}}
% \put(91.00,45.00){\vector(-1,0){2.00}}
% \put(91.00,45.00){\vector(1,0){2.00}}
% \put(78.10,42.99){\makebox(0,0)[lb]{{\tiny back margin}}}
% \put(16.00,45.00){\vector(0,1){35.00}}
% \put(16.00,45.00){\vector(0,-1){30.00}}
% \put(-0.03,44.00){\makebox(0,0)[lb]{{\tiny cropsetup \#1}}}
% \put(31.01,8.00){\makebox(0,0)[lb]{{\tiny cropsetup \#2}}}
% \put(54.03,39.97){\makebox(0,0)[lb]{{\tiny (cropsetup \#4)}}}
% \put(26.00,75.00){\makebox(0,0)[lb]{{\tiny (cropsetup \#3)}}}
% \put(26.00,77.00){\makebox(0,0)[lb]{{\tiny head margin}}}
% \put(56.00,45.00){\vector(-1,0){2.00}}
% \put(56.00,45.00){\vector(1,0){2.00}}
% \put(38.03,11.01){\vector(-1,0){17.96}}
% \put(38.03,11.01){\vector(1,0){20.00}}
% \put(105.01,18.01){\vector(1,0){17.04}}
% \put(105.01,18.01){\vector(-1,0){11.96}}
% \put(103.04,16.04){\makebox(0,0)[lb]{{\tiny hsize}}}
% \put(123.97,41.99){\vector(0,-1){21.94}}
% \put(124.00,41.98){\vector(0,1){24.96}}
% \put(124.94,43.05){\makebox(0,0)[lb]{{\tiny vsize}}}
% \put(126.99,66.01){\makebox(0,0)[lc]{{\tiny topskip}}}
% \put(125.99,70.01){\vector(0,-1){3.02}}
% \put(125.99,62.00){\vector(0,1){2.99}}
% \put(124.99,64.99){\line(1,0){2.03}}
% \put(124.99,66.99){\line(1,0){2.03}}
% \end{picture}
% \caption{Crop marks, back and head margins.}
% \label{pages}
% \end{figure}
%               ^^A   Ouch!  I'd hate to do that without
%               ^^A          Georg Horn's TeXcad program!
%
% \DescribeMacro{\cropsetup}
% \label{cropsetup}\relax
% If you want to have crop marks, and to control the back and
% head margins, you issue the "\cropsetup" macro.  It takes
% four parameters (see Figure \ref{pages}):
% \begin{enumerate}\addtolength{\itemsep}{-1ex}
% \item the vertical distance between crop marks,
% \item the horizontal distance between crop marks,
% \item the head margin, and
% \item the back margin.
% \end{enumerate}
%
% In addition to these arguments, "EDMAC"
% uses the "\hsize" of the page, as well as information about the
% height at which the "\headline" floats above the main text (which
% is set in \PlainTeX's "\makeheadline" macro). "EDMAC"
% performs these calculations when you issue the "\cropsetup"
% command.  Therefore, it is important that you set the "\hsize"
% and make any changes to "\makeheadline" {\sl before\/} you issue
% the "\cropsetup" command.  If you do change these values, issue
% the "\cropsetup" command again.
%
% \DescribeMacro{\headlinefont}
% \DescribeMacro{\magicvskip}
% In particular, if the "\headline" is going to be set at a
% different height from the top of the text, or in a different
% font, you can change the appropriate values easily by using
% "\headlinefont" and "\magicvskip".  The former is what
% you would expect; just "\let" it to be whatever font you
% are using (the font macro should include a definition of an
% appropriate "\strutbox" for that font). Note that this specification
% does {\em not\/} change what font is actually used by \TeX, unless
% you modify \TeX's "\headline" macro; it serves only to inform
% "\cropsetup" of the size of your headline font.
%
% The "\magicvskip" gives you direct
% access to what Donald Knuth calls
% a ``magic constant'' on p.\,255 of {\em The \TeX book}.  For
% \PlainTeX, "\magicvskip" is $-22.5$\,pt, but you can change
% this if you want the "\headline" higher or lower than the
% built-in value.  See p.\,\pageref{magic} below for more details.
%
% Apart from this stricture that the "\cropsetup" command
% should follow any changes in "\hsize" and the "\headline",
% there is no relation (other than visual) between the crop marks
% and the "\hsize" and "\vsize".  You can vary any of
% these dimensions independently, without affecting any other. Your
% publisher will almost always want the "\hsize" and
% "\vsize" to be a few picas smaller than the horizontal and
% vertical distances between crop marks.  And if you want to shift
% the whole of your printed page about on the paper, use
% "\hoffset" and "\voffset" as described in {\em The \TeX
% book}, p.\,251, or use the facilities of your "DVI" translator.
%
% \DescribeMacro{\cropwidth}
% \DescribeMacro{\cropgap}
% "\cropwidth" and "\cropgap" define the thickness of
% the rules used for drawing crop marks and the gap by which crop marks
% don't cross; as before, if you change either, do so before using
% the "\cropsetup" macro.
%
% If, for example, you want your text to have a back margin,
% for two-sided printing, but
% you don't want crop marks, just set "\cropwidth=0pt".
%
% \subsection{Endnotes}
%
% \DescribeMacro{\doendnotes}
% \DescribeMacro{\endprint}
% \label{doendnotes}\relax
% "\doendnotes" closes the ".end" file that contains
% the text of the endnotes, if it's open, and
% prints one series of endnotes, as specifed by a series-letter
% argument, e.g., "\doendnotes{A}". "\endprint" is the
% macro that's called to print each note. It uses
% "\notenumfont", "\select@lemmafont", and
% "\notefontsetup" to select fonts, just as the footnote
% macros do (see p.\,\pageref{notefonts} above).
%
% \DescribeMacro{\noendnotes}
% If you aren't going to have any endnotes, you can say "\noendnotes"
% in your file, before the first "\beginnumbering", to suppress the
% generation of an unneeded ".end" file.
%
% \subsection{Cross referencing}
% \label{crossref}\relax
% "EDMAC" provides a simple cross-referencing facility that allows
% you to mark places in the text with labels, and generate page and
% line number references to those places elsewhere in the text using
% those labels.
%
% \DescribeMacro{\label}
% First you place a label in the text using the command
% "\label{foo}". ``"foo"'' can be almost anything you like, including
% letters, numbers, punctuation, or a combination---anything but spaces;
% you might say "\label{toves-3}", for example.\footnote{More precisely,
% you should stick to characters in the \TeX\ categories of ``letter''
% and ``other''.}
%
% \DescribeMacro{\pageref}
% \DescribeMacro{\lineref}
% \DescribeMacro{\sublineref}
% Elsewhere in the text, either before or after the "\label",
% you can refer to its location by saying "\pageref{foo}", or
% "\lineref{foo}", or "\sublineref{foo}". These commands
% will produce, respectively, the page, line and sub-line on which
% the "\label{foo}" command occurred.
%
% A "\label" command may appear in the main text, or in the
% first argument of "\text", but not in the apparatus itself.  But
% "\pageref", "\lineref" and "\sublineref" commands can also be used in
% the apparatus to refer to "\label"s in the text.
%
% The "\label" command works by writing macros to an ".aux"
% file (which will only be created if you are actually using
% some of these commands). Clearly, then, you will need to process
% your document through \TeX\ twice in order for the references to
% be resolved.
%
% You will be warned if you say "\label{foo}" and "foo"
% has been used as a label before. The "ref" commands will
% return references to the last place in the file marked with this
% label. You will also be warned if a reference is made to an
% undefined label. (This will also happen the first time you
% process a document after adding a new "\label" command: the
% auxiliary file will not have been updated yet.)
%
% If you want to refer to a word inside a
% \verb"\text{...}/" command, the "\label" should be defined inside
% the first argument, e.g.,
% \begin{verbatim}
%   The \text{creature\label{elephant} was quite
%     unafraid}\Afootnote{Of the mouse, that is.}/
% \end{verbatim}
%
% \DescribeMacro{\xpageref}
% \DescribeMacro{\xlineref}
% \DescribeMacro{\xsublineref}
% However, there are situations in which you'll want "EDMAC" to
% return a number without displaying any
% warning messages about undefined labels or the like: if you want to
% use the reference in a context where \TeX\ is looking for a
% number, such a warning will lead to a complaint that the number
% is missing. This is the case for references used within the
% argument to "\linenum", for example. For this situation,
% three variants of the reference commands, with the "x"
% prefix, are supplied: "\xpageref", "\xlineref", and "\xsublineref".
% The only operations they perform are ones
% that \TeX\ can do in its ``mouth''. They have these limitations:
% they will not tell you if the label is undefined, and they must
% be preceded in the file by at least one of the four other
% cross-reference commands---e.g., a "\label{foo}" command,
% even if you never refer to that label---since those commands can all
% do the necessary processing of the ".aux" file, and these
% cannot.
%
% \DescribeMacro{\xxref}
% The macros "\xxref" and "\makelabel" let you manipulate numbers
% and labels in ways which you may find helpful in tricky
% situations.
%
% The "\xxref" command generates a reference to a sequence of
% lines, for use in the second argument of "\text".
% It takes two arguments, both of which are
% labels: e.g., "\xxref{mouse}{elephant}".  It calls "\linenum"
% (q.v., p.\,\pageref{linenum} above) and sets the beginning page,
% line, and sub-line numbers to those of the place where
% "\label{mouse}" was placed, and the ending numbers to those where
% "\label{elephant}" occurs.
%
% \DescribeMacro{\makelabel}
% Sometimes the "\label" command cannot be used to specify exactly
% the page and line desired---for example, if you want to refer to a
% page and line number in another volume of your edition.  In such
% cases, you can use the "\makelabel" macro so that you can ``roll
% your own'' label.  For example, if you say
% ``"\makelabel{elephant}{10|25|0}"'' you will have created a new
% label, and a later call to "\pageref{elephant}" would print
% ``10'' and "\lineref{elephant}" would print ``25''. The sub-line
% number here is zero.  It is usually best to collect your
% "\makelabel" statements near the top of your document, so that
% you can see them at a glance.
%
% \subsection{Miscellaneous}
%
% Generally, you should set the "\vsize" and "\hsize" of you
% document at the top, before any "EDMAC" commands are issued,
% since "EDMAC" uses these values to work out some things, like
% crop marks and footnote spacing.  As {\em The \TeX book\/} says
% (p.\,251), ``It's best not to monkey with "\hsize" and "\vsize"
% except at the very beginning of a job\ldots''.
%
% Any changes you make to "\leftskip" or "\rightskip" will apply to
% the main body text, but not to the footnotes.  This is how you
% can get a narrow-set text on a wider base of notes, a common
% style for critical editions.  Footnote material is always set
% "\hsize" wide.
%
% \DescribeMacro{\extensionchars}
% When "EDMAC" assembles the name of the auxiliary file for a
% section, it prefixes "\extensionchars" to the section number.
% This is initially defined to be empty, but you can add some characters to
% help distinguish these files if you like; what you use is likely
% to be system-dependent. If, for example, you said
% "\def\extensionchars{!}", then you would get temporary
% files called "jobname.!1", "jobname.!2", etc.
%
% \subsection{Known bugs}
%
% The \PlainTeX{} "\footnote" command will work only within
% unnumbered text; within numbered text it will wreak havoc.
% In general, "EDMAC"'s system for adding marginal line numbers
% breaks anything that makes direct use of the \TeX{} insert system.
%
% "\parshape" cannot be used within numbered text, except in a
% very restricted way (see p.\,\pageref{parshape}).
%
% \DescribeMacro{\ballast}
% \label{ballastdesc}\relax
% "EDMAC" is a three-pass system, but even after a document has
% been processed three times, there are some tricky situations in
% which the page breaks decided by \TeX\ never settle down.  At
% each successive run of \TeX, "EDMAC" oscillates between two
% different sets of page decisions.  To stop this happening, should
% it arise, Wayne Sullivan\index{Sullivan, Wayne} suggested the
% inclusion of the quantity "\ballast".  The amount of "\ballast"
% will be subtracted from the penalties which apply to the page
% breaks calculated on the {\em previous\/} run through \TeX, thus
% reinforcing these breaks.  So if you find your page breaks
% oscillating, say "\ballast=100" or some such figure, and with any
% luck the page breaks will settle down.  Luckily, this problem
% doesn't crop up at all often.
%
% The restriction on explicit line-breaking in paragraphed footnotes,
% mentioned in footnote \ref{nobreaks}, p.\,\pageref{nobreaks}, and
% described in more detail on p.\,\pageref{nobreaks-detail}, really is a
% nuisance if that's something you need to do.  There are some possible
% solutions, described by Michael Downes\index{Downes, Michael},
% but this area remains unsatisfactory.
%
% Help, suggestions and corrections will be gratefully received.
%
%
% \StopEventually{%
% \addcontentsline{toc}{section}{\protect\numberline{B}Index}
% \PrintIndex
% ^^A \addtocontents{toc}{\protect\end{multicols}}
% }
%
% \section{Implementation overview}\label{overview}
%
% We present the "EDMAC" code in roughly the order in which it's used
% during a run of \TeX. The order is {\em exactly\/} that in which
% it's read when you load the "EDMAC" package, because the same file
% is used to generate this book and to generate the \TeX{} input
% file. Most of what follows consists of macro definitions, but there
% are some \TeX{} commands that are executed immediately---especially
% at the start of the code. The documentation generally describes the
% code from the point of view of what happens when the macros are
% executed, though. As each macro is introduced, its name is printed
% in the margin.
%
% We begin with the commands you use to start and
% stop line numbering in a section of text (Section~\ref{preliminaries}).
% Next comes the machinery for writing and reading the auxiliary file for
% each section that helps us count lines, and for creating list macros
% encoding the information from that file (Section~\ref{lineation}); this
% auxiliary file will be read at the start of each section, to create
% those list macros, and a new version of the file will be started to
% collect information from the body of the section.
%
% Next are commands for marking sections of
% the text for footnotes (Section~\ref{text}), followed by the macros
% that take each paragraph apart, attach the line numbers and insertions,
% and send the result to the vertical list (Section~\ref{paragraph}). The
% footnote commands (Section~\ref{footnotes}) and output routine
% (Section~\ref{output}) finish the main part of the processing;
% cross-referencing (Section~\ref{xref}) and endnotes
% (Section~\ref{endnotes}) complete the story.
%
% In what follows, macros with an @ in their name are more internal
% to the workings of "EDMAC" than those made up just of
% ordinary letters, just as in \PlainTeX\ (see {\em The \TeX
% book}, p.\,344).  You are meant to be able to make free with
% ordinary macros, but the ``@'' ones should be treated with more
% respect, and changed only if you are pretty sure of what you are
% doing.
%
%
% \section{Preliminaries}
% \label{preliminaries}\relax
%
% When this file is loaded by \TeX, it makes a check, before
% anything else is done, for whether this set of macros has
% already been loaded before. If it has, this file exits without
% being read further; if it hasn't, some informative messages
% are printed.
%
%    \begin{macrocode}
\ifx\edmacloaded\relax\endinput\else\let\edmacloaded=\relax\fi
{\newlinechar=`\^^J
\message{^^J
 ********************************************************************^^J
 EDMAC Critical edition macros.^^J
 Copyright (C) 1990--1996 John Lavagnino and Dominik Wujastyk.^^J
 This is free software, and you are welcome to redistribute it under^^J
 certain conditions; see the accompanying file COPYING for details.^^J
 ^^J%
\fileversion\space\space\space <\filedate>.^^J
 ********************************************************************^^J^^J }}
%    \end{macrocode}
%
% \begin{macro}{\makeatletter}
% \begin{macro}{\makeatother}
% You can't normally use @ signs within \TeX{} macro names. We
% define macros that allow you to turn this capability on and off;
% and then we turn it on for the time being, since this file
% will use and define many macros with @ signs in their names.
%    \begin{macrocode}
\def\makeatletter{\catcode`\@=11 }
\def\makeatother{\catcode`\@=12 }
\makeatletter
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@tempcnta}
% \begin{macro}{\@tempcntb}
% In imitation of \LaTeX, we create a couple of scratch counters,
% "\@tempcnta" and "\@tempcntb", that we can
% use like "\count255" (see {\em The \TeX book}, p.\,122).
%    \begin{macrocode}
\newcount\@tempcnta \newcount\@tempcntb
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\edmac@warning}
% "EDMAC" will sometimes want to warn you about what's going
% on by writing to your terminal and log file; that operation
% is handled by the "\edmac@warning" macro.
%    \begin{macrocode}
\def\edmac@warning#1{\immediate\write\sixt@@n{EDMAC warning: #1}}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Sectioning commands}
%
% \begin{macro}{\section@num}
% You use "\beginnumbering" and "\endnumbering" to begin
% and end a line-numbered section of the text; the pair of commands may
% be used as many times as you like within one document to start
% and end multiple, separately line-numbered sections. \TeX\ will
% maintain and display a ``section number'' as a counter named
% "\section@num" that counts how many
% "\beginnumbering" and "\resumenumbering"
% commands have appeared; it needn't be
% related to the logical divisions of your text.
%
% \begin{macro}{\extensionchars}
% Each section will read and write an associated ``line-list
% file'', containing information used to do the numbering; the file
% will be called \meta{jobname}"."\meta{nn}, where {\it nn\/} is the
% section number. However, you may direct that
% an extra string be added before the
% {\it nn\/} in that filename, in order to distinguish these
% temporary files from others: that string is called
% "\extensionchars". Initially it's empty, since different
% operating systems have greatly varying ideas about what
% characters are permitted in file names.  So
% "\def\extensionchars{-}" gives temporary files called
% "jobname.-1", "jobname.-2", etc.
%    \begin{macrocode}
\newcount\section@num
\section@num=0
\let\extensionchars=\empty
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ifnumbering}
% \begin{macro}{\numberingtrue}
% \begin{macro}{\numberingfalse}
% The "\ifnumbering" flag is
% set to "true" if we're within a numbered section (that is, between
% "\beginnumbering" and "\endnumbering"). You can use "\ifnumbering"
% in your own code to check whether you're in a numbered section, but
% don't change the flag's value.
%    \begin{macrocode}
\newif\ifnumbering
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\beginnumbering}
% "\beginnumbering" begins a section of numbered text.
% When it's executed we increment the section number,
% initialize our counters, send a message to your terminal, and
% call macros to start the lineation machinery and endnote files.
%
% The initializations here are trickier than they look.
% "\line@list@stuff" will use all of the counters
% that are zeroed here when it assembles
% the line-list and other lists of information about the lineation.
% But it will do all of this locally and
% within a group, and when it's done the
% lists will remain but the counters will return to zero. Those same
% counters will then be used as we process the text of this section,
% but the assignments will be made globally. These initializations
% actually apply to both uses, though in all other respects there
% should be no direct interaction between the use of these counters
% and variables in the two processing steps.
%    \begin{macrocode}
\def\beginnumbering{%
  \ifnumbering
     \errmessage{Numbering has already been started}%
     \endnumbering
  \fi
  \global\numberingtrue
  \global\advance\section@num by 1
  \global\absline@num=0
  \global\line@num=0
  \global\subline@num=0
  \global\@lock=0
  \global\sub@lock=0
  \global\sublines@false
  \global\let\next@page@num=\relax
  \global\let\sub@change=\relax
  \message{Section \the\section@num }%
  \line@list@stuff{\jobname.\extensionchars\the\section@num}%
  \end@stuff}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\endnumbering}
% "\endnumbering" must follow the last text for a numbered section.
% It takes care of notifying you when changes have been noted in the
% input that require running the file through again to move everything
% to the right place.
%    \begin{macrocode}
\def\endnumbering{%
  \ifnumbering
    \global\numberingfalse
    \normal@pars
    \ifx\insertlines@list\empty\else
      \global\noteschanged@true
    \fi
    \ifx\line@list\empty\else
      \global\noteschanged@true
    \fi
    \ifnoteschanged@
      \immediate\write\sixt@@n{EDMAC reminder: }%
      \immediate\write\sixt@@n{ The number of footnotes in this section
                                has changed since the last run.}%
      \immediate\write\sixt@@n{ You will need to run TeX two more times
                                before the footnote placement}%
      \immediate\write\sixt@@n{ and line numbering in this section are
                                correct.}%
    \fi
  \else
    \errmessage{Numbering was not started}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pausenumbering}
% \begin{macro}{\resumenumbering}
% The "\pausenumbering" macro is just the same as
% "\endnumbering", but with the "\ifnumbering" flag set to "true", to
% show that numbering continues across the gap.\footnote{Our thanks
% to Wayne Sullivan,\index{Sullivan, Wayne} who suggested the idea
% behind these macros.}
%    \begin{macrocode}
\def\pausenumbering{\endnumbering\global\numberingtrue}
%    \end{macrocode}
% The "\resumenumbering" macro is a bit more involved, but not much.
% It does most of the same things as "\beginnumbering", but
% without resetting the various counters. Note that no check is made
% by "\resumenumbering" to ensure that "\pausenumbering" was actually
% invoked.
%    \begin{macrocode}
\def\resumenumbering{%
  \ifnumbering
     \global\advance\section@num by 1
     \message{Section \the\section@num\space
                               (continuing the previous section)}%
     \line@list@stuff{\jobname.\extensionchars\the\section@num}%
     \end@stuff
  \else
     \errmessage{Numbering should already have been started.}%
     \endnumbering
     \beginnumbering
  \fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \section{Line counting}
% \label{lineation}\relax
%
% \subsection{Choosing the system of lineation}
%
% Sometimes you want line numbers that start at $1$ at the top of each
% page; other times you want line numbers that start at $1$ at the start
% of each section and increase regardless of page breaks.
% "EDMAC" can do it either way, and you can switch from one to the
% other within one work.
% But you have to choose one or the other for all line numbers and
% line references within each section. Here we will define
% internal codes for these systems and the macros you use to select them.
%
% \begin{macro}{\ifbypage@}
% \begin{macro}{\bypage@true}
% \begin{macro}{\bypage@false}
% The "\ifbypage@" flag specifies the current lineation
% system: "true" for line-of-section, "false" for line-of-page.
% "EDMAC" will use the line-of-section system unless instructed otherwise.
%    \begin{macrocode}
\newif\ifbypage@
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lineation}
% "\lineation" is the macro you use to select the lineation system.
% Its argument is a string: either "page" or "section".
%    \begin{macrocode}
\def\lineation#1{{%
  \ifnumbering
    \errmessage{You can't use \string\lineation\space
                          within a numbered section}%
  \else
    \def\@tempa{#1}\def\@tempb{page}%
    \ifx\@tempa\@tempb
        \global\bypage@true
    \else
       \def\@tempb{section}%
       \ifx\@tempa\@tempb
           \global\bypage@false
       \else
           \edmac@warning{Bad \string\lineation\space argument.}%
       \fi
    \fi
  \fi}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\linenummargin}
% \begin{macro}{\line@margin}
% You call "\linenummargin" to specify which margin you want your
% line numbers in; it takes one argument, a string.
% You can put the line numbers in the same margin on every page using
% "left" or "right"; or you can use "inner" or
% "outer" to get them in the inner or outer margins. (These last
% two options assume that even-numbered pages will be on the
% left-hand side of every opening in your book.)
% You can change this within a numbered section, but the
% change may not take effect just when you'd like; if it's done between
% paragraphs nothing surprising should happen.
%
% The selection is recorded in "\line@margin":
% $0$ for left, $1$ for right, $2$ for outer, and $3$ for inner.
%    \begin{macrocode}
\newcount\line@margin
\def\linenummargin#1{{%
  \def\@tempa{#1}\def\@tempb{left}%
  \ifx\@tempa\@tempb
      \global\line@margin=0
  \else
     \def\@tempb{right}%
     \ifx\@tempa\@tempb
         \global\line@margin=1
     \else
       \def\@tempb{outer}%
       \ifx\@tempa\@tempb
           \global\line@margin=2
       \else
         \def\@tempb{inner}%
         \ifx\@tempa\@tempb
             \global\line@margin=3
         \else
             \edmac@warning{Bad \string\linenummargin\space argument.}%
         \fi
       \fi
     \fi
  \fi}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\firstlinenum}
% \begin{macro}{\linenumincrement}
% The following parameters tell "EDMAC" which lines should be
% printed with line numbers. "\firstlinenum" is the number of the
% first line in each section that gets a number;
% "\linenumincrement"
% is the difference between successive numbered lines. The initial
% values of these counters produce labels on lines $5$, $10$, $15$, etc.
% "\linenumincrement" must be at least $1$.
%    \begin{macrocode}
\newcount\firstlinenum
\newcount\linenumincrement
\firstlinenum=5
\linenumincrement=5
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\firstsublinenum}
% \begin{macro}{\sublinenumincrement}
% The following parameters are just like "\firstlinenum" and
% "\linenumincrement", but for sub-line numbers.
% "\sublinenumincrement" must be at least $1$.
%    \begin{macrocode}
\newcount\firstsublinenum
\newcount\sublinenumincrement
\firstsublinenum=5
\sublinenumincrement=5
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lockdisp}
% \begin{macro}{\lock@disp}
% When line locking is being used, the "\lockdisp" macro
% specifies whether a line number---if one is due to
% appear---should be printed on the first printed line or on the
% last, or by all of them. Its argument is a word, either
% "first", "last", or "all".  Initially, it is set to "first".
%
% "\lock@disp" encodes the selection: $0$ for first, $1$ for last,
% $2$ for all.
%    \begin{macrocode}
\newcount\lock@disp
\def\lockdisp#1{{%
  \def\@tempa{#1}\def\@tempb{first}%
  \ifx\@tempa\@tempb
      \global\lock@disp=0
  \else
     \def\@tempb{last}%
     \ifx\@tempa\@tempb
         \global\lock@disp=1
     \else
       \def\@tempb{all}%
       \ifx\@tempa\@tempb
           \global\lock@disp=2
       \else
           \edmac@warning{Bad \string\lockdisp\space argument.}%
       \fi
     \fi
  \fi}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\sublockdisp}
% \begin{macro}{\sublock@disp}
% The same questions about where to print the line number apply to
% sub-lines, and these are the analogous macros for dealing with
% the problem.
%    \begin{macrocode}
\newcount\sublock@disp
\def\sublockdisp#1{{%
  \def\@tempa{#1}\def\@tempb{first}%
  \ifx\@tempa\@tempb
      \global\sublock@disp=0
  \else
     \def\@tempb{last}%
     \ifx\@tempa\@tempb
         \global\sublock@disp=1
     \else
       \def\@tempb{all}%
       \ifx\@tempa\@tempb
           \global\sublock@disp=2
       \else
           \edmac@warning{Bad \string\sublockdisp\space argument.}%
       \fi
     \fi
  \fi}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\leftlinenum}
% \begin{macro}{\rightlinenum}
% \begin{macro}{\linenumsep}
% \begin{macro}{\numlabfont}
% "\leftlinenum" and "\rightlinenum" are the macros that are
% called to print marginal line numbers on
% a page, for left- and right-hand margins respectively.
% They're made easy to access and change, since you may
% often want to change the styling in some way. These standard versions
% illustrate the general sort of thing that will be needed; they're
% based on the "\leftheadline" macro in {\em The \TeX book}, p.\,416.
%
% Whatever these macros output gets printed in a box that will be
% put into the appropriate margin without any space between it and the
% line of text. You'll generally want a kern between a line number and
% the text, and "\linenumsep" is provided as a standard way of
% storing its size. Line numbers are usually printed in a smaller
% font, and "\numlabfont" is provided as a standard name for that
% font. When called, these macros
% will be executed within a group, so font changes and the like will
% remain local.
%    \begin{macrocode}
\newdimen\linenumsep
\linenumsep=1pc
\ifx\selectfont\undefined
  \let\numlabfont=\sevenrm
\else
  \def\numlabfont{\fontsize{7}{8pt}\rm}
\fi
\def\leftlinenum{\numlabfont\the\line@num
             \ifsublines@
               \ifnum\subline@num>0
                    \unskip\fullstop\the\subline@num
               \fi
             \fi
             \kern\linenumsep}
\def\rightlinenum{\kern\linenumsep \numlabfont\the\line@num
             \ifsublines@
               \ifnum\subline@num>0
                    \unskip\fullstop\the\subline@num
               \fi
             \fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{List macros}
%
% We will make heavy use of lists of information, which will be built
% up and taken apart by the following macros; they are
% adapted from {\em The \TeX book}, pp.\,378--379, which discusses
% their use in more detail.
%
% These macros consume a large amount of the run-time of this code.
% We intend to replace them in a future version, and in anticipation
% of doing so have defined their interface in such a way that it is
% not sensitive to details of the underlying code.
%
% \begin{macro}{\list@create}
% The "\list@create" macro creates a new list. In this version of
% "EDMAC" this macro doesn't do anything beyond initializing an empty
% list macro, but in future versions it will do more.
%    \begin{macrocode}
\def\list@create#1{\global\let#1=\empty}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\list@clear}
% The "\list@clear" macro just initializes a list to the empty list;
% in this version of "EDMAC" it is no different from
% "\list@create".
%    \begin{macrocode}
\def\list@clear#1{\global\let#1=\empty}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xright@appenditem}
% \begin{macro}{\@toksa}
% \begin{macro}{\@toksb}
% "\xright@appenditem" expands an item and appends it to the right
% end of a list macro. We want the expansion because we'll often
% be using this to store the current value of a counter.
% It creates global control sequences, like "\xdef", and uses two
% temporary token-list registers, "\@toksa" and "\@toksb".
%    \begin{macrocode}
\newtoks\@toksa \newtoks\@toksb
\global\@toksa={\\}
\long\def\xright@appenditem#1\to#2{%
  \global\@toksb=\expandafter{#2}%
  \xdef#2{\the\@toksb\the\@toksa\expandafter{#1}}%
  \global\@toksb={}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\xleft@appenditem}
% "\xleft@appenditem" expands an item and appends it to the left
% end of a list macro; it is otherwise identical to
% "\xright@appenditem".
%    \begin{macrocode}
\long\def\xleft@appenditem#1\to#2{%
  \global\@toksb=\expandafter{#2}%
  \xdef#2{\the\@toksa\expandafter{#1}\the\@toksb}%
  \global\@toksb={}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\gl@p}
% The "\gl@p" macro removes the leftmost
% item from a list and places it in a
% control sequence. You say "\gl@p\l\to\z"
% (where "\l" is the list macro, and
% "\z" receives the left item). "\l" is assumed nonempty: say
% "\ifx\l\empty" to test for an empty "\l". The control
% sequences created by "\gl@p" are all global.
%    \begin{macrocode}
\def\gl@p#1\to#2{\expandafter\gl@poff#1\gl@poff#1#2}
\long\def\gl@poff\\#1#2\gl@poff#3#4{\gdef#4{#1}\gdef#3{#2}}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Line-number counters and lists}
%
% Footnote references using line numbers rather than symbols can't be
% generated in one pass, because we don't know the line numbers till we
% ship out the pages. It would be possible if footnotes were never keyed
% to more than one line; but some footnotes gloss passages that may run
% for several lines, and they must be tied to the first line of the
% passage glossed. And even one-line passages require two passes if we
% want line-per-page numbering rather than line-per-section numbering.
%
% So we run \TeX\ over the text several times, and each time save
% information about page and line numbers in a ``line-list file'' to
% be used during the next pass. At the start of each section---whenever
% "\beginnumbering" is executed---the line-list file
% for that section
% is read, and the information from it is encoded into a few list
% macros.
%
% We need first to define the different line numbers that are involved
% in these macros, and the associated counters.
%
% \begin{macro}{\line@num}
% The "\line@num" counter stores the line number that's used in
% marginal line numbering and in notes: counting either from the start of
% the page or from the start of the section, depending on your
% choice for this section. This may be qualified by "\subline@num".
%    \begin{macrocode}
\newcount\line@num
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\subline@num}
% The "\subline@num" counter stores
% a sub-line number that qualifies "\line@num". For example,
% line $10$ might have sub-line numbers $1$, $2$ and $3$, which might be
% printed as lines $10.1$, $10.2$, $10.3$.
%    \begin{macrocode}
\newcount\subline@num
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifsublines@}
% \begin{macro}{\sublines@true}
% \begin{macro}{\sublines@false}
% We maintain an associated flag, "\ifsublines@",
% to tell us whether we're within
% a sub-line range or not.
%
% You may wonder why we don't just use the value of "\subline@num"
% to determine this---treating anything greater than $0$ as an
% indication that sub-lineation is on. We need a separate flag because
% sub-lineation can be used together with line-number locking in odd
% ways: several pieces of a logical line might be interrupted by
% pieces of sub-lineated text, and those sub-line numbers should not
% return to zero until the next change in the major line number. This
% is common in the typesetting of English Renaissance verse
% drama\index{Middleton, Thomas}, in which stage directions are
% given sub-line numbers: a single line of verse may be
% interrupted by several stage directions.
%    \begin{macrocode}
\newif\ifsublines@
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\absline@num}
% The "\absline@num" counter stores the
% absolute number of lines since the start
% of the section: that is, the number we've actually printed, no matter
% what numbers we attached to them.
% This value is never printed on an output page, though
% "\line@num" will often be equal to it. It is used internally to
% keep track of where notes are to appear and where new
% pages start: using this value rather than "\line@num" is a lot
% simpler, because it doesn't depend on the lineation system in use.
%    \begin{macrocode}
\newcount\absline@num
%    \end{macrocode}
% \end{macro}
%
% We'll be calling "\absline@num" numbers ``absolute'' numbers, and
% "\line@num" and "\subline@num" numbers ``visible'' numbers.
%
% \begin{macro}{\@lock}
% \begin{macro}{\sub@lock}
% The "\@lock" and "\sub@lock" counters
% tell us the state of line-number
% and sub-line-number locking. $0$ means we're not within a locked set of
% lines; $1$ means we're at the first line in the set; $2$, at some
% intermediate line; and $3$, at the last line.
%    \begin{macrocode}
\newcount\@lock
\newcount\sub@lock
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\line@list}
% \begin{macro}{\insertlines@list}
% \begin{macro}{\actionlines@list}
% \begin{macro}{\actions@list}
% Now we can define the list macros that will be created from the
% line-list file.  We will maintain the following lists:
% \begin{itemize}\addtolength{\itemsep}{-1ex}
% \item "\line@list": the page and line numbers for every
% lemma marked by "\text".
% There are seven pieces of information, separated by vertical bars:
% \label{linenumbers}
% \begin{enumerate}\addtolength{\itemsep}{-1ex}
% \item the starting page,
% \item line, and
% \item sub-line numbers, followed by the
% \item ending page,
% \item line, and
% \item sub-line numbers, and then the
% \item font specifier for the lemma.
% \end{enumerate}
% These line numbers are all visible numbers.  Thus a lemma that
% started on page $23$, line $35$ and
% went on until page $24$, line $3$
% (with no sub-line numbering), and was typeset in a font from
% "\fam0" would have a line list entry like this:
% "23|35|0|24|3|0|0". That assumes the use of the Plain font selection
% scheme, which uses the family number as its font specifier. When
% NFSS is used, the font specifier is a set of four codes for
% font encoding,
% family, series, and shape, separated by "/" characters; in that
% case, the line-list entry would be
% "23|35|0|24|3|0|OT1/cmr/m/n".
%
% There is one item in this list for every lemma marked by
% "\text", even if there are several notes to that lemma, or no
% notes at all. "\text" reads the data in this list, making it
% available for use in the text of notes.
%
% \item "\insertlines@list": the line numbers of lines that have
% footnotes or other insertions.
% These are the absolute numbers where the corresponding
% lemmas begin. This list contains one entry for every footnote in the
% section; one lemma may contribute no footnotes or many footnotes.
% This list is used by "\add@inserts" within "\do@line", to tell
% it where to insert notes.
%
% \item "\actionlines@list": a list of absolute line numbers at
% which we are to perform special
% actions; these actions are specified by the "\actions@list" list
% defined below.
%
% \item "\actions@list": action codes corresponding to the line
% numbers in "\actionlines@list". These codes tell "EDMAC" what action
% it's supposed to take at each of these lines. One action, the
% page-start action, is generated behind the scenes by "EDMAC" itself;
% the others, for specifying sub-lineation, line-number locking, and
% line-number alteration, are generated only by explicit commands in
% your input file. The page-start and line-number-alteration actions
% require arguments, to specify the new values for the page or line
% numbers; instead of storing those arguments in another list, we have
% chosen the action-code values so that they can encode both the action
% and the argument in these cases. Action codes greater than $-1000$
% are page-start actions, and the code value is the page number; action
% codes less than $-5000$ specify line numbers, and the code value is
% a transformed version of the line number; action codes between these
% two values specify other actions which require no argument.
%
% Here is the full list of action codes and their meanings:
%
% Any number greater than $-1000$ is a page-start action: the line number
% associated with it is the first line on a page, and the action number is
% the page number. (The cutoff of $-1000$ is chosen because negative
% page-number values are used by some macro packages; we assume that
% page-number values less than $-1000$ are not common.)
% Page-start action codes are added to the list by
% the "\page@action" macro, which is (indirectly) triggered by the
% workings of the "\page@start" macro; that macro should always be
% called in the output routine, just before the page contents are
% assembled. "EDMAC" calls it in "\pagecontents".
%
% The action code $-1001$ specifies the start of sub-lineation: meaning
% that, starting with the next line, we should be advancing
% "\subline@num" at each start-of-line command, rather than
% "\line@num".
%
% The action code $-1002$ specifies the end of sub-lineation. At the
% next start-of-line, we should clear the sub-line counter and start
% advancing the line number. The action codes for starting and ending
% sub-lineation are added to the list by the "\sub@action" macro, as
% called to implement the "\startsub" and "\endsub" macros.
%
% The action code $-1003$ specifies the start of line number locking.
% After the number for the current line is computed, it will remain
% at that value through the next line that has an action code to end
% locking.
%
% The action code $-1004$ specifies the end of line number locking.
%
% The action code $-1005$ specifies the start of sub-line number locking.
% After the number for the current sub-line is computed, it will remain
% at that value through the next sub-line that has an action code to end
% locking.
%
% The action code $-1006$ specifies the end of sub-line number locking.
%
% The four action codes for line and sub-line number locking are added
% to the list by the "\do@lockon" and "\do@lockoff" macros, as called
% to implement the "\startlock" and "\endlock" macros.
%
% An action code of $-5000$ or less sets the current visible line
% number (either the line number or the sub-line number, whichever is
% currently being advanced) to a specific positive value. The value of
% the code is $-(5000+n)$, where $n$ is the value (always $\ge 0$)
% assigned to the current line number. Action codes of this type are
% added to the list by the "\set@line@action" macro, as called to
% implement the "\advanceline" and "\setline" macros: this action only
% occurs when the user has specified some change to the line numbers
% using those macros. Normally "EDMAC" computes the visible line numbers
% from the absolute line numbers with reference to the other
% action codes and the settings they invoke; it doesn't require an
% entry in the action-code list for every line.
%
% Here are the commands to create these lists:
%
%    \begin{macrocode}
\list@create{\line@list}
\list@create{\insertlines@list}
\list@create{\actionlines@list}
\list@create{\actions@list}
%    \end{macrocode}
%
% \end{itemize}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\page@num}
% \begin{macro}{\endpage@num}
% \begin{macro}{\endline@num}
% \begin{macro}{\endsubline@num}
% We'll need some counters while we read the line-list,
% for the page number and the ending page, line, and sub-line numbers.
% Some of these will be used again later on, when we are acting on the
% data in our list macros.
%    \begin{macrocode}
\newcount\page@num
\newcount\endpage@num
\newcount\endline@num
\newcount\endsubline@num
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ifnoteschanged@}
% \begin{macro}{\noteschanged@true}
% \begin{macro}{\noteschanged@false}
% If the number of footnotes in a section is different from what it was
% during the last run, or if this is the very first time you've run
% \TeX\
% on this file, the information from the line-list used to place the
% notes will be wrong, and some notes will probably be misplaced.
% When this happens, we prefer
% to give a single error message for the whole section rather than
% messages at every point where we notice the problem, because
% we don't really know where in the section notes were added or removed,
% and the solution in any case is simply to run \TeX\ two more times;
% there's no fix needed to the document. The
% "\ifnoteschanged@" flag is set if such
% a change in the number of notes is discovered at any point.
%    \begin{macrocode}
\newif\ifnoteschanged@
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{Reading the line-list file}
%
% \begin{macro}{\read@linelist}
% \begin{macro}{\@inputcheck}
% "\read@linelist" is the control sequence
% that's called by "\beginnumbering"
% (via "\line@list@stuff") to open and process a
% line-list file; its argument is the name of the file, which will
% be opened on stream "\@inputcheck" to check for its existence.
% The first thing we do is initialize all the lists we just
% described.\label{readlinelist}
%    \begin{macrocode}
\newread\@inputcheck
\def\read@linelist#1{%
  \list@clear{\line@list}%
  \list@clear{\insertlines@list}%
  \list@clear{\actionlines@list}%
  \list@clear{\actions@list}%
%    \end{macrocode}
%
% Try to open the line-list file, as a check on whether it exists.
%    \begin{macrocode}
  \openin\@inputcheck=#1
  \ifeof\@inputcheck
    \edmac@warning{Can't find line-list file #1}%
    \global\noteschanged@true
  \else
    \global\noteschanged@false
    \closein\@inputcheck
%    \end{macrocode}
%
% The file's there. We start a new group and make some special
% definitions we'll need to process it: it's a sequence of \TeX\
% commands, but they require a few special settings. We make [ and
% ] become grouping characters: they're used that way in the
% line-list file, because we need to write them out one at a time
% rather than in balanced pairs, and it's easier to just use
% something other than real braces. @ must become a letter, since
% this is run in the ordinary \TeX\ context. We ignore carriage
% returns, since if we're in horizontal mode they can get
% interpreted as spaces to be printed.
%
%    \begin{macrocode}
  \begingroup
     \catcode`\[=1 \catcode`\]=2
     \makeatletter \catcode`\^^M=9
%    \end{macrocode}
%
% Our line, page, and line-locking counters were already zeroed
% by "\line@list@stuff" if this is being called from within
% "\beginnumbering"; sub-lineation will be turned off as well
% in that case. On the other hand,
% if this is being called from "\resumenumbering", those things
% should still have the values they had when "\pausenumbering"
% was executed.
%
% Now, after these preliminaries, we start interpreting the file.
%
%    \begin{macrocode}
     \input #1
  \endgroup
 \fi
%    \end{macrocode}
%
% When the "\input" is done, we're all through with the
% line-list file. All the information we needed
% from it will now be encoded in our list macros.
%
% Finally, we
% initialize the "\next@actionline" and "\next@action" macros,
% which specify where and what the next action to be taken is.
%    \begin{macrocode}
  \global\page@num=-1
  \ifx\actionlines@list\empty
      \gdef\next@actionline{1000000}%
  \else
      \gl@p\actionlines@list\to\next@actionline
      \gl@p\actions@list\to\next@action
  \fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% This version of "\read@linelist" creates list macros
% containing data for the entire section, so they could get rather
% large. It would be no more difficult to read the line-list file
% incrementally rather than all at once: we could read, at the
% start of each paragraph, only the commands relating to that
% paragraph, using "\read". But this would require that we
% have two line-lists open at once, one for reading, one for
% writing, and on systems without version numbers we'd have to do
% some file renaming outside of \TeX{} for that to work. We've
% retained this slower approach to avoid that sort of hacking
% about, but have provided the "\pausenumbering" and
% "\resumenumbering" macros to help you if you run into
% macro memory limitations (see p.\,\pageref{pause} above).
%
% \subsection{Commands within the line-list file}
%
% This section defines the commands that can appear within a
% line-list file. They all have very short names because we are
% likely to be writing very large numbers of them out. One macro,
% "\@l", is especially short, since it will be written to the
% line-list file once for every line of text in a numbered section.
% (Another of these commands, "\@lab", will be introduced in a
% later section, among the cross-referencing commands it is
% associated with.)
%
% When these commands modify the various page and line counters,
% they deliberately do not say "\global". This is because we
% want them to affect only the counter values within the current
% group when nested calls of "\@ref" occur. (The code assumes
% throughout that the value of "\globaldefs" is zero.)
%
% The macros with "action" in their names contain all the code
% that modifies the action-code list: again, this is so that they
% can be turned off easily for nested calls of "\@ref".
%
% \begin{macro}{\@l}
% "\@l" does everything related to the start of a
% new line of numbered text.
%
% First increment the absolute line-number, and perform
% deferred actions relating to page starts and sub-lines.
%    \begin{macrocode}
\def\@l{\advance\absline@num by 1
         \ifx\next@page@num\relax \else
             \page@action
             \let\next@page@num=\relax
         \fi
         \ifx\sub@change\relax \else
            \ifnum\sub@change>0
               \sublines@true
            \else
               \sublines@false
            \fi
            \sub@action
            \let\sub@change=\relax
         \fi
%    \end{macrocode}
%
% Fix the lock counters, if necessary. A value of $1$ is advanced to
% $2$; $3$ advances to $0$; other values are unchanged.
%    \begin{macrocode}
         \ifcase\@lock
            \or
               \@lock=2
            \or \or
               \@lock=0
         \fi
         \ifcase\sub@lock
            \or
               \sub@lock=2
            \or \or
               \sub@lock=0
         \fi
%    \end{macrocode}
%
% Now advance the visible line number, unless it's been locked.
%    \begin{macrocode}
         \ifsublines@
              \ifnum\sub@lock<2
                \advance\subline@num by 1
              \fi
         \else
              \ifnum\@lock<2
                \advance\line@num by 1 \subline@num=0
              \fi
         \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@page}
% "\@page" marks the start of a new output page; its argument is
% the number of that page.
%
% First we reset the visible line numbers, if we're numbering by page,
% and store the page number itself in a counter.
%    \begin{macrocode}
\def\@page#1{\ifbypage@
             \line@num=0 \subline@num=0
           \fi
           \page@num=#1
%    \end{macrocode}
%
% And we set a flag that tells "\@l" that a new page number is
% to be set, because other associated actions shouldn't occur until the
% next line-start occurs.
%    \begin{macrocode}
           \def\next@page@num{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\sub@on}
% \begin{macro}{\sub@off}
% The "\sub@on" and "\sub@off" macros
% turn sub-lineation on and off\/: but not directly, since such changes
% don't really take effect until the next line of text. Instead
% they set a flag that notifies "\@l" of the necessary action.
%    \begin{macrocode}
\def\sub@on{\ifsublines@
     \let\sub@change=\relax
  \else
     \def\sub@change{1}%
  \fi}
\def\sub@off{\ifsublines@
     \def\sub@change{-1}%
  \else
     \let\sub@change=\relax
  \fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@adv}
% The "\@adv" macro advances
% the current visible line number by the amount specified as
% its argument. This is used to implement "\advanceline".
%    \begin{macrocode}
\def\@adv#1{\ifsublines@
       \advance\subline@num by #1
       \ifnum\subline@num<0
          \edmac@warning{\string\advanceline\space produced
              a sub-line number less than zero.}%
          \subline@num=0
       \fi
  \else
       \advance\line@num by #1
       \ifnum\line@num<0
          \edmac@warning{\string\advanceline\space produced
              a line number less than zero.}%
          \line@num=0
       \fi
  \fi
  \set@line@action}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@set}
% The "\@set" macro sets
% the current visible line number to the value specified as
% its argument.  This is used to implement "\setline".
%    \begin{macrocode}
\def\@set#1{\ifsublines@
    \subline@num=#1
  \else
    \line@num=#1
  \fi
  \set@line@action}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\page@action}
% "\page@action"
% adds an entry to the action-code list to change the page number.
%    \begin{macrocode}
\def\page@action{%
  \xright@appenditem{\the\absline@num}\to\actionlines@list
  \xright@appenditem{\next@page@num}\to\actions@list}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\set@line@action}
% "\set@line@action" adds an entry to the action-code
% list to change the visible line number.
%    \begin{macrocode}
\def\set@line@action{%
  \xright@appenditem{\the\absline@num}\to\actionlines@list
  \ifsublines@
       \@tempcnta=-\subline@num
  \else
       \@tempcnta=-\line@num
  \fi
  \advance\@tempcnta by -5000
  \xright@appenditem{\the\@tempcnta}\to\actions@list}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\sub@action}
% "\sub@action"
% adds an entry to the action-code list to turn sub-lineation on or
% off, according to the current value of the "\ifsublines@" flag.
%    \begin{macrocode}
\def\sub@action{%
  \xright@appenditem{\the\absline@num}\to\actionlines@list
  \ifsublines@
      \xright@appenditem{-1001}\to\actions@list
  \else
      \xright@appenditem{-1002}\to\actions@list
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lock@on}
% \begin{macro}{\do@lockon}
% "\lock@on"
% adds an entry to the action-code list to turn line number
% locking on. The current setting of the sub-lineation flag tells us
% whether this applies to line numbers or sub-line numbers.
%
% Adding commands to the action list is slow, and it's very often the
% case that a lock-on command is immediately followed by a lock-off
% command in the line-list file, and therefore really does nothing.
% We use a look-ahead scheme here to detect such pairs, and add nothing
% to the line-list in those cases.
%    \begin{macrocode}
\def\lock@on{\futurelet\next\do@lockon}
\def\do@lockon{%
  \ifx\next\lock@off
     \global\let\lock@off=\skip@lockoff
  \else
     \xright@appenditem{\the\absline@num}\to\actionlines@list
     \ifsublines@
       \xright@appenditem{-1005}\to\actions@list
       \ifcase\sub@lock
          \sub@lock=1
       \else
          \sub@lock=0
       \fi
     \else
       \xright@appenditem{-1003}\to\actions@list
       \ifcase\@lock
          \@lock=1
       \else
          \@lock=0
       \fi
     \fi
  \fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lock@off}
% \begin{macro}{\do@lockoff}
% \begin{macro}{\skip@lockoff}
% "\lock@off" adds an entry to the action-code list
% to turn line number locking off.
%    \begin{macrocode}
\def\do@lockoff{%
  \xright@appenditem{\the\absline@num}\to\actionlines@list
  \ifsublines@
    \xright@appenditem{-1006}\to\actions@list
    \ifnum\sub@lock=2
       \sub@lock=3
    \else
       \sub@lock=0
    \fi
  \else
    \xright@appenditem{-1004}\to\actions@list
    \ifnum\@lock=2
       \@lock=3
    \else
       \@lock=0
    \fi
  \fi}
\def\skip@lockoff{\global\let\lock@off=\do@lockoff}
\global\let\lock@off=\do@lockoff
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@ref}
% \begin{macro}{\insert@count}
% "\@ref"
% marks the start of a passage, for creation of a footnote reference.
% It takes two arguments:
% \begin{itemize}\addtolength{\itemsep}{-1ex}
% \item "#1", the number of entries to add to "\insertlines@list"
% for this reference. \SpecialMainIndex{\insert@count}
% This value, here and within "\text",
% which computes it and writes it to the line-list file,
% will be stored in the "\insert@count" counter.
%    \begin{macrocode}
\newcount\insert@count
%    \end{macrocode}
%
% \item "#2", a sequence of other line-list-file commands, executed to
% determine the ending line-number. (This may also include other
% "\@ref" commands, corresponding to uses of "\text"
% within the first argument of another instance of "\text".)
% \end{itemize}
%
% \begin{macro}{\dummy@ref}
% When nesting of "\@ref" commands does occur, it's necessary to
% temporarily redefine "\@ref" within "\@ref", so that we're only
% doing one of these at a time.
%    \begin{macrocode}
\def\dummy@ref#1#2{#2}
%    \end{macrocode}
% \end{macro}
%
% The first thing "\@ref" itself does is to add the specified number
% of items to the "\insertlines@list" list.
%    \begin{macrocode}
\def\@ref#1#2{%
  \global\insert@count=#1
  \loop\ifnum\insert@count>0
    \xright@appenditem{\the\absline@num}\to\insertlines@list
    \global\advance\insert@count by -1
  \repeat
%    \end{macrocode}
%
% Next, process the second argument to determine the page
% and line numbers for the end of this lemma.
% We temporarily equate "\@ref" to a different macro that just executes
% its argument, so that nested "\@ref" commands are just skipped
% this time. Some other macros need to be temporarily redefined to
% suppress their action.
%    \begin{macrocode}
  \begingroup
    \let\@ref=\dummy@ref
    \let\page@action=\relax
    \let\sub@action=\relax
    \let\set@line@action=\relax
    \let\@lab=\relax
    #2
    \global\endpage@num=\page@num
    \global\endline@num=\line@num
    \global\endsubline@num=\subline@num
  \endgroup
%    \end{macrocode}
%
% Now store all the information about the location of the lemma's
% start and end in "\line@list".
%    \begin{macrocode}
    \xright@appenditem%
      {\the\page@num|\the\line@num|%
       \ifsublines@ \the\subline@num \else 0\fi|%
       \the\endpage@num|\the\endline@num|%
       \ifsublines@ \the\endsubline@num \else 0\fi}\to\line@list
%    \end{macrocode}
%
% Finally, execute the second argument of "\@ref" again,
% to perform for real all the commands within it.
%    \begin{macrocode}
  #2}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Writing to the line-list file}
%
% We've now defined all the counters, lists, and commands involved in
% reading the line-list file at the start of a section. Now we'll
% cover the commands that "EDMAC" uses within the text of a
% section to write commands out to the line-list.
%
% \begin{macro}{\linenum@out}
% The file will be opened on output stream "\linenum@out".
%    \begin{macrocode}
\newwrite\linenum@out
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\iffirst@linenum@out@}
% \begin{macro}{\first@linenum@out@true}
% \begin{macro}{\first@linenum@out@false}
% Once any file is opened on this stream, we keep it open forever, or
% else switch to another file that we keep open. The reason is that
% we want the output routine to write the page number for every page
% to this file; otherwise we'd have to write it at the start of
% every line.
% But it's not very easy for the output routine to tell whether an
% output stream is open or not. There's no way to test the status of
% a particular output stream directly, and
% the asynchronous nature of output routines makes the
% status hard to determine by other means.
%
% We can manage pretty well by means of the "\iffirst@linenum@out@"
% flag; its inelegant name suggests the nature of the problem that
% made its creation necessary. It's set
% to be "true" before any "\linenum@out" file is opened. When such a file
% is opened for the first time, it's done using "\immediate", so that
% it will at once be safe for the output routine to write to it; we then
% set this flag to "false".
%    \begin{macrocode}
\newif\iffirst@linenum@out@
\first@linenum@out@true
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\line@list@stuff}
% The "\line@list@stuff" macro, which
% is called by "\beginnumbering", performs
% all the line-list operations needed at the start of a section.
% Its argument is the name of the line-list file.
%    \begin{macrocode}
\def\line@list@stuff#1{%
%    \end{macrocode}
%
% First, use the commands of the previous section to interpret the
% line-list file from the last run.
%    \begin{macrocode}
  \read@linelist{#1}%
%    \end{macrocode}
%
% Now close the current output line-list file, if any, and open a new one.
% The first time we open a line-list file for output, we do it using
% "\immediate", and clear the "\iffirst@linenum@out@" flag.
%    \begin{macrocode}
  \iffirst@linenum@out@
     \immediate\closeout\linenum@out
     \global\first@linenum@out@false
     \immediate\openout\linenum@out=#1
  \else
%    \end{macrocode}
% If we get here, then this is
% not the first line-list we've seen, so we
% don't open or close the files immediately. We also need to insert
% a "\@page" command, since this might begin in the middle of
% a page.
%    \begin{macrocode}
     \closeout\linenum@out
     \openout\linenum@out=#1
     \page@start
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\new@line}
% The "\new@line" macro sends the "\@l" command to the line-list
% file, to mark the start of a new text line.
%    \begin{macrocode}
\def\new@line{\write\linenum@out{\string\@l}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\flag@start}
% \begin{macro}{\flag@end}
% We enclose a lemma marked by "\text" in
% "\flag@start" and "\flag@end": these send the "\@ref"
% command to the line-list file. "\text" is responsible for
% setting the value of "\insert@count" appropriately; it
% actually gets done by the various footnote macros.
%    \begin{macrocode}
\def\flag@start{%
  \edef\next{\write\linenum@out{%
                  \string\@ref[\the\insert@count][}}%
  \next}
\def\flag@end{\write\linenum@out{]}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\page@start}
% "\page@start" writes a command to the line-list
% file noting the current page number.
% When used within an output routine, this should be called so as to place
% its "\write" within the box that gets shipped out, and as close to
% the top of that box as possible.
%    \begin{macrocode}
\def\page@start{%
  \iffirst@linenum@out@ \else
    \write\linenum@out{\string\@page[\the\pageno]}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\startsub}
% \begin{macro}{\endsub}
% "\startsub" and "\endsub"
% turn sub-lineation on and off, by writing
% appropriate instructions to the line-list file.  When
% sub-lineation is in effect, the line number counter is frozen and
% the sub-line counter advances instead. If one of these commands
% appears in the middle of a line, it doesn't take effect until the
% next line; in other words, a line is counted as a line or
% sub-line depending on what it started out as, even if that
% changes in the middle.
%
% We tinker with "\lastskip" because a command of either sort
% really needs to be attached to the last word preceding the change, not
% the first word that follows the change. This is because sub-lineation
% will often turn on and off in mid-line---stage directions, for example,
% often are mixed with dialogue in that way---and when a line is mixed
% we want to label it using the system that was in effect at its start.
% But when sub-lineation begins at the very start of a line we have a
% problem, if we don't put in this code.
%    \begin{macrocode}
\def\startsub{\dimen0\lastskip
  \ifdim\dimen0>0pt \unskip \fi
  \write\linenum@out{\string\sub@on}%
  \ifdim\dimen0>0pt \hskip\dimen0 \fi}
\def\endsub{\dimen0\lastskip
  \ifdim\dimen0>0pt \unskip \fi
  \write\linenum@out{\string\sub@off}%
  \ifdim\dimen0>0pt \hskip\dimen0 \fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\advanceline}
% You can use "\advanceline"
% in running text to advance the current visible
% line-number by a specified value, positive or negative.
%    \begin{macrocode}
\def\advanceline#1{\write\linenum@out{\string\@adv[#1]}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\setline}
% You can use "\setline"
% in running text to set the current visible
% line-number to a specified positive value.
%    \begin{macrocode}
\def\setline#1{%
  \ifnum#1<0
    \edmac@warning{Bad setline argument.}%
  \else
    \write\linenum@out{\string\@set[#1]}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\startlock}
% \begin{macro}{\endlock}
% You can use "\startlock" or "\endlock"
% in running text to start or end line number locking at
% the current line. They decide whether line numbers or sub-line numbers
% are affected, depending on the current state of the sub-lineation flags.
%    \begin{macrocode}
\def\startlock{\write\linenum@out{\string\lock@on}}
\def\endlock{\write\linenum@out{\string\lock@off}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \section{Marking text for notes}
% \label{text}\relax
%
% The "\text" macro is used to create all footnotes and endnotes,
% as well as to print the portion of the main text to which a given note
% or notes is keyed. The idea is to have that lemma appear only once in
% the ".tex" file: all instances of it in the main text and in the
% notes are copied from that one appearance.
%
% "\text" requires two arguments. At any point within numbered
% text, you use it by saying:
% \begin{verbatim}
%     \text{#1}{#2}/
% \end{verbatim}
% where
% \begin{itemize}\addtolength{\itemsep}{-1ex}
% \item "#1" is the piece of the main text being glossed;
% it gets added to the
% main text, and is also used as a lemma for notes to it.
%
% \item "#2" is a series of subsidiary macros that generate
% various kinds of notes. The "/" after "#2" {\em must\/} appear:
% it marks the end of the macro. ({\em The \TeX{}book},
% p.\,204, points out that when
% additional text to be matched follows the arguments like this, spaces
% following the macro are not skipped, which is very desirable since
% this macro will never be used except within text. Having an
% explicit terminator also helps keep things straight when nested
% calls to "\text" are used.)  Braces around
% "#2" are optional.
% \end{itemize}
%
% The "\text" macro may be used (somewhat) recursively; that
% is, "\text" may be used within its own first argument. The
% code would be much simpler without this feature, but nested notes
% will commonly be necessary: it's quite likely that we'll have an
% explanatory note for a long passage and notes on variants for
% individual words within that passage. The situation we can't
% handle is overlapping notes that aren't nested: for example, one
% note covering lines 10--15, and another covering 12--18. You can
% handle such cases by using the "\lemma" and "\linenum"
% macros within "#2": they alter the copy of the lemma and the
% line numbers that are passed to the notes, and hence allow you to
% overcome any limitations of this system, albeit with extra
% effort.
%
% The recursive operation of "\text" will fail if you try to use a copy
% that is called something other than "\text". In order to handle
% recursion, "\text" needs to redefine its own definition temporarily
% at one point, and that doesn't work if the macro you are calling is
% not actually named "\text". There's no problem as long as "\text"
% is not invoked in the first argument. If you want to call "\text"
% something else, it is best to create instead a macro that expands
% to an invocation of "\text", rather than copying "\text" and giving
% it a new name; otherwise you will need to add an appropriate
% definition for your new macro to "\morenoexpands".
%
% Side effects of our line-numbering code make it impossible to use
% the usual footnote macros directly within a paragraph whose lines are
% numbered (see comments to
% "\do@line", p.\,\pageref{doline}).
% Instead, the appropriate note-generating command
% is appended to the list macro "\inserts@list", and when "\pend"
% completes the paragraph it inserts all the notes at the proper places.
%
% Note that we don't provide previous-note information, although it's
% often wanted; your own macros must handle that. We can't do it
% correctly without keeping track of what kind of notes have gone past:
% it's not just a matter of remembering the line numbers associated with
% the previous invocation of "\text", because that might have been for
% a different kind of note. It is preferable for your footnote macros
% to store and recall this kind of information if they need it.
%
% \label{parallel}An example where some ``memory'' of line numbers
% might be required is where there are several variant readings
% per line of text, and you do not wish the line number to be repeated
% for each lemma in the notes.  After the first occurrence of the line
% number, you might want the symbol ``$\parallel$'' instead of further
% occurrences, for instance.  This can easily be done by a macro like
% "\printlines", if it saves the last value of "\@nums" that {\em it\/}
% saw, and then performs a simple conditional test to see whether to print
% a number or a~``$\parallel$'' (see p.\,\pageref{multinotes} for an
% example of how to do this).
%
% \subsection{{\tt \protect\bslash text} itself}
%
% \begin{macro}{\end@lemmas}
% The various note-generating macros might want to request that
% commands be executed not at once, but in close connection with the
% start or end of the lemma. For example, footnote numbers in the text
% should be connected to the end of the lemma; or, instead of a single
% macro to create a note listing variants, you might want to use
% several macros in series to create individual variants, which would
% each add information to a private macro or token register, which in
% turn would be formatted and output when all of "#2" for the lemma
% has been read.
%
% To accomodate this, we provide a list macro
% to which macros may add commands that should subsequently
% be executed at the end of the lemma when that lemma is added
% to the text of the paragraph. A macro should add its contribution to
% "\end@lemmas" by using "\xleft@appenditem".
% (Anything that needs to be done at
% the {\em start\/} of the lemma may be handled using "\aftergroup", since
% the commands specified within "\text"'s second argument are
% executed within a group that ends just before the lemma is added to
% the main text.)
%
% "\end@lemmas" is intended for the few things that need to be
% associated with the end of the lemma, like footnote numbers. Such
% numbers are not implemented in the current version, and indeed
% no use is currently made of "\end@lemmas" or of the "\aftergroup"
% trick. The general
% approach would be to define a macro to be used within the second
% argument of "\text" that would add the appropriate command to
% "\end@lemmas".
%
% Commands that are added to this list should always take care
% not to do anything that adds possible line-breaks to the output;
% otherwise line numbering could be thrown off.
%    \begin{macrocode}
\list@create{\end@lemmas}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\dummy@text}
% We now need to define a number of macros that allow us to weed out
% nested instances of "\text", and other problematic macros, from
% our lemma. This is similar to what we did in reading the line-list
% file using "\dummy@ref" and various redefinitions---and that's
% because nested "\text" macros create nested "\@ref" entries
% in the line-list file.
%
% Here's a macro that takes the same arguments as
% "\text" but merely returns the first argument and ignores
% the second.
%    \begin{macrocode}
\long\def\dummy@text#1#2/{#1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@gobble}
% We're going to need another macro that takes one argument and ignores
% it entirely. This one is identical to the \LaTeX{} macro of the same
% name.
%    \begin{macrocode}
\def\@gobble#1{}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\no@expands}
% \begin{macro}{\morenoexpands}
% We need to turn off macro expansion for certain sorts of macros we're
% likely to see within the lemma and within the notes.
%
% The first class is font-changing macros. We suppress expansion for
% them by letting them become equal to zero.\footnote{Since ``control
% sequences equivalent to characters are not expandable''---{\em The
% \TeX book\/}, answer to Exercise 20.14.} This is done because we want to
% pass into our notes the generic commands to change to roman or
% whatever, and not their expansions that will ask for a particular style at
% a specified size.  The notes may well be in a smaller font, so the
% command should be expanded later, when the note's environment is in
% effect.
%
% A second sort to turn off includes a few of the accent macros.
% Most are not a problem: an accent that's expanded to an "\accent"
% command may be harder to read but it works just the same. The
% ones that cause problems are: those that use alignments---\TeX\
% seems to get confused about the difference between alignment
% parameters and macro parameters; those that use temporary control
% sequences; and those that look carefully at what the current font
% is.
%
% (The "\copyright" macro defined in \PlainTeX\ has this sort of
% problem as well, but isn't used enough to bother with. That macro,
% and any other that causes trouble, will get by all right if you put
% a "\noexpand" in front of it in your file---or a "\protect" if
% you're using NFSS.)
%
% We also need to eliminate all "EDMAC" macros like "\label" and
% "\setline" that write things to auxiliary files: that writing
% should be done only once. And we make
% "\text" itself, if it appears within its own
% argument, do nothing but copy its first argument.
%
% Finally, we execute "\morenoexpands". The version of
% "\morenoexpands" defined here does nothing; but you may define
% a version of your own when you need to add more expansion
% suppressions as needed with your macros. That makes it possible
% to make such additions without needing to copy or modify the
% standard "EDMAC" code. If you define your own
% "\morenoexpands", you must be very careful about spaces: if the
% macro adds any spaces to the text when it runs, extra space
% will appear in the main text when "\text" is used.
%
% (A related problem, not addressed by these two macros,
% is that of characters whose category code is changed by any
% the macros used in the arguments to "\text". Since the
% category codes are set when the arguments are scanned, macros
% that depend on changing them will not work. We have most often
% encountered this with characters that are made ``active'' within
% text in some, but not all, of the languages used within the document.
% One way around the problem, if it takes this form,
% is to ensure that those characters are {\em always\/} active; within
% languages that make no special use of them, their associated
% control sequences should simply return the proper character.)
%    \begin{macrocode}
\def\no@expands{\let\rm=0\let\it=0\let\sl=0\let\bf=0\let\tt=0%
  \let\b=0\let\c=0\let\d=0\let\t=0%
  \let\select@@lemmafont=0%
  \def\protect{\noexpand\protect\noexpand}%
  \let\startsub=\relax  \let\endsub=\relax
  \let\startlock=\relax \let\endlock=\relax
  \let\label=\@gobble   \let\pageref=\@gobble
  \let\lineref=\@gobble \let\sublineref=\@gobble
  \let\setline=\@gobble \let\advanceline=\@gobble
  \let\text=\dummy@text
  \morenoexpands}
\let\morenoexpands=\relax
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\text}
% Now we begin "\text" itself. The definition requires a "/" after
% the arguments: this eliminates the possibility of problems about
% knowing where "#2" ends. This also changes the handling of spaces
% following an invocation of the macro: normally such spaces are
% skipped, but in this case they're significant because "#2" is
% a ``delimited parameter''. Since "\text" is always used in running
% text, it seems more appropriate to pay attention to spaces than to
% skip them.
%
% When executed, "\text" first ensures that we're in
% horizontal mode.
%    \begin{macrocode}
\long\def\text#1#2/{\leavevmode
%    \end{macrocode}
%
% \begin{macro}{\@tag}
% Our normal lemma is just argument "#1"; but that argument could have
% further invocations of "\text" within it. We get a copy of the
% lemma without any "\text" macros within it by temporarily redefining
% "\text" to just copy its first argument and ignore the other,
% and then expand "#1" into "\@tag", our lemma.
%
% This is done within a group that starts here, in order to get the
% original "\text" restored; within this group we've also turned
% off the expansion of those control sequences commonly found within text
% that can cause trouble for us.
%    \begin{macrocode}
  \begingroup
    \no@expands
    \xdef\@tag{#1}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@nums}
% \label{nums}
% Prepare more data for the benefit of note-generating macros: the line
% references and font specifier for this lemma go to "\@nums".
%    \begin{macrocode}
    \set@line
%    \end{macrocode}
% \end{macro}
%
% "\insert@count" will be altered by the note-generating macros:
% it counts the number of deferred footnotes or other insertions
% generated by this instance of "\text".
%    \begin{macrocode}
    \global\insert@count=0
%    \end{macrocode}
%
% Now process the note-generating macros in argument "#2"
% (i.e., "\Afootnote", "\lemma", etc.). "\ignorespaces" is here to
% skip over any spaces that might appear at the start of "#2";
% otherwise they wind up in the main text. Footnote and other
% macros that are used within "#2" should all end with
% "\ignorespaces" as well, to skip any spaces between macros when
% several are used in series.
%    \begin{macrocode}
    \ignorespaces #2\relax
%    \end{macrocode}
%
% Finally, we're ready to admit the first argument into the current
% paragraph.
%
% It's important that we generate and output all the notes for this
% chunk of text {\em before} putting the text into the paragraph: notes
% that are referenced by line number should generally be tied to the
% start of the passage they gloss, not the end. That should all be done
% within the expansion of "#2" above, or in "\aftergroup"
% commands within that expansion.
%    \begin{macrocode}
    \flag@start
  \endgroup
  #1%
%    \end{macrocode}
%
% Finally, we add any insertions that are
% associated with the {\em end\/} of
% the lemma. Footnotes that are identified by symbols rather than by
% where the lemma begins in the main text need to be done here, and
% not above.
%
%    \begin{macrocode}
  \ifx\end@lemmas\empty \else
    \gl@p\end@lemmas\to\x@lemma
    \x@lemma
    \global\let\x@lemma=\relax
  \fi
  \flag@end}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\set@line}
% The "\set@line" macro
% is called by "\text" to put the line-reference field and
% font specifier for the current block of text into "\@nums".
%
% One instance of "\text" may generate several notes, or it
% may generate none---it's legitimate for argument "#2" to "\text" to
% be empty. But "\flag@start" and "\flag@end" induce the generation of
% a single entry in "\line@list" during the next run, and it's vital
% to also remove one and only one "\line@list" entry here.
%    \begin{macrocode}
\def\set@line{%
%    \end{macrocode}
%
% If no more lines are listed in "\line@list", something's
% wrong---probably just some change in the input. We set all the numbers
% to zeros, following an old publishing convention for numerical
% references that haven't yet been resolved.
%    \begin{macrocode}
  \ifx\line@list\empty
    \global\noteschanged@true
    \xdef\@nums{000|000|000|000|000|000|\edfont@info}%
%    \end{macrocode}
%
%  All's well; our reference is there.
%    \begin{macrocode}
 \else
   \gl@p\line@list\to\@tempb
   \xdef\@nums{\@tempb|\edfont@info}%
   \global\let\@tempb=\undefined
 \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\edfont@info}
% The macro "\edfont@info" returns coded information about the
% current font; the coding depends on the font selection scheme
% in use. See section~\ref{fontcode} for more on font selection
% schemes.
%
%    \begin{macrocode}
\ifx\selectfont\undefined       % we're using Plain fonts
  \def\edfont@info{\the\fam}
\else                           % we're using NFSS
  \def\edfont@info{\f@encoding/\f@family/\f@series/\f@shape}
\fi
%    \end{macrocode}
% \end{macro}
%
% \subsection{Substitute lemma}
%
% \begin{macro}{\lemma}
% The "\lemma" macro allows you to change the lemma
% that's passed on to the notes.
%    \begin{macrocode}
\def\lemma#1{\xdef\@tag{#1}\ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Substitute line numbers}
%
% \begin{macro}{\linenum}
% \label{linenumdef}\relax
% The "\linenum" macro can change any or all of
% the page and line numbers that are
% passed on to the notes.
%
% As argument "\linenum" takes a set of seven parameters
% separated by vertical bars, in the format used internally for
% "\@nums" (see p.\,\pageref{linenumbers}): the starting page,
% line, and sub-line numbers, followed by the ending page, line, and
% sub-line numbers, and then the font specifier for the lemma.
% However, you can omit any parameters you don't want to change, and
% you can omit a string of vertical bars at the end of the
% argument. Hence "\linenum{18|4|0|18|7|1|0}" is an invocation
% that changes all the parameters, but "\linenum{|3}" only
% changes the starting line number, and leaves the rest unaltered.
%
% We use "\\" as an internal separator for the macro parameters.
%    \begin{macrocode}
\def\linenum#1{%
  \xdef\@tempa{#1|||||||\noexpand\\\@nums}%
  \global\let\@nums=\empty
  \expandafter\line@set\@tempa|\\\ignorespaces}
%    \end{macrocode}
%
% \begin{macro}{\line@set}
% "\linenum" calls "\line@set" to do the actual work; it
% looks at the first number in the argument to "\linenum",
% sets the corresponding value in "\@nums", and then calls
% itself to process the next number in the "\linenum"
% argument, if there are more numbers in "\@nums" to process.
%    \begin{macrocode}
\def\line@set#1|#2\\#3|#4\\{%
  \gdef\@tempb{#1}%
  \ifx\@tempb\empty
        \@add{#3}%
  \else
        \@add{#1}%
  \fi
  \gdef\@tempb{#4}%
  \ifx\@tempb\empty\else
      \@add{|}\line@set#2\\#4\\%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@add}
% "\line@set" uses "\@add" to tack numbers or vertical bars
% onto the right hand end of "\@nums".
%    \begin{macrocode}
\def\@add#1{\xdef\@nums{\@nums#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \section{Paragraph decomposition and reassembly}
% \label{paragraph}\relax
%
% In order to be able to count the lines of text and affix line
% numbers, we add an extra stage of processing for each paragraph.
% We send the paragraph into a box
% register, rather than straight onto the vertical list, and when
% the paragraph ends we
% slice the paragraph into its component lines; to each line we
% add any notes or line numbers, add a command to write to the
% line-list, and then at last send the line to the vertical list.
% This section contains all the code for this processing.
%
% \subsection{Boxes, counters, {\tt\protect\bslash pstart}
% and {\tt\protect\bslash pend}}
%
% \begin{macro}{\raw@text}
% \begin{macro}{\ifnumberedpar@}
% \begin{macro}{\numberedpar@true}
% \begin{macro}{\numberedpar@false}
% \begin{macro}{\num@lines}
% \begin{macro}{\one@line}
% \begin{macro}{\par@line}
% Here are numbers and flags that are used internally in the course
% of the paragraph decomposition.
%
% When we first form the paragraph, it goes into a box register,
% "\raw@text", instead of onto the current vertical list.
% The "\ifnumberedpar@" flag will be "true" while a paragraph is
% being processed in that way.
% "\num@lines" will store the number of lines in the paragraph
% when it's complete. When we chop it up into lines, each line
% in turn goes into the
% "\one@line" register, and "\par@line" will be the number
% of that line within the paragraph.
%    \begin{macrocode}
\newbox\raw@text
\newif\ifnumberedpar@
\newcount\num@lines
\newbox\one@line
\newcount\par@line
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\pstart}
% "\pstart" starts the paragraph by
% clearing the "\inserts@list" list and other
% relevant variables, and then arranges for the
% subsequent text to go into the
% "\raw@text" box. "\pstart" needs to appear at the start of
% every paragraph that's to be numbered; the "\autopar" command below
% may be used to insert these commands automatically.
%
% Beware: everything that occurs between "\pstart" and "\pend"
% is happening within a group; definitions must be global if you want
% them to survive past the end of the paragraph.
%    \begin{macrocode}
\def\pstart{\ifnumbering \else
    \errmessage{\string\pstart\space must be used
                 within a numbered section}%
    \beginnumbering
  \fi
  \ifnumberedpar@
    \errmessage{\string\pstart\space encountered while another
                \string\pstart\space was in effect}%
    \pend
  \fi
  \list@clear{\inserts@list}%
  \global\let\next@insert=\empty
  \begingroup\normal@pars
  \global\setbox\raw@text=\vbox\bgroup
  \numberedpar@true}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pend}
% "\pend" must be used to end a numbered paragraph.
%
%    \begin{macrocode}
\def\pend{\ifnumbering \else
  \errmessage{\string\pend\space must be used
                  within a numbered section}%
  \fi
  \ifnumberedpar@ \else
    \errmessage{\string\pend\space must follow a \string\pstart}%
  \fi
%    \end{macrocode}
% We set all the usual interline penalties to zero and then immediately
% call "\endgraf" to end the paragraph; this ensures that there'll
% be no large interline penalties to prevent us from slicing the
% paragraph into pieces. These penalties revert to the values
% that you set when the group for the "\vbox" ends. Then we call
% "\do@line" to slice a line off the top of the
% paragraph, add a line number and footnotes, and restore it to the page;
% we keep doing this until there aren't any more lines left.
%    \begin{macrocode}
  \brokenpenalty=0 \clubpenalty=0
  \displaywidowpenalty=0 \interlinepenalty=0 \predisplaypenalty=0
  \postdisplaypenalty=0 \widowpenalty=0
  \endgraf\global\num@lines=\prevgraf\egroup
  \global\par@line=0
  \loop\ifvbox\raw@text
     \do@line
  \repeat
%    \end{macrocode}
% Deal with any leftover notes, and then end the group that was begun
% in the "\pstart".
%    \begin{macrocode}
  \flush@notes
  \endgroup
  \ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\autopar}
% In most cases it's only an annoyance to have to label the paragraphs
% to be numbered with "\pstart" and "\pend". "\autopar" will
% do that automatically, allowing you to start a paragraph with its
% first word and no other preliminaries, and to end it with a blank line
% or a "\par" command. The command should be issued within a
% group, after "\beginnumbering" has been used to start the
% numbering; all paragraphs within the group will be affected.
%
% A few situations can cause problems. One is a paragraph that begins with
% a begin-group character or command: "\pstart" will not get invoked
% until after such a group beginning is processed; as a result the
% character that ends the group will be mistaken for the end of the
% "\vbox" that "\pstart" creates, and the rest of the paragraph
% will not be numbered. Such paragraphs need to be started explicitly
% using "\indent", "\noindent", or "\leavevmode"---or "\pstart", since
% you can still include your own "\pstart" and "\pend"
% commands even with "\autopar" on.
%
% Prematurely ending the group within which "\autopar" is in
% effect will cause a similar problem. You must either leave a
% blank line or use "\par" to end the last paragraph before
% you end the group.
%
% The functioning of this macro is more tricky than the usual
% "\everypar": we don't want anything to go onto the vertical
% list at all, so we have to end the paragraph, erase any evidence
% that it ever existed, and start it again using "\pstart".
% We remove the paragraph-indentation box using "\lastbox" and
% save the width, and then skip backwards over the "\parskip"
% that's been added for this paragraph. Then we start again with
% "\pstart", restoring the indentation that we saved, and
% locally change "\par" so that it'll do our "\pend" for us.
%    \begin{macrocode}
\def\autopar{\ifnumbering \else
    \errmessage{\string\autopar\space must be used
                  within a numbered section}%
    \beginnumbering
  \fi
  \everypar={\setbox0=\lastbox
    \endgraf \vskip-\parskip
    \pstart \noindent \kern\wd0
    \let\par=\pend}%
  \ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\normal@pars}
% We also define a macro which we can rely on to turn off the
% "\autopar" definitions at various important places, if they
% are in force. We'll want to do this within footnotes, for
% example.
%    \begin{macrocode}
\def\normal@pars{\everypar={}\let\par\endgraf}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Processing one line}
%
% \begin{macro}{\do@line}
% The "\do@line" macro is called by "\pend" to
% do all the processing for a single line of text.
%    \begin{macrocode}
\def\do@line{%
%    \end{macrocode}
%
% First, pull
% one line off the top of "\raw@text", which contains the remaining
% unprocessed lines of the paragraph. "\vbadness" must be cranked up to
% suppress "Underfull vbox" errors from
% "\vsplit"; "\splittopskip" will be inserted at the top of
% "\one@line", so we zero it. (This skip will appear in the final
% vertical list, just before every "\baselineskip".)
%    \begin{macrocode}
 {\vbadness=10000 \splittopskip=0pt
 \global\setbox\one@line=\vsplit\raw@text to\baselineskip}%
%    \end{macrocode}
%
% "\one@line" comes out of "\vsplit" as a "vbox";
% we now convert it to an "hbox".
%
% This operation breaks if there's an insert connected to the
% \label{doline} line. In that case, the content of the "vbox"
% "\one@line" before this operation is not just an "hbox": it's
% an "hbox" followed by an insert. After the "\unvbox", the
% last thing on the vertical list is not the "hbox" but the
% insert. The result is that our line heads prematurely onto the
% vertical list---with incorrect interline spacing, because there's
% still a level of boxing that should be undone---and "\one@line"
% is the void box, because the last thing on the vertical list
% wasn't a box. The subsequent code consequently prints a blank
% line.
%
% All this is why insertions need to be kept out of the paragraph
% until this point; our footnote macros add all insertions to list
% macros, and the "\add@inserts" macro below puts them onto the
% vertical list at the proper time.
%    \begin{macrocode}
 \unvbox\one@line \global\setbox\one@line=\lastbox
%    \end{macrocode}
%
% Calculate the line and page number for this line.
%    \begin{macrocode}
 \getline@num
%    \end{macrocode}
%
% Now we'll add the line to the vertical list, with a line
% number attached if necessary.
%
% The "\hfil\hbox to \wd\one@line" is necessary to position a
% hangindented line correctly: without it, "\one@line" gets
% stretched out to "\hsize" in width and the indentation
% disappears. This is because hanging indentation is done by
% setting a nonzero ``shift'' value for the "hbox" that
% contains the line within the "vbox", and that shift vanishes, like
% the penalties, when we slice up the paragraph; one can examine
% the "\ht" or "\wd" of a box within \TeX{}, but it provides no
% way of examining the "\shift", though it would be a trivial
% modification of the \TeX{} program to add that function.
% ("\parshape"\label{parshape}
% also works by setting a nonzero shift, but this fix isn't good
% enough there, because the total width of the lines is also varied
% in that case; our algorithm will push all the lines of text over
% to the right margin.)
%
% We put the "\new@line" start-of-line marker in the output list at
% this point too: putting it within the "\hbox" here ensures that
% it comes before any of the text of the line in the vertical list,
% but cannot be broken away from it at a page break.
%    \begin{macrocode}
\hbox to \hsize{\affixline@num{%
  \hfil\hbox to \wd\one@line{\new@line\unhbox\one@line}}}%
%    \end{macrocode}
%
% Now we pull the footnotes and insertions for this line out of the
% "\inserts@list" list macro and attach them.
%    \begin{macrocode}
 \add@inserts
%    \end{macrocode}
%
% Penalties get stripped off by this slicing process; the following
% macro puts them back in as the last step.
%    \begin{macrocode}
 \add@penalties}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Line and page number computation}
%
% \begin{macro}{\getline@num}
% The "\getline@num" macro
% determines the page and line numbers for the line we're about to
% send to the vertical list.
%    \begin{macrocode}
\def\getline@num{%
  \global\advance\absline@num by 1
  \do@actions
  \do@ballast
  \ifsublines@
     \ifnum\sub@lock<2
       \global\advance\subline@num by 1
     \fi
  \else
     \ifnum\@lock<2
       \global\advance\line@num by 1
       \global\subline@num=0
     \fi
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\do@ballast}
% \label{do@ballast}\relax
% The real work in the macro above is done in "\do@actions", but
% before we plunge into that, let's get "\do@ballast" out of the
% way.  This macro looks to see if there is an action to be
% performed on the {\em next\/} line, and if it is going to be a
% page break action, "\do@ballast" decreases the "\ballast@count"
% counter
% by the amount of "\ballast".  This means, in practice, that when
% "\add@penalties" assigns penalties at this point, \TeX\ will be
% given extra encouragement to break the page here (see
% p.\,\pageref{add@penalties}).
%
% \begin{macro}{\ballast}
% \begin{macro}{\ballast@count}
% First we set up the required counters; they are initially
% set to zero, and will remain so unless you say
% "\ballast="\meta{some figure} in your document.
%    \begin{macrocode}
\newcount\ballast@count
\newcount\ballast
%    \end{macrocode}
% \end{macro}
% \end{macro}
% And here is "\do@ballast" itself. It advances "\absline@num"
% within the protection of a group to make its check for what
% happens on the next line.
%    \begin{macrocode}
\def\do@ballast{\global\ballast@count=0
  \begingroup
    \advance\absline@num by 1
    \ifnum\next@actionline=\absline@num
      \ifnum\next@action>-1001
        \global\advance\ballast@count by -\ballast
       \fi
     \fi
  \endgroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\do@actions}
% \begin{macro}{\do@actions@next}
%
% The "\do@actions" macro
% looks at the list of actions to take at particular absolute line
% numbers, and does everything that's specified for the current line.
%
% It may call itself recursively, and to do this efficiently (using
% \TeX's optimization for tail recursion), we define a control-sequence
% called "\do@actions@next" that is always the last thing that
% "\do@actions" does. If there could be more actions to process for
% this line, "\do@actions@next" is set equal to "\do@actions";
% otherwise it's just "\relax".
%
%    \begin{macrocode}
\def\do@actions{%
  \global\let\do@actions@next=\relax
  \ifnum\absline@num<\next@actionline\else
%    \end{macrocode}
%
% First, page number changes, which will generally be the most common
% actions. If we're restarting lineation on each page, this is where it
% happens.
%    \begin{macrocode}
    \ifnum\next@action>-1001
       \global\page@num=\next@action
       \ifbypage@
             \global\line@num=0 \global\subline@num=0
       \fi
%    \end{macrocode}
%
% Next, we handle
% commands that change the line-number values. (We subtract $5001$ rather
% than $5000$ here because the line number is going to be incremented
% automatically in "\getline@num".)
%    \begin{macrocode}
    \else
       \ifnum\next@action<-4999
          \@tempcnta=-\next@action
          \advance\@tempcnta by -5001
          \ifsublines@
             \global\subline@num=\@tempcnta
          \else
             \global\line@num=\@tempcnta
          \fi
%    \end{macrocode}
%
% It's one of the fixed codes. We rescale the value in
% "\@tempcnta" so that we can use a case statement.
%    \begin{macrocode}
       \else
          \@tempcnta=-\next@action
          \advance\@tempcnta by -1000
          \ifcase\@tempcnta
%    \end{macrocode}
%
% Commands that turn sub-lineation on and off.
%    \begin{macrocode}
          \or
             \global\sublines@true
          \or
             \global\sublines@false
%    \end{macrocode}
%
% Line locking. We ignore these indications when they don't appear
% at the right times: a start-lock should appear only when locking
% is entirely off, and an end-lock should only appear when locking is
% in the ``middle''.
%    \begin{macrocode}
          \or
             \ifcase\@lock
               \global\@lock=1
             \else
               \global\@lock=0
             \fi
          \or
             \ifnum\@lock=2
               \global\@lock=3
             \else
               \global\@lock=0
             \fi
%    \end{macrocode}
%
% Sub-line locking. Same comments as for line locking.
%    \begin{macrocode}
          \or
             \ifcase\sub@lock
               \global\sub@lock=1
             \else
               \global\sub@lock=0
             \fi
          \or
             \ifnum\sub@lock=2
               \global\sub@lock=3
             \else
               \global\sub@lock=0
             \fi
%    \end{macrocode}
%
% If we get here, some unknown action code has been encountered.
%    \begin{macrocode}
          \else
             \edmac@warning{Bad action code,
                                value \next@action.}%
          \fi
       \fi
    \fi
%    \end{macrocode}
%
% Now we get information about the next action off the list,
% and then set "\add@inserts@next" so that we'll
% call ourself recursively: the next action might also be for this
% line.
%
% There's no warning if we find "\actionlines@list" empty,
% since that will always happen near the end of the section.
%
%    \begin{macrocode}
    \ifx\actionlines@list\empty
         \gdef\next@actionline{1000000}%
    \else
         \gl@p\actionlines@list\to\next@actionline
         \gl@p\actions@list\to\next@action
         \global\let\do@actions@next=\do@actions
    \fi
  \fi
%    \end{macrocode}
%
% Make the recursive call, if necessary.
%
%    \begin{macrocode}
\do@actions@next}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Line number printing}
%
% \begin{macro}{\affixline@num}
% "\affixline@num" takes a single argument, a series of
% commands for printing the line just split off by "\do@line"; it
% puts that line back on the vertical list, and adds a line number if
% necessary.
%
% To determine whether we need to affix a line number to this line,
% we compute the following:
% \begin{tabbing}
%   \quad $m$ \=  \kill
%   $n$ \> $= \mbox{\it int\/} ( ( \mbox{\it linenum\/} -
%                                \mbox{\it firstlinenum\/} ) /
%                                  \mbox{\it linenumincrement\/} )$ \\
%   $m$ \> $= \mbox{\it firstlinenum\/} +
%                     ( n \times \mbox{\it linenumincrement\/})$
% \end{tabbing}
% (where {\it int\/} truncates a real number to an integer).
% $m$ will be equal to {\it linenum\/} only
% if we're to paste a number on here.
% However, the formula breaks down for the first line to number (and any
% before that), so we check that case separately: if "\line@num" $\le$
% "\firstlinenum", we compare the two directly instead of making these
% calculations.
%
% We compute, in the scratch counter "\@tempcnta", the number
% of the next line that should be printed with a number ($m$ in the
% above discussion), and move the current line number into the
% counter "\@tempcntb" for comparison.
%
% First, the case when we're within a sub-line range.
%    \begin{macrocode}
\def\affixline@num#1{%
  \ifsublines@
    \@tempcntb=\subline@num
    \ifnum\subline@num>\firstsublinenum
      \@tempcnta=\subline@num
      \advance\@tempcnta by-\firstsublinenum
      \divide\@tempcnta by\sublinenumincrement
      \multiply\@tempcnta by\sublinenumincrement
      \advance\@tempcnta by\firstsublinenum
    \else
      \@tempcnta=\firstsublinenum
    \fi
%    \end{macrocode}
%
% That takes care of computing the values for comparison, but if line
% number locking is in effect we have to make a further check. If this
% check fails, then we disable the line-number display by setting the
% counters to arbitrary but unequal values.
%    \begin{macrocode}
    \ifcase\sub@lock
      \or
        \ifnum\sublock@disp=1
           \@tempcntb=0 \@tempcnta=1
        \fi
      \or
        \ifnum\sublock@disp=2 \else
           \@tempcntb=0 \@tempcnta=1
        \fi
      \or
        \ifnum\sublock@disp=0
           \@tempcntb=0 \@tempcnta=1
        \fi
    \fi
%    \end{macrocode}
%
% Now the line number case, which works the same way.
%    \begin{macrocode}
  \else
    \@tempcntb=\line@num
    \ifnum\line@num>\firstlinenum
       \@tempcnta=\line@num
       \advance\@tempcnta by-\firstlinenum
       \divide\@tempcnta by\linenumincrement
       \multiply\@tempcnta by\linenumincrement
       \advance\@tempcnta by\firstlinenum
    \else
       \@tempcnta=\firstlinenum
    \fi
%    \end{macrocode}
%
% A locking check for sub-lines, just like the version for line
% numbers above.
%    \begin{macrocode}
    \ifcase\@lock
       \or
         \ifnum\lock@disp=1
            \@tempcntb=0 \@tempcnta=1
         \fi
       \or
         \ifnum\lock@disp=2 \else
            \@tempcntb=0 \@tempcnta=1
         \fi
       \or
         \ifnum\lock@disp=0
            \@tempcntb=0 \@tempcnta=1
         \fi
    \fi
  \fi
%    \end{macrocode}
%
% The following test is true if we need to print a line number.
%    \begin{macrocode}
  \ifnum\@tempcnta=\@tempcntb
%    \end{macrocode}
%
% If we got here,
% we're going to print a line number; so now we need to
% calculate a number that will tell us which side of the page will get
% the line number. We start from "\line@margin", which asks for
% one side always if it's less than $2$; and then if the side does
% depend on the page number, we simply add the page number to this
% side code---because the values of "\line@margin" have been devised so
% that this produces a number that's even for left-margin numbers and
% odd for right-margin numbers.
%    \begin{macrocode}
    \@tempcntb=\line@margin
    \ifnum\@tempcntb>1
      \advance\@tempcntb by\page@num
    \fi
%    \end{macrocode}
%
% Now print the line ("#1") with its page number.
%    \begin{macrocode}
    \ifodd\@tempcntb
      #1\rlap{{\rightlinenum}}%
    \else
      \llap{{\leftlinenum}}#1%
    \fi
  \else
%    \end{macrocode}
%
% If no line number is to be appended, we just print the line as is.
%    \begin{macrocode}
    #1%
  \fi
%    \end{macrocode}
%
% Now fix the lock counters, if necessary. A value of $1$ is advanced to
% $2$; $3$ advances to $0$; other values are unchanged.
%    \begin{macrocode}
  \ifcase\@lock
  \or
    \global\@lock=2
  \or \or
    \global\@lock=0
  \fi
  \ifcase\sub@lock
  \or
    \global\sub@lock=2
  \or \or
    \global\sub@lock=0
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Add insertions to the vertical list}
%
% \begin{macro}{\inserts@list}
% "\inserts@list" is the list macro that contains the inserts that
% we save up for one paragraph.
%
%    \begin{macrocode}
\list@create{\inserts@list}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\add@inserts}
% \begin{macro}{\add@inserts@next}
% "\add@inserts"
% is the penultimate macro used by "\do@line"; it takes
% insertions saved in a list macro and sends them onto the vertical list.
%
% It may call itself recursively, and to do this efficiently (using
% \TeX's optimization for tail recursion), we define a control-sequence
% called "\add@inserts@next" that is always the last thing that
% "\add@inserts" does. If there could be more inserts to process for
% this line, "\add@inserts@next" is set equal to "\add@inserts";
% otherwise it's just "\relax".
%
%    \begin{macrocode}
\def\add@inserts{%
  \global\let\add@inserts@next=\relax
%    \end{macrocode}
%
% If "\inserts@list" is empty, there aren't any more notes or insertions
% for this paragraph, and we needn't waste our time.
%    \begin{macrocode}
  \ifx\inserts@list\empty \else
%    \end{macrocode}
%
% The "\next@insert" macro records the number of the line that
% receives the next footnote or other insert; it's empty when we start
% out, and just after we've affixed a note or insert.
%    \begin{macrocode}
  \ifx\next@insert\empty
    \ifx\insertlines@list\empty
      \global\noteschanged@true
      \gdef\next@insert{100000}%
    \else
      \gl@p\insertlines@list\to\next@insert
    \fi
  \fi
%    \end{macrocode}
%
% If the next insert's for this line, tack it on (and then erase the
% contents of the insert macro, as it could be quite large).
% In that case, we also set "\add@inserts@next" so that we'll
% call ourself recursively: there might be another insert for this same
% line.
%
%    \begin{macrocode}
  \ifnum\next@insert=\absline@num
    \gl@p\inserts@list\to\@insert
    \@insert
    \global\let\@insert=\undefined
    \global\let\next@insert=\empty
    \global\let\add@inserts@next=\add@inserts
  \fi
\fi
%    \end{macrocode}
%
% Make the recursive call, if necessary.
%
%    \begin{macrocode}
\add@inserts@next}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Penalties}
%
% \begin{macro}{\add@penalties}
% "\add@penalties" is
% the last macro used by "\do@line". It adds up the club,
% widow, and interline penalties, and puts a single penalty
% of the appropriate size
% back into the paragraph; these penalties get
% removed by the "\vsplit" operation. "\displaywidowpenalty" and
% "\brokenpenalty" are not restored, since we have no easy way to
% find out where we should insert them.
%
% \label{add@penalties}
% In this code, "\num@lines" is the number of lines in the whole
% paragraph, and "\par@line" is the line we're working on at the
% moment.  The counter "\@tempcnta" is used to calculate and
% accumulate the penalty; it is initially set to the value of
% "\ballast@count", which has been worked out in "\do@ballast"
% above (p.\,\pageref{do@ballast}).  Finally, the penalty is
% checked to see that it doesn't go below $-10000$.
%    \begin{macrocode}
\def\add@penalties{\@tempcnta=\ballast@count
  \ifnum\num@lines>1
    \global\advance\par@line by 1
    \ifnum\par@line=1
      \advance\@tempcnta by \clubpenalty
    \fi
    \@tempcntb=\par@line \advance\@tempcntb by 1
    \ifnum\@tempcntb=\num@lines
      \advance\@tempcnta by \widowpenalty
    \fi
    \ifnum\par@line<\num@lines
      \advance\@tempcnta by \interlinepenalty
    \fi
  \fi
    \ifnum\@tempcnta=0
      \relax
    \else
      \ifnum\@tempcnta>-10000
        \penalty\@tempcnta
      \else
        \penalty -10000
      \fi
    \fi}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Printing leftover notes}
%
% \begin{macro}{\flush@notes}
% The "\flush@notes"
% macro is called after the entire paragraph has been sliced up
% and sent on to the vertical list.
% If the number of notes to this paragraph has increased since the last
% run of \TeX, then there can be leftover notes that haven't yet been
% printed. An appropriate error message will be printed elsewhere; but
% it's best to go ahead and
% print these notes somewhere, even if it's not in quite the
% right place. What we do is dump them all out here, so that they should
% be printed on the same page as the last line
% of the paragraph. We can hope that's not
% too far from the proper location, to which they'll move on the next
% run.
%    \begin{macrocode}
\def\flush@notes{%
  \@xloop
    \ifx\inserts@list\empty \else
      \gl@p\inserts@list\to\@insert
      \@insert
      \global\let\@insert=\undefined
  \repeat}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@xloop}
% "\@xloop" is
% a variant of the \PlainTeX\ "\loop" macro, useful when it's
% hard to construct a positive test using the \TeX\ "\if" commands---as
% in "\flush@notes" above. One says "\@xloop" "..." "\if" "..." "\else"
% "..." "\repeat", and the action following "\else" is repeated as long
% as the "\if" test fails. (This macro will work wherever the \PlainTeX\
% "\loop" is used, too, so we could just call it "\loop";
% but it seems preferable not to change the definitions of any of
% the standard macros.)
%
% This variant of "\loop" was introduced by
% Alois Kabelschacht\index{Kabelschacht, Alois} in
% {\em TUGboat\/} {\bf 8} (1987), pp.\,184--5.
%
%    \begin{macrocode}
\def\@xloop#1\repeat{%
  \def\body{#1\expandafter\body\fi}%
  \body}
%    \end{macrocode}
% \end{macro}
%
% \section{Footnotes}
% \label{footnotes}\relax
%
% The footnote macros are adapted from those in \PlainTeX, but they
% differ in these respects: the outer-level commands must add other
% commands to a list macro rather than doing insertions immediately;
% there are five separate levels of footnotes, not just one; and there
% are options to reformat footnotes into paragraphs or into multiple
% columns.
%
% \subsection{Fonts (using the Plain font selection scheme)}
% \label{fontcode}\relax
% Before getting into the details of formatting the notes, we set
% up some font macros. It is the notes that present the greatest
% challenge for our font-handling mechanism, because we need to be
% able to take fragments of our main text and print them in
% different forms: it is common to reduce the size,
% for example, without otherwise changing the fonts used.
%
% "EDMAC" supports two different systems for
% font handling: the ``Plain font selection scheme'', that is,
% the original \PlainTeX\ system, with some minor
% extensions needed for our purposes here; and the New Font Selection
% Scheme (NFSS) of Frank Mittelbach\index{Mittelbach, Frank} and Rainer
% Sch\"opf\index{Sch\"opf, Rainer}, as adapted for use with \PlainTeX\
% by Wayne Sullivan\index{Sullivan, Wayne}. The NFSS is strongly
% recommended, but the Plain font selection scheme will suffice for
% simple applications.
%
% "EDMAC" will define different versions of the following
% macros, depending on which scheme is used: "\edfont@info",
% "\notefontsetup", "\notenumfont", "\numlabfont", and
% "\select@lemmafont". If the Plain font selection
% scheme is chosen, "EDMAC" will also define an "\eightpoint"
% macro and load additional Computer Modern fonts for use with it.
%
% The choice of a font selection scheme is made implicitly. If NFSS
% has been loaded, it is assumed that you want to use it; otherwise
% "EDMAC" uses the Plain font selection scheme. If you're using NFSS,
% load it and make any choices of customizations and standard settings
% before you load "EDMAC".
%
% We know that NFSS has been loaded if the "\selectfont" macro is
% present.
%
%    \begin{macrocode}
\ifx\selectfont\undefined
%    \end{macrocode}
%
% The rest of this section defines macros for use with the Plain
% font selection scheme; see the next section for definitions used
% with NFSS.
%
% What we want to provide with these macros is something a little bit
% more general than \PlainTeX, without going the whole way to
% implementing a full, planned font scheme.
%
% \begin{macro}{\notefontsetup}
% The font setup defined in "\notefontsetup" defines the
% fonts which will normally be used
% for the text of the footnotes.  Parts of the footnote, such
% as the line number references and the lemma, are enclosed in
% groups, with their own font macros, so a note in plain roman can
% still have line numbers in bold, say, and the lemma in the same
% family of font as in the main text.
%
% Since it is common to have notes in a font smaller than
% the main text, we set up an "\eightpoint" macro which contains
% definitions for smaller versions of "\rm", "\it",
% "\bf", "\tt", and "\sl".  It also contains
% definitions of the appropriate "\fam" for each of these
% styles, as well as a smaller "\strutbox" and a setting of
% the "\baselineskip".
%
% If you want to change the size or style of the standard footnote
% font, it is important that your macro define at least these
% items:
% \begin{itemize}\addtolength{\itemsep}{-1ex}
% \item fonts
% \item "\fam"(s)
% \item "\strutbox"
% \item "\baselineskip"
% \end{itemize}
% For example, like \PlainTeX\ itself, "EDMAC" uses the height of a
% "\strutbox" in a few crucial places, such as the crop marks,
% the alignment of the top line of footnotes, etc. (Page
% \pageref{magic} explains the reasons why this is important in one
% instance.)  If you change the size of your fonts, but don't
% change the size of the "\strutbox" too, then there will be
% various discrepancies in the spacing.  The same holds for the
% "\baselineskip", and the other macros mentioned here.
%
% The size of a "\strutbox" for the standard ten-point fonts
% is already set by \PlainTeX, as are the other quantities.  This
% takes care of the "\headlinefont", since this is initially set to ten-point
% "\rm".  But once again, if you change the font of
% the headline, be sure to add appropriate definitions of
% "\baselineskip" and "\strutbox" too.
%
% The first thing, then, is to load some font metric information
% for the small fonts that \PlainTeX\ doesn't load (cf.\ {\em The
% \TeX book}, pp.\,413--415).  (We load eight-point fonts where we
% should load six-point ones, because the normal \TeX\ distributions
% don't have "cmtt6" etc.  If you have them, you may want to create
% your own "\eightpoint" with proper definitions.)
%    \begin{macrocode}
  \font\eightrm=cmr8 \font\eighti=cmmi8  \skewchar\eighti='177
  \font\eightsy=cmsy8 \skewchar\eightsy='60 \font\eightbf=cmbx8
  \font\eighttt=cmtt8 \hyphenchar\eighttt=-1 % inhibit hyphenation
  \font\eightsl=cmsl8 \font\eightit=cmti8
  \font\sixrm=cmr8  \font\sixi=cmmi8    \skewchar\sixi='177
  \font\sixsy=cmsy8 \skewchar\sixsy='60 \font\sixbf=cmbx8
  \font\sixtt=cmtt8 \hyphenchar\sixtt=-1 % inhibit hyphenation
  \font\sixsl=cmsl8 \font\sixit=cmti8
%    \end{macrocode}
%
% \begin{macro}{\eightpoint}
% \label{eightpoint}\relax
% With that out of the way, we can now define an "\eightpoint"
% macro that is taken almost directly from p.\,415 of {\em The \TeX
% book\/} (can you spot the differences?).
%    \begin{macrocode}
  \def\eightpoint{\def\rm{\fam0\eightrm}%
    \textfont0=\eightrm \scriptfont0=\sixrm
                        \scriptscriptfont0=\fiverm
    \textfont1=\eighti  \scriptfont1=\sixi
                        \scriptscriptfont1=\fivei
    \textfont2=\eightsy \scriptfont2=\sixsy
                        \scriptscriptfont2=\fivesy
    \textfont3=\tenex   \scriptfont3=\tenex
                        \scriptscriptfont3=\tenex
    \def\it{\fam\itfam\eightit}\textfont\itfam=\eightit
    \def\sl{\fam\slfam\eightsl}\textfont\slfam=\eightsl
    \def\bf{\fam\bffam\eightbf}\textfont\bffam=\eightbf
    \scriptfont\bffam=\sixbf \scriptscriptfont\bffam=\fivebf
    \def\tt{\fam\ttfam\eighttt}\textfont\ttfam=\eighttt
    \normalbaselineskip=9pt
    \setbox\strutbox=\hbox{\vrule height7pt depth2pt width0pt}%
    \normalbaselines\rm}
%    \end{macrocode}
% And finally, we set "\notefontsetup" to be the new font setup
% macro:
%    \begin{macrocode}
  \let\notefontsetup=\eightpoint
%    \end{macrocode}
% \end{macro}
% \end{macro}
% With the above macros, remember to use "\eightpoint" (alias
% "\notefontsetup") inside a group.  If you want to use it
% outside a group, you will need to define a "\tenpoint" macro
% to set all these definitions back to the standard ten-point settings of
% \PlainTeX.
%
% \begin{macro}{\notenumfont}
% The macro controlling the font for line numbers
% within notes, "\notenumfont", is
% more simple.  It really is just a font call.
%    \begin{macrocode}
  \let\notenumfont=\sevenrm
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\select@lemmafont}
% \label{selectlemmafont}\relax
% "\select@lemmafont" is provided to set the right font for
% the lemma in a note. This macro extracts the font-family number
% from the line and page number cluster, and issues the associated
% font-changing command, so that the lemma is printed in its
% original font.
%    \begin{macrocode}
  \def\select@lemmafont#1|#2|#3|#4|#5|#6|#7|{%
     \ifcase#7
        \rm \or \rm \or \rm \or \rm           % families 0--3
            \or \it \or \sl \or \bf \or \tt   % families 4--7
            \else \rm
     \fi}
%    \end{macrocode}
% \end{macro}
% Note that this is a departure from the normal behavior of
% \PlainTeX\ regarding font selection.
% As Donald Knuth remarks ({\em The
% \TeX book}, p.\,154), the "\fam" value is usually irrelevant
% when \TeX\ is typesetting text in horizontal mode; "\fam"
% only matters in math mode.  But here we are using the
% "\fam" value as a convenient way to select a font group.  If
% you are editing a text in some other font, say Cyrillic, be sure
% to assign it a font "\fam", and add that to the list here in
% "\select@lemmafont" (see the example given on p.\,\pageref{fam-fiddle}
% below for using a Sanskrit font with "EDMAC").
%  The ideal in this situation would be to be
% able to test for such parameters such as font series, style, and
% size.  Exactly those
% capabilities are provided in the New Font Selection Scheme
% written by Frank Mittelbach\index{Mittelbach, Frank} and Rainer
% Sch\"opf,\index{Sch\"opf, Rainer}
% and this is one place in "EDMAC" where
% such a system can be used to good effect (see the discussion
% above, page \pageref{edmacnfss}, and the following section).
%
% \subsection{Fonts: using the New Font Selection Scheme}
%
% These are the font macros used with NFSS.  They will be activated if
% the NFSS macros have been loaded as described above
% (p.\,\pageref{ed-nfss}).
%    \begin{macrocode}
\else
%    \end{macrocode}
%
% \begin{macro}{\notefontsetup}
% The font setup defined in "\notefontsetup" defines the standard
% fonts for the text of the footnotes.  Parts of the footnote, such
% as the line number references and the lemma, are enclosed in
% groups, with their own font macros, so a note in plain roman can
% still have line numbers in bold, say, and the lemma in the same
% font encoding, family, series, and shape
% of font as in the main text. Typically this definition should
% specify only a size. It should always end with "\selectfont" or
% with a command like "\rm" that does a "\selectfont".
%
%    \begin{macrocode}
  \def\notefontsetup{\fontsize{8}{9pt}\selectfont}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\notenumfont}
% The line numbers will be printed using the font selected by
% executing "\notenumfont".
%    \begin{macrocode}
  \def\notenumfont{\fontsize{7}{8pt}\rm}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\select@lemmafont}
% \begin{macro}{\select@@lemmafont}
% "\select@lemmafont" is provided to set the right font for
% the lemma in a note. This macro extracts the font specifier
% from the line and page number cluster, and issues the associated
% font-changing command, so that the lemma is printed in its
% original font.
%    \begin{macrocode}
  \def\select@lemmafont#1|#2|#3|#4|#5|#6|#7|{\select@@lemmafont#7|}
  \def\select@@lemmafont#1/#2/#3/#4|%
    {\fontencoding{#1}\fontfamily{#2}\fontseries{#3}\fontshape{#4}%
    \selectfont}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% This is the end of the conditional section for font macro definition.
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
% \subsection{Outer-level footnote commands}
% \begin{macro}{\Afootnote}
% The outer-level footnote commands will look familiar: they're
% just called "\Afootnote", "\Bfootnote", etc., instead of
% plain "\footnote". What they do, however, is quite different,
% since they have to operate in conjunction with "\text" when
% numbering is in effect.
%
% If we're within a line-numbered paragraph, then, we tack this note onto
% the "\inserts@list" list, and increment the deferred-page-bottom-note
% counter.
%    \begin{macrocode}
\def\Afootnote#1{%
  \ifnumberedpar@
    \xright@appenditem{\noexpand\vAfootnote{A}%
                   {{\@nums}{\@tag}{#1}}}\to\inserts@list
    \global\advance\insert@count by 1
%    \end{macrocode}
%
% Within free text, there's no need to put off making the insertion
% for this note. No line numbers are available, so this isn't generally
% that useful; but you might want to use it to get around some
% limitation of "EDMAC".
%    \begin{macrocode}
  \else
    \vAfootnote{A}{{0|0|0|0|0|0|0}{}{#1}}%
  \fi\ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Bfootnote}
% \begin{macro}{\Cfootnote}
% \begin{macro}{\Dfootnote}
% \begin{macro}{\Efootnote}
% We need similar commands for the other footnote series.
%    \begin{macrocode}
\def\Bfootnote#1{%
  \ifnumberedpar@
    \xright@appenditem{\noexpand\vBfootnote{B}%
                   {{\@nums}{\@tag}{#1}}}\to\inserts@list
    \global\advance\insert@count by 1
  \else
    \vBfootnote{B}{{0|0|0|0|0|0|0}{}{#1}}%
  \fi\ignorespaces}
%    \end{macrocode}
%    \begin{macrocode}
\def\Cfootnote#1{%
  \ifnumberedpar@
    \xright@appenditem{\noexpand\vCfootnote{C}%
                   {{\@nums}{\@tag}{#1}}}\to\inserts@list
    \global\advance\insert@count by 1
  \else
    \vCfootnote{C}{{0|0|0|0|0|0|0}{}{#1}}%
  \fi\ignorespaces}
%    \end{macrocode}
%    \begin{macrocode}
\def\Dfootnote#1{%
  \ifnumberedpar@
    \xright@appenditem{\noexpand\vDfootnote{D}%
                   {{\@nums}{\@tag}{#1}}}\to\inserts@list
    \global\advance\insert@count by 1
  \else
    \vDfootnote{D}{{0|0|0|0|0|0|0}{}{#1}}%
  \fi\ignorespaces}
%    \end{macrocode}
%    \begin{macrocode}
\def\Efootnote#1{%
  \ifnumberedpar@
    \xright@appenditem{\noexpand\vEfootnote{E}%
                   {{\@nums}{\@tag}{#1}}}\to\inserts@list
    \global\advance\insert@count by 1
  \else
    \vEfootnote{E}{{0|0|0|0|0|0|0}{}{#1}}%
  \fi\ignorespaces}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{Normal footnote formatting}
%
% The processing of each note is done
% by four principal macros: the "vfootnote" macro takes the text
% of the footnote and does the "\insert"; it calls on the
% "footfmt" macro to select the right fonts, print the line
% number and lemma, and do any other formatting needed for that individual
% note. Within the output routine, the two other macros, "footstart"
% and "footgroup", are called; the first prints extra vertical
% space and a footnote rule, if desired; the second does any reformatting
% of the whole set of footnotes in this series for this page---such
% as paragraphing or division into columns---and then sends them to the
% page.
%
% These four macros, and the other macros and parameters shown
% here, are distinguished by the ``series letter''
% that indicates which set of footnotes
% we're dealing with---"A", "B", "C", "D", or "E".
% The series letter always precedes the string "foot" in macro
% and parameter names. Hence, for the "A" series, the four macros
% are called "\vAfootnote", "\Afootfmt", "\Afootstart",
% and "\Afootgroup".
%
% \begin{macro}{\normalvfootnote}
% We now begin a series of commands that do ``normal'' footnote
% formatting: a format much like that implemented
% in \PlainTeX{}, in which each footnote
% is a separate paragraph.
%
% "\normalvfootnote" takes the series letter as "#1",
% and the entire text of the footnote is "#2". It does the
% "\insert" for this note, calling on the "footfmt" macro for
% this note series to format the text of the note.
%    \begin{macrocode}
\def\normalvfootnote#1#2{\insert\csname #1footins\endcsname\bgroup
  \notefontsetup
  \interlinepenalty\csname inter#1footnotelinepenalty\endcsname
  \splittopskip\ht\strutbox
  \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
  \leftskip\z@skip \rightskip\z@skip
  \spaceskip\z@skip \xspaceskip\z@skip
  \csname #1footfmt\endcsname #2\egroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\normalfootfmt}
% \label{normalfootfmt}\relax
% "\normalfootfmt" is a ``normal'' macro
% to take the footnote line and page
% number information (see p.\,\pageref{linenumbers}), and the
% desired text, and output what's to be printed.
% Argument "#1" contains the line and page number information
% and lemma font specifier;
% "#2" is the lemma;
% "#3" is the note's text. This version is very
% rudimentary---it uses "\printlines"
% to print just the range of line numbers,
% followed by a square bracket, the lemma, and the note text;
% it's intended to be copied and modified as necessary.
%
% "\par" should always be redefined to "\endgraf" within
% the format macro (this is what "\normal@pars" does),
% to override any tricky stuff which might be done in the main text
% to get the lines numbered automatically (as set up by
% "\autopar", for example).
%    \begin{macrocode}
\def\normalfootfmt#1#2#3{%
  \normal@pars
  \parindent=0pt \parfillskip=0pt plus 1fil
  {\notenumfont\printlines#1|}\strut\enspace
      {\select@lemmafont#1|#2}\rbracket\enskip#3\strut\par}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\endashchar}
% \begin{macro}{\fullstop}
% \begin{macro}{\rbracket}
% The fonts that are used for printing notes might not have the
% character mapping we expect: for example, the Computer Modern font
% that contains old-style numerals does not contain an en-dash or
% square brackets, and its period and comma are in odd locations.
% To allow use of the standard footnote macros with such fonts, we use
% the following macros for certain characters.
%
% The "\endashchar" macro is simply an en-dash from a
% "\rm" font that is immune to changes in the surrounding
% font.  The same goes for the full stop.  These two are used in
% "\printlines".  The right bracket macro is the same again;
% it crops up in "\normalfootfmt" and the other footnote
% macros for controlling the format of footnotes.
%    \begin{macrocode}
\def\endashchar{{\rm--}}
\def\fullstop{{\rm.}}
\def\rbracket{{\rm\thinspace]}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\printlines}
% The "\printlines" macro prints the line
% numbers for a note---which, in the
% general case, is a rather complicated task.
% The seven parameters of the
% argument are the line numbers as stored in "\@nums", in the
% form described on page \pageref{linenumbers}: the starting
% page, line, and sub-line numbers, followed by the ending page,
% line, and sub-line numbers, and then the font specifier for
% the lemma.
%
% \begin{macro}{\@pnum}
% \begin{macro}{\@ssub}
% \begin{macro}{\@elin}
% \begin{macro}{\@esl}
% \begin{macro}{\@dash}
% To simplify the logic, we use a lot of counters to tell us which
% numbers need to get printed (using $1$ for yes, $0$ for no, so
% that "\ifodd" tests for ``yes''). The counter assignments are:
% \begin{itemize}\addtolength{\itemsep}{-1ex}
% \item "\@pnum" for page numbers;
% \item "\@ssub" for starting sub-line;
% \item "\@elin" for ending line;
% \item "\@esl" for ending sub-line; and
% \item "\@dash" for the dash between the starting and ending groups.
% \end{itemize}
% There's no counter for the line number because it's always printed.
%    \begin{macrocode}
\newcount\@pnum \newcount\@ssub \newcount\@elin
\newcount\@esl  \newcount\@dash
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% First of all, we print the page numbers only if\/: 1)~we're doing
% the lineation by page, and 2)~the ending page number is different
% from the starting page number.\label{printlines}
%    \begin{macrocode}
\def\printlines#1|#2|#3|#4|#5|#6|#7|{\begingroup
  \@pnum=0 \@dash=0
  \ifbypage@
     \ifnum#4=#1 \else
        \@pnum=1
        \@dash=1
     \fi
  \fi
%    \end{macrocode}
%
% We print the ending line number if\/: 1)~we're printing the ending
% page number, or 2)~it's different from the starting line number.
%    \begin{macrocode}
  \@elin=\@pnum
  \ifnum#2=#5 \else
      \@elin=1
      \@dash=1
  \fi
%    \end{macrocode}
%
% We print the starting sub-line if it's nonzero.
%    \begin{macrocode}
  \@ssub=0
  \ifnum#3=0 \else
      \@ssub=1
  \fi
%    \end{macrocode}
%
% We print the ending sub-line if it's nonzero and: 1)~it's different
% from the starting sub-line number, or 2)~the ending line number is
% being printed.
%    \begin{macrocode}
  \@esl=0
  \ifnum#6=0 \else
      \ifnum#6=#3
         \@esl=\@elin
      \else
         \@esl=1
         \@dash=1
      \fi
  \fi
%    \end{macrocode}
%
% Now we're ready to print it all, based on our counter values. The
% only subtlety left here is when to print a period between
% numbers. But the only instance in which this is tricky is for the
% ending sub-line number: it could be coming after the starting
% sub-line number (in which case we want only the dash) or after an
% ending line number (in which case we need to insert a period).
%    \begin{macrocode}
  \ifodd\@pnum #1\fullstop\fi
  #2%
  \ifodd\@ssub \fullstop #3\fi
  \ifodd\@dash \endashchar\fi
  \ifodd\@pnum #4\fullstop\fi
  \ifodd\@elin #5\fi
  \ifodd\@esl \ifodd\@elin\fullstop\fi #6\fi
\endgroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\normalfootstart}
% \label{normalvalues}\relax
% "\normalfootstart"
% is a standard footnote-starting macro, called in the output
% routine whenever there are footnotes of this series to be
% printed: it skips a bit and then draws a rule.
%
% Any "footstart" macro must put onto the page something that
% takes up space exactly equal to the "\skip\footins" value for
% the associated series of notes. \TeX\ makes page computations based
% on that "\skip" value, and the output pages will suffer from
% spacing problems if what you add takes up a different amount of
% space.
%
% The "\leftskip" and "\rightskip" values
% are both zeroed here.\label{footskips}
% Similarly, these skips are cancelled in the "vfootnote" macros
% for the various types of notes. Strictly speaking,
% this is necessary only
% if you are using paragraphed footnotes, but we have put it here
% and in the other "vfootnote" macros too so that the behavior of
% "EDMAC" in this respect is general across all footnote types
% (you can change this).  What this means is that any "\leftskip"
% and "\rightskip" you specify applies to the main text, but not
% the footnotes.  The footnotes continue to be of width "\hsize".
%    \begin{macrocode}
\def\normalfootstart#1{%
  \vskip\skip\csname #1footins\endcsname
  \leftskip0pt \rightskip0pt
  \csname #1footnoterule\endcsname}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\normalfootnoterule}
% "\normalfootnoterule" is
% a standard footnote-rule macro, for use by a "footstart"
% macro: just the same as the \PlainTeX\ footnote rule.
%    \begin{macrocode}
\let\normalfootnoterule=\footnoterule
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\normalfootgroup}
% "\normalfootgroup" is
% a standard footnote-grouping macro: it sends the
% contents of the footnote-insert box to the output page without
% alteration.
%    \begin{macrocode}
\def\normalfootgroup#1{\unvbox\csname #1footins\endcsname}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Standard footnote definitions}
%
% \begin{macro}{\footnormal}
% We can now define all the parameters for the five series of
% footnotes; initially they use the ``normal'' footnote formatting,
% which is set up by calling "\footnormal".
% You can switch to another type of formatting by using
% "\footparagraph", "\foottwocol", or "\footthreecol".
%
% Switching to a variation of ``normal''
% formatting requires changing the
% quantities defined in "\footnormal".  The best way to
% proceed would be to make a copy of this macro, with a different
% name, make your desired changes in that copy, and then invoke it,
% giving it the letter of the footnote series you wish to control.
%
% (We have not defined baseline skip values like
% "\abaselineskip", since this is one of the quantities set in
% "\notefontsetup".)
%
% What we want to do here is to say something like the following
% for each footnote series. (This is an example, not part of the
% actual "EDMAC" code.)
% \begin{verbatim}
% \newinsert\Afootins
% \newcount\interAfootnotelinepenalty \interAfootnotelinepenalty=100
% \skip\Afootins=12pt plus5pt minus5pt
% \count\Afootins=1000
% \dimen\Afootins=0.8\vsize
% \let\vAfootnote=\normalvfootnote  \let\Afootfmt=\normalfootfmt
% \let\Afootstart=\normalfootstart  \let\Afootgroup=\normalfootgroup
% \let\Afootnoterule=\normalfootnoterule
% \end{verbatim}
% Instead of repeating ourselves, we define a "\footnormal"
% macro that makes all these assignments for us, for any given
% series letter.  This also makes it easy to change from any
% different system of formatting back to the "normal" setting.
%
% We begin by defining the five new insertion classes, and some
% "count" registers; these are "\outer" operations that
% can't be done inside "\footnormal".
%    \begin{macrocode}
\newinsert\Afootins \newinsert\Bfootins
\newinsert\Cfootins \newinsert\Dfootins
\newinsert\Efootins
%    \end{macrocode}
%    \begin{macrocode}
\newcount\interAfootnotelinepenalty
\newcount\interBfootnotelinepenalty
\newcount\interCfootnotelinepenalty
\newcount\interDfootnotelinepenalty
\newcount\interEfootnotelinepenalty
%    \end{macrocode}
% Now we set up the "\footnormal" macro itself.  It takes
% one argument: the footnote series letter.
%    \begin{macrocode}
\def\footnormal#1{%
  \csname inter#1footnotelinepenalty\endcsname=100
  \expandafter\let\csname #1footstart\endcsname=\normalfootstart
  \expandafter\let\csname v#1footnote\endcsname=\normalvfootnote
  \expandafter\let\csname #1footfmt\endcsname=\normalfootfmt
  \expandafter\let\csname #1footgroup\endcsname=\normalfootgroup
  \expandafter\let\csname #1footnoterule\endcsname=%
                                             \normalfootnoterule
  \count\csname #1footins\endcsname=1000
  \dimen\csname #1footins\endcsname=0.8\vsize
  \skip\csname #1footins\endcsname=12pt plus6pt minus6pt}
%    \end{macrocode}
% \end{macro}
% Some of these values deserve comment: the "\dimen"
% setting allows 80\% of the page to be occupied by notes;  the
% "\skip" setting is deliberately flexible, since pages with
% lots of notes attached to many of the lines can be a bit hard
% for \TeX\ to make.
%
% And finally, we initialize the formatting for all the footnote series
% to be normal.
%    \begin{macrocode}
\footnormal{A}
\footnormal{B}
\footnormal{C}
\footnormal{D}
\footnormal{E}
%    \end{macrocode}
%
%
% \subsection{Paragraphed footnotes}
%
% The paragraphed-footnote option
% reformats all the footnotes of one series for a page into
% a single paragraph; this is especially appropriate when the notes are
% numerous and brief. The code is based
% on {\em The \TeX book}, pp.\,398--400, with
% alterations for our environment. This algorithm uses a considerable
% amount of save-stack space: a \TeX\ of ordinary size may not be able
% to handle more than about $100$ notes of this kind on a page.
%
% \begin{macro}{\footparagraph}
% The "\footparagraph" macro
% sets up everything for one series of footnotes so that
% they'll be paragraphed; it takes the series letter as argument.
% We include the setting of "\count\footins" to $1000$ for the
% footnote series just in case you are switching to paragraphed
% footnotes after having columnar ones, since they change this
% value (see below).
%
% It is important to call "\footparagraph" only after
% "\hsize" has been set for the pages that use
% this series of notes; otherwise \TeX\ will try to put too
% many or too few of these notes on each page. If you need to
% change the "\hsize" within the document, call
% "\footparagraph" again afterwards to take account of the new
% value.  The argument of "\footparagraph" is the letter
% ("A"--"E") denoting the series of notes to be paragraphed.
%    \begin{macrocode}
\def\footparagraph#1{%
  \expandafter\let\csname #1footstart\endcsname=\parafootstart
  \expandafter\let\csname v#1footnote\endcsname=\para@vfootnote
  \expandafter\let\csname #1footfmt\endcsname=\parafootfmt
  \expandafter\let\csname #1footgroup\endcsname=\para@footgroup
  \count\csname #1footins\endcsname=1000
  \para@footsetup{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\para@footsetup}
% "\footparagraph" calls the
% "\para@footsetup" macro to calculate a special
% fudge factor, which is the ratio of the "\baselineskip"
% to the "\hsize". We assume that the proper value of
% "\baselineskip" for the footnotes (normally 9\,pt) has been set
% already, in "\notefontsetup".  The argument of the macro is
% again the note series letter.
%    \begin{macrocode}
\def\para@footsetup#1{{\notefontsetup
  \dimen0=\baselineskip
  \multiply\dimen0 by 1024
  \divide \dimen0 by \hsize \multiply\dimen0 by 64
  \expandafter
  \xdef\csname #1footfudgefactor\endcsname{%
    \expandafter\en@number\the\dimen0 }}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\en@number}
% The "\en@number" macro extracts the numerical part from a "dimen"
% register and strips off the ``"pt"'' (see {\em The \TeX
% book}, p.\,375).  It turns "10pt" into "10" so that you can use
% it in arithmetic.
%    \begin{macrocode}
{\catcode`p=12 \catcode`t=12 \gdef\en@number#1pt{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\parafootstart}
% "\parafootstart" is the same as "\normalfootstart", but we give it
% again to ensure that "\rightskip" and "\leftskip" are
% zeroed (this needs to be done before "\para@footgroup" in the
% output routine).  You might have decided to change this for other
% kinds of note, but here it should stay as it is.  The size of
% paragraphed notes is calculated using a fudge factor which in
% turn is based on "\hsize".  So the paragraph of notes needs to be
% that wide.
%
% The argument of the macro is again the note series letter.
%    \begin{macrocode}
\def\parafootstart#1{%
  \rightskip=0pt \leftskip=0pt \parindent=0pt
  \vskip\skip\csname #1footins\endcsname
  \csname #1footnoterule\endcsname}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\para@vfootnote}
% "\para@vfootnote"
% is a version of the "\vfootnote" command that's used for
% paragraphed notes.  It gets appended to the "\inserts@list" list
% by an outer-level footnote command like "\Afootnote".  The first
% argument is the note series letter; the second is the full text
% of the printed note itself, including line numbers, lemmata, and
% footnote text.
%
% The initial model for this insertion is, of course, the
% "\insert\footins" definition in {\em The \TeX book}, p.\,398.
% There, the footnotes are first collected up in hboxes, and these
% hboxes are later unpacked and stuck together into a paragraph.
%
% However, Michael Downes\index{Downes, Michael} has pointed out
% that because text in hboxes gets typeset in restricted horizontal
% mode, there are some undesirable side-effects if you later want
% to break such text across lines.  In restricted horizontal mode,
% where \TeX\ does not expect to have to break lines, it does not
% insert certain items like "\discretionary"s. If you later unbox
% these hboxes and stick them together, as the {\em \TeX book\/}
% macros do to make these footnotes, you lose the ability to
% hyphenate after an explicit hyphen.  This can lead to overfull
% "\hbox"es when you would not expect to find them, and to the
% uninitiated it might be very hard to see why the problem had
% arisen.\footnote{Michael Downes, ``Line Breaking in {\tt \bslash
% unhbox}ed Text'', {\em TUGboat\/} {\bf 11} (1990), pp.\,605--612.}
%
% Wayne Sullivan\index{Sullivan, Wayne} pointed out to us another
% subtle problem that arises from the same cause: \TeX\ also leaves
% the "\language" whatsit nodes out of the horizontal
% list.\footnote{See {\em The \TeX book}, p.\,455 (editions after
% January 1990).}  So changes from one language to another will not
% invoke the proper hyphenation rules in such footnotes.  Since
% critical editions often do deal with several languages,
% especially in footnotes, we really ought to get this bit of code
% right.
%
% To get around these problems, Wayne suggested emendations to the
% {\em \TeX book\/} versions of these macros which are broadly the
% same as those described by Michael: the central idea (also
% suggested by Donald Knuth in a letter to Michael) is to avoid collecting
% the text in an "\hbox" in the first place, but instead to collect
% it in a "\vbox" whose width is (virtually)
% infinite.\label{hboxproblem} The text is therefore typeset in
% unrestricted horizontal mode, as a paragraph consisting of a
% single long line.  Later, there is an extra level of unboxing to
% be done: we have to unpack the "\vbox", as well as the hboxes
% inside it, but that's not too hard.  For details, we refer you to
% Michael's article, where the issues are clearly
% explained.\footnote{Wayne supplied his own macros to do this, but
% since they were almost identical to Michael's, we have used the
% latter's {\tt \bslash unvxh} macro since it is publicly
% documented.}  Michael's unboxing macro is called "\unvxh": unvbox,
% extract the last line, and unhbox it.
%
% Doing things this way has an important
% consequence:\label{nobreaks-detail} as Michael
% pointed out, you really can't put an explicit line-break into a
% note built in a "\vbox" the way we are doing.\footnote{``Line
% Breaking'', p.\,610.}  In other words, be very careful not to say
% "\break", or "\penalty-10000", or any equivalent inside your
% para-footnote.\label{nobreak}  If you do, most of the note will
% probably disappear.  You {\em are\/} allowed to make strong
% suggestions; in fact "\penalty-9999" will be quite okay.  Just
% don't make the break mandatory.  We haven't applied any of
% Michael's solutions here, since we feel that the problem is
% exiguous, and "EDMAC" is quite baroque enough already.  If
% you think you are having this problem, look up Michael's
% solutions.
%
% One more thing; we set "\leftskip" and "\rightskip" to zero.
% This has the effect of neutralizing any such skips which may
% apply to the main text (cf.\ p.\,\pageref{footskips} above).
% We need to do this, since "footfudgefactor" is calculated on
% the assumption that the notes are "\hsize" wide.
%
% So, finally, here is the modified foot-paragraph code, which
% sets the footnote in vertical mode so that language and
% discretionary nodes are included.
%    \begin{macrocode}
\def\para@vfootnote#1#2{\insert\csname #1footins\endcsname
  \bgroup
    \notefontsetup
    \interlinepenalty=\csname inter#1footnotelinepenalty\endcsname
    \splittopskip=\ht\strutbox
    \splitmaxdepth=\dp\strutbox \floatingpenalty=\@MM
    \leftskip0pt \rightskip0pt
    \setbox0=\vbox{\hsize=\maxdimen
      \noindent\csname #1footfmt\endcsname#2}%
    \setbox0=\hbox{\unvxh0}%
    \dp0=0pt
    \ht0=\csname #1footfudgefactor\endcsname\wd0
%    \end{macrocode}
% Here we produce the contents of the footnote from box $0$, and
% add a penalty of $0$ between boxes in this insert.
%    \begin{macrocode}
    \box0
    \penalty0
  \egroup}
%    \end{macrocode}
% The final penalty of $0$
% was added here at Wayne's\index{Sullivan, Wayne}
% suggestion to avoid a weird page-breaking problem, which occurs on
% those occasions when \TeX\ attempts to split foot paragraphs.
% After trying out such a split (see {\em The \TeX book}, p.\,124),
% \TeX\ inserts a penalty of $-10000$ here, which
% nearly always forces the break at the end of the whole footnote
% paragraph (since individual notes can't be split) even when this
% leads to an overfull vbox.  The change above results in a penalty
% of $0$ instead which allows, but doesn't force, such breaks. This
% penalty of $0$ is later removed, after page breaks have been
% decided, by the "\unpenalty" macro in "\makehboxofhboxes". So it
% does not affect how the footnote paragraphs are typeset (the
% notes still have a penalty of $-10$ between them, which is added
% by "\parafootfmt").
% \end{macro}
%
% \begin{macro}{\unvxh}
% Here is Michael's\index{Downes, Michael} definition of "\unvxh",
% used above.  Michael's macro also takes care to remove some
% unwanted penalties and glue that \TeX\ automatically attaches to
% the end of paragraphs.  When \TeX\ finishes a paragraph, it
% throws away any remaining glue, and then tacks on the following
% items: a "\penalty" of $10000$, a "\parfillskip" and a
% "\rightskip" ({\em The \TeX book}, pp.\,99--100).  "\unvxh"
% cancels these unwanted paragraph-final items using "\unskip" and
% "\unpenalty".
%    \begin{macrocode}
\def\unvxh#1{%
  \setbox0=\vbox{\unvbox#1%
    \global\setbox1=\lastbox}%
  \unhbox1
  \unskip            % remove \rightskip,
  \unskip            % remove \parfillskip,
  \unpenalty         % remove \penalty of 10000,
  \hskip\ipn@skip}   % but add the glue to go between the notes
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\interparanoteglue}
% \begin{macro}{\ipn@skip}
% \label{interparanoteglue}\relax
% Close observers will notice that we snuck some glue called
% "\ipn@skip" onto the end of the hbox produced by "\unvxh" in the
% above macro.
%
% We want to be able to have some glue between our paragraphed
% footnotes. But since we are initially setting our notes in
% internal vertical mode, as little paragraphs, any paragraph-final
% glue will get discarded.  Since "\unvxh" is already busy fiddling
% with glue and penalties at the end of these paragraphs, we take
% advantage of the opportunity to provide our inter-note spacing.
%
% We collect the value of the inter-parafootnote glue value as the
% parameter of a macro called---wait for it---"\interparanoteglue".
% We put this value into the value of a glue register
% "\ipn@skip" (inter-para-note-skip) making sure first to set the
% current font to the value normally used in footnotes so that the value of an
% "em" will be taken from the right font.
%    \begin{macrocode}
\newskip\ipn@skip
\def\interparanoteglue#1{%
             {\notefontsetup\global\ipn@skip=#1 \relax}}
\interparanoteglue{1em plus.4em minus.4em}
%    \end{macrocode}
% There is a point to be careful about regarding the
% "\interparanoteglue".  Remember that in "\para@vfootnote" we do
% some measurements on the footnote box, and use the resulting size
% to make an estimate of how much the note will contribute to the
% height of our final footnote paragraph.  This information is used
% by the output routine to allocate the right amount of vertical
% space on the page for the notes ({\em The \TeX book}, pp.\,398--399).
%
% The length of the footnote includes the natural size of the glue
% specified by "\interparanoteglue", but not its stretch or shrink
% components, since at this point the note has no need to stretch
% or shrink. Later, when the paragraph is actually composed by
% "\parafootgroup" in the output routine, \TeX\ will almost
% certainly do some stretching and shrinking of this glue in order
% to make the paragraph look nice. Probably the stretching and
% shrinking over the whole paragraph will cancel each other out.
% But if not, the actual vertical size of the paragraph may not
% match the size the output routine had been told to expect, and
% you may get an overfull/underfull "\vbox" message from the output
% routine.  To minimize the risk of this, you can do two things:
% keep the "plus" and "minus" components of "\interparanoteglue"
% small compared with its natural glue, and keep them the same as
% each other.  As a general precaution, keep the size and
% flexibility of the "\skip\footins" glue on the high side too:
% because the reckoning is approximate, footnote blocks may be up
% to a line bigger or smaller than the output routine allows for,
% so keep some flexible space between the text and the notes.
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\parafootfmt}
% "\parafootfmt" is
% "\normalfootfmt" adapted to do the special stuff
% needed for paragraphed notes---leaving out the "\endgraf" at the
% end, sticking in special penalties and kern, and leaving out the
% "\footstrut".  The first argument is the line and page
% number information, the second is the lemma, and the third is the
% text of the footnote.
%    \begin{macrocode}
\def\parafootfmt#1#2#3{%
  \normal@pars
  \parindent=0pt \parfillskip=0pt plus1fil
  {\notenumfont\printlines#1|}\enspace
  {\select@lemmafont#1|#2}\rbracket\enskip
  #3\penalty-10 }
%    \end{macrocode}
% Note that in the above definition, the penalty of $-10$
% encourages a line break between notes, so that notes have a
% slight tendency to begin on new lines.
% \end{macro}
%
% \begin{macro}{\para@footgroup}
% This "footgroup" code is modelled on the macros in {\em The
% \TeX book}, p.\,399.  The only difference is the "\unpenalty"
% in "\makehboxofhboxes", which is there to remove the penalty of
% $0$ which was added to the end of each footnote by
% "\para@vfootnote".
%
% The call to "\notefontsetup" is to ensure that the correct
% "\baselineskip" for the footnotes is used. The argument is the
% note series letter.
%    \begin{macrocode}
\def\para@footgroup#1{%
  \unvbox\csname #1footins\endcsname \makehboxofhboxes
  \setbox0=\hbox{\unhbox0 \removehboxes}%
  \notefontsetup
  \noindent\unhbox0\par}
\def\makehboxofhboxes{\setbox0=\hbox{}%
  \loop
    \unpenalty
    \setbox2=\lastbox
  \ifhbox2
    \setbox0=\hbox{\box2\unhbox0}
  \repeat}
\def\removehboxes{\setbox0=\lastbox
  \ifhbox0{\removehboxes}\unhbox0 \fi}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Columnar footnotes}
%
% \begin{macro}{\rigidbalance}
% \begin{macro}{\dosplits}
% \begin{macro}{\splitoff}
% \begin{macro}{\@h}
% \begin{macro}{\@k}
% We will now define macros for three-column notes and two-column
% notes. Both sets of macros will use "\rigidbalance", which splits a
% box ("#1") into into a number ("#2") of columns, each
% with a space ("#3") between the top baseline and the top of
% the "\vbox".  The "\rigidbalance" macro is taken from
% {\em The \TeX book}, p.\,397, with a slight change to the syntax of
% the arguments so that they don't depend on white space.  Note also
% the extra unboxing in "\splitoff", which allows the new "\vbox" to
% have its natural height as it goes into the alignment.
%    \begin{macrocode}
\newcount\@k \newdimen\@h
\def\rigidbalance#1#2#3{\setbox0=\box#1 \@k=#2 \@h=#3
  \line{\splittopskip=\@h \vbadness=\@M \hfilneg
  \valign{##\vfil\cr\dosplits}}}
\def\dosplits{\ifnum\@k>0 \noalign{\hfil}\splitoff
  \global\advance\@k-1\cr\dosplits\fi}
\def\splitoff{\dimen0=\ht0
  \divide\dimen0 by\@k \advance\dimen0 by\@h
  \setbox2 \vsplit0 to \dimen0
  \unvbox2 }
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \paragraph{Three columns}
%
% \begin{macro}{\footthreecol}
% You say "\footthreecol{A}" to have the "A" series of footnotes
% typeset in three columns. It is important to call this only after
% "\hsize" has been set for the document.
%    \begin{macrocode}
\def\footthreecol#1{%
  \expandafter\let\csname v#1footnote\endcsname=\threecolvfootnote
  \expandafter\let\csname #1footfmt\endcsname=\threecolfootfmt
  \expandafter\let\csname #1footgroup\endcsname=\threecolfootgroup
  \threecolfootsetup{#1}}
%    \end{macrocode}
% The "\footstart" and "\footnoterule" macros for these notes assume
% the normal values (p.\,\pageref{normalvalues} above).
% \end{macro}
%
% \begin{macro}{\threecolfootsetup}
% The "\threecolfootsetup" macro calculates and sets some numbers
% for three-column footnotes.
%
% We set the "\count" of the foot insert to $333$.
% Each footnote can be thought of as contributing only one third of
% its height to the page, since the footnote insertion has been
% made as a long narrow column, which then gets trisected by the
% "\rigidbalance" routine (inside "\threecolfootgroup").
% These new, shorter columns are saved in a box, and then that box
% is {\em put back\/} into the footnote insert, replacing the
% original collection of footnotes.  This new box is, therefore,
% only about a third of the height of the original one.
%
% The "\dimen" value for this note series has to change in the
% inverse way: it needs to be three times
% the actual limit on the amount of space these notes are allowed to
% fill on the page, because when \TeX\ is
% accumulating material for the page
% and checking that limit, it doesn't apply the "\count" scaling.
%    \begin{macrocode}
\def\threecolfootsetup#1{%
  \count\csname #1footins\endcsname 333
  \multiply\dimen\csname #1footins\endcsname by 3 }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\threecolvfootnote}
% "\threecolvfootnote"
% is the "\vfootnote" command for three-column notes. The
% call to "\notefontsetup" ensures that the
% "\splittopskip" and "\splitmaxdepth" take their values
% from the right "\strutbox": the one used in footnotes.
% Note especially the importance of temporarily reducing the
% "\hsize" to $0.3$ of its normal value.  This determines the
% widths of the individual columns.  So if the normal "\hsize"
% is, say, 10\,cm, then each column will be $0.3\times10=3$\,cm
% wide, leaving a gap of 1\,cm spread equally between columns
% (i.e., .5\,cm between each).
%
% The arguments are 1)~the note series letter and 2)~the full text
% of the note (including numbers, lemma and text).
%    \begin{macrocode}
\def\threecolvfootnote#1#2{%
  \insert\csname #1footins\endcsname\bgroup
  \notefontsetup
  \interlinepenalty=\csname inter#1footnotelinepenalty\endcsname
  \floatingpenalty=20000
  \splittopskip=\ht\strutbox \splitmaxdepth=\dp\strutbox
  \rightskip=0pt \leftskip=0pt
  \csname #1footfmt\endcsname #2\egroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\threecolfootfmt}
% "\threecolfootfmt"
% is the command that formats one note.
% It uses "\raggedright", which will usually be
% preferable with such short lines.  Setting the "\parindent"
% to zero means that, within each individual note, the lines begin
% flush left.
%
% The arguments are 1)~the line numbers, 2)~the lemma and 3)~the
% text of the "-footnote" command.
%    \begin{macrocode}
\def\threecolfootfmt#1#2#3{%
  \normal@pars
  \hsize .3\hsize
  \parindent=0pt
  \tolerance=5000
  \raggedright
  \leavevmode
  \strut{\notenumfont\printlines#1|}\enspace
  {\select@lemmafont#1|#2}\rbracket\enskip
  #3\strut\par\allowbreak}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\threecolfootgroup}
% And here is the "footgroup" macro that's called within the
% output routine to regroup the notes into three columns. Once
% again, the call to "\notefontsetup" is there to ensure that
% it is the right "\splittopskip"---the one used in
% footnotes---which is used to provide the third argument for
% "\rigidbalance".  This third argument ("\@h") is the
% "topskip" for the box containing the text of the
% footnotes, and does the job of making sure the top lines of the
% columns line up horizontally.  In {\em The \TeX book}, p.\,398,
% Donald Knuth suggests retrieving the ouput of "\rigidbalance",
% putting it back into the insertion box, and then printing the
% box.  Here, we just print the "\line" which comes out of
% "\rigidbalance" directly, without any re-boxing.
%    \begin{macrocode}
\def\threecolfootgroup#1{{\notefontsetup
  \splittopskip=\ht\strutbox
  \expandafter
  \rigidbalance\csname #1footins\endcsname 3 \splittopskip }}
%    \end{macrocode}
% \end{macro}
%
% \paragraph{Two columns}
%
% \begin{macro}{\foottwocol}
% You say "\foottwocol{A}" to have the "A" series of footnotes
% typeset in two columns. It is important to call this only after
% "\hsize" has been set for the document.
%    \begin{macrocode}
\def\foottwocol#1{%
  \expandafter\let\csname v#1footnote\endcsname=\twocolvfootnote
  \expandafter\let\csname #1footfmt\endcsname=\twocolfootfmt
  \expandafter\let\csname #1footgroup\endcsname=\twocolfootgroup
  \twocolfootsetup{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\twocolfootsetup}
% \begin{macro}{\twocolvfootnote}
% \begin{macro}{\twocolfootfmt}
% \begin{macro}{\twocolfootgroup}
% Here is a series of macros which are very similar to their
% three-column counterparts. In this case,
% each note is assumed to contribute only a half a line of text.
% And the notes are set in columns
% "0.45\hsize" wide, giving a gap between them of one tenth
% of the "\hsize".
%    \begin{macrocode}
\def\twocolfootsetup#1{%
  \count\csname #1footins\endcsname 500
  \multiply\dimen\csname #1footins\endcsname by 2 }
%    \end{macrocode}
%    \begin{macrocode}
\def\twocolvfootnote#1#2{\insert\csname #1footins\endcsname\bgroup
  \notefontsetup
  \interlinepenalty=\csname inter#1footnotelinepenalty\endcsname
  \floatingpenalty=20000
  \splittopskip=\ht\strutbox \splitmaxdepth=\dp\strutbox
  \rightskip=0pt \leftskip=0pt
  \csname #1footfmt\endcsname #2\egroup}
%    \end{macrocode}
%    \begin{macrocode}
\def\twocolfootfmt#1#2#3{%
  \normal@pars
  \hsize .45\hsize
  \parindent=0pt
  \tolerance=5000
  \raggedright
  \leavevmode
  \strut{\notenumfont\printlines#1|}\enspace
  {\select@lemmafont#1|#2}\rbracket\enskip
  #3\strut\par\allowbreak}
%    \end{macrocode}
%    \begin{macrocode}
\def\twocolfootgroup#1{{\notefontsetup
  \splittopskip=\ht\strutbox
  \expandafter
  \rigidbalance\csname #1footins\endcsname 2 \splittopskip}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \section{Output routine}
% \label{output}\relax
%
% Now we begin the output routine and associated things.
%
% \subsection{Crop marks}
%
% The following are the parameters that specify the page dimensions
% that relate to crop marks; they are set by the "\cropsetup"
% macro.
%
% \begin{macro}{\crop@vsize}
% "\crop@vsize" is the vertical distance between crop marks.
%    \begin{macrocode}
\newdimen\crop@vsize \crop@vsize=0pt
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\crop@hsize}
% "\crop@hsize" is the horizontal distance between crop marks.
%    \begin{macrocode}
\newdimen\crop@hsize \crop@hsize=0pt
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\head@margin}
% "\head@margin" is the head margin.
%    \begin{macrocode}
\newdimen\head@margin \head@margin=0pt
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\back@margin}
% "\back@margin" is the back margin.
%    \begin{macrocode}
\newdimen\back@margin \back@margin=0pt
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\odd@back}
% \begin{macro}{\even@back}
% \begin{macro}{\@back}
% To handle the odd/even difference in the back margin, we keep the
% different margin sizes in two registers, "\odd@back" and
% "\even@back", and use a token register, "\@back", to
% hold the code that decides which to use.
%    \begin{macrocode}
\newdimen\odd@back \odd@back=0pt
\newdimen\even@back \even@back=0pt
\newtoks\@back
\@back={\ifodd\pageno \odd@back \else \even@back\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\registration@marks}
% We store up the registration marks in a box
% called "\registration@marks" that's reused for every
% page, instead of regenerating them all again at each page.
%    \begin{macrocode}
\newbox\registration@marks
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\vertical@rules}
% \begin{macro}{\horizontal@rules}
% The following are macros that will be used in
% the course of making "\registration@marks".
%    \begin{macrocode}
\def\vertical@rules{%
  \hbox to\crop@hsize{%
    \vrule height1pc width\cropwidth depth0pt
    \hfil
    \vrule width\cropwidth depth0pt}}
%    \end{macrocode}
%    \begin{macrocode}
\def\horizontal@rules{%
  \hbox to\crop@hsize{%
    \llap{\vrule width1pc height\cropwidth \kern\cropgap}%
    \hfil
    \rlap{\kern\cropgap \vrule width1pc height\cropwidth}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cropwidth}
% \begin{macro}{\cropgap}
% Set standard values for the thickness of the rules used for drawing crop
% marks ("\cropwidth") and the gap by which crop marks don't cross
% ("\cropgap").
%    \begin{macrocode}
\newdimen\cropwidth \cropwidth=.4pt
%    \end{macrocode}
%    \begin{macrocode}
\newdimen\cropgap \cropgap=5pt
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\magicvskip}
% \begin{macro}{\headlinefont}
% \label{magic}\relax
% Publishers usually measure the head margin for the crop marks
% from the top of the running head.\footnote{Cf.\ Hugh Williamson,
% {\it Methods of Book Design\/} (New Haven: Yale University Press,
% 1983), p.\,21.\protect\index{Williamson, Hugh}}
%
% \PlainTeX's starting reference point for a page is not the
% running head, but a point "\topskip" above the baseline of
% the first line of main text on the page.  (Before doing anything
% else, \TeX\ adds a small amount of skip to the top of a new page,
% which is calculated to bring the baseline of the top line of text
% down to "\topskip" from the top of the page, i.e., from the
% point where the "\vsize" is measured from: {\em The \TeX
% book}, pp.\,113--114.) So any vertical matter we add in the output
% routine to the start of a page will sit with its base at a point
% "\topskip" above the baseline of the first line of the main
% text.  And if "\ht\strutbox" is the height of the header box
% we are adding, then the distance between its top and the
% reference point will be
% "\topskip"$-$"\ht\strutbox"$-s$, where $s$ is the space
% we want to put between the baselines of the header and the first
% text line.
%
% In \PlainTeX, this distance is $-22.5$\,pt, a ``magic constant''
% explained in {\em The \TeX book}, p.\,255. Rather than using this
% figure explicitly, "EDMAC" calculates it afresh, in case
% you have changed any of the values that go to make up this magic
% constant. The parameters involved are the "\topskip", the
% font of the "\headline" text (which determines the height of
% the "\strutbox"), and the "\baselineskip" (assuming that you
% want the header to be exactly two lines above the first line of
% the text). This calculation is done within "\cropsetup".
%    \begin{macrocode}
\newdimen\magicvskip \magicvskip=\topskip
%    \end{macrocode}
%
% If the "\headline" is going to be set at a different height
% from the top of the text, or in a different size of font,
% be sure to make the appropriate changes to the
% above parameters, or the crop marks will not be in the right
% position. We now set the standard value for "\headlinefont".
%    \begin{macrocode}
\let\headlinefont=\rm
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\cropsetup}
% \begin{macro}{\ifcropmarks@}
% Here at last is the "\cropsetup"
% macro that takes the page and margin
% dimensions you specify and calculates all the other parameters
% from them. It should always be used after "\hsize",
% "\makeheadline", and "\headlinefont" for the
% document have been set, as explained above.
% These macros use the same approach as those published by David
% Salomon\index{Salomon, David} in {\em TUGboat\/} {\bf 11} (1990),
% pp.\,77--78.  Cf.\ also the "\setcornerrules" code in {\em The \TeX
% book}, pp.\,416--417.
%
% The four arguments are as described above, on page
% \pageref{cropsetup}.
%
% First, set up a conditional, "\ifcropmarks@",
% for use in the output routine.
% Initially, it's false.  (It is set to true when you use the
% "\cropsetup" macro.)
%    \begin{macrocode}
\newif\ifcropmarks@
%    \end{macrocode}
% Now the main macro to set up crop marks:
%    \begin{macrocode}
\def\cropsetup#1#2#3#4{\cropmarks@true
  \global\crop@vsize=#1
  \global\crop@hsize=#2
  \global\head@margin=#3
  \global\back@margin=#4
%    \end{macrocode}
% The back margin for odd pages is easy. For even pages, we take the
% full width and subtract the text width and back margin size.
%    \begin{macrocode}
  \global\odd@back=\back@margin
  \global\even@back=\crop@hsize
  \global\advance\even@back by -\hsize
  \global\advance\even@back by -\back@margin
%    \end{macrocode}
%    \begin{macrocode}
  \setbox\registration@marks=
    \vbox to \crop@vsize{%
      \offinterlineskip
      \vbox to0pt{\vss
        \vertical@rules
        \kern\cropgap
        \horizontal@rules}%
      \vfil
      \vbox to0pt{%
        \horizontal@rules
        \kern\cropgap
        \vertical@rules\vss}}%
%    \end{macrocode}
%
% Set the box's size to zero.
%
%    \begin{macrocode}
  \ht\registration@marks=0pt
  \wd\registration@marks=0pt
%    \end{macrocode}
%
% In the next lines, we set the font to "\headlinefont" so that
% the height of the "\strutbox" will be the that of the
% "\headlinefont" font. This makes the assumption that font
% used for the "\headline" is invoked by "\headlinefont",
% and that the "\headlinefont" macro defines a
% "\strutbox" of an appropriate size for the font.  (The
% standard setting is to \PlainTeX's "\rm", and the height of a
% "\strutbox" for this font is already set by \PlainTeX.)
%    \begin{macrocode}
  \global\magicvskip=\topskip
  {\headlinefont \global\advance\magicvskip by -\ht\strutbox}%
  \global\advance\magicvskip by -2\baselineskip}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Output routine}
%
% \begin{macro}{\output}
% \begin{macro}{\edmac@output}
% \begin{macro}{\pagecontents}
% This is a new output routine, with changes to handle printing all our
% footnotes. Those changes have not been added directly, but are in macros
% that get called here: that should make it easier to see what would need
% to be taken over to a different output routine. We continue to use the
% "\pagebody", "\makeheadline", "\makefootline", and "\dosupereject"
% macros of \PlainTeX; for those macros, and the original version of
% "\output", see {\em The \TeX book}, p.\,364.
%    \begin{macrocode}
\output{\edmac@output}
\def\edmac@output{\shipout\vbox{\normal@pars
  \ifcropmarks@
    \do@cropmarks
  \else
    \vbox{\makeheadline\pagebody\makefootline}%
  \fi}%
  \advancepageno
  \ifnum\outputpenalty>-\@MM\else\dosupereject\fi}
%    \end{macrocode}
%    \begin{macrocode}
\def\pagecontents{\page@start
  \ifvoid\topins\else\unvbox\topins\fi
  \dimen@=\dp\@cclv \unvbox\@cclv % open up \box255
  \do@feet
  \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\do@cropmarks}
% When crop marks are to be printed,
% "\edmac@output" uses this macro to print them, along with the
% text of the page.
%    \begin{macrocode}
\def\do@cropmarks{%
  \vbox{\offinterlineskip
    \kern\magicvskip
    \copy\registration@marks
    \kern-\magicvskip}%
  \nointerlineskip
  \kern\head@margin
  \moveright\the\@back\vbox{\makeheadline\pagebody\makefootline}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\do@feet}
% "\do@feet" ships out all the footnotes. Standard "EDMAC" has only
% five feet, but there is nothing in principal to prevent you
% from creating an arachnoid or centipedal edition; straightforward
% modifications of "EDMAC" are all that's required. However, the
% myria\-pedal edition is ruled out by \TeX's limitations: the number
% of insertion classes is limited to $255$.
%    \begin{macrocode}
\def\do@feet{%
  \ifvoid\footins\else
    \vskip\skip\footins
    \footnoterule
    \unvbox\footins
  \fi
  \ifvoid\Afootins\else
    \Afootstart{A}\Afootgroup{A}%
  \fi
  \ifvoid\Bfootins\else
    \Bfootstart{B}\Bfootgroup{B}%
  \fi
  \ifvoid\Cfootins\else
    \Cfootstart{C}\Cfootgroup{C}%
  \fi
  \ifvoid\Dfootins\else
    \Dfootstart{D}\Dfootgroup{D}%
  \fi
  \ifvoid\Efootins\else
    \Efootstart{E}\Efootgroup{E}%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \section{Cross referencing}
% \label{xref}\relax
%
% You can mark a place in the text using a command of the form
% "\label{foo}", and later refer to it using the label
% "foo" by saying "\pageref{foo}", or "\lineref{foo}" or
% "\sublineref{foo}". These reference commands will produce,
% respectively, the page, line and sub-line on which the
% "\label{foo}" command occurred.
%
% The reference macros warn you if a reference is made to an
% undefined label. If "foo" has been used as a label before,
% the "\label{foo}" command will issue a complaint; subsequent
% "\pageref" and "\lineref" commands will refer to the
% latest occurrence of "\label{foo}". When any of these
% commands are used, an additional auxiliary file, called
% \meta{filename}".aux", is created.
%
% \begin{macro}{\labelref@list}
% Set up a new list, "\labelref@list", to hold the page, line and
% sub-line numbers for each label.
%    \begin{macrocode}
\list@create{\labelref@list}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@aux}
% "\@aux" is the output stream number for our auxiliary file
% that contains labeling commands.
%    \begin{macrocode}
\newwrite\@aux
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\do@labelsfile}
% The "\do@labelsfile" macro
% opens the auxiliary labels file and executes it; the file should
% consist of a stream of "\make@labels" commands. Then it opens
% a new auxiliary file, and redefines itself so that it isn't called
% again. This will be called by the first "\label" or reference
% command that appears in the text---and not at all if there are no
% labels or references, so we won't bother at all with an ".aux"
% file if there's no need for it.
%    \begin{macrocode}
\def\do@labelsfile{%
   \openin\@inputcheck=\jobname.aux
   \ifeof\@inputcheck \else
      \closein\@inputcheck
      \begingroup
         \makeatletter \catcode`\^^M=9
         \input\jobname.aux
      \endgroup
   \fi
   \immediate\openout\@aux=\jobname.aux
   \global\let\do@labelsfile=\relax}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\label}
% \begin{macro}{\zz@@@}
% The "\label" command first writes a "\@lab" macro to
% the "\linenum@out" file.  It then checks to see that the
% "\labelref@list" actually has something in it (if not, it
% creates a dummy entry), and pops the next value for the current
% label, storing it in "\label@refs". Finally it defines the
% label to be "\empty" so that any future check will turn up
% the fact that it has been used.\footnote{The remaining macros
% in this section were kindly revised by Wayne
% Sullivan,\index{Sullivan, Wayne}  who
% substantially improved their efficiency and flexibility.}
%    \begin{macrocode}
\def\zz@@@{000|000|000} % set three counters to zero in one go
%    \end{macrocode}
%    \begin{macrocode}
\def\label#1{\do@labelsfile
  \write\linenum@out{\string\@lab}%
  \ifx\labelref@list\empty
    \xdef\label@refs{\zz@@@}%
  \else
    \gl@p\labelref@list\to\label@refs
  \fi
  \edef\next{\write\@aux{\string\make@labels\label@refs|{#1}}}%
  \next}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\make@labels}
% The "\make@labels" macro gets executed when the labels file is
% read. For each label it defines a macro, whose name is made up
% partly from the label you supplied, that contains the page, line
% and sub-line numbers.  But first it checks to see whether the
% label has already been used (and complains if it has).
%    \begin{macrocode}
\def\make@labels#1|#2|#3|#4{%
  \expandafter\ifx\csname the@label#4\endcsname \relax\else
    \edmac@warning{Duplicate definition of label `#4'
                   on page \number\pageno.}%
  \fi
  \expandafter\gdef\csname the@label#4\endcsname{#1|#2|#3}%
  \ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@lab}
% The "\@lab" command, which appears in the "\linenum@out" file,
% appends the current values of page, line and sub-line to the
% "\labelref@list". These values are defined by the earlier
% "\@page", "\@l", and the "\sub@on" and "\sub@off" commands
% appearing in the "\linenum@out" file.
%    \begin{macrocode}
\def\@lab{\xright@appenditem
  {\the\page@num|\the\line@num|%
     \ifsublines@ \the\subline@num \else 0\fi}\to\labelref@list}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\pageref}
% \begin{macro}{\xpageref}
% If the specified label exists, "\pageref" gives its page number.
% For this reference command, as for the other two, a special
% version with prefix "x" is provided for use in places where the
% command is to be scanned as a number, as in "\linenum". These
% special versions have two limitations: they don't print error
% messages if the reference is unknown, and they can't appear as
% the first label or reference command in the file; you must ensure
% that a "\label" or a normal reference command appears first, or
% these x-commands will always return zeros.
%    \begin{macrocode}
\def\pageref#1{\ref@undefined{#1}\getref@num{1}{#1}}
\def\xpageref#1{\getref@num{1}{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\lineref}
% \begin{macro}{\xlineref}
% If the specified label exists, "\lineref" gives its line number.
%    \begin{macrocode}
\def\lineref#1{\ref@undefined{#1}\getref@num{2}{#1}}
\def\xlineref#1{\getref@num{2}{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\sublineref}
% \begin{macro}{\xsublineref}
% If the specified label exists, "\sublineref" gives its sub-line number.
%    \begin{macrocode}
\def\sublineref#1{\ref@undefined{#1}\getref@num{3}{#1}}
\def\xsublineref#1{\getref@num{3}{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ref@undefined}
% The next three macros are used by the referencing commands above,
% and do the job of extracting the right numbers from the label
% macro that contains the page, line, and sub-line number. The
% "\ref@undefined" macro is called when you refer to a label with
% the normal referencing macros.  Its argument is a label, and it
% just checks that the labels file has indeed been opened and read (if
% not, it does so), and that the label is defined (if not, it
% squeals).  (It is these checks which the "x-" forms of the
% reference macros leave out.)
%    \begin{macrocode}
\def\ref@undefined#1{\do@labelsfile
  \expandafter\ifx\csname the@label#1\endcsname\relax
  \edmac@warning{Reference `#1'
           on page \the\pageno\space undefined. Using `000'.}%
        \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\getref@num}
% Next, "\getref@num" fetches the number we want.  It has two
% arguments: the first is simply a digit, specifying whether to
% fetch a page ("1"), line ("2") or sub-line ("3") number.  (This
% switching is done by calling "\label@parse".) The second argument
% is the label-macro, which because of the "\@lab" macro above is
% defined to be a string of the type "123|456|789".
%    \begin{macrocode}
\def\getref@num#1#2{%
  \expandafter
  \ifx\csname the@label#2\endcsname \relax
    000%
  \else
    \expandafter\expandafter\expandafter
    \label@parse\csname the@label#2\endcsname|#1%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\label@parse}
% Notice that we slipped another "|" delimiter into the
% penultimate line of "\getref@num", to
% keep the ``switch-number'' separate from the reference numbers.  This
% "|" is used as another parameter delimiter by "\label@parse",
% which extracts the appropriate number from its first arguments.
% The "|"-delimited arguments consist of the expanded label-macro
% (three reference numbers), followed by the switch-number ( "1",
% "2", or "3") which defines which of the earlier three numbers to
% pick out. (It was earlier given as the first argument of
% "\getref@num".)
%    \begin{macrocode}
\def\label@parse#1|#2|#3|#4{%
  \ifcase #4\relax
  \or #1%
  \or #2%
  \or #3%
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\xxref}
% The "\xxref" command takes two arguments, both of which are
% labels, e.g., "\xxref{mouse}{elephant}".  It first does some
% checking to make sure that the labels do exist (if one doesn't,
% those numbers are set to zero).  Then it calls "\linenum" and sets
% the beginning page, line, and sub-line numbers to those of the
% place where "\label{mouse}" was placed, and the ending
% numbers to those at "\label{elephant}".  The point of this is
% to be able to manufacture footnote line references to passages
% which can't be specified in the normal way as the first argument
% to "\text" for one reason or another.  Using "\xxref" in the
% second argument of "\text" lets you set things up at least
% semi-automatically.
%    \begin{macrocode}
\def\xxref#1#2{%
  {\expandafter\ifx\csname the@label#1\endcsname
   \relax \expandafter\let\csname the@label#1\endcsname\zz@@@\fi
   \expandafter\ifx\csname the@label#2\endcsname \relax
   \expandafter\let\csname the@label#2\endcsname\zz@@@\fi
   \linenum{\csname the@label#1\endcsname|%
    \csname the@label#2\endcsname}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\makelabel}
% Sometimes the "\label" command cannot be used to specify
% exactly the page and line desired; you can use the "\makelabel" macro
% make your own label.  For example, if you say
% ``"\makelabel{elephant}{10|25|0}"'' you will have created a
% new label, and a later call to "\pageref{elephant}" would
% print ``10'' and "\lineref{elephant}" would print ``25''.
% The sub-line number here is zero.
% "\makelabel" takes a label, followed by a page and a line number(s)
% as arguments.
%    \begin{macrocode}
\def\makelabel#1#2{\expandafter\xdef\csname the@label#1\endcsname{#2}}
%    \end{macrocode}
% (If you are only going to refer to such a label using
% "\xxref", then you can omit entries in the same way as with
% "\linenum" (see pp.\,\pageref{linenumdef} and
% \pageref{linenumbers}), since "\xxref" makes a call to
% "\linenum" in order to do its work.)
% \end{macro}
%
%
% \section{Endnotes}
% \label{endnotes}\relax
%
% \begin{macro}{\@end}
% \begin{macro}{\ifend@}
% \begin{macro}{\end@true}
% \begin{macro}{\end@false}
% Endnotes of all varieties are saved up in a file, typically named
% \meta{filename}".end".
% "\@end" is the output stream number for
% this file, and "\ifend@" is a flag that's "true" when the file is open.
%    \begin{macrocode}
\newwrite\@end
\newif\ifend@
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\end@open}
% \begin{macro}{\end@close}
% "\end@open" and "\end@close" are the
% macros that are used to open and close the endnote file. Note that
% all our writing to this file is "\immediate": all page and
% line numbers for the endnotes are generated by the same mechanism
% we use for the footnotes, so that there's no need to defer any
% writing to catch information from the output routine.
%    \begin{macrocode}
\def\end@open#1{\end@true\immediate\openout\@end=#1\relax}
\def\end@close{\end@false\immediate\closeout\@end}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\end@stuff}
% "\end@stuff" is used by "\beginnumbering" to
% do everything that's necessary for the endnotes at the
% start of each section: it opens the "\@end" file, if necessary,
% and writes the section number to the endnote file.
%    \begin{macrocode}
\def\end@stuff{%
 \ifend@\relax\else
   \end@open{\jobname.end}%
 \fi
 \immediate\write\@end{\string\@section{\the\section@num}}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\Aendnote}
% \begin{macro}{\Bendnote}
% \begin{macro}{\Cendnote}
% \begin{macro}{\Dendnote}
% \begin{macro}{\Eendnote}
% The following five macros each function to
% write one endnote to the ".end" file. Like the footnotes, these
% endnotes come in five series, "A" through "E". We change
% "\newlinechar" so that in the file every space becomes the
% start of a new line; this generally ensures that a long note doesn't
% exceed restrictions on the length of lines in files.
%    \begin{macrocode}
\def\Aendnote#1{{\newlinechar='40
       \immediate\write\@end{\string\Aend%
                {\ifnumberedpar@\@nums\fi}%
                {\ifnumberedpar@\@tag\fi}{#1}}}\ignorespaces}
%    \end{macrocode}
%    \begin{macrocode}
\def\Bendnote#1{{\newlinechar='40
       \immediate\write\@end{\string\Bend%
                {\ifnumberedpar@\@nums\fi}%
                {\ifnumberedpar@\@tag\fi}{#1}}}\ignorespaces}
%    \end{macrocode}
%    \begin{macrocode}
\def\Cendnote#1{{\newlinechar='40
       \immediate\write\@end{\string\Cend%
                {\ifnumberedpar@\@nums\fi}%
                {\ifnumberedpar@\@tag\fi}{#1}}}\ignorespaces}
%    \end{macrocode}
%    \begin{macrocode}
\def\Dendnote#1{{\newlinechar='40
       \immediate\write\@end{\string\Dend%
                {\ifnumberedpar@\@nums\fi}%
                {\ifnumberedpar@\@tag\fi}{#1}}}\ignorespaces}
%    \end{macrocode}
%    \begin{macrocode}
\def\Eendnote#1{{\newlinechar='40
       \immediate\write\@end{\string\Eend%
                {\ifnumberedpar@\@nums\fi}%
                {\ifnumberedpar@\@tag\fi}{#1}}}\ignorespaces}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\Aend}
% \begin{macro}{\Bend}
% \begin{macro}{\Cend}
% \begin{macro}{\Dend}
% \begin{macro}{\Eend}
% \begin{macro}{\endprint}
% \begin{macro}{\@gobblethree}
% \begin{macro}{\@section}
% "\Aendnote" and the like write commands called "\Aend" and
% so on to the endnote file; these are analogous to the various
% "footfmt" commands above, and they take the same arguments.
% When we process this file, we'll want to pick out the notes of one
% series and ignore all the rest. To do that, we equate the "end"
% command for the series we want to "\endprint", and leave the
% rest equated to "\@gobblethree", which just skips over its three
% arguments. The "\endprint" here is nearly identical in its
% functioning to "\normalfootfmt".
%
% The endnote file also contains "\@section" commands, which
% supply the section numbers from the main text; standard "EDMAC" does
% nothing with this information, but it's there if you want to write
% custom macros to do something with it.
%    \begin{macrocode}
\def\endprint#1#2#3{{\notefontsetup{\notenumfont\printlines#1|}%
      \enspace{\select@lemmafont#1|#2}\enskip#3\par}}
\def\@gobblethree#1#2#3{}
\let\Aend=\@gobblethree
\let\Bend=\@gobblethree
\let\Cend=\@gobblethree
\let\Dend=\@gobblethree
\let\Eend=\@gobblethree
\let\@section=\@gobble
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\doendnotes}
% "\doendnotes" is
% the command you use to print one series of endnotes; it
% takes one argument, the series letter of the note series you want
% to print.
%    \begin{macrocode}
\def\doendnotes#1{\end@close
   \begingroup
      \makeatletter
      \expandafter\let\csname #1end\endcsname=\endprint
      \input\jobname.end
   \endgroup}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\noendnotes}
% You can say "\noendnotes" before the first
% "\beginnumbering" in your file if you aren't going to be using
% any of the endnote commands: this will suppress the creation of
% an ".end" file. If you do have some lingering endnote
% commands in your file,
% the notes will be written to your terminal and to the \TeX\ log file.
%    \begin{macrocode}
\def\noendnotes{\global\let\end@stuff=\relax
                \global\chardef\@end=16 }
%    \end{macrocode}
% \end{macro}
%
% \section{The End}\label{end}
%
% At signs are no longer letters.
%    \begin{macrocode}
\makeatother
%    \end{macrocode}
%
% \newpage
% \appendix
%
% \section{Examples}\label{examples}
%
% In the following examples, the command "\input edmac.doc" has
% been included for completeness.  This is always safe, since
% "EDMAC" checks to see if has been loaded before.  But, as mentioned
% above, it is usually more convenient to include the "EDMAC" macros
% in a pre-digested \TeX\ format file, to be invoked with a command such
% as "tex &edmac" \meta{filename}.
%
% \subsection{General example of features}
% This made-up example, "features.tex", is included purely to illustrate
% some of "EDMAC"'s main features.  It is hard to find real-world
% examples that actually use as many layers of notes as this, so we made
% one up.  The example is a bit tricky to read, but close study and
% comparison with the output (Figure~\ref{features-out}) will be
% illuminating.
% \begin{figure}[p]
% \includegraphics{features}
% \vspace*{\textheight}                 ^^A supply artwork
% \vspace*{-3\baselineskip}
% \caption{Output from {\tt features.tex}.}
% \label{features-out}
% \end{figure}
%
% \medskip
% \hrule
% \medskip
% \begin{small}
% \begin{verbatim}
% \input edmac.doc
% \hsize 28pc
% \vsize 35pc
% \cropsetup{45pc}{35pc}{4pc}{4pc}
% \headline{Headline \hfil \folio}
% \footline{Footline \hfil --\folio--\hfil footline}
%
% \makeatletter
% % I'd like a spaced out colon after the lemma:
% \def\spacedcolon{{\rm\thinspace:\thinspace}}
% \def\normalfootfmt#1#2#3{%
%   \normal@pars
%   \parindent=0pt \parfillskip=0pt plus 1fil
%   {\notenumfont\printlines#1|}\strut\enspace
%   {\select@lemmafont#1|#2}\spacedcolon\enskip#3\strut\par}
%
% % And I'd like the 3-col notes printed with a hanging indent:
% \def\threecolfootfmt#1#2#3{%
%   \normal@pars
%   \hsize .3\hsize
%   \parindent=0pt
%   \tolerance=5000       % high, but not infinite
%   \raggedright
%   \hangindent1.5em \hangafter1
%   \leavevmode
%   \strut\hbox to 1.5em{\notenumfont\printlines#1|\hfil}\ignorespaces
%   {\select@lemmafont#1|#2}\rbracket\enskip
%   #3\strut\par\allowbreak}
%
% % And I'd like the 2-col notes printed with a double colon:
% \def\doublecolon{{\rm\thinspace::\thinspace}}
% \def\twocolfootfmt#1#2#3{%
%   \normal@pars
%   \hsize .45\hsize
%   \parindent=0pt
%   \tolerance=5000
%   \raggedright
%   \leavevmode
%   \strut{\notenumfont\printlines#1|}\enspace
%   {\select@lemmafont#1|#2}\doublecolon\enskip
%   #3\strut\par\allowbreak}
%
% % And in the paragraphed footnotes, I'd like a colon too:
% \def\parafootfmt#1#2#3{%
%   \normal@pars
%   \parindent=0pt \parfillskip=0pt plus 1fil
%   {\notenumfont\printlines#1|}\enspace
%   {\select@lemmafont#1|#2}\spacedcolon\enskip
%   #3\penalty-10 }
% \makeatother
%
% % I'd like the line numbers picked out in bold.
% \let\notenumfont=\eightbf
% \lineation{page}
% \linenummargin{inner}
% \firstlinenum=3       % just because I can
% \linenumincrement=1
% \foottwocol{A}
% \footthreecol{B}
% \footparagraph{E}
% % I've changed \normalfootfmt, so invoke it again for C and D notes.
% \footnormal{C}
% \footnormal{D}
%
% \beginnumbering
%
% \pstart
% This is an \text{example}
%   \Afootnote{eximemple C, D.}/
% of some text with \text{variant}
%   \Afootnote{alternative, A, B.}/
% readings recorded as `A' footnotes.  From here on, \text{though}
%   \Afootnote{however $\alpha$, $\beta$}/,
% we shall have \text{`C'}
%   \Bfootnote{B, {\it pace\/} the text}/.
% \text{For spice, let us mark a longer passage, but give a different
%   lemma for it, so that we don't get a \text{huge}
%     \Dfootnote{vast E, F; note that this is
%     a `D' note to section of text within a longer lemma}/
%   amount of text in a note}\lemma{For spice \dots\ note}
%   \Cfootnote{The note here is type `C'}/.
% \text{Finally}
%   \Efootnote{in the end X, Y}/,
% \text{we}
%   \Efootnote{us K}/
% \text{shouldn't}
%   \Efootnote{ought not to L, M}/
% \text{forget the}
%   \Efootnote{omit to mention the \S, \P}/
% \text{paragraphed}
%   \Efootnote{blocked M, N}/
% \text{notes}
%   \Efootnote{variants HH, KK}/,
% which are so \text{useful}
%   \Efootnote{truly useful L, P}/
% when there are \text{a great number of}
%   \Efootnote{many, many (preferably)}/
% short notes to be \text{recorded}
%   \Efootnote{noted: repetition}/.
% \pend
%
% \pstart
% This is a second paragraph, giving more {\it \text{examples}
%   \Afootnote{eximples L, M.}/}
% of text with \text{variant}
%   \Afootnote{alternative, A, B.}/
% readings recorded as `A' footnotes.  From here on, \text{though}
%   \Bfootnote{however $\alpha$, $\beta$}/,
% we shall have \text{`B'}
%   \Bfootnote{B, as correctly stated in the text}/ notes in the text.
% \text{For spice, let us mark a longer passage, but give a different
%   lemma for it, so that we don't get a {\it \text{huge}
%     \Dfootnote{vast E, F; note that this is
%     a `D' note to text within a longer lemma.}/}
%   amount of text in a note}\lemma{For spice, \dots\ note}
%   \Cfootnote{This is a rogue note of type `C'.}/.
% \text{Finally}
%   \Bfootnote{In the end X, Y}/,
% \text{we}
%   \Bfootnote{we here K}/
% \text{shouldn't}
%   \Bfootnote{ought not to L, M}/
% \text{forget the}
%   \Bfootnote{omit to mention the \S, \P}/
% \text{column}
%   \Bfootnote{blocked M, N}/
% \text{notes}
%   \Bfootnote{variants H}/,
% which are so \text{useful}
%   \Bfootnote{very, very useful L, P}/
% when there are \text{many}
%   \Bfootnote{lots of Z}/
% short notes to be \text{recorded}
%   \Bfootnote{recorded and put down: M (repetition)}/.
% \pend
%
% \endnumbering
% \bye
% \end{verbatim}
% \end{small}
% \medskip
% \hrule
% \medskip
%
% \subsection{Gascoigne}
% The first real-life example is taken from an edition of George
% Gascoigne's\index{Gascoigne, George}
% {\em A Hundreth Sundrie Flowres\/} that is being
% prepared by G.~W.~Pigman III,\index{Pigman, III$^{rd}$, G. W.} at
% the California Institute of Technology. Figure \ref{iocasta-out}
% shows the result of setting the text with "EDMAC".
% \begin{figure}[p]
% \includegraphics{iocasta}
% \vspace*{\textheight}                       ^^A supply artwork
% \vspace*{-3\baselineskip}
% \caption{Output from {\tt iocasta.tex}.}
% \label{iocasta-out}
% \end{figure}
%
% The main input file first calls for a file of initial
% definitions, called "gg.tex".  This file, shown below,
% demonstrates how "EDMAC" macros may be customized to give
% detailed control over the final format.
% \medskip
%
% \hrule
% \medskip
% \begin{small}
% \begin{verbatim}
% % parameters for edition of Gascoigne's
% %    {\it A Hundreth Sundrie Flowres}.
% \ifx\ggloaded\relax\endinput\else\let\ggloaded=\relax\fi
% \noendnotes
% \makeatletter
% %
% \font\poemnumfont=cmmi12 \font\titlefont=cmr12 \font\ninerm=cmr9
% \font\nineit=cmti9       \font\eightrm=cmr8
% \let\headfont=\eightrm
% \font\eightit=cmti8      \let\headit=\eightit  \font\sixrm=cmr6
% \font\foliofont=cmmi8    \let\os=\foliofont
% \let\numlabfont=\foliofont
% %
% \firstsublinenum=1000
% \hoffset=1.25in \voffset=1.25in \hsize=24pc \vsize=488pt
% %
% \frenchspacing \parskip=0pt \hyphenpenalty=1000
% %
% \def\makeheadline{\vbox to 0pt{\vskip-16.5pt
%   \line{\vbox to8.5pt{}\the\headline}\vss}\nointerlineskip}
% \nopagenumbers
% %
% % Say \nolinenums if you want no line numbers in the notes.
% \newif\ifnolinenums
% \def\nolinenums{\global\nolinenumstrue}
% \def\linenums{\global\nolinenumsfalse}
% % Say \nopoemnum to suppress poem number in the notes.
% \newif\ifpoemnum
% \def\nopoemnum{\global\poemnumfalse}
% % Say \nodbpoemnum to suppress poem number in the notes for
% %  poems with two numbers, e.g., 64 (v).
% \newif\ifdbpoemnum
% \def\nodbpoemnum{\global\dbpoemnumfalse}
% % Say \noactnum to suppress act/scene numbers in the notes.
% \newif\ifactnum
% \def\noactnum{\global\actnumfalse}
% %
% \newcount\poemnumber
% \def\poem#1{\poemnumber=#1\poemnumtrue\parindent=0pt
%   \centerline{{\poemnumfont#1}}\vskip12pt}
% %
% \newcount\dbpoemnumone  \newcount\dbpoemnumtwo
% \def\dbpoem#1#2{\dbpoemnumtrue\dbpoemnumone=#1\dbpoemnumtwo=#2
%   \parindent=0pt\par
%   \centerline{{\poemnumfont#1} {\titlefont
%    (\romannumeral#2)}}\nointerlineskip \vskip12pt}
% %
% \newcount\actnumber \newcount\scenenumber
% \def\act #1 #2 #3{\actnumtrue\actnumber=#1\scenenumber=#2
%   \parindent=0pt\vskip24pt plus12pt minus3pt\hrule height0pt\relax
%   \pstart\startsub\centerline{\rm#3}\pend\endsub
%   \mark{{\os#1\fullstop #2}}\nobreak \vskip 12pt plus3pt minus3pt}
% %
% \def\rightlinenum{\ifbypage@\ifnum\line@num<10\kern.5em\fi\else
% \ifnum\line@num<10\kern1em\else\ifnum\line@num<100
%   \kern.5em\fi\fi\fi\kern.5em\numlabfont\the\line@num
%   \ifnum\subline@num>0:\the\subline@num\fi}
% \def\leftlinenum{\numlabfont\the\line@num
%   \ifnum\subline@num>0:\the\subline@num\fi \kern.5em}
% \linenummargin{outer}
% \lineation{page}
% \def\ggfootfmt#1#2#3{%
%   \notefontsetup
%   \let\par=\endgraf
%   \rightskip=0pt \leftskip=0pt
%   \parindent=0pt \parfillskip=0pt plus 1fil
%   \ifnolinenums\relax\else
%     \begingroup \os \panums \printlines#1|\endgroup
%     \enskip
%   \fi
%   {\rm #2\def\@tempa{#2}\ifx\@tempa\empty
%     \else]\enskip\fi#3\penalty-10 }}
% %
% % \panums adds the poem number or act/scene number to a
% % line number display when necessary.
% %
% \def\panums{%
%     \ifpoemnum                  % a poem
%       \the\poemnumber:%
%       \global\poemnumfalse
%     \fi
%     \ifdbpoemnum                % a poem with two numbers
%       \the\dbpoemnumone\space
%           {\rm(\romannumeral\the\dbpoemnumtwo).}%
%       \global\dbpoemnumfalse
%     \fi
%     \ifactnum                   % a play (act/scene)
%       \the\actnumber:\the\scenenumber:%
%       \global\actnumfalse
%     \fi}
% %
% % Now reset the \Afootnote parameters and macros:
% \footparagraph{A}
% \let\Afootfmt=\ggfootfmt
% \dimen\Afootins=\vsize
% \skip\Afootins=3pt plus9pt
% \def\ggfootstart#1{\vskip\skip\Afootins}
% \let\Afootstart=\ggfootstart
% \def\title{\pstart\startsub\let\par=\endtitle}
% \def\endtitle{\pend\endsub}
% \def\verseskip{\vskip6pt plus6pt}
% \def\speaker#1{\pstart\parindent=1em\let\par=\pend
%   {\tenit{#1}}\hbox to 1ex{}\ignorespaces}
% \def\sen{\leavevmode\lower1ex\hbox{\tenrm''}}
% \def\senspeak#1{\pstart\obeylines\setbox0=\hbox{\tenrm''}%
%   \leavevmode
%   \lower1ex\copy0\kern-\wd0\hskip1em{\tenit{#1}}%
%   \hbox to1ex{}\ignorespaces}
% \def\speak#1{\pstart\obeylines\hskip1em{\tenit{#1}}%
%   \hbox to1ex{}\ignorespaces}
% \def\nospeaker{\parindent=0em\pstart\let\par=\pend}
% \def\nospeak{\pstart\obeylines}
% \def\stage#1{\pstart\startsub\parindent=0pt
%   \hangindent=3em\hangafter=0
%   {\tenit#1}\let\par=\endstage}
% \let\endstage=\endtitle
% \def\motto#1{\pstart\startsub\centerline{{\tenit#1}}\pend\endsub}
% \def\finis#1{\pstart\startsub\smallskip\centerline{{\tenit#1}}
%   \let\par=\endfinis}
% \let\endfinis=\endtitle
% \def\initials#1{\pstart\line{\hfil{\it #1}\quad}\let\par=\pend}
% \makeatother
% \end{verbatim}
% \end{small}
% \medskip
% \hrule
% \medskip
%
% With these definitions, the actual input file,
% "iocasta.tex", is relatively simple:
%
% \medskip
% \hrule
% \medskip
% \begin{small}
% \begin{verbatim}
% \input edmac.doc
% \input gg
% \parindent=0pt
% \pageno=73
% \mark{{\os2:1}}
% \headline={\ifnum\pageno>61\ifodd\pageno
%     \rlap{\foliofont\botmark}\hfil\headfont
%     IOCASTA\hfil\llap{\foliofont\folio}%
%   \else
%     \rlap{\foliofont\folio}\hfil\headfont
%     IOCASTA\hfil\llap{\foliofont\botmark}\fi
%   \else\hfil\fi}
%
% \beginnumbering
%
% \stage{Oedipus \text{entreth}\Afootnote{{\it intrat} MS}/.}
%
% \nospeak
% Or that with wrong the right and doubtlesse heire,
% Shoulde banisht be out of his princely seate.
% Yet thou O queene, so fyle thy sugred toung,
% And with suche counsell decke thy mothers tale,
% That peace may bothe the brothers heartes inflame,
% And rancour yelde, that erst possest the same.
% \pend
%
% \speak{Eteocl.} Mother, beholde, youre hestes for to obey,
% In person nowe am I resorted hither:
% In haste therefore, fayne woulde I knowe what cause
% With hastie speede, so moued hath your mynde
% To call me nowe so causelesse out of tyme,
% When common wealth moste craues my onely ayde:
% Fayne woulde I knowe, what queynt commoditie
% Persuades you thus to take a truce for tyme,
% And yelde the gates wide open to my foe,
% The gates that myght our stately state defende,
% And nowe are made the path of our decay.
% \pend
%
% \senspeak{Ioca.}Represse deare son, those raging stormes of wrath,
% \sen That so bedimme the eyes of thine intente,
% \text{\sen As when \text{the}\Afootnote{thie MS}/ tongue %
%   (a redy Instrument)
% \sen Would \text{fayne pronounce}\Afootnote{faynest tell MS}/ %
%   the meaning of \text{the minde}\Afootnote{thy minde MS}/,
% \sen \text{It}\lemma{It \dots\ worde.}\Afootnote{Thie %
%   swelling hart puft vp with wicked ire / Can scarce pronounce %
%   one inward louing thought. MS}/ cannot speake one honest %
%   seemely worde.}\lemma{As \dots\ worde.}\Afootnote{{\it not %
%   in\/} \os73}/
% \sen But when disdayne is shrunke, or sette asyde,
% \sen And mynde of man with leysure can discourse
% \sen What seemely woordes his tale may best beseeme,
% \sen And that the toung vnfoldes without affectes
% \sen Then may proceede an answere sage and graue,
% \sen And euery sentence sawst with sobernesse:
% Wherefore vnbende thyne angrie browes deare chylde,
% And caste thy rolling eyes none other waye,
% That here doost not \text{{\it Medusaes\/}}%
% \Afootnote{One of the furies. {\os75}m}/ face beholde,
% But him, euen him, thy blood and brother deare.
% And thou beholde, my {\it Polinices\/} eke,
% Thy brothers face, wherin when thou mayst see
% Thine owne image, remember therwithall,
% That what offence thou woldst to him were done,
% \pend
% \endnumbering
% \bye
% \end{verbatim}
% \end{small}
% \medskip
% \hrule
%
% \subsection{Shakespeare}
% The following text illustrates another input file of moderate
% complexity, with two layers of annotation in use. The example is
% taken from the Arden {\em Merchant of Venice}.\index{Shakespeare, William}
% First, the file "arden.sty" contains a set of font
% definitions and format specifications:
%
% \medskip
% \hrule
% \medskip
% \begin{small}
% \begin{verbatim}
% \makeatletter
%
% % Macros for the edition:
% \def\stage#1{\rlap{\hbox to \the\linenumsep{%
%                        \hfil\llap{[{\it#1\/}]}}}}
% \def\speaker#1{\pstart\hangindent2em\hangafter1
%   \leavevmode{\it#1}\enspace\ignorespaces}
% \def\\{\hfil\break}
% \def\exit#1{\hfill\stage{#1}}
%
% % EDMAC customizations:
% \noendnotes \vsize 40pc \hsize 23pc \parindent 0pt
% \linenumsep=.4in \rightskip\linenumsep
% \def\interparanoteglue{1em plus.5em minus.1em}
%
% \catcode`\<=\active
% \def\xtext#1#2>{\text{#1}{#2}/}
% \let<=\xtext
%
% \let\numlabfont=\eighti
% \let\sc=\fiverm
% \let\Afootnoterule=\relax \let\Bfootnoterule=\relax
% \footline={\hfil}
% \def\rightlinenum{\numlabfont\llap{\the\line@num}}
% \pageno=46
% \headline={\eightpoint{\teni\folio}\hfil
%                      THE MERCHANT OF VENICE\hfil [ACT II}
% \cropsetup{8in}{5in}{3.5pc}{3pc}
% \hoffset=.75in   \voffset=.9375in
% \frenchspacing
%
% % Footnote formats:
% % \nonumparafootfmt is a footnote format without line numbers.
% \def\nonumparafootfmt#1#2#3{%
%   \normal@pars
%   \rightskip=0pt
%   \parindent=0pt \parfillskip=0pt plus 1fil
%   \select@lemmafont#1|#2\rbracket\enskip
%   \it#3\penalty-10 }
% \def\newparafootfmt#1#2#3{%
%   \normal@pars
%   \parindent=0pt \parfillskip=0pt plus 1fil
%   {\notenumfont\printlines#1|}\fullstop\enspace
%   {\select@lemmafont#1|#2}\rbracket\enskip
%   \it#3\penalty-10 }
% \def\newtwocolfootfmt#1#2#3{%
%   \normal@pars
%   \hsize .48\hsize
%   \tolerance=5000
%   \rightskip=0pt \leftskip=0pt \parindent=5pt
%   \strut\notenumfont\printlines#1|\fullstop\enspace
%   \it#2\/\rbracket\penalty100\hskip .5em plus .5em
%   \rm#3\strut\goodbreak}
%
% % Footnote style selections etc. (done last):
% \footparagraph{A}
% \foottwocol{B}
% \let\Afootfmt=\newparafootfmt
% \let\Bfootfmt=\newtwocolfootfmt
% \let\collation=\Afootnote
% \let\note=\Bfootnote
% \lineation{section}
% \linenummargin{right}
% \makeatother
% \end{verbatim}
% \end{small}
% \begin{figure}[p]
% \includegraphics{arden}
% \vspace*{\textheight}                         ^^A supply artwork
% \vspace*{-3\baselineskip}
% \caption{Output of the Arden text.}
% \label{arden-out}
% \end{figure}
% \medskip
% \hrule
% \medskip
%
% The Arden text, using the above definitions, is input as follows
% (the output is shown in Figure \ref{arden-out}):
%
% \medskip
% \hrule
% \medskip
% \begin{small}
% \begin{verbatim}
% \input edmac.doc
% \input arden.sty
%
% % Initially, we don't want line numbers.
% \let\Afootfmt=\nonumparafootfmt
%
% \beginnumbering
% \pstart
% \centerline{[<{SCENE III}
%   \lemma{Scene III}
%   \collation{Capell; om. Q, F; {\rm Scene IV} Pope.}>.---%
%   <{\it Venice}
%   \collation{om. Q, F; Shylock's house Theobald; The same.
%   A Room in Shylock's House Capell.}>.]}
% \pend
% \bigskip
%
% \pstart
% \centerline{\it Enter\/ {\rm JESSICA} and\/
%   {\rm [<{LAUNCELOT}
%   \lemma{Launcelot}
%   \collation{Rowe; om. Q, F.}>]} the clown.} \pend \bigskip
%
% \let\Afootfmt=\newparafootfmt % we do want line numbers from now
%
%  \setline{0}%
%
% \speaker{Jes.}<{I am}
%   \collation{Q, F; {\rm I'm} Pope.}>
%                       sorry thou wilt leave my father so,\\
% Our house is hell, and thou (a merry devil)\\
% Didst rob it of some taste of tediousness,---\\
% But fare thee well, there is a ducat for thee,\\
% And Launcelot, <{soon}
%   \note{early.}>
%                        at supper shalt thou see\\
% Lorenzo, who is thy new master's guest,\\
% Give him this letter,---do it secretly,---\\
% And so farewell: I would not have my father\\
% See me <{in}
%   \collation{Q; om. F.}>
%              talk with thee.
% \pend
%
% \speaker{Laun.}
%   <{}\lemma{\it Laun.}\collation{Q2; Clowne. Q, F.}>%
% <{Adieu!}
%   \collation{{\rm Adiew}, Q, F.}>
% tears <{exhibit}
%   \note{Eccles paraphrased ``My tears serve to express what my
%   tongue should, if sorrow would permit it,'' but probably it is
%   Launce\-lot's blunder for prohibit (Halliwell) or inhibit
%   (Clarendon).}>
% my tongue, most beautiful <{pagan}
%   \note{This may have a scurrilous undertone: cf. {\it 2 H 4,}
%   \sc II. \rm ii. 168.}>%
% , most sweet <{Jew!}
%   \collation{{\rm Iewe}, Q, F. \quad {\rm do]} Q, F;
%              {\rm did} F2.}>%
% ---if a Christian <{do}
%   \note{Malone upheld the reading of Qq and F by comparing \sc
%   II. \rm vi. 23: ``When you shall please to play the thieves for
%   wives''; Launcelot seems fond of hinting at what is going to
%   happen (cf. \sc II. \rm v. 22--3). If F2's ``did'' is accepted,
%   {\it get\/} is used for beget, as in \sc III. \rm v. 9.}>
% not play the knave and get thee, I am much deceived; but <{adieu!}
%   \collation{{\rm adiew}, Q, F.}>
% these <{foolish drops do \text{something}
%   \collation{Q; {\rm somewhat} F.}/
% drown my manly spirit}
%   \lemma{foolish{\rm\dots}spirit}
%   \note{``tears do not become a man'' (\it AYL., \sc III. \rm
%   iv. 3); cf. also \it H 5, \sc IV. \rm vi. 28--32.}>%
% : <{adieu!}
%   \collation{{\rm adiew}. Q, F. \quad {\rm S. D.]} Q2, F; om. Q;
%   after l. 15 Capell.}>
% \exit{Exit.}
% \pend
%
% \speaker{Jes.}
% Farewell good Launcelot.\\
% Alack, what heinous sin is it in me\\
% To be ashamed to be my father's <{child!}
%   \collation{{\rm child}, Q, F; {\rm Child?} Rowe.}>
% \pend
% \endnumbering
% \bye
% \end{verbatim}
% \end{small}
% \medskip
% \hrule
%
% \subsection{Classical text edition}
% The next example, which was extracted from a longer file kindly
% supplied by Wayne Sullivan,\index{Sullivan, Wayne} University
% College, Dublin, Ireland, illustrates the use of "EDMAC" to
% produce a Latin text edition, the {\em Periphyseon}, with Greek
% passages.\footnote{The bibliographic details of the forthcoming book
% are: Iohannis Scotti Erivgenae, {\it Periphyseon} ({\it De
% Diuisione Naturae\/}) Liber Qvartvs [Scriptores Latini Hiberniae
% vol.\,xii], (Dublin: School of Celtic Studies, Dublin Institute
% for Advanced Studies, forthcoming 1992).}  The Greek font used is
% that prepared by Silvio Levy\index{Levy, Silvio} and described in {\em
% TUGboat}.\footnote{{\em TUGboat\/} {\bf 9} (1988), pp.\,20--24.} The
% output of this file is shown in Figure~\ref{periphyseon-out}.
% Note the use of two layers of footnotes to record testimonia and
% manuscript readings respectively.
%
% \begin{figure}[p]
% \includegraphics{periph4}
% \vspace*{\textheight}                       ^^A supply artwork
% \vspace*{-3\baselineskip}
% \caption{Output of the {\em Periphyseon, Liber IV}.}
% \label{periphyseon-out}
% \end{figure}
%
% The following "EDMAC" customizations are loaded initially, as
% file "slhh.tex":
%
% \medskip
% \hrule
% \medskip
% \begin{small}
% \begin{verbatim}
% \overfullrule0 pt
% \hsize=25pc
% \vsize=44pc
% \lefthyphenmin=3
% %\overfullrule=0pt
% \input greekmac
% \greekdelims
% \input edmac.doc
% \makeatletter
% \newbox\lp@rbox
% % We need an addition to \no@expands since the \active $ in greekmac
% % causes problems:
% \def\morenoexpands{\let$=0}
%
% \def\ffootnote#1{%
%   \ifnumberedpar@
%     \xright@appenditem{\noexpand\vffootnote{f}{{\@nums}{\@tag}{#1}}}%
%                                                 \to\inserts@list
%     \global\advance\insert@count by 1
% %  \else         %% may be used only in numbered text
% %    \vffootnote{f}{{0|0|0|0|0|0|0}{}{#1}}%
%   \fi\ignorespaces}
% \def\gfootnote#1{%
%   \ifnumberedpar@
%     \xright@appenditem{\noexpand\vgfootnote{g}{#1}}%
%                                                 \to\inserts@list
%     \global\advance\insert@count by 1
% %  \else         %% may be used only in numbered text
% %    \vgfootnote{g}{#1}%
%   \fi\ignorespaces}
% \def\raggedleft{\leftskip\z@% This is a hack; doubtless there are better ways.
%    plus5em\spaceskip.3333em\xspaceskip.5em\parfillskip\z@\relax}
% \def\setlp@rbox#1#2#3{%
%   {\parindent\z@\hsize=2.5cm\raggedleft\eightpoint
%   \baselineskip 9pt%
%   \global\setbox\lp@rbox=\vbox to\z@{\vss#3}}}
% \def\vffootnote#1#2{\setlp@rbox#2}
% \def\vgfootnote#1#2{\def\rd@ta{#2}}
% \def\do@line{%
%  {\vbadness=10000 \splittopskip=0pt
%  \gdef\rd@ta{}% for right margin paragraph->always a few characters
%  \global\setbox\one@line=\vsplit\raw@text to\baselineskip}%
%  \unvbox\one@line \global\setbox\one@line=\lastbox
%  \getline@num
% \hbox to\hsize{\affixline@num\add@inserts\hbox to\z@% inserts added here so
%   {\hss\box\lp@rbox\kern\linenumsep}%                 that margin pars are
%    \hfil\hbox to\wd\one@line{\new@line\unhbox\one@line%   included.
%       \hbox to\z@{\kern\linenumsep\notenumfont\rd@ta\hss}}}%
%  \add@penalties} % margin pars also included in line format
% \def\affixline@num{%
%   \ifsublines@
%     \@tempcntb=\subline@num
%     \ifnum\subline@num>\firstsublinenum
%       \@tempcnta=\subline@num
%       \advance\@tempcnta by-\firstsublinenum
%       \divide\@tempcnta by\sublinenumincrement
%       \multiply\@tempcnta by\sublinenumincrement
%       \advance\@tempcnta by\firstsublinenum
%     \else
%       \@tempcnta=\firstsublinenum
%     \fi
%     %
%     \ifcase\sub@lock
%       \or
%         \ifnum\sublock@disp=1
%            \@tempcntb=0 \@tempcnta=1
%         \fi
%       \or
%         \ifnum\sublock@disp=2 \else
%            \@tempcntb=0 \@tempcnta=1
%         \fi
%       \or
%         \ifnum\sublock@disp=0
%            \@tempcntb=0 \@tempcnta=1
%         \fi
%     \fi
%   \else
%     \@tempcntb=\line@num
%     \ifnum\line@num>\firstlinenum
%        \@tempcnta=\line@num
%        \advance\@tempcnta by-\firstlinenum
%        \divide\@tempcnta by\linenumincrement
%        \multiply\@tempcnta by\linenumincrement
%        \advance\@tempcnta by\firstlinenum
%     \else
%        \@tempcnta=\firstlinenum
%     \fi
%     \ifcase\@lock
%        \or
%          \ifnum\lock@disp=1
%             \@tempcntb=0 \@tempcnta=1
%          \fi
%        \or
%          \ifnum\lock@disp=2 \else
%             \@tempcntb=0 \@tempcnta=1
%          \fi
%        \or
%          \ifnum\lock@disp=0
%             \@tempcntb=0 \@tempcnta=1
%          \fi
%     \fi
%   \fi
%   %
%   \ifnum\@tempcnta=\@tempcntb
%     \@tempcntb=\line@margin
%     \ifnum\@tempcntb>1
%       \advance\@tempcntb by\page@num
%     \fi
%     \ifodd\@tempcntb
% %      #1\rlap{{\rightlinenum}}%
%        \xdef\rd@ta{\the\line@num}%
%     \else
%       \llap{{\leftlinenum}}%#1%
%     \fi
%   \else
%     %#1%
%   \fi
%   \ifcase\@lock
%   \or
%     \global\@lock=2
%   \or \or
%     \global\@lock=0
%   \fi
%   \ifcase\sub@lock
%   \or
%     \global\sub@lock=2
%   \or \or
%     \global\sub@lock=0
%   \fi}
% %
% % We want to include a small Greek font in the definition
% % of \eightpoint:
% \let\oldeightpoint=\eightpoint
% \font\eightgr=grreg8
% \def\eightpoint{\oldeightpoint\let\tengr=\eightgr}
% \output{\advancepageno\edmac@output} % even page numbers
% \lineation{page}
% \linenummargin{right}
% \footparagraph{A}
% \footparagraph{B}
% \let\notenumfont=\eightrm
% \let\notetextfont=\eightpoint
% \let\Afootnoterule=\relax
% \count\Afootins=825
% \count\Bfootins=825
% \def\Aparafootfmt#1#2#3{%
%   \normal@pars\eightpoint
%   \parindent=0pt \parfillskip=0pt plus1fil
%   \notenumfont\printlines#1|\enspace
% %      \lemmafont#1|#2\enskip
%   \notetextfont
%   #3\penalty-10\hskip 1em plus 4em minus.4em\relax}
% \def\Bparafootfmt#1#2#3{%
%   \normal@pars\eightpoint
%   \parindent=0pt \parfillskip=0pt plus1fil
%   \notenumfont\printlines#1|\enspace
%   \select@lemmafont#1|#2\rbracket\enskip
%   \notetextfont
%   #3\penalty-10\hskip 1em plus 4em minus.4em\relax }
% \makeatother
% \let\Afootfmt=\Aparafootfmt
% \let\Bfootfmt=\Bparafootfmt
% \def\lemmafont#1|#2|#3|#4|#5|#6|#7|{\eightpoint}
% \headline={\hfil\tenit Periphyseon, Liber IV\hfil}
% \voffset=1in
% \hoffset=1in
% \parindent=1em
% \def\lmarpar#1{\text{}\ffootnote{#1}/}
% \def\rmarpar#1{\text{}\gfootnote{#1}/}
% \emergencystretch40pt
% \cropsetup{24.5cm}{15.5cm}{1.5cm}{2.1cm}
% \end{verbatim}
% \end{small}
% \medskip
% \hrule
% \medskip
%
% The file "periph4.tex" then inputs the above definitions, and
% proceeds with the main text:
%
% \medskip
% \hrule
% \medskip
% \begin{small}
% \begin{verbatim}
% \input slhh
%
% \beginnumbering
% \pstart
% \rmarpar{741C}
% \noindent \text{Incipit Quartus $PERIFUSEWN$}%
% \lemma{incipit\ .~.~.\ $PERIFUSEWN$}\Bfootnote{{\it om.\ R},
% incipit quartus {\it M}}/
% \pend
% \medskip
%
% \pstart
% \noindent \text{NVTRITOR}\lemma{$ANAKEFALIOSIS$}\Bfootnote{{\it
% FJP, lege\/} $<anakefala'iwsis$}/.\lmarpar{$ANAKEFALIOSIS$
% NATVRARVM} Prima nostrae
% \text{Physiologiae}\lemma{physiologiae}\Bfootnote{phisiologiae
% {\it P}, physeologiae {\it R}}/ intentio praecipuaque mat\-e\-ria
% erat \text{quod}\Bfootnote{{\it p}.\ natura {\it transp.\ MR}}/
% \text{$UPEROUSIADES$}\Bfootnote{{\it codd.\ Vtrum\/}
% $<uperousi'wdhs$ (hoc est superessentialis) natura {\it cum Gale
% (p.160) an\/} $<uperousi'oths$ (hoc est superessentialis natura)
% {\it cum Floss (PL 122,741C) intelligendum sit, ambigitur}}/ (hoc
% est superessentialis) natura sit causa creatrix existentium et
% non existentium omnium, a nullo creata, unum principium, una
% origo, unus et uniuersalis uniuersorum fons, a nullo manans, dum
% ab eo manant omnia, trinitas coessentialis in tribus substantiis,
% $ANARQOS$ (hoc est sine principio), principium et finis, una
% bonitas, deus unus, \text{$OMOUSIOS$}\Bfootnote{{\it codd.,
% lege\/} $<omoo'usios$}/ \text{et}\lemma{{\bf et}}\Bfootnote{{\it
% R}\math^{\rm 1}\math, {\it om.\ R}\math^{\rm 0}\math}/
% $UPEROUSIOS$ (id est coessentialis et superessentialis). Et, ut
% ait sanctus Epifanius, episcopus Constantiae Cypri, in
% \text{$AGKURATW$}\Bfootnote{anchurato {\it MR}}/ sermone \text{de
% fide}\Bfootnote{Glo\math\langle\math ssa\math\rangle\math: Ita
% enim uocatur sermo eius de fide $AGKURATOS$, id est procuratus
% {\it mg.\ add.\ FJP}}/: {\it Tria sancta, tria consancta, tria
% \text{agentia}\Bfootnote{actiua {\it MR}}/, tria coagentia, tria
% \text{formantia}\Bfootnote{formatiua {\it MR}}/, tria
% conformantia, tria \text{operantia}\Bfootnote{operatiua {\it
% MR}}/, tria cooperantia, tria subsistentia, tria}\rmarpar{742C}
% {\it consubsistentia sibi inuicem coexistentia. Trinitas haec
% sancta uocatur: tria existentia, una consonantia, una deitas
% \text{eiusdem}\Bfootnote{eiusdemque {\it M}}/ essentiae,
% \text{eiusdem uirtutis, eiusdem
% \text{subsistentiae}{\Bfootnote{substantiae {\it R}}}/}%
% \Bfootnote{{\it om.\ M}}/, similia \text{similiter}\Bfootnote{ex
% simili {\it MR}}/ aequalitatem gratiae operantur patris et filii
% et sancti spiritus. Quomodo autem \text{sunt}\Bfootnote{{\it om.\
% M}}/, ipsis relinquitur docere: \text{`Nemo enim nouit patrem
% nisi filius, neque filium nisi pater, et cuicumque filius
% reuelauerit'}\Afootnote{Matth.\ 11, 27}/; reuelatur autem per
% spiritum sanctum. Non ergo haec tria existentia aut ex ipso aut
% per ipsum aut ad ipsum in unoquoque digne intelliguntur,
% \math\mid\! R, 264^{\rm r}\!\mid\math\ sicut ipsa reuelant:\/}
% $FWS, PUR, PNEUMA$ \text{(hoc est lux, ignis,
% spiritus)}\Afootnote{EPIPHANIVS, {\it Ancoratus\/} 67; PG~43,
% 137C--140A; GCS 25, p.~82, 2--12}/.
% \pend
%
% \pstart
% Haec, ut dixi, ab Epifanio tradita, ut quisquis interrogatus quae
% tria et quid unum in sancta trinitate debeat credere, sana fide
% \math\!\mid J, 1^{\rm v}\!\mid\math\ respondere ualeat, aut ad
% fidem accedens\rmarpar{743A} sic erudiatur. Et mihi uidetur
% spiritum pro calore posuisse, quasi dixisset in similitudine:
% lux, ignis, calor. Haec enim tria unius essentiae sunt. Sed cur
% lucem primo dixit, non est mirum. Nam et pater lux est et ignis
% et calor; et filius est lux, ignis, calor; et \text{spiritus
% sanctus}\Bfootnote{sanctus spiritus {\it R}}/ lux, ignis, calor.
% Illuminat enim pater, illuminat filius, illuminat spiritus
% sanctus: ex ipsis enim omnis scientia et sapientia donatur.
% \pend
% \endnumbering
% \bye
% \end{verbatim}
% \end{small}
% \medskip
% \hrule
%
% \subsection{Arabic text edition}
% Recent developments in Klaus Lagally's\index{Lagally, Klaus} Arab\TeX\
% package have meant that
% now Arab\TeX\ and "EDMAC" can work smoothly together.\footnote{These
% changes are available in versions of Arab\TeX\ from 2.08,
% March/April 1993\@. The Arab\TeX\ system is available from its author's
% institution (by anonymous "ftp" from
% "<URL ftp://ifi.informatik.uni-stuttgart.de/pub/arabtex/>"
% and from many other network sites.}  This will
% be welcome news indeed to all frustrated editors of Arabic texts!
%
% As a taster, Klaus has kindly supplied Figure \ref{arabtex}, a test page
% which shows off the joint capabilities of Arab\TeX\ and "EDMAC".
%
% \begin{figure}[p]
% \includegraphics{arabic}
% \vspace*{\textheight}                       ^^A supply artwork
% \vspace*{-3\baselineskip}
% \caption{Arabic edition of some instructions for using a post office.}
% \label{arabtex}
% \end{figure}
%
% \subsection{Sanskrit text edition}
% Finally, Figure \ref{vyadi} shows an example from an edition of a
% Sanskrit text on P\=a\d ninian grammar that uses Frans
% Velthuis's\index{Velthuis, Frans} excellent Devan\=agar\=\i\
% font.\footnote{Now published as Dominik Wujastyk, {\em Metarules
% of P\=a\d{n}inian Grammar: The {\em
% Vy\=a\d{d}\=\i ya\-paribh\=a\d{s}\=a\-v\d{r}tti\/}
% critically edited with translation and commentary\/} 2 vols.\
% (Groningen: Forsten, 1993).}
%
%    I have not shown the input file for this because I almost
% never looked at it myself.  The edition records a large number of
% variants, and there are frequent font and script changes.
% Preparing this purely manually would have been very error-prone.
% In fact, the text was prepared using a word processor (XyWrite
% III+) which had the ability to fold footnotes out of sight. I
% designed custom Indic fonts for my computer screen, so that I
% could see all the diacritical marks on accented characters as I
% typed.
%
% \begin{figure}[p]
% \includegraphics{sanskrit}
% \vspace*{\textheight}                       ^^A supply artwork
% \vspace*{-3\baselineskip}
% \caption{Sanskrit edition of a grammatical text.}
% \label{vyadi}
% \end{figure}
%
% Font changes were invoked visually using the standard
% facilities of the word processor, so the perennial ``missing
% closing brace'' hardly ever arose.  A short text filter
% program changed the word processor file into correctly tagged
% "EDMAC" input, and another filter program (provided by
% Velthuis) did some special processing on the Devan\=agar\=\i\
% strings.  This combination of tools proved very workable and no
% major problems were encountered.
%
% The following "EDMAC" customizations are typical of the sort
% of changes needed to use Sanskrit with the Devan\=agar\=\i\ font:
%
% \medskip
% \hrule
% \medskip
% \begin{small}
% \label{fam-fiddle}
% \begin{verbatim}
% @dolmode3    % for the Devanagari pre-processor
% \input dnmacs.tex   % special macros for Devanagari font
% \input edmac.doc
% %
% \makeatletter
% %
% \def\notefontsetup{\eightpoint\dnsmall\dn}
% \footparagraph{A}
% \firstlinenum=1
% \def\variant#1#2{\text{#1}\Afootnote{#2}/}
% %
% % Now we set up \select@lemmafont to recognize Sanskrit:
% %
% \newfam\skt % \fam 8 (plain.tex defines 0--7; TeXbook p.351.)
% \def\san{\fam\skt \dn}
% \def\select@lemmafont#1|#2|#3|#4|#5|#6|#7|{%
%    \ifcase#7
%       \rm \or \rm \or \rm \or \rm           % fams 0--3
%           \or \it \or \sl \or \bf \or \tt   % fams 4--7
%           \or \san                          % Devanagari for \fam 8
%           \else \rm
%    \fi}
% %
% \makeatother
% %
% % And then the text:
% $   % for the Devanagari pre-processor
% \beginnumbering
% \san
% \autopar
%
% aasiidraajaa \variant{nalo}{ki.mcidanyat ka, kha} naama
%   viirasenasuto balii|
%
% \endnumbering
% $   % for the Devanagari pre-processor
% \bye
% \end{verbatim}
% \end{small}
% \medskip
% \hrule
% \medskip
%
% \label{multinotes}
% You may have noticed that in the apparatus of the Sanskrit edition shown
% in figure~\ref{vyadi}, the line numbers are printed only once, even if
% there are several variants on a line.  Multiple notes to the same line
% are separated by a $\parallel$ sign.  We mentioned on
% p.\,\pageref{parallel} above how, in principle, this could be done. Here
% is the modified version of "\printlines" that actually does it (the
% original is on p.\,\pageref{printlines} above).
%
% \medskip
% \hrule
% \medskip
% \begin{small}
% \begin{verbatim}
% % First, define the symbol that will print instead of a repeated line
% % number:
% %
% \def\notenumsep{$\parallel$}
% %
% % Now the macro which prints the line numbers for a note.
% % It is modified here so that notes to the same line do not repeat
% % the line number, but print a "||" instead.
% %
% % Just a reminder that the seven parameters of the
% % argument are the line numbers as stored in "\@nums":
% % #1 the starting page,
% % #2 line, and
% % #3 subline numbers, followed by the
% % #4 ending page,
% % #5 line, and
% % #6 subline numbers, and then the
% % #7 font-family number for the lemma.
% %
% % Although there's no counter for the line number, because it's always
% % printed, we define a counter that keeps track of the previously printed
% % line number, so that we can stop line numbers being repeated in the
% % notes if they are all the same.
% %
% \newcount\previous@note@number
% %
% % The beginning of the \printlines macro is just the same as the original
% % defined by EDMAC (q.v. for commentary):
% %
% \def\printlines#1|#2|#3|#4|#5|#6|#7|{\begingroup
%   \@pnum=0 \@dash=0
%   \ifbypage@
%      \ifnum#4=#1 \else
%         \@pnum=1
%         \@dash=1
%      \fi
%   \fi
%   \@elin=\@pnum
%   \ifnum#2=#5 \else
%       \@elin=1
%       \@dash=1
%   \fi
%   \@ssub=0
%   \ifnum#3=0 \else
%       \@ssub=1
%   \fi
%   \@esl=0
%   \ifnum#6=0 \else
%       \ifnum#6=#3
%          \@esl=\@elin
%       \else
%          \@esl=1
%          \@dash=1
%       \fi
%   \fi
% %
% % Here come our modifications.  We're ready to print the various numbers,
% % based on our counter values, but the first thing we do is to compare the
% % current line number (parameter #2) with the last line number to have
% % been printed.  If they are the same, we print the \notenumsep siglum; if
% % not, we go ahead and print the actual line number.  (Note that this does
% % not cope with cases of multiple sub-line numbered notes to the same
% % line; more checks would be needed if that situation were likely to
% % arise.)
%
%   \ifnum\previous@note@number = #2
%     \ifodd\@elin % there is a different ending line number
%     #2%
%     \else
%       \notenumsep
%     \fi
%   \else
%     \ifodd\@pnum #1\fullstop\fi
%   #2% The (starting) line number
%   \fi
%   \ifodd\@ssub \fullstop #3\fi
%   \ifodd\@dash \endashchar\fi
%   \ifodd\@pnum #4\fullstop\fi
%   \ifodd\@elin #5\fi
%   \ifodd\@esl \ifodd\@elin\fullstop\fi #6\fi
% %
% % Now we record the number that has been printed, for comparison
% % next time \printlines is called:
% %
% \global\previous@note@number=#2
% %
% \endgroup}
% \end{verbatim}
% \end{small}
% \medskip
% \hrule
% \medskip
% \Finale
% \endinput
\endinput