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
|
\part The Style Files\label{SFPART}\endpart
\begingroup
\newword\chapter{}
\chapter""Introduction\endchapter
*lamstex.tex* provides default treatments for all the main
\lamstex\ constructions,
while *lamstex.stf* and *lamstex.stb*
provide default treatments for front matter and back matter constructions.
In some styles, some of these constructions are a little more complicated,
or have to be combined in different ways;
and
certain features, like running heads, haven't yet been considered
at all.
So in this Part we discuss the standard \lamstex\
style files, although in a somewhat more perfunctory manner than the
treatment of previous Parts.
As usual (compare section~\Sref{GENDEFS}), we will be using double horizontal
lines for code from these files.
\endgroup
\chapter The {\tt paper} style\endchapter
The file *paper.st* begins
\CC**
\catcode`\@=11
**
to allow us to access and create private control sequences,
followed by
\CC**
\ifx\paperst@\relax\catcode`\@=\active
\endinput\else\let\paperst@=\relax\fi
**
which prevents *paper.st* from being read in twice (compare
section~\Sref{AC}), a necessity because of the *\NameHL* commands
that occur later (we can't *\NameHL1\heading* twice, since that involves
*\define\heading* twice).\linebreak
Then we have
\CC**
\let\alloc@=\alloc@@
**
so that we can
create new
counters, etc., without having them written to the *.log* file
(compare page~\ref{NEWALLOC}).
\section{Basic settings}Next we set basic parameters that differ from
the default style:
\CC**
\hsize=30pc
\vsize=42pc
\parindent=1em
\normallineskiplimit=1pt
\advance\hoffset 48pt
\advance\voffset 78pt
**
*\hoffset* and *\voffset* are changed to center these
small pages within an 8\piecefrac12 $\times$ 11 inch piece of paper.
\section{Fonts and point sizes}
Since parts of the paper will be set in 8~point type, we first
have to introduce numerous extra fonts:
\CC**
\font@\ninerm=cmr9
\font@\eightrm=cmr8
\font@\sixrm=cmr6
\font@\eighti=cmmi8 \skewchar\eighti='177
\font@\sixi=cmmi6 \skewchar\sixi='177
\font@\ninesy=cmsy9 \skewchar\ninesy='60
. . .
**
\amstex's *\font@* is basically like the \tex\ primitive *\font*, except
that the font name is added to *\fontlist@* (see section~\Sref{LISTS}),
for use by \amstex's *\syntax* command.
The only slightly surprising things here are the *\ninerm* and *\ninesy*---%
they are needed only
because they are used fleetingly in the definition of *\big* for eight point
type (see below).
If the
additional AMS fonts have been loaded, using any of
**
\loadmsam
\loadmsbm
\loadeufm
**
then flags *\ifmsamloaded@*, *\ifmsbmloaded@*, and *\ifeufmloaded@*,
respectively, will have been set true. And if
**
\loadbold
**
was used to load *cmmib..* and *cmmbsy...* fonts, flags
*\ifcmmibloaded@* and *\ifcmbsyloaded@* will have been set true.
In each case, we should then load additional fonts for eight point:
\CC**
\ifmsamloaded@
\font@\eightmsa=msam8
\font@\sixmsa=msam6
\fi
"2
. . .
"2
\ifcmbsyloaded@
\font@\eightcmbsy=cmbsy8 \skewchar\eightcmbsy='60
\font@\sixcmbsy=cmbsy6 \skewchar\sixcmbsy='60
\fi
**
(If even more crazy families are to be loaded, like *eufb*, *eusm*,
*eusb*, *eurm*, *eurb*, further clauses will have to be added, but I couldn't
bear including them.)
Now we want to define *\tenpoint* and *\eightpoint*, following the basic
scheme used in Appendix~E of {\it The \tex book}.
For literal mode, we will want spaces to give different amounts of
glue in the two different point sizes, so we first declare a new glue
register,
\CC**
\newskip\ttglue@
**
A few macros need to know what point size is currently used,
so this information is kept in a control
sequence *\pointsize@*. Thus,
the definition of *\tenpoint* will be of the form:
\CC**
\def\tenpoint{\def\pointsize@{10}%
. . .
}
**
After *\pointsize@* is defined,
*\normalbaselineskip* is set to~*12pt* (at the end of the definition,
*\normalbaselines* will be stated, which actually sets *\baselineskip* to this
value); on the other hand,
*\normallineskip* and *\normallineskiplimit* will each have the
value~*1pt* for both 10~point and 8~point type.
Then values of *\abovedisplayskip*, \dots, for the spacing above and below
displayed formulas are set.
Next we use
**
\textonlyfont@\rm\tenrm
. . .
\textonlyfont@\bf\tenbf
**
so that *\rm* means *\tenrm* in 10~point type, etc. \amstex's
*\textonlyfont@* construction means that *\rm*, \dots, will give error
messages if used in math mode. (However, if the file *pcompat.tex*
has
been *\input*, and *\plainfonts* has been specified,
then *\textonlyfont@* will be redefined so that *\rm*, \dots, will
function exactly as in *plain* \tex@.)
Next we have to set up the families for math fonts,
and then\linebreak *\let\big=\tenbig@*, which is defined separately,
since *\big* is different for 10~point type and
8~point type (following Appendix~E, however, *\bigg*, \dots, are kept
the same).
If the user has typed *\syntax*, so that *\ifsyntax@* is true,
then we might as well skip all these font assignments, and we can give
*\big* a simpler definition, in which the actual size used is irrelevant,
**
\ifsyntax@
\def\big##1{{\hbox{$\left##1\right.$}}}
\else
\let\big=\tenbig@
\textfont0=\tenrm . . .
"2
. . .
"2
\textfont3=\tenex . . .
\textfont\itfam=\tenit
"2
. . .
"2
\textfont\bffam=\tenbf . . .
\ifmsamloaded@
. . .
\fi
. . .
\fi
**
We also *\let\tt=\tentt*, although we don't bother producing a *\tt* math
family, and we then use
**
\tt\ttglue@=.5em minus.15em
**
Thus, we switch to this *\tt* font (so that *em* refers to that font), and
then assign the value of *\ttglue@*).
This switch to *\tt* is temporary, since we will
switch to *\rm* at the end.
Before ending, however, we have to set *\box\strutbox*, which determines
struts,
**
\setbox\strutbox=\hbox{\vrule\height8.5pt\depth3.5pt\width0pt}
**
as well as *\strutbox@*, which \amstex\ uses for its special math struts,
**
\setbox\strutbox@=\hbox{\vrule\height8pt\depth3pt\width0pt}
**
We also set the \amstex\ dimen
**
\ex@=.2326ex
**
(as explained in *amstex.doc*, I don't remember why this value is chosen!).
And then the definition of *\tenpoint* ends with
**
\normalbaselines
**
so that we have set *\baselineskip*, etc., to their ``normal'' values,
and then
**
\ifmmode\else\rm\fi
**
to switch to *\rm*; the *\ifmmode* test is required in case a construction
like
**
$$ \tenpoint ... $$
**
is used, since *\rm* will give an error message in math mode!
After the definition of *\tenpoint*, we still have to give the
definition
\CC**
\def\tenbig@#1{{\hbox{$\left#1\vbox to8.5pt{}
\right.\n@space$}}}
**
and then we can switch to *\tenpoint*:
\CC**
\tenpoint
**
{\bf NOTICE }that we must not say *\tenpoint* until *\tenbig@* has been
defined, or *\big* will initially be undefined.
The definition of *\eightpoint* is exactly analogous, and followed by
the definition
\CC**
\def\eightbig@#1{{\hbox{$\textfont0=\ninerm\textfont2=\ninesy
\left#1\vbox to6.5pt{}\right.\n@space$}}}
**
which is where *\ninerm* and *\ninesy* get used; then, for example,
*\big(* in *\tenpoint* selects the *\ninerm*~(.
Then we use
\CC**
{\catcode` =\active
\gdef\litcodes@@{\def {\allowbreak\hskip\ttglue@}}}
**
so that if literal mode is used within *\tenpoint* or *\eightpoint*,
the active space will have the desired width.
With the fonts now declared, we can properly print the \lamstex\
logo; for best effects somewhat different choices are required at different
point sizes:
\CC**
\def\LamSTeX{L\kern-.4em\raise.3ex\hbox{$\ssize\Cal A$}%
\def\next@{10}\ifx\next@\pointsize@
\kern-.25em\else\kern-.3em\fi
"2
\lower.4ex\hbox{\def\next@{10}\ifx\next@\pointsize@
\eightsy\else\sixsy\fi M}%
\kern-.1em{$\Cal S$}-\TeX}
**
Although *\claimformat* is supposed to be the same as in the default
style, most people don't have an 8~point ``caps and small caps'' font, so
*\tenpoint* and *\eightpoint* don't define
*\smc*, which simply has the default *lamstex.tex* meaning
of *\tensmc* (choosing the font *cmcsc10*).
So we substitute *\rm\uppercase* instead:
\CC**
\def\claimformat@#1#2#3{\medbreak\noindent@@
\def\next@{8}\ifx\pointsize@\next@
\rm\uppercase{#1 {\claim@@@F#2} #3}%
\punct@{\null.}\addspace@\enspace
"2
\else
\smc#1 {\claim@@@F#2} #3\punct@{\null.}%
\addspace@\enspace
\fi
\sl}
**
Finally, since we have the smaller *\eightpoint* fonts, we might as well use
them in the *\windex@* routine for printing index entries at the right
margin, for proofing; we change the strut so that it gives only~
*10pt* between lines.
\CC**
\def\windex@{\ifindexing@
\expandafter\unmacro@\meaning\stari@\unmacro@
\edef\macdef@{\string""\macdef@\string""}%
\edef\next@{\write\ndx@{\macdef@}}\next@
\write\ndx@{{\number\pageno}{\page@N}{\page@P}{\page@Q}}%
\fi
\ifindexproofing@
\ifx\stariii@\empty\else
\expandafter\unmacro@\meaning\stariii@\unmacro@\fi
\insert\margin@{\hbox{\eightpoint
\vrule\height7\p@\depth3\p@\width\z@\starii@
\ifx\stariii@\empty\else\tt\macdef@\fi}}\fi}
**
\section{The {\tt.toc} levels} Since *paper.st* has so many different heading
levels,
$$\vcenter{\halign{\tt#\hfil&\quad{\it alias\/}\quad\tt#\hfil\cr
\bs HL1&\bs chapter\cr
\bs hl1&\bs section\cr
\bs hl2&\bs subsection\cr
\bs hl3&\bs topic\cr
\bs hl4&\bs subtopic\cr}}$$
we want to allow *\toclevel* to indicate how many levels should be written to
the *.toc* file: *\toclevel1* should indicate that only *\chapter*'s are
written, *\toclevel2* that *\chapter*'s and *\section*'s are written, etc.
We might as well allow *\toclevel0* to mean nothing is written (although then
it was fairly silly to specify *\tocfile* to begin with).
We do this in terms of a counter *\toclevel@*, initially with the value~*3*
(so that *\chapter*'s, *\section*'s and *\subsection*'s---the only numbered
heading levels in this style---are written):
\CC**
\newcount\toclevel@
\toclevel@=3
\def\toclevel#1{\toclevel@=#1\relax}
**
To get this to work, we have to restate the definitions of *\HLtoc@* and
*\hltoc@* from *lamstex.tex*. The only difference in the definition
of *\HLtoc@* is that we don't do anything if *\toclevel@* is less than~*1*:
\setbox0\hbox{\<old code for *\HLtoc*\>}
\CC**
\def\HLtoc@{%
\iftoc@
\ifnum\toclevel@ < 1
"2
\else
"box0
\fi
\fi}
**
Similarly, *\hltoc@* only writes to the *.toc* file when *\hllevel* is
less than *\toclevel@* (so if *\toclevel@* is~*1*, no *\hl* is written, if
*\toclevel@* is~*2*, only *\hl1* is written, etc., as desired):
\setbox0\hbox{\<old code for *\hltoc@*\>}
\CC**
\def\hltoc@{%
\iftoc@
"2
\ifnum\hllevel@ < \toclevel@
"box0
\fi
\fi}
**
\section{Setting up heading levels} Next we have to set up the heading
levels. As mentioned on page~\ref{USESFPART}, we want to make sure that
the basic
*\NameHL*'s in this style file don't write information to the *.toc* file
even if *\tocfile* has been specified before the *\docstyle* line.
So we define
\CC**
\def\notocwrite@#1#2#3{\iftoc@\test@true\else\test@false\fi
\toc@false#1{#2}#3\iftest@\toc@true\fi}
**
For example,
\CC**
\notocwrite@\NameHL1\heading
**
first stores the value of *\iftoc@* in *\iftest@*, declares *\tocfalse@*,
calls *\NameHL1\heading*, and restores *\toc@true* if *\iftoc@* was
initially true. The *\NameHL* and *\Namehl* constructions don't involve
*\iftest@*, so this is safe. (The definition of *\notocwrite@* encloses
argument~*#2* in braces in case we have something like *\NameHL{10}...*.)
Next we state
\CC**
\newfontstyle\heading{\smc}
**
Thus, *\HL1*, {\it alias\/} *\heading*, has numbers set in
*\smc* (which will also be used for the heading title, in the definitions
to follow).
One additional feature of the *paper* style is that a *\subsection* (*\hl2*)
is only allowed within a *\section* (*\hl1*), not directly within a
*\heading*. So we need a flag
\CC**
\newif\ifinsection@
**
which *\heading* will set false and *\section* will set true.
Aside from this, *\heading* is handled
by defining
`*\HL@1*'
almost exactly as in the default style,
\CC**
\expandafter\def\csname HL@1\endcsname#1\endHL{%
\global\insection@false
"2
\bigbreak"9\medskip"9
"2
{\locallabel@
\global\setbox1=\vbox{\Let@\tabskip\hss@
\halign to\hsize{"9\smc"9\hfil\ignorespaces##\unskip\hfil\cr
"2
\expandafter\ifx\csname HL@W1\endcsname\empty\else
\csname HL@W1\endcsname\space\fi
"2
{\HL@@F\ifx\thelabel@@\empty\else\thelabel@@\space\fi}%
\ignorespaces#1\crcr}}}%
\unvbox1
\nobreak\medskip}
**
merely adding some extra space before the heading, and setting the heading
in
*\smc*.
One of the interesting features of the *paper* style is the definition
\CC**
\def\appendices{%
\NameHL1\appendix
\Reset\appendix1%
\newnumstyle\appendix\Alph
\newword\appendix{Appendix}%
}
**
This means that after *\appendices* has appeared, *\appendix* may be
used (and *\heading* may no longer be used---compare page~\ref{NHLUD});
the new headings created by
*\appendix* will be numbered `A', `B', \dots, and the headings
will now say `Appendix A \dots', etc.
Notice that when *\appendices* is used, *\NameHL1\appendix* {\it will\/} be
written to the *.toc* file. As we will see in section~\ref{Pmaketoc}, this
will enable *\maketoc* to properly process any *\appendix* lines that appear
afterwards.
Next we have
\CC**
\notocwrite@\Namehl1\section
\newstyle\section#1{#1\null.}
**
so that *\section* can be used for *\hl1*; in addition, we now have a period
printed after the *\section* number (the default style omits the period).
Although each *\heading* normally resets *\section* numbers to~1 (this will
be handled by `*\HL@I1*', to be defined shortly), we will allow
**
\keepsection
**
analogous to *\keepitem*, to be typed before *\heading*, to prevent this.
*\keepsection* will merely set a flag
\CC**
\newif\ifcontinuesection@
\def\keepsection{\global\continuesection@true}
**
which each *\section* should set false (with this arrangement,
if\linebreak
*\keepsection* is typed before a *\heading* with no *\section*'s, then
it carries over to the next *\heading*).
The definition of *\section*, via `*\hl@1'*, also
sets *\ifinsection@* to be true,
and the formatting is somewhat different from the default style: instead of
running the *\section* title into the text, we start a new paragraph, after a
*\smallskip*:
\CC**
\expandafter\def\csname hl@1\endcsname#1{%
\global\insection@true
\global\continuesection@false
\medbreak\noindent@@
{\locallabel@
\bf{\hl@@F\ifx\thelabel@@\empty\else\thelabel@@\space\fi}%
\ignorespaces#1\unskip\punct@{\null.}}%
\par\nobreak\smallskip}
**
For *\hl2*, eventually to be named *\subsection*, we must first declare
counters and default values:
\CC**
\expandafter\newcount\csname hl@C2\endcsname
\csname hl@C2\endcsname=0
"2
\expandafter\def\csname hl@S2\endcsname#1{#1\null.}
"2
\expandafter\let\csname hl@N2\endcsname=\arabic
"2
\expandafter\let\csname hl@P2\endcsname=\empty
\expandafter\let\csname hl@Q2\endcsname=\empty
"2
\expandafter\def\csname hl@F2\endcsname{\bf}
\expandafter\let\csname hl@W2\endcsname=\empty
**
Then we can
\CC**
\notocwrite@\Namehl2\subsection
**
[recall (page~\ref{NameNOTE}) that *\Namehl2* must be used after
`*\hl@C2*', \dots\ have been defined]. Then we
define *\subsection*, via `*\hl@2*', giving an error message
if the flag *\ifinsection@* is false:
\CC**
\expandafter\def\csname hl@2\endcsname#1{%
\ifinsection@
"2
\smallbreak
\noindent@@
"2
{\locallabel@
{\hl@@F\ifx\thelabel@@\empty\else
\thelabel@@\space\fi}\bf
"2
\ignorespaces#1\unskip\punct@{\null.}%
\addspace@\enspace}%
"2
\else
\Err@{\noexpand\subsection not in a \string\section}%
\fi}
**
The declaration of counters and default values for *\hl3* and *\hl4* are
analogous, except that we can even
**
\expandafter\let\csname hl@F3\endcsname=\empty
\expandafter\let\csname hl@F4\endcsname=\empty
**
since the numbers for these heading levels aren't even going to be printed.
We can then state
\CC**
\notocwrite@\Namehl3\topic
**
and
\CC**
\notocwrite@\Namehl4\subtopic
**
The definition of *\topic*, via `*\hl@3*', is
\CC**
\expandafter\def\csname hl@3\endcsname#1{%
\smallbreak
"2
\noindent@@
"2
{\locallabel@
\bf\ignorespaces#1\unskip\punct@{\null.}%
\addspace@\enspace}}
**
while *\subtocic*, defined via `*\hl@4*', starts as an ordinary paragraph:
\CC**
\expandafter\def\csname hl@4\endcsname#1{%
"2
\smallbreak
"2
{\locallabel@\bf\ignorespaces#1\unskip
\punct@{\null.}\addspace@\enspace}}
**
The initializations are fairly simple:
\CC**
\expandafter\def\csname HL@I1\endcsname{\ifcontinuesection@
\else\Reset\hl11\fi}
"2
\expandafter\def\csname hl@I1\endcsname{\Reset\hl21%
\ifx\pref\empty\newpre\hl2{}\else\new\hl2{\pref.}\fi}
"2
\expandafter\def\csname hl@I2\endcsname{\Reset\hl31}
"2
\expandafter\def\csname hl@I3\endcsname{\Reset\hl41}
**
Thus, *\section* numbers are reset to~1 after each *\heading*,
unless\linebreak
*\keepsection* preceded it; *\subsection* numbers are reset to~1 at each
*\section*, and the {\it n}$^{\text{th}}$ subsection number is
printed as {\it m}.{\it n}, where {\it m\/} is the *\section* number, unless
empty (because of a *\section""""* command); and *\subsection* resets
*\topic* numbers to~1, while *\topic* resets *\subtopic* numbers to~1, even
though these numbers aren't printed (they can still be referred to by *\nref*,
if the *\topic* or *\subtopic* is given a *\label*).
\section{Footnotes}
The definition of *\vfootnote@* is modified so that the footnotes will be
printed in 8~point type:
\C**
\def\vfootnote@#1{\insert\footins
\bgroup
"2
\floatingpenalty2000
"2
\interlinepenalty=\interfootnotelinepenalty
"2
\leftskip=0pt \rightskip=0pt \spaceskip=0pt \xspaceskip=0pt
"9\eightpoint"9
\splittopskip=\ht\strutbox \splitmaxdepth=\dp\strutbox
"2
\locallabel@\noindent@@{\foottext@F#1}\modifyfootnote@
\footstrut\futurelet\next\fo@t}
**
Note that the *\strutbox* will now have the value set by *\eightpoint*.
\section{Additional ``top matter'' and ``end matter''
constructions}
In addition to *\title*, *\author*, *\affil*, and *\date*, which already
appear in the default style, the *paper* style also has several other
constructions that go at the beginning of the paper, and a few that go at the
end.
For *\abstract...\endabstract*, as
for *\title* and *\author*, we declare a box
\CC**
\newbox\abstractbox@
**
to hold the abstract. Because we are printing a word `Abstract' at the
beginning, followed by punctuation and spacing, we then
\CC**
\rightadd@\abstract\to\nofrillslist@
\def\abstract@W{Abstract}
**
The *\box\abstractbox@* is going to be set with
**
\leftskip=24pt \rightskip=\leftskip
**
rather than as a *\vbox* with smaller *\hsize*, so that we can simply
*\unvbox* it at the proper time, instead of having to include it in
*\centerline*, and worrying about spacing before and after it.
We will increase the *\tolerance* to~*800* for these smaller lines.
Unfortunately,
these values of *\leftskip* and *\rightskip*
{\it do not\/} influence
*\displaywidth* and *\displayindent*, which determine the positioning
of displayed formulas within the *\abstract*; the latter are influenced
only by *\parshape*---see {\it The \tex book}, page~188. Moreover,
we
can't simply assign them the desired values, because, as explained on that
page, \tex\
assigns them values
immediately after the *$$* that begins a display, based on the value of
*\parshape*.
Instead we will have to change *\everydisplay* (which, recall from
section~\Sref{pretend1}, is already non-empty in \lamstex) to include
the desired changes.
\CC**
\def\abstract{\begingroup
\global\setbox\abstractbox@=\vbox\bgroup
"2
\eightpoint\leftskip=24pt \rightskip=\leftskip
"2
\everydisplay{\advance\displaywidth by -48pt
\displayindent=24pt \csname displaymath \endcsname}%
"2
\tolerance=800
\noindent@@
"2
\ifx\abstract@W\empty\else\abstract@W\punct@{\null.}%
\addspace@\enspace\fi}
"slip
\def\endabstract{\egroup\endgroup}
**
*\thanks*, *\keywords*, and *\subjclass* are handled like *\date*:
\CC**
\let\thanks@=\relax
\long\def\thanks#1{\gdef\thanks@{{\ignorespaces#1}}}
"slip
\let\keywords@=\relax
\def\keywords#1{\gdef\keywords@{{\ignorespaces#1}}}
"slip
\let\subjclass@=\relax
\def\subjclass#1{\gdef\subjclass@{{\ignorespaces#1}}}
**
The *\long* allows several paragraphs of thanks. Extra group is included
in the definitions of *\keywords* and *\subjclass* in case a font change is
included; but, as we will see, that is unnecessary for *\thanks*.
None of these need *\unskip*
at the end, because they will all eventually be ended by a *\par*.
*\address* is somewhat different, because it can be used arbitrarily many
times. A counter *\addresscount@* is used to keep track of the number, and
each use of *\address* creates a new control sequence to store the argument:
\CC**
\newcount\addresscount@
\addresscount@=0
"2
\long\def\address#1{\global\advance\addresscount@ by 1
\expandafter\gdef
\csname address\number\addresscount@\endcsname
{{\ignorespaces#1}}}
**
Since *\keywords*, *\subjclass*, and *\address*'s are printed at the end of
the paper in the *paper* style, we redefine *\bye* to include this
material before adding the *\vfill\supereject\end*:
\CC**
\def\bye{\par
\nobreak
"2
\vskip12pt minus6pt
"2
\eightpoint
"2
\ifx\keywords@\relax\else
\noindent@@{\it Keywords.\enspace}\keywords@\par\fi
"2
\ifx\subjclass@\relax\else
\noindent@@ 1980 {\it Mathematics subject
classifications\/}\colon@\space\subjclass@\par\fi
"2
\ifnum\addresscount@ > 0
\nobreak
\vskip12pt minus6pt
"2
\loop\ifnum\addresscount@>0
\csname address\number\addresscount@\endcsname\endgraf
\global\advance\addresscount@ by -1
\repeat
"2
\fi
\vfill\supereject
\end}
**
Notice that instead of a *:* we used *\colon@* (page~\ref{COLONAT}).
No *\keywords@W* or
*\subjclass@W* has been provided, to change `Keywords' or `Mathematics
subject classifications', since those are presumably somewhat standard terms;
but they could easily be added if needed. In the *\loop* for the
*\address*'s, we needed *\endgraf* instead of *\par*, since *\loop* isn't
*\long*.
And then we make *\enddocument* synonymous with this new *\bye*:
\CC**
\let\enddocuent=\bye
**
The remaining constructions, which occur at the top, are placed by\linebreak
*\maketitle*, just as in the default style. We also declare initially empty
elements
\CC**
\let\pretitle=\empty
\let\preauthor=\empty
"2
\let\preaffil=\empty
"2
\let\predate=\empty
"2
\let\preabstract=\empty
\let\prepaper=\empty
**
which can be redefined to add additional elements:
\CC**
\def\maketitle{\hrule\height 0pt \vskip-\topskip
"2
\pretitle
"2
\vskip24pt plus12pt minus12pt
\unvbox\titlebox@
"2
\preauthor
"2
\ifvoid\authorbox@\else
\vskip12pt plus6pt minus3pt \unvbox\authorbox@\fi
"2
\preaffil
"2
\ifvoid\affilbox@\else
\vskip10pt plus5pt minus2pt \unvbox\affilbox@\fi
"2
\predate
"2
\ifx\date@\relax\else
\vskip6pt plus2pt minus2pt\centerline{\rm\date@}%
\let\date@=\relax\fi
"2
\preabstract
"2
\ifx\thanks@\relax\else
\vfootnote@{}\thanks@
\let\thanks@=\relax\fi
"2
\ifvoid\abstractbox@\else
\vskip15pt plus12pt minus12pt
\unvbox\abstractbox@
\fi
"2
\prepaper
\vskip18pt plus12pt minus6pt}
**
Notice that the *\thanks* is treated like the text of a footnote, but with
no number.
\section{Bibliography}
The only modification
required for *\makebib* in the *paper* style is to switch to 8~point type:
\CC**
\def\makebib{\begingroup\eightpoint
\bigbreak
\centerline{\smc\makebib@W}\nobreak\medskip
"2
\sfcode`\.=1000 \everypar{}\parindent=0pt
\def\nopunct{\nopunct@true}\def\nospace{\nospace@true}%
"2
\nopunct@false\nospace@false
\def\lkerns@{\null\kern-1sp\kern1sp}%
\def\nkerns@{\null\kern-2sp\kern2sp}%
}
**
For the case where *\UseBibTeX* has been specified, so that the
**
\makebib
. . .
\endmakebib
**
region is replaced by a
**
\bibliography{...}
**
line, we redefine *\beginthebibliography@* so that it will also print in
8~point type:
\CC**
\def\beginthebibliography@#1{\eightpoint
\setbox0=\hbox{#1\ }\bibindent@=\wd0
\bigbreak\centerline{\smc\bibliography@W}\nobreak\medskip
\sfcode`\.=1000 \everypar{}\parindent=0pt}
**
\section{\CS{maketoc}\label{Pmaketoc}}
Finally, the *\maketoc* command is special,
because it is used right in the *paper* style, rather than in a ``front
matter file''. So most of the definitions of *lamstex.stf* are also required
in *paper.st*:
\CC**
\def\dotleaders ...
\def\Page@ ...
\long\def\widerthanhsize@
"2
\long\def\setentry@##1##2##3##4{%
. . .
\else
\hbox to\hsize{"9\kern24pt"9 ...}
\fi}
"2
\def\endstrut@
\newdimen\thehang@
"2
\long\def\longentry@##1##2##3##4{. . .
. . .
\hangafter1 \hangindent\thehang@ "9\leftskip=24pt"9
. . .}
"2
\newif\ifemptynumber@
\def\Style@ ... . . . \def\Style@@@@ ...
\newdimen\digits
**
with the difference that
all entries will be indented 24~points from the left margin (the
same amount of indentation that occurs for the *\abstract*).
We also need to have the definition
\CC**
\def\maketoc@W{Contents}
**
so that *\newword\maketoc* can be used before *\maketoc* itself.
Then the definition of *\maketoc* starts
**
\def\maketoc{\par
\begingroup
\eightpoint \tolerance=800
\unlabel@\noset@
\let\nopunct=\relax \let\nospace=\relax
\let\overlong=\relax
\everypar={}\parindent=0pt
\lineskiplimit=0pt
**
The *\checkmainfile@* in the *lamstex.stf* definition is naturally deleted,
and the *\par\vfill\break* is replaced by a *\par*. We use *\begingroup*,
because we will be making redefinitions of *\HL*, etc., and the old
definitions will have to be restored after the table of contents is finished;
and the *\lineskiplimit=0pt*, which is so important for the entries of the
table of contents (compare section~\Sref{SETENTRY}), will also be confined to
this group.
And then come the various redefinitions that also occur in *\maketoc*
in *lamstex.stf*:
**
\def\HL ...
\setbox0=\hbox{0.00}
\digits=\wd0
\def\hl ...
\def\NameHL ...
\def\Namehl ...
**
The definitions of *\HL* and *\hl* are somewhat different, reflecting both
the larger number of heading levels, and somewhat different formatting in the
table of contents. Then we have to add
**
\NameHL1\heading \Namehl1\section \Namehl2\subsection
\Namehl3\topic \Namehl4\subtopic
**
so that *\heading*, \dots, *\subtopic* will be suitably redefined while
making the table of contents. Naturally we can't
add *\NameHL1\appendix* at the same time,
but *\appendices* will add this to the *.toc* file,
so that *\appendix* will be suitably redefined at the necessary time when
printing the Contents.
Finally, we print the properly
centered heading, diminish *\hsize* by\linebreak
24~points,
(so that the right margin will match that of the *\abstract*), *\input* the
file *\jobname.toc*, end the group, and add some vertical space:
**
\centerline{\smc\maketoc@W}
\nobreak
\vskip18pt plus12pt minus6pt
"2
\advance\hsize by -24pt
"2
\input \jobname.toc
\endgroup
\vskip 12pt plus8pt minus4pt
**
\medskip
The definitions involving *\island*'s from *lamstex.stf* are not needed,
since *paper.st* does not print a list of Figures, Tables, etc., even when a
table of contents is made.
And nothing from *lamstex.stb* is required, since *paper.st* does not
provide for
an index.
\chapter The {\tt book} style\label{BOOKSTYLE}\endchapter
\section{Basic settings}
The *book* style has
**
\ifx\bookst@\relax\catcode`\@=\active
\endinput\else\let\bookst@=\relax\fi
**
analogous to the code in *paper.st*, and then
some slightly different basic settings,
**
\hsize=30pc
\vsize=42pc
**
Then, more significantly, it changes *\makeheadline*
so that running heads will be separated from the main body of the text by a
different amount of space; in addition, the running head is not made into
a *\vbox to0pt*, as in *plain* \tex@---the running heads are a measurable part
of the page
(the final pages might even be printed
with ``crop marks'' on them, which should naturally take into account the
presence of the running heads). *\makefootline* is also changed, although
that will only effect the page numbers at the bottoms of special pages, like
the initial pages
of each chapter:
\CC**
\def\makeheadline{\hbox{%
\botsmash{\line{\vbox to8.5pt{}\the\headline}}}%
\nointerlineskip\vskip20pt}
\def\makefootline{\baselineskip=2.5pc
\line{\the\footline}}
**
Just for good measure, we make things like *\title*, \dots, undefined, since
they should appear only in the ``front matter file'' for the book:
\CC**
\let\title=\undefined
"2
\let\author=\undefined
"2
\let\affil=\undefined
"2
\let\date=\undefined
**
and, in particular, we
\CC**
\let\makebib=\undefined
**
since *\makebib* should only occur in the ``back matter file''.
\section{Fonts and point sizes}Exactly the same new fonts are declared as in
the *paper* style, and *\tenpoint* and *\eightpoint* are defined in the same
way.
\section{The {\tt.toc} levels} *\toclevel* is defined just as in the *paper*
style, and *\HLtoc@* and *\hltoc@* are redefined in exactly the same way.
\section{Flushing out figures\label{FLUSHF}}
Both *\part* and *\chapter* are going to flush out any
figures from previous *\chapter*'s.
As
discussed in section~\Sref{FLUSHSEC}, this means that
we will have to modify the *\plainoutput*
routine so that empty pages produced at the ends of chapters won't
increase the page numbers, and won't get printed.
Since this additional process is memory intensive, however,
we
don't want it to be
invoked unless a flag
\CC**
\newif\ifflush@
**
is true, where
*\FlushedFigs* and *\NoFlushedFigs* are used to set the flag:
\CC**
\def\FlushedFigs{\global\flush@true}
\def\NoFlushedFigs{\global\flush@false}
**
(The savvy user will
specify *\FlushedFigs* near the end of a *\chapter*
with *\Aplace*'s and add *\NoFlushedFigs* at the beginning of the next
*\chapter*.)
It might seem that *\part* and *\chapter* will flush out figures from a
previous *\chapter* if their definitions are of the form
**
\par\vfill\supereject
. . .
{\locallabel@ . . . }
. . .
**
(using the *\par\vfill\supereject* that occurs in the definition of *\bye*).
Unfortunately, that may not be sufficient
when we have a situation like
**
. . .
\Aplace{...}
\chapter
**
because
the *\Aplace*'d material may not get printed until after the remaining
aspects of *\chapter* have already set things up for preparing pages for this
next *\chapter*. For example,
flushed out figures from Chapter~9 might end up having
heading levels saying `Chapter~10 \dots'!---which is even worse than having
extra blank pages.
Therefore *\part* and *\chapter* will, in all situations, use
something like
**
\par\vfill\break\null\kern-\topskip\nobreak\vfill\supereject
**
(essentially the construction that appears in the *plain* definition
of\linebreak
*\dosupereject*), so that we can be sure that any
held-over figures are flushed
out before the remaining aspects of *\chapter* are brought into play. The
problem with this approach is that a blank page will now be produced when
there are no figures to be flushed out. However, we will take care of that
problem later, during the *\output* routine. We will need a flag
\CC**
\newif\ifSflush@
**
to indicate such special pages, and then we define
\CC**
\def\flush@{\par\vfill\break\null\kern-\topskip\nobreak
\global\Sflush@true\vfill\supereject}
**
\section{\CS{part} and \CS{chapter}} The *book* style has a new heading level
*\HL0*, {\it alias\/} *\part*. We will need a new font for setting it,
\CC**
\font\BF=cmbx10 scaled \magstep3
**
and then we set up things for *\HL0*:
\CC**
\expandafter\newcount\csname HL@C0\endcsname
\csname HL@C0\endcsname=0
"2
\expandafter\def\csname HL@S0\endcsname#1{#1\/}
\expandafter\let\csname HL@N0\endcsname=\Roman
\expandafter\let\csname HL@P0\endcsname=\empty
\expandafter\let\csname HL@Q0\endcsname=\empty
\expandafter\def\csname HL@F0\endcsname{\BF}
\expandafter\def\csname HL@W0\endcsname{Part}
**
So *\HL0*
levels
will be numbered I, II, \dots. The word preceding the number
will actually be `PART' rather than `Part', but we will use *\uppercase* for
this, rather than defining `*\HL@W0*' as *PART*, so that *Part* will appear
in the *.toc* file; this allows the style file for the front matter to print
things differently, if desired.\pagelabel{UCPART}
Once these definitions have been made, we can then
*\NameHL0\part* (see page~\ref{NameNOTE}).
As with the *paper* style, however, we need to have
\CC**
\def\notocwrite@#1#2#3{\iftoc@\test@true\else\test@false\fi
\toc@false#1{#2}#3\iftest@\toc@true\fi}
**
so that we can
\CC**
\notocwrite@\NameHL0\part
**
We introduce a new flag
\CC**
\newif\ifpart@
**
since *\part* pages will be special (they will have no number at the bottom
and also no running head). Then we define *\part*, via `*\HL@0*', which
involves quite a few tricky maneuvers.
Our definition of *\csname HL@0\endcsname* begins with
**
\flush@
\global\part@true
\ifodd\pageno\else\advancepageno\fi
**
where the *\flush@* (section~\Sref{FLUSHF}) flushes out any figures remaining
from the previous *\chapter*, and
the third clause insures that *\part*'s always begin on odd-numbered
pages.
And then we want something like
**
{\locallabel@
\global\setbox1=\vbox{\Let@
\baselineskip=21pt
\halign{\BF\ignorespaces##\unskip\hfil\cr
\expandafter\ifx\csname HL@W0\endcsname\empty
\else\csname HL@W0\endcsname\space\space\fi
{\HL@@F\thelabel@@}\cr
\noalign{\vskip30pt}%
\uppercase{\ignorespaces#1\crcr}}}
**
printing
something like `PART\ \ II' on the first line, an extra 30~points of
vertical
space, and then the title *#1* in uppercase letters.
But we want to
eliminate the first line and the extra 30~points if both the \<word\> and
the number happen to be empty. Moreover,
**
\uppercase{\csname HL@W0\endcsname}
**
won't uppercase the letters in *\csname HL@W0\endcsname*, and even
**
\uppercase\expandafter{\csname HL@W0\endcsname}
**
won't do the trick, so we need to resort to a strategy used before
(compare pages~\ref{LNIII} and ~\ref{USELNIII}),
\CC**
\expandafter\def\csname HL@0\endcsname#1\endHL{%
\flush@
\global\part@true
\ifodd\pageno\else\advancepageno\fi
{\locallabel@
\global\setbox1=\vbox{\Let@
\baselineskip=21pt
"2
\halign{\BF\ignorespaces##\unskip\hfil\cr
"2
\test@false
\expandafter\ifx\csname HL@W0\endcsname\empty
\ifx\thelabel@@\empty\global\let\Next@=T\fi\fi
"2
\ifx\Next@ T%
"2
\else
\expandafter\ifx\csname HL@W0\endcsname\empty
\else
"2
\def\next@{\let\nextii@=}%
\expandafter\next@\csname HL@W0\endcsname
\uppercase\expandafter{\nextii@}\space\space\fi
"2
{\HL@@F\thelabel@@}%
\fi
\cr
"2
\noalign{\ifx\Next@ T\vskip-\baslineskip\else\vskip30pt\fi}%
\uppercase{\ignorespaces#1}\crcr}}}%
\def\aftertoc@{\vfill\break\advancepageno\global\part@false}%
\hrule\height0pt\mark{}\vskip1.25in\unvbox 1
}
**
The *\hrule* keeps the *\vskip1.25in* from disappearing at the top of the
page, and the *\mark{}* clears any marks from previous *\section*'s (see
below).
Notice that *\aftertoc@* causes the page number to jump to the next odd number
after the *\part* page,
but the proper page for the *\part* will appear in the *.toc* file
(compare page~\ref{AFTERTOC}); *\advancepageno* requires less work from
\tex\ than *\Offset\Page2*, which could also have been used.
We needed the globally defined *\Next@* here, since each line of the
*\halign* is already within a group; although *\Next@* is used in various
other \lamstex\ routines, none of them will be involved when
we typeset (the *\uppercase*'d) *\HL@W* (for greater security, we could
always use some new scratch token instead).
Next we have
\CC**
\notocwrite@\NameHL1\chapter
\newword\chapter{Chapter}
\newif\iffirstchapterpage@
**
We need the new flag *\iffirstchapterpage@*, because initial pages of
chapters will be treated specially, with no running heads, and page numbers
at the bottom.
As with the *paper* style, we also have the flag
\CC**
\newif\ifinsection@
**
Even-numbered pages will normally have the *\chapter* title at the top.
However, we will allow
**
\runningchapter{...}
**
to be used before *\chapter* to specify a different running chapter
(this change from version~*1*, where *\runningchapter* was supposed to
occur after the *\chapter*, makes things much easier).
We need a new flag to alert *\chapter* to the fact that *\runningchapter* has
been used; the argument of *\runningchapter* will be stored in a token list,
for reasons that will soon become apparent:
\CC**
\newif\ifrunningchapter@
\newtoks\runningchaptertoks@
\def\runningchapter#1{\global\runningchapter@true
\runningchaptertoks@={#1}}
**
The running heads at the top of odd-numbered pages will normally contain
the most recent *\section* title, an arrangement that will require the use of
*\mark*'s, except that we will use
the *\chapter* title if no *\section* has appeared. *\chapter* is going
to start a new page, issue an empty *\mark{}*, to clear *\mark*'s from
the previous *\section*'s,
and then define *\thechapter@* to be the desired running
head on even-numbered pages.
Just in case there are pages before a *\chapter*, we begin with
\CC**
\let\thechapter@=\relax
**
We then define *\chapter*, via `*\HL@1*', by
\CC**
\expandafter\def\csname HL@1\endcsname#1\endHL{%
\flush@
\global\insection@false
"2
\ifrunningchapter@\else\runningchaptertoks@={#1}\fi
\global\runningchapter@false
"2
{\noexpands@
\xdef\thechapter@{\ifx\Thepref@\empty\else
\Thepref@\null. \fi\the\runningchaptertoks@}}%
\global\firstchapterpage@true
"2
{\locallabel@
"2
\global\setbox1=\vbox{\Let@\tabskip\hss@
\halign to\hsize{\bf\hfil\ignorespaces##\unskip\hfil\cr
\expandafter\ifx\csname HL@W1\endcsname\empty\else
\csname HL@W1\endcsname\space\fi
"2
{\HL@@F\ifx\thelabel@@\empty\else\thelabel@@\space\fi}%
\ignorespaces#1\crcr}}%
}%
\unvbox1 \mark{}%
\nobreak\vskip\baselineskip
%\firstparflush@
}
**
Note that:
\Pitem
As with `*\HL@0*,' we need to flush out any figures from the
previous *\chapter*.
\pitem
The tokens *#1* are stored in the token list *\runningchaptertoks@*,
unless *\runningchapter* has already been used, and has thus already\linebreak
stored something in *\runningchaptertoks@*. After this decision for\linebreak
*\runningchaptergtoks@* has been made, we can reset the flag\linebreak
*\ifrunningchaptertoks@*
to be false.
\pitem
Then *\thechapter@* is created by an *\xdef*, inside a group
containing\linebreak
*\noexpands@*, so that appropriate control sequences in *\Thepref@* are left
alone. Even though we have an *\xdef*,
our chapter title (or abbreviated title, specified by
*\runningchapter*) appears as originally typed, since it is the value
of *\the\runningchaptertoks@*---thus, we do not have to worry about expansion
of control sequences in *\thechapter@*, and do not have to resort to the
*\unmacro@\meaning* trick (this works because *\thechapter@* is not going to
be written to a file, but merely typeset at the appropriate time).
\pitem
At the very end of the definition the line
**
\firstparflush@
**
is designed to start the next paragraph unindented; it has been commented
out, since it is not used in the *book* style, but other book styles might
want to use it.
\small The definition of *\firstparflush@*, for those styles that want it,
is given immediately afterwards:
\CC**
\def\firstparflush@{\parindent=0pt
\everypar{\global\parindent=10pt \global\everypar{}}}
**
Thus, the first paragraph will be
set with *\parindent* equal to~*0pt*, but this paragraph will
set *\everypar*, for all successive paragraphs, to
**
\global\parindent=10pt \global\everypar{}
**
This means that *\parindent* will be *10pt* for the second paragraph, and,
moreover, *\everypar* will be back to the empty list for the third
paragraph. The *\global*'s are needed because a paragraph might start with
something like
**
{\it Consequently}, we see that ...
**
\endsmall
Having defined *\part* and *\chapter*, which set special flags *\ifpart@* and
*\iffirstchapterpage@*, we also
define *\footline*, which uses them, printing
nothing at the bottom of *\part* pages, but a centered page number, in
9~point type
at the
bottom of the first page of each chapter.
In essence we want
**
\ninepoint\folio
**
except that there is no *\ninepoint* command, merely *\ninerm* to switch to
the 9~point roman font. So we have to use
\CC**
\footline={\ifpart@\hfil
\else
\iffirstchapterpage@\hfil
\ninerm\page@S{\page@P\page@N{\number\page@C}\page@Q}\hfil
\fi
\global\firstchapterpage@false
\fi}
**
---thus, *\newfontstyle\page* won't effect the page numbers at the bottom of
initial chapter pages.
At this point we also want to prevent any *\Aplace*'d material from occurring
on the first page of each *\chapter*, by modifying *\advancedimtopins@*,
as indicated on page~\ref{MODADT}:
\CC**
\def\advancedimtopins@{%
\iffirstchapterpage@
\else
\advance\dimen@ by \dimen\topins
\global\dimen\topins=\dimen@
\fi}
**
\section{\CS{plainoutput}}The
*\part* and *\chapter* heading levels
are the only ones that flush out figures, so
now is the time to consider the necessary modifications to *\plainoutput*,
as already indicated in section~\Sref{FLUSHF}.
We are going to need a new flag and a new box,
\CC**
\newif\ifblankpage@
\newbox\topinsbox@
**
and also a counter in which we store the special penalty
\setbox0\hbox{($={}$*-'10000000000*)}
**
-1073741824 "box0
**
that \tex\ inserts when it sees *\end* (page~\ref{WEIRDPEN}):
\CC**
\newcount\endpenalty@
\endpenalty@=-'10000000000
**
Most of our extra manipulations will be done only
when *\ifflush@* is true. However, we will also be doing extra manipulations
when *\ifSflush@* is true and *\insertpenalties* is~*0* (which is when
the additional
**
\null\kern-\topskip\nobreak\vfill
**
will create a blank page). So we first use
**
\test@false
\ifflush@\test@true
\else\ifSflush@\global\Sflush@false
\ifnum\insertpenalties=0 \test@true\fi
\fi\fi
**
to set *\iftest@* true in either of these cases, and reset *\ifSflush@* to
false.
Then, if this test is passed,
we first test if *\box\footins* is void and also
*\box\topins* is void or has height~*0pt*; and if that test is true,
we then
use the code on page~\ref{BPGTEST} to test whether *box255* is essentially
blank, reducing the page number by~1, and setting *\ifblankpage@* true,
if it is:
**
\def\plainoutput{%
\test@false
\ifflush@\test@true
\else\ifSflush@\global\Sflush@false
\ifnum\insertpenalties=0 \test@true\fi
\fi\fi
\iftest@
"2
\test@false
\ifvoid\footins
\ifvoid\topins\test@true
\else\ifdim\ht\topins=0pt\test@true
\fi\fi
"2
\fi
\iftest@
"2
\setbox0=\vbox{\unvcopy255 \unskip\unpenalty\unkern
\global\setbox1=\lastbox\unskip}%
"2
\ifdim\ht0=0pt \ifdim\ht1=0pt
\global\advance\pageno by -1
\global\blankpage@true
\fi\fi
"2
\fi
\fi
**
Then we could
continue with the commands from the standard\linebreak *\plainoutput* routine:
**
\specialsplit@false\ifvoid\topins\else\ifdim\ht\topins=0pt
\specialsplit@true\advance\minpagesize by -\skip\topins\fi\fi
\fliptopins@
\setbox\outbox@=\vbox{\makeheadline\pagebody\makefootline}%
"2
{\noexpands@ \let\style=\relax
\shipout@\box\outbox@
}%
"2
\advancepageno
\resetdimtopins@
\ifvoid 255 \else \unvbox 255 \penalty\outputpenalty\fi
\ifnum\outputpenalty>-20000 \else\dosupereject\fi}
**
That would insure that the page numbers don't increase for the
spurious blank pages. But we can do better than that. If we replace
the
**
\shipout@\box\outbox@
**
with
**
\ifblankpage@ \global\blankpage@false
\else\shipout@\box\outbox@\fi
**
then the spurious blank pages shouldn't even be printed.
This
seems to work fine at the end of all *\chapter*'s except when
there are figures to be flushed out at the end of the last *\chapter*,
before the *\bye* or
*\enddocument*. In that case,
after each round of the *\output* routine, which now increases
*\deadcycles* by~*1*, since nothing is shipped out,
\tex\ keeps adding
**
\line{} \vfill \penalty -'10000000000
**
so that we eventually get an error message like
**
! Output loop---25 consecutive dead cycles.
**
Page~264 of {\it The \tex book\/} says ``When \tex\ sees
an *\end* command, it terminates the job only if the main vertical list has
been entirely output and if *\deadcycles=0*. Otherwise it inserts the
equivalent of
**
\line{} \vfill \penalty-'10000000000
**
into the main vertical list, and prepares to read the `*\end*' token again.''
Apparently, the main vertical list has not been ``entirely output''
because *\box\topins* hasn't been shipped out.
Emptying out *\box\topins* with something like
**
\setbox0=\box\topins
**
doesn't seem to help, so I resorted to
**
\ifblankpage@
\ifnum\outputpenalty=\endpenalty@
\shipout\vbox{\hrule\width1pt\height0pt\box\topins}%
\fi
\global\blankpage@false
\else
\shipout@\box\outbox@
\fi
**
which seems to work---the only adverse
side-effect is the possibility of extra, totally blank, pages
at the end.
There is also one other modification that we need: instead of always
using
**
\setbox\outbox@=\vbox{\makeheadline\pagebody\makefootline}
**
we use
**
\ifblankpage@ \setbox\outbox@=\pagebody\else
\setbox\outbox@=\vbox{\makeheadline\pagebody\makefootline}\fi
**
The takes care of spurious blank pages that might be created
by the first *\part* or *\chapter*, since *\makeheadline* or *\makefootline*
might involve quantities that haven't even been determined yet.
So the whole definition is:
\CC**
\def\plainoutput{%
\test@false
\ifflush@\test@true
\else\ifSflush@\global\Sflush@false
\ifnum\insertpenalties=0 \test@true\fi
\fi\fi
\iftest@
"2
\test@false
\ifvoid\footins
\ifvoid\topins\test@true
\else\ifdim\ht\topins=0pt \test@true
\fi\fi
"2
\fi
\iftest@
\setbox0=\vbox{\unvcopy255 \unskip\unpenalty\unkern
\global\setbox1=\lastbox\unskip}%
\ifdim\ht0=0pt \ifdim\ht1=0pt
\global\advance\pageno by -1
\global\blankpage@true
\fi\fi
"2
\fi
\fi
"2
\specialsplit@false
\ifvoid\topins\else
\ifdim\ht\topins=0pt
\specialsplit@true
\advance\minpagesize by -\skip\topins
\fi\fi
"2
\fliptopins@
"2
\ifblankpage@
\setbox\outbox@=\pagebody\else
\setbox\outbox@=\vbox{\makeheadline
\pagebody\makefootline}%
\fi
"2
{\noexpands@ \let\style=\relax
\ifblankpage@
\ifnum\outputpenalty=\endpenalty@
\shipout\vbox{\hrule\width1pt\height0pt
\box\topins}%
\fi
\global\blankpage@false
"2
\else
\shipout@\box\outbox@
\fi}%
"2
\advancepageno
"2
\resetdimtopins@
\ifvoid 255 \else \unvbox 255 \penalty\outputpenalty\fi
\ifnum\outputpenalty>-20000 \else \dosupereject \fi}
**
\small For the clause
**
\ifblankpage@
\setbox\outbox@=\pagebody\else
\setbox\outbox@=\vbox{\makeheadline
\pagebody\makefootline}
\fi
**
I originally had simply
**
\ifblankpage@\else
\setbox\outbox@=\vbox{\makeheadline
\pagebody\makefootline}
\fi
**
But this lead to the dead cycles error message, though I don't understand
why.
\andsmall!
Since the extra test in *\plainoutput*
always regards a ``blank'' page as a mistake,
actual blank pages can't be produced with something like
\setbox0\hbox{or}
**
\newpage\null\vfill\break "box0 \pagebreak\null\vfill\break
**
but we can use something like
**
\newpage\blankpage
**
where we have defined
\CC**
\def\blankpage{\null\null\vfill\break}
**
just in case that's needed. [Of course
**
\Aplace{\Figure\Hbyw{...}\endFigure}
**
possibly with a *\caption*, would be used if a blank page were
required for a picture, the most usual reason for such a request. Also,
**
\NoFlushedFigs
\newpage\null\vfill\break
**
would work.]
\endsmall
\section{Other heading levels}
*\appendices* is treated exactly as in the *paper* style, so we won't repeat
the definition here.
Next we have
\CC**
\notocwrite@\Namehl1\section
\newstyle\section#1{#1\null.}
**
as in the *paper* style.
The running heads at the top of odd-numbered pages will normally contain the
most recent *\section* title, except that we will use the *\chapter* title if
no *\section* has yet appeared.
We also want to allow *\runningsection* to be used
before *\section* (again a change from version~*1*), which is treated just
like *\runningchapter*:
\CC**
\newif\ifrunningsection@
\newtoks\runningsectiontoks@
\def\runningsection#1{\global\runningsection@true
\runningsectiontoks@{#1}}
**
In the definition of *\section*, via `*\hl@1*', instead of defining\linebreak
*\thechapter@*, we need to make an appropriate *\mark*; since *\mark*'s are
expanded, this requires a little more care, using now familiar tricks:
**
{\noexpands@
\edef\next@{\toks@={\ifx\Thepref@\empty\else
\Thepref@\null. \fi
\the\runningsectiontoks@}}%
\next@
\mark{\the\toks@}}
**
Here the *\edef\next@* makes *\next@* mean
\setbox0\hbox{\<*\section* number\>}
\setbox1\hbox{\<*\section* title\>}
**
\toks@="box0. "box1
**
so that *\next@* actually assigns *\toks@* that value, and then
**
\mark{\the\toks@}
**
produces the *\mark*, with no further expansions. The whole definition is
\CC**
\expandafter\def\csname hl@1\endcsname#1{%
\global\insection@true
"2
\medbreak
\ifrunningsection@\else\runningsectiontoks@{#1}\fi
\global\runningsection@false
"2
\noindent@@
"2
{\noexpands@
\edef\next@{\toks@{\ifx\Thepref@\empty\else
\Thepref@\null. \fi
\the\runningsectiontoks@}}\next@
\mark{\the\toks@}}%
"2
{\locallabel@
{\hl@@F\ifx\thelabel@@\empty\else\thelabel@@\space\fi}\bf
\ignorespaces#1\unskip\punct@{\null.}\addspace@\enspace}%
\par\nobreak\smallskip}
**
*\section* is the only heading level that will produce *\mark*'s, except
for *\chapter*, which emits *\mark{}*; so we should now define *\headline*.
On odd-numbered pages this will usually involve *\botmark*, unless *\botmark*
is empty, in which case we will use *\thechapter@*. However, *\botmark*
being ``empty'' cannot be checked using the test *\ifx\botmark\empty*, which
is never true, since *\botmark* is a primitive that is not equivalent to
*\empty*.
So we first define a routine
\CC**
\def\BotOrChap@#1\BotOrChap@{%
\def\next@{#1}\ifx\next@\empty\thechapter@
\else\ignorespaces#1\unskip\fi}
**
which will be used after an *\expandafter*
in the definition
\CC**
\headline={\unlabel@ \noset@
\def\\{\unskip\space\ignorespaces}%
\ifpart@\hfil
"2
\else
\iffirstchapterpage@\hfil
"2
\else
\ifodd\pageno
\hfil
\smc\expandafter\BotOrChap@\botmark\BotOrChap@
\hfil
\llap{\tenpoint\folio}%
"2
\else
\rlap{\tenpoint\folio}%
\hfil\smc\thechapter@
\hfil
\fi
\fi\fi}
**
The *\unlabel* and *\noset* are used in case some
*\Reset* or *\Offset* or
some *\label* or *\pagelabel*
appeared within a *\chapter* or *\section* title. The
definition of *\\* is provided for an unedited *\\* in a *\chapter* title.
*\subsection*, *\topic* and *\subtopic* are handled just as in the *paper*
style, so we won't repeat the definitions here.
The initializations for *\chapter* are a little more complicated than
in the *paper* style:
\CC**
\expandafter\def\csname HL@I1\endcsname{\Reset\hl11%
\Reset\tag1\Reset\claim1\Reset\Figure1\Reset\Table1%
\ifx\pref\empty\newpre\section{}\def\tag@P{}%
\def\claim@P{}\def\island@P{}%
"2
\else
\newpre\section{\pref.}\edef\tag@P{\pref.}%
\edef\claim@P{\pref.}\edef\island@P{\pref.}%
\fi
}
**
As before, we reset the *\section* counter to~*1* (there is no
*\keepsection* command for this style). Moreover, we also
want the numbering for displayed formulas, *\claim*'s, *\Figure*'s and
*\Table*'s to be reset to~*1*. If *\pref* is *\empty* (only because
the user has typed something like *\chapter""""*), then the ``pre'' material
for *\section*, *\tag*, *\claim* and all types of *\island* numbers should
be empty; otherwise it should be the *\chapter* number followed by a period.
Notice that we explicitly use *\edef\tag@P{\pref.}*, \dots, rather than
*\newpre*, since that takes less \tex\ processing, but we definitely want
*\newpre\section*, since that takes care of *\newpre\hl1* automatically.
The initializations for other heading levels are the same as in the *paper*
style.
\section{Footnotes}*\vfootnote@* is redefined exactly as in the *paper*
style, to get footnotes in 8~point type.
\section{Bibliography} Although *\makebib* isn't allowed in the *book* style,
*\UseBibTeX*
is allowed, causing
an *.aux* file to be written, on which \bibtex\ can operate, thereby creating
a *.bbl* file that can be used by the ``back matter file''.
The definition
from *lamstex.tex* has to be changed so that *\bibliography{...}* only
writes *\bibdata{...}* to the *.aux* file, without trying to read the *.bbl*
file. Also, *\bibliography@W* shouldn't be defined, since
**
\newword\bibliography
**
shouldn't be allowed in the main file, only in the back matter file.
\CC**
\def\UseBibTeX{%
\immediate\openout\auxwrite@=\jobname.aux
\let\cite=\BTcite@
\def\nocite##1{\immediate\write\auxwrite@
{\string\citation{##1}}}%
\def\bibliographystyle##1{\immediate\write\auxwrite@
{\string\bibstyle{##1}}}%
\def\bibliography##1{%
\immediate\write\auxwrite@{\string\bibdata{##1}}}}
**
\section{{\tt book.stf}}
The front matter style file *book.stf* does not require a mechanism to
prevent it from being read in twice. Aside for this, it
begins with the same basic settings as
*book.st* itself,
including the redefinition of *\makeheadline*
and *\makefootline*.
It also specifies
\CC**
\newnumstyle\page\roman
**
and
then loads the same fonts as *book.st*,
and defines *\tenpoint* and *\eightpoint* as
in that file.
Two new fonts
\CC**
\font\Bf=cmbx10 scaled \magstep1
\font\BF=cmbx10 scaled \magstep3
**
are also loaded; *\BF* is used for the `CONTENTS' headings, etc., while
*\Bf* is used for the Part entries in the table of contents (Chapter entries
will be printed in ordinary *\bf* and other heading level entries in *\rm*).
Pages with *\BF* headings are handled specially, with no running heads, and
page numbers at the bottom, and we have the flag
\CC**
\newif\ifspecialpage@
**
to indicate such pages.
The material for running heads will be stored in *\headline@*, initialized by
\CC**
\let\headline@=\relax
**
The *\makepiece* command is supplied for special pieces like
a Preface:
\CC**
\def\makepiece#1{\par\vfill\break
\global\specialpage@true
\gdef\headline@{\ignorespaces#1\unskip}%
\centerline{\BF\uppercase{\ignorespaces#1\unskip}}%
\vskip30pt plus10pt minus 10pt}
**
The argument *#1* is stored in *\headline@*, which will be used in the
running heads of this piece, except for the first page.
Here we assume that the heading fits on a single line. A variant
**
\makepiece#1\endmakepiece
**
command, allowing *\\* to indicate line breaks, could be specified in an
obvious way. If this were allowed, then there should probably be
a
**
\runningpiece
**
command to specify a shortened form for the running heads. This would work
like the *\runningchapter* command.
As with *paper.st*, for *\maketoc*
we now how to include many of the definitions from
*lamstex.stf*:
\CC**
\def\dotleaders ...
\def\Page@ ...
\long\def\widerthanhsize@ ...
"2
\long\def\setentry@ ...
"2
\def\endstrut@ ...
\newdimen\thehang@
"2
\long\def\longentry@ ...
"2
\newif\ifemptynumber@
\def\Style@ ... . . . \def\Style@@@@ ...
**
*\digits* isn't used, because the *\hl* entries are set differently.
Because the *\Style@ . . . \Style@@@@* complex involves *\style*, which
will be set to *\HL@@S* or *\hl@@S*, we need to provide definitions
for all cases that will occur:
\CC**
\expandafter\def\csname HL@S0\endcsname#1{#1\/}
\expandafter\def\csname HL@S1\endcsname#1{#1\null.}
\expandafter\def\csname hl@S1\endcsname#1{#1\null.}
\expandafter\def\csname hl@S2\endcsname#1{#1\null.}
\expandafter\def\csname hl@S3\endcsname#1{#1\/}
\expandafter\def\csname hl@S4\endcsname#1{#1\/}
**
As in *paper.st*, we
\CC**
\def\maketoc@W{Contents}
**
We will also need a new flag
\CC**
\newif\ifbib@
**
for one part of the contents.
The definition of *\maketoc* is something of a cross between the
definitions in *lamstex.stf* (page~\ref{STFMAKETOC})
and *paper.st* (section~\Sref{Pmaketoc}), adding extra information
needed for running heads and *\footline*:
\setbox0\hbox{\<extra material to set any}
\setbox1\hbox{ *\makebib* and *\makeindex* entries\>}
\CC**
\def\maketoc{\checkmainfile@\par\vfill\break
\begingroup
\unlabel@ . . . \lineskiplimipt=0pt
\def\HL ... \def\hl ...
\def\NameHL ... \def\Namehl ...
\NameHL0\part . . . \Namehl4\subtopic
"box0
"box1
\global\specialpage@true
\gdef\headline@{\maketoc@W}%
\centerline{\BF\uppercase\expandafter\maketoc@W}}%
\vskip30pt plus10pt minus10pt
\input\mainfile@.toc
\endgroup}
**
The \<extra material\> starts with
**
\def\makebib##1\Page##2##3##4##5{\bigbreak\bigskip\bigskip
\setentry@{\Bf##1}{}{\dotleaders}%
{\Page@{##2}{##3}{##4}{##5}}%
\bib@true}%
**
This definition is added for the situation where a *\makebib*
in the ``back matter file'' (see the next section) creates an entry in the
*.toc* file for the back matter file, which is then transferred to the
*.toc* file for the main file.
Then we
**
\let\biliography=\makebib
**
in case
*\bibliography* appears instead of *\makebib*; this is for the situation
where
*\UseBibTeX*
appeared in the main file, so that a *.bbl* file was created, and the
corresponding entry in the *.toc* file for the back matter file was
transferred to the *.toc* file for the main file.
Similarly, we add
**
\def\makeindex##1\Page##2##3##4##5{\ifbib@\bigskip\else
\bigbreak\bigskip\bigskip\fi
\setentry@{\Bf##1}{}{\dotleaders}%
{\Page@{##2}{##3}{##4}{##5}}}}%
**
in case a *\makeindex*
in the *.toc* file for the back matter file is transferred to the
*.toc* file for the main file. Note that the spacing before this entry
depends on whether or not a *\makebib* or *\bibliography* has already
appeared.
The definition of *\HL* in the above definition
has an extra clause for *\part*'s:
**
\ifnum\HLlevel@=0
\bigbreak\bigskip
"2
\begingroup
\def\\{\unskip\space\ignorespaces}%
"2
\setentry@{\Bf\def\next@{##2}\ifx\next@\empty\else
\uppercase{##2} \fi
\let\style=\HL@@S\hbox to35pt{\Style@##3\Style@\hss}\ifemptynumber@
\nobreak\hskip-35pt\fi
\uppercase{\ignorespaces##4\unskip}}{}\hfil{}%
"2
\endgroup
\nobreak\smallskip
"2
\else
\ifnum\HLlevel@=1
. . .
\else
\Err@ ...
\fi}
**
So the first argument of *\setentry@* contains the
\medskip\font\Bf=cmbx10 scaled \magstep1
\leftline{\Bf PART \hbox to35pt{I\hfil} PART TITLE}
\medskip
\noindent
with the Part title, in *\uppercase*,
starting 35~points from the word `PART' (but if there is no part number,
we *\hskip* back 35~points). We use\linebreak
*\uppercase{#2}*, since, as mentioned on
page~\ref{UCPART}, the *.toc* file has
`*\HL@W0*', which is `*Part*', rather than `*PART*', allowing other
front matter style files to handle things differently.
The second argument (which normally would
be the part title) is empty; the third argument, normally *\dotleaders*
is *\hfil*, and the fourth argument, normally *\Page...* is also empty, so
that `Part' entries are printed without dot leaders or page numbers.
\medskip
Similarly, the definition of *\makelist* in *book.stf*
is almost the same as that in
*lamstex.stf*, except that we add
**
\global\spsecialpage@true
\gdef\headline@{\ignorespace#2\unskip}
**
and use
**
\BF\baselineskip=22pt
**
for setting the heading instead of *\bf*.
Finally, *\footline* and *\headline* are reset as in *book.st*, except
using the flag *\ifspecialpage@* rather than the flags *\ifpart@*
and\linebreak
*\iffirstchapterpage@*.
\section{{\tt book.stb}}
The back matter style file *book.stb* also begins with the same basic
settings as *book.st*, except that redefinition of *\makeheadline* and
*\makefootline* is deferred; and then it loads the same fonts as before.
Then we have numerous definitions from *lamstex.stb*:
\CC**
\def\adjustpunct@ ...
\def\ignorepars@ ...
\def\ignorepars@@ ...
"2
\newcount\ctype@
\newcount\Ctype@
"2
\newif\ifleftcolbreak@
\def\cbreak@ ...
"2
\newif\ifletter@
\newtoks\marktoks@i . . . \newtoks\marktoks@v
"2
\newif\ifentry@
\newcount\dii@
\def\Topage@ ...
**
as well as
\CC**
\newdimen\pageheight@
\pageheight@=\vsize
"2
\newdimen\doublepageheight@
\doublepageheight@=2\pageheight@
\advance\doublepageheight@ by 1pc
"2
\newdimen\pagewidth@
\pagewidth@=\hsize
**
and then we redefine *\makeheadline* and *\makefootline* in terms
of *\pagewidth@*:
\CC**
\def\makeheadline{%
\hbox{\botsmash{\hbox to\pagewidth@
{\vbox to8.5pt{}\the\headline}}}%
\nointerlineskip\vskip26pt}
\def\makefootline{\baselineskip=2.5pc\relax
\hbox to \pagewidth@{\the\footline}}
**
As in *lamstex.stb*,
we will need a new flag for the first page of the index,
\CC**
\newif\iffirstindexpage@
**
Recall that in *lamstex.stb* it is the definition of *\combinecolumns@*
that actually prints the heading at the top of the first page.
The same is true in *book.stb*, so we first
\CC**
\def\makeindex@W{Index}
**
and declare the font
\CC**
\font\Bf=cmbx10 scaled \magstep1
**
Then the definition of *\combinecolumns@* from *lamstex.stb* is modified as
follows:
\CC**
\def\combinecolumns@{%
\setbox\outbox@=\vbox{\makeheadline
\vbox to\pageheight@{\boxmaxdepth=\maxdepth
\iffirstindexpage@
\vbox to30pt{%
\hbox to\pagewidth@{\hfil\Bf
\uppercase\expandafter{\makeindex@W}\hfil}%
\vfil}%
\nointerlineskip
\fi
\wd0=\hsize \wd2=\hsize
\setbox0=\hbox to\pagewidth@{\box0 \kern1pc \box2}%
\dimen@=\dp0 \box0 \kern-\dimen@\vfill}%
\makefootline}%
{\noexpands@\let\style=\relax
\shipout@\box\outbox@
}%
\global\vsize=\doublepageheight@
\global\firstindexpage@false
\advancepageno}
**
Then we continue with other material from *lamstex.stb*:
\CC**
\newdimen\prevcoldepth@
\def\doublecolumns@ ...
\def\continue@ ...
\newif\ifshortlastcolumn@
\def\balancecolumns@ ...
**
With these definitions---used mainly for the index---out of the way, we
first start on the bibliography.
As with *book.stf*, we need
\CC**
\newif\ifspecialpage@
\let\headline@=\relax
**
The definition of *\makebib* is similar to that in *paper.st*, except
that we also write to the *.toc* file (compare page~\ref{XXZZXX}):
\C**
\def\makebib{\par\vfill\break
\global\specialpage@true
\gdef\headline@{\makebib@W}%
"2
\begingroup
"2
\eightpoint
"2
\sfcode`\.=1000 \everypar{}\parindent=0pt
"2
\def\nopunct{\nopunct@true} \def\nospace{\nospace@true}%
\nopunct@false\nospace@false
"2
\def\lkerns@{\null\kern-1sp\kern1sp}%
\def\nkerns@{\null\kern-2sp\kern2sp}%
"2
\hbox to\pagewidth@
{\hfil\Bf\uppercase\expandafter{\makebib@W}\hfil}%
"2
\iftoc@
\expandafter\unmacro@\meaning\makebib@W\unmacro@
{\noexpands@
\edef\next@{\write\toc@{\noexpand\noexpand
\noexpand\makebib{\macdef@}}}\next@}%
\write\toc@{\noexpand\Page
{\number\pageno}{\page@N}{\page@P}{\page@Q}^^J}%
\fi
\nobreak\bigskip}
**
\medskip
If *\UseBibTeX* was specified in the main file, and a *.bbl* file
was created, then instead of a *\makebib"allowbreak..."allowbreak\endmakebib*
region, the user can simply type
**
\bibliography
**
(but with no argument).
We will need to define
\CC**
\def\bibliography@W{Bibliography}
**
so that
**
\newword\bibliography
**
can be used prior to this (in *lamstex.tex* this definition is
made by\linebreak
*\UseBibTeX*, which won't appear in the back matter file).
The redefinition of *\bibliography*, with no argument, will begin
with\linebreak
*\checkmainfile@*, since *\mainfile@.bbl* is the file we will want to
*\input*:
\CC**
\def\bibliography{\checkmainfile@
\immediate\openin\bbl@=\mainfile@.bbl
\ifeof\bbl@
\W@{No .bbl file}%
\else
\immediate\closein\bbl@
\begingroup
\input bibtex
\input\mainfile@.bbl
\endgroup
\fi}%
**
Recall that *bibtex.tex* defines *\begin{thebibliography}{...}* in\linebreak
terms
of *\begingthebibliography@{...}*, which now has to be redefined to give
the same sort of information and formatting as *\makebib* for this file:
\CC**
\def\beginthebibliography@#1{\par\vfill\break
\global\specialpage@true
\gdef\headline@{\makebib@W}%
"2
\eightpoint
\setbox0=\hbox{#1\ }\bibindent@=\wd0
\sfcode`\.=1000 \everypar{}\parindent=0pt
"2
\hbox to\pagewidth@
{\hfil\Bf\uppercase\expandafter{\bibliography@W}\hfil}%
"2
\iftoc@
\expandafter\unmacro@\meaning\makebib@W\unmacro@
{\noexpands@
\edef\next@{\write\toc@{\noexpand\noexpand
\noexpand\bibliography{\macdef@}}}\next@}%
\write\toc@{\noexpand\Page
{\number\pageno}{\page@N}{\page@P}{\page@Q}^^J}%
\fi
\nobreak\bigskip}
**
The definition of *\makeindex* is virtually the same as in *lamstex.stb*,
except that we again write to the *.toc* file, and set up information for
the heading levels and foot line,
\setbox0\hbox{\<material from *lamstex.stb* definition,}
\setbox1\hbox{\qquad starting with *\let\asterisk="1*, and}
\setbox2\hbox{\qquad ending with *\def\shortlastcolumn* ... \>}
\CC**
\def\makeindex{\checkmainfile@\par\vfill\break
\iftoc@
"2
\expandafter\unmacro@\meaning\makeindex@W\unmacro@
"2
{\noexpands@
\edef\next@{\write\toc@{\noexpand\noexpand
\noexpand\makeindex{\macdef@}}}\next@}%
"2
\write\toc@{\noexpand\Page
{\number\pageno}{\page@N}{\page@P}{\page@Q}^^J}%
\fi
"2
\global\specialpage@true
"2
\global\firstindexpage@true
"2
\gdef\headline@{\makeindex@W}%
"2
\begingroup
"box0
"box1
"box2
"2
\hsize=14pc
"2
\global\vsize=\doublepageheight@
"2
\maxdepth=\maxdimen
"2
\global\firstindexpage@true
"2
\global\advance\vsize by -60pt
"2
\everypar{}\parindent=0pt
"2
\eightpoint
\rightskip=0pt plus3em
\spaceskip=.3333em \xspaceskip=.5em
\output={\doublecolumns@}%
\input\mainfile@.xdx
\mark{}%
\output={\balancecolumns@}\vfil\break\endgroup
\global\vsize=\pageheight@}
**
And then we reset *\headline* and *\footline*, as in *book.stf*.
\chapter The {\tt letter} style\endchapter
The \lamstex\ *letter.st* is based on the format for business letters
discussed at the beginning of Appendix~E of {\it The \tex book}, with numerous
added features, and some change of notation.
The letter format in {\it The \tex book\/} has the unfortunate feature that
*plain* \tex's *\item* command doesn't work well, since it indents by
*\parindent*, which is~*0pt* in this format. Fortunately, that problem
doesn't occur with \lamstex's *\list \item ...* command. We do change
*\listbi@* to
**
\def\listbi@{\penalty50 \bigskip}
**
(the default value has a *\medskip* instead), since this seems to look better
when *\parindent* is ~*0pt*.
Although there are several
interesting features in *letter.st*,
most of them have almost nothing to do with
\lamstex\ in general, so we won't discuss them here.
\chapter The {\tt amsppt} style\endchapter
|