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
|
% \iffalse ltxdoc klootch
% ltxutil.dtx: package to add utilties to LaTeX
% Copyright (c) 2000 Arthur Ogawa
%
% Disclaimer
% This file is distributed WITHOUT ANY WARRANTY;
% without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% ReadMe
% For the documentation and more detailed instructions for
% installation, typeset this document with \LaTeX.
% \fi
% \GetFileInfo{ltxutil.dtx}\CheckSum{3641}
%
% \iffalse ltxdoc klootch
%<*ltxutil>
%%% @LaTeX-file{
%%% filename = "ltxutil.dtx",
%%% version = "1.0rc5b",
%%% date = "2001/07/31",
%%% time = "12:23:00 GMT+8",
%%% checksum = "3641",
%%% author = "Arthur Ogawa (mailto:ogawa@teleport.com),
%%% commissioned by the American Physical Society.
%%% ",
%%% copyright = "Copyright (C) 1999 Arthur Ogawa,
%%% distributed under the terms of the
%%% LaTeX Project Public License, see
%%% ftp://ctan.tug.org/macros/latex/base/lppl.txt
%%% ",
%%% address = "Arthur Ogawa,
%%% USA",
%%% telephone = "",
%%% FAX = "",
%%% email = "ogawa@teleport.com",
%%% codetable = "ISO/ASCII",
%%% keywords = "latex, utility, kernel",
%%% supported = "yes",
%%% abstract = "package to add utilties to LaTeX",
%%% docstring = "The checksum field above generated by ltxdoc",
%%% }
%</ltxutil>
% \fi
%
% \iffalse ltxdoc klootch
% The following references the \file{00readme.txt} file,
% which contains basic information about this package.
% The contents of this file are generated when
% you typeset the programmer's documentation.
% Search on "{filecontents*}{00readme.txt}" to locate it.
% \fi\input{00readme.txt}%
%
% \subsection{Bill of Materials}
%
% Following is a list of the files in this distribution arranged
% according to provenance.
%
% \subsubsection{Primary Source}%
% One single file generates all.
%\begin{verbatim}
%ltxutil.dtx
%\end{verbatim}
%
% \subsubsection{Generated by \texttt{latex ltxutil.dtx}}%
% Typesetting the source file under \LaTeX\
% generates the readme and the installer.
%\begin{verbatim}
%00readme.txt ltxutil.ins
%\end{verbatim}
%
% \subsubsection{Generated by \texttt{tex ltxutil.ins}}%
% Typesetting the installer generates
% the package files.
%\begin{verbatim}
%ltxutil.sty
%\end{verbatim}
%
% \subsubsection{Documentation}%
% The following are the online documentation:
% \begin{verbatim}
%ltxutil.pdf
% \end{verbatim}
%
% \subsubsection{Auxiliary}%
% The following are auxiliary files generated
% in the course of running \LaTeX:
% \begin{verbatim}
%ltxutil.aux ltxutil.idx ltxutil.ind ltxutil.log ltxutil.toc
% \end{verbatim}
%
% \section{Code common to all modules}%
%
% The following may look a bit klootchy, but we
% want to require only one place in this file
% where the version number is stated,
% and we also want to ensure that the version
% number is embedded into every generated file.
%
% Now we declare that
% these files can only be used with \LaTeXe.
% An appropriate message is displayed if
% a different \TeX{} format is used.
% \begin{macrocode}
%<*doc|ltxutil>
\NeedsTeXFormat{LaTeX2e}[1995/12/01]%
%</doc|ltxutil>
% \end{macrocode}
% As desired, the following modules all
% take common version information:
% \begin{macrocode}
%<ltxutil>\ProvidesFile{ltxutil.sty}%
%<*doc>
\expandafter\ProvidesFile\expandafter{\jobname.dtx}%
%</doc>
% \end{macrocode}
%
% The following line contains, for once and for all,
% the version and date information.
% By various means, this information is reproduced
% consistently in all generated files and in the
% typeset documentation.
% \begin{macrocode}
%<*doc|ltxutil>
[2001/07/31 1.0rc5b utilities package]% \fileversion
%</doc|ltxutil>
% \end{macrocode}
%
%
% \section{The driver module \texttt{doc}}
%
% This module, consisting of the present section,
% typesets the programmer's documentation,
% generating the \file{.ins} installer and \file{00readme.txt} as required.
%
% Because the only uncommented-out lines of code at the beginning of
% this file constitute the \file{doc} module itself,
% we can simply typeset the \file{.dtx} file directly,
% and there is thus rarely any need to
% generate the ``doc'' {\sc docstrip} module.
% Module delimiters are nonetheless required so that
% this code does not find its way into the other modules.
%
% The \enve{document} command concludes the typesetting run.
%
% \begin{macrocode}
%<*doc>
% \end{macrocode}
%
% \subsection{The Preamble}
% The programmers documentation is formatted
% with the \classname{ltxdoc} class with local customizations,
% and with the usual code line indexing.
% \begin{macrocode}
\documentclass{ltxdoc}
\RequirePackage{ltxdocext}%
\let\url\undefined
\RequirePackage[colorlinks=true,linkcolor=blue]{hyperref}%
\expandafter\ifx\csname package@font\endcsname\@undefined\else
\expandafter\RequirePackage\expandafter{\csname package@font\endcsname}%
\fi
\CodelineIndex\EnableCrossrefs
% \end{macrocode}
%
% \subsubsection{Docstrip and info directives}
% We use so many {\sc docstrip} modules that we set the
% \texttt{StandardModuleDepth} counter to 1.
% \begin{macrocode}
\setcounter{StandardModuleDepth}{1}
% \end{macrocode}
% The following command retrieves the date and version information
% from this file.
% \begin{macrocode}
\expandafter\GetFileInfo\expandafter{\jobname.dtx}%
% \end{macrocode}
%
%
% \subsection{The installer file}
%
% The installer \file{ltxutil.ins} appears here.
% If you have retrieved the standard distribution of this package,
% the installer file is already on your filesystem.
% If you are bootstrapping,
% the first typesetting of the \file{.dtx} file
% will cause the installer to be generated.
%
% The following modules are used to direct
% {\sc docstrip} in generating the external files:
% \begin{center}
% \begin{tabular}{lll}
% \textbf{Module}&\textbf{File}&\textbf{Description}\\
% doc &\file{ltxutil.drv}&driver for programmer's documentation\\
% ltxutil,ltxutil-krn &\file{ltxutil.sty}&this package\\
% ltxutil-krn& &the portion of this package suitable for inclusion within another package
% \end{tabular}
% \end{center}
%
% \begin{macrocode}
\begin{filecontents}{ltxutil.ins}
%% This file will generate documentation and runtime files
%% from ltxutil.dtx when run through LaTeX or TeX.
\input docstrip
\preamble
This is a generated file;
altering it directly is inadvisable;
instead, modify the original source file.
See the URL in the file 00readme.txt.
Copyright notice.
These files are distributed
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
\endpreamble
\keepsilent
\generate{%
\file{ltxutil.drv}{\from{ltxutil.dtx}{doc}}%
\file{ltxutil.sty}{%
\from{ltxutil.dtx}{ltxutil,ltxutil-krn}%
}%
}%
\ifToplevel{
\Msg{***********************************************************}
\Msg{*}
\Msg{* To finish the installation, please move}
\Msg{* ltxutil.sty}
\Msg{* into a directory searched by TeX.}
\Msg{*}
\Msg{* To produce the documentation,
run ltxutil.dtx through LaTeX.}
\Msg{*}
\Msg{* Happy TeXing}
\Msg{***********************************************************}
}
\endbatchfile
\end{filecontents}
% \end{macrocode}
% Note that, because all of the files generated by the installer
% are part of the standard distribution, it will
% be necessary to run the installer only when bootstrapping
% (or, of course, during development).
% Note, too, that it is rare to generate the \file{doc}
% module because it suffices to simply typeset the \file{.dtx} file itself.
%
% \subsection{The ``Read Me'' File}
% As promised above, here is the contents of the
% ``Read Me'' file. That file serves a double purpose,
% since it also constitutes the beginining of the
% programmer's documentation. What better thing, after
% all, to have appear at the beginning of the
% typeset documentation?
%
% A good discussion of how to write a ReadMe file can be found in
% Engst, Tonya, ``Writing a ReadMe File? Read This''
% \emph{MacTech} October 1998, p. 58.
%
% Note the appearance of the
% \cmd\StopEventually\ command, which marks the
% dividing line between the user documentation
% and the programmer documentation.
%
% The usual user will not be asked to
% do a full build, not to speak
% of the bootstrap.
% Instructions for carrying these processes
% begin the programmer's manual.
%
% \begin{macrocode}
\begin{filecontents*}{00readme.txt}
\title{%
A \LaTeX\ Package of utility macros%
\thanks{%
This file has version number \fileversion,
last revised \filedate.%
% For version number and date,
% search on "\fileversion" in the .dtx file,
% or see the end of the 00readme.txt file.
}%
}%
\author{%
Arthur Ogawa (\texttt{mailto:ogawa@teleport.com}),
\fileversion\\Copyright (C) 1999 Arthur Ogawa
}%
\maketitle
This file embodies the \classname{ltxutil} package,
the implementation and its user documentation.
The distribution point for this work is
\url{ftp://ftp.teleport.com/users/ogawa/macros/latex/contrib/supported/ltxutil...},
which contains fully unpacked, prebuilt runtime files and documentation.
The \classname{ltxutil} package was commissioned by the American Physical Society
and is distributed under the terms of the \LaTeX\ Project Public License,
the same license under which all the portions of \LaTeX\ itself is distributed.
Please see \url{http://ctan.tug.org/macros/latex/base/lppl.txt} for details.
To use this document class, you must have a working
\TeX\ installation equipped with \LaTeXe\
and possibly pdftex and Adobe Acrobat Reader or equivalent.
To install, retrieve the distribution,
unpack it into a directory on the target computer,
and move the file \file{ltxutil.sty}
into a location in your filesystem where it will be found by \LaTeX.
To use, read the user documentation \file{ltxutil.pdf}.
\tableofcontents
\section{Processing Instructions}
The package file \file{ltxutil.sty}
is generated from this file, \file{ltxutil.dtx},
using the {\sc docstrip} facility of \LaTeX
via |tex ltxutil.ins|.
The typeset documentation that you are now reading is generated from
the same file by typesetting it with \LaTeX\ or pdftex
via |latex ltxutil.dtx| or |pdflatex ltxutil.dtx|.
\subsection{Build Instructions}
You may bootstrap this suite of files solely from \file{ltxutil.dtx}.
Prepare by installing \LaTeXe\ (and either tex or pdftex) on your computer,
then carry out the following steps:
\begin{enumerate}
\item
Within an otherwise empty directory,
typeset \file{ltxutil.dtx} with \LaTeX\ or pdflatex;
you will obtain the typeset documentation you are now reading,
along with
the installer \file{ltxutil.ins},
and the file \file{00readme.txt}.
Note: you will have to run \LaTeX\ twice, then \file{makeindex}, then
\LaTeX\ again in order to obtain a valid index and table of contents.
\item
Now typeset \file{ltxutil.ins},
thereby generating the package file \file{ltxutil.sty}.
\item
Install \classname{ltxutil.sty}
by moving it to a location
in your filesystem where they will be found by \LaTeX.
\end{enumerate}
\end{filecontents*}
% \end{macrocode}
%
% \subsection{The Document Body}
%
% Here is the document body, containing only a
% \cmd\DocInput\ directive---referring to this very file.
% This very cute self-reference is a common \classname{ltxdoc} idiom.
% \begin{macrocode}
\begin{document}%
\expandafter\DocInput\expandafter{\jobname.dtx}%
% ^^A\PrintChanges
\end{document}
% \end{macrocode}
%
% \begin{macrocode}
%</doc>
% \end{macrocode}
%
% \section{Using this package}
% Once this package is installed on your filesystem, you can employ it in
% adding functionality to \LaTeX\ by invoking it in your document or document class.
%
% \subsection{Invoking the package}
% In your document, you can simply call it up in your preamble:
% \begin{verbatim}
%\documentclass{book}%
%\usepackage{ltxutil}%
%\begin{document}
%<your document here>
%\end{document}
% \end{verbatim}
% However, the preferred way is to invoke this package from within your
% customized document class:
% \begin{verbatim}
%\NeedsTeXFormat{LaTeX2e}[1995/12/01]%
%\ProvidesClass{myclass}%
%\RequirePackage{ltxutil}%
%\LoadClass{book}%
%<class customization commands>
%\endinput
% \end{verbatim}
%
% Once loaded, the package gives you acccess to certain procedures,
% usually to be invoked by a \LaTeX\ command or environment, but not at the document level.
%
%
% \section{Compatability with \LaTeX's Required Packages}
% Certain packages, usually ones written by members of the
% \LaTeX\ Project itself, have been designated ``required'' and
% are distributed as part of standard \LaTeX.
% These packages have been placed in a priviledged position
% vis \'a vis the \LaTeX\ kernel in that they override the definitions of certain kernel macros.
%
% The \classname{ltxutil} package will be incompatible with any package that
% redefines any of the kernel macros that \classname{ltxutil} patches---if that
% package is loaded \emph{after} \classname{ltxutil}. This means that for
% greatest compatability, \classname{ltxutil} should be loaded \emph{after},
% say, \classname{ftnright}, which overwrites \LaTeX's kernel
% procedures \cmd\@outputdblcol, \cmd\@startcolumn, and \cmd\@makecol.
%
% Hereinafter follows some notes on specific \LaTeX\ packages.
%
% \subsection{array}
% This package alters the way tabular environments are done,
% therefore it could run afoul of the \LaTeX\ ``required'' package \classname{array} or any
% package that calls for it to be loaded.
% However, this package has provisions for remaining compatible with \classname{array}.
% So long as the version of \classname{array} that is used with this package has the appropriate
% meanings for the procedures it overwrites, all should be well.
%
% \subsection{longtable}
% David Carlisle's \classname{longtable} package modifies both the \LaTeX\ kernel and the
% \classname{array} package. This package must therefore alter \cmd\LT@array.
% For now, that job is handled by \classname{ltxgrid}.
%
%
%\StopEventually{}
%
% \section{Implementation of package}
%
% Special acknowledgment: this package uses concepts pioneered
% and first realized by William Baxter (mailto:web@superscript.com)
% in his SuperScript line of commercial typesetting tools, and
% which are used here with his permission.
%
% \subsection{Beginning of the \file{ltxutil} {\sc docstrip} module}
% \begin{macrocode}
%<*ltxutil>
\def\package@name{ltxutil}%
\expandafter\PackageInfo\expandafter{\package@name}{%
Utility macros for \protect\LaTeXe,
by A. Ogawa (ogawa@teleport.com)%
}%
%</ltxutil>
% \end{macrocode}
%
% \subsection{Banner}%
% Credit where due.
% \begin{macrocode}
%<*ltxutil-krn>
\typeout{%
ltxutil: portions licensed from W. E. Baxter (web@superscript.com)%
}%
% \end{macrocode}
%
% \subsection{Errors and warnings}
%
% \begin{macro}{\class@err}
% \begin{macro}{\class@warn}
% \begin{macro}{\class@info}
% A few shorthands for Class messages.
% Your document class should define \cmd\class@name.
% \begin{macrocode}
\def\class@err#1{\ClassError{\class@name}{#1}\@eha}%
\def\class@warn#1{\ClassWarningNoLine{\class@name}{#1}}%
\def\class@info#1{\ClassInfo{\class@name}{#1}}%
\def\obsolete@command#1{%
\class@warn@end{Command \string#1\space is obsolete.^^JPlease remove from your document}%
\global\let#1\@empty
#1%
}%
\def\replace@command#1#2{%
\class@warn@end{Command \string#1\space is obsolete;^^JUse \string#2\space instead}%
\global\let#1#2%
#1%
}%
\def\replace@environment#1#2{%
\class@warn@end{Environment #1 is obsolete;^^JUse #2 instead}%
\glet@environment{#1}{#2}%
\@nameuse{#1}%
}%
\def\incompatible@package#1{%
\@ifpackageloaded{#1}{%
\def\@tempa{I cannot continue. You must remove the \string\usepackage\ statement that caused that package to be loaded.}%
\ClassError{\class@name}{The #1 package cannot be used with \class@name}%
\@tempa\stop
}{%
\class@info{#1 was not loaded (OK!)}%
}%
}%
\def\class@warn@end#1{%
\gappdef\class@enddocumenthook{\class@warn{#1}}%
}%
\AtEndOfClass{%
\@ifxundefined\class@name{\def\class@name{Generic Class}}{}%
}%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{New Tools}%
%
% \begin{macro}{\t@}
% \begin{macrocode}
\def\t@{to}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\dimen@iii}
% \begin{macrocode}
\dimendef\dimen@iii\thr@@
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\halignt@}
% \begin{macrocode}
\def\halignt@{\halign\t@}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\f@ur}
% Analogous to \cmd\@ne, \cmd\tw@, and \cmd\thr@@.
% \begin{macrocode}
\chardef\f@ur=4\relax
\chardef\cat@letter=11\relax
\chardef\other=12\relax
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\let@environment}
% \begin{macro}{\glet@environment}
% The directive \cmd\let@environment\ takes care of a common programming
% idiom whereby one environment is made a synonym for another.
% \begin{macrocode}
\def\let@environment#1#2{%
\expandafter\let
\csname#1\expandafter\endcsname\csname#2\endcsname
\expandafter\let
\csname end#1\expandafter\endcsname\csname end#2\endcsname
}%
\def\glet@environment#1#2{%
\global\expandafter\let
\csname#1\expandafter\endcsname\csname#2\endcsname
\global\expandafter\let
\csname end#1\expandafter\endcsname\csname end#2\endcsname
}%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\tracingplain}
% The command \cmd\tracingplain\ causes \TeX's tracing parameters to
% return to the values set by default. This command is sometimes
% useful when you have said \cmd\tracingall\ somewhere and want to
% restore.
% The \cmd\traceoutput\ command causes \cmd\tracingoutput\ diagnostics
% upon \cmd\shipout.
% \begin{macrocode}
\newcommand\tracingplain{%
\tracingonline\z@\tracingcommands\z@\tracingstats\z@
\tracingpages\z@\tracingoutput\z@\tracinglostchars\@ne
\tracingmacros\z@\tracingparagraphs\z@\tracingrestores\z@
\showboxbreadth5\showboxdepth3\relax %\errorstopmode
}%
\newcommand\traceoutput{%
\appdef\@resetactivechars{\showoutput}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\say}
% \begin{macro}{\saythe}
% The commands \cmd\say\ and \cmd\saythe\ cause diagnostic messages in the
% \TeX\ log that give the value of a control sequence name or a register
% respectively.
% \begin{macrocode}
\newcommand\say[1]{\typeout{<\noexpand#1=\meaning#1>}}%
\newcommand\saythe[1]{\typeout{<\noexpand#1=\the#1>}}%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\fullinterlineskip}
% Resets the \cmd\prevdepth\ so that the full amount of \cmd\baselineskip\ glue will be inserted by
% the \cmd\baselinesklip\ mechanism.
% Can be invoked just after a \cmd\hrule\ to undo its default suppression of base line skip.
% \begin{macrocode}
\def\fullinterlineskip{\prevdepth\z@}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\count@i}
% \begin{macro}{\count@ii}
%
% \begin{macrocode}
\countdef\count@i\@ne
\countdef\count@ii\tw@
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \subsection{Boolean Control}%
% We introduce just enough of the Boolean calculus for \TeX.
% Alan Jeffrey was the pioneer here, with an article in TUGboat
% (Vol. 11, No. 2, page 237).
% This implementation owes a debt to
% William Baxter (web@superscript.com).
% See articles by Baxter and Ogawa in the proceedings of the
% 1994 TUG meeting, TUGboat Vol.~15, No.~3.
%
% \begin{macro}{\prepdef}
% \begin{macro}{\appdef}
% \begin{macro}{\gappdef}
%
% Provide the capability of performing head- and tail patches.
% The procedure \cmd\prepdef\ prepends to the given macro
% the tokens specified in its second argument.
% Likewise for \cmd\appdef, except that it appends.
% Note that the first 10 toks registers are utility registers,
% and we simply make a control sequence name, \cmd\toks@ii, for one of
% them.
% \begin{macrocode}
\long\def\prepdef#1#2{%
\@ifxundefined#1{\toks@{}}{\toks@\expandafter{#1}}%
\toks@ii{#2}%
\edef#1{\the\toks@ii\the\toks@}%
}%
\long\def\appdef#1#2{%
\@ifxundefined#1{\toks@{}}{\toks@\expandafter{#1}}%
\toks@ii{#2}%
\edef#1{\the\toks@\the\toks@ii}%
}%
\long\def\gappdef#1#2{%
\@ifxundefined#1{\toks@{}}{\toks@\expandafter{#1}}%
\toks@ii{#2}%
\global\edef#1{\the\toks@\the\toks@ii}%
}%
\long\def\appdef@val#1#2{%
\appdef#1{{#2}}%
}%
\long\def\appdef@e#1#2{%
\expandafter\appdef
\expandafter#1%
\expandafter{#2}%
}%
\long\def\appdef@eval#1#2{%
\expandafter\appdef@val
\expandafter#1%
\expandafter{#2}%
}%
\toksdef\toks@ii=\tw@
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@ifxundefined}
% \begin{macro}{\@ifnotrelax}
% \begin{macro}{\@argswap}
% \begin{macro}{\@argswap@val}
%
% Certain utility procedures use \cmd\@ifxundefined,
% which is defined here in terms of \cmd\@ifx.
% Others use \cmd\@ifnotrelax, namely when
% the control sequence name is manufactured by
% the use of \cmd\csname.
%
% The procedures \cmd\@argswap and \cmd\@argswap@val
% are used to facilitate control of expansion.
%
% \begin{macrocode}
\long\def\@ifxundefined#1{\@ifx{\undefined#1}}%
\long\def\@ifnotrelax#1#2#3{\@ifx{\relax#1}{#3}{#2}}%
\long\def\@argswap#1#2{#2#1}%
\long\def\@argswap@val#1#2{#2{#1}}%
\def\@ifxundefined@cs#1{\expandafter\@ifx\expandafter{\csname#1\endcsname\relax}}%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@boolean}
% \begin{macro}{\@boole@def}
% In order to define \cmd\@ifx, we first must create the
% ``defining word'' (term taken form our Forth vocabulary)
% \cmd\@boole@def, which employs \cmd\@boolean\ to do its job.
% \begin{macrocode}
\def\@boolean#1#2{%
\long\def#1{%
#2% \if<something>
\expandafter\true@sw
\else
\expandafter\false@sw
\fi
}%
}%
\def\@boole@def#1#{\@boolean{#1}}% Implicit #2
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@booleantrue}
% \begin{macro}{\@booleanfalse}
% The procedures \cmd\@booleantrue\ and
% \cmd\@booleanfalse\ are assignment operators
% for Boolean flags.
% \begin{macrocode}
\def\@booleantrue#1{\let#1\true@sw}%
\def\@booleanfalse#1{\let#1\false@sw}%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@ifx}
% \begin{macro}{\@ifx@empty}
% \begin{macro}{\@if@empty}
% \begin{macro}{\@ifcat}%
% \begin{macro}{\@ifdim}%
% \begin{macro}{\@ifeof}%
% \begin{macro}{\@ifhbox}%
% \begin{macro}{\@ifhmode}%
% \begin{macro}{\@ifinner}%
% \begin{macro}{\@ifmmode}%
% \begin{macro}{\@ifnum}%
% \begin{macro}{\@ifodd}%
% \begin{macro}{\@ifvbox}%
% \begin{macro}{\@ifvmode}%
% \begin{macro}{\@ifvoid}%
% We can now invoke the defining word to create
% the procedures \cmd\@ifx\ and friends.
%
% Compatability Note: earlier versions of this package
% defined a procedure \cmd\@ifempty. However, for compatability with AMS\LaTeX,
% we must avoid the following three names:
% \cmd\@ifempty, \cmd\@xifempty, and \cmd\@ifnotempty.
%
% \begin{macrocode}
\@boole@def\@ifx#1{\ifx#1}%
\@boole@def\@ifx@empty#1{\ifx\@empty#1}%
\@boole@def\@if@empty#1{\if!#1!}%
%\@boole@def\@if@sw#1{\csname if#1\endcsname}%
\def\@if@sw#1#2{#1\expandafter\true@sw\else\expandafter\false@sw#2}%
\@boole@def\@ifdim#1{\ifdim#1}%
\@boole@def\@ifeof#1{\ifeof#1}%
\@boole@def\@ifhbox#1{\ifhbox#1}%
\@boole@def\@ifhmode{\ifhmode}%
\@boole@def\@ifinner{\ifinner}%
\@boole@def\@ifmmode{\ifmmode}%
\@boole@def\@ifnum#1{\ifnum#1}%
\@boole@def\@ifodd#1{\ifodd#1}%
\@boole@def\@ifvbox#1{\ifvbox#1}%
\@boole@def\@ifvmode{\ifvmode}%
\@boole@def\@ifvoid#1{\ifvoid#1}%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\true@sw}
% \begin{macro}{\false@sw}
%
% Note that when a Boolean operator expands, it
% employs two macros that act as selectors, defined here.
%
% \begin{macrocode}
\long\def\true@sw#1#2{#1}%
\long\def\false@sw#1#2{#2}%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\loopuntil}
% \begin{macro}{\loopwhile}
%
% Loop control using the Boolean idiom.
% Superior to \cmd\loop\dots\cmd\repeat\ because these can be nested.
% The tail of the argument must have a Boolean predicate.
%
% \begin{macrocode}
\long\def\loopuntil#1{#1{}{\loopuntil{#1}}}%
\long\def\loopwhile#1{#1{\loopwhile{#1}}{}}%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@provide}
%
% A defining word that refuses to clobber a prior meaning.
%
% \begin{macrocode}
\def\@provide#1{%
\@ifx{\undefined#1}{\true@sw}{\@ifx{\relax#1}{\true@sw}{\false@sw}}%
{\def#1}{\def\j@nk}%
}%
% \end{macrocode}
% \end{macro}
%
%
% \subsection{Begin Document Structure}
% The standard \LaTeX\ mechanism \cmd\AtBeginDocument\
% is inadequate because the \cmd\vsize\ is bound much too early.
% We supply here a mechanism whereby decisions about the
% page layout can be deferred until \cmd\AtBeginDocument\ time.
%
% The problem we are working around is that the \cmd\AtBeginDocument\
% hook in \cmd\document\ appears long after the calculation of
% \cmd\vsize\ and \cmd\hsize, that is, \LaTeX\ provides no mechanism
% for deferring the decision about the page grid until \cmd\AtBeginDocument\ time.
% We fix things by prepending a hook at the very beginning of \cmd\document.
%
% The price we pay for this facility is to depend on the stability of this part
% of \LaTeX's kernel code (the first token of \cmd\document),
% which could change, you see. But considering that \LaTeX\ is
% at this point essentially stagnant once more, we risk it.
%
% \begin{macro}{\document}
% We begin by installing hooks into \cmd\document\ that
% we will manage ourselves.
% First, we do as \cmd\document\ does: end the group
% begun by \cmd\begin. Last, we conclude our shenanigans by absorbing
% the first token of the expansion of \cmd\document, which
% we assume to be \cmd\endgroup.
% \begin{macrocode}
\prepdef\document{%
\endgroup
\init@documenthook
\set@typesize@hook
\normalsize
\set@pica@hook
\true@sw{}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\class@documenthook}
% \begin{macro}{\class@enddocumenthook}
% We install the first \cmd\AtBeginDocument\ hook, namely the
% procedure \cmd\class@documenthook. Within the document class,
% we will use this hook exclusively, so as to avoid interference from other packages.
% Similarly with \cmd\class@enddocumenthook, installed via \cmd\AtEndDocument.
%
% A document class using this package should do as this package does and
% just say, \cmd\appdef\cmd\class@documenthook\ and \cmd\appdef\cmd\class@enddocumenthook\
% instead of \cmd\AtBeginDocument\ and \cmd\AtEndDocument.
% \begin{macrocode}
\def\init@documenthook{}%
\AtBeginDocument{%
\class@documenthook
}%
\AtEndDocument{%
\class@enddocumenthook
}%
\def\class@documenthook{}%
\def\class@enddocumenthook{}%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\set@typesize@hook}
% \begin{macro}{\set@pica@hook}
% The macros \cmd\set@typesize@hook\ and \cmd\set@pica@hook\ provide everything we need.
% To use, simply \cmd\appdef\ your tokens to the appropriate hook.
% \begin{macrocode}
\def\set@typesize@hook{}%
\def\set@pica@hook{}%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\enddocument}
% \begin{macro}{\check@aux}
% \begin{macro}{\do@check@aux}
% The standard \LaTeX\ \enve{document} processing is a potential problem,
% particularly when the output routine has been changed by \classname{ltxgrid}.
% We separate out the procedure that checks the auxiliary file at the end of
% the job so that later it can be called from the safety of the output
% routine.
% We will do this to ensure that the \cmd\@mainaux\ stream is not closed until
% the last page of the job is shipped out, and that can only be done by coordinating
% with the output routine.
% \begin{macrocode}
\def\enddocument{%
\@enddocumenthook
\@checkend{document}%
\clear@document
\check@aux
\deadcycles\z@
\@@end
}%
\def\clear@document{\clearpage}%
\def\check@aux{\do@check@aux}%
\def\do@check@aux{%
\@if@sw\if@filesw\fi{%
\immediate\closeout\@mainaux
\let\@setckpt\@gobbletwo
\let\@newl@bel\@testdef
\@tempswafalse
\makeatletter
\input\jobname.aux\relax
}{}%
\@dofilelist
\@ifdim{\font@submax >\fontsubfuzz\relax}{%
\@font@warning{%
Size substitutions with differences\MessageBreak
up to \font@submax\space have occured.\@gobbletwo
}%
}{}%
\@defaultsubs
\@refundefined
\@if@sw\if@filesw\fi{%
\@ifx{\@multiplelabels\relax}{%
\@if@sw\if@tempswa\fi{%
\@latex@warning@no@line{%
Label(s) may have changed.
Rerun to get cross-references right
}%
}{}%
}{%
\@multiplelabels
}%
}{}%
}%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsection{Type Tools}%
%
% \begin{macro}{\flushing}
% Undoes \cmd\centering. Should also undo \cmd\raggedleft\ and \cmd\raggedright.
% \begin{macrocode}
\def\flushing{%
\let\\\@normalcr
\leftskip\z@skip
\rightskip\z@skip
\@rightskip\z@skip
\parfillskip\@flushglue
}%
% \end{macrocode}
% \end{macro}
%
%
% \subsection{Display Math}%
%
% \begin{macro}{\eqnarray@LaTeX}
% \begin{macro}{\eqnarray@fleqn@fixed}
% Team \LaTeX\ has stated they will never repair Leslie's broken definition of \env{eqnarray}.
% Let us be bold\dots.
%
% Note on \classname{hyperref} package compatability: that package overrides
% \cmd\eqnarray\ by wrapping it up in a larger procedure, so its changes
% are compatible with this package's changes.
%
% \begin{macrocode}
\def\eqnarray@LaTeX{%
\stepcounter{equation}%
\def\@currentlabel{\p@equation\theequation}%
\global\@eqnswtrue
\m@th
\global\@eqcnt\z@
\tabskip\@centering
\let\\\@eqncr
$$\everycr{}\halign\t@\displaywidth\bgroup
\hskip\@centering$\displaystyle\tabskip\z@skip{##}$\@eqnsel
&\global\@eqcnt\@ne\hskip \tw@\arraycolsep \hfil${##}$\hfil
&\global\@eqcnt\tw@ \hskip \tw@\arraycolsep
$\displaystyle{##}$\hfil\tabskip\@centering
&\global\@eqcnt\thr@@ \hb@xt@\z@\bgroup\hss##\egroup
\tabskip\z@skip
\cr
}
\long\def\eqnarray@fleqn@fixed{%
\stepcounter{equation}\def\@currentlabel{\p@equation\theequation}%
\global\@eqnswtrue\m@th\global\@eqcnt\z@
\tabskip\mathindent
\let\\=\@eqncr
\setlength\abovedisplayskip{\topsep}%
\ifvmode\addtolength\abovedisplayskip{\partopsep}\fi
\addtolength\abovedisplayskip{\parskip}%
\setlength\belowdisplayskip{\abovedisplayskip}%
\setlength\belowdisplayshortskip{\abovedisplayskip}%
\setlength\abovedisplayshortskip{\abovedisplayskip}%
$$%
\everycr{}%
\halignt@\linewidth\bgroup
\hskip\@centering$\displaystyle\tabskip\z@skip{##}$\@eqnsel
&\global\@eqcnt\@ne
\hskip\tw@\eqncolsep
\hfil${{}##{}}$\hfil
&\global\@eqcnt\tw@
\hskip\tw@\eqncolsep
$\displaystyle{##}$\hfil\tabskip\@centering
&\global\@eqcnt\thr@@\hb@xt@\z@\bgroup\hss##\egroup
\tabskip\z@skip
\cr
}%
\@ifx{\eqnarray\eqnarray@LaTeX}{%
\class@info{Repairing broken LaTeX eqnarray}%
\let\eqnarray\eqnarray@fleqn@fixed
\newlength\eqncolsep
\setlength\eqncolsep\z@
\let\eqnarray@LaTeX\relax
\let\eqnarray@fleqn@fixed\relax
}{}%
\def\mathindent{\@centering}%
\def\set@eqnarray@skips{}%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \subsection{Footnotes}
%
% \changes{v4.0beta 4}{2000/04/10}
% {New kernel fix. For bug 174}
%
% \begin{macro}{\footnote}
% \begin{macro}{\footnotemark}
% \begin{macro}{\@xfootnote}
% \begin{macro}{\@xfootnotemark}
% \begin{macro}{\@yfootnote}
% We repair an error in the \LaTeX\ kernel (see \file{ltfloat.dtx}) involving footnotes.
% The symptom is that the \cmd\footnotemark\ command does not work properly within a \env{minipage} environment.
% The source of the problem is in the way the \cmd\footnotemark\ and \cmd\@xfootnotemark\ procedures are defined:
% they do not share the method used by the \cmd\footnote\ and other procedures that allows a context switch to
% change the way footnotes behave within a minipage environment.
% This is a \LaTeX\ bug of long standing; this fix dates to 1987.
%
% While we are at it, we rewrite both the \cmd\footnote\ and \cmd\footnotemark\ procedures,
% achieving a slightly cleaner separation of syntax and semantics.
% Note that the \cmd\@footnotemark\ and \cmd\@footnotetext\ procedures are not altered here;
% they continue as the methods of formatting the footnote mark and footnote text, respectively.
%
% A note about the context switch mentioned above:
% the \env{minipage} environment executes the following in order to alter the way footnotes
% behave:
%\begin{verbatim}
%\def\@mpfn{mpfootnote}%
%\def\thempfn{\thempfootnote}%
%\let\@footnotetext\@mpfootnotetext
%\c@mpfootnote\z@
%\end{verbatim}
% This code changes the counter used in autonumbered footnotes, the choice of footnote marker,
% and the procedure used on the footnote text. Changing the counter is needed because minipage
% footnotes are in their own sequence, and the footnote marker is customarily different within
% a minipage. The procedure that works on the footnote text must be different because the footnotes
% are placed at the bottom of the minipage, not the bottom of the text column.
%
% Any procedure that establishes a minipage-like context (e.g., floats) can do the same.
% \begin{macrocode}
\def\footnote{%
\@ifnextchar[\@xfootnote{\@yfootnote\@footnotetext}%
}%
\def\footnotemark{%
\@ifnextchar[\@xfootnotemark{\@yfootnote}%
}%
\def\@xfootnote[#1]{%
\@xfootnotemark[#1]%
\@footnotetext
}%
\def\@xfootnotemark@ltx[#1]{%
\begingroup
\csname c@\@mpfn\endcsname #1\relax
\unrestored@protected@xdef\@thefnmark{\thempfn}%
\endgroup
\H@@footnotemark
}%
\def\@yfootnote{%
\stepcounter\@mpfn
\protected@xdef\@thefnmark{\thempfn}%
\H@@footnotemark
}%
% \end{macrocode}
%
% Note on \classname{hyperref} compatability:
% In its ``Automated \LaTeX\ hypertext cross-references'',
% the \classname{hyperref} package alters footnote processing,
% thereby imperiling these fixes and necessiating defensive measures.
%
% The main thing \classname{hyperref} does is to take over the \cmd\@mpfootnotetext\ and
% \cmd\@footnotetext\ procedures, feeding its own arguments to these macros.
% It also rewrites \cmd\@footnotemark, making it a hyperlink.
%
% But at the same time, it attempts to turn off these changes during
% \cmd\maketitle\ processing, necessitating rewriting \cmd\@xfootnotemark.
% At this point it is on the slippery slope.
%
% We make ourself \classname{hyperref} friendly:
% we give \classname{hyperref} what it needs, but avoid its change to
% \cmd\@xfootnotemark.
%
% Any other package that rewrites \LaTeX's footnote macros will be incompatible
% with this package.
% \begin{macrocode}
\appdef\class@documenthook{%
\@ifxundefined\H@@footnotemark{%
\let\H@@footnotemark\@footnotemark
}{}%
\let\@xfootnotemark\@xfootnotemark@ltx
}%
% \end{macrocode}
%
% Two thoughts about \classname{hyperref}: what for does it define \cmd\realfootnote?
% Also: a document class that desires high hypertext capabilities might
% well wish to reimplement \cmd\maketitle\ so that footnotes called out from there
% are hypertext links: the \classname{hyperref} package's
% ``Automated \LaTeX\ hypertext cross-references''
% does not do any of this:
%\begin{quotation}
% But the special footnotes
% in |\maketitle| are much too hard to deal with
% properly. Let them revert to plain behaviour.
%\end{quotation}
% Note that the document class, in reimplementing \cmd\maketitle, must ensure
% that the \classname{hyperref} package does not clobber its own definition!
%
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@footnotetext}
% \begin{macro}{\@mpfootnotetext}
% \begin{macro}{\@tpfootnotetext}
% \begin{macro}{\make@footnotetext}
% \begin{macro}{\set@footnotewidth}
% The two procedures \cmd\@footnotetext\ and \cmd\@mpfootnotetext\ share code.
% We make that explicit here.
%
% Note that the procedure calling \cmd\make@footnotetext\ will open a group
% with \cmd\bgroup\ which is then closed by \cmd\minipagefootnote@drop.
%
% Difference from \LaTeX: here we do not set \cmd\floatingpenalty\ to infinity.
% Doing this must date back to a time when \LaTeX\ could not accomodate split insertions (footnotes).
% I cannot think of any other reason to do have done this.
% At any rate, with the \classname{ltxgrid} package, split insertions are specifically properly
% taken care of, so we allow it.
%
% We provide the hook \cmd\set@footnotewidth\
% that sets the footnote on a particular measure.
% Some page grids are such as to set a footnote in a context where \cmd\columnwidth
% is not the right parameter to use for the set width of a footnote.
% In such a case, for the applicable scope, you should define
% \cmd\set@footnotewidth\ to perform this job correctly.
%
% A procedure, \cmd\set@footnotewidth@ii, illustrates how to do this when in a two-column page grid.
% In general, remember that footnotes, like all insertions (including floats),
% are a step outside of the galley context, and all aspects of insertions need to be
% properly handled, including the set width.
% \begin{macrocode}
\long\def\@footnotetext{%
\insert\footins\bgroup
\make@footnotetext
}%
\long\def\@mpfootnotetext{%
\minipagefootnote@pick
\make@footnotetext
}%
\def\make@footnotetext#1{%
\reset@font\footnotesize
\interlinepenalty\interfootnotelinepenalty
\splittopskip\footnotesep
\splitmaxdepth\dp\strutbox
% \floatingpenalty\@MM
\set@footnotewidth
\@parboxrestore
\protected@edef\@currentlabel{%
\csname p@footnote\endcsname\@thefnmark
}%
\color@begingroup
\@makefntext{%
\rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox
}%
\color@endgroup
\minipagefootnote@drop
}%
\def\set@footnotewidth{%
\hsize\columnwidth
\linewidth\hsize
}%
\def\set@footnotewidth@ii{%
\hsize\textwidth
\advance\hsize\columnsep
\divide\hsize\tw@
\advance\hsize-\columnsep
\linewidth\hsize
}%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsection{Floats}
%
% \subsubsection{Usage notes}%
% We extend the \LaTeX\ kernel for three purposes:
% \begin{enumerate}
%
% \item
% When the \cmd\footnote\ command is used within the
% scope of a float, we do as \env{minipage} does.
%
% \item
% We provide a mechanism to write floats out to an external
% stream for temporary storage (deferred floats).
%
% \item
% We provide mechanism for placing a float \texttt{here}
% invariably, that is, floats are unfloated.
% This mechanism is used to read the external stream mentioned above.
%
% \end{enumerate}
%
% To use these mechanisms, the document class should
% define a float, say, \env{figure} as per usual, and in addition:
% \begin{enumerate}
%
% \item
% Optionally define an alternative, say \env{figure@write} as follows:
% \begin{verbatim}
%\newenvironment{figure@write}{%
% \write@float{figure}%
%}{%
% \endwrite@float
%}%
% \end{verbatim}
% That is, the alternative environment executes \cmd\write@float\
% instead of \cmd\@float.
% Note that this step is not needed if the float environment
% is defined in the simple way of \file{classes.dtx}.
% However, an environment like \env{longtable} will require it.
%
% \item
% Install into \cmd\AtBeginDocument\ a call to \cmd\do@if@floats,
% with the float name and an appropriate file extension as its arguments.
% \begin{verbatim}
%\AtBeginDocument{\do@if@floats{figure}{.fgx}}%
% \end{verbatim}
%
% \item
% Optionally define a text entity \cmd\figuresname\ that will
% be the text of the head that is set over the
% deferred floats.
% If not defined, there will be no head.
%
% \item
% Optionally define a user-level command to allow
% the document to determine where the figures are printed out
% (default is to print at end of document). E.g.,
% \begin{verbatim}
%\newcommand\printfigures{\print@float{figure}}%
% \end{verbatim}
% \item
% Install into \cmd\appdef\cmd\class@enddocumenthook\ a call to \cmd\printfigures,
% or, if the latter is not defined, as follows:
% \begin{verbatim}
%\appdef\class@enddocumenthook{\print@float{figure}}%
% \end{verbatim}
% Note that installing this command into \cmd\AtBeginDocument
% is best done earlier than calls that assume the last page of
% the document is at hand.
%
% \end{enumerate}
%
% \subsubsection{Robustifying fragile commands}%
% Certain of \LaTeX's commands cannot be written out to a file or appear within a \cmd\mark\ command argument
% because they do calculations during expansion.
% We provide for a little help, but without changing the meanings of these commands.
%
% \begin{macro}{\addtocontents}
%
% \begin{macrocode}
\def\addtocontents#1#2{%
\protected@write\@auxout{%
\let \label \@gobble \let \index \@gobble \let \glossary \@gobble
\def\({\string\(}%
\def\){\string\)}%
\def\\{\string\\}%
}{\string \@writefile {#1}{#2}}%
}%
% \end{macrocode}
%
% \end{macro}
%
% \subsubsection{Preparing for the \classname{hyperref package}}%
%
% \begin{macro}{\addcontentsline}
% \begin{macro}{\contentsline}
% The \classname{hyperref} package assumes that the \cmd\contentsline\ command will be given four arguments.
% Therefore it cannot successfully process a \filename{.toc} file that had been written by standard \LaTeX.
% We fix things up by always writing that fourth argument and by supplying a \cmd\contentsline\ command that
% can read them.
%
% We also give the \cmd\newlabel\ command's second argument five tokens.
%
% This means that a document class that uses this package will itself have trouble taking over a \filename{.toc} file that was written by standard \LaTeX. Sigh.
% \begin{macrocode}
\def\addcontentsline#1#2#3{%
\addtocontents{#1}{%
\protect\contentsline{#2}{#3}{\thepage}{}%
}%
}%
\def\contentsline#1#2#3#4{%
\csname l@#1\endcsname{#2}{#3}%
}%
\def\label#1{%
\@bsphack
\protected@write\@auxout{}{%
\string\newlabel{#1}{{\@currentlabel}{\thepage}{}{}{}}%
}%
\@esphack
}%
% \end{macrocode}
%
% \end{macro}
% \end{macro}
%
% \subsubsection{Footnotes within floats, unfloating floats, float font}%
%
% \begin{macro}{\caption}
% DPC: Er a bit of a hack, but seems best way of supporting normal
% \LaTeX\ syntax at this point: If a caption is used below a table,
% then put out the footnotes before the caption.
% \changes{v4.0beta 2}{1999/06/20}
% {Support the hack with \cs{prepdef}, and delay until \cs{AtBeginDocument} time,
% since \classname{hyperref} clobbers \cs{caption}.}
% \begin{macrocode}
\appdef\class@documenthook{%
\prepdef\caption{\minipagefootnote@here}%
}%
% \end{macrocode}
%
% Note on \classname{hyperref} compatability:
% this change to the \cmd\caption\ command is compatible with the
% ``Automated \LaTeX\ hypertext cross-references'' patches of
% that package.
%
% All the same, I think Sebastian's changes to \cmd\caption\ and \cmd\@caption\
% could bear with some improvement.
% The following implementation requires knowing only the pattern part of the
% \cmd\@caption\ macro:
%\begin{verbatim}
%\def\caption{%
% \H@refstepcounter\@captype
% \hyper@makecurrent{\@captype}%
% \@dblarg{\H@caption\@captype}%
%}%
%\def\H@caption#1[#2]#3{%
% \@caption{#1}[#2]{%
% \ifHy@nesting
% \hyper@@anchor{\@currentHref}{#3}%
% \else
% \hyper@@anchor{\@currentHref}{\relax}#3%
% \fi
% }%
%}%
%
%\end{verbatim}
%
% \end{macro}
%
% \begin{macro}{\minipagefootnote@init}
% \begin{macro}{\minipagefootnote@here}
% \begin{macro}{\minipagefootnote@foot}
% \begin{macro}{\minipagefootnote@pick}
% \begin{macro}{\minipagefootnote@drop}
% Procedure to deal with footnotes accumulated within a minipage environment.
% These procedures encapsulate all uses of the \cmd\@mpfootins\ box.
%
%
% Note: \cmd\minipagefootnote@here\ must \emph{not} be executed within the MVL!
% \begin{macrocode}
\def\minipagefootnote@init{%
\setbox\@mpfootins\box\voidb@x
}%
\def\minipagefootnote@pick{%
\global\setbox\@mpfootins\vbox\bgroup
\unvbox\@mpfootins
}%
\def\minipagefootnote@drop{%
\egroup
}%
\def\minipagefootnote@here{%
\par
\@ifvoid\@mpfootins{}{%
\vskip\skip\@mpfootins
\fullinterlineskip
\@ifinner{%
\vtop{\unvcopy\@mpfootins}%
{\setbox\z@\lastbox}%
}{}%
\unvbox\@mpfootins
}%
}%
\def\minipagefootnote@foot{%
\@ifvoid\@mpfootins{}{%
\insert\footins\bgroup\unvbox\@mpfootins\egroup
}%
}%
\def\endminipage{%
\par
\unskip
\minipagefootnote@here
\@minipagefalse %% added 24 May 89
\color@endgroup
\egroup
\expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa}%
}%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\floats@sw}
% The Boolean \cmd\floats@sw\ signifies that floats are to be floated;
% if false, that floats are to be deferred to the end of the document.
% Note that the state of this Boolean is to be changed by
% the document class in response to user-selected options.
% Here we display model code that assigns a default value
% at \cmd\AtBeginDocument\ time.
% \begin{verbatim}
%\AtBeginDocument{%
% \@ifxundefined\floats@sw{\@booleantrue\floats@sw}{}%
%}%
% \end{verbatim}
% \end{macro}
%
% \begin{macro}{\@xfloat}
% \begin{macro}{\@mpmakefntext}
% The float start-code is redefined to set up footnotes in the style of minipage.
% Also, the \cmd\floats@sw\ Boolean informs us that floats are to be
% all placed \texttt{here}.
% Note that, to protect against the Boolean being undefined
% at this late hour, we default it globally to true.
%
% \changes{v4.0beta 2}{1999/06/20}
% {AO: Removed superfluous \cs{def}s, changed to using \cs{floats@sw} as the flag.
% Also stopped using DPC's \cs{if@twocolumn} flag: using \cs{floats@sw} instead.
% Also added \cs{par}\cs{vskip}\cs{z@skip} after the \cs{minipagefootnotes}
% so that the float box would have zero depth like the kernel one.
% }
% \changes{v4.0beta 3}{1999/11/13}
% {bug fix 110. Install hooks for endfloats processing}
% \changes{v4.0beta 4}{2000/04/10}
% {bug fix 127. Floats placed [h] to allow page breaks}
% \changes{v4.0beta 4}{2000/05/19}
% {bug fix 224. Hyperref compatability.}
% \changes{v4.0beta 5}{2000/11/16}
% {bug fix 221. Remove samepage command from @xfloat@prep: If the float can break over pages, we want better control.}
%FIXME: why does hyperref override \cmd\@xfootnotenext?
%
% \begin{macrocode}
\let\@xfloat@LaTeX\@xfloat
\def\@xfloat#1[#2]{%
\@xfloat@prep
\@nameuse{fp@proc@#2}%
\@ifxundefined\floats@sw{\global\@booleantrue\floats@sw}{}%
\floats@sw{\@xfloat@LaTeX{#1}[#2]}{\@xfloat@anchored{#1}[]}%
}%
\def\@xfloat@prep{%
\let\footnote\footnote@latex
\def\@mpfn{mpfootnote}%
\def\thempfn{\thempfootnote}%
% \def\thefootnote{\thempfootnote}%
\c@mpfootnote\z@
\let\@footnotetext\@mpfootnotetext
\let\H@@footnotetext\@mpfootnotetext
\let\@makefntext\@mpmakefntext
% \samepage
}%
\appdef\class@documenthook{%
\let\footnote@latex\footnote
}%
%\def\fp@proc@h{\@booleanfalse\floats@sw}%
%\def\fp@proc@H{\@booleanfalse\floats@sw}%
\def\@xfloat@anchored#1[#2]{%
\def\@captype{#1}%
\begin@float@pagebreak
%\vbox\bgroup
\let\end@float\end@float@anchored
\let\end@dblfloat\end@float@anchored
% do as \@xfloat does:
\hsize\columnwidth
\@parboxrestore
\@floatboxreset
\minipagefootnote@init
% \pagegrid@col\@ne % Klootch to avoid processing as a float
}%
\def\end@float@anchored{%
\minipagefootnote@here
\par\vskip\z@skip %% \par\vskip\z@ added 15 Dec 87
%\egroup
\par
\end@float@pagebreak
}%
\def\begin@float@pagebreak{\par\addvspace\intextsep}%
\def\end@float@pagebreak{\par\addvspace\intextsep}%
\def\@mpmakefntext#1{%
\parindent=1em
\noindent
\hb@xt@1em{\hss\@makefnmark}%
#1%
}%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \subsubsection{Writing floats out to a file}%
%
% \begin{macro}{\do@if@floats}
% The procedure \cmd\do@if@floats\ should be executed at
% \cmd\AtBeginDocument\ time, and arranges to write out
% the floats of the given class to a temporary file, to be
% read back later (deferred floats),
% given that \cmd\floats@sw\ is false.
% Note that, to protect against the Boolean being undefined
% at this late hour, we default it globally to true.
% \begin{macrocode}
\def\do@if@floats#1#2{%
\@ifxundefined\floats@sw{\global\@booleantrue\floats@sw}{}%
\floats@sw{}{%
% \end{macrocode}
% Open the stream to save out the document's floats of this class.
% \begin{macrocode}
\expandafter\newwrite
\csname#1write\endcsname
\expandafter\def
\csname#1@stream\endcsname{\jobname#2}%
\expandafter\immediate
\expandafter\openout
\csname#1write\endcsname
\csname#1@stream\endcsname\relax
% \end{macrocode}
% Swap environments.
% If the class writer has defined, e.g., \env{figure@write},
% then we use this as the procedure to execute for writing
% the float out to the external stream.
% Otherwise, the replacement of \cmd\@float\ by \cmd\write@float\
% should do the right thing for float environments defined
% in the simple way of \classname{classes.dtx}.
% \begin{macrocode}
\@ifxundefined\@float@LaTeX{%
\let\@float@LaTeX\@float
\let\@dblfloat@LaTeX\@dblfloat
\let\@float\write@float
\let\@dblfloat\write@floats
}{}%
\let@environment{#1@float}{#1}%
\let@environment{#1@floats}{#1*}%
\@ifxundefined@cs{#1@write}{}{%
\let@environment{#1}{#1@write}%
}%
}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\print@float}
% The procedure \cmd\print@float\ prints out the
% deferred floats.
% \changes{v4.0beta 2}{1999/06/20}
% {only execute if there really were floats of the given type}
% \changes{v4.0beta 3}{1999/11/13}
% {*-form mandates pagebreak at each float;
% only print section head if there is something there.}
% \changes{v4.0beta 4}{2000/05/23}
% {Allow things to break over pages by setting array@default.}
%
% \begin{macrocode}
\def\triggerpar{\leavevmode\@@par}%
\def\oneapage{\def\begin@float@pagebreak{\newpage}\def\end@float@pagebreak{\newpage}}%
\def\print@float#1#2{%
\@ifxundefined@cs{#1write}{}{%
\begingroup
\@booleanfalse\floats@sw
#2%
\raggedbottom
\def\array@default{v}% floats must
\let\@float\@float@LaTeX
\let\@dblfloat\@dblfloat@LaTeX
\let\trigger@float@par\triggerpar
\let@environment{#1}{#1@float}%
\let@environment{#1*}{#1@floats}%
\expandafter\prepdef\csname#1\endcsname{\trigger@float@par}%
\expandafter\prepdef\csname#1*\endcsname{\trigger@float@par}%
\@namedef{fps@#1}{h!}%
\expandafter\immediate
\expandafter\closeout
\csname#1write\endcsname
\everypar{%
\global\let\trigger@float@par\relax
\global\everypar{}\setbox\z@\lastbox
\@ifxundefined@cs{#1sname}{}{%
\begin@float@pagebreak
\expandafter\section
\expandafter*%
\expandafter{%
\csname#1sname\endcsname
}%
}%
}%
\input{\csname#1@stream\endcsname}%
\endgroup
\global\expandafter\let\csname#1write\endcsname\relax
}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\write@float}
% \begin{macro}{\write@floats}
% \begin{macro}{\write@@float}
% Handles the case where the name of the float is the same as
% that of the stream. Note that
% \env{longtable} does \emph{not} fit this case.
% Note also: \cmd\write@float\ is \emph{not} a user-level environment
% therefore it is properly not defined with \cmd\newenvironment.
% \begin{macrocode}
\def\write@float#1{\write@@float{#1}{#1}}%
\def\endwrite@float{\@Esphack}%
\def\write@floats#1{\write@@float{#1*}{#1}}%
\def\endwrite@floats{\@Esphack}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\write@@float}
% \changes{v4.0beta 2}{1999/06/20}
% {AO: Fixed spurious \texttt{CR} and (return) characters in output file.
% Also, if the document did not have the \cs{end}\texttt{figure} on a line of its own,
% the macro wouldn't work. Fixed.}
% \begin{macrocode}
\def\write@@float#1#2{%
\ifhmode
\@bsphack
\fi
\chardef\@tempc\csname#2write\endcsname
\toks@{\begin{#1}}%
\def\@tempb{#1}%
\expandafter\let\csname end#1\endcsname\endwrite@float
\catcode`\^^M\active
\@makeother\{\@makeother\}\@makeother\%
\write@floatline
}%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\write@floatline}
% \begin{macro}{\@write@floatline}
% \begin{macro}{\float@end@tag}
% The procedure \cmd\write@floatline\ only parses, and passes
% its result to \cmd\@write@floatline, which
% writes the line to output, then tests the line
% for the \cmd\end\arg{float} tokens with
% aid of the \cmd\float@end@tag\ procedure.
% \begin{macrocode}
\begingroup
\catcode`\[\the\catcode`\{\catcode`\]\the\catcode`\}\@makeother\{\@makeother\}%
\gdef\float@end@tag#1\end{#2}#3\@nul[%
\def\@tempa[#2]%
\@ifx[\@tempa\@tempb][\end[#2]][\write@floatline]%
]%
\obeylines%
\gdef\write@floatline#1^^M[%
\begingroup%
\newlinechar`\^^M%
\toks@\expandafter[\the\toks@#1]\immediate\write\@tempc[\the\toks@]%
\endgroup%
\toks@[]%
\float@end@tag#1\end{}\@nul%
]%
\endgroup
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
%
% \subsection{Counters}
% The following definitions override those of the \LaTeX\ kernel,
% providing for a greater range of inputs.
% \begin{macrocode}
\def\@alph#1{\ifcase#1\or a\or b\or c\or d\else\@ialph{#1}\fi}
% \end{macrocode}
%
% \begin{macrocode}
\def\@ialph#1{\ifcase#1\or \or \or \or \or e\or f\or g\or h\or i\or j\or
k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or
y\or z\or aa\or bb\or cc\or dd\or ee\or ff\or gg\or hh\or ii\or jj\or
kk\or ll\or mm\or nn\or oo\or pp\or qq\or rr\or ss\or tt\or uu\or
vv\or ww\or xx\or yy\or zz\else\@ctrerr\fi}
% \end{macrocode}
%
%
% \subsection{Customization of Sections}%
%
% Patch the standard \LaTeX\ sectioning procedure to:
%\begin{itemize}
%\item
% Allow a sectioning command to trigger the title page, or more generally
% to recognize that it is the first object in the document,
% so we headpatch \cmd\@startsection.
%
%\item
% Allow a tail command in |#6| to uppercase the title, so we retain
% DPC's braces.
%
%\item
% Allow each type of sectioning command to format its number differently,
% so we generalize \cmd\@seccntformat.
%
%\item
% Allow each type of sectioning command to format its argument differently,
% so we generalize \cmd\@hangfrom.
%
%\item
% Allow the starred form of the command to
% mark (the running head) and
% make an entry in the TOC,
% so we put \cmd\@ssect\ on the same footing as \cmd\@sect.
%
% Note that the tokens passed to the TOC now are \emph{not}
% the optional argument of the command, but the required.
% This means that the user can no longer use the former
% to put variant content in to the TOC as the Manual says.
%
% Instead, the optional argument is used to put an alternative
% title into the running headers, a better choice.
%
%\end{itemize}
%
% \begin{macro}{\@startsection}
% Patch a head hook into the basic sectioning command.
% Treat \cmd\@sect\ and \cmd\@ssect\ on an equal footing:
% now their pattern parts are identical.
% \begin{macrocode}
\def\@startsection#1#2#3#4#5#6{%
\@startsection@hook
\if@noskipsec \leavevmode \fi
\par
\@tempskipa #4\relax
\@afterindenttrue
\ifdim \@tempskipa <\z@
\@tempskipa -\@tempskipa \@afterindentfalse
\fi
\if@nobreak
\everypar{}%
\else
\addpenalty\@secpenalty\addvspace\@tempskipa
\fi
\@ifstar
{\@dblarg{\@ssect@ltx{#1}{#2}{#3}{#4}{#5}{#6}}}%
{\@dblarg{\@sect@ltx {#1}{#2}{#3}{#4}{#5}{#6}}}%
}%
\def\@startsection@hook{}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@sect}
% When defining \cmd\@svsec, do not expand \cmd\@seccntformat.
% Put brace characters back where they were before David Carlisle got at them
% (i.e., as if \cmd\@hangfrom\ had two arguments).
% Protect the mark mechanism from an undefined meaning.
% Pass |#8| to the TOC instead of |#7|.
% Remove \cmd\relax\ from the replacement part of \cmd\@svsec.
%
% The procedure \cmd\@hangfrom\ and \cmd\@runin@to\ can
% be used to process the argument of the head.
% The head can define, e.g., \cmd\@hangfrom@section, to
% do its own processing.
%
% In using \cmd\H@refstepcounter\ in place of \cmd\refstepcounter\ we rely on
% either loading before any package that patches the latter, or
% the convention that the former is the original \LaTeX\ procedure.
%
% \begin{macrocode}
\class@info
{Repairing broken LateX \string\@sect}%
\def\@sect@ltx#1#2#3#4#5#6[#7]#8{%
\@ifnum{#2>\c@secnumdepth}{%
\def\H@svsec{\phantomsection}%
\let\@svsec\@empty
}{%
\H@refstepcounter{#1}%
\def\H@svsec{%
\phantomsection
}%
\protected@edef\@svsec{{#1}}%
\@ifundefined{@#1cntformat}{%
\prepdef\@svsec\@seccntformat
}{%
\expandafter\prepdef
\expandafter\@svsec
\csname @#1cntformat\endcsname
}%
}%
\@tempskipa #5\relax
\@ifdim{\@tempskipa>\z@}{%
\begingroup
\interlinepenalty \@M
#6{%
\@ifundefined{@hangfrom@#1}{\@hang@from}{\csname @hangfrom@#1\endcsname}%
{\hskip#3\relax\H@svsec}{\@svsec}{#8}%
}%
\@@par
\endgroup
\@ifundefined{#1mark}{\@gobble}{\csname #1mark\endcsname}{#7}%
\addcontentsline{toc}{#1}{%
\@ifnum{#2>\c@secnumdepth}{%
\protect\numberline{}%
}{%
\protect\numberline{\csname the#1\endcsname}%
}%
#8}%
}{%
\def\@svsechd{%
#6{%
\@ifundefined{@runin@to@#1}{\@runin@to}{\csname @runin@to@#1\endcsname}%
{\hskip#3\relax\H@svsec}{\@svsec}{#8}%
}%
\@ifundefined{#1mark}{\@gobble}{\csname #1mark\endcsname}{#7}%
\addcontentsline{toc}{#1}{%
\@ifnum{#2>\c@secnumdepth}{%
\protect\numberline{}%
}{%
\protect\numberline{\csname the#1\endcsname}%
}%
#8}%
}%
}%
\@xsect{#5}%
}%
\def\@hang@from#1#2#3{\@hangfrom{#1#2}#3}%
\def\@runin@to #1#2#3{#1#2#3}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@ssect}
% Put brace characters back where they were before David Carlisle got at them
% (as if \cmd\@hangfrom\ has two arguments).
% Possibly set a mark.
% Make a TOC entry.
%
% Note that, for compatability with the \classname{hyperref} package, we
% need to provide the interface required by that package
% (actually required by \file{pdfmark.def} and \file{nameref.sty}),
% namely
% the definition of \cmd\@currentlabelname\ (but now removed),
% the insertion of the procedure \cmd\Sectionformat\ (but why is this needed?), and
% the call to \cmd\phantomsection\ (which must precede the call to \cmd\addcontentsline).
% We also have to sidestep the patch to \cmd\@ssect\ in that same file, therefore
% we use a different control sequence name in the call from \cmd\@startsection.
% \changes{v4.0beta 3}{1999/11/13}
% {Bug 116: Hyperref compatability}
% \changes{v4.0rc3b}{2001/07/13}
% {Bug 404: Hyperref compatability}
% \begin{macrocode}
\def\@ssect@ltx#1#2#3#4#5#6[#7]#8{%
% \def\@currentlabelname{#8}%
\def\H@svsec{\phantomsection}%
\@tempskipa #5\relax
\@ifdim{\@tempskipa>\z@}{%
\begingroup
\interlinepenalty \@M
#6{%
\@ifundefined{@hangfroms@#1}{\@hang@froms}{\csname @hangfroms@#1\endcsname}%
% {\hskip#3\relax\H@svsec}{\Sectionformat{#8}{#1}}%
{\hskip#3\relax\H@svsec}{#8}%
}%
\@@par
\endgroup
\@ifundefined{#1smark}{\@gobble}{\csname #1smark\endcsname}{#7}%
\addcontentsline{toc}{#1}{\protect\numberline{}#8}%
}{%
\def\@svsechd{%
#6{%
\@ifundefined{@runin@tos@#1}{\@runin@tos}{\csname @runin@tos@#1\endcsname}%
% {\hskip#3\relax\H@svsec}{\Sectionformat{#8}{#1}}%
{\hskip#3\relax\H@svsec}{#8}%
}%
\@ifundefined{#1smark}{\@gobble}{\csname #1smark\endcsname}{#7}%
\addcontentsline{toc}{#1}{\protect\numberline{}#8}%
}%
}%
\@xsect{#5}%
}%
\def\@hang@froms#1#2{#1#2}%
\def\@runin@tos #1#2{#1#2}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\init@documenthook}
% Document classes that incorporate this package will be \classname{hyperref}-savvy.
% (To accomplish this, we ensure that \cmd\hyperanchor\ and \cmd\hyper@last\ are both defined.)
% Being \classname{hyperref}-savvy levels some requirements on us, but the benefits are many.
%
% One is that the TOC will not get amnesia and require a full set of three typesetting runs before its formatting is stable.
% Instead, only two runs are required: the first updates the auxiliary file, the second the TOC.
% However, the formatting of the document does not change.
%
% Another aspect of being \classname{hyperref}-savvy is that the syntax of commands in the \filename{.aux} file will now change
% if \classname{hyperref} is turned on or off.
%
% Note that \cmd\hyper@anchorstart\ and \cmd\hyper@anchorend\ constitute the programming interface
% for a hypertext anchor (the target of a hypertext link); \cmd\hyper@linkstart\ and \cmd\hyper@linkend\
% are the interface for a hypertext link.
% \begin{macrocode}
\appdef\init@documenthook{%
\providecommand\phantomsection{}%
%\@ifx{\Sectionformat\@undefined}{\let\Sectionformat\@firstoftwo}{}%
\providecommand\hyper@anchor[1]{}%
\providecommand\hyper@last{}%
\providecommand\Hy@raisedlink[1]{#1}%
\providecommand\hyper@anchorstart[1]{}%
\providecommand\hyper@anchorend{}%
\providecommand\hyper@linkstart[2]{}%
\providecommand\hyper@linkend{}%
}%
\let\H@refstepcounter\refstepcounter
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\sec@upcase}
% Upper case for sections (optional upper case items). These are
% created so that some headings can be toggled between mixed case and
% upper case readily.
% Headings that might be changed can be wrapped in the style file in
% \cmd\sec@upcase\arg{text} constructs;
% the expansion of \cmd\sec@upcase\ is
% controlled here. It is \cmd\relax\ by default (mixed case heads), and
% can easily be changed to \cmd\uppercase\ if desired.
% If mixed-case headings are wanted by the editor, authors {\em must}
% supply mixed case text, although this is what authors should be doing
% anyway.
% (Mixed can be converted to upper,
% but the reverse transformation cannot be automated.)
%
% The following setting gives the \LaTeX\ default.
% \begin{macrocode}
\def\sec@upcase#1{\relax{#1}}%
% \end{macrocode}
% \end{macro}
%
%
% \subsection{Patch the \env{tabular} and \env{array} Environments}
%
% \begin{macro}{\endtabular}
% \begin{macro}{\endarray}
% We headpatch the begin processing and tailpatch the end processing
% of the \env{tabular} and \env{array} environments.
% A document class can define these hooks as needed.
%
% We proceed with care to make further patches to
% support tabulars that break over pages.
% Our patches will not necessarily be effective for
% other packages that replace the \LaTeX\ \env{array} and \env{tabular}
% environments. I know of none that do so.
% \begin{macrocode}
\appdef\class@documenthook{%
\@ifpackageloaded{array}{\switch@array}{\switch@tabular}%
\prepdef\endtabular{\endtabular@hook}%
\@provide\endtabular@hook{}%
\prepdef\endarray{\endarray@hook}%
\@provide\endarray@hook{}%
\providecommand\array@hook{}%
% \end{macrocode}
% Install, effectively, a head patch to \cmd\tabular.
% In order to avoid interference from, e.g., the \classname{array} package,
% we must perform this patch only \emph{after} packages load.
% \changes{v4.0beta 3}{1999/11/13}
% {Bug 130. Interference from array package}
% \begin{macrocode}
\prepdef\@tabular{\tabular@hook}%
\@provide\tabular@hook{}%
}%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\switch@tabular}
% \begin{macro}{\switch@array}
% The two procedures \cmd\switch@tabular\ and \cmd\switch@array\
% apply needed patches to the various tabular procedures,
% the former applying to the \LaTeX\ kernel, the latter to the
% required \classname{array} package (and to the number of other
% required packages that load it).
%
% \begin{macrocode}
\def\switch@tabular{%
\let\@array@sw\@array@sw@array
\@ifx{\@array\@array@LaTeX}{%
\@ifx{\multicolumn\multicolumn@LaTeX}{%
\@ifx{\@tabular\@tabular@LaTeX}{%
\@ifx{\@tabarray\@tabarray@LaTeX}{%
\@ifx{\array\array@LaTeX}{%
\@ifx{\endarray\endarray@LaTeX}{%
\@ifx{\endtabular\endtabular@LaTeX}{%
\@ifx{\@mkpream\@mkpream@LaTeX}{%
\@ifx{\@addamp\@addamp@LaTeX}{%
\@ifx{\@arrayacol\@arrayacol@LaTeX}{%
\@ifx{\@tabacol\@tabacol@LaTeX}{%
\@ifx{\@arrayclassz\@arrayclassz@LaTeX}{%
\@ifx{\@tabclassiv\@tabclassiv@LaTeX}{%
\@ifx{\@arrayclassiv\@arrayclassiv@LaTeX}{%
\@ifx{\@tabclassz\@tabclassz@LaTeX}{%
\@ifx{\@classv\@classv@LaTeX}{%
\@ifx{\hline\hline@LaTeX}{%
\@ifx{\@tabularcr\@tabularcr@LaTeX}{%
\@ifx{\@xtabularcr\@xtabularcr@LaTeX}{%
\@ifx{\@xargarraycr\@xargarraycr@LaTeX}{%
\@ifx{\@yargarraycr\@yargarraycr@LaTeX}{%
\true@sw
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
{%
\class@info{Patching LaTeX tabular.}%
}{%
\class@info{Unrecognized LaTeX tabular. Please update this document class! (Proceeding with fingers crossed.)}%
}%
\let\@array\@array@ltx
\let\multicolumn\multicolumn@ltx
\let\@tabular\@tabular@ltx
\let\@tabarray\@tabarray@ltx
\let\array\array@ltx
\let\endarray\endarray@ltx
\let\endtabular\endtabular@ltx
\let\@mkpream\@mkpream@ltx
\let\@addamp\@addamp@ltx
\let\@arrayacol\@arrayacol@ltx
\let\@tabacol\@tabacol@ltx
\let\@arrayclassz\@arrayclassz@ltx
\let\@tabclassiv\@tabclassiv@ltx
\let\@arrayclassiv\@arrayclassiv@ltx
\let\@tabclassz\@tabclassz@ltx
\let\@classv\@classv@ltx
\let\hline\hline@ltx
\let\@tabularcr\@tabularcr@ltx
\let\@xtabularcr\@xtabularcr@ltx
\let\@xargarraycr\@xargarraycr@ltx
\let\@yargarraycr\@yargarraycr@ltx
}%
\def\switch@array{%
\let\@array@sw\@array@sw@LaTeX
\@ifx{\@array\@array@array}{%
\@ifx{\@tabular\@tabular@array}{%
\@ifx{\@tabarray\@tabarray@array}{%
\@ifx{\array\array@array}{%
\@ifx{\endarray\endarray@array}{%
\@ifx{\endtabular\endtabular@array}{%
\@ifx{\@mkpream\@mkpream@array}{%
\@ifx{\@classx\@classx@array}{%
\@ifx{\insert@column\insert@column@array}{%
\@ifx{\@arraycr\@arraycr@array}{%
\@ifx{\@xarraycr\@xarraycr@array}{%
\@ifx{\@xargarraycr\@xargarraycr@array}{%
\@ifx{\@yargarraycr\@yargarraycr@array}{%
\true@sw
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}%
}{%
\false@sw
}{%
\class@info{Patching array package.}%
}{%
\class@info{Unrecognized array package. Please update this document class! (Proceeding with fingers crossed.)}%
}%
\let\@array \@array@array@new
\let\@@array \@array % Cosi fan tutti
\let\@tabular \@tabular@array@new
\let\@tabarray \@tabarray@array@new
\let\array \array@array@new
\let\endarray \endarray@array@new
\let\endtabular\endtabular@array@new
\let\@mkpream \@mkpream@array@new
\let\@classx \@classx@array@new
\let\@arrayacol\@arrayacol@ltx
\let\@tabacol \@tabacol@ltx
\let\insert@column\insert@column@array@new
\expandafter\let\csname endtabular*\endcsname\endtabular % Cosi fan tutti
\let\@arraycr \@arraycr@new
\let\@xarraycr \@xarraycr@new
\let\@xargarraycr\@xargarraycr@new
\let\@yargarraycr\@yargarraycr@new
}%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@array@sw}
% The Boolean \cmd\@array@sw\ must be different depending on
% whether the \classname{array} package is loaded.
% \begin{macrocode}
\def\@array@sw@LaTeX{\@ifx{\\\@tabularcr}}%
\def\@array@sw@array{\@ifx{\d@llarbegin\begingroup}}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@tabular}
% We provide the old versions of \cmd\@tabular\ along with the respective new versions.
% The change here is to avoid committing to LR mode. That will be done later (as late as possible, naturally).
% \begin{macrocode}
\def\@tabular@LaTeX{%
\leavevmode
\hbox\bgroup$%
\let\@acol\@tabacol
\let\@classz\@tabclassz
\let\@classiv\@tabclassiv
\let\\\@tabularcr
\@tabarray
}%
\def\@tabular@ltx{%
\let\@acoll\@tabacoll
\let\@acolr\@tabacolr
\let\@acol\@tabacol
\let\@classz\@tabclassz
\let\@classiv\@tabclassiv
\let\\\@tabularcr
\@tabarray
}%
\def\@tabular@array{%
\leavevmode
\hbox\bgroup$%
\col@sep\tabcolsep
\let\d@llarbegin\begingroup
\let\d@llarend\endgroup
\@tabarray
}%
\def\@tabular@array@new{%
\let\@acoll\@tabacoll
\let\@acolr\@tabacolr
\let\@acol\@tabacol
\let\col@sep\@undefined
\let\d@llarbegin\begingroup
\let\d@llarend\endgroup
\@tabarray
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@tabarray}
% Here we provide old and new versions of the \cmd\@tabarray\ procedure.
% The change here is to parametrize the default vertical alignment,
% which is 'c' in standard \LaTeX.
% Under some circumstances, we want to change this to, say, 'v'.
%
% FIXME: must decouple \env{array} and \env{tabular}.
% \begin{macrocode}
\def\@tabarray@LaTeX{%
\m@th\@ifnextchar[\@array{\@array[c]}%
}%
\def\@tabarray@ltx{%
\m@th\@ifnextchar[\@array{\expandafter\@array\expandafter[\array@default]}%
}%
\def\@tabarray@array{%
\@ifnextchar[{\@@array}{\@@array[c]}%
}%
\def\@tabarray@array@new{%
\@ifnextchar[{\@@array}{\expandafter\@@array\expandafter[\array@default]}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@tabularcr}
% \begin{macro}{\@tbpen}
% \begin{macro}{\@tabularcr}
% \begin{macro}{\@xtabularcr}
% \begin{macro}{\@xargarraycr}
% \begin{macro}{\@yargarraycr}
% \begin{macro}{\@arraycr}
% \begin{macro}{\@xarraycr}
% We provide for the \cmd\\ command within \env{tabular} to provide control over page breaking, just the same as
% that of \env{eqnarray}.
%
% The count register \cmd\intertabularlinepenalty\ is similar to \cmd\interdisplaylinepenalty: it is the penalty
% associated with each row of a tabular. When it is set to \cmd\@M, the tabular will cleave together.
%
% The count register \cmd\@tbpen\ is similar to \cmd\@eqpen: it memorizes the penalty to use after the current tabular row.
% If the \cmd\\ command is in its star form, then \cmd\@eqpen\ is set to \cmd\@M.
%
% We append code to \cmd\samepage\ so that a tabular within its scope will cleave together.
%
% We keep the standard definition of \cmd\@tabularcr\ in \cmd\@tabularcr@LaTeX\ for reference,
% and provide a new definition that works like \cmd\@eqncr: it sets \cmd\@tbpen\ to \cmd\@M\ if the star was given.
%
% We also provide new versions of \cmd\@xtabularcr, \cmd\@xargarraycr, and \cmd\@yargarraycr, all of which invoke \cmd\@tbpen.
%
% The \cmd\switch@tabular\ procedure switches in the new definitions.
% \begin{macrocode}
\newcount\intertabularlinepenalty
\intertabularlinepenalty=100
\newcount\@tbpen
\appdef\samepage{\intertabularlinepenalty\@M}%
\def\@tabularcr@LaTeX{{\ifnum 0=`}\fi \@ifstar \@xtabularcr \@xtabularcr}%
\def\@tabularcr@ltx{{\ifnum 0=`}\fi \@ifstar {\global \@tbpen \@M \@xtabularcr }{\global \@tbpen \intertabularlinepenalty \@xtabularcr }}%
\def\@xtabularcr@LaTeX{\@ifnextchar [\@argtabularcr {\ifnum 0=`{\fi }\cr }}%
\def\@xtabularcr@ltx{\@ifnextchar [\@argtabularcr {\ifnum 0=`{\fi }\cr \noalign {\penalty \@tbpen }}}%
\def\@xargarraycr@LaTeX#1{\@tempdima #1\advance \@tempdima \dp \@arstrutbox \vrule \@height \z@ \@depth \@tempdima \@width \z@ \cr}%
\def\@xargarraycr@ltx#1{\@tempdima #1\advance \@tempdima \dp \@arstrutbox \vrule \@height \z@ \@depth \@tempdima \@width \z@ \cr \noalign {\penalty \@tbpen }}%
\def\@yargarraycr@LaTeX#1{\cr \noalign {\vskip #1}}%
\def\@yargarraycr@ltx#1{\cr \noalign {\penalty \@tbpen \vskip #1}}%
% \end{macrocode}
%
% If the \classname{array} package has been loaded, we must alter the meanings of
% \cmd\@arraycr, \cmd\@xarraycr, \cmd\@xargarraycr, and \cmd\@yargarraycr.
% In this case, it is \cmd\switch@array\ that switches in the new definitions.
% \begin{macrocode}
\def\@arraycr@array{%
\relax
\iffalse{\fi\ifnum 0=`}\fi
\@ifstar \@xarraycr \@xarraycr
}%
\def\@arraycr@new{%
\relax
\iffalse{\fi\ifnum 0=`}\fi
\@ifstar {\global \@tbpen \@M \@xarraycr }{\global \@tbpen \intertabularlinepenalty \@xarraycr }%
}%
\def\@xarraycr@array{%
\@ifnextchar [%]
\@argarraycr {\ifnum 0=`{}\fi\cr}%
}%
\def\@xarraycr@new{%
\@ifnextchar [%]
\@argarraycr {\ifnum 0=`{}\fi\cr \noalign {\penalty \@tbpen }}%
}%
\def\@xargarraycr@array#1{%
\unskip
\@tempdima #1\advance\@tempdima \dp\@arstrutbox
\vrule \@depth\@tempdima \@width\z@
\cr
}%
\def\@xargarraycr@new#1{%
\unskip
\@tempdima #1\advance\@tempdima \dp\@arstrutbox
\vrule \@depth\@tempdima \@width\z@
\cr
\noalign {\penalty \@tbpen }%
}%
\def\@yargarraycr@array#1{%
\cr
\noalign{\vskip #1}%
}%
\def\@yargarraycr@new#1{%
\cr
\noalign{\penalty \@tbpen \vskip #1}%
}%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\array}
% We provide old and new versions of the \cmd\array\ procedure for both \LaTeX\ and the \classname{array} package.
% The change here is to accomodate the new procedures that will be called for the array boundaries, even
% though at present they are not special.
% A thought: here is where matrices can be readily accomodated.
% \begin{macrocode}
\def\array@LaTeX{%
\let\@acol\@arrayacol
\let\@classz\@arrayclassz
\let\@classiv\@arrayclassiv
\let\\\@arraycr
\let\@halignto\@empty
\@tabarray
}%
\def\array@ltx{%
\@ifmmode{}{\@badmath$}%
\let\@acoll\@arrayacol
\let\@acolr\@arrayacol
\let\@acol\@arrayacol
\let\@classz\@arrayclassz
\let\@classiv\@arrayclassiv
\let\\\@arraycr
\let\@halignto\@empty
\@tabarray
}%
\def\array@array{%
\col@sep\arraycolsep
\def\d@llarbegin{$}\let\d@llarend\d@llarbegin\gdef\@halignto{}%
\@tabarray
}
\def\array@array@new{%
\@ifmmode{}{\@badmath$}%
\let\@acoll\@arrayacol
\let\@acolr\@arrayacol
\let\@acol\@arrayacol
\let\col@sep\@undefined
\def\d@llarbegin{$}%
\let\d@llarend\d@llarbegin
\gdef\@halignto{}%
\@tabarray
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@array}
% Here we provide old and new versions of \cmd\@array.
% The change here is to provide a convenient, flexible, and extensible
% mechanism for new vertical alignment options.
%
% Instead of testing the optional argument with \cmd\if, we
% use a dispatcher based on \cmd\csname.
%
% We also refrain from using \cmd\ialign, which would set
% the \cmd\tabskip\ to the wrong value.
%
% Finally, the procedure to set the \cmd\@arstrutbox\
% is broken out so that it can be patched.
% \begin{macrocode}
\def\@array@LaTeX[#1]#2{%
\if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi
\bgroup
\setbox\@arstrutbox\hbox{%
\vrule \@height\arraystretch\ht\strutbox
\@depth\arraystretch \dp\strutbox
\@width\z@}%
\@mkpream{#2}%
\edef\@preamble{%
\ialign \noexpand\@halignto
\bgroup \@arstrut \@preamble \tabskip\z@skip \cr}%
\let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
\let\tabularnewline\\%
\let\par\@empty
\let\@sharp##%
\set@typeset@protect
\lineskip\z@skip\baselineskip\z@skip
\ifhmode \@preamerr\z@ \@@par\fi
\@preamble
}%
\def\@array@ltx[#1]#2{%
\@nameuse{@array@align@#1}%
\set@arstrutbox
\@mkpream{#2}%
\prepdef\@preamble{%
\tabskip\tabmid@skip
\@arstrut
}%
\appdef\@preamble{%
\tabskip\tabright@skip
\cr
\array@row@pre
}%
% \let\@startpbox\@@startpbox
% \let\@endpbox\@@endpbox
\let\tabularnewline\\%
\let\par\@empty
\let\@sharp##%
\set@typeset@protect
\lineskip\z@skip\baselineskip\z@skip
\tabskip\tableft@skip\relax
\ifhmode \@preamerr\z@ \@@par\fi
\everycr{}%
\expandafter\halign\expandafter\@halignto\expandafter\bgroup\@preamble
}%
%
\def\set@arstrutbox{%
\setbox\@arstrutbox\hbox{%
\vrule \@height\arraystretch\ht\strutbox
\@depth\arraystretch \dp\strutbox
\@width\z@
}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@array@array}
%
% \begin{macrocode}
\def\@array@array[#1]#2{%
\@tempdima \ht \strutbox
\advance \@tempdima by\extrarowheight
\setbox \@arstrutbox \hbox{\vrule
\@height \arraystretch \@tempdima
\@depth \arraystretch \dp \strutbox
\@width \z@}%
\begingroup
\@mkpream{#2}%
\xdef\@preamble{\noexpand \ialign \@halignto
\bgroup \@arstrut \@preamble
\tabskip \z@ \cr}%
\endgroup
\@arrayleft
\if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
\bgroup
\let \@sharp ##\let \protect \relax
\lineskip \z@
\baselineskip \z@
\m@th
\let\\\@arraycr \let\tabularnewline\\\let\par\@empty \@preamble
}%
\def\@array@array@new[#1]#2{%
\@tempdima\ht\strutbox
\advance\@tempdima by\extrarowheight
\setbox\@arstrutbox\hbox{%
\vrule \@height\arraystretch\@tempdima
\@depth \arraystretch\dp\strutbox
\@width \z@
}%
\begingroup
\@mkpream{#2}%
\xdef\@preamble{\@preamble}%
\endgroup
\prepdef\@preamble{%
\tabskip\tabmid@skip
\@arstrut
}%
\appdef\@preamble{%
\tabskip\tabright@skip
\cr
\array@row@pre
}%
\@arrayleft
\@nameuse{@array@align@#1}%
\m@th
\let\\\@arraycr
\let\tabularnewline\\%
\let\par\@empty
\let\@sharp##%
\set@typeset@protect
\lineskip\z@\baselineskip\z@
\tabskip\tableft@skip
\everycr{}%
\expandafter\halign\expandafter\@halignto\expandafter\bgroup\@preamble
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\endarray}
% Here we provide old and new versions of \cmd\endarray.
% The change here is to use a single procedure to close
% out any array-like structure, namely \cmd\endarray@ltx.
% It merely closes out the \cmd\halign.
% \begin{macrocode}
\def\endarray@LaTeX{%
\crcr\egroup\egroup
}%
\def\endarray@ltx{%
\crcr\array@row@pst\egroup\egroup
}%
\def\endarray@array{%
\crcr \egroup \egroup \@arrayright \gdef\@preamble{}%
}%
\def\endarray@array@new{%
\crcr\array@row@pst\egroup\egroup % Same as \endarray@ltx
\@arrayright
\global\let\@preamble\@empty
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\endtabular}
%
% \begin{macrocode}
\def\endtabular@LaTeX{%
\crcr\egroup\egroup $\egroup
}%
\def\endtabular@ltx{%
\endarray
}%
\def\endtabular@array{%
\endarray $\egroup
}%
\def\endtabular@array@new{%
\endarray
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{endtabular*}
% Here we provide a proper definition for the star-form of \enve{endtabular}.
% It is one of the enduring curiosities that the \LaTeX\ kernel continues to use
% dangerously and inappropriately ``optimized'' definitions for such commands.
% \begin{macrocode}
\@namedef{endtabular*}{\endtabular}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\multicolumn}
%
% \begin{macrocode}
\long\def\multicolumn@LaTeX#1#2#3{%
\multispan{#1}\begingroup
\@mkpream{#2}%
\def\@sharp{#3}\set@typeset@protect
\let\@startpbox\@@startpbox\let\@endpbox\@@endpbox
\@arstrut \@preamble\hbox{}\endgroup\ignorespaces
}%
\long\def\multicolumn@ltx#1#2#3{%
\multispan{#1}%
\begingroup
\@mkpream{#2}%
\def\@sharp{#3}%
\set@typeset@protect
%\let\@startpbox\@@startpbox\let\@endpbox\@@endpbox
\@arstrut
\@preamble
\hbox{}%
\endgroup
\ignorespaces
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@array@align@}
% \begin{macro}{\array@default}
% Here are the various procedures for the vertical alignment options.
% The change from standard \LaTeX\ is that we do not go into math mode
% in every case: only when required by \cmd\vcenter.
% Also, we use \cmd\aftergroup\ to close out the boxes and modes we have started.
% It requires only that each procedure issue exactly one unmatched \cmd\bgroup.
%
% We establish here the default vertical alignment.
% \begin{macrocode}
\def\@array@align@t{\leavevmode\vtop\bgroup}%
\def\@array@align@b{\leavevmode\vbox\bgroup}%
\def\@array@align@c{\leavevmode\@ifmmode{\vcenter\bgroup}{$\vcenter\bgroup\aftergroup$\aftergroup\relax}}%
\def\@array@align@v{%
\@ifmmode{%
\@badmath
\vcenter\bgroup
}{%
\@ifinner{%
$\vcenter\bgroup\aftergroup$
}{%
\@@par\bgroup
}%
}%
}%
\def\array@default{c}%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\array@row@pre}
% \begin{macro}{\array@row@pst}
% \begin{macro}{\array@row@rst}
% The procedure \cmd\array@row@rst\ reestablishes a default context for
% an alignment, so that they can be nested.
% Any environment or procedure that alters the way alignments are formatted
% must patch this procedure to restore from that alteration.
% To start things off, we equate \cmd\@array@align@v\ to \cmd\@array@align@c,
% because it does not make sense to do the former in any context other
% than the MVL or in a list that will be unboxed onto the MVL.
% \begin{macrocode}
\def\array@row@rst{%
\let\@array@align@v\@array@align@c
}%
\def\array@row@pre{}%
\def\array@row@pst{}%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\toprule}
% \begin{macro}{\colrule}
% \begin{macro}{\botrule}
% Default definitions for \cmd\toprule, \cmd\colrule, \cmd\botrule
% \begin{macrocode}
\newcommand\toprule{\tab@rule{\column@font}{\column@fil}{\frstrut}}%
\newcommand\colrule{\unskip\lrstrut\\\tab@rule{\body@font}{}{\frstrut}}%
\newcommand\botrule{\unskip\lrstrut\\\noalign{\hline@rule}{}}%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\hline}
% \begin{macrocode}
\def\hline@LaTeX{%
\noalign{\ifnum0=`}\fi\hrule \@height \arrayrulewidth \futurelet
\reserved@a\@xhline
}%
\def\hline@ltx{%
\noalign{%
\ifnum0=`}\fi
\hline@rule
\futurelet\reserved@a\@xhline
% \noalign ended in \@xhline
}%
\def\@xhline@unneeded{%
\say\reserved@a
\ifx\reserved@a\hline
\vskip\doublerulesep
\vskip-\arrayrulewidth
\fi
\ifnum0=`{\fi}%
}%
\def\tab@rule#1#2#3{%
\crcr
\noalign{%
\hline@rule
\gdef\@arstrut@hook{%
\global\let\@arstrut@hook\@empty
#3%
}%
\gdef\cell@font{#1}%
\gdef\cell@fil{#2}%
}%
}%
\def\column@font{}%
\def\column@fil{}%
\def\body@font{}%
\def\cell@font{}%
\def\frstrut{}%
\def\lrstrut{}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@arstrut@hline}
% \begin{macro}{\@arstrut@org}
% \begin{macro}{\@arstrut@hook}
% \begin{macro}{\@arstrutbox@hline}
% \begin{macro}{\set@arstrutbox}
% \begin{macro}{\hline@rule}
% The procedure \cmd\@arstrut@hline\ is substantially the same as
% \cmd\@arstrut, except the strut copied in is \cmd\@arstrutbox@hline
% instead of \cmd\@arstrutbox.
%
% The procedure \cmd\@arstrut@hook\ is redefined in \cmd\tab@rule!
%
% The register \cmd\@arstrutbox@hline.
%
% We append to \cmd\set@arstrutbox\ the code necessary to set a strut following an \cmd\hline.
%
% The procedure \cmd\hline@rule\ lays down a rule, and changes the meaning of \cmd\@arstrut\
% so that the next line will be correctly strutted.
%
% The \cmd\@arstrut@hline@clnc\ is a klootch, a magic number.
% \begin{macrocode}
\def\@arstrut@hline{%
\relax
\@ifmmode{\copy}{\unhcopy}\@arstrutbox@hline
\@arstrut@hook
}%
%
\let\@arstrut@org\@arstrut
\def\@arstrut@hook{%
\global\let\@arstrut\@arstrut@org
}%
%
\newbox\@arstrutbox@hline
\appdef\set@arstrutbox{%
\setbox\@arstrutbox@hline\hbox{%
\setbox\z@\hbox{$0^{0}_{}$}%
\dimen@\ht\z@\advance\dimen@\@arstrut@hline@clnc
\@ifdim{\dimen@<\arraystretch\ht\strutbox}{\dimen@=\arraystretch\ht\strutbox}{}%
\vrule \@height\dimen@
\@depth\arraystretch \dp\strutbox
\@width\z@
}%
}%
%
\def\hline@rule{%
\hrule \@height \arrayrulewidth
\global\let\@arstrut\@arstrut@hline
}%
\def\@arstrut@hline@clnc{2\p@}% % Klootch: magic number
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\tableft@skip}
% \begin{macrocode}
\def\tableft@skip{\z@skip}%
\def\tabmid@skip{\z@skip}%\@flushglue
\def\tabright@skip{\z@skip}%
\def\tableftsep{\tabcolsep}%
\def\tabmidsep{\tabcolsep}%
\def\tabrightsep{\tabcolsep}%
\def\cell@fil{}%
\def\pbox@hook{}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@arstrut}
% \begin{macrocode}
\appdef\@arstrut{\@arstrut@hook}%
\let\@arstrut@hook\@empty
\def\@addtopreamble{\appdef\@preamble}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@mkpream}
% \begin{macrocode}
\def\@mkpream@LaTeX#1{%
\@firstamptrue\@lastchclass6
\let\@preamble\@empty
\let\protect\@unexpandable@protect
\let\@sharp\relax
\let\@startpbox\relax\let\@endpbox\relax
\@expast{#1}%
\expandafter\@tfor \expandafter
\@nextchar \expandafter:\expandafter=\reserved@a\do
{\@testpach\@nextchar
\ifcase \@chclass \@classz \or \@classi \or \@classii \or \@classiii
\or \@classiv \or\@classv \fi\@lastchclass\@chclass}%
\ifcase \@lastchclass \@acol
\or \or \@preamerr \@ne\or \@preamerr \tw@\or \or \@acol \fi
}%
\def\@mkpream@ltx#1{%
\@firstamptrue
\@lastchclass6
\let\@preamble\@empty
\let\protect\@unexpandable@protect
\let\@sharp\relax
%\let\@startpbox\relax\let\@endpbox\relax
\@expast{#1}%
\expandafter\@tfor\expandafter\@nextchar\expandafter:\expandafter=\reserved@a
\do{%
\expandafter\@testpach\expandafter{\@nextchar}%
\ifcase\@chclass
\@classz
\or
\@classi
\or
\@classii
\or
\@classiii
\or
\@classiv
\or
\@classv
\fi
\@lastchclass\@chclass
}%
\ifcase\@lastchclass
\@acolr % right-hand column
\or
\or
\@preamerr\@ne
\or
\@preamerr\tw@
\or
\or
\@acolr % right-hand column
\fi
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\insert@column}
% \begin{macrocode}
\def\insert@column@array{%
\the@toks \the \@tempcnta
\ignorespaces \@sharp \unskip
\the@toks \the \count@ \relax
}%
\def\insert@column@array@new{%
\the@toks\the\@tempcnta
\array@row@rst\cell@font
\ignorespaces\@sharp\unskip
\the@toks\the\count@
\relax
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@mkpream@relax}
% The procedure \cmd\@mkpream@relax\ participates in a strange and wonderful
% method of binding the alignment procedure---but only certain parts thereof.
%
% Here is how it works: in \LaTeX, the \classname{array} package, and in the
% \classname{longtable} package alike, there is a need to create an alignment
% preamble (using \cmd\@mkpream) for use by the upcoming \cmd\halign.
% Then, in both \classname{array} and \classname{longtable}, \TeX's \cmd\edef\
% is used to `compile in place' that alignment preamble.
%
% In the case of \classname{array}, the operation is done in order to
% pre-expand the use of \texttt{*}, in \classname{longtable}, it is to
% set the widths of the columns.
%
% Now, during this \cmd\edef, certain control sequence names must \emph{not}
% be expanded, and those are robustified by \cmd\@mkpream@relax.
%
% \begin{macrocode}
\def\@mkpream@relax{%
\let\tableftsep\relax
\let\tabmidsep\relax
\let\tabrightsep\relax
\let\array@row@rst\relax
\let\cell@font\relax
\let\@startpbox\relax
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@mkpream}
% \begin{macrocode}
\def\@mkpream@array#1{%
\gdef\@preamble{}\@lastchclass 4 \@firstamptrue
\let\@sharp\relax \let\@startpbox\relax \let\@endpbox\relax
\@temptokena{#1}\@tempswatrue
\@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}%
\count@\m@ne
\let\the@toks\relax
\prepnext@tok
\expandafter \@tfor \expandafter \@nextchar
\expandafter :\expandafter =\the\@temptokena \do
{\@testpach
\ifcase \@chclass \@classz \or \@classi \or \@classii
\or \save@decl \or \or \@classv \or \@classvi
\or \@classvii \or \@classviii
\or \@classx
\or \@classx \fi
\@lastchclass\@chclass}%
\ifcase\@lastchclass
\@acol \or
\or
\@acol \or
\@preamerr \thr@@ \or
\@preamerr \tw@ \@addtopreamble\@sharp \or
\or
\else \@preamerr \@ne \fi
\def\the@toks{\the\toks}%
}%
\def\@mkpream@array@new#1{%
\gdef\@preamble{}%
\@lastchclass\f@ur
\@firstamptrue
\let\@sharp\relax
\@mkpream@relax
%\let\@startpbox\relax\let\@endpbox\relax
\@temptokena{#1}\@tempswatrue
\@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}%
\count@\m@ne
\let\the@toks\relax
\prepnext@tok
\expandafter\@tfor\expandafter\@nextchar\expandafter:\expandafter=\the\@temptokena
\do{%
\@testpach
\ifcase\@chclass
\@classz
\or
\@classi
\or
\@classii
\or
\save@decl
\or
\or
\@classv
\or
\@classvi
\or
\@classvii
\or
\@classviii
\or
\@classx
\or
\@classx
\fi
\@lastchclass\@chclass
}%
\ifcase\@lastchclass
\@acolr % right-hand column
\or
\or
\@acolr % right-hand column
\or
\@preamerr\thr@@
\or
\@preamerr\tw@\@addtopreamble\@sharp
\or
\or
\else
\@preamerr\@ne
\fi
\def\the@toks{\the\toks}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@addamp}
% \begin{macrocode}
\def\@addamp@LaTeX{%
\if@firstamp\@firstampfalse\else\edef\@preamble{\@preamble &}\fi
}%
\def\@addamp@ltx{%
\if@firstamp\@firstampfalse\else\@addtopreamble{&}\fi
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@arrayacol}
% \begin{macrocode}
\def\@arrayacol@LaTeX{%
\edef\@preamble{\@preamble \hskip \arraycolsep}%
}%
\def\@arrayacol@ltx{%
\@addtopreamble{\hskip\arraycolsep}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@tabacol}
% \begin{macrocode}
\def\@tabacoll{%
\@addtopreamble{\hskip\tableftsep\relax}%
}%
\def\@tabacol@LaTeX{%
\edef\@preamble{\@preamble \hskip \tabcolsep}%
}%
\def\@tabacol@ltx{%
\@addtopreamble{\hskip\tabmidsep\relax}%
}%
\def\@tabacolr{%
\@addtopreamble{\hskip\tabrightsep\relax}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@arrayclassz}
% \begin{macrocode}
\def\@arrayclassz@LaTeX{%
\ifcase \@lastchclass \@acolampacol \or \@ampacol \or
\or \or \@addamp \or
\@acolampacol \or \@firstampfalse \@acol \fi
\edef\@preamble{\@preamble
\ifcase \@chnum
\hfil$\relax\@sharp$\hfil \or $\relax\@sharp$\hfil
\or \hfil$\relax\@sharp$\fi}%
}%
\def\@arrayclassz@ltx{%
\ifcase\@lastchclass
\@acolampacol
\or
\@ampacol
\or
\or
\or
\@addamp
\or
\@acolampacol
\or
\@firstampfalse\@acoll
\fi
\ifcase\@chnum
\@addtopreamble{%
\hfil\array@row@rst$\relax\@sharp$\hfil
}%
\or
\@addtopreamble{%
\array@row@rst$\relax\@sharp$\hfil
}%
\or
\@addtopreamble{%
\hfil\array@row@rst$\relax\@sharp$%
}%
\fi
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@tabclassz}
% \begin{macrocode}
\def\@tabclassz@LaTeX{%
\ifcase\@lastchclass
\@acolampacol
\or
\@ampacol
\or
\or
\or
\@addamp
\or
\@acolampacol
\or
\@firstampfalse\@acol
\fi
\edef\@preamble{%
\@preamble{%
\ifcase\@chnum
\hfil\ignorespaces\@sharp\unskip\hfil
\or
\hskip1sp\ignorespaces\@sharp\unskip\hfil
\or
\hfil\hskip1sp\ignorespaces\@sharp\unskip
\fi}}%
}%
\def\@tabclassz@ltx{%
\ifcase\@lastchclass
\@acolampacol
\or
\@ampacol
\or
\or
\or
\@addamp
\or
\@acolampacol
\or
\@firstampfalse\@acoll
\fi
\ifcase\@chnum
\@addtopreamble{%
{\hfil\array@row@rst\cell@font\ignorespaces\@sharp\unskip\hfil}%
}%
\or
\@addtopreamble{%
{\cell@fil\hskip1sp\array@row@rst\cell@font\ignorespaces\@sharp\unskip\hfil}%
}%
\or
\@addtopreamble{%
{\hfil\hskip1sp\array@row@rst\cell@font\ignorespaces\@sharp\unskip\cell@fil}%
}%
\fi
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@tabclassiv}
% \begin{macrocode}
\def\@tabclassiv@LaTeX{%
\@addtopreamble\@nextchar
}%
\def\@tabclassiv@ltx{%
\expandafter\@addtopreamble\expandafter{\@nextchar}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@arrayclassiv}
% \begin{macrocode}
\def\@arrayclassiv@LaTeX{%
\@addtopreamble{$\@nextchar$}%
}%
\def\@arrayclassiv@ltx{%
\expandafter\@addtopreamble\expandafter{\expandafter$\@nextchar$}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@classv}
% \begin{macrocode}
\def\@classv@LaTeX{%
\@addtopreamble{\@startpbox{\@nextchar}\ignorespaces
\@sharp\@endpbox}%
}%
\def\@classv@ltx{%
\expandafter\@addtopreamble
\expandafter{%
\expandafter \@startpbox
\expandafter {\@nextchar}%
\pbox@hook\array@row@rst\cell@font\ignorespaces\@sharp\@endpbox
}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@classx}
% \begin{macrocode}
\def\@classx@array{%
\ifcase \@lastchclass
\@acolampacol \or
\@addamp \@acol \or
\@acolampacol \or
\or
\@acol \@firstampfalse \or
\@addamp
\fi
}%
\def\@classx@array@new{%
\ifcase \@lastchclass
\@acolampacol
\or
\@addamp \@acol
\or
\@acolampacol
\or
\or
\@firstampfalse\@acoll
\or
\@addamp
\fi
}%
% \end{macrocode}
% \end{macro}
%
%
% \subsection{Repair other broken parts of \LaTeX}
%
% \begin{macro}{\@xbitor}
% Expansion part has extraneous space token. Removed.
% \begin{macrocode}
\def\@xbitor@LaTeX #1{\@tempcntb \count#1
\ifnum \@tempcnta =\z@
\else
\divide\@tempcntb\@tempcnta
\ifodd\@tempcntb \@testtrue\fi
\fi}%
\def\@xbitor@ltx#1{%
\@tempcntb\count#1%
\@ifnum{\@tempcnta=\z@}{}{%
\divide\@tempcntb\@tempcnta
\@ifodd\@tempcntb{\@testtrue}{}%
}%
}%
\@ifx{\@xbitor\@xbitor@LaTeX}{%
\class@info{Repairing broken LaTeX \string\@xbitor}%
}{%
\class@info{Unrecognized LaTeX \string\@xbitor. Please update this document class! (Proceeding with fingers crossed.)}%
}%
\let\@xbitor\@xbitor@ltx
% \end{macrocode}
% \end{macro}
%
%
% \subsection{Syntax}
% \begin{macro}{\@gobble@opt@one}
% The \cmd\@gobble@opt@one\ command eats up an optional argument
% and one required argument.
% \begin{macrocode}
\newcommand*\@gobble@opt@one[2][]{}%
% \end{macrocode}
% \end{macro}
%
% \subsection{Auto-indented Contents}
% Facility to automatically determine the proper indentation of
% the TOC entries.
%
% Note on \classname{hyperref} compatibility:
% We must respect that
% \cmd\contentsline now has a 4th argument.
% So, instead of trying to override the meaning of \cmd\contentsline,
% we use the aux file to remember max values from one run to the next.
%
% In this respect, this package retains compatability with
% \classname{hyperref}.
%
% \begin{macro}{\@starttoc}
% Install hooks at beginning and end of the TOC processing.
% \begin{macrocode}
\def\@starttoc#1{%
\begingroup
\toc@pre
\makeatletter
\@input{\jobname.#1}%
\if@filesw
\expandafter\newwrite\csname tf@#1\endcsname
\immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
\fi
\@nobreakfalse
\toc@post
\endgroup
}%
\def\toc@pre{}%
\def\toc@post{}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\toc@@font}
% Interface for setting the formatting characteristics of this part
% of the TOC.
%
% Note: \cmd\toc@@font\ is the common font for all auto-sizing toc commands,
% although this, too, could become a dispatcher.
% \begin{macrocode}
\def\toc@@font{}%{\footnotesize\rmfamily}%
\def\@dotsep{\z@}%{5.5pt}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\l@section}
% Interface for determining which TOC elements are automatically indented.
%
% All of the \cmd\l@\dots\ commands simply go through the
% bottleproc \cmd\l@@sections. The calling convention is
% to pass the name of self and the name of parent.
% If you want to exclude any of these from the indentation
% scheme, simply leave the \cmd\l@\dots\ command undefined.
%
% Note that the parent of ``section'' is nil, so we have to
% define a stub.
% \begin{verbatim}
%\def\l@section{%
% \l@@sections{}{section}% Implicit #3#4
%}%
%\def\tocleft@{\z@}%
%\def\l@subsection{%
% \l@@sections{section}{subsection}% Implicit #3#4
%}%
%\def\l@subsubsection{%
% \l@@sections{subsection}{subsubsection}% Implicit #3#4
%}%
%\def\l@paragraph{%
% \l@@sections{subsubsection}{paragraph}% Implicit #3#4
%}%
%\def\l@subparagraph#1#2{%
% \l@@sections{paragraph}{subparagraph}% Implicit #3#4
%}%
% \end{verbatim}
% \end{macro}
%
% Glom some \cmd\dimen\ registers.
% \begin{macrocode}
\let\tocdim@section \leftmargini
\let\tocdim@subsection \leftmarginii
\let\tocdim@subsubsection \leftmarginiii
\let\tocdim@paragraph \leftmarginiv
\let\tocdim@appendix \leftmarginv
\let\tocdim@pagenum \leftmarginvi
% \end{macrocode}
%
% \begin{macro}{\toc@pre@auto}
% \begin{macro}{\toc@post@auto}
% We patch \cmd\@starttoc\ to:
% 1) before TOC processing,
% initialize the max registers and
% set the needed dimensions from
% the values stored in the auxiliary file, and
% 2) after TOC processing,
% store out those max register values into the auxiliary file.
%
% Note that the font is set here: all other TOC entries must
% override these font settings.
%
% To activate this override of the standard \LaTeX\ processing,
% the substyle does: \cmd\let\cmd\toc@pre\cmd\toc@pre@auto\
% and \cmd\let\cmd\toc@post\cmd\toc@post@auto.
% \begin{macrocode}
\def\toc@pre@auto{%
\toc@@font
\@tempdima\z@
\toc@setindent\@tempdima{section}%
\toc@setindent\@tempdima{subsection}%
\toc@setindent\@tempdima{subsubsection}%
\toc@setindent\@tempdima{paragraph}%
\toc@letdimen{appendix}%
\toc@letdimen{pagenum}%
}%
\def\toc@post@auto{%
\if@filesw
\begingroup
\toc@writedimen{section}%
\toc@writedimen{subsection}%
\toc@writedimen{subsubsection}%
\toc@writedimen{paragraph}%
\toc@writedimen{appendix}%
\toc@writedimen{pagenum}%
\endgroup
\fi
}%
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\toc@setindent}
% \begin{macrocode}
\def\toc@setindent#1#2{%
\csname tocdim@#2\endcsname\tocdim@min\relax
\@ifundefined{tocmax@#2}{\@namedef{tocmax@#2}{\z@}}{}%
\advance#1\@nameuse{tocmax@#2}\relax
\expandafter\edef\csname tocleft@#2\endcsname{\the#1}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\toc@letdimen}
% \begin{macrocode}
\def\toc@letdimen#1{%
\csname tocdim@#1\endcsname\tocdim@min\relax
\@ifundefined{tocmax@#1}{\@namedef{tocmax@#1}{\z@}}{}%
\expandafter\let\csname tocleft@#1\expandafter\endcsname\csname tocmax@#1\endcsname
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\toc@writedimen}
% \begin{macrocode}
\def\toc@writedimen#1{%
\immediate\write\@auxout{%
\gdef\expandafter\string\csname tocmax@#1\endcsname{%
\expandafter\the\csname tocdim@#1\endcsname
}%
}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\l@@sections}
% The procedure for formatting the indented TOC entries.
% We use control sequence names such as \cmd\tocmax@section\ and
% \cmd\tocleft@section, the former being written to the auxiliary file
% and the latter only defined for the duration of the TOC processing.
%
% Note that the assignment of \cmd\box\cmd\z@\ must endure
% over the invocation of |#3|.
% \begin{macrocode}
\def\l@@sections#1#2#3#4{%
% #1 - superior section
% #2 - this section
% #3 - content, including possible \numberline
% #4 - page number
\begingroup
\everypar{}%
\set@tocdim@pagenum{#4}%
\global\@tempdima\csname tocdim@#2\endcsname
\leftskip\csname tocleft@#2\endcsname\relax
\dimen@\csname tocleft@#1\endcsname\relax
\parindent-\leftskip\advance\parindent\dimen@
\rightskip\tocleft@pagenum plus 1fil\relax
\skip@\parfillskip\parfillskip\z@
\let\numberline\numberline@@sections
\@nameuse{l@f@#2}%
\ignorespaces#3\unskip\nobreak\hskip\skip@
\hb@xt@\rightskip{\hfil\unhbox\@tempboxa}\hskip-\rightskip\hskip\z@skip
\par
\expandafter\aftergroup\csname tocdim@#2\endcsname\expandafter
\endgroup\the\@tempdima\relax
}%
\def\set@tocdim@pagenum#1{%
\setbox\@tempboxa\hbox{\ignorespaces#1}%
\@ifdim{\tocdim@pagenum<\wd\z@}{\global\tocdim@pagenum\wd\z@}{}%
}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\numberline@@sections}
% The bottleproc for all \cmd\numberline\ processing in indented TOC entries.
% The first argument is self.
%
% We use \cmd\@tempdima\ to pass a value around (via global assignment) because
% \cmd\numberline\ executes inside a group if the
% \classname{hyperref} package is loaded.
% Would that it were not so!
% \begin{macrocode}
\def\numberline@@sections#1{%
\leavevmode\hb@xt@-\parindent{%
\hfil
\@if@empty{#1}{}{%
\setbox\z@\hbox{#1.\kern\@dotsep}%
\@ifdim{\@tempdima<\wd\z@}{\global\@tempdima\wd\z@}{}%
\unhbox\z@
}%
}%
\ignorespaces
}%
\def\tocdim@min{\z@}%
% \end{macrocode}
% \end{macro}
%
%
% \subsection{Lists}
% \begin{macro}{\list}
% Using \cmd\parshape\ to implement lists was always suspect
% (can you get behind \cmd\parshape\cmd\@ne?) and we now see that
% it was a mistake all along. Why? Because \cmd\parshape, like
% \cmd\hangindent, achieves its effect via ``shifting'' the \cmd\hbox es
% in a paragraph
% instead of using \cmd\leftskip\ and \cmd\parindent, which is
% robust during column balancing.
%
% We introduce the alternative method with a hook into
% the \LaTeX\ kernel procedure \cmd\list, which is
% the implementation of all lists.
%
% \begin{macrocode}
\def\list#1#2{%
\ifnum \@listdepth >5\relax
\@toodeep
\else
\global\advance\@listdepth\@ne
\fi
\rightmargin\z@
\listparindent\z@
\itemindent\z@
\csname @list\romannumeral\the\@listdepth\endcsname
\def\@itemlabel{#1}%
\let\makelabel\@mklab
\@nmbrlistfalse
#2\relax
\@trivlist
\parskip\parsep
\set@listindent
\ignorespaces
}%
\def\set@listindent@parshape{%
\parindent\listparindent
\advance\@totalleftmargin\leftmargin
\advance\linewidth-\rightmargin
\advance\linewidth-\leftmargin
\parshape\@ne\@totalleftmargin\linewidth
}%
\def\set@listindent@{%
\parindent\listparindent
\advance\@totalleftmargin\leftmargin
\advance\rightskip\rightmargin
\advance\leftskip\@totalleftmargin
}%
\let\set@listindent\set@listindent@parshape
% \end{macrocode}
% \end{macro}
%
% \subsection{End of the \file{ltxutil} {\sc docstrip} module}
% Here ends the module.
% \begin{macrocode}
%</ltxutil-krn>
% \end{macrocode}
%
%
% \Finale
% %Here ends the programmer's documentation.
% \endinput
%
\endinput
%%EOF
|