summaryrefslogtreecommitdiff
path: root/info/maltby-intro.tex
blob: d492d9f5f02073b80e901a48e0ed6b761af0cd52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
% introduction to \TeX
% written for course at unp, november 1992
% written in \LaTeX
% with the NFSS, but should work with normal \LaTeX

\documentstyle[12pt]{report}

\begin{document}
\pagenumbering{roman}

\newcommand{\contact}{Gavin Maltby (Maths Department, UNP)}

\newcommand{\AmSLaTeX}{{\protect\the\textfont2 A}\kern-.1667em\lower.5ex\hbox
{\protect\the\textfont2 M}\kern-.125em{\protect\the\textfont2 S}-\LaTeX}


\newcommand{\AmSTeX}{{\protect\the\textfont2 A}\kern-.1667em\lower.5ex\hbox
{\protect\the\textfont2 M}\kern-.125em{\protect\the\textfont2 S}-\TeX}

\newcommand{\usertype}[1]{\vspace{3pt plus 3pt}\centerline{%
#1}\vspace{3pt plus 3pt}}

\newcommand{\BibTeX}{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}

\newcommand\bs{\char '134 }   % A backslash character for \tt font
\newcommand{\lb}{\char '173 } % A left brace character for \tt font
\newcommand{\rb}{\char '175 } % A right brace character for \tt font

\newenvironment{syntax}[1]{\smallskip\hspace{1.3cm}\tt\bs#1}{\smallskip}
\newcommand{\opt}[1]{[{\em #1\/}]}
\newcommand{\man}[1]{\{{\em #1\/}\}}

\long\def\result#1{{\smallskip\moveright0.1\textwidth\vbox{\hsize 0.8\textwidth\footnotesize#1}}\smallskip}

%\newcommand{\nsubsubsection}[1]{\subsubsection{#1}\addcontentsline{toc}
%{subsection}{\quad\quad#1}}
\newcommand{\nsubsubsection}[1]{\subsection{#1}}

\newenvironment{mathegs}%
{\medskip\footnotesize\begin{center}%
\renewcommand{\arraystretch}{1.3}
\begin{tabular}{ll}%
\it \makebox[190pt][l]{Type} & \it To produce\\}
{\end{tabular}\end{center}\medskip}

\title{An introduction to \TeX\ and friends}
\author{Gavin Maltby}
\date{November 1992}

\maketitle
\tableofcontents
\listoftables
\newpage
\pagenumbering{arabic}

\chapter{Getting acquainted with \TeX}
\TeX\ is well known to be {\em the\/} typesetting package,
and a vast cult of \TeX\ lovers has evolved.  But to the beginning
\TeX\ user, or to someone wondering if they should bother changing
to \TeX, it is often not clear what all the fuss is about.  After all,
are not both WordPerfect and Ventura Publisher capable of
high quality output?  Newcomers have often already seen what \TeX\
is capable of (many books, journals, letters are now prepared with \TeX)
and so expect to find a tremendously powerful and friendly package.
In fact they {\em do}, but that fact is well hidden in one's initial
\TeX\ experiences.  In this chapter we describe a little of what
makes \TeX\ great, and why other packages cannot even begin
to compete.  Be warned that a little patience is required---\TeX's
virtues are rather subtle to begin with.  But when the penny drops,
you will wonder how you ever put up with anything different.

\section{The spirit of \TeX}
In order to really appreciate \TeX\ one needs to get a feel
for what I call the ``spirit'' of \TeX.  When \TeX\
appears to be making me work overtime to achieve something
that I think ought to be perfectly straightforward, consultation
with the \TeX\ spirit shows me the error of my ways.

\subsection{\TeX\ is a typesetter, not a word-processor}
% we chat about the pros and cons of this;
% talk about compilation, previewing, printing
% start to convince of the essential power of this
% a few examples
% macro packages & style files
\TeX\ was designed with no limiting application in mind.
It was intended to be able to prepare practically any document---from
a single page all-text letter to a full blown book with huge numbers
of formulae, tables, figures etc.  The size and the complexity of a
{\TeX}able document is limited only by hardware considerations.
Furthermore, \TeX\ seeks to achieve all this whilst setting
typesetting standards of the highest order for itself.  The expertise
of generations of professional printers has been captured in
\TeX, and it has been taught all the tricks of the trade.

Historically, printers prepared a document by placing metal
characters in a large tray and arranging and binding them
to form a page.  This was very precisely done, but the ultimate
precision was limited because of the mechanical nature of
things and by time considerations.  \TeX\ prepares a page
in an analogous manner (putting your characters and
formulae into ``boxes'' which are then ``glued'' together
to form the page), but has the advantage of enormous
precision because placement calculations are performed
by computer.  Indeed, \TeX's internal unit (the ``scaled
point'') is about one-hundredth of the wavelength of
natural light!

``But conventional word processors run on computers , too'',
you object.  Yes, but their fundamental limitation is that
they try to ``keep up'' with you and ``typeset'' your document
as you type.  This means that it can only make decisions at
a local level (eg, it decides where to break a line just as you
type the end of the line).  \TeX's secret is that it waits until
you have typed the {\em whole\/} document before it typesets
a single thing!  This means that \TeX\ can make decisions of
a global nature in order to optimise the aesthetic appeal of
your document.  It has been taught what looks good and what
looks bad (having been given a measure of the ``badness'' of
various possibilities) and makes choices for your document that
are designed to make it ``minimally bad''.

But \TeX's virtues run much deeper than that, which is just as well
because it is possible to get satisfactory, though imperfect, results from
some word processors.  One of \TeX's strongest points is its ability
to typeset complicated formulae with ease.  Not only does \TeX\
make hundreds of special symbols easily accessible, it will lay them
out for you in your formulae.  It has been taught all the spacing,
size, font, \ldots conventions that printers have decided look
best in typeset formulae.  Although, of course, it doesn't understand
any mathematics it knows the grammar of mathematics---it
recognises binary relations, binary operators, unary operators, etc.\
and has been taught how these parts should be set.  It is consequently
rather difficult to get an equation to look bad in \TeX.

Another advantage of compiling a document after it is typed is that
cross-referencing can be done.  You can label and refer back to
chapters, sections, tables etc.\ by {\em name\/} rather than absolute
number, and \TeX\ will number and cross-reference these for you.
Similarly, it will compile a table of contents, glossary, index and bibliography
for you.

Essential to the spirit of \TeX\ is that {\em it formats the document whilst
you just take care of the content}, making for increased productivity.
The cross-referencing just mentioned is just part of this.  Many more
labour-saving mechanisms are provided for through {\em style files}.
These are generic descriptions of classes of documents, teaching \TeX\
just how each class likes to be formatted.  This is taught in terms
of font preferences, default page sizes, placement of title, author, date,
etc.  For instance, a {\tt paper} style file could teach \TeX\ that
when typesetting a theorem it should embolden the part that states
the theorem number and typeset the text of the theorem statement
in slanted Roman typeface (as in many journals).  The typist simply
provides and indication that a theorem is being stated, and then
types the text of the theorem {\em without\/} bothering to choose
any fonts or do any formatting---all that is done by the style
file.  Style files exist for all manner of document---letters,
articles, papers, books, proceedings, review articles, and so on.

In addition to style files, there are {\em macro packages}.  A
{\em macro\/} is just a definition of a new \TeX\ command
in terms of existing ones.  Don't think small when you think of
macros!  When typing a document that has a lot of repetition
in it, say the same expression is used again and again in different
different equations, you can define a macro in  your document
to abbreviate that expression.  But macros can teach \TeX\
how to typeset all sorts of complicated structures, not just
parts of an equation.  Many macro packages (files that are
just collections of definitions) have been written to teach \TeX\
all sorts of applications.  There are specialist maths packages
(\AmSTeX, \AmSLaTeX), general purpose packages (\LaTeX),
packages for setting tree diagrams, Feynmann diagrams,
languages like Chinese, Arabic and Ancient Greek,
orchestral scores, and many, many more.  All these are
freely available, a spin-off of the giant \TeX\ cult.

Another facet of the design of \TeX\ allows it to use
practically {\em any\/} output device.  In fact, \TeX\
doesn't talk to any printers, screens, phototypesetters
at all!  Instead, when a document is compiled a
{\em device independent\/} ({\tt .dvi}) is produced---%
\TeX\ does not compile with any particular output
device in mind.  Printer drivers are then invoked on
this {\tt .dvi} file and, in consultation with the font
data for that printer, produce output suitable for the
particular device.  You can choose an HP Laserjet
driver, or an Apple LaserWriter driver, or a dot matrix
driver etc.  All use the same {\tt .dvi} file as input (and
remember the material in there is set to enormous
accuracy) and attempt to image that file on the particular
device as faithfully as possible.  If you are using a top of the
line laser printer or phototypesetter, then \TeX's
massive internal precision will not be wasted.  Alternatively,
a dot matrix printer
will give a coarse approximation of the ideal image that is
suitable only for proof-reading.  In addition to portability,
these {\tt .dvi} files help ensure that there are very few printing
surprises when you move from one device to another:  how many times
has your favourite word-processor made you reformat a document when
you wish to change printers?

There are many other motivations one could cite for the
superiority of \TeX.    But it is time that we started to get
our hands dirty.  One last comment:  \TeX\ was not designed
to supplant secretaries and professional printers---it was designed
to aid them in their work and, in the words of the \TeX\ designer
Donald Knuth, allow them to ``go forward and create masterpieces
of the publishing art''.% or was that typesetting art?
It also allows those who generate the material
to be typeset---mathematicians, physicists, computer scientists, etc---to
prepare their own documents in a language that is intimately linked
to the language we use for writing such material.

The novice reader will still have no idea of what a \TeX\ source file
looks like.  Indeed, why do we keep referring to it as a {\em source
file}?  The fact of the matter is that \TeX\ is essentially a
{\em programming language}.  Just as in any compiled language
(e.g.,\ Pascal, C) one prepares a source file and submits it to the
compiler which attempts to produce an object file ({\tt .dvi} file
in the \TeX\ case).  To learn \TeX\ is to learn the command syntax
of the commands that can be used in the source file.

\subsection{Typical \TeX\ interfaces}
% multicompter setting
% device independence
% command line level and script files
% \TeX\ shells
\TeX\ was designed to run on a multitude of computers.  It is therefore
the case that the documentation for \TeX\ and its ``friends''
\LaTeX, \AmSTeX, etc.\ is not computer specific.  Only
command syntax is described---i.e., the content of your source file---but
few details of how to get from there to a printout are given.  Those details
are left to site-specific documents.

The average user loses little in using \TeX\ on, say, a PC rather than
on a bigger machine.  Indeed, compilation times on the
new PCs begin to rival those on a Sun Sparc
Station 2 (no slouch).  Running on top of DOS can cause memory problems
when very large documents are being prepared.  That aside, the quality
of the document is not affected because of the careful design of \TeX---%
whether you work on a a machine with massive floating point precision or
a modest XT the {\tt .dvi} files produced on compilation will be 
identical; and when those files are submitted to printer equivalent
printer drivers (say for an HP LaserJet III attached to a Sun in one case
and a PC in the other) the output will be identical because the font
information they draw on is identical.

By the nature of \TeX\ most time is spent editing the source document
(before submitting it for compilation).  No special interface is necessary
here, you just use your favourite text editor (perhaps customising it
to enhance {\TeX}nical typing.  Thus \TeX\ user interfaces are usually
small and simple, often even missing.  One frequently uses \TeX\ at
command line level, just running the editor, compiler etc.\ as you need them.
Sometimes a {\TeX}shell program is present, which runs these for you
when you choose various menu options.

Whatever the interface, there are just a few basic steps to preparing
a document:
\begin{enumerate}
\item Choose a document style to base your document on (e.g., letter, article).
\item Glance through the material you have to type, and decide what
	       definitions might be made to save you a lot of time.  Also, decide on
	       the overall structure of the prospective document (e.g., will the largest
	       sectional unit be a chapter or a part?).  If you are going to compose as
	       you type, then pause a moment to think ahead and plan the structure
	       of your document.  The importance of this step cannot be overstressed,
	       for it makes clear in {\em your\/} mind what you want from \TeX.
\item Prepare your input file, specifying only the content and the logical
	       structure (parts, sections, theorems,...) thereof and forgetting about formatting details.
\item Submit your input, or source, file to the \TeX\ compiler for compilation
		of a {\tt .dvi} file.
\item If the compiler finds anything in your source file strongly objectionable,
	       say incorrect command syntax, then return to editing.
\item Run a {\em previewer\/} to preview your compiled document on the
	       screen.  Resolution is only limited by your screen, and can be very
		good indeed on some modern monitors.
\item Go back to editing your document until glaring errors have been taken
		care of.
\item Make a printout of your compiled document, and check for those errors that
		you failed to notice on the screen.
\end{enumerate}
Performing these steps may be effected through typing at the system prompt
(barebones technique) or through choosing menu options in a {\TeX}shell program.
The latter will probably provide some conveniences to make your life easier.

If you think this sounds like a lot of work, it is time that you consult with the
\TeX\ spirit!  Sure your first couple of tries may be hesitant, but before long
you'll find that you can take {\em less\/} time to prepare a document on \TeX\
than on any other package.


\chapter{Getting started with \LaTeX}
\section{Why start with \LaTeX?}
To answer this question we must say a little more about
some of  the macro packages we mentioned earlier.

The \TeX\ typesetting system was designed by the eminent Stanford
computer scientist Donald Knuth, on commission from the American
Mathematical Society.  It was designed with enormous care, to be
ultimately powerful and maximally flexible.  The enormous success
of Knuth's design is apparent from the vast number of diverse applications
\TeX\ has found.  In reading the following you must keep one thing clearly
in mind:  {\em there is only \TeX\ language, and all the other packages whose
names end in the suffix \mbox{-\TeX} simply harness it's power via a whole
lot of complicated macro definitions}.

\TeX\ proper is a collection of around 300 so called {\em primitive\/}
typesetting commands.  These work at the very lowest level, affording
enormous power.  But to make this raw power manageable, some macros
must be defined to tame raw \TeX\ somewhat.  The standard set
of macros is called Plain \TeX, and consists of about 600 macro definitions.
It is clear that these definitions must be made in terms of \TeX\ primitives,
or in terms of previously made definitions.  Plain \TeX, however, is still
no place for the timid.  A strong working knowledge of \TeX\ is still required
to understand the ins and outs of Plain \TeX.

In the few years after the initial \TeX\ release (1982), the macro packages
\AmSTeX\ and \LaTeX\ were born.  \AmSTeX\ was written by Michael
Spivak, also on commission from the AMS.  This package was designed to
facilitate the preparation of the numerous books, journals, and review
indices that fall under the auspices of the AMS and its affiliates.
Married to the macro package was a style file---the AMS preprint style.
This was distributed along with the macro package, so that authors
submitting to journals could use it in the preparation of their articles.
The given style was based on the style used by the {\em Journal of the
American Mathematical Society}, i.e., it conformed to their page sizes
and typographical conventions.  This meant that people around the world
produced papers that were all based on the same style.  The clever part
is this:  when a source file is submitted to a journal {\em other\/} than
the {\em  Journal of the AMS}, the journal staff simply substitute their
style file for the AMS preprint style and the paper will appear completely
different {\em with no other changes to the source code\/}!  To create
their style file, a journal just needed to tweak the standard AMS prepint
style:  for instance, the original preprint style places author addresses
at the very end of a paper;  If a journal wishes this to appear on the first
page then they just modify their in-house version of the style file, and
the change will be effected without having to change the file submitted
by the author.

\LaTeX\ was written for more general usage.  It lacks some of the
mathematical finesse inherited by \AmSTeX\ from the vast experience of the AMS
technical staff, but more than makes up for this in its ability to enhance
the typesetting of letters, books, poetry, etc.  \LaTeX\ also scores high
points for its enhanced command syntax.

With \AmSTeX\ and \LaTeX\ being released at around the same time (1984--1985),
there were born many \AmSTeX\ literate but \LaTeX\ illiterate users,
and conversely.  \LaTeX\ was easier to learn because of its more friendly
syntax, and also provided powerful cross-referencing commands that
\AmSTeX\ did not.  So the AMS commissioned another project to
furnish \LaTeX\ users with the additional power of \AmSTeX\
while not compromising the \LaTeX\ command syntax or
cross-referencing commands.  This resulted in the \AmSLaTeX\
macro package and associated style file for submission to journals.

{\em That\/} is why we will kick off our \TeX\ careers with \LaTeX!
It is easier to learn and provides many conveniences, and the user
who requires additional mathematical typesetting prowess can
easily move on to \AmSLaTeX.  Much of what we say will be true
for \TeX\ itself, but we shall regard \LaTeX\ as the lowest
common-denominator.  By far the majority of \LaTeX\ and
\AmSLaTeX\ users will never have to learn ``raw'' \TeX, for they will
be shielded from direct exposure by the numerous powerful macro packages.
In the rare case that something way out of the ordinary is required,
the local \TeX\ guru can be consulted.

\section{\LaTeX\ formats, and we compose}
% free form nature of input file
The {\em free form nature\/} of the input file is essential to the
spirit of \TeX.  As we type, we do not concern ourselves with linebreaks
and pagebreaks so much as the content of what we are typing.  In fact,
we'll see that \TeX\ will choose nice line breaks even for bizarre looking
input.  This is just part of the concept of only having to describe the
{\em logical\/} structure of the document to \LaTeX, and not worry
about nuisance-value formatting details.  We inform \LaTeX\
of the logical structure of our document by telling it when to begin
a new paragraph, subsection, section, chapter, theorem, definition,
remark, poem, list etc.  When typing a particular element of the logical
structure, we need pay little attention to how we lay our source file out.

A consequence of this is that we have to go to a bit of effort to mess things
up.  Starting a new line, for instance, entails more than just pressing
Return because \LaTeX\ will just regard the next word you type
as exactly that---the next word in the paragraph.  You have to specifically
ask for a line to be terminated.  Things like this may seem to be a bit of a
nuisance, but it is a small price to pay for the automatic formatting that
necessitated it.  Further, such small inconveniences have been localised
to rare events.  I have, for instance, not once forced a new line up until
this point in the present document.

\section{Document styles}
We have explained the concept of a document style during our discussion
of the virtues of \TeX\ and the discussion of \AmSTeX.  It remains to
name a few, and indicate where they would be used.  One {\em always\/}
has to choose a document style when preparing a document with \LaTeX.

The basic document styles in \LaTeX\ are {\tt letter}, {\tt article}, {\tt report},
and {\tt book}.  Many more are available, but these few cover the majority
of straightforward applications.  This is because styles are not rigid---you
can impose your own parameter choices if you want.  So one chooses the
style that most closely approximates the document you have in mind, and
performs some minor tweaks here and there.  The {\tt article} style is
used for documents that are to have the appearance of a journal or
magazine article. The {\tt report} style is usually used
for larger documents than the {\tt article} style.  These styles really only
differ in their choice of default page size, font, placement of title and author,
sectional units, etc.\ and on how they format certain \LaTeX\ constructs.
You use the same \LaTeX\ commands in each.  Since the
examples here will be small, we will choose to use the {\tt article} document
style.

There are a number of possible options with each document style.  The syntax
for choosing a document style follows.  Don't worry if this leaves you with no idea
of how to choose a document style, for we will soon be seeing some examples.  Also,
remember that an argument in square brackets is optional, and can omitted
altogether (including the brackets).
\begin{syntax}{documentstyle}
\opt{options}\man{style}
\end{syntax}
where {\em style\/} is the main document style (eg {\tt report})
and the optional argument {\em options\/} is a list of document style options chosen
from the following list:
\begin{itemize}
\item[\tt 11pt] chooses 11-point as the default font size for the document, instead
			  of the default 10-point.
\item[\tt 12pt] chooses 12-point as the default font size.
\item[\tt twoside] formats output as left and right pages, as in a book.
\item[\tt twocolumn] produces two-column magazine like output.
\item[\tt titlepage] applies to the {\tt article} style only, causing the
	      title and abstract to appear on a page each.
\end{itemize}

In fact there are many, many more document style options but we
won't mention any more here.

\section{Preparing a non-mathematical document}
We assume that you have read the local guides to \TeX\ at your site and have
decided which system environment you want to work in.  There you have been
shown how to perform the steps required to produce a printed document from a
\LaTeX\ source file.

\subsection{Sentences and paragraphs}
Let's create our very first \LaTeX\ document, which will consist
of just a few paragraphs.

As mentioned above, paragraph input is free-form.  You type the words
and separate them by spaces so that \LaTeX\ can distinguish between
words.  For these purposes, pressing Return is equivalent to inserting
a space---it does not indicate the end of a line, but the end of a word.
You tell \LaTeX\ that a sentence has ended by typing a period followed
by a space.  \LaTeX\ ignores extra spaces; typing three or three thousand will
get you no more space between the words that these spaces separate than
typing just one space.  Finally, you tell \LaTeX\ that a paragraph has
ended by leaving one or more blank lines.
In summary: \LaTeX\ concerns itself only with the
logical concepts end-of-word, end-of-sentence, and end-of-paragraph.
Sounds complicated?  An example should clear things up:

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\documentstyle{article}
\begin{document}
Words within a sentence are ended by spaces.  One space
between words  is     equivalent      to any number. We are only
interested in separating      one    word      from        the
next, not in formatting       the space between them.
For these purposes, pressing Return
at the end of a line
and starting a new word on the next line
just serves to separate
words, not to cut a line short.
The end of a sentence is indicated by a period
followed by one or more spaces.

The end of a paragraph is indicated by leaving a blank line.
All this
means that we can type without too much regard for layout, and
the typesetter will sort things out for us.
\end{document}
\end{verbatim}
}
\noindent produces the result

\result{%
Words within a sentence are ended by spaces.  One space
between words  is     equivalent      to any number. We are only
interested in separating      one    word      from        the
next, not in formatting       the space between them.
For these purposes, pressing Return
at the end of a line
and starting a new word on the next line
just serves to separate
words, not to cut a line short.
The end of a sentence is indicated by a period
followed by one or more spaces.

The end of a paragraph is indicated by leaving a blank line.  All this
means that we can type without too much regard for layout, and
the typesetter will sort things out for us.
}

Perhaps you would like to try running \LaTeX\ on the above input.
Consult your local guide for details.

Note that we have learned more than just how \LaTeX\ recognises words,
sentences and paragraphs.  We've also seen how to specify our choice
of document style and how to tell \LaTeX\ where our document begins
and ends.  Any material that is to be printed must lie somewhere between
the declaration of \verb@\begin{document}@ and that of \verb@\end{document}@.
Definitions that are to apply to the entire document can be made before
the declaration of the document beginning.  The specification of
document style must precede all other material.

In future examples we won't explicitly display the commands that
select document style and delimit the start and end of the document.
But if you wish to try any of the examples, don't forget to include those
commands.  The {\tt article} document style will do for most of our examples.
Of course, the preceding example looks not at all like an article because
it is so short and because we specified no title or author information.

Most of what you need to know to type regular text is contained in the
example above.  When you consider that by far the majority of any document
consists of straight text, it is obvious that \LaTeX\ makes this fabulously straightforward.
\LaTeX\ will do all the routine work of formatting, and we simply get on with the
business of composing.

\LaTeX\ does more than simply choose pleasing line breaks and
provide natural spacing when setting a paragraph.  Remember we
said that \TeX\ has inherited the knowledge of generations of
professional printers---well part of that knowledge includes
being on the look-out for {\em ligatures}.  These are combinations
of letters within words which should be typeset as a single special
symbol because they will ``clash'' with each if this is not done.
Have a look at these words
\begin{center}
flight, flagstaff, chaff, fixation
\end{center}
and compare them with these
\begin{center}
f{l}ight, f{l}agstaf{f}, chaf{f}, f{i}xation
\end{center}
See the difference?  In the first set I let \LaTeX\ run as it usually does.
In the second I overruled it somewhat, and stopped it from creating
ligatures.  Notice how the `fl', `ff', and `fi' combinations are different
in the two sets---in the former they form a single symbol (a ligature)
and in the latter they are comprised of two disjoint symbols.  There
are other combinations that yields ligatures, but we don't have to bother
remembering any of them because \LaTeX\ will take care of these, too.

Notice, too, that \LaTeX\ has been taught how to hyphenate the
majority of words.  It will hyphenate a word if it feels that the overall
quality of the paragraph will be improved.  For long words it has been
taught several potential hyphenation positions.

\LaTeX\ also goes to a lot of trouble to try to choose pleasing page
breaks.  It avoids ``widows'', which are single lines of a paragraph
occurring by themselves at either the bottom of a page (where
it would have to be the first line of a paragraph) or at the top
of a page (where it would have to be the last).  It also
``vertically justifies'' your page so that all pages have exactly
the same height, no matter what appears on them.  As testimony
to the success of the pagebreaking algorithm, I have (to
this point) not once chosen a page break in this document.

\subsection{Punctuation}
Typists have a convention whereby a single space is left after a
mid-sentence comma, and two spaces are left after a sentence-ending
period.  How do we enforce this if \LaTeX\ treats a string of spaces just like
a single one?  The answer, unsurprisingly, is that we {\em don't}.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
To have a comma followed by the appropriate space,  we simply
type a comma follows by at least one space. To end a sentence
we type a period with at least one following space.     No space will
be inserted if we type a comma or period followed straight away
by something other than a space, because there are times when
we won't require any space, i.e., we do what comes narurally.
\end{verbatim}
}
\noindent will produce

\result{%
To have a comma followed by the appropriate space,  we simply
type a comma follows by at least one space. To end a sentence
we type a period with at least one following space.     No space will
be inserted if we type a comma or period followed straight away
by something other than a space, because there are times when
we won't require any space, i.e., we do what comes naturally.
}

\LaTeX\ will produce suitable space after commas, periods,
semi-colons and colons, exclamation marks, question marks etc.\
if they are followed by a space.
In stretching a line to justify to the
right margin, it also knows that space after a punctuation
character should be more ``stretchable'' than normal inter-word
space and that space after a sentence-ending period should be stretched
more than space after a mid-sentence comma.  \TeX\ knows the nature of
punctuation if you stick to the simple rules outlined here.  As we've already
said, those rules tell \LaTeX\ how to distinguish consecutive words,
sentences, phrases, etc.

Actually, there is more to ending sentences than mentioned above.
Since \LaTeX\ cannot speak English, it works on the assumption
that {\em a period followed by a space ends a sentence unless the period
follows a capital
letter}.  This works most of the time, but can fail.  To get a normal
inter-word space after a period that doesn't end a sentence,
follow the period by a {\em control space}---a \verb*@\ @
(a {\tt \bs} character followed by a space or return).  Very
rarely, you will have to force a sentence to end after a
period that follows a capital letter (remember that \LaTeX\
assumes this doesn't end a sentence).  This is done by preceding
the period with a \verb!\@! command (you can guess from the odd
syntax that this is rarely needed).

It's time we saw some examples of this.  After all, this is our first
experience of {\em control symbols} (don't worry, there are many
more to come).

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
We must be careful not to confuse intra-sentence periods
with periods that end a sentence, i.e.\ we must remember
that our task is to describe the sentence structure.  Periods
that the typesetter requires a little help with typically result
from abbreviations, as in etc.\ and  others.  We have to work
somewhat harder to break a sentence after a capital letter,
but that shouldn't bother us to much if we keep up our intake
of vitamin E\@.  All this goes for other sentence-ending
punctuation characters, so I could have said vitamin E\@!
Fortunately, these are rare occurrences.
\end{verbatim}
}
\noindent results in

\result{%
We must be careful not to confuse intra-sentence periods
with periods that end a sentence, i.e.\ we must remember
that our task is to describe the sentence structure.  Periods
that the typesetter requires a little help with typically result
from abbreviations, as in etc.\ and  others.  We have to work
somewhat harder to break a sentence after a capital letter,
but that shouldn't bother us to much if we keep up our intake
of vitamin E\@.  All this goes for other sentence-ending
punctuation characters, so I could have said vitamin E\@!
Fortunately, these are rare occurrences.
}

Quotation marks is another area where \LaTeX\ will do some
work for us.  Keyboards have the characters \verb@`@, \verb@`@, and \verb@"@ but we
want to to have access to each of `, ', ``, and ''.  So we proceed like this:

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
`\LaTeX' is no conventional word-processor, and
to to get quotes, like ``this'', we type repeated
` and ' characters.  Note that modern
convention is that ``punctuation comes after
the closing quote character''.
\end{verbatim}
}
\noindent which gives just what we want

\result{%
`\LaTeX' is no conventional word-processor, and
to to get quotes, like ``this'', we type repeated
{\tt `} and {\tt '} characters.  Note that modern
convention is that ``punctuation comes after
the closing quote character''.
}

Very rarely, you have three quote characters together.
Merely typing those three quote characters one-after-the-other
is ambiguous---how should they be grouped?  You tell
\LaTeX\ how you want them grouped by inserting a
very small space called \verb@\,@.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
``\,`Green ham' or `Eggs?'\,'' is the question.
\end{verbatim}
}
\noindent gives the desired result

\result{%
``\,`Green ham' or `Eggs?'\,'' is the question.
}

Since we have a typesetter at our disposal, we might as
well use the correct dashes where we need them.  There
are three types of dash: the hyphen, the endash, and
the emdash.  A minus sign is not a dash.

Hyphens are typed as you'd hope, just by typing a \verb@-@
at the point in the word that you want a hyphen.  Don't
forget that \LaTeX\ takes care of hyphenation that is
required to produce pretty linebreaks.  You only type
a hyphen when you explicitly want one to appear,
as in a combination like ``inter-college''.

An endash is the correct dash to use in indicating
number ranges, as in ``questions~1--3''.  To
specify an endash you type two consecutive
dashes on the keyboard, as in \verb@1--3@.

An emdash is a punctuation dash, used at the end
of a sentence---I tend to use them too much.
To specify an emdash you type three consecutive
dashes on the keyboard, as in ``\ldots\verb@a sentence---I tend to@\ldots''.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
Theorems 1--3 concern the semi-completeness
of our new construct---in the case that it
satisfies the first axiom.
\end{verbatim}
}
\noindent yields

\result{%
Theorems 1--3 concern the semi-completeness
of our new construct---in the case that it
satisfies the first axiom.
}

\subsection{Ties}
When you always remember to use {\em ties\/}, you know
that you are becoming {\TeX}nically inclined.  Ties are
used to prevent \LaTeX\ from breaking lines at
certain places.  \LaTeX\ will always choose line breaks
that result in the most aesthetically pleasing paragraph
as judged by its stringent rules.  But because \LaTeX\
does not actually understand the material it is setting
so beautifully, it can make some poor choices.

A {\em tie\/} is the character \verb@~@.  It behaves as a
normal interword space in all respects {\em except\/}
that the line-breaking algorithm will never break a
line at that point.  Thus

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
Dr. Seuss should be typed as Dr.~Seuss
\end{verbatim}
}
\unskip\noindent for this makes sure that \LaTeX\ will never
leave the `Dr' at the end of one line and put the `Seuss'
at the beginning of the next.

One should try to get in to the habit of typing ties first-time,
not after waiting to see if \LaTeX\ will make a poor choice  This will allow
you to make all sorts of changes to your text without ever
having to go back and insert a tie at a point that has migrated
to the end of a line from the middle of a line as a result
of those changes.  Remember, of course, that the line-breaks 

Here are some more examples of places where you should remember to
place ties.

\moveright0.1\textwidth\vbox{%
\footnotesize\tt\begin{tabbing}
Lemmas 3 and\verb!~!4\quad      \= \kill
Chapter\verb!~!10       \> Donald\verb!~!E. Knuth\\
Appendix\verb!~!C     \> width\verb!~!2\\
Figure\verb!~!1   \>    function\verb!~!f\\
Theorem\verb!~!2    \>   1,\verb!~!2, or\verb!~!3\\
Lemmas 3 and\verb!~!4   \>  equals\verb!~!5\\
\end{tabbing}
}

\subsection{Specially reserved symbols}\label{sec:reserved}
In the sequel we will see that the the ten characters

\moveright0.1\textwidth\hbox{\verb!# $ % & ~ _ ^ \ { }!}

\noindent are reserved for special use.  Indeed, we have seen already
that {\tt\bs} and \verb@~@ are non-printing characters
that perform special services (and we'll have a lot more to
say about the use of {\tt\bs}).

But what if we need one of these special symbols to appear
in our document?  The answer for seven of the symbols
is to precede them by a {\tt\bs} character, so forming
another {\em control symbol\/} (remember that
{\tt\bs} followed by a space was also a control symbol).

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
It is not 100\% straightforward to typeset the
characters \$ \& \% \_ \{ \}, but given the
enormous convenience of the use they are normally
reserved for this is a small price to pay.
\end{verbatim}
}
\noindent produces

\result{%
It is not 100\% straightforward to typeset the
characters \$ \& \% \_ \{ \}, but given the
enormous convenience of the use they are normally
reserved for this is a small price to pay.
}

\subsection{So what are control symbols and words?}
In typing a document, we can think of ourselves as
being in one of two distinct modes.  We are either
typing {\em literal text\/} (which will just be set into neat
paragraphs for us) or we are typing text that will
be {\em interpreted\/} by \LaTeX\ as an instruction
to insert a special symbol or to perform some action.
Thus we are either typing material that will go
straight into the document (with some beautification),
or we are giving commands to \LaTeX.

Some commands are implicit, in that we don't have to
do anything much extra.  For instance, we command
\LaTeX\ to end the present sentence by typing a
period (that doesn't follow a capital letter).  These are
no so much commands as part of having to describe
the logical structure of a document.

A {\em control word\/} is something of the form
\verb@\commandname@, where the command name
is a word made up only of the letters  a to~z and A to~Z.  A
{\em control symbol\/} consists of a {\tt\bs}
followed by single symbol that is not a letter.

Here are some examples:
\begin{itemize}
\item we have met the control space symbol \verb*@\ @ before,
\item the commands to set symbols like \% and \$ are control symbols
\item \verb!\@! was a control symbol that told told \LaTeX\ that
		the very next period did really end the sentence,
\item \verb@\LaTeX@ is a control word that tell \LaTeX\ to insert
	       its own name at the current point,
\item \verb@\clubsuit@ instructs that a $\clubsuit$ be inserted,
\item \verb@\pounds@ inserts a \pounds\ symbol,
\item \verb@\S@ inserts a \P\ symbol,
\item \verb@\em@ makes the ensuing text {\em be emphasised},
\end{itemize}

These examples show that control sequences can be used to
access symbols not available from the keyboard,
do some typesetting tricks like setting the word
\LaTeX\ the way it does, and change the appearance of
whole chunks of text as with \verb@\em@.  We'll be meeting
many more of these type of control sequences.

Another enormously powerful class of control sequences is
those that accept {\em arguments}.  They tell \LaTeX\
to take the parts of text you supply and do something
with them---like make a fraction by setting the first
argument over the second and drawing a line of the
appropriate length between them.  These are part of
what makes \LaTeX\ so powerful, and here are some
examples.

\begin{itemize}
\item \verb@\chapter{The beginning}@ causes \LaTeX\ to
	      start a new chapter with name ``The Beginning'', number
	      it in sequence, typeset the chapter heading in a suitable
	      font, and make an entry in the table of contents,
\item \verb@\overline{words}@ causes $\overline{\mbox{words}}$ to
	      be overlined,
\item \verb@\frac{a+b}{c+d}@ sets the given two argument as
	       a fraction, doing most of the dirty work for us: $\frac{a+b}{c+d}$,
\item \verb@\sqrt[5]{a+b}@ typesets the fifth-root of $a+b$,
	       like this: $\sqrt[5]{a+b}$. The {\tt 5} is in square brackets
	       instead of braces because it is an optional argument and
		could be ommited all together (giving the default of square root),
\end{itemize}

Mandatory arguments are given enclosed by braces, and
optional arguments enclosed by square brackets.  Each
command knows how many arguments to expect, so
you don't have to provide any indication of that.

We have actually jumped the gun a little.  The above examples
include examples of {\em mathematical\/} typesetting, and we
haven't yet seen how to tell \LaTeX\ that it is typesetting
maths as opposed to some other random string of symbols
that it doesn't understand either.  We'll come to mathematical
typesetting in good time.

We need to dwell on a {\TeX}nicality for a moment.  How does
\LaTeX\ know where the name of a control sequence ends?
Will it accept both \verb@\pounds3@ and \verb@\pounds 3@
in order to set \pounds3, and will \verb@\emWalrus@
and \verb@\em Walrus@ both be acceptable in order to
get {\em Walrus\/}?  The answer is easy when you remember
that a control word consists only of alphabetic characters,
and a control symbol consists of exactly one nonalphabetic
character.

So to determine which control sequence you typed,
\LaTeX\ does the following:
\begin{enumerate}
\item when a {\tt\bs} character is encountered, \LaTeX\ knows
	       that either a control symbol or a control word will follow.
\item If the {\tt\bs} is followed by a nonalphabetic character,
		then \LaTeX\ knows that it is a control {\em symbol\/}
		that you have typed.  It then recognises which one it was,
		typesets it, and goes on to read the character which follows
		the symbol you typed.
\item If the {\tt\bs} is followed by an alphabetic character, then
	       \LaTeX\ knows that it is a control word that you have typed.
		But it has to work out where the name of the control word ends
		 and where the ensuing text takes over again.  Since only alphabetic
		 characters are allowed, \LaTeX\ reads everything up to 
		 just before that first
		 nonalphabetic character as the control sequence name.  Since
		 it is common to delimit the end of a control word by a space,
		 \LaTeX\ will {\em ignore\/} any space that follows a control
		 word, since you want that space treated as end-of-control-word
		 space rather than interword space.
\end{enumerate}

This has one important consequence:  The character in the input
file immediately after a control symbol will be ``seen'' by \LaTeX,
but {\em any space following a control word  will be
discarded and never processed.}  This does not affect one much if you adopt
the convention of always typing a space after a control sequence name.

There is a rare circumstance where this necessitates a little extra work
and thought, which we illustrate by example:

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
If we type a control word like \LaTeX in the running text
then we must be cautious, because the string of spaces that
come after it will be discarded by the \LaTeX\ system.
\end{verbatim}
}
\noindent which produces the output

\result{%
If we type a control word like \LaTeX in the running text
then we must be cautious, because the string of spaces that
come after it will be discarded by the \LaTeX\ system.
}

\subsection{Commands to change appearance}\label{sec:groups}
We've seen a little of how to access  various symbols using
control sequences and we mentioned the \verb@\em@
command to emphasise text, but we didn't see how to use
them.  We look here at commands that change the appearance
of the text.

Each of the control words here is a directive rather
than a control sequence that accepts an argument.
This is because potential arguments consisting
of text that wants to be emboldened or emphasised
are very large, and it would be a nuisance to have
to enclose such an argument in argument-enclosing
braces.

To delimit the area of text over which one of these commands
has effect (its {\em scope}) we make that text into what
is called a {\em group}.  Groups are used extensively in
\LaTeX\ to keep effects local to an area, rather than
affecting the whole document.  Apart from enhancing
usability, this also in a sense protects distinct parts
of a document from each other.

The \LaTeX\ commands for changing type style are given
in table~\ref{tab:typestyles}, and those for changing type
size are given in table~\ref{tab:sizes}.  Commands for
selecting fonts other than these are not discussed here.

\begin{table}[ht]
\centering
\begin{tabular}{llllllll}
\verb@\rm@ & Roman                    & & \verb@\it@ & \it italic          & & \verb@\sc@ & \sc Capitals\\
\verb@\em@ & \em Emphasised &  & \verb@\sl@ & \sl slanted     & & \verb@\tt@  & \tt typewriter\\
\verb@\bf@   & \bf boldface           &  & \verb@\sf@ & \sf sans serif & &\\
\end{tabular}
\caption{Commands for selecting type styles}
\label{tab:typestyles}
\end{table}

Each of the type style selection commands selects the specified style but does
not change the size of font being used.  The default type style is roman (you
are reading a roman style font now).  To change type size you issue one of
the type size changing commands in table~\ref{tab:sizes}, which will select
the indicated size in the currently active style.  The release of \LaTeX\
3.0 (the present version is 2.09) will see the New Font Selection Scheme
in place as a standard feature. This makes font matters much easier to deal
with.

% part 2 of 4
\begin{table}[ht]
\centering
\begin{tabular}{l|r|r|r|}
\multicolumn{1}{l}{size} &
\multicolumn{1}{c}{default (10pt)} &
	   \multicolumn{1}{c}{11pt option}  &
	   \multicolumn{1}{c}{12pt option}\\
\cline{2-4}
\verb|\tiny|       & 5pt  & 6pt & 6pt\\
\cline{2-4}
\verb|\scriptsize| & 7pt  & 8pt & 8pt\\
\cline{2-4}
\verb|\footnotesize| & 8pt & 9pt & 10pt \\
\cline{2-4}
\verb|\small|        & 9pt & 10pt & 11pt \\
\cline{2-4}
\verb|\normalsize| & 10pt & 11pt & 12pt \\
\cline{2-4}
\verb|\large|      & 12pt & 12pt & 14pt \\
\cline{2-4}
\verb|\Large|      & 14pt & 14pt & 17pt \\
\cline{2-4}
\verb|\LARGE|      & 17pt & 17pt & 20pt\\
\cline{2-4}
\verb|\huge|       & 20pt & 20pt & 25pt\\
\cline{2-4}
\verb|\Huge|       & 25pt & 25pt & 25pt\\
\cline{2-4}
\end{tabular}
\caption{\LaTeX\ size-changing commands.}\label{tab:styles}
\label{tab:sizes}
\end{table}

The point-size option referred to in table~\ref{tab:sizes} is that
specified in the \verb@\documentstyle@ command issued at the
beginning of the input file.  Through it you select that base
(or default) font for your document to be 10, 11, or~12 point Roman.
If no options are specified, the default is 10-point Roman.  The
table shows, for instance, that if I issue a \verb@\large@ in
this document for which I chose the {\tt 12pt} document style
option the result will be a {\large 14-point Roman typeface}.

We mentioned that to restrict the scope of a type-changing
command we will set the text to be affected off in a group.
Let's look at an example of this.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
When we want to {\em emphasise\/} some text we
use the {\tt em} command, and use grouping to
restrict the scope.  We can change font {\large sizes}
in much the same way.  We can also obtain {\it italicised},
{\bf emboldened}, {\sc Capitals} and {\sf sans serif} styles.
\end{verbatim}
}

\result{%
When we want to {\em emphasise\/} some text we
use the {\tt em} command, and use grouping to
restrict the scope.  We can change font {\large sizes}
in much the same way.  We can also obtain {\it italicised},
{\bf emboldened}, {\sc Capitals} and {\sf sans serif} styles.
}

Notice how clever grouping allows us to do all that without
once having to use \verb@\rm@ or \verb@\normalsize@.

One more thing slipped into that example---and {italic correction\/}
\verb@\/@.  This is a very small amount of additional space that
we asked to be inserted to allow for the change from sloping
{\em emphasised} text to upright text, because the interword
space has been made to look less substantial from the terminal
sloping character.  One has to keep an eye open for circumstances
where this is necessary.  See the effect of omitting an italic correction
after the emphasised text earlier in this paragraph.

One might expect, by now, that \LaTeX\ would insert an italic correction
for us.  But there are enough occasions when it is not wanted, and there
is no good rule for \LaTeX\ to use to decide just when to do it for us.
So the italic correction is always left up to the typist.

\subsection{Accents}
\LaTeX\ provides accents for just about all occasions.  They are
accessed through a variety of control symbols and single-letter
control worlds which accept a single argument---the letter to be
accented.  These control sequences are detailed in table~\ref{tab:accents}.

\begin{table}[ht]
\centering
\begin{tabular}{lll}
\verb@\`{o}@ & \`{o} & (grave accent)\\
\verb@\'{o}@ & \'{o} &(acute accent)\\
\verb@\^{o}@ & \^{o} & (circumflex or ``hat'')\\
\verb@\"{o}@ & \"{o} & (umlaut or dieresis)\\
\verb@\~{o}@ & \~{o} & (tilde or ``squiggle'')\\
\verb@\={o}@ & \={o} & (macron or ``bar'')\\
\verb@\.{o}@ & \.{o} & (dot accent)\\
\verb@\u{o}@ & \u{o} & (breve accent)\\
\verb@\v{o}@ & \v{o} & (h\'{a}\v{c}ek or ``check'')\\
\verb@\H{o}@ & \H{o} & (long Hungarian umlaut)\\
\verb@\t{oo}@ & \t{oo} & (tie-after accent)\\
\verb@\c{o}@ & \c{o} & (cedilla accent)\\
\verb@\d{o}@ & \d{o} & (dot-under accent)\\
\verb@\b{o}@ & \b{o} & (bar-under accent)
\end{tabular}
\caption{Control sequences for accents}
\label{tab:accents}
\end{table}

Thus we can produce \'{o} by typing \verb@\'{o}@,
\v{a} by typing \verb@\v{a}@, and P\'{a}l Erd\"{o}s
by typing \verb@P\'{a}l Erd\"{o}s@.  Take special
care when accenting an $i$ or a $j$, for they should
lose their dots when accented.  Use the control
words \verb@\i@ and \verb@\j@ to produce dotless
versions of these letters.  Thus the best way to type
to type \u{e}x\u{\i}gent is \verb"\u{e}x\u{\i}gent".

\subsection{Over-ruling some of \TeX's choices}
We've seen that ties can be used to stop linebreaks
occurring between words.  But how can we stop
\LaTeX\ from hyphenating a particular word?
More generally, how can we stop it from splitting
any given group of characters across two lines.
The answer is to make that group of characters
appears as one solid {\em box\/}, through
use of an \verb@\mbox@ command.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
For instance, if we wanted to be sure that the word
{\em currentitem\/} is not split across lines
then we should type it as \mbox{\em currentitem}.
\end{verbatim}
}

If for some reason we wish to break a line\\
in the middle of nowhere, preventing \LaTeX\
from justifying that line to the prevailing right
margin, the we use the \verb@\newline@
command.  One can also use the abbreviated
form \verb@\\@.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
We start with a short line.\newline
And  now we continue with the normal
text, remembering that where we press
Return in the input file probably won't
correspond to a line break in the final
document.  More short lines\\
are easy, too.
\end{verbatim}
}
\noindent will produce the line breaks we want

\result{%
We start with a short line.\newline
And  now we continue with the normal
text, remembering that where we press
Return in the input file probably won't
correspond to a line break in the final
document.  More short lines\\
are easy, too.
}

A warning is in order:  \verb@\newline@
must only end part of a line that is ``already
set''.  It cannot be used to add additional
space between paragraphs, nor to leave
space for a picture you want to paste in.
This is not to be awkward, but is just part
of \LaTeX\ holding up its end of the deal
by making you have to specially request
additional vertical space.  This prevents
unwanted extra space from entering
your document.

Later we shall see how to impose our own choice
of page size, paragraph indentation, etc.  For now
we will continue to accept those declared for
us in the document style.

\subsection{Commenting your document}
It is handy to be able to make comments
to yourself in the source file for a document.
Things like ``I must rewrite this section'' and
``This is version 3 of the document'' are likely.
It would also be useful to be able to make
the compiler ignore certain parts of the
document at times.  For this purpose
we can use the \verb@%@ character, for
all text on an input line that is
after a \verb@%@  which is not part of
an occurrence of the control symbol
\verb@\%@ is discarded by the compiler.
Here is an example:

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
There was a 100\% turnout today,
an all-time record.  %perhaps I should check this claim!
%Indeed, there are lots of unsubstantiated claims here!
This made for an extremely productive session.
\end{verbatim}
}
\noindent will yields

\result{%
There was a 100\% turnout today,
an all-time record.  %perhaps I should check this claim!
%Indeed, there are lots of unsubstantiated claims here!
This made for an extremely productive session.
}

\subsection{Footnotes}
Inserting footnotes is easy---\LaTeX\ will position and
number them for you.  You just indicate {\em exactly\/}
where the footnote marker should go, and provide the
text of the footnote.  The footnote text will be
placed at the bottom of the present page in a somewhat
smaller font, and be separated from the main text by
a short horizontal rule\footnote{See for yourself!  It's
easy when you don't have to do any work.} to conform with
convention.  The footnote in the last line was typed
like this:

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
...rule\footnote{See for yourself! It's easy ...work.} to conform
\end{verbatim}
}
No space was typed between the {\tt rule} and the
\verb@\footnote@, because we want the footnote
marker to appear right next to the last letter of the word.

Multiple footnotes\footnote{Here is another footnote} are
obtained just by using the \verb@\footnote@ command
again and again.

\subsection{Topmatter}
We declare the title and author information using the
\verb@\title@ and \verb@\author@ commands, each of
which accept a single argument.  Multiple authors
are all listed in the argument of \verb@\title@,
separated by \verb@\and@'s.  The \verb@\date@
command can be used to date a document.  After
we have declared each of these, we issue a
\verb@\maketitle@ command to have them typeset for
us.  In the \verb@book@ and \verb@article@ document
styles this will result in a separate page; in
the \verb@article@ style the ``top matter'' will
be placed at the top of the first page.  The style
files determine the placement and the choice of font.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\title{A Thought for the Day}
\author{Fred Basset \and Horace Hosepipe}
\date{November 1992}
\maketitle
\end{verbatim}
}
\noindent will produce something along the lines of

\result{%
\begin{center}
{\Large A Thought for the Day}\\
\smallskip Fred Basset\quad Horace Hosepipe\\
\smallskip November 1992
\end{center}
}

This topmatter must appear {\em after\/} the 
\verb"\begin{document}" and before any other printing material.

\subsection{Sectioning commands}
As part of our task of describing the logical structure of
the document, we must indicate to \LaTeX\ where to start sectional
units.  To do this we make use of the sectioning commands shown
in table~\ref{tab:sectioning}.

\begin{table}[ht]
\centering
{\tt
\begin{tabular}{lll}
\bs part & \bs subsection & \bs paragraph\\
\bs chapter & \bs subsubsection & \bs subparagraph\\
\bs section & & \\
\end{tabular}
}
\caption{\LaTeX\ sectioning commands}
\label{tab:sectioning}
\end{table}

Each sectioning command accepts a single argument---the section
heading that is to be used.  \LaTeX\ will provide the section
numbering (and numbering of subsections within sections, etc.)\
so there is no need to include any number in the argument.
\LaTeX\ will also take care of whatever spacing is required to
set the new logical unit off from the others, perhaps through
a little extra space and using a larger font.  It will
also start a new page in the case that a new chapter is
begun.

The \verb@\part@ command is used for major subdivisions of
substantial documents.  The \verb@\paragraph@ and
\verb@\subparagraph@ commands are, unfortunately
confusing.  They are used to section off a modest number of
paragraphs of text---they don't start new paragraphs (remember that
that was done by leaving a blank line in our input file).
The names were retained for historical reasons.

It is always a good idea to {\em plan\/} the overall
sectional structure of a document in advance, or at least
give it a little thought.  Not that it would be difficult to
change your mind later (you could use the global replace
feature of an editor, for instance), but so that you have
a good idea of the structure that you have to describe to
\LaTeX.

The sectioning command that began the present sectional unit
of this document was

\moveright0.1\textwidth\vbox{%
\begin{verbatim}
\subsection{Sectioning commands}
\end{verbatim}
}
\noindent and that was all that was required to get the numbered
section name and the table of contents entry.

There are occasions when you want a heading to have all the
appearance of a particular sectioning command, but shouldn't
be numbered as a section in its own right or produce a table
of contents entry.  This can be achieved through using the
{\em *-form\/} of the command, as in \verb@\section*{...}@.
We'll see that many \LaTeX\ commands have such a *-form
which modify their behaviour slightly.

Not only will \LaTeX\ number your sectional units for you,
it will compile a table of contents too.  Just include the
command \verb@\tableofcontents@ after the 
\verb@\begin{document}@ command and after the topmatter that
should precede it.


\subsection{\LaTeX\ environments}
Perhaps the most powerful and convenient concept in the \LaTeX\
syntax is that of an {\em environment}.  We will see most of
the ``heavy'' typesetting problems we will encounter can be best
tackled by one or other of the \LaTeX\ environments.

Some environments are used to {\em display\/} a portion of text,
i.e.\ to set it off from the surrounding text by indenting it.
The {\tt quote} and {\tt verse} environments are examples of
these.  The {\tt center} environment allows us to centre
portions of text, while the {\tt flushright} environment
sets small portions of text flush against the right margin.

But the true power of \LaTeX\ begins to show itself when
we look at environments such as those that provide facilities
for itemised or enumerated lists, complex tabular arrangements,
and for taking care of figure and table positioning and captioning.
What we learn here will also be applicable in typesetting some
complicated mathematical arrangements in the next chapter.

All the environments are begun by a {\tt \bs begin{\{{\em name}\}}}
command and ended by an {\tt \bs end{\em \{name\}}}, where
{\em name\/} is the environment name.  These commands also
serve as begin-group and end-group\footnote{See section \ref{sec:groups}}
markers, so that all commands are local to the present environment---they
cannot affect text outside the environment.

We can also have environment embedded within environment within
environment and so on, limited only by memory available on the
computer.  We must, however, be careful to check that each of
these {\em nested\/} environments is indeed contained within
the one just outside of it.

\nsubsubsection{{\tt em} environment}
We start with a very simple environment, one which provides
an alternative to the \verb@\em@ command.  Remember that
\verb@\em@ does not accept an argument; it applies to
everything within its scope as dictated by the group
within which it is used.  This can be tricky if we wish
to emphasise a large amount of text, for we may forget
a group-delimiting brace and so upset the entire grouping
structure of our document.  In cases where we fear this might
happen, we can proceed as follows.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{em}
We must always be careful to match our group-delimiting
braces correctly.  If the braces in a document are unevenly
matched then \LaTeX\ will become confused because we will
have, in effect, indicated different scopes than we
intended for commands.
\end{em}
\end{verbatim}
}
\noindent which will give

\result{%
\begin{em}
We must always be careful to match our group-delimiting
braces correctly.  If the braces in a document are unevenly
matched then \LaTeX\ will become confused because we will
have, in effect, indicated different scopes than we
intended for commands.
\end{em}
}

Although \LaTeX\ doesn't care too much for how we format
our source file, it is obviously a good idea to lay it
out logically and readably anyway.  This helps minimise
errors as well as aids in finding them.  For this reason
I have adopted the convention of always placing the
environment \verb@\begin@ and \verb@\end@ commands on
lines by themselves.

\nsubsubsection{{\tt quote} and {\tt quotation} environments}
This environment can be used to display a part
of a sentence or paragraph, or even several
paragraphs, in such a manner that the material
stands out from the rest of the text.  This can
be used to enhance readability, or to simply
emphasise something.  Its syntax is simple:

\moveright0.05\textwidth\vbox{%
\footnotesize\begin{verbatim}
Horace smiled and retaliated:
\begin{quote}
\em You can mock the non-WYSIWYG nature of \TeX\
all you like.  You don't understand that that is
precisely what makes \TeX\ enormously more powerful
than that lame excuse for a typesetter you use.
And I'll bet that from start to finish of preparing
a document I'm quicker than you are, even if you
do type at twice the speed and have the so-called
advantage of WYSIWYG.  In your case, what you see
is {\em all\/} you get!
\end{quote}
and then continued with composing his masterpiece of the
typesetting art.
\end{verbatim}
}
\noindent produces the following typeset material:

\moveleft0.05\textwidth\vbox{\result{%
\noindent Horace smiled and retaliated:
\begin{quote}
\noindent\em You can mock the non-WYSIWYG nature of \TeX\
all you like.  You don't understand that that is
precisely what makes \TeX\ enormously more powerful
than that lame excuse for a typesetter you use.
And I'll bet that from start to finish of preparing
a document I'm quicker than you are, even if you
do type at twice the speed and have the so-called
advantage of WYSIWYG.  In your case, what you see
is {\em all\/} you get!
\end{quote}
and then continued with composing his masterpiece of the
typesetting art.
}
}

That is a much more readable manner of presenting Horace's
piece of mind than embedding it within a regular paragraph.
The {\tt quote} environment was responsible for the margins
being indented on both sides during the quote.  This example
has also been used to show how the commands that begin and
end an environment restrict the scope of commands issued within
that environment: The \verb@\em@ at the beginning of the
quote did not affect the text following the quote.  We have
also learned here that if we use \verb@\em@ within already
emphasised text, the result is roman type---and we don't
require an italic correction here because the final letter
of `all' was not sloping to the right.

The {\tt quotation} environment is used in just the same way
as the {\tt quote} environment above, but it is intended
for setting long quotations of several paragraphs.  It would
be suitable for quoting a few paragraphs from the text of
some speech, for instance.  \LaTeX\ treats the given
text just like normal text that it has to set into paragraphs,
except that it indents the margins a little.

\nsubsubsection{{\tt verse} environment}
This is provided to facilitate the setting of poetry.
When within the {\tt verse} environment, we use
\verb@\newline@ (or \verb@\\@) to end a line; and
what would normally signify a new paragraph
serves to indicate the start of a new stanza.
Let's have a shot at some cheap poetry.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{verse}
Roses are red\\
Violets are blue\\
I think \TeX\ is great\\
And so will you!

Roses are still red\\
Violets are still blue\\
I'm schizophrenic\\
And so am I.
\end{verse}
\end{verbatim}
}
\noindent will produce the following stunningly-creative ``poem'':

\result{%
\begin{verse}
Roses are red\\
Violets are blue\\
I think \TeX\ is great\\
And so will you!

Roses are still red\\
Violets are still blue\\
I'm schizophrenic\\
And so am I.
\end{verse}
}



\nsubsubsection{{\tt center} environment}
This environment allows the centring of consecutive lines
of text, new lines being indicated by a \verb@\\@.  If you
don't separate lines with the \verb@\\@ command then you'll
get a centred paragraph the width of the page,
which won't look any different to normal.  If only one
line is to be centred, then no \verb@\\@ is necessary.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
The {\tt center} environment takes care of the vertical
spacing before and after it, so we don't need to leave any.
\begin{center}
If we leave no blank line after the\\
{\tt center} environment\\
then the ensuing text will not\\
be regarded as part of a new\\
paragraph, and so will not be indented.\\
\end{center}

In this case we left a blank line after the environment,
so the new text was regarded as starting a new paragraph.
\end{verbatim}
}
\noindent gives the following text

\result{%
The {\tt center} environment takes care of the vertical
spacing before and after it, so we don't need to leave any.
\begin{center}
If we leave no blank line after the\\
{\tt center} environment\\
then the ensuing text will not\\
be regarded as part of a new\\
paragraph, and so will not be indented.\\
\end{center}

In this case we left a blank line after the environment,
so the new text was regarded as starting a new paragraph.
}

\nsubsubsection{{\tt flushright} and {\tt flushleft} environments}
The {\tt flushright} environment causes each line to be set
with its last character against the right margin, without trying
to stretch the line to to current text width.  The {\tt flushleft}
environment is similar.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
We can stop \LaTeX\ from justifying each line to both the
left and the right margins.
\begin{flushright}
The {\tt flushright} environment is\\
used for text with an even right margin\\
and a ragged left margin.
\end{flushright}
\begin{flushleft}
and the {\tt flushleft} environment is\\
used for text with an even left margin\\
and a ragged right margin.
\end{flushleft}
\end{verbatim}
}
\noindent gives the desired display

\result{%
We can stop \LaTeX\ from justifying each line to both the
left and the right margins.
\begin{flushright}
The {\tt flushright} environment is\\
used for text with an even right margin\\
and a ragged left margin.
\end{flushright}
\begin{flushleft}
and the {\tt flushleft} environment is\\
used for text with an even left margin\\
and a ragged right margin.
\end{flushleft}
}

One must be wary not to lapse into ``word-processing'' mode
when using these environments.  Remember that pressing return
at the end of a line in the input file does not serve to end
the current line there, but just to indicate the end of another word.
We have to use the \verb@\\@ command to end a line.

\nsubsubsection{{\tt verbatim} environment}
We can simulate typed text using the {\tt verbatim} environment.
The \verb@\tt@ (typewriter text) type style can be used for
simulating typed words, but runs into trouble if one of the
characters in the simulated typed text is a specially reserved
\LaTeX\ character.  For instance, \verb@{\tt type \newline}@
would not have the desired effect because \LaTeX\ would
interpret the \verb@\newline@ is an instruction to start
a new line.

The {\tt verbatim} environment allows the simulation of multiple
typed lines.  {\em Everything\/} within the environment is
typeset in typewriter font exactly as it appears in our source
file---obeying spaces and line breaks as in the source file and
not recognising the existence of any special symbols.

% this is going to be ugly, because we can't demonstrate an
% \end{verbatim} using the verbatim environment
\moveright0.1\textwidth\vbox{%
\footnotesize\begin{flushleft}
\tt\bs begin\{verbatim\}\\
In the verbatim environment we can type anything\\
we like.\\
So we don't  need to look out for uses of \%, \$, \& etc,\\
nor will control sequences like \bs newline have any\\
effect.\\
\bs end\{verbatim\}
\end{flushleft}
}
\noindent will produce the simulated input text

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
In the verbatim environment we can type anything
we like.
So we don't  need to look out for uses of %, $, & etc,
nor will control sequences like \newline have any 
effect.
\end{verbatim}
}

The only thing that cannot be typed in the {\tt verbatim}
environment is the sequence \verb@\end{verbatim}@.  You
might notice that I still managed to simulate that
control sequence above.  One can always get what you want
in \TeX, perhaps with a little creativity.

If we want only to simulate a few typed words, such as when
I say to use \verb@\newline@ to start a new line, then the
\verb@\verb@ command is used.  This command has a slightly
odd syntax, pressed upon it by the use for which it was
intended. It cannot accept an argument, because we may 
want to simulate typed text that is enclosed by
\verb@{braces}@.  What one does is to choose any character
that is {\em not\/} in the text to be simulated, and use
a pair of these characters as ``argument delimiters''.  I usually use the 
\verb"@" or \verb@"@ charachters, as I rarely have any other uses for them.
Thus

\result{%
\noindent use \verb"\%" to obtain a \% sign
}
\noindent is typed as

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
use \verb"\%" to obtain a \% sign
\end{verbatim}
}

\nsubsubsection{{\tt itemize}, {\tt enumerate}, {\tt description} environments}
\LaTeX\ provides three predefined list-making environment, and a 
``primitive'' list environment for designing new list environments
of your own.  We shall just describe the predefined ones here.

There is delightfully little to learn in order to be able to create
lists.  The only new command is \verb@\item@ which indicates the
beginning of a new list item (and the end of the last one if this is
not the first item).  This command accepts an optional argument
(which means you'd enclose it in square brackets) that can be
used to provide an item label.  If no optional argument is given, then
\LaTeX\ will provide the item label for you;  in an
{\tt itemize} list it will bullet the items, in an
{\tt enumerate} list it will number the items, and in a list
of {\tt description}s the default is to have no label (which would look
a bit odd, so you're expected to use the optional argument there).

Remember that \verb@\item@ is used to separate list items; it
does not accept the list item as an argument.  

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{itemize}
\item an item is begun with \verb@\item@
\item if we don't specify labels, then
	 \LaTeX\ will bullet the items for us
\item I indent lines after the first in the
	 input file, but that is just to keep things
	 readable.  As always, \LaTeX\ ignores additional
	 spaces.

\item a blank line between items is ignored, for
	 \LaTeX\ is responsible for spacing items.
\item \LaTeX\ is in paragraph-setting mode when
	 it reads the text of an item, and so will
	 perform all the usual functions
\end{itemize}
\end{verbatim}
}
\noindent produces the following itemised list:

\result{
\begin{itemize}
\item an item is begun with {\tt\bs item}%\verb blew up here!
\item if we don't specify labels, then
	 \LaTeX\ will bullet the items for us
\item I indent lines after the first in the
	 input file, but that is just to keep things
	 readable.  As always, \LaTeX\ ignores additional
	 spaces.

\item a blank line between items is ignored, for
	 \LaTeX\ is responsible for spacing items.
\item \LaTeX\ is in paragraph-setting mode when
	 it reads the text of an item, and so will
	 perform all the usual functions
\end{itemize}
}

Lists can also be embedded within one another,
for they are just environments and we said that
environments have this property.  Remember that
we must nest them in the correct order.  We
demonstrate with the following list, which also
shows how to use the {\tt enumerate} environment.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\noindent I still have to do the following things:
\begin{enumerate}
\item Sort out LAN accounts for people on the course
  \begin{itemize}
  \item Have new accounts created for those not already
	    registered on the LAN
  \item Make sure all users have a personal directory
	   on the data drive
  \item Give read and scan rights to users in the \TeX\
	    directories
  \item Add users to the appropriate LAN print queues
  \end{itemize}
\item Have a \TeX\ batch file added to a directory that
	 is on a public search path
\item Finish typing these course notes and proof-read them
\item Photocopy and bind the finished notes
\end{enumerate}
\end{verbatim}
}
\noindent will give the following list

\result{
I still have to do the following things:
\begin{enumerate}
\item Sort out LAN accounts for people on the course
  \begin{itemize}
  \item Have new accounts created for those not already
	    registered on the LAN
  \item Make sure all users have a personal directory
	   on the data drive
  \item Give read and scan rights to users in the \TeX\
	    directories
  \item Add users to the appropriate LAN print queues
  \end{itemize}
\item Have a \TeX\ batch file added to a directory that
	 is on a public search path
\item Finish typing these course notes and proof-read them
\item Photocopy and bind the finished notes
\end{enumerate}
}

See how I lay the source file out in a readable fashion.
This is to assist myself, not \LaTeX.

The {\tt description} environment is, unsurprisingly, 
for making lists of descriptions.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{description}
\item[\tt itemize] an environment for setting itemised lists.
\item[\tt enumerate] an environment for setting numbered lists.
\item[\tt description] an environment for listing descriptions.
\end{description}
\end{verbatim}
}
\noindent will typeset the following descriptions:

\result{%
\begin{description}
\item[\tt itemize] an environment for setting itemised lists.
\item[\tt enumerate] an environment for setting numbered lists.
\item[\tt description] an environment for listing descriptions.
\end{description}
}

Note that the scope of the \verb@\tt@ commands used in the
item labels was restricted to the labels.

\nsubsubsection{{\tt tabbing} environment}
This environment simulates tabbing on typewriters.
There one chose the tab stops in advance (analysing
the material to be typed for the longest item in
each column) and typed entries consecutively,
hitting the tab key to move to the next tab stop
and return to move to the next line.

In the {\tt tabbing} environment, we proceed similarly.
We look for the worst-case line (that which will 
determine the desired tab stops) and use it to
set the tabs by inserting \verb@\=@ control symbols
at the points where we want tab stops. We then discard
that line using \verb@\kill@, since the worst-case line
might not be the first line in the material we have to
type.  We then type each line, using \verb@\>@ to move
to the next tab stop and \verb@\\@ to end a line.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{tabbing}
Cheddar cheese \= Recommended \= \$2.00 \kill
Green Ham \> Recommended \> \$2.00
Eggs \> 1 a week \> \$1.50
Cheddar cheese \> Hmmm \> \$0.80
Yak cheese \> Avoid \> \$0.05
\end{tabbing}
\end{verbatim}
}
\noindent gives the following uniformly-tabbed table

\result{%
\begin{tabbing}
Cheddar cheese \= Recommended \= \$2.00 \kill
Green Ham      \> Recommended \> \$2.00\\
Eggs           \> 1 a week    \> \$1.50\\
Cheddar cheese \> Hmmm   \> \$0.80\\
Yak cheese     \> Avoid  \> \$0.05
\end{tabbing}
}

In the format line I chose the longest entry
from each of the prospective columns.  I lined
some of the \verb@\>@ commands up in the source
just to keep things readable.

Remember that excess spaces are ignored.  \LaTeX\
sets the \verb@\kill@ed line normally and sees where the
tab stops requested will be needed in the typeset text.
Note also that commands given within the {\tt tabbing}
environment are local to {\em the current item}. 

Actually, we use the above approach in the case that
we require uniformly tabbed columns.  The format line
is not compulsory, and we can define tab stops dynamically.
See if you can make sense of the following.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{tabbing}
Entry in position 1,1 \= Entry 1,2 \= Entry 1,3\\
Entry in position 2,1 \> Entry 2,2 \> Entry 2,3\\
Entry 3,1 \= Entry 3,2 \> Entry 3,3\\
Entry 4,1 \> Entry 4,2 \> Entry 4,3
\end{tabbing}
\end{verbatim}
}
\noindent which produces

\result{%
\begin{tabbing}
Entry in position 1,1 \= Entry 1,2 \= Entry 1,3\\
Entry in position 2,1 \> Entry 2,2 \> Entry 2,3\\
Entry 3,1 \= Entry 3,2 \> Entry 3,3\\
Entry 4,1 \> Entry 4,2 \> Entry 4,3
\end{tabbing}
}

The are additional commands that can be used within
the tabbing environment to achieve special effects,
but we won't be discussing them here.

\nsubsubsection{{\tt tabular} environment}
The {\tt tabular} environment is used to produce
tables of items, particularly when the table
is predominantly rectangular and when line drawing
is required.  \LaTeX\ will make most decisions for
us;  for instance it will align everything for us
without having to be told which are the longest
entries in each column.

This environment is the first of many that use the
\TeX\ ``tabbing character'' {\tt \&}.  This character
is used to separate consecutive entries in a row
of a table, array, etc.  The end of a row is indicated
in the usual manner, by using \verb@\\@.
In this way the individual cells of the table, or array,
are clearly described to \LaTeX, and it can analyse
them to make typesetting decisions.  Commands issued
within a cell so defined are, again, local to that
cell.

The {\tt tabular} environment is also our first example
of an {\em environment with arguments}.  The arguments
are given, in braces as usual, just after the closing
brace after the environments name.  In the case of
{\tt tabular} there is a single mandatory argument
giving the justification of the entries in each column:
{\tt l} for left justified, {\tt r} for right justified,
and {\tt c} for centred.  There must be an entry for each
column of the table, and there is no default.  Let's start
with a simple table.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{tabular}{llrrl}
\bf Student name & \bf Number & \bf Test 1 & \bf Test 2 & \bf Comment\\
F. Basset    & 865432 & 78     & 85     & Pleasing\\
H. Hosepipe  & 829134 & 5      & 10     & Improving\\
I.N. Middle  & 853931 & 48     & 47     & Can make it
\end{tabular}
\end{verbatim}
}
\noindent will produce the following no-frills table

\result{%
\begin{tabular}{llrrl}
\bf Student name & \bf Number & \bf Test 1 & \bf Test 2 & \bf Comment\\
F. Basset        & 865432     & 78         & 85         & Pleasing\\
H. Hosepipe      & 829134     & 5          & 10         & Improving\\
I.N. Middle      & 853931     & 48         & 47         & Can make it
\end{tabular}
}
Note that a \verb@\\@ was not necessary at the end
of the last row.  Also note that, once again, the alignment
of the \verb@&@ characters was for human readability.
It is conventional to set columns of numbers with right
justification.  The \verb@\bf@ directives apply only the
entries in which they are given.

A {\tt |} typed in the {\tt tabular} environment's argument
causes a vertical line to be drawn at the indicated position
and extending for the height of the entire table.  An
\verb@\hline@ given in the environment draws a horizontal
line extending the width of the table to be drawn at the
vertical position at which the command is given.
A \verb@\cline@$\{i$-$j\}$ draws a line spanning columns
$i$ to $j$, at the vertical position at which the
command is given.  A repeated line-drawing command
causes a double line to be drawn.  We illustrate line
drawing in tables by putting some lines into our first
table.  We will type this example in a somewhat expanded
form, trying to make it clear why the lines appear where they
do.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{tabular}{|l|l|r|r|l|}
\hline
\bf Student name & \bf Number & \bf Test 1 & \bf Test 2 & \bf Comment\\
\hline
F. Basset        & 865432     & 78         & 85         & Pleasing\\
\hline
H. Hosepipe      & 829134     & 5          & 10         & Improving\\
\hline
I.N. Middle      & 853931     & 48         & 47         & Can make it\\
\hline
\end{tabular}
\end{verbatim}
}
\noindent which will give

\result{%
\begin{tabular}{|l|l|r|r|l|}
\hline
\bf Student name & \bf Number & \bf Test 1 & \bf Test 2 & \bf Comment\\
\hline
F. Basset        & 865432     & 78         & 85         & Pleasing\\
\hline
H. Hosepipe      & 829134     & 5          & 10         & Improving\\
\hline
I.N. Middle      & 853931     & 48         & 47         & Can make it\\
\hline
\end{tabular}
}
% part 3 of 4
That way of laying out the source file makes it clear where
the lines will go.  As we (by now) well know, the returns that
we pressed after the \verb@\\@s in typing this table might
as well have been spaces as far as \LaTeX\ is concerned.  Thus
it is common to have the \verb@\hline@ commands following the
\verb@\\@s on the input lines.  We will do this in future examples.

The \verb@\multicolumn@ column can be used to overrule the overall
format of the table for a few columns.  The syntax of this command
is

\begin{syntax}{multicolumn}
\man{n}\man{pos}\man{item}
\end{syntax}

\noindent where $n$ is the number of columns
of the original format that {\em item\/}
is to span, and {\em pos\/} specifies the justification
of the new argument.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{tabular}{||l|c|c|c||} \hline
\multicolumn{4}{|c|}{\LaTeX\ size changing commands}\\ \hline
Style option         & 10pt (default) & \tt 11pt & \tt 12pt\\ \hline
\tt\bs footnotesize  & 8pt            & 9pt      & 10pt\\ \hline
\tt\bs small         & 9pt            & 10pt     & 11pt\\ \hline
\tt\bs large         & 12pt           & 12pt     & 14pt\\ \hline
\end{tabular}
\end{verbatim}
}
\noindent produces the following table:

\begin{center}\footnotesize
\begin{tabular}{||l|c|c|c||} \hline
\multicolumn{4}{|c|}{\LaTeX\ size changing commands}\\ \hline
Style option         & 10pt (default) & \tt 11pt & \tt 12pt\\ \hline
\tt\bs footnotesize  & 8pt            & 9pt      & 10pt\\ \hline
\tt\bs small         & 9pt            & 10pt     & 11pt\\ \hline
\tt\bs large         & 12pt           & 12pt     & 14pt\\ \hline
\end{tabular}
\end{center}

\nsubsubsection{{\tt figure} and {\tt table} environments}
Figures (diagrams, pictures, etc.)\ and tables (perhaps created
with the {\tt tabular} environment) cannot be split across
pages.  So \LaTeX\ provides a mechanism for ``floating''
them to a nearby place where there is room for them.  This
may mean that your figure or table may appear a little later in the
document than its declaration in the source file might suggest.
You can suggest to \LaTeX\ that it try to place the figure or
table at the present position if there is room 
or, failing that, at the top or bottom of
the present or following page.  You can also ask for it to be presented by
itself on a ``page of floats''.  

You suggest these options to \LaTeX\ through an optional
argument to the environment.  One lists a combination
of the letters {\tt h}, {\tt t}, {\tt b}, and {\tt p} where
\begin{description}
\item[h] means that the object should be placed {\em here} if there
	    is room, so that things will appear in the same order as
	    in the source file,
\item[t] means that the object can be placed at the {\em top\/} of the of a text
	    page, but no earlier than the present page.
\item[b] means that the object can be placed at the {\em bottom\/} of a text
	    page, but no earlier than the present page.
\item[p] means that the object should be set on a {\em page of floats\/} that consists
	    only of tables and figures.
\end{description}

A combination of these indicates decreasing order of preference.
The default is {\tt tbp}.  In this document I have tended to use
{\tt htbp}.

\LaTeX\ will also number and caption a figure or table for you,
and compile a list of tables and a list of figures.
Just include  \verb@\listoffigures@ and \verb@\listoftables@
next to your \verb@\tableofcontents@ command at the beginning
of the document.  To caption a table of figure, include
\verb@\caption{@{\em caption text}\verb@}@ just before the
\verb@\end{table}@ or \verb@\end{figure}@ command.  Here's
a sample source file.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{table}[htbp]
  \begin{tabular}{lrll}
  ...
  \end{tabular}
\caption{Mark analysis}
\end{table}
\end{verbatim}
}

To leave space for a figure that will inserted by some
other means at a later date, we can use the \verb@\vspace@
command:

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{figure}[htbp]
\vspace{9.5cm}
\caption{An artists impression}
\end{figure}
\end{verbatim}
}

Including graphics files prepared with drawing packages is
possible, but beyond the scope of this introduction.

\subsection{The {\tt letter} document style}
All this and we still don't know how to prepare
a simple letter!  Actually, there is very little
to it.

Figure~\ref{fig:letter} shows a sample letter.  We declare
our own address and signature before entering the {\tt letter}
environment because we can use repeated {\tt letter}
environments to prepare multiple letters from the same source
file.  The address of the intended recipient of a particular
letter is given as an argument to the {\tt letter} environment.

\begin{figure}[p]
\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\documentstyle[12pt]{letter}
\begin{document}
\address{(Underneath) Lion Bridge\\
Midway down Commercial Road\\
Pietermaritzburg\\
3200}

\signature{F. Basset\\
Public nuisance}

\begin{Letter}{Director of Public Parks\\
Pietermaritzburg Municipality\\
Pietermaritzburg}

\opening{Kind Sir/Madam}

I wish to complain about the shocking practice of
fencing off the base of trees.  I notice with grave
concern that this has occurred in the park bordering
my stately residence.

This has already caused me great inconvenience
and public embarrassment, as you can imagine it would
for a hound of my social standing.  I demand that
you take these obscene obstructions away without
delay.

\closing{Yours anxiously}
\end{letter}
\end{document}
\end{verbatim}
}
\vfil\caption{A sample letter}
\label{fig:letter}
\end{figure}

\subsection{Common pitfalls;  Error messages}
By now it should be clear that we have to work quite
accurately when preparing a document.  Typing errors
in the running text can be absorbed, but messing up
a control sequence name will halt the compiler with
an error message.  Before we look at some common errors and
some ways to avoid them, let's have a look at a sample 
error message.

You'll have noticed by now that when you run \LaTeX\
on a source file, the transcript of the compiler
session is written on a log file.  When errors have
accumulated to the point that \LaTeX\ is hopelessly
confused, it is time to debug your source file.  The
log file contains a reference to the line, or lines, of
your source file that generated the error together with
a description of the error.

\TeX\ and \LaTeX\ error messages appear frightening at first
sight, to say the least.  They are actually very informative,
but they can take some getting used to.  Mistyped control
sequences cause little pain, but a missing
\verb@\end{@{\em environment}\verb@}@ can cause a good deal
of confusion because it has the effect of making \LaTeX\
try to set material into that environment that was never
intended/designed to fit in such a place.  Also, ommiting a mandatory
argument can cause great confusion.

Suppose we type \verb@\bold@ instead of \verb@\bf@ in the following
line:

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
this is going to be {\bold very} messy.
\end{verbatim}
}
\noindent  This produces the following error message:

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
! Undefined control sequence.
1.683 this is going to be {\bold
				   very} messy.
?
\end{verbatim}
}
That not so bad!  The line beginning with {\tt!} tells us that we
have tried to used a control sequence that was not known to
\LaTeX;  the {\tt 1.683} tells us that the error occurred on line
683 of the source file; and the error message is split over two lines
with the break occurring at the point where \LaTeX\ detected a problem.

But suppose we try the following

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{tabular}{llrrl}
Student name & Number & Test 1 & Test 2 & Comment\\
F. Basset    & 865432 & 78     & 85     & Pleasing\\
H. Hosepipe  & 829134 & 5      & 10     & Improving\\
I.N. Middle  & 853931 & 48     & 47     & Can make it

This shows that H.~Hosepipe's newfound concentration has...
\end{verbatim}
}
i.e., we omit to provide the \verb@\end{tabular}@ that
delimits the end of the environment.  Not having been
told that the environment is supposed to be concluded,
\LaTeX\ will try to set the text of the next paragraph
as a table item---and will scream blue murder when it
finds that it doesn't conform to the syntax demanded.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
LaTeX error.  See LaTeX manual for explanation.
		 Type  H <return>  for immediate help.
! \begin{tabular} ended by \end{document}.
\@latexerr ...diate help.}\errmessage {#1}

\@checkend ...urrenvir \else \@badend {#1}
					     \fi 
\enddocument ->\@checkend {document}
				       \clearpage \begingroup \if@filesw...
\end #1->\csname end#1\endcsname 
				    \@checkend {#1}\expandafter \endgrou...
l.58 \end{document}

? 
\end{verbatim}
}

Now {\em that's\/} informative!  Actually it {\em is} if we 
agree to ignore all but the the error indication line
(the one beginning with the {\tt!}) and the line telling us
where \LaTeX\ noticed that all was not well (the one beginning
{\tt 1.58} in this case).  The rest of the error message you can
regard as being for your local \TeX\ wizard to sort your problem
out if you are unable to after consulting the manuals.
Tough as it looks, we can decipher this message straight
away: the error indicator line tell us that a {\tt tabular}
environment was ended incorrectly (in this case by an
\verb@\end{document}@).

\TeX\ error messages aren't all that bad once you've made
enough errors to get used to a few!  Most can be avoided
through {\em careful\/} preparation of the source file.
Typing accurately and knowledge of the command syntax is a good start,
but there are some other precautions that make good sense:
\begin{enumerate}
\item Even if \LaTeX\ is happy with free-form input, try to
	 lay your input file out as regularly and logically as 
	 possible.  See our examples of environments for
	 formats to adopt.
\item It is important that all group delimiters be properly matched,
	 i.e., braces and {\tt\bs begin\{\}}\ldots{\tt\bs end\{\}} must
	 come in pairs.  A good habit to fall in to is to always type
	 such things in pairs and then move the cursor back between
	 them and type the intervening material.
\item Don't forget command arguments when they are mandatory.
	 Always ask yourself what a particular commands {\em needs
	 from you\/} in order to make the decisions that are required of it.
\item Remember the 10 characters that are specially reserved for
	 commenting, table item separation, etc.
\item When we look at mathematical typesetting in the next chapter,
	 we will see that the same principles apply there.
\item Try to use a text editor that has a \TeX\ mode, or at least
	 one that will match brackets for you.      
\end{enumerate}

\section{Summary}
We have learned pretty much all we need to know in order to 
prepare non-mathematical documents.  There has been quite
a lot of material, all told, but we're fortunate that the
average document requires only a fraction of what we've
listed here.  Furthermore, we'll find that what we've
learned equips us with a good deal of the framework
needed for mathematical typesetting.

The important thing to extract from this chapter is some
feel for what I termed the ``spirit of \TeX'' at the
chapter beginning.  I cannot emphasise enough the
importance of getting your mind out of ``word processing''
mode and into ``typesetting'' mode.  Always keep uppermost
in your mind the task at hand:  you are to describe the
logical content of the document to \LaTeX, so furnishing
it with enough information to perform all the formatting
for you.

Many of the earlier sections of this chapter will become
trivially easy to you after just a little experimentation
with \LaTeX.  The best way to learn the syntax of the more
complicated environments is to use them---try typesetting
the examples, for instance.  It is important that you come
to terms with the {\tt tabular} environment, for its
syntax is typical of many of the mathematical constructs 
that we will use.

If you have not already done so, then now is the time
to try preparing some documents of your own.  Try
including all the material from this chapter, for
that is the best way to remember it all.  When
the initial lack of familiarity wears off, you'll
find that \LaTeX\ is really a whole lot friendlier
and easier to use than you expected.

We must also recognise that there is a lot more to some of the command
than detailed here.  Some accept optional argumnets that were not mentioned,
others have more options than we considered.  And even once we have a full
description of each command, there is still much to be learned for there
is much that can be achieved through creative use of some of the environments.





\chapter{Mathematical typesetting with \LaTeX}


The last chapter taught us a good deal of what we need to know in order to
prepare quite complicated non-mathematical documents.  There are still a
number of useful topics that we have not covered (such as cross-referencing),
but we'll defer discussion of those until a later chapter.  In the present
chapter, we'll learn how \LaTeX\ typesets mathematics.  It should come
as no surprise that \LaTeX\ does most of the work for us.

\section{Introduction}
In text-only documents we saw that our task was to describe the logical
components of each sentence, paragraph, section, table, etc.
When we tell \LaTeX\ to go into {\em mathematical mode}, we have to
describe the logical parts of a formula, matrix, operator, special symbol, etc.
\TeX\ has been taught to recognize a binary operation, a binary relation,
a variable, an operator that expects limits, and so on.  We just need to 
supply the parts that make up each of these, and \TeX\ will take care of
the rest.  It will leave appropriate space around operators, italicise variables,
set an operator name in roman type, leave the correct space after colons, 
place sub- and superscripts in the correct positions (based on what it is
you're working with), choose the correct typesizes, \ldots\ the list of things it has been taught is
enormous.  When you want to revert to setting normal text again, you tell
\LaTeX\ too leave maths mode and go back into the mode it was in (paragraphing
mode).

\LaTeX\ cannot be expected to perform these mode shifts itself,  for it
is not always clear just when it is mathematics that has been typed.
For example, should an isolated letter {\tt a} in the input file be
regarded as a word (as in the definite article) or a mathematical
variable (as in the variable $a$).  There are no reliable rules for
\LaTeX\ to make such decisions by, so the begin-math and end-math
mode switching is left entirely to you.

The symbol \verb@$@ is specially reserved\footnote{See section \ref{sec:reserved}}
by \LaTeX\ as the ``math shift'' symbol.  When \LaTeX\  starts setting
a document it is in paragraphing mode, ready to set lines of the
input file into paragraphs.   It remains in this mode until
it encounters a \verb@$@ symbol, which shifts \LaTeX\ into mathematical
mode.  It now knows to be on the look-out for the components of a mathematical
expression, rather than for words and paragraphs.  It reads everything
up to the next \verb@$@ sign in this mathemtical mode, and then shifts back to
paragraphing mode (i.e.\ the mode it was in before we took it in to
maths mode).

You must be careful to balance your begin-math and end-math
symbols.  It is often a good idea to type two \verb@$@ symbols
and then move back between them and type the mathematical
expression.  If the math-shift symbols in a document are
not matched, then \LaTeX\ will become confused because
it will be trying to set non-mathematical material as
mathematics.

For those who find having the same symbol for both math-begin
and math-end confusing or dangerous, there are two control symbols that perform
the same operations:  the control symbol \verb@\(@ is
a begin-math instruction, and the control symbol \verb@\)@
is an end-math instruction.  Since it is easy to ``lose'' a \verb@$@
sign when typing a long formula, a math environment is provided
for such occasions:  you can use \verb@\begin{math}@ and
\verb@\end{math}@ as the math-shift instructions.  Of course, you
could just decide to use \verb@$@ and take your chances.

Let's have a look at some mathematics.

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\LaTeX\ is normally in paragraphing mode, where
it expects to find the usual paragraph material.  Including
a mathematical expression, like $2x+3y - 4z= -1$, in the
paragraph text is easy.  \TeX\ has been taught to recognize
the basic elements of an expression, and typeset them appropriately,
choosing spacing, positioning, fonts, and so on.
Typing the above expression without entering maths
mode produces the incorrect result: 2x+3y - 4z= -1
\end{verbatim}
}
\noindent will produce the following paragraph

\result{
\LaTeX\ is normally in paragraphing mode, where
it expects to find the usual paragraph material.  Including
a mathematical expression, like $2x+3y - 4z= -1$, in the
paragraph text is easy.  \TeX\ has been taught to recognize
the basic elements of an expression, and typeset them appropriately,
choosing spacing, positioning, fonts, and so on.
Typing the above expression without entering maths
mode produces the incorrect result: 2x+3y - 4z= -1
}

Notice that \LaTeX\ sets space around the binary relation
$=$ and space around the binary operators $+$ and $-$ on the
left hand side of the equation, ignoring the
spacing we typed in the input. It was also able to recognize
that the $-1$ on the right hand side of the equation was
a unary minus---negating the $1$ rather than being used to
indicate subtraction---and so did not put space around it.
It also italicised the
variables $x$, $y$, and $z$.  However, it did not italicise
the number $1$.

In typing a mathematical expression we must remember to keep the
following in mind:
\begin{enumerate}
\item All letters that are not part of an argument to some control
sequence will be italicised.  Arguments to control sequences will
be set according to the definition of the command used.  So
typing \verb@$f(x)>0 for x > 1$@ will produce
$$f(x)>0 for x > 1$$
instead of the expression
$$f(x)>0 \mbox{\quad for\quad} x>1$$
that we intended.  Numerals and punctuation marks are set
in normal roman type but \LaTeX\ will take care of the
spacing around punctuation symbols, as in

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
$f(x,y) \geq 0$
\end{verbatim}
}
\noindent which produces
$$f(x,y) \geq 0\quad.$$

\item Even a single letter can constitute a formula, as in
``the constant $a$''.  To type this you enter \verb@$a$@ in
your source file.  If you do not go in to maths mode to type
the symbol, you'll get things like ``the constant a''.

\item Some symbols have a different meaning when typed in maths
mode.  Not only do ordinary letters become variables, but symbols
such as \verb@-@ and \verb@+@ are now interpreted as mathematical
symbols.  Thus in maths mode \verb@-@ is no longer considered
a hyphen, but as a minus sign.

\item \LaTeX\ ignores all spaces and carriage returns 
when in maths mode, without exception.  So typing something
like \verb@the constant$ a$@ will produce ``the constant$ a$''.
You should have typed \verb@the constant $a$@.  \LaTeX\
is responsible for all spacing when in maths mode, and
(as in paragraphing mode) you have to specially ask to have
spacing changed.  Even if \LaTeX\ does ignore all spaces
when in maths mode you should (as always in \TeX) still employ
spaces to keep your source file readable.
\end{enumerate}

The above means that, at least for most material, a typist need
not understand the mathematics in order to typeset it correctly.
And even if one does understand the mathematics, \LaTeX\ is there to
make sure that you adhere to accepted typesetting conventions (whether
you were aware of their existence or not).

So one could type either

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
$f(x, y)  =  2 (x+ y)y/(5xy - 3  )$
\end{verbatim}

\noindent{\normalsize or}

\begin{verbatim}
$f(x,y) = 2(x+y)y / (5xy-3)$
\end{verbatim}
}
\noindent and you'd still get the correct result
$$f(x,y) = 2(x+y)y / (5xy-3)\quad.$$

There are some places where this can go wrong.  For instance,
if we wish to speak of the $x$-$y$ plane then one has to know
that it is an {\em endash\/} that is supposed to be placed between
the $x$ and the $y$, not a minus sign (as \verb@$x-y$@ would produce).
But typing \verb@$x--y$@ will produce $x--y$ since both dashes are
interpreted as minus signs.
To avoid speaking of the $x-y$ plane or the $x--y$ plane, we should type
it as \verb@the $x$--$y$ plane@.  We are fortunate that \LaTeX\
can recognise and cope with by far the majority of our mathematical
typesetting needs.

Another thing to look out for is the use of braces in an expression.
Typing

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
${x : f(x)>0}$
\end{verbatim}
}
\noindent will not produce any braces.  This is because, as we well
know, braces are reserved for delimiting groups in the input file.
Looking back to section~\ref{sec:reserved}, we see how it should be done:

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
$ \{ x: f(x)>0 \} $
\end{verbatim}
}

Math shift commands also behave as scope delimiters, so that 
commands issued in an expression cannot affect anything else in
a document.

\section{Displaying a formula}\label{sec:display}
\LaTeX\ considers an expression \verb@$ ... $@ to be word-like in the
sense that it considers it to be eligible for splitting across lines
of a paragraph (but without hyphenation, of course).  \LaTeX\ assigns
quite a high penalty to doing this, thus trying to avoid it (remember
that \LaTeX\ tries to minimize the ``badness'' of a paragraph).
When there is no other way, it will split the expression at a suitable place.
But there are some expressions which are just too long to fit into the
running text without looking awkward.  These are best ``displayed'' on
a line by themselves.  Also, some expressions are sufficiently important
that they should be made to stand out.  These, too, should be displayed
on a line of their own.

The mechanism for displaying an expression is the {\em display math\/}
mode, which is begun by typing \verb@$$@ and ended by typing the same
sequence (which again means that we'd better be sure to type them in pairs).
Corresponding to the alternatives \verb@\(@ and \verb@\)@ that we had
for the math shift character \verb@$@, we may use \verb@\[@ and
\verb@\]@ as the display-math shift sequences.  One can also
use the environment

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
\begin{displaymath} ... \end{displaymath}
\end{verbatim}
}
\noindent which is equivalent to \verb@$$ ... $$@ and is suitable for
use with long displayed expressions. If you wish \LaTeX\
to number your equations for you you can use the environment

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
\begin{equation} ... \end{equation}
\end{verbatim}
}
\noindent which is the same as the \verb@displaymath@ environment, except that
an equation number will be generated.

It is poor style to have a displayed expression either begin a paragraph
or be a paragraph by itself. This can be avoided if you agree to
{\em never leave a blank line in your input file before a math display}.

We will see later how to typeset an expression that is to span
multiple lines.  For now, let's look at an example of displaying
an expression:

\moveright0.1\textwidth\vbox{%
\footnotesize\begin{verbatim}
For each $a$ for which the Lebesgue-set $L_a(f) \neq \emptyset$ we define
$$ % We could have used \begin{displaymath} here
{\cal B}_a(f) = \{ L_{a+r}(f) : r > 0  \},
$$ % and \end{displaymath} here
and these are easily seen to be completely regular.
\end{verbatim}}
\noindent which produces

\result{
For each $a$ for which the Lebesgue-set $L_a(f) \neq \emptyset$ we define
$$ 
{\cal B}_a(f) = \{ L_{a+r}(f) : r > 0  \},
$$
and these are easily seen to be completely regular.
}

That illustrates how to display an expression, but also shows that
we've got a lot more to learn about mathematical typesetting.  Before
we have a look at how to arrange symbols all over the show (e.g.\
the subscripting above) we must learn how to access the multitude
of symbols that are used in mathematical texts.

\section{Using mathematical symbols}\label{sec:symbols}
\LaTeX\ puts all the esoteric symbols of mathematics at
our fingertips.  They are all referenced by name, with the naming system
being perfectly logical and systematic.  None of the control words that
access these symbols accepts an argument, but we'll soon see that
some of them prepare \LaTeX\ for something that might follow.  For instance,
when you ask for the symbol `$\sum$' \LaTeX\ is warned that any sub- or
superscripts that follow should be positioned appropriately as limits
to a summation.  In keeping
with the \TeX\ spirit, none of this requires any additional work on your
part.

We'll also see that some of the symbols behave differently depending on
where they are used.  For instance, when I ask for $\sum_{i=1}^{n}a_i$ within
the running text, the limits are places differently to when I ask
for that expression to be displayed:
$$\sum_{i=1}^{n}a_i\quad.$$
Again, I typed nothing different here---just asked for display math mode.

It is important to note that {\em almost all of the special maths symbols are
unavailable in ordinary paragraphing mode}. If you need to use one there,
then use an in-line math expression \verb@$...$@.

\subsection{Symbols available from the keyboard}
A small percentage of the available symbols can be obtained from just
a single key press.  They are $+$ $-$ $=$ $<$ $>$ $|$ $/$ $($ $)$
$[$ $]$ and $*$.  Note that these must be typed {\em within maths mode\/}
to be interpreted as math symbols.

Of course, all of $a$--$z$, $A$--$Z$, the numerals $0, 1, 2, \ldots, 9$ and
the punctuation characters $,$ $;$ and $:$ are available directly from the keyboard.
Alphabetic letters will be assumed to be variables that are to be
italicised, unless told otherwise\footnote{See section \ref{sec:mathtext}}.
The numerals receive no special attention, appearing precisely as in
normal paragraphing mode.  The punctuation symbols
are still set in standard roman type when read in maths mode, but a little
space is left after them so that expressions like $\{x_i : i=1,2,\ldots,10\}$
look like they should.  Note that this means that normal sentence punctuation
should not migrate into an expression.

\subsection{Greek letters}

\newcommand{\ds}[1]{$\csname#1\endcsname$ & \tt\bs #1 }
\newcommand{\dsf}[4]{\ds{#1}&\ds{#2}&\ds{#3}&\ds{#4}}
\newcommand{\dst}[3]{\ds{#1}&\ds{#2}&\ds{#3}}

Tables \ref{tab:lgreek} and \ref{tab:ugreek} show the control sequences that produce the
letters of the Greek alphabet.  We see that a lowercase Greek letter
is simply is accessed by typing the control word of the same name
as the symbol, using all lowercase letters.  To obtain an uppercase
Greek letter, simply capitalise the {\em first\/} letter of its name.

Just as \verb@$mistake$@ produces $mistake$ because the letters
are interpreted as variables, so too will \verb@$\tai \epsilon \chi$@
produce the incorrectly spaced $\tau \epsilon \chi$ if you try to
type greek words like this.  \TeX\ can be taught to set Greek, but
this is not the way.  $\tau\!\epsilon\!\chi$, % and nor is this
incidentally, is the Greek word for ``art'' and it is from the initials of the
Greek letters constituting this word that the name \TeX\ was derived.
\TeX\ is ``the art of typesetting''.

\begin{table}[thbp]
\centering\footnotesize
\begin{tabular}{llllllll}
\dsf{alpha}{beta}{gamma}{delta}\\
\dsf{epsilon}{varepsilon}{zeta}{eta}\\
\dsf{theta}{vartheta}{iota}{kappa}\\
\dsf{lambda}{mu}{nu}{xi}\\
\dsf{pi}{varpi}{rho}{varrho}\\
\dsf{sigma}{varsigma}{tau}{upsilon}\\
\dsf{phi}{varphi}{chi}{psi}\\
\ds{omega}
\end{tabular}
\caption{\rm Lowercase Greek letters}
\label{tab:lgreek}
\end{table}

\begin{table}[htbp]
\centering\footnotesize
\begin{tabular}{llllllll}
\dsf{Gamma}{Delta}{Theta}{Lambda}\\
\dsf{Xi}{Pi}{Sigma}{Upsilon}\\
\dst{Phi}{Psi}{Omega}
\end{tabular}
\caption{\rm Uppercase Greek letters}
\label{tab:ugreek}
\end{table}

\subsection{Calligraphic uppercase letters}
The letters $\cal A, \ldots, \cal Z$ are available through use of the
style changing command \verb@\cal@.  This command behaves like
the other style changing commands \verb@\em@, \verb@\it@, etc.\
so its scope must be delimited as with them.  Thus we can type

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
... for the filter $\cal F$ we have $\varphi({\cal F}) = \cal G$.
\end{verbatim}
}
\noindent to obtain

\result{%
for the filter $\cal F$ we have $\varphi({\cal F}) = \cal G$.
}

There is no need to tabulate all the calligraphic letters, since they
are all obtained by just a type style changing command.  We will just
list them so that we can see, for reference purposes, what they all look like.
Here they are:

\newcommand{\calf}[5]{\cal{#1}\cal{#2}\cal{#3}\cal{#4}\cal{#5}}
$$  % cos we're using AmSLaTeX, things have changed!
\calf{A}{B}{C}{D}{E}\calf{F}{G}{H}{I}{J}\calf{K}{L}{M}{N}{O}
\calf{P}{Q}{R}{S}{T}\calf{U}{V}{W}{X}{Y}\cal Z
$$

\subsection{Binary operators}
\LaTeX\ has been taught to recognise binary operators and set the
appropriate space either side of one---i.e., it sets the first
argument followed by a little space, then the operator followed
by the same little space and finally the second argument.  
Table~\ref{tab:binops} shows the binary operators that are available
via \LaTeX\ control words (recall that the binary operators $+$,
$-$, and $*$ can be typed from the keyboard).  Here are some examples of their use:

\begin{mathegs}
\verb@$a+b$@ & $a+b$\\
\verb@$(a+b) \ otimes c$@ & $(a+b)\otimes c$\\
\verb@$(a \vee b) \wedge c$@ & $(a \vee b)\wedge c$\\
\verb@$X - (A \cap B) = (X-A) \cup (X-B)$@ & $X - (A \cap B) = (X-A) \cup (X-B)$
\end{mathegs}

\begin{table}
\centering\footnotesize
\begin{tabular}{llllllll}
\dsf{pm}{cap}{diamond}{oplus}\\
\dsf{mp}{cup}{bigtriangleup}{ominus}\\
\dsf{times}{uplus}{bigtriangledown}{otimes}\\
\dsf{div}{sqcap}{triangleleft}{oslash}\\
\dsf{ast}{sqcup}{triangleright}{odot}\\
\dsf{star}{vee}{wedge}{bigcirc}\\
\dsf{dagger}{setminus}{amalg}{circ}\\
\dsf{ddagger}{cdot}{wr}{bullet}
\end{tabular}
\caption{\rm Binary Operation Symbols}
\label{tab:binops}
\end{table}

\subsection{Binary relations}
\LaTeX\ has been taught to recognize the use of binary relations, too.
Table~\ref{tab:binrels} shows those available via \LaTeX\ control words.
There are a few that you can obtain directly from the keyboard:
$<$, $>$, $=$, and $|$.

To negate a symbol you can precede the control word that gives the symbol
by a \verb@\not@.  Some symbols come with ready-made negations, which
should be used above the \verb@\not@'ing method because the slope of the
negating line is just slightly changed to look more pleasing.
Thus \verb@\notin@ should be used above \verb@\not\in@, and
\verb@\neq@ should be used above \verb@\not =@.

If negating a symbol produces a slash whose horizontal positioning
is not to your liking, then use the math spacing characters described
in section~\ref{sec:mathspace} to adjust it.


\begin{table}[htbp]
\centering\footnotesize
\begin{tabular}{llllllll}
\dsf{leq}{geq}{equiv}{models}\\
\dsf{prec}{succ}{sim}{perp}\\
\dsf{preceq}{succeq}{simeq}{mid}\\
\dsf{ll}{gg}{asymp}{parallel}\\
\dsf{subset}{supset}{approx}{bowtie}\\
\ds{subseteq} & \ds{supseteq}& \ds{cong} & $\bowtie$ & \tt\bs Join\\ % lazy?
\dsf{sqsubset}{sqsupset}{neq}{smile}\\
\dsf{sqsubseteq}{sqsupseteq}{doteq}{frown}\\
\dst{in}{ni}{propto}\\
\ds{vdash} & \ds{dashv}
\end{tabular}
\caption{\rm Binary relations}
\label{tab:binrels}
\end{table}

\subsection{Miscellaneous symbols}
Table~\ref{tab:miscsym} shows a number of general-purpose symbols.
Remember that these are only available in maths mode.  Note that
\verb@\imath@ and \verb@\jmath@ should be used when you need to
accent an $i$ or a~$j$ in maths mode\footnote{See section \ref{sec:mathacc}}%
---you cannot use \verb@\i@ or \verb@\j@ that were available in
paragraphing mode.  To get a prime symbol, you can use \verb@\prime@
or you can just type \verb@'@ when in maths mode, as in
\verb@$f''(x)=x$@ which produces $f''(x)=x$.

\begin{table}[htbp]
\centering\footnotesize
\begin{tabular}{llllllll}
\dsf{aleph}{prime}{forall}{infty}\\
\dsf{hbar}{emptyset}{exists}{Box}\\
\dsf{imath}{nabla}{neg}{triangle}\\
\dsf{jmath}{surd}{flat}{triangle}\\
\dsf{ell}{top}{natural}{clubsuit}\\
\dsf{wp}{bot}{sharp}{diamondsuit}\\
\dsf{Re}{|}{backslash}{heartsuit}\\
\dsf{Im}{angle}{partial}{spadesuit}\\
\ds{mho}
\end{tabular}
\caption{\rm Miscellaneous symbols}
\label{tab:miscsym}
\end{table} 

\subsection{Arrow symbols}

\LaTeX\ has a multitude of arrow symbols, which it will set the correct
space around.  Note that vertical arrows can all be used as
delimiters---see section~\ref{sec:delims}.  The available symbols
are listed in table~\ref{tab:arrows}.

\begin{table}[htbp]
\centering\footnotesize
\begin{tabular}{llllll}
\dst{leftarrow}{longleftarrow}{uparrow}\\
\dst{Leftarrow}{Longleftarrow}{Uparrow}\\
\dst{rightarrow}{longrightarrow}{downarrow}\\
\dst{Rightarrow}{Longrightarrow}{Downarrow}\\
\dst{leftrightarrow}{longleftrightarrow}{updownarrow}\\
\dst{Leftrightarrow}{Longleftrightarrow}{Updownarrow}\\
\dst{mapsto}{longmapsto}{nearrow}\\
\dst{hookleftarrow}{hookrightarrow}{searrow}\\
\dst{leftharpoonup}{rightharpoonup}{swarrow}\\
\dst{leftharpoondown}{rightharpoondown}{nwarrow}\\
\ds{rightleftharpoons} & \ds{leadsto} 
\end{tabular}
\caption{\rm Arrow symbols}
\label{tab:arrows}
\end{table}

\subsection{Expression delimiters}\label{sec:delims}
A pair of delimters often enclose an expression, as in
$$
\left[\begin{array}{cc}
a_{11} & a_{12} \\
a_{21} & a_{22} 
\end{array}\right]
\mbox{\quad and\quad}
f(x) = \left\{ \begin{array}{ll}
x & \mbox{if } x < 1 \\
x^2 & \mbox{if } x \geq 1
\end{array}\right.
\quad.$$
\LaTeX\ will scale delimiters to the correct size (determined by what
they enclose) for you, if you ask it to.  There are times when you don't
want a delimiter to be scaled, so it is left up to you to ask for
scaling.

To ask that a delimter be scaleable, you precede it by 
\verb@\left@ or \verb@\right@ according as it is the left or right
member of the pair.  Scaled delimiters must be balanced correctly.
It sometimes occurs, as in the right-hand example above, that only
one member of a delimiting pair is to be visible.  For this purpose, 
use the commands \verb@\left.@ and \verb@\right.@ which will produce
no visible delimiter but can be used to correctly balance the
delimiters in an expression.  For examples of the use of delimiters, 
see section~\ref{sec:arrays} where we learn about arrays.

Table~\ref{tab:delims} shows the symbols that \LaTeX\ will
recognise as delimiters, i.e.\ symbols that may follow
a \verb@\left@ or a \verb@\right@.  Note that you have to 
use \verb@\left\{@ and \verb@\right\}@ in order to get
scaled braces.

\begin{table}[htbp]
\centering\footnotesize
\begin{tabular}{llllll}
$($ & \makebox[90pt][l]{(} & $)$ & \makebox[90pt][l]{)} & $\uparrow$ & \makebox[90pt][l]{\tt\bs uparrow}\\
$[$ & ] & $]$ & ] & $\downarrow$ & \tt\bs downarrow\\
$\{$ & \verb@\{@ & $\}$ & \verb@\}@ & $\updownarrow$ & \tt\bs updownarrow\\
\dst{lfloor}{rfloor}{Uparrow}\\
\dst{lceil}{rceil}{Downarrow}\\
\dst{langle}{rangle}{Updownarrow}\\
$/$ & / & \ds{backslash}\\
$|$ & | & \ds{|}  
\end{tabular}
\caption{\rm Delimiters}
\label{tab:delims}
\end{table}

\subsection{Operators like $\displaystyle\int$ and $\displaystyle\sum$}
These behave differently when used in display-math mode as
compared with in-text math mode.  When used in text, they
will appear in their small form and any limits provided will
be set so as to reduce the overall height of the operator, 
as in $\sum_{i=1}^{N}f_i$.  When used in display-math mode, \LaTeX\
will choose to use the larger form and will not try to
reduce the height of the operator, as in
$$
\sum_{i=1}^{N} f_i \quad .
$$

Table~\ref{tab:bigops} describes what variable-size symbols are
available, showing both the small (in text) and the large (displayed)
form of each.  In section~\ref{sec:subsup} we will learn how to 
place limits on these operators.

\begin{table}[htbp]
\centering\footnotesize
\newcommand{\od}[1]{\makebox[27pt]{$\csname#1\endcsname\hfil\displaystyle\csname#1\endcsname$} & \tt\bs #1}
\newcommand{\odt}[3]{\od{#1} & \od{#2} & \od{#3}}
\begin{tabular}{ll@{\hspace{1.5cm}}ll@{\hspace{1.5cm}}ll}
\odt{sum}{bigcap}{bigodot}\\
\odt{prod}{bigcup}{bigotimes}\\
\odt{coprod}{bigsqcup}{bigoplus}\\
\odt{int}{bigvee}{biguplus}\\
\od{oint} & \od{bigwedge}
\end{tabular}
\caption{\rm Variable-sized symbols}
\label{tab:bigops}
\end{table}

\subsection{Accents}\label{sec:mathacc}
The accenting commands that we learned for paragraphing mode do not
apply in maths mode.  Consult table~\ref{tab:mathacc} to see how
to accent a symbol in maths mode (all the examples there accent
the symbol $u$, but they work with any letter).  Remember that $i$ and $j$
should lose their dots when accented, so \verb@\imath@ and
\verb@\jmath@ should be used.

There also exist commands that give a ``wide hat'' or a 
``wide tilde'' to their argument, \verb@\widehat@ and
\verb@\widetilde@.

\begin{table}[htbp]
\centering\footnotesize
\newcommand{\da}[1]{$\csname#1\endcsname{u}$ & \tt\bs #1\{u\}}
\newcommand{\daf}[4]{\da{#1} & \da{#2} & \da{#3} & \da{#4}}
\begin{tabular}{llllllll}
\daf{hat}{acute}{bar}{dot}\\
\daf{check}{grave}{vec}{ddot}\\
\da{breve} & \da{tilde}
\end{tabular}
\caption{\rm Math accents}
\label{tab:mathacc}
\end{table} 

\section{Some common mathematical structures}
In this section we shall begin to learn how to manipulate
all the symbols listed in section~\ref{sec:symbols}.
Indeed, by the end of this section we'll be able to typeset
some quite large expressions.  In the section following
this we will learn how use various alignment environments
that allow us to prepare material like multi-line expressions
and arrays.

\subsection{Subscripts and superscripts}\label{sec:subsup}
Specifying a sub- or superscript is as easy as you'd hope---%
you just give an indication that you want a sub- or superscript
to the last expression and provide the material to be
placed there, and \LaTeX\ will position things correctly.
So sub- and superscripting a single symbol, an operator, or a big
array all involve the same input, and \LaTeX\ places the material
according to what the expression is that is being sub- or superscripted:
$$
x^2\quad,\quad \prod_{i=1}^{N}X_i \quad,\quad
\left[\begin{array}{ccc}
a_{11} & a_{12} & a_{13}\\
a_{21} & a_{22} & a_{23}\\
a_{31} & a_{32} & a_{33}
\end{array}\right]^2
\quad.$$

To tell \LaTeX\ that you want a single character set as a superscript
to the last expression, you just type a \verb@^@ before it.  The 
``last expression'' is the preceding group or, if there is no preceding
group, the single character or symbol that the \verb@^@ follows:

\begin{mathegs}
\verb@$x^2$@ & $x^2$\\
\verb@$a^b$@ & $a^b$\\
\verb@$Y^X$@ & $Y^X$\\
\verb@$\gamma^2$@ & $\gamma^2$\\
\verb@$(A+B)^2$@ & $(A+B)^2$\\
\verb@$\left[ \frac{x^2+1}{x^2 + y^2} \right]^n$@ & $\left[ \frac{x^2+1}{x^2 + y^2} \right]^n$
\end{mathegs}

Subscripts of a single character are equally easy---you just use
the underscore character \verb@_@ where you used \verb@^@ for
superscripting:

\begin{mathegs}
\verb@$x_2$@ & $x_2$\\
\verb@$x_i$@ & $x_i$\\
\verb@$\Gamma_1(x)$@ & $\Gamma_1(x)$
\end{mathegs}

%part 4 of 4
Now let's see how to set a sub- or superscript that consists of more than
just one character.  This is no more difficult than before if we remember
the following rule: {\em \verb@_@ and \verb@^@ set the group that
follows them as a sub- and superscripts to the group that precedes
the sub- and superscript symbols.}  We see now now that our initial examples worked by considering a single
character to be a group by itself.  Here are some examples:

\begin{mathegs}
\verb@$a^2b^3$@ & $a^2b^3$\\
\verb@$2^{21}$@ & $2^{21}$\\
\verb@$2^21$@ & $2^21$\\
\verb@$a^{x+1}$@ & $a^{x+1}$\\
\verb@$a^{x^2+1}$@ & $a^{x^2+1}$\\
\verb@$(x+1)^3$@ & $(x+1)^3$\\
\verb@$\Gamma_{\alpha\beta\gamma}$@ & $\Gamma_{\alpha\beta\gamma}$\\
\verb@${}_1A_2$@ & ${}_1A_2$\\
\end{mathegs}

In the very last example we see a case of setting a subscript to 
an empty group, which
resulted in a kind of ``pre-subscript''.  With some imagination this
can be put to all sorts of uses.

In all of the above examples the sub- and superscripts were set
to single-character groups.  Nowhere did we group an expression 
before sub- or superscripting it.  Even in setting the expression
$(x+1)^3$, the superscript ${}^3$ was really only set to the
character $)$.  If we had wanted to group the $(x+1)$ before
setting the superscript, we would have typed \verb@${(x+1)}^3$@ which
gives ${(x+1)}^3$, with the superscript slightly raised.  One has
to go to this trouble because, to most people, something like
$(x^a)^b$ is just as acceptable and as readable as ${(x^a)}^b$.
It also has the advantage of aligning the base lines in expressions
such as 
$$
(ab)^{-2} = [(ab)^{-1}]^2 = [b^{-1}a^{-1}]^2 = b^{-1}a^{-1}b^{-1}a^{-1}
$$
which looks more pleasing than if we use additional grouping to force
$$
{(ab)}^{-2} = {[{(ab)}^{-1}]}^2 = {[b^{-1}a^{-1}]}^2 = b^{-1}a^{-1}b^{-1}a^{-1}\quad,
$$
and the latter has rather more braces in it that require balancing.

Here are some more examples, showing how \LaTeX\ will set things just as we
want without any further work on our part:

\begin{mathegs}
\verb@$x^{y^z}$@ & $x^{y^z}$\\
\verb@$2^{(2^2)}$@ & $2^{(2^2)}$\\
\verb@$2^{2^{2^{\aleph_0}}}$@ & $2^{2^{2^{\aleph_0}}}$\\
\verb@$\Gamma^{z_c^d}$@ & $\Gamma^{z_c^d}$
\end{mathegs}

We can also make use of empty groups in order to stagger sub- and
superscripts to an expression, as in

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
$\Gamma_{\alpha\beta}{}^{\gamma}{}_\delta$
\end{verbatim}
}
\noindent which will yield

\result{%
$\Gamma_{\alpha\beta}{}^{\gamma}{}_\delta$
}

One can specify the sub- and superscripts to a group in any order,
but it is best to be consistent.  The most natural order seems to 
be to have subscripts first, but you may think otherwise.
It is also a good idea to always include your sub- and superscripts
in braces (i.e.\ make them a group), whether they consist of just
a single character or not.  This enhances readability and also helps
avoid the unfortunate case where you believe that a particular control
word gives a single symbol yet it really is defined in terms of several.

\subsection{Primes}
\LaTeX\ provides the control word \verb@\prime@ ($\prime$) for
priming symbols.  Note that it is not automatically at the superscript
height, so that to get $f^\prime$ you would have to type

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
$f^\prime$ .
\end{verbatim}
}
\noindent  To make lighter work of this, \LaTeX\ will interpret
a right-quote character as a prime if used in maths mode.
Thus we can type

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
$f'(g(x)) g'(x) h''(x)$
\end{verbatim}
}
\noindent in order to get

\noindent

\result{%
$f'(g(x)) g'(x) h''(x)\quad.$
}

\subsection{Fractions}
\LaTeX\ provides the \verb@\frac@ command that accepts two
arguments: the numerator and the denominator (in that order).
Before we look at examples of its use, let us just note that many simple
in-text fractions are often better written in the form 
$\mbox{\it num} / \!\mbox{\it den}$, as with $3/8$ which can be typed
as \verb@$3/8$@.  This is also often the better form for 
a fraction that occurs {\em within\/} some expression.

\begin{mathegs}
\verb@$\frac{x+1}{x+2}$@ & $\displaystyle\frac{x+1}{x+2}$\\
\verb@$\frac{1}{x^2+1}$@ & $\displaystyle\frac{1}{x^2+1}$\\
\verb@$\frac{1+x^2}{x^2+y^2} + x^2 y$@ & $\displaystyle\frac{1+x^2}{x^2+y^2} + x^2 y$\\
\verb@$\frac{1}{1 + \frac{x}{2}}$@ & $\displaystyle\frac{1}{1 + \frac{x}{2}}$\\
\verb@$\frac{1}{1+x/2}$@ & $\displaystyle\frac{1}{1+x/2}$
\end{mathegs}

\subsection{Roots}
The \verb@\sqrt@ command accepts two arguments.  The first, 
and optional, argument specifies what order of root you desire
if it is anything other than the square root.  The second, and
mandatory, argument specifies the expression that the root sign
should enclose:

{\renewcommand{\arraystretch}{1.6}
\begin{mathegs}
\verb@$\sqrt{a+b}$@ & $\displaystyle\sqrt{a+b}$\\
\verb@$\sqrt[5]{a+b}$@ & $\displaystyle\sqrt[5]{a+b}$\\
\verb@$\sqrt[n]{\frac{1+x}{1+x^2}}$@ & $\displaystyle\sqrt[n]{\frac{1+x}{1+x^2}}$\\
\verb@$\frac{\sqrt{x+1}} {\sqrt[3]{x^3+1}}$@ & $\displaystyle\frac{\sqrt{x+1}} {\sqrt[3]{x^3+1}}$
\end{mathegs}
}

\subsection{Ellipsis}
Simply typing three periods in a row will not give the correct
spacing of the periods if it is an ellipsis that is desired.  So
\LaTeX\ provides the commands \verb@\ldots@ and \verb@\cdots@.
Centered ellipsis should be used between symbols like
$+$, $-$, $*$, $\times$, and $=$.  Here are some examples:

\begin{mathegs}
\verb@$a_1+ \cdots + a_n$@ & $a_1+ \cdots + a_n$\\
\verb@$x_1 \times x_2 \times \cdots \times x_n$@ & $x_1 \times x_2 \times \cdots \times x_n$\\
\verb@$v_1 = v_2 = \cdots = v_n = 0$@ & $v_1 = v_2 = \cdots = v_n = 0$\\
\verb@$f(x_1,\ldots,x_n) = 0$@ & $f(x_1,\ldots,x_n) = 0$
\end{mathegs}

\subsection{Text within an expression}\label{sec:mathtext}
One can use the \verb@\mbox@ command to insert normal text into
an expression.  This command forces \LaTeX\ temporarily out of
maths mode, so that its argument will be treated as normal text.
It's use is simple, but we must be wary on one count: remember that
\LaTeX\ ignores all space characters when in maths mode; so to 
surround words in an expression that were placed by an
\verb@\mbox@ command by space you must include the space 
in the \verb@\mbox@ argument.

\begin{mathegs}
\verb@$f_i(x) \leq 0 \mbox{ for } x \in I$@ & $f_i(x) \leq 0 \mbox{ for } x \in I$\\
\verb@$\Gamma(n)=(n-1)! \mbox{ when $n$ is an integer}$@ & $\Gamma(n)=(n-1)! \mbox{ when $n$ is an integer}$
\end{mathegs}

In section~\ref{sec:mathspace} we'll learn of some special spacing commands
that can be used in math mode.  These are often very useful in positioning
text within an expression, enhancing readability and logical layout.

\subsection{Log-like functions}
There are a number of function names and operation symbols that should
be set in normal (roman) type in an expression, such as in
$$
f(\theta) = \sin\theta + \log(\theta+1) - \sinh(\theta^2+1)
$$
and
$$
\lim_{h \rightarrow 0} \frac{\sin h}{h} = 1\quad.
$$

We know that simply typing \verb@$log\theta$@ would produce the
incorrect result
$$
log\theta
$$
and that using \verb@$\mbox{log}\theta$@ would leave us having to insert
a little extra space between the log and the $\theta$
$$
\mbox{log}\theta\quad.
$$
So \LaTeX\ provides a collection of ``log-like functions'' defined
as control sequences.  Table~\ref{tab:loglike} shows those that are
available.  Here are some examples of their use:

\begin{table}[tbp]
{\centering\footnotesize\tt
\begin{tabular}{llllllll}
\bs arccos & \bs cos & \bs csc &\bs exp & \bs ker & \bs limsup & \bs min & \bs sinh\\
\bs arcsin & \bs cosh & \bs deg & \bs gcd & \bs lg & \bs ln & \bs Pr & \bs sup\\
\bs arctan & \bs cot & \bs det & \bs hom & \bs lim & \bs log & \bs sec & \bs tan\\
\bs arg & \bs coth & \bs dim & \bs inf & \bs liminf & \bs max & \bs sin & \bs tanh
\end{tabular}}
\caption{\rm Log-like functions}
\label{tab:loglike}
\end{table}

\begin{mathegs}
\verb@$f(x)=\sin x + \log(x^2)$@ & $f(x)=\sin x + \log(x^2)$\\
\verb@$\delta = \min \{ \delta_1, \delta_2 \}$@ & $\delta = \min \{ \delta_1, \delta_2 \}$\\
\verb@$\chi(X) = \sup_{x\in X} \chi(x)$@ & $\chi(X) = \sup_{x\in X} \chi(x)$\\
\verb@$\lim_{n \rightarrow \infty} S_n = \gamma$@ & $\lim_{n \rightarrow \infty} S_n = \gamma$
\end{mathegs}

Notice how \LaTeX\ does more than just set an operation like
sup in roman type.  It also knew where a subscript to that operator
should go.

\subsection{Over- and Underlining and bracing}
The \verb@\underline@ command will place an unbroken line
under its argument, and the \verb@\overline@ command will place
an unbroken line over its argument.  These two commands can also
be used in normal paragraphing mode (but be careful: \LaTeX\ will
not break the line within an under- or overlined phrase, so don't
go operating on large phrases).

You can place horizontal braces above or below an expression
by making that expression the argument of \verb@\overbrace@
or \verb@\underbrace@.  You can place a label on an overbrace
(resp.\ underbrace) by superscripting (resp.\ subscripting the
group defined by the bracing command.

\begin{mathegs}
\verb@$\overline{a+bi} = a- bi$@ & $\overline{a+bi} = a- bi$\\
\verb@$\overline{\overline{a+bi}} = a+bi$@ & $\overline{\overline{a+bi}} = a+bi$\\
\end{mathegs}

And some examples of horizontal bracing:

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
$A^n=\overbrace{A \times A \times \ldots \times A}^{\mbox{$n$ terms}}$

$\forall x \underbrace{\exists y (y \succ x)}_{\mbox{scope of $\forall$}}$
\end{verbatim}
}
\noindent will produce
$$A^n=\overbrace{A \times A \times \ldots \times A}^{\mbox{$n$ terms}}$$
and
$$\forall x \underbrace{\exists y (y \succ x)}_{\mbox{scope of $\forall$}}$$

\subsection{Stacking symbols}
\LaTeX\ allows you to set one symbol above another through the
\verb@\stackrel@ command.  This command accepts two arguments, 
and sets the first centrally above the second.

\begin{mathegs}
\verb@$X \stackrel{f^*}{\rightarrow}Y$@ & $X \stackrel{f^*}{\rightarrow}Y$\\
\verb@$f(x) \stackrel{\triangle}{=} x^2 + 1$@ & $f(x) \stackrel{\triangle}{=} x^2 + 1$
\end{mathegs}

\subsection{Operators;  Sums, Integrals, etc.}
Each of the operation symbols in table~\ref{tab:bigops} can occur
with limits.  They are specified as sub- and superscripts to the
operator, and \LaTeX\ will position them appropriately.  In an in-text
formula they will appear in more-or-less the usual scripting positions;
but in a displayed formula they will be set below and above the 
symbol (which will also be a little larger).  The following should
give you an idea of how to use them:

\begin{mathegs}
\verb@$\sum_{i=1}^{N} a_i$@ & $\sum_{i=1}^{N} a_i$\\
\verb@$\int_a^b f$@ & $\int_a^b f$\\
\verb@$\oint_{\cal C}f(x)\,dx$@ & $\oint_{\cal C}f(x)\,dx$\\
\verb@$\prod_{\alpha \in A} X_\alpha$@ & $\prod_{\alpha \in A} X_\alpha$\\
\verb@$\lim_{N\rightarrow\infty}\sum_{i=1}^{N}f(x_i)\Delta x_i$@ & $\lim_{N\rightarrow\infty}\sum_{i=1}^{N}f(x_i)\Delta x_i$
\end{mathegs}

We'll have more to say about the use of \verb@\,@ in section~\ref{sec:mathspace}.
Let's have a look at each of those expressions when displayed:

$$
\sum_{i=1}^{N} a_i\quad,\quad
\int_a^b f\quad,\quad
\oint_{\cal C}f(x)\,dx\quad,\quad
\prod_{\alpha \in A} X_\alpha\quad,\quad
\lim_{N\rightarrow\infty}\sum_{i=1}^{N}f(x_i)\Delta x_i
$$

\subsection{Arrays}\label{sec:arrays}

The \verb@array@ environment is provided for typesetting arrays
and array-like material.  It accepts two arguments, one optional
and one mandatory.  The optional argument specifies the vertical
alignment of the array---use \verb@t@, \verb@b@, or \verb@c@ to align
the top, bottom, or centre of the array with the centreline of the
line it occurs on (the default being \verb@c@).  The second argument
is as for the \verb@tabular@ environment:  a series of \verb@l@,
\verb@r@, and \verb@c@'s that specify the number of columns and the
justification of these columns.  The body of the \verb@array@ environment
uses the same syntax as the \verb@tabular@ environment to specify
the individual entries of the array.

For instance the input

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
... let $A = \begin{array}{rrr}
12 & 3 & 4\\
-2 & 1 & 0\\
3 & 7 & 9
\end{array}$ ...
\end{verbatim}
}
\noindent will produce the output

\result{%
let $A = \left[\begin{array}{rrr}
12 & 3 & 4\\
-2 & 1 & 0\\
3 & 7 & 9
\end{array}\right] 
$}

Note that we had to choose and supply the enclosing brackets
ourselves (they are not placed for us so that we can use the
\verb@array@ environment for array-like material; also,
we get to choose what type of brackets we want this way).
As in the \verb@tabular@ environment, the scope of a  command
given inside a matrix entry is restricted to that entry.

We can use ellipsis within arrays as in the following example:

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
\det A = \left| \begin{array}{cccc}
a_{11} & a_{12} & \cdots & a_{1n}\\
a_{21} & a_{22} & \cdots & a_{2n}\\
\vdots & \vdots & \ddots & \vdots\\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{array} \right|
\end{verbatim}
}
\noindent which produces

\result{%
$\det A = \left| \begin{array}{cccc}
a_{11} & a_{12} & \cdots & a_{1n}\\
a_{21} & a_{22} & \cdots & a_{2n}\\
\vdots & \vdots & \ddots & \vdots\\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{array} \right|$
}


The \verb@array@ environment is often used to typeset material that
is not, strictly speaking, an array:

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
f(x) = \left\{ \begin{array}{ll}
  x & \mbox{for $x<1$}\\
x^2 & \mbox{for $x \geq 1$}  
\end{array} \right.
\end{verbatim}
}
\noindent which will yield

\result{%
$f(x) = \left\{ \begin{array}{ll}
  x & \mbox{for $x<1$}\\
x^2 & \mbox{for $x \geq 1$}  
\end{array} \right.$
}

\subsection{Changes to spacing}\label{sec:mathspace}
Sometimes \LaTeX\ needs a little help in spacing an expression,
or perhaps you think that the default spacing needs adjusting.
For these purposes we have the following spacing commands:\medskip

\begin{tabular}{lllll}
\verb@\,@ & thin space & & \verb@\:@ & medium space\\
\verb@\!@ & negative thin space && \verb@\;@ & thick space\\
\verb@\quad@ & a quad of space && \verb@\qquad@ & two quads of space
\end{tabular}\medskip

The spacing commands \verb@\,@, \verb@\quad@, and \verb@\qquad@ can
be used in paragraphing mode, too.  Here are some examples of these
spacing commands used to make subtle modifications to some expressions.

\begin{mathegs}
\verb@$\sqrt{2} \, x$@ & $\sqrt{2} \, x$\\
\verb@$\int_a^b f(x)\,dx$@ & $\int_a^b f(x)\,dx$\\
\verb@$\Gamma_{\!2}$@ & $\Gamma_{\!2}$\\
\verb@$\int_a^b \! \int_c^d f(x,y)\,dx\,dy$@ & $\int_a^b \! \int_c^d f(x,y)\,dx\,dy$\\
\verb@$x / \! \sin x$@ & $x / \! \sin x$\\
\verb@$\sqrt{\,\sin x}$@ & $\sqrt{\,\sin x}$
\end{mathegs}

\section{Alignment}
Recall that the \verb@$equation$@
environment can be used to display and automatically number a single-\
line equation\footnote{See section \ref{sec:display}}.
The \verb@eqnarray@ environment is used for displaying
and automatically numbering either a single expression that spreads
over several lines or multiple expressions, while taking care of 
alignment for us.  The syntax is similar to that of the
\verb@tabular@ and \verb@array@ environments, except that no argument
is necessary to declare the number and justification of columns.  The
\verb@eqnarray*@ environment does this without numbering any equations.

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
\begin{eqnarray}
(a+b)(a+b) & = & a^2 + 2ab + b^2\\
(a+b)(a-b) & = & a^2 - b^2
\end{eqnarray}
\end{verbatim}
}
\noindent will give

\begin{eqnarray}
(a+b)(a+b) & = & a^2 + 2ab + b^2\\
(a+b)(a-b) & = & a^2 - b^2
\end{eqnarray}

See how we identify the columns so as to line the $=$ signs up.
We can also leave entries empty, to obtain effect like the
following:

\vbox{
\footnotesize\begin{verbatim}
\begin{eqnarray*}
\frac{d}{dx} \sin x & = & \lim_{h\rightarrow0}\frac{\sin(x+h)-\sin x}{h}\\
& = & \lim_{h\rightarrow0}\frac{\sin x\cos h + \cos x\sinh - \sin x}{h}\\ 
& = & \lim_{h\rightarrow0}\frac{\sin x(\cos h-1)}{h} + \cos x\frac{\sin h}{h}\\
& = & \cos x
\end{eqnarray*}
\end{verbatim}
}
\noindent which produces

\begin{eqnarray*}
\frac{d}{dx} \sin x & = & \lim_{h\rightarrow0}\frac{\sin(x+h)-\sin x}{h}\\
& = & \lim_{h\rightarrow0}\frac{\sin x\cos h + \cos x\sinh - \sin x}{h}\\ 
& = & \lim_{h\rightarrow0}\left\{\frac{\sin x(\cos h-1)}{h} + \cos x\frac{\sin h}{h}\right\}\\
& = & \cos x
\end{eqnarray*}

\section{Theorems, Propositions, Lemmas, $\ldots$}
Suppose you document contains four kinds of theorem-like structures:
``theorems'', ``propositions'', ``conjectures'', and ``wild guesses''.
Then near the beginning of the document you should have something
like the following:

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim} 
\newtheorem{thm}{Theorem}
\newtheorem{prop}{Proposition}
\newtheorm{conjec}{Conjecture}
\newtheorem{wildshot}{Hypothesis} % make it sound good!
\end{verbatim}
}

\newtheorem{thm}{Theorem}
\newtheorem{prop}{Proposition}
\newtheorem{conjec}{Conjecture}
\newtheorem{wildshot}{Hypothesis}

The first argument to \verb@\newtheorem@ defines a new
theorem-like environment name of your own choosing.  The second argument
contains the text that you want inserted when your theorem is
proclaimed:

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
\begin{thm} $X$ is normal if, and only if, each pair of disjoint
closed sets in $X$ is completely separated.
\end{thm}

\begin{wildshot} % remember, we chose the name 'wildshot'
The property of Moore extends to all objects of the class $\Sigma$.
\end{wildshot}
\end{verbatim}
}
\noindent which will produce the following:

\begin{thm} $X$ is normal if, and only if, each pair of disjoint
closed sets in $X$ is completely separated.
\end{thm}

\begin{wildshot}
The property of Moore extends to all objects of the class $\Sigma$.
\end{wildshot}

Notice that \LaTeX\ italicises the theorem statement, and that you
still have to shift in to maths mode when you want to set symbols
and expression.  Typically, it is the style file that determines
what a theorem will appear like---so don't go changing this if
you are preparing for submission for publication (because the journal
staff want to substitute their production style for your document style
choice, and not be over-ridden by other commands).

\section{Where to from here?}
We have covered a good deal of \LaTeX's mathematical abilities, 
albeit rather superficial coverage here and there.  There is
much that has been impressive, but there is clearly a lot more
to {\TeX}nical typesetting than we have covered here---it is
not difficult to think of an expression that we don't yet know
how to typeset.  Also, there are places where \LaTeX\ is a
little weak and it leaves us to do somewhat more work than
the spirit of \TeX\ would suggest.

Of course, we cannot criticise \LaTeX\ until we know its full
capability.  So the first place to go from here is the
{\em\LaTeX\ User's Guide \& Reference Manual}.  Particularly, the
command reference guide in Appendix C of that book is an
invaluable source of \LaTeX\ information that few can afford to 
do without.  With good knowledge of the \LaTeX\ environments and their
options (and we've left out many here) one can accomplish a good
deal of most typesetting problems.  A little imagination (say
putting an environment to a slightly non-standard use) can often
solve more difficult problems.  Lastly, of course, much of
raw \TeX\ still sits underneath \LaTeX\ and so it is true to say that
you can do {\em anything\/} with \LaTeX---but you may need some
divine inspiration from time to time (ask your local \TeX\ guru).

In the next chapter we will look, very briefly, at a number of
\LaTeX\ commands that we have not yet considered.  Nothing
exciting on the mathematical front, but there is some other
important material (e.g.\ cross-referencing and page-sizing).
For now, let's look at the ``way forward'' with respect to 
mathematical typesetting.

\section{\AmSLaTeX}
Back in the introduction we said that \AmSLaTeX\ was just a big
macro package, the result of a marriage of \LaTeX\ and \AmSTeX\
designed to endow the powerful general-purpose \LaTeX\ package with the
mathematical prowess of \AmSTeX\ without compromising the \LaTeX\ syntax.
Most of that is true, except that \AmSLaTeX\ is really just 
a document-style option (like \verb@12pt@) that can be used within
a ``tweaked \LaTeX''.  The most visible part of this tweak is the
{\em new font selection scheme of Mittelbach and Sch\"{o}pf}, 
discussed more fully in the next chapter.  Almost every
\LaTeX\ command and environment survived the transition to \AmSLaTeX, the
exceptions being those that were considered redundant or under-used (space
is at a premium with such a big package).
The tweaked \LaTeX\ package is therefore able to deal with practically
every existing \LaTeX\ document, giving just a few (often pleasant)
surprises.

With the \verb@amstex@ style option, one can just start a \LaTeX\
document with

\moveright0.1\textwidth\vbox{
\footnotesize\begin{verbatim}
\documentstyle[amstex]{article} % or report, book, etc
\end{verbatim}
}
\noindent to gain access to the {\TeX}nical excellence of the
AMS technical staff.  It is not necessary to have read
{\em The Joy of \TeX} (the \AmSTeX\ reference guide) to
be able to use the \verb@amstex@ option, for \AmSLaTeX\
comes with its own reference guide.  Even so, 
{\em The Joy of TeX\/} is still highly recommended reading.
The syntax of \AmSTeX\ has been changed to that of \LaTeX, 
but one can perform that transformation as you read ``{\em Joy\/}''
and still learn much of the art of technical typesetting.  Nowhere
else will you find so comprehensive a coverage of the conventions
and pitfalls of mathematical typesetting.  In addition, {\em Joy\/}
lists all the extra symbols that are available through the
\verb@amstex@ option (if you thought \LaTeX\ had a fair selection
of esoteric symbols, just wait 'til you see those!) and provides
in-depth accounts where the \AmSLaTeX\ documentation is brief.

Just as \AmSTeX\ comes with the AMS preprint style
(\verb@amsppt@), \AmSLaTeX\ comes with a specialist style file for
preparation of articles with \AmSLaTeX\ for submission to journals:
\verb@amsart@.  The \AmSLaTeX\ User's Guide is quite short and very
terse in its explanations (assuming you to be competent in \LaTeX),
but is supplemented by a large body of examples and a comprehensive
sample article that is a showcase of the abilities of the \verb@amsart@
style.  You must read both these documents to really
learn \AmSLaTeX.  The AMS also distributes a guide to authors
who wish to submit using \AmSLaTeX, and this is a must-read once
you are familiar with some of \AmSLaTeX. 

\end{document}