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
|
% $Id: faq-adj-types.tex,v 1.23 2010/08/12 18:14:24 rf10 Exp rf10 $
\section{Adjusting the typesetting}
\subsection{Alternative document classes}
\Question[Q-replstdcls]{Replacing the standard classes}
People are forever concocting classes that replace the standard ones:
the present author produced an \Class{ukart} class that used the
\Package{sober} package, and a few British-specific things (such as
appear in the \Package{babel} package's British-english
specialisation) in the 1980s, which is still occasionally used.
Similar public efforts were available well back in the days of
\LaTeXo{}: a notable example, whose pleasing designs seem not to have
changed much over all that time, is the \Class{ntgclass} bundle.
Each of the standard classes is replaced by a selection of classes,
named in Dutch, sometimes with a single numeric digit attached. So we
have classes \Class{artikel2}, \Class{rapport1}, \Class{boek3} and
\Class{brief}. These classes are moderately well documented in
English.
The \Class{KOMA-script} bundle (classes named \Class{scr...}) are a
strong current contender. They are actively supported and are subject
to sensitive development; they are comprehensive in their coverage of
significant typesetting issues; they produce good-looking output and
they are well documented in both English (\Package{scrguien} in the
distribution) and German (\Package{scrguide} in the distribution).
The other comparable class is \Class{memoir}. This aims to replace
\Class{book} and \Class{report} classes directly, and (like
\Class{KOMA-script}) is comprehensive in its coverage of small issues.
\Class{Memoir}'s documentation (\Package{memman}) is very highly
spoken of, and its lengthy introductory section is regularly
recommended as a tutorial on typesetting.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}KOMA-script bundle]\CTANref{koma-script}
\item[memoir.cls]\CTANref{memoir}
\item[\nothtml{\rmfamily}NTGclass bundle]\CTANref{ntgclass}
\item[sober.sty]\CTANref{sober}
\end{ctanrefs}
\Question[Q-slidecls]{Producing presentations (including slides)}
Lamport's original \LaTeX{} had a separate program (Sli\TeX{}) for
producing slides; it dates from the age when colour effects were
produced by printing separate slides in different-coloured inks, and
overlaying them, and was just about acceptable back then. When
\LaTeXe{} came along, the reason Sli\TeX{} had to be a separate
program went away, and its functionality was supplied by the
\Class{slides} class. While this makes life a little easier for
system administrators, it does nothing for the inferior functionality
of the class: no-one who ``knows'' uses \Class{slides} nowadays.
The `classic' alternatives have been \Class{seminar} and \Class{foils}
(originally known as Foil\TeX{}). Both were originally designed to
produce output on acetate foils, though subsequent work has provided
environments in which they can be used with screen projectors (see
below).
The advent of Microsoft \ProgName{PowerPoint} (feeble though early
versions of it were) has created a demand for ``dynamic'' slides~---
images that develop their content in a more elaborate fashion than by
merely replacing one foil with the next in the way that was the norm
when \Class{slides}, \Class{foils} and \Class{seminar} were designed.
The \Class{prosper} class builds on \Class{seminar} to provide dynamic
effects and the like; it retains the ability to provide \acro{PDF} for
a projected presentation, or to print foils for a foil-based
presentation. The add-on package \Package{ppr-prv} adds ``preview''
facilities (that which is commonly called ``hand-out printing''). The
\Package{HA-prosper} package, which you load with \Class{prosper},
mends a few bugs, and adds several facilities and slide design styles.
The (more recent) \Class{powerdot} class is designed as a
replacement for \Class{prosper} and \Package{HA-prosper}, co-authored
by the author of \Package{HA-prosper}.
\Class{Beamer} is a relatively easy-to-learn, yet powerful, class that
(as its name implies) was designed for use with projection displays.
It needs the \Package{pgf} package (for graphics support), which in
turn requires \Package{xcolor}; while this adds to the tedium of
installing \Class{beamer} ``from scratch'', both are good additions to
a modern \LaTeX{} installation. \Class{Beamer} has reasonable
facilities for producing printed copies of slides.
\Class{Talk} is another highly functional, yet easy-to-learn class
which claims to differ from the systems mentioned above, such as
\Class{beamer}, in that it doesn't impose a slide style on you. You
get to specify a bunch of slide styles, and you can switch from one to
the other between slides, as you need. (The class itself provides
just the one style, in the package \Package{greybars}: the author
hopes users will contribute their own styles, based on
\Package{greybars}.)
\Package{Lecturer} is a \emph{generic} solution (it works with
\plaintex{}, \latex{} and \context{}~mk~ii, but not~--- yet~--- with
\context{}~mk iv). By separating the functionality needed for a
presentation (using \tex{} for typesetting, and \acro{PDF} functions
for layering and dynamic effects) a clear structure emerges. While it
doesn't have the range of ``themes'' (presentation styles) of
\Class{beamer} it seems a useful alternative candidate.
\Package{Present} is designed for use with \plaintex{} only; its
design is simple, to the extent that its author hopes that users will
themselves be able to tune its macros.
\ProgName{Ppower4} (commonly known as \ProgName{pp4}) is a
\ProgName{Java}-based support program that will postprocess
\acro{PDF}, to `animate' the file at places you've marked with
commands from one of the \ProgName{pp4} packages. The commands don't
work on \acro{PDF} that has come from \ProgName{dvips} output; they
work with \acro{PDF} generated by \PDFLaTeX{}, V\TeX{} \LaTeX{}, or
\ProgName{dvipdfm} running on \LaTeX{} output.
\Package{Pdfscreen} and \Package{texpower} are add-on packages that
permit dynamic effects in documents formatted in ``more modest''
classes; \Package{pdfscreen} will even allow you to plug
``presentation effects'' into an \Class{article}-class document.
% ifmslide
%\noindent ifmslide: a few slides extolling virtues in \File{doc/ifmman.pdf}
A more detailed examination of the alternatives (including examples
of code using many of them) may be found at Michael Wiedmann's fine
\URL{http://www.miwie.org/presentations/presentations.html}
\CONTeXT{} users will find that much (if not all) of what they need is
already in \CONTeXT{} itself; there's a useful summary of what's
available, with examples, in
\URL{http://wiki.contextgarden.net/Presentation_Styles}
%
\begin{ctanrefs}
\item[beamer.cls]Download all of \CTANref{beamer}
\item[foils.cls]\CTANref{foiltex}
\item[greybars.sty]distributed with \CTANref{talk}
\item[HA-prosper.sty]\CTANref{ha-prosper}
%\item[ifmslide.sty]\CTANref{ifmslide}
\item[lecturer.sty]\CTANref{lecturer}
\item[seminar.cls]\CTANref{seminar}
\item[pgf.sty]\CTANref{pgf}
\item[powerdot.cls]\CTANref{powerdot}
\item[pp4]\CTANref{ppower4}
\item[ppr-prv.sty]\CTANref{ppr-prv}
\item[present.tex]\CTANref{present}
\item[prosper.cls]\CTANref{prosper}
\item[talk.cls]\CTANref{talk}
\item[texpower]\CTANref{texpower}
\item[xcolor.sty]\CTANref{xcolor}
\end{ctanrefs}
\Question[Q-poster]{Creating posters with \LaTeX{}}
There is no complete ``canned solution'' to creating a poster (as, for
example, classes like \Class{seminar}, \Class{powerdot} and
\Class{beamer} serve for creating presentations in a variety of
styles).
The nearest approach to the complete solution is the \Class{sciposter}
class, which provides the means to produce really rather good posters
according to the author's required style. A complete worked example
is provided with the distribution
Otherwise, there is a range of tools, most of which are based on the
\Class{a0poster} class, which sets up an appropriately-sized piece of
paper, sets font sizes appropriately, and leaves you to your own
devices.
Having used \Class{a0poster}, you can of course slog it out, and write
all your poster as an unadorned \LaTeX{} document (presumably in
multiple columns, using the \Package{multicol} package), but it's not really
necessary: the (straightforward) \Package{textpos} package provides a
simple way of positioning chunks of text, or tables or figures, on the
poster page.
More sophisticated is the \Package{flowfram} package, whose basic aim
in life is flowing text from one box on the page to the next. One of
the package's design aims seems to have been the production of
posters, and a worked example is provided. The author of
\Package{flowfram} has an experimental tool called
\href{http://theoval.cmp.uea.ac.uk/~nlct/jpgfdraw/}{JpgfDraw}, which
allows you to construct the outline of frames for use with
\Package{flowfram}.
The \Package{beamerposter} package is added to a % ! line break
\Qref*{\Class{beamer} document}{Q-slidecls} to enable the user to work
as if in a \Class{a0poster} class. Thus \Class{beamer}'s neat
provisions for layout may be used when creating the poster.
Documentation of \Package{beamerposter} is sparse, but an example file
allows the user to get a grip on what's available.
Despite the relative shortage of tools, there are a fair few web pages
that explain the process (mostly in terms of the \Class{a0poster}
route):
\begin{itemize}
\item from Norman Gray, % ! line break
\href{http://nxg.me.uk/docs/posters/}{Producing posters using \LaTeX{}};
\item from Nicola Talbot, % ! line break
\href{http://theoval.cmp.uea.ac.uk/~nlct/latex/posters/index.html}{Creating technical posters with \LaTeX{}}
\item from ``\emph{awf}'' and ``\emph{capes}'' % ! line break
\href{http://www.robots.ox.ac.uk/~awf/latex-posters/}{Preparing conference posters in \LaTeX{}} % ! line break
(the page discusses a sample, which you can download);
\item From Rob Clark % ! line break
\href{http://homepages.inf.ed.ac.uk/robert/posters/advanced.html}{Advanced LaTeX Posters} % ! line break
(which has links to code samples);
\item from Brian Wolven, % ! line break
\href{http://fuse.pha.jhu.edu/~wolven/posters.html}{LaTeX Poster Macros, Examples, and Accessories} % ! line break
(this page also provides macros and other support suggestions); and
\item from ``\emph{pjh}'' % ! line break
\href{http://www.phys.ufl.edu/~pjh/posters/poster_howto_UF.html}{Making and printing a poster with \LaTeX{}}, % ! line break
which covers the specific issue of dealing with University of
Florida styled poster (offering supporting material as necessary),
but has hints which are generally useful.
\end{itemize}
\begin{ctanrefs}
\item[a0poster.cls]\CTANref{a0poster}
\item[beamer.cls]\CTANref{beamer}
\item[beamberposter.sty]\CTANref{beamerposter}
\item[flowfram.sty]\CTANref{flowfram}
\item[multicol.sty]Distributed as part of \CTANref{2etools}[multicol]
\item[sciposter.cls]\CTANref{sciposter}
\item[textpos.sty]\CTANref{textpos}
\end{ctanrefs}
\Question[Q-thesis]{Formatting a thesis in \LaTeX{}}
Thesis styles are usually very specific to your University, so it's
usually not profitable to ask around for a package outside your own
University. Since many Universities (in their eccentric way) still
require double-spaced thesis text, you may also need separately to set
up \Qref*{double spacing}{Q-linespace}.
If you want to write a new thesis class of your own, a good place to
start is the University of California style, but remember that it's
often difficult to produce a thesis that both looks good and conforms
with the style that your Univeristy demands.
\begin{ctanrefs}
\item[UC thesis style]\CTANref{ucthesis}
\end{ctanrefs}
\Question[Q-journalpaper]{Setting papers for journals}
Publishers of journals have a wide range of requirements for the
presentation of papers, and while many publishers do accept electronic
submissions in \AllTeX{}, they don't often submit recommended macros to
public archives.
Nevertheless, there are considerable numbers of macros of one sort or
another available on \acro{CTAN}; searching for your journal name in
the CTAN catalogue~--- see % ! line break
\Qref{searching \acro{CTAN}}{Q-findfiles})~---
may well turn up what you're seeking.
Failing that, you may be well advised to contact the prospective
publisher of your paper; many publishers have macros on their own web
sites, or otherwise available only upon application.
Check that the publisher is offering you macros suitable to an
environment you can use: a few still have no macros for current
\LaTeX{}, for example, claiming that \LaTeXo{} is good enough\dots{}
Some publishers rekey anything sent them anyway, so that it doesn't
really matter what macros you use. Others merely encourage you to use
as few extensions of a standard package as possible, so that they will
find it easy to transform your paper to their own internal form.
\Question[Q-multidoc]{A `report' from lots of `article's}
This is a requirement, for example, if one is preparing the
proceedings of a conference whose papers were submitted in \LaTeX{}.
The nearest things to canned solutions are Peter Wilson's
\Class{combine} and Federico Garcia's \Class{subfiles} classes, but
many approaches have been proposed. Each of of the offerings has its
own advantages; in particular, several distinctly light-weight
solutions (for example, \Package{includex} and \Package{docmute}) are
available, well-suited to less formal documents.
\Class{Combine} defines the means to `\csx{import}' entire documents,
and provides means of specifying significant features of the layout of
the document, as well as a global table of contents, and so on. The
complete set of facilities is pretty complex. An auxiliary package,
\Package{combinet}, allows use of the \csx{title}s and \csx{author}s
(etc.\@) of the \csx{import}ed documents to appear in the global table
of contents. The basic structure of a combined document would be:
\begin{quote}
\begin{verbatim}
\documentclass[...]{combine}
...
\begin{document}
...
<introductory materiel>
...
\begin{papers}
% title and author of first article,
% to go the the main ToC
\coltoctitle{...}
\coltocauthor{...}
\label{art1}
\import{art1}
...
\end{papers}
...
<acknowledgements, etc.>
...
\end{document}
\end{verbatim}
\end{quote}
The \Class{subfiles} class is used in the component files of a multi-file
project, and the corresponding \Package{subfiles} package is used in the
master file; so the structure of the master file looks like:
\begin{quote}
\begin{verbatim}
\documentclass{<whatever>}
...
\usepackage{subfiles}
...
\begin{document}
...
\subfile{subfile_name}
...
\end{document}
\end{verbatim}
\end{quote}
while a subfile has the structure:
\begin{quote}
\begin{verbatim}
\documentclass[mainfile_name]{subfiles}
\begin{document}
...
\end{document}
\end{verbatim}
\end{quote}
Arrangements may be made so that the component files will
be typeset using different page format, etc., parameters than those
used when they are typeset as a part of the main file.
A more `raw' toolkit is offered by Matt Swift's \Package{includex} and
\Package{newclude} packages, both part of the \Package{frankenstein}
bundle. Note that Matt believes \Package{includex} is obsolete
(though it continues to work for this author); furthermore, its
replacement, \Package{newclude} remains ``in development'', as it has
been since 1999.
Both \Package{includex} and \Package{newclude} enable you to
`\csx{includedoc}' complete articles (in the way that you
`\csx{include}' chapter files in an ordinary report). The preamble
(everything up to \cmdinvoke{begin}{document}), and everything after
\cmdinvoke{end}{document}, is ignored by both packages. Thus the
packages don't ``do the whole job'' for you, though: you need to
analyse the package use of the individual papers, and ensure that a
consistent set is loaded in the preamble of the main report. (Both
packages require \Package{moredefs}, which is also part of the
bundle.)
A neat (and simple) toolkit is offered by the
\Package{docmute} package; once the package is loaded, anything
between \cmdinvoke{documentclass}[...]{...} and
\cmdinvoke{begin}{document} in an \csx{input}'ed or \csx{include}'d
document is ignored, and then the input is processed up to
\cmdinvoke{end}{document} in the input file. The package does nothing
about \csx{usepackage} (or anything else) in the preamble of the
included document; it's up to the user to ensure that any packages
needed are loaded, and any other necessary configuration is done, in
the parent document.
The \Package{standalone} package develops on the ideas of
\Package{docmute}; it was designed to meet the needs of users who are
developing images from one of the more extreme new graphics packages
(notably \Package{pgf/tikz}) where the compile time of the graphics is
such that separate compilation is very desirable.
\Package{Standalone} provides a means of developing the graphics in a
convenient way, detached from the development of the document as a
whole; its value for use in multiple documents is clear.
The user includes the \Package{standalone} package in the main
document, and each subfile uses the \Class{standalone} class.
(\Class{Standalone} uses \Class{article} for the ``real'' work in
stand-alone mode, but it may be asked to use another).
The real difference from the \Package{docmute} package is
flexibility. In particular, you can ask that the preambles of the
included documents be gathered up, so that you can construct a good
preamble for the master document.
A final ``compile-together'' approach comes from the \Package{subdocs}
package. The driver file contains a \csx{subdocuments} command:
\begin{quote}
\cmdinvoke*{subdocuments}[options]{file1, file2, ...}
\end{quote}
(the optional arguments provide layout options, such as control over
whether \csx{clearpage} or \csx{cleardoublepage} are used between the
files). Each of the sub-files will execute
\begin{quote}
\cmdinvoke*{usepackage}[master]{subdocs}
\end{quote}
to declare the name, \texttt{\emph{master}}, of the calling file;
each of the subfiles reads all the \extension{aux} files, so that
tables of contents may be produced.
A completely different approach is to use the \Package{pdfpages}
package, and to include articles submitted in \acro{PDF} format into a
a \acro{PDF} document produced by \PDFLaTeX{}. The package
defines an \csx{includepdf} command, which takes arguments similar to
those of the \csx{includegraphics} command. With keywords in the
optional argument of the command, you can specify which pages you want
to be included from the file named, and various details of the layout
of the included pages.
\begin{ctanrefs}
\item[combine.cls]\CTANref{combine}
\item[combinet.sty]\CTANref{combine}
\item[docmute.sty]\CTANref{docmute}
\item[includex.sty]Distributed in the ``unsupported'' part of
\CTANref{frankenstein}[includex]
\item[moredefs.sty]Distributed as part of \CTANref{frankenstein}[moredefs]
\item[newclude.sty]Distributed as part of \CTANref{frankenstein}[newclude]
\item[pdfpages.sty]\CTANref{pdfpages}
\item[standalone.cls, standalone.sty]\CTANref{standalone}
\item[subdocs.sty]Distributed as part of \CTANref{bezos}[subdocs]
\item[subfiles.cls, etc.]\CTANref{subfiles}
\end{ctanrefs}
\Question[Q-cv]{\emph{Curriculum Vitae} (R\'esum\'e)}
Andrej Brodnik's class, \Class{vita}, offers a framework for producing
a \emph{curriculum vitae}. The class may be customised both for
subject (example class option files support both computer scientists
and singers), and for language (both the options provided are
available for both English and Slovene). Extensions may be written by
creating new class option files, or by using macros defined in the
class to define new entry types, etc.
Didier Verna's class, \Class{curve}, is based on a model in which
the \acro{CV} is made of a set of \emph{rubrics} (each one dealing
with a major item that you want to discuss, such as `education', `work
experience', etc). The class's documentation is supported by a couple
of example files, and an emacs mode is provided.
Xavier Danaux offers a class \Class{moderncv} which supports
typesetting modern \emph{curricula vitarum}, both in a classic and in a
casual style. It is fairly customizable, allowing you to define your
own style by changing the colours, the fonts, etc.
The European Commission has recommended a format for % ! line break
\emph{curricula vitarum} within Europe, and Nicola Vitacolonna has
developed a class \Class{europecv} to produce it. While (by his own
admission) the class doesn't solve all problems, it seems well-thought
out and supports all current official EU languages (together with a
few non-official languages, such as Catalan, Galician and Serbian).
The alternative to using a separate class is to impose a package on
one of the standard classes. An example,
Axel Reichert's \Package{currvita} package, has been recommended to the
\acro{FAQ} team. Its output certainly looks good.
There is also a \LaTeXo{} package \Package{resume}, which comes with
little but advice \emph{against} trying to use it.
\begin{ctanrefs}
\item[currvita.sty]\CTANref{currvita}
\item[curve.cls]\CTANref{curve}
\item[europecv.cls]\CTANref{europecv}
\item[moderncv.cls]\CTANref{moderncv}
\item[resume.sty]\CTANref{resume}
\item[vita.cls]\CTANref{vita}
\end{ctanrefs}
\Question[Q-letterclass]{Letters and the like}
\LaTeX{} itself provides a \Class{letter} document class, which is
widely disliked; the present author long since gave up trying with
it. If you nevertheless want to try it, but are irritated by its way
of vertically-shifting a single-page letter, try the following hack:
\begin{quote}
\begin{verbatim}
\makeatletter
\let\@texttop\relax
\makeatother
\end{verbatim}
\end{quote}
in the preamble of your file.
Doing-it-yourself is a common strategy; Knuth (for use with
\plaintex{}, in the \TeX{}book), and Kopka and Daly (in their Guide to
\LaTeX{}) offer worked examples. (The latest version of Knuth's
macros appear in his ``local library'' dump on the archive, which is
updated in parallel with new versions of \TeX{}~--- so not very often\dots{})
Nevertheless, there \emph{are} contributed alternatives~--- in fact
there are an awfully large number of them: the following list, of
necessity, makes but a small selection.
The largest, most comprehensive, class is \Class{newlfm}; the \texttt{lfm}
part of the name implies that the class can create letters, faxes and
memoranda. The documentation is voluminous, and the package seems
very flexible.
Other classes recommended for inclusion in this \acro{FAQ} are
\Class{akletter} and \Class{isodoc}.
The \Class{dinbrief} class, while recommended, is only documented in
German.
There are letter classes in each of the excellent
\Class{KOMA-script} (\Class{scrlttr2}: documentation is available in
English) and \Package{ntgclass} (\Class{brief}: documentation in Dutch
only) bundles. While these are probably good (since the bundles
themselves inspire trust) they've not been specifically recommended by
any users.
\begin{ctanrefs}
\item[akletter.cls]\CTANref{akletter}
\item[brief.cls]Distributed as part of \CTANref{ntgclass}
\item[dinbrief.cls]\CTANref{dinbrief}
\item[isodoc.cls]\CTANref{isodoc}
\item[\nothtml{\rmfamily}Knuth's letter.tex]\CTANref{knuth-letter}
\item[newlfm.cls]\CTANref{newlfm}
\item[scrlttr2.cls]Distributed as part of \CTANref{koma-script}
\end{ctanrefs}
\Question[Q-extsizes]{Other ``document font'' sizes?}
The \LaTeX{} standard classes have a concept of a (base) ``document
font'' size; this size is the basis on which other font sizes (those
from \csx{tiny} to \csx{Huge}) are determined. The classes are designed
on the assumption that they won't be used with sizes other than the
set that \LaTeX{} offers by default (10--12pt), but people regularly
find they need other sizes. The proper response to such a requirement
is to produce a new design for the document, but many people don't
fancy doing that.
A simple solution is to use the \Package{extsizes} bundle. This
bundle offers ``extended'' versions of the article, report, book and
letter classes, at sizes of 8, 9, 14, 17 and 20pt as well as the
standard 10--12pt. Since little has been done to these classes other
than to adjust font sizes and things directly related to them, they
may not be optimal~--- but they're certainly practical.
More satisfactory are the \emph{\acro{KOMA}-script} classes, which are
designed to work properly with the class option files that come with
\Package{extsizes}, and the \Class{memoir} class that has its own
options for document font sizes 9pt--12pt, 14pt, 17pt, 20pt, 25pt,
30pt, 36pt, 48pt and 60pt.
Many classes, designed to produce typeset results other than on
``ordinary'' paper, will have their own font size mechanisms and
ranges of sizes. This is true, for example, of % ! line break
\Qref*{poster classes}{Q-poster} (such as \Class{a0poster}), and of
\Qref*{presentation and lecturing classes}{Q-slidecls} (such as
\Class{beamer}.
\begin{ctanrefs}
\item[a0poster.cls]\CTANref{a0poster}
\item[beamer.cls]\CTANref{beamer}
\item[extsizes bundle]\CTANref{extsizes}
\item[\nothtml{\rmfamily}KOMA script bundle]\CTANref{koma-script}
\item[memoir.cls]\CTANref{memoir}
\end{ctanrefs}
\subsection{Document structure}
\Question[Q-titlsty]{The style of document titles}
The \Package{titling} package provides a number of facilities that
permit manipulation of the appearance of a \csx{maketitle} command, the
\csx{thanks} commands within it, and so on. The package also defines a
\environment{titlingpage} environment, that offers something in between the
standard classes' \pkgoption{titlepage} option and the \environment{titlepage}
environment, and is itself somewhat configurable.
The memoir class includes all the functionality of the
\Package{titling} package, while the \Class{KOMA-script} classes have
their own range of different titling styles.
Finally, the indefatigable Vincent Zoonekynd supplies examples of how
to program alternative % don't let this \href suffer a line-break
\href{http://zoonek.free.fr/LaTeX/LaTeX_samples_title/0.html}{title styles}.
The web page is not useful to users unless they are willing to do
their own \LaTeX{} programming.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}KOMA script bundle]\CTANref{koma-script}
\item[memoir.cls]\CTANref{memoir}
\item[titling.sty]\CTANref{titling}
\end{ctanrefs}
\Question[Q-secthead]{The style of section headings}
Suppose that the editor of your favourite journal has specified that section
headings must be centred, in small capitals, and subsection headings ragged
right in italic, but that you don't want to get involved in the sort of
programming described in section 2.2 of \emph{The \LaTeX{} Companion}
\begin{narrowversion} % really non-hyper
(\Qref{}{Q-books}; the programming itself is discussed in
\Qref[question]{}{Q-atsigns}).
\end{narrowversion}
\begin{wideversion} % really hyper
(see \Qref{\TeX{}-related books}{Q-books}; the
\Qref{programming}{Q-atsigns} itself is discussed elsewhere in this
\acro{FAQ}).
\end{wideversion}
The following hack will
probably satisfy your editor. Define yourself new commands
\begin{quote}
\begin{wideversion}
\begin{verbatim}
\newcommand{\ssection}[1]{%
\section[#1]{\centering\normalfont\scshape #1}}
\newcommand{\ssubsection}[1]{%
\subsection[#1]{\raggedright\normalfont\itshape #1}}
\end{verbatim}
\end{wideversion}
\begin{narrowversion} % really non-hyper
\begin{verbatim}
\newcommand{\ssection}[1]{%
\section[#1]{\centering
\normalfont\scshape #1}}
\newcommand{\ssubsection}[1]{%
\subsection[#1]{\raggedright
\normalfont\itshape #1}}
\end{verbatim}
\end{narrowversion}
\end{quote}
and then use \csx{ssection} and \csx{ssubsection} in place of
\csx{section} and \csx{subsection}. This isn't perfect: section numbers
remain in bold, and starred forms need a separate redefinition.
The \Package{titlesec} package offers a structured approach to the
problem, based on redefinition of the sectioning and chapter commands
themselves. This approach allows it to offer radical adjustment: its
options provide (in effect) a toolbox for designing your own
sectioning commands' output.
The \Package{sectsty} package provides a more simply structured set of
tools; while it is less powerful than is \Package{titlesec}, it is
perhaps preferable for minor adjustments, since you can use it after
having read a smaller proportion of the manual.
The \Package{fncychap} package provides a nice collection of customised
chapter heading designs. The \Package{anonchap} package provides a
simple means of typesetting chapter headings ``like section headings''
(i.e., without the ``Chapter'' part of the heading); the
\Package{tocbibind} package provides the same commands, in pursuit of
another end.
The \Class{memoir} class includes facilities that match
\Package{sectsty} and \Package{titlesec}, as well as a bundle of
chapter heading styles (including an \Package{anonchap}-equivalent).
The \Class{KOMA-script} classes also have sets of tools that provide
equivalent functionality, notably formatting specifications \csx{partformat},
\csx{chapterformat}, \csx{sectionformat}, \dots{}, as well as several
useful overall formatting specifications defined in class options.
Finally, the indefatigable Vincent Zoonekynd supplies examples of how
to program alternative % don't let these \href suffer line-breaks
\href{http://zoonek.free.fr/LaTeX/LaTeX_samples_chapter/0.html}{chapter heading styles}
and
\href{http://zoonek.free.fr/LaTeX/LaTeX_samples_section/0.html}{section heading styles}.
The web pages provide programming examples, and expect users to adapt
them to their own \LaTeX{} use.
\begin{ctanrefs}
\item[anonchap.sty]\CTANref{anonchap}
\item[fncychap.sty]\CTANref{fncychap}
\item[\nothtml{\rmfamily}KOMA script bundle]\CTANref{koma-script}
\item[memoir.cls]\CTANref{memoir}
\item[sectsty.sty]\CTANref{sectsty}
\item[titlesec.sty]\CTANref{titlesec}
\item[tocbibind.sty]\CTANref{tocbibind}
\end{ctanrefs}
\Question[Q-appendix]{Appendixes}
\LaTeX{} provides an exceedingly simple mechanism for appendixes: the
command \csx{appendix} switches the document from generating sections
(in \Class{article} class) or chapters (in \Class{report} or
\Class{book} classes) to producing appendixes. Section or chapter
numbering is restarted and the representation of the counter switches
to alphabetic. So:
\begin{quote}
\begin{verbatim}
\section{My inspiration}
...
\section{Developing the inspiration}
...
\appendix
\section{How I became inspired}
...
\end{verbatim}
\end{quote}
would be typeset (in an \Class{article} document) something like:
\begin{quote}
\textbf{1~~My inspiration}
\dots{}
\textbf{2~~Developing the inspiration}
\dots{}
\textbf{A~~How I became inspired}
\dots{}
\end{quote}
which is quite enough for many ordinary purposes. Note that, once
you've switched to typesetting appendixes, \LaTeX{} provides you with
no way back~--- once you've had an appendix, you can no longer have an
``ordinary'' \csx{section} or \csx{chapter}.
The \Package{appendix} provides several ways of elaborating on this
simple setup. Straightforward use of the package allows you to have a
separate heading, both in the body of the document and the table of
contents; this would be achieved by
\begin{quote}
\begin{verbatim}
\usepackage{appendix}
...
\appendix
\appendixpage
\addappheadtotoc
\end{verbatim}
\end{quote}
The \csx{appendixpage} command adds a separate title ``Appendices''
above the first appendix, and \csx{addappheadtotoc} adds a similar
title to the table of contents. These simple modifications cover many
people's needs about appendixes.
The package also provides an \environment{appendices} environment,
which provides for fancier use. The environment is best controlled by
package options; the above example would be achieved by
\begin{quote}
\begin{verbatim}
\usepackage[toc,page]{appendix}
...
\begin{appendices}
...
\end{appendices}
\end{verbatim}
\end{quote}
The great thing that the \environment{appendices} environment gives
you, is that once the environment ends, you can carry on with sections
or chapters as before~--- numbering isn't affected by the intervening
appendixes.
The package provides another alternative way of setting appendixes, as
inferior divisions in the document. The \environment{subappendices}
environment allows you to put separate appendixes for a particular
section, coded as \csx{subsection}s, or for a particular chapter, coded
as \csx{section}s. So one might write:
\begin{quote}
\begin{verbatim}
\usepackage{appendix}
...
\section{My inspiration}
...
\begin{subappendices}
\subsection{How I became inspired}
...
\end{subappendices}
\section{Developing the inspiration}
...
\end{verbatim}
\end{quote}
Which will produce output something like:
\begin{quote}
\textbf{1~~My inspiration}
\dots{}
\textbf{1.A~~How I became inspired}
\dots{}
\textbf{2~~Developing the inspiration}
\dots{}
\end{quote}
There are many other merry things one may do with the package; the
user is referred to the package documentation for further details.
The \Class{memoir} class includes the facilities of the
\Package{appendix} package. The \Class{KOMA-script} classes offer a
\csx{appendixprefix} command for manipulating the appearance of appendixes.
\begin{ctanrefs}
\item[appendix.sty]\CTANref{appendix}
\item[\nothtml{\rmfamily}KOMA script bundle]\CTANref{koma-script}
\item[memoir.cls]\CTANref{memoir}
\end{ctanrefs}
\Question[Q-secindent]{Indent after section headings}
\LaTeX{} implements a style that doesn't indent the first paragraph
after a section heading. There are coherent reasons for this, but not
everyone likes it.
The \Package{indentfirst} package
suppresses the mechanism, so that the first paragraph is
indented.
\begin{ctanrefs}
\item[indentfirst.sty]Distributed as part of \CTANref{2etools}[indentfirst]
\end{ctanrefs}
\Question[Q-subsubsub]{How to create a \csx{subsubsubsection}}
\LaTeX{}'s set of ``sections'' stops at the level of
\csx{subsubsection}. This reflects a design decision by Lamport~---
for, after all, who can reasonably want a section with such huge
strings of numbers in front of it?
In fact, \LaTeX{} standard classes \emph{do} define ``sectioning''
levels lower than \csx{subsubsection}, but they don't format them like
sections (they're not numbered, and the text is run-in after the
heading). These deeply inferior section commands are \csx{paragraph}
and \csx{subparagraph}; you can (if you \emph{must}) arrange that these
two commands produce numbered headings, so that you can use them as
\csx{subsubsubsection}s and lower.
The \Package{titlesec} allows you to adjust the definitions of the
sectioning macros, and it may be used to
transform a \csx{paragraph}'s typesetting so that it looks like that
of a \csx{section}.
If you want to program the change yourself, you'll find that the
commands (\csx{section} all the way down to \csx{subparagraph}) are
defined in terms of the internal \csx{@startsection} command, which
takes 6~arguments. Before attempting this sort of work, you are well
advised to read the \LaTeX{} sources (\File{ltsect.dtx} in the
\LaTeX{} distribution) and the source of the standard packages
(\File{classes.dtx}). The \Qref*{\LaTeX{} Companion}{Q-books}
discusses use of \csx{@startsection} for this sort of thing.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\LaTeX{} source]\CTANref{latex}
\item[titlesec.sty]\CTANref{titlesec}
\end{ctanrefs}
\Question[Q-captsty]{The style of captions}
Changes to the style of captions may be made by redefining the commands
that produce the caption. So, for example, \csx{fnum@figure} (which
produces the float number for figure floats) may be redefined, in a
package of your own, or between
\Qref*{\csx{makeatletter}--\csx{makeatother}}{Q-atsigns}:
\begin{quote}
\begin{wideversion}
\begin{verbatim}
\renewcommand{\fnum@figure}{\textbf{Fig.~\thefigure}}
\end{verbatim}
\end{wideversion}
\begin{narrowversion}
\begin{verbatim}
\renewcommand{\fnum@figure}%
{\textbf{Fig.~\thefigure}}
\end{verbatim}
\end{narrowversion}
\end{quote}
which will cause the number to be typeset in bold face. (Note that
the original definition used \nothtml{\csx{figurename}~--- }%
\Qref{\csx{figurename}}{Q-fixnam}.) More elaborate changes can be
made by patching the \csx{caption} command, but since there are
packages to do the job, such changes (which can get rather tricky)
aren't recommended for ordinary users.
The \Package{float} package provides some control of the appearance of
captions, though it's principally designed for the creation of
non-standard floats. The \Package{caption} and \Package{ccaption}
(note the double ``\emph{c}'') packages provide a range of different
formatting options.
\Package{ccaption} also provides `continuation' captions and captions
that can be placed outside of float environments. The (very simple)
\Package{capt-of} package also allows captions outside a float
environment. Note that care is needed when doing things that assume
the sequence of floats (as in continuation captions), or potentially
mix non-floating captions with floating ones.
The \Class{memoir} class includes the facilities of the
\Package{ccaption} package; the \Class{KOMA-script} classes also
provide a wide range of caption-formatting commands.
The documentation of \Package{caption} is available by processing a
file \File{manual.tex}, which is created when you unpack
\File{caption.dtx}
Note that the previously-recommended package \Package{caption2} has
now been overtaken again by \Package{caption}; however,
\Package{caption2} remains available for use in older documents.
\begin{ctanrefs}
\item[caption.sty]\CTANref{caption}
\item[capt-of.sty]\CTANref{capt-of}
\item[ccaption.sty]\CTANref{ccaption}
\item[float.sty]\CTANref{float}
\item[\nothtml{\rmfamily}KOMA script bundle]\CTANref{koma-script}
\item[memoir.cls]\CTANref{memoir}
\end{ctanrefs}
\Question[Q-fancyhdr]{Alternative head- and footlines in \LaTeX{}}
\keywords{headings header footer headline footline}
The standard \LaTeX{} document classes define a small set of `page
styles' which specify head- and footlines for your document (though
they can be used for other purposes, too). The standard set is very
limited, but \LaTeX{} is capable of much more. The internal
\LaTeX{} coding needed to change page styles is not particularly
challenging, but there's no need~--- there are packages that provide
useful abstractions that match the way we typically think about these
things.
The \Package{fancyhdr} package provides
simple mechanisms for defining pretty much every head- or footline
variation you could want; the directory also contains some
documentation and one or two smaller packages. \Package{Fancyhdr}
also deals with the tedious behaviour of the standard styles with
\Qref*{initial pages}{Q-nopageno}, by enabling you to define
different page styles for initial and for body pages.
While \Package{fancyhdr} will work with \Class{KOMA-script} classes,
an alternative package, \Package{scrpage2}, eases integration with the
classes. \Package{Scrpage2} may also be used as a \Package{fancyhdr}
replacement, providing similar facilities. The \Class{KOMA-script}
classes themselves permit some modest redefinition of head- and
footlines, without the use of the extra package.
\Class{Memoir} also contains the functionality of \Package{fancyhdr},
and has several predefined styles.
Documentation of \Package{fancyhdr} is distributed with the package,
in a separate file; documentation of \Package{scrpage2} is integrated
with the \File{scrgui*} documentation files that are distributed with
the \Class{KOMA-script} classes.
\begin{ctanrefs}
\item[fancyhdr.sty]\CTANref{fancyhdr}
\item[\nothtml{\rmfamily}KOMA script bundle]\CTANref{koma-script}
\item[memoir.cls]\CTANref{memoir}
\end{ctanrefs}
\Question[Q-widefigs]{Wide figures in two-column documents}
Floating figures and tables ordinarily come out the same width as the
page, but in two-column documents they're restricted to the width of
the column. This is sometimes not good enough; so there are alternative
versions of the float environments~--- in two-column documents,
\texttt{figure*} provides a floating page-wide figure (and \texttt{table*} a
page-wide table) which will do the necessary.
The ``\texttt{*}''ed float environments can only appear at the top of a page,
or on a whole page~--- \texttt{h} or \texttt{b} float placement directives are
simply ignored.
Unfortunately, page-wide equations can only be accommodated inside
float environments. You should include them in \texttt{figure} environments,
or use the \Package{float} or \Package{ccaption}package to define a
new float type.
\begin{ctanrefs}
\item[ccaption.sty]\CTANref{ccaption}
\item[float.sty]\CTANref{float}
\end{ctanrefs}
\Question[Q-onecolabs]{1-column abstract in 2-column document}
One often requires that the abstract of a paper should appear across
the entire page, even in a two-column paper. The required trick is:
\begin{quote}
\begin{verbatim}
\documentclass[twocolumn]{article}
...
\begin{document}
... % \author, etc
\twocolumn[
\begin{@twocolumnfalse}
\maketitle
\begin{abstract}
...
\end{abstract}
\end{@twocolumnfalse}
]
\end{verbatim}
\end{quote}
Unfortunately, with the above \csx{thanks} won't work in the
\csx{author} list. If you need such specially-numbered footnotes, you
can make them like this:
\begin{quote}
\begin{verbatim}
\title{Demonstration}
\author{Me, You\thanks{}}
\twocolumn[
... as above ...
]
{
\renewcommand{\thefootnote}%
{\fnsymbol{footnote}}
\footnotetext[1]{Thanks for nothing}
}
\end{verbatim}
\end{quote}
and so on.
As an alternative, among other facilities the \Package{abstract} package
provides a
\csx{saythanks} command and a \environment{onecolabstract} environment
which remove the need to fiddle with the \csx{thanks} and
footnoting. They can be used like this:
\begin{quote}
\begin{verbatim}
\twocolumn[
\maketitle % full width title
\begin{onecolabstract} % ditto abstract
... text
\end{onecolabstract}
]
\saythanks % typeset any \thanks
\end{verbatim}
\end{quote}
The \Class{memoir} class offers all the facilities of \Package{abstract}.
\begin{ctanrefs}
\item[abstract.sty]\CTANref{abstract}
\item[memoir.cls]\CTANref{memoir}
\end{ctanrefs}
\Question[Q-reallyblank]{Really blank pages between chapters}
If you're using the standard classes, you need to take special action;
the \Class{memoir} class and the \Class{Koma-Script} classes provide
their own support for this~--- see below.
\Class{Book} (by default) and \Class{report} (with \pkgoption{openright} class
option) ensure that each chapter starts on a right-hand (recto) page;
they do this by inserting a \csx{cleardoublepage} command between
chapters (rather than a mere \csx{clearpage}). The empty page thus
created gets to have a normal running header, which some people don't
like.
The (excellent) \Package{fancyhdr} manual covers this issue, basically
advising the creation of a command \csx{clearemptydoublepage}:
\begin{quote}
\begin{verbatim}
\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{%
\clearpage
{\pagestyle{empty}\origdoublepage}%
}
\end{verbatim}
\end{quote}
The ``obvious'' thing is then to use this command to replace
\csx{cleardoublepage} in a patched version of the \csx{chapter} command.
(Make a package of your own containing a copy
of the command out of the class.) This isn't particularly difficult,
but you can instead simply subvert \csx{cleardoublepage} (which isn't
often used elsewhere):
\begin{quote}
\begin{verbatim}
\let\cleardoublepage\clearemptydoublepage
\end{verbatim}
\end{quote}
Note: this command works because \csx{clearemptydoublepage} uses a copy
of \csx{cleardoublepage}: instructions on macro programming
% beware line break
\Qref*[question]{patching techniques}{Q-patch} explain the problem and
why this is a solution.
The \Package{emptypage} package does this sort of thing for you; all
you need do is load the package, and it does the rest.
The \emph{\acro{KOMA}-Script} replacements for the
\Class{book} and \Class{report} classes (\Class{scrbook} and
\Class{scrreprt} offers class options \pkgoption{cleardoubleempty},
\pkgoption{cleardoubleplain} and \pkgoption{cleardoublestandard}
(using the running page style, as normal) that control the appearance
of these empty pages. The classes also offer do-it-yourself commands
\csx{cleardoubleempty} (etc.\@).
The \Class{memoir} class (and the \Package{nextpage} package)
provide commands \csx{cleartooddpage} and \csx{cleartoevenpage},
which both take an optional argument (the first, with no argument,
being an equivalent of \csx{cleardoublepage}). One can achieve
`special' effects by putting commands in the optional argument: the
\csx{clearemptydoublepage} we're after would be achieved by
\csx{cleartooddpage[}\cmdinvoke{thispagestyle}{empty}\texttt{]}. The
commands will also serve if you want the surreal effect of ``This page
intentionally left blank'' in the centre of an otherwise empty page.
\begin{ctanrefs}
\item[emptypage.sty]\CTANref{emptypage}
\item[fancyhdr.sty]\CTANref{fancyhdr}
\item[memoir.cls]\CTANref{memoir}
\item[nextpage.sty]\CTANref{nextpage}
\item[scrbook.cls, scrrept.cls]Part of \CTANref{koma-script}
\end{ctanrefs}
\Question[Q-balance]{Balancing columns at the end of a document}
The \Package{twocolumn} option of the standard classes causes
\LaTeX{} to set the text of a document in two columns. However, the last
page of the document typically ends up with columns of different
lengths~--- such columns are said to be ``unbalanced''. Many (most?)
people don't like unbalanced columns.
The simplest solution to the problem is to use the \Package{multicol}
package in place of the \Package{twocolumn} option, as
\Package{multicol} balances the columns on the final page by default.
However, the use of \Package{multicol} does come at a cost: its
special output routine disallows the use of in-column floats, though
it does still permit full-width (e.g., \environment{figure*}
environment) floats.
As a result, there is a constant push for a means of balancing columns
at the end of a \Package{twocolumn} document. Of course, the job can
be done manually: \csx{pagebreak} inserted at the appropriate place on
the last page can often produce the right effect, but this seldom
appeals, and if the last page is made up of automatically-generated
text (for example, bibliography or index) inserting the command will
be difficult.
The \Package{flushend} package offers a solution to this problem. It's a
somewhat dangerous piece of macro code, which patches one of the most
intricate parts of the \LaTeX{} kernel without deploying any of the
safeguards discussed in \Qref[question]{patching commands}{Q-patch}.
The package only changes the behaviour at end document (its
\csx{flushend} command is enabled by default), and one other command
permits adjustment of the final balance; other packages in the bundle
provide means for insertion of full width material in two-column
documents.
The \Package{balance} package also patches the output routine
(somewhat more carefully than \Package{flushend}).
The user should be aware that any of these packages are liable to
become confused in the presence of floats: if problems arise, manual
adjustment of the floats in the document is likely to be necessary.
It is this difficulty (what's required in any instance can't really be
expressed in current \LaTeX{}) that led the author of
\Package{multicol} to suppress single-column-wide floats.
\begin{ctanrefs}
\item[balance.sty]Distributed as part of \CTANref{preprint}[balance]
\item[flushend.sty]Distributed as part of \CTANref{sttools}[flushend]
\item[multicol.sty]Distributed as part of \CTANref{2etools}[multicol]
\end{ctanrefs}
\Question[Q-runheadtoobig]{My section title is too wide for the page header}
By default, \LaTeX{} sectioning commands make the chapter or section
title available for use by page headers and the like. Page headers
operate in a rather constrained area, and it's common for titles too
be too big to fit: the \LaTeX{} sectioning commands therefore take an
optional argument:
\begin{quote}
\begin{verbatim}
\section[short title]{full title}
\end{verbatim}
\end{quote}
If the \meta{short title} is present, it is used both for the table of
contents and for the page heading. The usual answer to people who
complain that their title is too big for the running head is to
suggest that they the optional argument.
However, using the same text for the table of contents as for the
running head may also be unsatisfactory: if your chapter titles are
seriously long (like those of a Victorian novel), a valid and rational
scheme is to have a shortened table of contents entry, and a really
terse entry in the running head.
One of the problems is the tendency of page headings to be set in
capitals (which take up more space); so why not set headings as written
for ``ordinary'' reading? It's not possible to do so with unmodified
\LaTeX{}, but the \Package{fancyhdr} package provides a command
\csx{nouppercase} for use in its header (and footer) lines to suppress
\LaTeX{}'s uppercasing tendencies. Classes in the \Class{KOMA-script}
bundle don't uppercase in the first place.
In fact, the sectioning commands use `mark' commands to pass
information to the page headers. For example, \csx{chapter} uses
\csx{chaptermark}, \csx{section} uses \csx{sectionmark}, and so on. With
this knowledge, one can achieve a three-layer structure for chapters:
\begin{quote}
\begin{verbatim}
\chapter[middling version]{verbose version}
\chaptermark{terse version}
\end{verbatim}
\end{quote}
which should supply the needs of every taste.
Chapters, however, have it easy: hardly any book design puts a page
header on a chapter start page. In the case of sections, one has
typically to take account of the nature of the \csx{*mark} commands:
the thing that goes in the heading is the first mark on the page (or,
failing any mark, the last mark on any previous page). As a result
the recipe for sections is more tiresome:
\begin{quote}
\begin{verbatim}
\section[middling version]{verbose version%
\sectionmark{terse version}}
\sectionmark{terse version}
\end{verbatim}
\end{quote}
(the first \csx{sectionmark} deals with the header of the page the
\csx{section} command falls on, and the second deal with subsequent
pages; note that here, you need the optional argument to \csx{section},
even if ``\emph{middling version}'' is in fact the same text as
``\emph{long version''}.)
A similar arrangement is necessary even for chapters if the class
you're using is odd enough that it puts a page header on a chapter's
opening page.
Note that the \Package{titlesec} package manages the running heads in
a completely different fashion; users of that package should refer to
the documentation.
The \Class{memoir} class avoids all the silliness by providing an
extra optional argument for chapter and sectioning commands, for
example:
\begin{quote}
\begin{narrowversion}
\begin{verbatim}
\section[middling version][terse version]%
{verbose version}
\end{verbatim}
\end{narrowversion}
\begin{wideversion}
\begin{verbatim}
\section[middling version][terse version]{verbose version}
\end{verbatim}
\end{wideversion}
\end{quote}
As a result, it is always possible for users of \Class{memoir} to
tailor the header text to fit, with very little trouble.
\begin{ctanrefs}
\item[fancyhdr.sty]\CTANref{fancyhdr}
\item[\nothtml{\rmfamily}KOMA script bundle]\CTANref{koma-script}
\item[memoir.cls]\CTANref{memoir}
\item[titlesec.sty]\CTANref{titlesec}
\end{ctanrefs}
\nothtml{\begingroup\boldmath}
\Question[Q-nofm]{Page numbering ``\meta{n} of \meta{m}''}
\nothtml{\afterquestion}
Finding the page number of the last page of a document, from within
the document, is somewhat tricky. The \Package{lastpage} package is
therefore supplied to make life easy for us all; it defines a label
\texttt{LastPage} whose number is \emph{right} (after sufficiently many
passes through \LaTeX{}, of course). The \Class{memoir} class also
defines a ``last page'' label.
The documentation of the \Package{fancyhdr} package spells out exactly
how one might actually use this information to produce page numbering
as suggested in the question.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}fancyhdr documentation]\CTANref{fancyhdr}
\item[lastpage.sty]\CTANref{lastpage}
\end{ctanrefs}
\Question[Q-pagebychap]{Page numbering by chapter}
When I was a young man, a common arrangement for loose bound technical
manuals is to number pages by chapter. (It's quite a good scheme, in
those situations: even if your corrections add a whole page to the
chapter, the most you have to redistribute is that chapter.)
The problem, at first sight, seems pretty much the same as that in
another answer on
% beware line break
\Qref*{running numbers within a chapter}{Q-running-nos},
and the basic technique is indeed pretty similar.
However, tidying-up loose ends, making sure the page number gets reset
to the correct value at the start of each chapter, and so on, is
slightly more challenging. This is why the \Package{chappg} package
was written: it does the obvious things, and more.
Users have been known to ask for running page numbers within a
section, but this really doesn't make sense: you need to run page
numbers within document objects that always start on a fresh page.
\begin{ctanrefs}
\item[chappg.sty]\CTANref{chappg}
\end{ctanrefs}
\subsection{Page layout}
\Question[Q-papersize]{The size of printed output}
The final product of a \AllTeX{} run is something for a person to
read. Often, nowadays, that product will be read ``on-screen'', but
the printed page remains a principal output form.
When we come to print our output, it is important that the output fits
on the paper; in some cases, for the output to ``fit'' is good enough.
However, there are circumstances where the actual size of the printed
output, on the page, is crucial to the acceptance of the output.
(This might happen when the output is a book to be published, or when
it's a dissertation which must match the fancies of some bureaucrat
even to be considered.)
Sadly, we often find that the printed output doesn't conform to our
expectations\dots{}
The check-list for such problems has two entries:
\begin{itemize}
\item Your output is generated via Adobe \ProgName{Reader} (or
possibly ``\ProgName{Acrobat Reader}''~--- older versions of the
program had the qualified name). In this case, it may be that
\ProgName{Reader} is willfully changing the size of your output:
read \Qref*{\ProgName{Reader} antics}{Q-acroantics}.
\item Something in your \TeX{} system is producing the wrong size (or
shape) of output: read \Qref*{paper geometry}{Q-papergeom}.
\end{itemize}
An alternative approach is to use the (excellent) \Package{testflow}
suite, that provides a detailed outline of the potential problems
together with a sample document and prototype outputs.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}testflow bundle]\CTANref{testflow}
\end{ctanrefs}
\Question[Q-acroantics]{Adobe \ProgName{Reader} messing with print size}
\AliasQuestion{Q-outszwrng}
Printing from Adobe \ProgName{Reader} shrinks the page ``to fit''
(\emph{by default}). Unfortunately, its calculation doesn't consider
the existing margins of the document, so that it shrinks what it
believes is your whole page onto what it believes is its output page.
The effect typically looks as if your margins have expanded.
Solve this problem by adjusting the \ProgName{Reader}'s default in the
print dialogue; unfortunately, this dialogue varies from one version
to the next:
\begin{itemize}
\item \ProgName{Reader} version 7:\\
Page Scaling (default: ``Fit to printer margins'')~--- change to
``None'', and\\
Scale (default 95\textpercent{} of Normal size)~--- change to
``100\textpercent''.
\item Adobe Reader 6:\\
in the print dialogue, on the ``copies \& pages'' pane, you'll find a
popup menu/drop-down list titled ``Page Scaling''~--- change to ``None''.
\item Windows, Linux Acrobat (Reader) 5.0:\\
In the print dialog, make sure the ``Shrink oversized pages to fit''
checkbox is unchecked. It may also be useful to uncheck the
``Expand small pages to fit paper size'' checkbox as well.
\end{itemize}
\Question[Q-papergeom]{Getting the right paper geometry from \AllTeX{}}
If your output is the wrong size, and you've checked that it's not due
to the \Qref*{ministrations of Adobe \ProgName{Reader}}{Q-acroantics},
the problem is probably that your \AllTeX{} system is producing output
that specifies the wrong paper size. Paper sizes can be a pain:
they're a forgotten backwater~--- Knuth seems not to have considered
paper size as something the \TeX{} engine needs to know about. As a
result, there is no \acro{DVI} command to specify the paper on which
the document should be printed, which has led a dichotomy where macros
shape the text according to the needs of the author's chosen paper
size, and device drivers' choice happens independently of the macros'
ideas.
In practice, one usually finds that macro packages (such as \plaintex{} and
\LaTeX{}) assume American ``letter'' paper size, by default; and since
most distributions nowadays originate in Europe, the drivers usually
default to \acro{ISO} ``A4'' paper size.
This is (of course) pretty unsatisfactory. Users may select a
different paper size for their document (current \LaTeX{} offers a
range of sizes as options in the standard classes), pretty easily.
Nevertheless, the user also has to be sure that each time
\ProgName{xdvi}, \ProgName{dvips} (or whatever) runs, it uses the
paper size the document was designed for.
The default paper size for \acro{DVI} drivers may be changed by a
distribution management command (\ProgName{texconfig} for \texlive{},
the \ProgName{Options} application for \miktex{}), but this still
doesn't provide for people using the ``wrong'' sort of paper for some
reason.
A different issue arises for users of \PDFTeX{}~--- the
\acro{PDF} format \emph{does} have the means of expressing paper size
and \PDFTeX{} has system variables \csx{pdfpagewidth} and
\csx{pdfpageheight}, that are written into the output \acro{PDF} file.
Unfortunately, most of the core software predates \PDFTeX{}, so not even
\PDFLaTeX{} sets the correct values into those variables, to match the
paper size specified in a \csx{documentclass} option.
The \acro{DVI} drivers \ProgName{dvips} and \ProgName{dvipdfm} define
\csx{special} commands for the document to specify its own paper size;
so in those cases, as when \PDFTeX{} or V\TeX{} is being used, the
paper size can be programmed by the document. Users who wish to, may
of course consult the manuals of the various programs to write the
necessary code.
The \Package{geometry} package (whose main business is defining
typeset page areas), also takes notice the size of the paper that the
document is going to be printed on, and can issue the commands
necessary to ensure the correct size of paper is used. If
\Package{geometry} is used when a document is being processed by
\PDFLaTeX{}, it can set the necessary dimensions ``in the output''.
If the document is being processed by \LaTeX{} on a \TeX{} or \eTeX{}
engine, there are package options which instruct \Package{geometry}
which \csx{special} commands to use. (Note that the options are
ignored if you are using either \PDFLaTeX{} or V\TeX{}.)
So, the resolution of the problem is to add
\begin{quote}
\begin{verbatim}
\usepackage[dvixxx,...]{geometry}
\end{verbatim}
\end{quote}
(where \pkgoption{dvixxx} is your current favourite \acro{DVI}
driver~--- \Package{geometry} knows about \pkgoption{dvips} and
\pkgoption{dvipdfm}), and the document will run correctly with
\LaTeX{}. If you're using \PDFLaTeX{}, load with
\begin{quote}
\begin{verbatim}
\usepackage[pdftex,...]{geometry}
\end{verbatim}
\end{quote}
Needless to say, both the ``big'' classes (\Class{koma-script} and
\Class{memoir}) provide their own ways to get the paper size
``right''.
The \Package{typearea} package is the \Class{Koma-script}
distribution's way of providing page layout functionality. Load it
with the \pkgoption{pagesize} option and it will ensure the correct
paper is selected, for \acro{PDF} output from \PDFLaTeX{}, and for
\PS{} output from \LaTeX{} via \ProgName{dvips}.
\Class{Memoir} has the standard classes' paper-size selections
(\pkgoption{a4paper}, \pkgoption{letterpaper} and so on), but also
permits the user to choose an arbitrary paper size, by setting the
length registers \csx{stockheight} and \csx{stockwidth}. The commands
\csx{fixdvipslayout} (for \LaTeX{} processing), and \csx{fixpdflayout}
(for \PDFLaTeX{} processing) then instruct the processor to produce
output that specifies the necessary paper size.
\begin{ctanrefs}
\item[geometry.sty]\CTANref{geometry}
\item[memoir.cls]\CTANref{memoir}
\item[typearea.sty]Distributed as part of \CTANref{koma-script}[typearea]
\end{ctanrefs}
\Question[Q-changemargin]{Changing the margins in \LaTeX{}}
Changing the layout of a document's text on the page involves several
subtleties not often realised by the beginner. There are interactions
between fundamental \TeX{} constraints, constraints related to the
design of \LaTeX{}, and good typesetting and design practice, that
mean that any change must be very carefully considered, both to ensure
that it ``works'' and to ensure that the result is pleasing to the
eye.
\LaTeX{}'s defaults sometimes seem excessively conservative,
but there are sound reasons behind how Lamport designed the layouts
themselves, whatever one may feel about his overall design. For
example, the common request for ``one-inch margins all round on A4
paper'' is fine for 10- or 12-pitch typewriters, but not for 10pt (or
even 11pt or 12pt) type because readers find such wide, dense, lines
difficult to read. There should ideally be no more than 75 characters
per line (though the constraints change for two-column text).
So Lamport's warning to beginners in his section on `Customizing the
Style'~--- ``don't do it''~--- should not lightly be ignored.
This set of \acro{FAQ}s recommends that you use a package to establish
consistent settings of the parameters: the interrelationships are
taken care of in the established packages, without you \emph{needing}
to think about them, but remember~--- the packages only provide
consistent, working, mechanisms: they don't analyse the quality of
what you propose to do.
The following answers deal with the ways one may choose to proceed:
\begin{itemize}
\item \Qref*{Choose which package to use}{Q-marginpkgs}.
\item \Qref*{Find advice on setting up page layout by hand}{Q-marginmanual}.
\end{itemize}
There is a related question~--- how to change the layout
temporarily~--- and there's an answer that covers that, too:
\begin{itemize}
\item \Qref*{Change the margins on the fly}{Q-chngmargonfly}.
\end{itemize}
\Question[Q-marginpkgs]{Packages to set up page designs}
The `ultimate' tool for adjusting the dimensions and position of the
printed material on the page is the \Package{geometry} package; a very
wide range of adjustments of the layout may be relatively
straightforwardly programmed, and package documentation is good and
comprehensive.
As is usual, users of the \Class{memoir} class have built-in
facilities for this task, and users of the \Class{KOMA-script} classes
are recommended to use an alternative package, \Package{typearea}. In
either case it is difficult to argue that users should go for
\Package{geometry}: both alternatives are good.
The documentation of \Package{geometry} is a bit overwhelming, and
learning all its capabilities may be more than you ever need.
Somewhat simpler to use is the \Package{vmargin} package, which has a
canned set of paper sizes (a superset of that provided in \LaTeXe{}),
provision for custom paper, margin adjustments and provision for
two-sided printing.
\begin{ctanrefs}
\item[geometry.sty]\CTANref{geometry}
\item[\nothtml{\rmfamily}KOMA script bundle]\CTANref{koma-script}
\item[layout.sty]Distributed as part of \CTANref{2etools}[layout]
\item[memoir.cls]\CTANref{memoir}
\item[typearea.sty]Distributed as part of \CTANref{koma-script}[typearea]
\item[vmargin.sty]\CTANref{vmargin}
\end{ctanrefs}
\Question[Q-marginmanual]{How to set up page layout ``by hand''}
So you're eager to do it yourself, notwithstanding the cautions
\begin{narrowversion}
outlined above (\Qref{}{Q-changemargin}).
\end{narrowversion}
\begin{wideversion}
outlined in ``\Qref{changing margins}{Q-changemargin}''.
\end{wideversion}
It's important that you first start by familiarising yourself
with LaTeX's page layout parameters. For example, see section C.5.3 of the
\LaTeX{} manual (pp.~181-182), or corresponding sections in many of the other
good \LaTeX{} manuals (see \Qref[question]{\LaTeX{} books}{Q-books}).
\LaTeX{} controls the page layout with a number of parameters, which
allow you to change the distance from the edges of a page to the left
and top edges of your typeset text, the width and height of the text,
and the placement of other text on the page. However, they are
somewhat complex, and it is easy to get their interrelationships wrong
when redefining the page layout. The layout package defines a
\csx{layout} command which draws a diagram of your existing page
layout, with the dimensions (but not their interrelationships) shown.
Even changing the text height and width, \csx{textheight} and
\csx{textwidth}, requires more care than you might expect: the height
should be set to fit a whole number of text lines (in terms of
multiples of \csx{baselinskip}), and the width should be constrained
by the number of characters per line, as mentioned in % ! line break
``\Qref*{changing margins}{Q-changemargin}''.
Margins are controlled by two parameters: \csx{oddsidemargin} and
\csx{evensidemargin}, whose names come from the convention that
odd-numbered pages appear on the right-hand side (`recto') of a
two-page spread and even-numbered pages on the left-hand side
(`verso'). Both parameters actually refer to the left-hand margin of
the relevant pages; in each case the right-hand margin is specified by
implication, from the value of \csx{textwidth} and the width of the
paper. (In a one-sided document, which is the default in many
classes, including the standard \Class{article} and \Class{report}
classes, \csx{oddsidemargin} stands for both.)
The
``origin'' (the zero position) on the page is one inch from the top of
the paper and one inch from the left side; positive horizontal
measurements extend right across the page, and positive vertical
measurements extend down the page. Thus, the parameters
\csx{evensidemargin}, \csx{oddsidemargin} and \csx{topmargin}, should
be set to be 1~inch less than the true margin; for margins closer to
the left and top edges of the page than 1~inch, the margin parameters
must be set to negative values.
\Question[Q-chngmargonfly]{Changing margins ``on the fly''}
One of the surprises characteristic of \TeX{} use is that you cannot
change the width or height of the text within the document, simply by
modifying the text size parameters; \TeX{} can't change the text width
on the fly, and \LaTeX{} only ever looks at text height when starting
a new page.
So the simple rule is that the parameters should only be
changed in the preamble of the document, i.e., before the
\cmdinvoke{begin}{document} statement (so before any typesetting has
happened.
To adjust text width within a document we define an environment:
\begin{quote}
\begin{verbatim}
\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\parsep}{\parskip}%
}%
\item[]}{\end{list}}
\end{verbatim}
\end{quote}
The environment takes two arguments, and will indent the left and
right margins, respectively, by the parameters' values. Negative
values will cause the margins to be narrowed, so
\cmdinvoke{begin}{changemargin}{-1cm}{-1cm} narrows the left and right
margins by 1 centimetre.
Given that \TeX{} can't do this, how does it work?~--- well, the
environment (which is a close relation of the \LaTeX{}
\environment{quote} environment) \emph{doesn't} change the text width
as far as \TeX{} is concerned: it merely moves text around inside the
width that \TeX{} believes in.
The \Package{changepage} package provides ready-built commands to do
the above; it includes provision for changing the shifts applied to
your text according to whether you're on an odd (\emph{recto}) or an
even (\emph{verso}) page of a two-sided document.
\Package{Changepage}'s structure matches that of the \Class{memoir}
class.
The (earlier) package \Package{chngpage} provides the same facilities,
but it uses rather different syntax. \Package{Changepage}'s structure
matches that of the \Class{memoir} class, and it should be used for
any new work.
Changing the vertical dimensions of a page is more clumsy still: the
\LaTeX{} command \csx{enlargethispage} adjusts the size of the current
page by the size of its argument. Common uses are
\begin{quote}
\begin{verbatim}
\enlargethispage{\baselineskip}
\end{verbatim}
\end{quote}
to make the page one line longer, or
\begin{quote}
\begin{verbatim}
\enlargethispage{-\baselineskip}
\end{verbatim}
\end{quote}
to make the page one line shorter. The process is (to an extent)
simplified by the \Package{addlines} package: its \csx{addlines}
command takes as argument the \emph{number} of lines to add to the
page (rather than a length): the package documentation also provides a
useful analysis of when the command may (or may not) be expected to
work.
\begin{ctanrefs}
\item[addlines.sty]\CTANref{addlines}
\item[changepage.sty]\CTANref{changepage}
\end{ctanrefs}
\Question[Q-nopageno]{How to get rid of page numbers}
\AliasQuestion{ps@empty}
Very occasionally, one wants a document with no page numbers. For
such occasions, the package \Package{nopageno} will make
\cmdinvoke{pagestyle}{plain} have the same effect as
\cmdinvoke{pagestyle}{empty}; in simple documents, this will suppress
all page numbering (it will not work, of course, if the document uses
some other pagestyle than \environment{plain}).
To suppress page numbers from a sequence of pages, you may use
\cmdinvoke{pagestyle}{empty} at the start of the sequence, and restore
the original page style at the end. Unfortunately, you still have to
deal with the page numbers on pages containing a \csx{maketitle},
\csx{part} or \csx{chapter} command, since the standard classes; deal
with those separately, as described below.
To suppress page numbers on a single page, use
\cmdinvoke{thispagestyle}{empty} somewhere within the text of the
page. Note that, in the standard classes, \csx{maketitle} and
\csx{chapter} use \csx{thispagestyle} internally, so your call
must be \emph{after} those commands.
Unfortunately, \csx{thispagestyle} doesn't work for \Class{book} or
\Class{report} \csx{part} commands: they set the page style (as do
\csx{chapter} commands), but then they advance to the next page so
that you have no opportunity to change the style using
\csx{thispagestyle}. The present author has proposed solving the
problem with the following ``grubby little patch'', on
\Newsgroup{comp.text.tex}:
\begin{quote}
\begin{verbatim}
\makeatletter
\let\sv@endpart\@endpart
\def\@endpart{\thispagestyle{empty}\sv@endpart}
\makeatother
\end{verbatim}
\end{quote}
Both the \Class{KOMA-script} classes and \Class{memoir} have separate
page styles for the styles of various ``special'' pages, so, in a
\Class{KOMA} class document one might say:
\begin{quote}
\begin{verbatim}
\renewcommand*{\titlepagestyle}{empty}
\end{verbatim}
\end{quote}
while \Class{memoir} will do the job with
\begin{quote}
\cmdinvoke{aliaspagestyle}{title}{empty}
\end{quote}
An alternative (in all classes) is to use the rather delightful
\cmdinvoke{pagenumbering}{gobble}; this has the simple effect that any
attempt to print a page number produces nothing, so there's no issue
about preventing any part of \LaTeX{} from printing the number.
However, the \csx{pagenumbering} command does have the side effect that
it resets the page number (to 1), so it is unlikely to be helpful
other than at the beginning of a document.
The \Package{scrpage2} package separates out the representation of the
page number (it typesets the number using the \csx{pagemark} command) from
the construction of the page header and footer; so one can say
\begin{quote}
\begin{verbatim}
\renewcommand*{\pagemark}{}
\end{verbatim}
\end{quote}
which will also suppress the printing of the page number.
Neither of these ``suppress the page number'' techniques touches the
page style in use; in practice this means they don't make sense unless
you are using \cmdinvoke{pagestyle}{plain}
\begin{ctanrefs}
\item[fancyhdr.sty]\CTANref{fancyhdr}
\item[\nothtml{\rmfamily}KOMA script bundle]\CTANref{koma-script}
\item[memoir.cls]\CTANref{memoir}
\item[nopageno.sty]\CTANref{nopageno}
\item[scrpage2.sty]Distributed as part of \CTANref{koma-script}
\end{ctanrefs}
\Question[Q-crop]{How to create crop marks}
If you're printing something that's eventually to be reproduced in
significant quantities, and bound, it's conventional to print on paper
larger than your target product, and to place ``crop marks'' outside
the printed area. These crop marks are available to the production
house, for lining up reproduction and trimming machines.
You can save yourself the (considerable) trouble of programming these
marks for yourself by using the package \Package{crop}, which has
facilities to satisfy any conceivable production house. Users of the
\Class{memoir} class don't need the package, since \Class{memoir} has
its own facilities for programming crop marks.
\begin{ctanrefs}
\item[crop.sty]\CTANref{crop}
\item[memoir.cls]\CTANref{memoir}
\end{ctanrefs}
\Question[Q-watermark]{`Watermarks' on every page}
It's often useful to place some text (such as `DRAFT') in the
background of every page of a document. For \LaTeX{} users, this can
be achieved with the \Package{draftcopy} package. This can deal with
many types of \acro{DVI} processors (in the same way that the graphics
package does) and knows translations for the word `DRAFT' into a wide
range of languages (though you can choose your own word, too).
Unfortunately, however, the package relies on \PS{} specials, and will
therefore fail if you are viewing your document with \ProgName{xdvi},
and won't even compile if you're using \PDFLaTeX{}. (\PDFLaTeX{}
users need one of the other solutions below.)
The \Package{wallpaper} package builds on \Package{eso-pic} (see
below). Apart from the single-image backdrops described above
(``wallpapers'', of course, to this package), the package provides
facilities for tiling images. All its commands come in pairs: one for
``general'' use, and one applying to the current page only.
The \Package{draftwatermark} package uses the same author's
\Package{everypage} package to provide a simple interface for adding
textual (`DRAFT'-like) watermarks.
More elaborate watermarks may be achieved using the \Package{eso-pic}
package, which in turn uses the package \Package{everyshi}, or by
using \Package{everypage}. \Package{Eso-pic} attaches a
\environment{picture} environment to every page as it is shipped out;
you can put things into that environment. The package provides
commands for placing things at certain useful points (like ``text
upper left'' or ``text centre'') in the picture, but you're at liberty
to do what you like.
\Package{Eso-pic} is, in turn, built upon the package
\Package{atbegshi}. That package has the capability to produce
watermarks \emph{on top of} the other material on the page; this
doesn't sound very ``watermark-like'', but can be useful on pages
where the watermark would otherwise be hidden by graphics or the
like. The \Package{atbegshi} command that \Package{eso-pic} uses is
\csx{AtBeginShipoutUpperLeft}; \csx{AtBeginShipoutUpperLeftForeground}
is what's needed instead to place the material on top of the rest of
the content of the page.
\Package{Everypage} allows you to add ``something'' to every page, or
to a particular page; you therefore need to construct your own
apparatus for anything complicated.
\begin{ctanrefs}
\item[atbegshi.sty]Distributed as part of \CTANref{oberdiek}[atbegshi]
\item[draftcopy.sty]\CTANref{draftcopy}
\item[draftwatermark.sty]\CTANref{draftwatermark}
\item[eso-pic.sty]\CTANref{eso-pic}
\item[everypage.sty]\CTANref{everypage}
\item[everyshi.sty]Distributed as part of \CTANref{ms}[everyshi]
\item[wallpaper.sty]\CTANref{wallpaper}
\end{ctanrefs}
\Question[Q-landscape]{Typesetting things in landscape orientation}
It's often necessary to typeset part of a document in landscape
orientation; to achieve this, one needs not only to change the page
dimensions, but also to instruct the output device to print the
strange page differently.
There are two ``ordinary'' mechanisms for doing two slight variations
of landscape typesetting:
\begin{itemize}
\item If you have a single floating object that is wider than it is
deep, and will only fit on the page in landscape orientation, use
the \Package{rotating} package; this defines
\environment{sidewaysfigure} and \environment{sidewaystable}
environments which create floats that occupy a whole page.
Note that \Package{rotating} has problems in a document that also
loads the \Package{float} package, which recommended in other
answers in these \acro{FAQ}s, for example that on
\Qref*{float placement}{Q-floats}. The \Package{rotfloat} package
loads \Package{rotating} for you, and smooths the interaction with
\Package{float}.
\item If you have a long sequence of things that need to be typeset in
landscape (perhaps a code listing, a wide \environment{tabbing}
environment, or a huge table typeset using \Package{longtable} or
\Package{supertabular}), use the \Package{lscape} package (or
\Package{pdflscape} if you're generating \acro{PDF} output, whether
using \PDFLaTeX{} or \ProgName{dvips} and generating \acro{PDF} from
that). Both packages define an environment \environment{landscape}, which
clears the current page and restarts typesetting in landscape
orientation (and clears the page at the end of the environment
before returning to portrait orientation).
\end{itemize}
No currently available package makes direct provision for typesetting
in both portrait and landscape orientation on the same page (it's not
the sort of thing that \TeX{} is well set-up to do). If such
behaviour was an absolute necessity, one might use the techniques
described in
% beware line-wrap
\Qref[question]{"flowing text around figures"}{Q-textflow}, and would
rotate the landscape portion using the rotation facilities of the
\Package{graphics} package. (Returning from landscape to portrait
orientation would be somewhat easier: the portrait part of the page
would be a bottom float at the end of the landscape section, with its
content rotated.)
To set an entire document in landscape orientation, one might use
\Package{lscape} around the whole document. A better option is the
\pkgoption{landscape} option of the \Package{geometry} package; if you
also give it \pkgoption{dvips} or \pkgoption{pdftex} option,
\Package{geometry} also emits the rotation instructions to cause the
output to be properly oriented. The \Class{memoir} class has the same
facilities, in this respect, as does \Package{geometry}.
A word of warning: most current \TeX{} previewers do not honour
rotation requests in \acro{DVI} files.
%% (the exception is
%% (the exceptions are the
%% \begin{htmlversion}
%% (\Qref{commercial}{Q-commercial}) \YandY{} previewer
%% \ProgName{dviwindo},
%% \end{htmlversion}
%% \htmlignore
%% (commercial) \YandY{} previewer \ProgName{dviwindo}
%% (\Qref{}{Q-commercial}),
%% \endhtmlignore
%% and
%% the fp\TeX{} previewer Win\acro{DVI}). If your previewer is not
%% capable of rotation,
Your best bet is to convert your output to \PS{} or to \acro{PDF}, and
to view these `final' forms with an appropriate viewer.
\begin{ctanrefs}
\item[geometry.sty]\CTANref{geometry}
\item[graphics.sty]Distributed as part of \CTANref{graphics}
\item[longtable.sty]Distributed as part of \CTANref{2etools}[longtable]
\item[lscape.sty]Distributed as part of \CTANref{graphics}[lscape]
\item[memoir.cls]\CTANref{memoir}
\item[pdflscape.sty]Distributed with Heiko Oberdiek's packages
\CTANref{oberdiek}[pdflscape]
\item[rotating.sty]\CTANref{rotating}
\item[rotfloat.sty]\CTANref{rotfloat}
\item[supertabular.sty]\CTANref{supertabular}
\end{ctanrefs}
\Question[Q-abspos]{Putting things at fixed positions on the page}
\TeX{}'s model of the world is (broadly speaking) that the author
writes text, and \TeX{} and its macros decide how it all fits on the
page. This is not good news for the author who has, from whatever
source, a requirement that certain things go in exactly the right
place on the page.
There \emph{are} places on the page, from which things may be hung,
and two \LaTeX{} packages allow you position things relative to such
points, thus providing a means of absolute positioning.
The \Package{textpos} package aids the construction of pages from
``blobs'', dotted around over the page (as in a poster); you give it
the location, and it places your typeset box accordingly.
The \Package{eso-pic} defines a ``shipout picture'' that covers the
page. The user may add \environment{picture}-mode commands to this
picture, which of course can include box placements as well as the
other rather stilted commands of \environment{picture}-mode.
(\Package{Eso-pic} requires the services of \Package{everyshi}, which
must therefore also be available.)
%
% Fortunately, in the \LaTeX{} world at least, there \emph{is} a fixed
% point on every page, to whit the page header. The package
% \Package{textpos} latches bits of typesetting to locations you
% specify, by fixing them to the page header, and thereby solves the
% problem.
\begin{ctanrefs}
\item[eso-pic.sty]\CTANref{eso-pic}
\item[everyshi.sty]Distributed as part of \CTANref{ms}[everyshi]
\item[textpos.sty]\CTANref{textpos}
\end{ctanrefs}
\Question[Q-nopagebrk]{Preventing page breaks between lines}
One commonly requires that a block of typeset material be kept on the
same page; it turns out to be surprisingly tricky to arrange this.
\LaTeX{} provides a \environment{samepage} environment which claims it
does this sort of thing for you. It proceeds by setting infinite
penalties for all sorts of page-break situations; but in many
situations where you want to prevent a page break,
\environment{samepage} doesn't help. If you're trying to keep running
text together, you need to end the paragraph inside the environment
(see \Qref[question]{preserving paragraph parameters}{Q-paraparam}).
Also, if the things you are trying to keep together insert their own
pagebreak hints, \environment{samepage} has no power over them (though
list items' attempts~--- they suggest page breaks between items~---
are subverted by \environment{samepage}). Naturally, if
\environment{samepage} \emph{does} work, it is capable of leaving
stuff jutting out at the bottom of the page.
A convenient trick is to set all the relevant stuff in a \csx{parbox}
(or a \environment{minipage} if it contains things like verbatim text
that may not be in the argument of a \csx{parbox}). The resulting box
certainly \emph{won't} break between pages, but that's not to say that
it will actually do what you want it to do: again, the box may be left
jutting out at the bottom of the page.
Why do neither of these obvious things work? Because \TeX{} can't
really distinguish between infinitely awful things.
\environment{Samepage} will make any possible break point ``infinitely
bad'' and boxes don't even offer the option of breaks, but if the
alternative is the leave an infinitely bad few centimetres of blank
paper at the bottom of the page, \TeX{} will take the line of least
resistance and do nothing.
This problem still arises even if you have \csx{raggedbottom} in
effect: \TeX{} doesn't notice the value of \emph{that} until it starts
actually shipping a page out. One approach is to set:
\begin{quote}
\begin{verbatim}
\raggedbottom
\addtolength{\topskip}{0pt plus 10pt}
\end{verbatim}
\end{quote}
The \texttt{10pt} offers a hint to the output routine that the column is
stretchable; this will cause \TeX{} to be more tolerant of the need to
stretch while building the page. If you're doing this as a temporary
measure, cancel the change to \csx{topskip} by:
\begin{quote}
\begin{verbatim}
\addtolength{\topskip}{0pt plus-10pt}
\end{verbatim}
\end{quote}
as well as resetting \csx{flushbottom}. (Note that the \texttt{10pt} never
actually shows up, because it is overwhelmed when the page is shipped
out by the stretchability introduced by \csx{raggedbottom}; however, it
could well have an effect if \csx{flushbottom} was in effect.)
An alternative (which derives from a suggestion by Knuth in the
\TeX{}book) is the package \Package{needspace} or the \Class{memoir} class,
which both define a command \csx{needspace} whose argument tells it
what space is needed. If the space isn't available, the current page
is cleared, and the matter that needs to be kept together will be
inserted on the new page. For example, if 4~lines of text need to be
kept together, the sequence
\begin{quote}
\begin{verbatim}
\par
\needspace{4\baselineskip}
% the stuff that must stay together
<text generating lines 1-4>
% now stuff we don't mind about
\end{verbatim}
\end{quote}
Yet another trick by Knuth is useful if you have a sequence of small
blocks of text that need, individually, to be kept on their own page.
Insert the command \csx{filbreak} before each small block, and the
effect is achieved. The technique can be used in the case of
sequences of \LaTeX{}-style sections, by incorporating \csx{filbreak}
into the definition of a command (as in % beware line break
\Qref[question]{patching commands}{Q-patch}). A simple and effective
patch would be:
\begin{quote}
\begin{verbatim}
\let\oldsubsubsection=\subsubsection
\renewcommand{\subsubsection}{%
\filbreak
\oldsubsubsection
}
\end{verbatim}
\end{quote}
While the trick works for consecutive sequences of blocks, it's
slightly tricky to get out of such sequences unless the sequence is
interrupted by a forced page break (such as \csx{clearpage}, which may
be introduced by a \csx{chapter} command, or the end of the document).
If the sequence is not interrupted, the last block is likely to be
forced onto a new page, regardless of whether it actually needs it.
If one is willing to accept that not everything can be accomplished
totally automatically, the way to go is to typeset the document and to
check for things that have the potential to give trouble. In such a
scenario (which has Knuth's authority behind it, if one is to believe
the rather few words he says on the subject in the \TeX{}book) one can
decide, case by case, how to deal with problems at the last
proof-reading stage. The alternatives are to insert \csx{clearpage}
commands as necessary, or to use \csx{enlargethispage}. Supposing you
have a line or two that stray: issue the command
\cmdinvoke{enlargethispage}{2\csx{baselineskip}} and two lines are
added to the page you're typesetting. It depends on the document
whether this looks impossibly awful or entirely acceptable, but the
command remains a useful item in the armoury.
\begin{ctanrefs}
\item[memoir.cls]\CTANref{memoir}
\item[needspace.sty]\CTANref{needspace}
\end{ctanrefs}
\Question[Q-parallel]{Parallel setting of text}
It's commonly necessary to present text in two languages `together' on a
page, or on a two-page spread. For this to be satisfactory, one usually
needs some sort of alignment between the two texts.
The \Package{parallel} package satisfies the need, permitting
typesetting in two columns (not necessarily of the same width) on one
page, or on the two opposing pages of a two-page spread. Use can be
as simple as
\begin{quote}
\begin{verbatim}
\usepackage{parallel}
...
\begin{Parallel}{<left-width>}{<right-width}
\ParallelLText{left-text}
\ParallelRText{right-text}
\ParallelPar
...
\end{Parallel}
\end{verbatim}
\end{quote}
\Package{Parallel} can get terribly confused with colour changes, in
\PDFTeX{}; the indefatigable Heiko Oberdiek has a patch for this
issue~--- the \Package{pdfcolparallel} package, which maintains
separate colour stacks for the columns.
The \Package{parcolumns} package can (in principle) deal with any
number of columns: the documentation shows its use with three
columns. Usage is rather similar to that of \Package{parallel},
though there is of course a ``number of columns to specify'':
\begin{quote}
\begin{verbatim}
\usepackage{parcolumns}
...
\begin{parcolumns}[<options>]{3}
\colchunk{<Column 1 text>}
\colchunk{<Column 2 text>}
\colchunk{<Column 3 text>}
\colplacechunks
...
\end{parcolumns}
\end{verbatim}
\end{quote}
The \meta{options} can specify the widths of the columns, whether to
place rules between the columns, whether to set the columns sloppy,
etc. Again, there are issues with colours, which are addressed by the
\Package{pdfcolparcolumns} package.
The \Package{ledpar} package is distributed with (and integrated with)
the \Qref{\Package{ledmac} package}{Q-linenos}. It provides parallel
setting carefully integrated with the needs of a scholarly text,
permitting translation, or notes, or both, to be set in parallel with
the `base' text of the document.
\begin{ctanrefs}
\item[ledpar.sty]Distributed with \CTANref{ledmac}
\item[parallel.sty]\CTANref{parallel}
\item[parcolumns.sty]Distributed as part of \CTANref{sauerj}[parcolumns]
\item[pdfcolparallel.sty]Distributed as part of \CTANref{oberdiek}[pdfcolparallel]
\item[pdfcolparcolumns.sty]pdfcolparcolumns]
\end{ctanrefs}
\Question[Q-epigraph]{Typesetting epigraphs}
Epigraphs are those neat quotations that authors put at the start of
chapters (or even at the end of chapters: Knuth puts things at the
ends of chapters of the \TeX{}book).
Typesetting them is a bit of a fiddle, but not impossible to do for
yourself. Fortunately, there are two packages that do the job, to
some extent; there are also facilities in the two ``big'' classes
(\Class{memoir} and \Class{koma-script}.
The \Package{epigraph} package defines an \csx{epigraph} command, for
creating a single
epigraph (as at the top of a chapter):
\begin{quote}
\begin{verbatim}
\chapter{The Social Life of Rabbits}
\epigraph{Oh! My ears and whiskers!}%
{Lewis Carroll}
\end{verbatim}
\end{quote}
and an epigraphs environment, for entering more than one epigraph
consecutively, in a sort of list introduced by \csx{qitem} commands:
\begin{quote}
\begin{verbatim}
\begin{epigraphs}
\qitem{What I tell you three times is true}%
{Lewis Carroll}
\qitem{Oh listen do, I'm telling you!}%
{A.A. Milne}
\end{epigraphs}
\end{verbatim}
\end{quote}
The \csx{epigraphhead} command enables you to place your epigraph
\emph{above} a chapter header:
\begin{quote}
\begin{verbatim}
\setlength{\unitlength}{1pt}
...
\chapter{The Social Life of Rabbits}
\epigraphhead[<distance>]{%
\epigraph{Oh! My ears and whiskers!}%
{Lewis Carroll}%
}
\end{verbatim}
\end{quote}
The \meta{distance} says how far above the chapter heading the
epigraph is to go; it's expressed in terms of the \csx{unitlength}
that's used in the \environment{picture} environment; the package's
author recommends \texttt{70pt}.
The package also offers various tricks for adjusting the layout of
chapter header (necessary if you've found a hugely long quotation for
an \csx{epigraphhead}), for patching the bibliography, for patching
\csx{part} pages, and so on. (Some of these suggested patches lead you
through writing your own package\dots{})
The \Package{quotchap} package redefines chapter headings (in a
moderately striking way), and provides an environment
\environment{savequotes} in which you can provide one (or more)
quotations to use as epigraphs. The facilities seem not as flexible
as those of \Package{epigraph}, but it's probably easier to use.
The \Class{memoir} class offers all the facilities of the
\Package{epigraph} package. The \Class{Koma-script} classes have
commands \csx{setchapterpreamble} and \csx{dictum} to provide these
facilities.
\begin{ctanrefs}
\item[epigraph.sty]\CTANref{epigraph}
\item[\nothtml{\rmfamily}KOMA script bundle]\CTANref{koma-script}
\item[memoir.cls]\CTANref{memoir}
\item[quotchap.sty]\CTANref{quotchap}
\end{ctanrefs}
% \Question[Q-outszwrng]{\AllTeX{} \acro{PDF} output prints at wrong size}
% Having got everything \emph{else} right, you should be aware that the
% problem may have nothing to do with \AllTeX{} and everything to do
% with the program you use for printing. A regular cause for such
% problems lies with Acrobat Reader, which by default enables its option
% to scale pages to fit on the printable area of the paper. Since a
% printer can rarely print right to the edge, this means that pdf-files
% will be shrunk by some (small) factor (even if the pdf-file is
% formatted for A4, and your paper size is set to A4 as well).
% Correcting this silliness is not very hard, but the exact details
% depend on the version of Acrobat Reader (or "Adobe Reader" from
% version 6.0 onwards) you have installed:
% \begin{itemize}
% \item Mac OS X, Adobe Reader 6:\\
% in the print dialogue, on the ``copies \& pages'' pane, you'll find a
% popup menu titled ``Page Scaling''. Make sure that the menu reads
% ``None''.
% \item Windows, Adobe Reader 6:\\
% in the print dialogue, select ``None'' from the drop-down list
% ``Page Scaling''.
% \item Windows, Linux Acrobat (Reader) 5.0:\\
% In the print dialog, make sure the ``Shrink oversized pages to fit''
% checkbox is unchecked. It may also be useful to uncheck the
% ``Expand small pages to fit paper size'' checkbox as well.
%\end{itemize}
\subsection{Spacing of characters and lines}
\Question[Q-linespace]{Double-spaced documents in \LaTeX{}}
A quick and easy way of getting inter-line space for copy-editing is
to change \csx{baselinestretch}~--- \cmdinvoke{linespread}{1.2} (or,
equivalently \cmdinvoke{renewcommand}{\csx{baselinestretch}}{1.2}) may
be adequate. Note that \csx{baselinestretch} changes don't take
effect until you select a new font, so make the change in the preamble
before any font is selected. Don't try changing \csx{baselineskip}:
its value is reset at any size-changing command so that results will
be inconsistent.
For preference (and certainly for a production document, such as a
dissertation or an article submission), use a line-spacing package.
The only one currently supported is \Package{setspace} (do \emph{not}
be tempted by \Package{doublespace}~--- its performance under current
\LaTeX{} is at best problematical). \Package{Setspace} switches off
double-spacing at places where even the most die-hard official would
doubt its utility (footnotes, figure captions, and so on); it's very
difficult to do this consistently if you're manipulating
\csx{baselinestretch} yourself.
Of course, the real solution (other than for private copy editing) is
\emph{not} to use double-spacing at all. Universities, in particular,
have no excuse for specifying double-spacing in submitted
dissertations: \LaTeX{} is a typesetting system, not a
typewriter-substitute, and can (properly used) make single-spaced text
even more easily readable than double-spaced typewritten text. If you
have any influence on your university's system (for example, through
your dissertation supervisor), it may be worth attempting to get the
rules changed (at least to permit a ``well-designed book'' format).
Double-spaced submissions are also commonly required when submitting
papers to conferences or journals. Fortunately (judging by the
questions from users in this author's department), this demand is
becoming less common.
Documentation of \Package{setspace} appears as \TeX{} comments in the
package file itself.
\begin{ctanrefs}
\item[setspace.sty]\CTANref{setspace}
\end{ctanrefs}
\Question[Q-letterspace]{Changing the space between letters}
A common technique in advertising copy (and other text whose actual
content need not actually be \emph{read}) is to alter the space
between the letters (otherwise known as the tracking). As a general
rule, this is a very bad idea: it detracts from legibility, which is
contrary to the principles of typesetting (any respectable font you
might be using should already have optimum tracking built into it).
The great type designer, Eric Gill, is credited with saying ``he who
would letterspace lower-case text, would steal sheep''. (The
attribution is probably apocryphal: others are also credited with the
remark. Stealing sheep was, in the 19th century, a capital offence in
Britain.) As the remark suggests, though, letterspacing of upper-case
text is less awful a crime; the technique used also to be used for
emphasis of text set in Fraktur (or similar) fonts.
Straightforward macros (usable, in principle, with any \TeX{} macro
package) may be found in \Package{letterspacing} (which is the name of
the \extension{tex} file).
%%% the package has a serious bug in it, so suppress mention pro tem
%The \Package{tracking} package has similar facilities.
A more comprehensive solution is to be found in the \Package{soul}
package (which is optimised for use with \LaTeX{}, but also works with
\plaintex{}). Soul also permits hyphenation of letterspaced text;
Gill's view of such an activity is not (even apocryphally) recorded.
(Spacing-out forms part of the name of \Package{soul}; the other half
is described in \Qref[question]{another question}{Q-underline}.)
Possibly the `ultimate' in this field is the \Package{microtype},
which uses the micro-typography capabilities of current \PDFTeX{} to
provide a \csx{textls} command, which operates according to parameters
declared in a \csx{SetTracking} command. \Package{Microtype}'s
`tracking' facility expands the natural spacing font itself, rather
than inserting space between characters. Ordinarily, letter-spacing
will destroy ligatures; however, this is \emph{wrong} if the font is
of a fraktur style, and the package provides a means of protecting the
ligatures in a letter-spaced text.
\begin{ctanrefs}
\item[letterspacing.tex]\CTANref{letterspacing}
\item[microtype.sty]\CTANref{microtype}
\item[soul.sty]\CTANref{soul}
%\item[tracking.sty]\CTANref{tracking}
\end{ctanrefs}
\Question[Q-ragright]{Setting text ragged right}
The trick with typesetting ragged right is to be sure you've told the
\TeX{} engine ``make this paragraph ragged, but never \emph{too}
ragged''. The \LaTeX{} \csx{raggedright} command (and the
corresponding \environment{flushleft} environment) has a tendency to
miss the ``never'' part, and will often create ridiculously short
lines, for some minor benefit later in the paragraph. The
\plaintex{} version of the command doesn't suffer this failing, but
is rather conservative: it is loath to create too large a gap at the
end of the line, but in some circumstances~--- such as where
\Qref*{hyphenation is suppressed}{Q-hyphoff}~--- painfully large gaps
may sometimes be required.
Martin Schr\"oder's \Package{ragged2e} package offers the best of both
worlds: it provides raggedness which is built on the \plaintex{}
model, but which is easily configurable. It defines easily-remembered
command (e.g., \csx{RaggedRight}) and environment (e.g.,
\environment{FlushLeft}) names that are simply capitalised
transformations of the \LaTeX{} kernel originals. The documentation
discusses the issues and explains the significance of the various
parameters of \Package{ragged2e}'s operation.
\begin{ctanrefs}
\item[ragged2e.sty]Distributed as part of \CTANref{ms}[ragged2e]
\end{ctanrefs}
\Question[Q-flushboth]{Cancelling \csx{ragged} commands}
\LaTeX{} provides commands \csx{raggedright} and \csx{raggedleft}, but
none to cancel their effect. The \csx{centering} command is
implemented in the same way as the \csx{ragged*} commands, and suffers
in the same way.
The following code (to be inserted in a package of your own, or as
\nothtml{internal \LaTeX{} code~---}% beware line break
\Qref{internal \LaTeX{} code}{Q-atsigns}) defines a command that
restores flush justification at both margins:
\begin{verbatim}
\def\flushboth{%
\let\\\@normalcr
\@rightskip\z@skip \rightskip\@rightskip
\leftskip\z@skip
\parindent 1.5em\relax}
\end{verbatim}
There's a problem with the setting of \csx{parindent} in the code: it's
necessary because both the \csx{ragged} commands set \csx{parindent} to
zero, but the setting isn't a constant of nature: documents using a
standard \LaTeX{} class with \pkgoption{twocolumn} option will have
\texttt{1.0em} by default, and there's no knowing what you (or some
other class) will have done.
Any but a really old copy of Martin Schr\"oder's \Package{ragged2e}
package has a \csx{justifying} command to match its % ! line break
\Qref*{versions of the \LaTeX{} `ragged' commands}{Q-ragright}. The
package also provides a \environment{justify} environment, which
permits areas of justified text in a larger area which is ragged.
\begin{ctanrefs}
\item[ragged2e.sty]Distributed as part of \CTANref{ms}[ragged2e]
\end{ctanrefs}
% this package hasn't materialised, for some reason i don't now
% remember...
%% Donald Arseneau's \Package{flushboth} package provides this code, and
%% preserves a sensible value for \csx{parindent} (at begin document).
%% This still doesn't protect it against any change you might make to
%% \csx{parindent} within the body of your document.
%% \begin{ctanrefs}
%% \item[flushboth.sty]\CTANref{flushboth}
%% \end{ctanrefs}
\subsection{Typesetting specialities}
\Question[Q-verbfile]{Including a file verbatim in \LaTeX{}}
A good way is to use Rainer Sch\"opf's \Package{verbatim} package,
which provides a command \csx{verbatiminput} that takes a file name as
argument:
\begin{quote}
\begin{verbatim}
\usepackage{verbatim}
...
\verbatiminput{verb.txt}
\end{verbatim}
\end{quote}
Another way is to use the \environment{alltt} environment, which
requires the \Package{alltt} package. The environment interprets its
contents `mostly' verbatim, but executes any \AllTeX{} commands it
finds:
\begin{quote}
\begin{verbatim}
\usepackage{alltt}
...
\begin{alltt}
\input{verb.txt}
\end{alltt}
\end{verbatim}
\end{quote}
of course, this is little use for inputting \AllTeX{} source
code\dots{}
The \Package{moreverb} package extends the \Package{verbatim} package,
providing a \environment{listing} environment and a \csx{listinginput}
command, which line-number the text of the file. The package also has
a \csx{verbatimtabinput} command, that honours \acro{TAB} characters in
the input (the package's \environment{listing} environment and the
\csx{listinginput} command also both honour \acro{TAB}).
The \Package{sverb} package provides verbatim input (without recourse
to the facilities of the \Package{verbatim} package):
\begin{quote}
\begin{verbatim}
\usepackage{sverb}
...
\verbinput{verb.txt}
\end{verbatim}
\end{quote}
The \Package{fancyvrb} package offers configurable implementations of
everything \Package{verbatim}, \Package{sverb} and \Package{moreverb}
have, and more besides. It is nowadays the package of choice for the
discerning typesetter of verbatim text, but its wealth of facilities
makes it a complex beast and study of the documentation is strongly
advised.
The \Class{memoir} class includes the relevant functionality of the
\Package{verbatim} and \Package{moreverb} packages.
\begin{ctanrefs}
\item[alltt.sty]Part of the \LaTeX{} distribution.
\item[fancyvrb.sty]\CTANref{fancyvrb}
\item[memoir.cls]\CTANref{memoir}
\item[moreverb.sty]\CTANref{moreverb}
\item[sverb.sty]Distributed as part of \CTANref{mdwtools}[sverb]
\item[verbatim.sty]Distributed as part of \CTANref{2etools}[verbatim]
\end{ctanrefs}
\Question[Q-linenos]{Including line numbers in typeset output}
For general numbering of lines, there are two packages for use with
\LaTeX{}, \Package{lineno} (which permits labels attached to
individual lines of typeset output) and \Package{numline}.
(\Package{Numline} is considered obsolete, but remains available from
the archive.)
Both of these packages play fast and loose with the \LaTeX{} output
routine, which can cause problems: the user should beware\dots{}
If the requirement is for numbering verbatim text, \Package{moreverb},
or \Package{fancyvrb} (see % ! line break
\Qref[question]{including files verbatim}{Q-verbfile}) may be used.
Class \Class{memoir} also provides the necessary facilities.
One common use of line numbers is in critical editions of texts, and
for this the \Package{edmac} package offers comprehensive support;
\Package{ledmac} is a \LaTeX{} port of \Package{edmac}.
The \Package{vruler} package sidesteps many of the problems associated
with line-numbering, by offering (as its name suggests) a rule that
numbers positions on the page. The effect is good, applied to
even-looking text, but is poor in texts that involve breaks such as
interpolated mathematics or figures. Documentation of the package, in
the package itself, is pretty tough going, though there is an example
(also inside the package file).
\begin{ctanrefs}
\item[edmac]\CTANref{edmac}
\item[fancyvrb.sty]\CTANref{fancyvrb}
\item[ledmac.sty]\CTANref{ledmac}
\item[lineno.sty]\CTANref{lineno}
\item[memoir.cls]\CTANref{memoir}
\item[moreverb.sty]\CTANref{moreverb}
\item[numline.sty]\CTANref{numline}
\item[vruler.sty]\CTANref{vruler}
\end{ctanrefs}
\Question[Q-codelist]{Code listings in \LaTeX{}}
`Pretty' code listings are sometimes considered worthwhile by the
``ordinary'' programmer, but they have a serious place in
the typesetting of dissertations by computer science and other
students who are expected to write programs. Simple verbatim listings
of programs are commonly useful, as well.
\begin{hyperversion}
\Qref{Verbatim listings}{Q-verbfile} are dealt with elsewhere,
\end{hyperversion}
\begin{flatversion}
Verbatim listings are dealt with elsewhere (\Qref{}{Q-verbfile}),
\end{flatversion}
as is the problem of % ! line break
\Qref*{typesetting algorithm specifications}{Q-algorithms}.
The \Package{listings} package is widely regarded as the best bet for
formatted output (it is capable of parsing program source, within the
package itself), but there are several well-established packages that
rely on a pre-compiler of some sort. You may use \Package{listings}
to typeset snippets that you include within your source:
\begin{quote}
\begin{verbatim}
\usepackage{listings}
\lstset{language=C}
...
\begin{document}
\begin{lstlisting}
#include <stdio.h>
int main(int argc, char ** argv)
{
printf("Hello world!\n");
return 0;
}
\end{lstlisting}
\end{document}
\end{verbatim}
\end{quote}
or you can have it typeset whole files:
\begin{quote}
\begin{verbatim}
\usepackage{listings}
\lstset{language=C}
...
\begin{document}
\lstinputlisting{main.c}
\end{document}
\end{verbatim}
\end{quote}
These very simple examples may be decorated in a huge variety of ways,
and of course there are other languages in the package's vocabulary
than just \ProgName{C}\dots{}
Most people, advising others on \AllTeX{} lists, seem to regard
\Package{listings} as the be-all and end-all on this topic. But there
\emph{are} alternatives, which may be worth considering, in some
situations.
\ProgName{Highlight} is attractive if you need more than one output
format for your program: as well as \AllTeX{} output,
\ProgName{highlight} will produce (\acro{X})\acro{HTML}, \acro{RTF}
and \acro{XSL}-\acro{FO} representations of your program listing.
Documentation is available on the % ! line break
\href{http://www.andre-simon.de/}{\ProgName{highlight} project site}.
The \Package{minted} package is a relatively recent addition. It
requires that documents be pre-processed using an external
(\ProgName{python}) script, % ! line break
\href{http://pygments.org/}{\ProgName{Pygments}}.
The \ProgName{lgrind} system is another well-established pre-compiler,
with all the facilities one might need and a wide repertoire of
languages; it is derived from the very long-established
\ProgName{tgrind}, whose output is based on \plaintex{}
The \ProgName{tiny_c2l} system is more recent: users are encouraged to
generate their own driver files for languages it doesn't already deal
with.
The \ProgName{C++2LaTeX} system comes with strong recommendations for
use with \acro{C} and \acro{C}++.
An extremely simple system is \ProgName{c2latex}, for which you write
\LaTeX{} source in your \acro{C} program comments. The program then
converts your program into a \LaTeX{} document for processing. The
program (implicitly) claims to be ``self-documenting''.
\begin{ctanrefs}
\item[c2latex]\CTANref{c2latex}
\item[C++2LaTeX]\CTANref{c++2latex}
\item[highlight]\CTANref{highlight}
\item[lgrind]\CTANref{lgrind}
\item[listings.sty]\CTANref{listings}
\item[minted.sty]\CTANref{minted}
\item[tgrind]\CTANref{tgrind}
\item[tiny\_c2l]\CTANref{tiny_c2l}
\end{ctanrefs}
\Question[Q-algorithms]{Typesetting pseudocode in \LaTeX{}}
There is no consensus on the `right' way to typeset pseudocode.
Consequently, there are a variety of \LaTeX{} packages to choose from
for producing \ae{}sthetically pleasing pseudocode listings.
Pseudocode differs from actual program listings in that it lacks
strict syntax and semantics. Also, because pseudocode is supposed to
be a clear expression of an algorithm it may need to incorporate
mathematical notation, figures, tables, and other \LaTeX{} features
that do not appear in conventional programming languages.
\begin{wideversion} % hyper?
\Qref{Typesetting program listings}{Q-codelist} is described
elsewhere.
\end{wideversion}
\begin{narrowversion} % non-hyper
Typesetting program listings is described elsewhere
(\Qref{}{Q-codelist}).
\end{narrowversion}
You can certainly create your own environment for typesetting
pseudocode using, for example, the \environment{tabbing} or
\environment{list} environments~--- it's not difficult, but it may
prove boring. So it's worth trying the following packages, all
designed specifically for typesetting pseudocode.
The \Package{algorithms} bundle (which contains packages
\Package{algorithm} and \Package{algorithmic}, both of which are
needed for ordinary use) has a simple interface and produces fairly
nice output. It provides primitives for statements, which can contain
arbitrary \LaTeX{} commands, comments, and a set of iterative and
conditional constructs. These primitives can easily be redefined to
produce different text in the output. However, there is no support
for adding new primitives. Typesetting the pseudocode itself is
performed in \Package{algorithmic}; the \Package{algorithms} package
uses the facilities of the \Package{float} package to number
algorithms sequentially, enable algorithms to float like figures or
tables, and support including a List of Algorithms in a document's
front matter.
Packages in the \Package{algorithmicx} bundle are similar both in
concept and output form to \Package{algorithmic} but additionally
provide support for adding new keywords and altering the formatting.
It provides the \Package{algpseudocode} package which is (almost) a
drop-in replacement for \Package{algorithmic}. Another package in the
bundle, \Package{algpascal}, uses Pascal-like keywords, indents
differently from \Package{algpseudocode}, and puts command arguments
in maths mode instead of text mode. There is no floating environment
but \Package{algorithmicx}, like \Package{algorithmic}, is compatible
with the \Package{algorithm} package.
The \Package{alg} package, like \Package{algorithms}, offers a
floating algorithm environment with all of the ensuing niceties.
\Package{alg}, however, can caption its floats in a variety of
(natural) languages. In addition, \Package{alg} unlike
\Package{algorithms}, makes it easy to add new constructs.
The \Package{newalg} package has a somewhat similar interface to
\Package{algorithms}, but its output is designed to mimic the rather
pleasant typesetting used in the book ``\emph{Introduction to Algorithms}''
by Corman, Leiserson, Rivest and Stein. Unfortunately,
\Package{newalg} does not support a floating environment or any
customisation of the output.
``\emph{Bona fide}'' use of the style of ``Introduction to
Algorithms'' may be achieved with Cormen's own \Package{clrscode}:
this is the package as used in the second edition of the book.
Similarly, the style of % ! line break
``\emph{Combinatorial Algorithms: Generation, Enumeration and Search}''
is supported by the \Package{pseudocode} package, written by the
authors of the book. It has the common `Pascal-like' style, and has
some interesting constructs for what one thinks of as Pascal blocks.
The \Package{algorithm2e} is of very long standing, and is widely used
and recommended. It loads the \Package{float} package to provide the
option of floating algorithm descriptions, but you can always use the
``\texttt{H}'' option of \Package{float} to have the algorithm appear
``where you write it''.
The usage of the \Package{program} package is a little different from
that of the other packages. It typesets programs in maths mode
instead of text mode; and linebreaks are significant.
\Package{program} lacks a floating environment but does number
algorithms like \Package{alg} and \Package{algorithms}. Customisation
and extension are not supported. Documentation of the
\Package{program} package (such as it is) appears in a file
\File{program.msg} in the distribution.
None of the above are perfect. The factors that should influence your
choice of package include the output style you prefer, how much you
need to extend or modify the set of keywords, and whether you require
algorithms to float like figures and tables.
%%
%% Documentation availability:
%% \begin{description}
%% \item[\Package{algorithms} bundle] is provided in \File{algorithms.ps}
%% (also available as LaTeX{} source). The documentation speaks as if
%% the two packages of the bundle were indeed one, called
%% \Package{algorithms}.
%% \item[\Package{program} package] (such as it is) appears in a file
%% \File{program.msg}.
%% \item[\Package{clrscode} package] is to be found in
%% \File{clrscode.pdf} in the distribution.
%% \item[\Package{algorithm2e} package] is to be found in
%% \File{algorithm2e.tex} in the distribution (it needs the package
%% itself when you process it).
%% \end{description}
\begin{ctanrefs}
\item[algorithm2e.sty]\CTANref{algorithm2e}
\item[algorithmicx\nothtml{\rmfamily} bundle]\CTANref{algorithmicx}
\item[algorithms\nothtml{\rmfamily} bundle]\CTANref{algorithms}
\item[alg.sty]\CTANref{alg}
\item[clrscode.sty]\CTANref{clrscode}
\item[float.sty]\CTANref{float}
\item[newalg.sty]\CTANref{newalg}
\item[program.sty]\CTANref{program}
\item[pseudocode.sty]\CTANref{pseudocode}
\end{ctanrefs}
\Question[Q-makeindex]{Generating an index in \AllTeX{}}
Making an index is not trivial; what to index, and how to index it, is
difficult to decide, and uniform implementation is difficult to
achieve. You will need to mark all items to be indexed in your text
(typically with \csx{index} commands).
It is not practical to sort a large index within \TeX{}, so a
post-processing program is used to sort the output of one \TeX{} run,
to be included into the document at the next run.
The following programs are available:
\begin{description}
\item[makeindex] Comes with most distributions~--- a good workhorse,
but is not well-arranged to deal with other sort orders than the
canonical \acro{ASCII} ordering.
The \Package{makeindex} documentation is a good source of
information on how to create your own index. \Package{Makeindex} can
be used with some \TeX{}
macro packages other than \LaTeX{}, such as \nothtml{\Eplain\ (}%
\Qref{Eplain}{Q-eplain}\nothtml{)}, and \TeX{} (whose macros can
be used independently with \plaintex{}).
\item[idxtex] for \LaTeX{} under \acro{VMS}; \ProgName{idxtex} comes
with a glossary-maker \ProgName{glotex}.
\item[texindex(1)] A witty little shell-script using \ProgName{sed}
and \ProgName{awk}; designed for \LaTeX{} under Unix.
\item[texindex(2)] The \Qref*{Texinfo}{Q-texinfo} system also offers a program
\ProgName{texindex}, whose source is to be found in the
\ProgName{texinfo} distribution. The \Package{ltxindex} package
provides macros that enable \LaTeX{} users to use this
\ProgName{texindex}.
\item[xindy] arose from frustration at the difficulty of making a
multi-language version of \ProgName{makeindex}. It is designed to
be a successor to \ProgName{makeindex}, by a team that included the
then-current maintainer of \ProgName{makeindex}. It successfully
addresses many of \ProgName{makeindex}'s shortcomings, including
difficulties with collation order in different languages, and it is
highly flexible. Sadly, its take-up is proving rather slow.
\end{description}
\begin{ctanrefs}
\item[idxtex]\CTANref{glo+idxtex}
\item[ltxindex.sty]\CTANref{ltxindex}
\item[makeindex]\CTANref{makeindex}
\item[makeindex (Macintosh)]\CTANref{macmakeindex}
\item[texindex \nothtml{\upshape\rmfamily}(the script)]\CTANref{texindex}
\item[texindex \nothtml{\upshape\rmfamily}(the program)]Distributed
with \CTANref{texinfo}
\item[texsis (system)]\CTANref{texsis}
\item[texsis (makeindex support)]\CTANref{texsis-index}
\item[xindy]\CTANref{xindy}
\end{ctanrefs}
\Question[Q-setURL]{Typesetting \acro{URL}s}
\acro{URL}s tend to be very long, and contain characters that would
naturally prevent them being hyphenated even if they weren't typically
set in \csx{ttfamily}, verbatim. Therefore, without special treatment,
they often produce wildly overfull \csx{hbox}es, and their typeset
representation is awful.
There are three packages that help solve this problem:
\begin{itemize}
\item The \Package{path} package, which defines a \csx{path} command.
The command defines each potential break character as a
\csx{discretionary}, and offers the user the opportunity of
specifying a personal list of potential break characters. Its chief
disadvantage is fragility in \LaTeX{} moving arguments. The
% beware line breaks
\Qref*{\Eplain{} macros}{Q-eplain}~--- define a similar \csx{path} command.
\Package{Path}, though it works in simple situations, makes no
attempt to work with \LaTeX{} (it is irremediably fragile). Despite
its long and honourable history, it is no longer recommended for
\LaTeX{} use.
\item The \Package{url} package, which defines an \csx{url} command
(among others, including its own \csx{path} command). The command
gives each potential break character a maths-mode `personality', and
then sets the \acro{URL} itself (in the user's choice of font) in
maths mode. It can produce (\LaTeX{}-style) `robust' commands
% beware line break within paren
(\htmlonly{see }\Qref{use of \csx{protect}}{Q-protect}) for use
within moving arguments.
The package ordinarily ignores spaces in the \acro{URL}, but
unfortunately \acro{URL}s that contain spaces do exist; to typeset
them, call the package with the \pkgoption{obeyspaces} option. Two
other useful options allow line breaks in the \acro{URL} in places
where they are ordinarily suppressed to avoid confusion:
\pkgoption{spaces} to allow breaks at spaces (note, this requires
\pkgoption{obeyspaces} as well, and \pkgoption{hyphens} to allow
breaks after hyphens. (Note that the package \emph{never} does
``ordinary'' hyphenation of names inside an \acro{URL}.)
It is possible to use the \Package{url} package in \plaintex{},
with the assistance of the \Package{miniltx} package (which was
originally developed for using the \LaTeX{} graphics package in
\plaintex{}). A small patch is also necessary: the required
sequence is therefore:
\begin{narrowversion}
\begin{verbatim}
\input miniltx
\expandafter\def\expandafter\+%
\expandafter{\+}
\input url.sty
\end{verbatim}
\end{narrowversion}
\begin{wideversion}
\begin{verbatim}
\input miniltx
\expandafter\def\expandafter\+\expandafter{\+}
\input url.sty
\end{verbatim}
\end{wideversion}
\item The \Package{hyperref} package, which uses the typesetting code
of \Package{url}, in a context where the typeset text forms the
anchor of a link.
\end{itemize}
The author of this answer prefers the (rather newer) \Package{url}
package (directly or indirectly); both \Package{path} and
\Package{url} work well with \plaintex{} (though of course, the fancy
\LaTeX{} facilities of \Package{url} don't have much place there).
(\Package{hyperref} isn't available in a version for use with \plaintex{}.)
Note that neither \csx{path} (from package \Package{path}) nor \csx{url} (from
package \Package{url}) is robust (in the \LaTeX{} sense). If you need
a \acro{URL} to go in a moving argument, you need the command
\csx{urldef} from the \Package{url} package. So one might write:
\begin{quote}
\begin{verbatim}
\urldef\faqhome\url{http://www.tex.ac.uk/faq}
\end{verbatim}
\end{quote}
after which, \csx{faqhome} is robust.
Documentation of both package \Package{path} and package \Package{url}
is in the package files.
\begin{ctanrefs}
\item[hyperref.sty]\CTANref{hyperref}
\item[miniltx.tex]Distributed as part of \CTANref{graphics-plain}[miniltx]
\item[path.sty]\CTANref{path}
\item[url.sty]\CTANref{url}
\end{ctanrefs}
\Question[Q-music]{Typesetting music in \TeX{}}
In the early days, a simple music package called Mu\TeX{} was
written by Angelika Schofer and Andrea Steinbach, which demonstrated
that music typesetting was possible; the package was very limited, and is
hardly ever used nowadays. Daniel Taupin took up the baton, and
developed Music\TeX{}, which allows the typesetting of polyphonic and
other multiple-stave music; Music\TeX{} remains available, but is most
definitely no longer recommended.
Music\TeX{} has been superseded by its successor MusiX\TeX{}, which is
a three-pass system (with a processor program that computes values for
the element spacing in the music), and achieves finer control than is
possible in the unmodified \TeX{}-based mechanism that Music\TeX{}
uses. Daniel Taupin's is the only version of MusiX\TeX{} currently
being developed (the original author, Andreas Egler, had an
alternative version, but he is now working on a different package
altogether).
Input to Musix\TeX{} is extremely tricky stuff, and Don Simons'
preprocessor \ProgName{pmx} is the preferred method of creating input
for Taupin's version. \ProgName{Pmx} greatly eases use of
Musix\TeX{}, but it doesn't support the full range of Musix\TeX{}'s
facilities directly; however, it does allow in-line Musix\TeX{} code
in \ProgName{pmx} sources.
Dirk Laurie's \ProgName{M-Tx} allows preparation of music with lyrics;
it operates ``on top of'' \ProgName{pmx}
Another simple notation is supported by \ProgName{abc2mtex}; this is a
package designed to notate tunes stored in an \acro{ASCII} format
(\texttt{abc} notation). It was designed primarily for folk and traditional
tunes of Western European origin (such as Irish, English and Scottish)
which can be written on one stave in standard classical notation, and
creates input intended for Music\TeX{}. However, it should be
extendable to many other types of music.
Digital music fans can typeset notation for their efforts by using
\ProgName{midi2tex}, which translates \acro{MIDI} data files into
Music\TeX{} source code.
There is a mailing list (\Email{TeX-music@icking-music-archive.org})
for discussion of typesetting music in \TeX{}; it mostly covers
Musix\TeX{} and related systems. To subscribe, use
\URL{http://icking-music-archive.org/mailman/listinfo/tex-music/}
An alternative (free) means of embedding music examples into \AllTeX{}
documents is \href{http://www.lilypond.org}{Lilypond}. Lilypond is
(at heart) a batch music typesetting system with plain text input that
does most of its work without TeX. Lilypond's input syntax is far
less cryptic than is Musix\TeX{}'s, and it handles much more stuff
automatically, yielding the same or better quality with less effort.
Lilypond can also produce basic \acro{MIDI} output.
\begin{ctanrefs}
\item[abc2mtex]\CTANref{abc2mtex}
\item[M-Tx]\CTANref{mtx}
\item[midi2tex]\CTANref{midi2tex}
\item[musictex]\CTANref{musictex}
% ! line breaks
\item[musixtex \nothtml{\rmfamily}(Taupin's version)]\CTANref{musixtex-taupin}
\item[musixtex \nothtml{\rmfamily}(Egler's version)]\CTANref{musixtex-egler}
\item[mutex]\CTANref{mutex}
\item[pmx]\CTANref{pmx}
\end{ctanrefs}
\Question[Q-parskip]{Zero paragraph indent}
The conventional way of typesetting running text has no separation
between paragraphs, and the first line of each paragraph in a block of
text indented.
In contrast, one common convention for typewritten text was to have no
indentation of paragraphs; such a style is often required for
``brutalist'' publications such as technical manuals, and in styles
that hanker after typewritten manuscripts, such as
officially-specified dissertation formats.
Anyone can see, after no more than a moment's thought, that if the
paragraph indent is zero, the paragraphs must be separated by blank
space: otherwise it is sometimes going to be impossible to see the
breaks between paragraphs.
The simple-minded approach to zero paragraph indentation is thus:
\begin{verbatim}
\setlength{\parindent}{0pt}
\setlength{\parskip}{\baselineskip}
\end{verbatim}
and in the very simplest text, it's a fine solution.
However, the non-zero \csx{parskip} interferes with lists and the like,
and the result looks pretty awful. The \Package{parskip} package
patches things up to look reasonable; it's not perfect, but it deals
with most problems.
The Netherlands Users' Group's set of classes includes an
\Class{article} equivalent (\Class{artikel3}) and a \Class{report}
equivalent (\Class{rapport3}) whose design incorporates zero paragraph
indent and non-zero paragraph skip.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\acro{NTG} classes]\CTANref{ntgclass}
\item[parskip.sty]\CTANref{parskip}
\end{ctanrefs}
\Question[Q-dropping]{Big letters at the start of a paragraph}
A common style of typesetting, now seldom seen except in newspapers,
is to start a paragraph (in books, usually the first of a chapter)
with its first letter set large enough to span several lines.
This style is known as ``dropped capitals'', or (in French)
\latexhtml{``lettrines''}{\htmlentity{laquo}lettrines\htmlentity{raquo}},
and \TeX{}'s primitive facilities for hanging indentation make its
(simple) implementation pretty straightforward.
The \Package{dropping} package does the job simply, but has a curious
attitude to the calculation of the size of the font to be used for the
big letters. Examples appear in the package documentation, so before
you process the \extension{dtx}, the package itself must already be
installed. Unfortunately, \Package{dropping} has an intimate relation
to the set of device drivers available in an early version of the
\LaTeX{} graphics package, and it cannot be trusted to work with
modern offerings such as \PDFTeX{}, V\TeX{} or \acro{DVI}pdfm, let
alone such modernisms as \xetex{}. As a result, the package is widely
deprecated, nowadays.
The more recent \Package{lettrine} package is generally more reliable.
It has a well-constructed array of options, and an impressive set of
examples adds to the package's document.
\begin{ctanrefs}
\item[dropping]\CTANref{dropping}
\item[lettrine]\CTANref{lettrine}
\end{ctanrefs}
\Question[Q-dec_comma]{The comma as a decimal separator}
\TeX{} embodies the British/American cultural convention of using a
period as the separator between the whole number and the decimal
fraction part of a decimal number. Other cultures use a comma as
separator, but if you use a comma in maths mode you get a small space
after it; this space makes a comma that is used as a decimal separator
look untidy.
A simple solution to this problem, in maths mode, is to type
\texttt{3}\marg{,}\texttt{14} in place of \texttt{3,14}. While such a
technique may produce the right results, it is plainly not a
comfortable way to undertake any but the most trivial amounts of
typing numbers.
Therefore, if you need to use commas as decimal separator, you will
probably welcome macro support. There are two packages that
can help relieve the tedium: \Package{icomma} and \Package{ziffer}.
\Package{Icomma} ensures that there will be no extra space after a
comma, unless you type a space after it (as in \texttt{f(x, y)}~--- in
the absence of the package, you don't need that space), in which case
the usual small space after the comma appears. \Package{Ziffer} is
specifically targeted at the needs of those typesetting German, but
covers the present need, as well as providing the double-minus sign
used in German (and other languages) for the empty `cents' part of an
amount of currency.
The \Package{numprint} package provides a command
\cmdinvoke*{numprint}{number} that prints its argument according to
settings you give it, or according to settings chosen to match the
language you have selected in \Package{babel}. The formatting works
equally well in text or maths. The command is very flexible (it can also
group the digits of very `long' numbers), but is inevitably less
convenient than \Package{icomma} or \Package{ziffer} if you are typing a
lot of numbers.
\begin{ctanrefs}
\item[icomma.sty]Distributed as part of \CTANref{was}[icomma]
\item[numprint.sty]\CTANref{numprint}
\item[ziffer.sty]\CTANref{ziffer}
\end{ctanrefs}
\Question[Q-breakbox]{Breaking boxes of text}
\AllTeX{} boxes may not be broken, in ordinary usage: once you've
typeset something into a box, it will stay there, and the box will jut
out beyond the side or the bottom of the page if it doesn't fit in the
typeset area.
If you want a substantial portion of your text to be framed (or
coloured), the restriction starts to seem a real imposition.
Fortunately, there are ways around the problem.
The \Package{framed} package provides \environment{framed} and
\environment{shaded} environments; both put their content into
something which looks like a framed (or coloured) box, but which
breaks as necessary at page end. The environments ``lose'' footnotes,
marginpars and head-line entries, and will not work with
\Package{multicol} or other column-balancing macros. The
\Class{memoir} class includes the functionality of the
\Package{framed} package.
The \Package{boites} package provides a \environment{breakbox}
environment; examples of its use may be found in the distribution, and
the package's \File{README} file contains terse documentation. The
environments may be nested, and may appear inside
\environment{multicols} environments; however, floats, footnotes and
marginpars will be lost.
For \plaintex{} users, the facilities of the \Package{backgrnd}
package may be useful; this package subverts the output routine to
provide vertical bars to mark text, and the macros are clearly marked
to show where coloured backgrounds may be introduced (this requires
\Package{shade}, which is distributed as tex macros and
device-independent \MF{} for the shading). The author of
\Package{backgrnd} claims that the package works with \LaTeXo{}, but
there are reasons to suspect that it may be unstable working with
current \LaTeX{}.
\begin{ctanrefs}
\item[backgrnd.tex]\CTANref{backgrnd}
\item[boites.sty]\CTANref{boites}
\item[framed.sty]\CTANref{framed}
\item[memoir.cls]\CTANref{memoir}
\item[shade.tex]\CTANref{shade}
\end{ctanrefs}
\Question[Q-overstrike]{Overstriking characters}
This may be used, for example, to indicate text deleted in the course
of editing. Both the \Package{ulem} and the \Package{soul} packages
provide the necessary facilities.
Overstriking for % beware line break
\Qref*{cancellation in maths expressions}{Q-cancellation} is achieved
by a different mechanism.
Documentation of \Package{ulem} is in the package file.
\begin{ctanrefs}
\item[soul.sty]\CTANref{soul}
\item[ulem.sty]\CTANref{ulem}
\end{ctanrefs}
\Question[Q-upquot]{Realistic quotes for verbatim listings}
The \texttt{cmtt} font has ``curly'' quotes\nothtml{ (\texttt{`thus'})},
which are pleasing on the eye, but don't really tally with what one
sees on a modern % beware line break
\ProgName{xterm}\nothtml{ (which look like \texttt{\textasciigrave this\textquotesingle})}.
The appearance of these quotes is critical in program listings,
particularly in those of Unix-like shell scripts. The
\Package{upquote} package modifies the behaviour of the
\environment{verbatim} environment so that the output is a clearer
representation of what the user must type.
\begin{ctanrefs}
\item[upquote.sty]\CTANref{upquote}
\end{ctanrefs}
\Question[Q-time]{Printing the time}
\TeX{} has a primitive register that contains ``the number of minutes
since midnight''; with this knowledge it's a moderately simple
programming job to print the time (one that no self-respecting
\plaintex{} user would bother with anyone else's code for).
However, \LaTeX{} provides no primitive for ``time'', so the
non-programming \LaTeX{} user needs help.
Two packages are available, both providing ranges of ways of printing
the date, as well as of the time: this question will concentrate on
the time-printing capabilities, and interested users can investigate
the documentation for details about dates.
The \Package{datetime} package defines two time-printing functions:
\csx{xxivtime} (for 24-hour time), \csx{ampmtime} (for 12-hour time) and
\csx{oclock} (for time-as-words, albeit a slightly eccentric set of
words).
The \Package{scrtime} package (part of the compendious
\Class{KOMA-Script} bundle) takes a package option (\pkgoption{12h} or
\pkgoption{24h}) to specify how times are to be printed. The command
\csx{thistime} then prints the time appropriately (though there's no
\emph{am} or \emph{pm} in \pkgoption{12h} mode). The \csx{thistime}
command also takes an optional argument, the character to separate the
hours and minutes: the default is of course \texttt{:}.
\begin{ctanrefs}
\item[datetime.sty]\CTANref{datetime}
\item[scrtime.sty]Distributed as part of \CTANref{koma-script}
\end{ctanrefs}
\Question[Q-the-commands]{Redefining counters' \csx{the-}commands}
Whenever you request a new \LaTeX{} counter, \LaTeX{} creates a bunch
of behind-the-scenes commands, as well as defining the counter
itself.
Among other things, \cmdinvoke*{newcounter}{fred} creates a command
\csx{the}\texttt{\emph{fred}}, which expands to ``the value of
\texttt{\emph{fred}}'' when you're typesetting.
The definition of \csx{the}\texttt{\emph{fred}} should express the
value of the counter: it is almost always always a mistake to use the
command to produce anything else. The value may reasonably be
expressed as an arabic, a roman or a greek number, as an alphabetic
expression, or even as a sequence (or pattern of) symbols. If you
need a decision process on whether to re-define
\csx{the}\texttt{\emph{fred}}, consider what might happen when you do
so.
So, for example, if you want your section numbers to be terminated by
a period, you could make \csx{thesection} expand with a terminating
period. However, such a change to \csx{thesection} makes the
definition of \csx{thesubsection} look distinctly odd: you are going to
find yourself redefining things left, right and centre. Rather, use
the standard techniques for % beware line break
\Qref*{adjusting the presentation of section numbers}{Q-seccntfmt}.
Or, suppose you want the page number to appear at the bottom of each
page surrounded by dashes (as in
``\texttt{-}{}\texttt{-\textasciitilde}\texttt{nnn\textasciitilde-}{}\texttt{-}'').
If you try to achieve this by redefining \csx{thepage}, problems will
arise from the use of the page number in the table of contents (each
number will have the dashes attached), and \csx{pageref} references
will be oddly modified. In this case, the change of appearance is
best done by redefining the page style itself, perhaps using
\Qref*{package \Package{fancyhdr}}{Q-fancyhdr}.
\subsection{Tables of contents and indexes}
\Question[Q-tocloft]{The format of the Table of Contents, etc.}
The formats of entries in the table of contents (\acro{TOC}) are
controlled by a number of internal commands (discussed in section~2.3
of \Qref*{\emph{The \LaTeX{} Companion}}{Q-books}. The commands
\csx{@pnumwidth}, \csx{@tocrmarg} and \csx{@dotsep} control the space
for page numbers, the indentation of the right-hand margin, and the
separation of the dots in the dotted leaders, respectively. The
series of commands named \csx{l@\emph{xxx}}, where \texttt{\emph{xxx}}
is the name of a sectional heading (such as \texttt{chapter} or
\texttt{section}, \dots{}\@) control the layout of the corresponding
heading, including the space for section numbers. All these internal
commands may be individually redefined to give the effect that you
want.
Alternatively, the package \Package{tocloft} provides a set of
user-level commands that may be used to change the \acro{TOC}
formatting. Since exactly the same mechanisms are used for the List
of Figures and List of Tables, the layout of these sections may be
controlled in the same way.
The \Class{KOMA-Script} classes provides an optional variant structure
for the table of contents, and calculates the space needed for the
numbers automatically. The \Class{memoir} class includes the functionality
of \Package{tocloft}.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}KOMA script bundle]\CTANref{koma-script}
\item[memoir.cls]\CTANref{memoir}
\item[tocloft.sty]\CTANref{tocloft}
\end{ctanrefs}
\Question[Q-secnumdep]{Unnumbered sections in the Table of Contents}
The way the relevant parts of sectioning commands work is exemplified
by the way the \csx{chapter} command uses the counter \texttt{secnumdepth}
(described in Appendix~C of the \LaTeX{} manual):
\begin{enumerate}
\item put something in the \extension{aux} file, which will appear in
the \extension{toc};
\htmlignore
\item if \ensuremath{\texttt{secnumdepth} \geq 0},
\endhtmlignore
\begin{htmlversion}
\item if the \texttt{secnumdepth} counter is greater than or equal to
zero,
\end{htmlversion}
increase the counter for the chapter and write it out.
\item write the chapter title.
\end{enumerate}
Other sectioning commands are similar, but with other values used in
the test.
So a simple way to get headings of funny `sections' such as prefaces
in the table of contents is to use the counter:
\begin{quote}
\begin{verbatim}
\setcounter{secnumdepth}{-1}
\chapter{Preface}
\end{verbatim}
\end{quote}
Unfortunately, you have to set \texttt{secnumdepth} back to its usual
value (which is~2 in the standard styles) before you do any `section'
which you want to be numbered.
Similar settings are made, automatically, in the \LaTeX{} book class by
the \csx{frontmatter} and \csx{backmatter} commands.
The value of the counter \texttt{tocdepth} controls which headings
will be finally printed in the table of contents; it is normally set
in the preamble and is a constant for the document. The package
\Package{tocvsec2} package takes the tedium out of changing the
\texttt{secnumdepth} and/or the \texttt{tocdepth} counter values at
any point in the body of the document; the commands (respectively)
\csx{setsecnumdepth} and \csx{settocdepth} make the changes based on
the \emph{name} of the sectional unit (\texttt{chapter},
\texttt{section}, etc.\@).
The package \Package{abstract} (see % line break!
\Qref[question]{one-column abstracts}{Q-onecolabs}) includes an option
to add the \texttt{abstract} to the table of contents, while the
package \Package{tocbibind} has options to include the table of
contents itself, the \texttt{bibliography}, \texttt{index}, etc., to
the table of contents.
The \Class{KOMA-Script} classes have commands \csx{addchap} and
\csx{addled}, which work like \csx{chapter} and \csx{section} but
aren't numbered. The \Class{memoir} class incorporates the facilities
of all three of the \Package{abstract}, \Package{tocbibind} and
\Package{tocvsec2} packages.
\begin{ctanrefs}
\item[abstract.sty]\CTANref{abstract}
\item[\nothtml{\rmfamily}KOMA script bundle]\CTANref{koma-script}
\item[memoir.cls]\CTANref{memoir}
\item[tocbibind.sty]\CTANref{tocbibind}
\item[tocvsec2.sty]\CTANref{tocvsec2}
\end{ctanrefs}
\Question[Q-tocbibind]{Bibliography, index, etc., in \acro{TOC}}
The standard \LaTeX{} classes (and many others) use \csx{section*} or
\csx{chapter*} for auto-generated parts of the document (the tables of
contents, lists of figures and tables, the bibliography and the index). As a
result, these items aren't numbered (which most people don't mind),
and (more importantly) they don't appear in the table of contents.
The correct solution (as always) is to have a class of your own that
formats your document according to your requirements. The macro to do
the job (\csx{addcontentsline}) is fairly simple, but there is always
an issue of ensuring that the contents entry quotes the correct page.
Supposing that our the document is chapter-based (class \Class{report}
or \Class{book}, for example), the text:
\begin{quote}
\begin{verbatim}
\bibliography{frooble}
\addcontentsline{toc}{chapter}{Bibliography}
\end{verbatim}
\end{quote}
will produce the \emph{wrong} answer if the bibliography is more than
one page long. Instead, one should say:
\begin{quote}
\begin{verbatim}
\cleardoublepage
\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{frooble}
\end{verbatim}
\end{quote}
(Note that \csx{cleardoublepage} does the right thing, even if your
document is single-sided~--- in that case, it's a synonym for
\csx{clearpage}). Ensuring that the entry refers to the right place is
trickier still in a \csx{section}-based class.
If you are using \Package{hyperref} (which will link entries in the
table of contents to the relevant place in the file), a slight
adjustment is necessary:
\begin{quote}
\begin{verbatim}
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{frooble}
\end{verbatim}
\end{quote}
The extra command (\csx{phantomsection}) gives \Package{hyperref}
something to ``hold on to'' when making the link.
The common solution, therefore, is to use the \Package{tocbibind}
package, which provides many facilities to control the way these
entries appear in the table of contents.
Classes of the \Class{KOMA-script} bundle provide this functionality
as a set of class options (e.g., \pkgoption{bibtotoc} to add the
bibliography to the table of contents); the \Class{memoir} class includes
\Package{tocbibind} itself.
\begin{ctanrefs}
\item[hyperref.sty]\CTANref{hyperref}
\item[\nothtml{\rmfamily}KOMA script bundle]\CTANref{koma-script}
\item[memoir.cls]\CTANref{memoir}
\item[tocbibind.sty]\CTANref{tocbibind}
\end{ctanrefs}
\Question[Q-minitoc]{Table of contents, etc., per chapter}
The common style, of a ``small'' table of contents for each part,
chapter, or even section, is supported by the \Package{minitoc}
package. The package also supports mini-lists of tables and figures;
but, as the documentation observes, mini-bibliographies are a
different problem~--- see
\Qref[question]{bibliographies per chapter}{Q-chapbib}.
The package's basic scheme is to generate a little \extension{aux} file for
each chapter, and to process that within the chapter. Simple usage
would be:
\begin{quote}
\begin{verbatim}
\usepackage{minitoc}
...
\begin{document}
...
\dominitoc \tableofcontents
\dominilof \listoffigures
...
\chapter{blah blah}
\minitoc \mtcskip \minilof
...
\end{verbatim}
\end{quote}
though a lot of elaborations are possible (for example, you don't need
a \csx{minitoc} for every chapter).
\Package{Babel} doesn't know about \Package{minitoc}, but
\Package{minitoc} makes provision for other document languages than
English~--- a wide variety is available. Fortunately, the current
version of the \Package{hyperref} package does know about
\Package{minitoc} and treats \csx{minitoc} tables in the
same way as ``real'' tables of contents.
\begin{ctanrefs}
\item[babel.sty]\CTANref{babel}
\item[hyperref.sty]\CTANref{hyperref}
\item[minitoc.sty]\CTANref{minitoc}
\end{ctanrefs}
\Question[Q-multind]{Multiple indexes}
\LaTeX{}'s standard indexing capabilities (those provided by the
\Package{makeidx} package) only provide for one index in your
document; even quite modest documents can be improved by indexes for
separate topics.
The \Package{multind} package provides simple and straightforward
multiple indexing. You tag each \csx{makeindex}, \csx{index} and
\csx{printindex} command with a file name, and indexing commands are
written to (or read from) the name with the appropriate (\extension{idx} or
\extension{ind}) extension appended. The \csx{printindex} command is modified
from the \LaTeX{} standard so that it doesn't create its own chapter
or section heading; you therefore decide what names (or sectioning
level, even) to use for the indexes, and
\Qref*{\csx{indexname}}{Q-fixnam} is completely ignored.
To create a ``general'' and an ``authors'' index, one might write:
\begin{quote}
\begin{verbatim}
\usepackage{multind}
\makeindex{general}
\makeindex{authors}
...
\index{authors}{Another Idiot}
...
\index{general}{FAQs}
...
\printindex{general}{General index}
\printindex{authors}{Author index}
\end{verbatim}
\end{quote}
To complete the job, run \LaTeX{} on your file enough times that
labels, etc., are stable, and then execute the commands
\begin{quote}
\begin{verbatim}
makeindex general
makeindex authors
\end{verbatim}
\end{quote}
before running \LaTeX{} again. Note that the names of the index files
to process are not necessarily related to the name of the \LaTeX{}
file you're processing, at all. (There's no documentation that comes
with the package: what you see above is as good as you will
get\dots{})
The \Package{index} package provides a comprehensive set of indexing
facilities, including a \csx{newindex} command that allows the
definition of new styles of index. \csx{newindex} takes a `tag' (for
use in indexing commands), replacements for the \extension{idx} and
\extension{ind} file extensions, and a title for the index when it's
finally printed; it can also change the item that's being indexed
against (for example, one might have an index of artists referenced by
the figure number where their work is shown).
Using \Package{index}, to create an author index together with a
``normal'' index, one would start with preamble commands:
\begin{quote}
\begin{verbatim}
\usepackage{index}
\makeindex
\newindex{aut}{adx}{and}{Name Index}
\end{verbatim}
\end{quote}
which load the package, define a ``main'' (original-style) index, and
then define an author index. Then, in the body of the document, we
might find commands like:
\begin{quote}
\begin{verbatim}
\index[aut]{Another Idiot}
...
\index{FAQs}
\end{verbatim}
\end{quote}
Which place an entry in the author index, and then one in the main
index. At the end of the document, we have two commands:
\begin{quote}
\begin{verbatim}
\printindex
\printindex[aut]
\end{verbatim}
\end{quote}
Which will print the main index and then the author index. Supposing
this lot to be in \File{myfile.tex}, after enough runs through
\LaTeX{} that labels are stable, execute the following commands
(Unix-style shell commands shown here, but the principle is the same
whatever system you're using):
\begin{quote}
\begin{verbatim}
makeindex myfile
makeindex myfile.adx -o myfile.and
\end{verbatim}
\end{quote}
and rerun \LaTeX{}. The \ProgName{makeindex} commands process
\File{myfile.idx} to \File{myfile.ind} (the default action), and then
\File{myfile.adx} to \File{myfile.and}, the two files needed as input
by the two \csx{printindex} commands in \File{myfile.tex}.
The \Package{splitidx} package can operate in the same way as the
others: load the package with the \pkgoption{split} option, and
declare each index with a \csx{newindex} command:
\begin{quote}
\cmdinvoke{newindex}[\meta{index name}]{\meta{shortcut}}
\end{quote}
and \Package{splitidx} will generate a file
\csx{jobname}\texttt{.\meta{shortcut}} to receive index entries
generated by commands like \cmdinvoke{sindex}[\meta{shortcut}]{\meta{item}}.
As with the other packages, this method is limited by \TeX{}'s total
number of output files. However, \Package{splitindex} also comes with
a small executable \ProgName{splitindex} (available for a variety of
operating systems); if you use this auxiliary program (and don't use
\pkgoption{split}), there's no limit to the number of indexes. Apart
from this trick, \Package{splitidx} supports the same sorts of things
as does \Package{index}. An example of use appears in
the documentation.
The \Class{memoir} class has its own multiple-index functionality (as
well as its own index layout options, which other packages delegate to
the index style used by \ProgName{makeindex}).
\begin{ctanrefs}
\item[index.sty]\CTANref{index}
\item[makeidx.sty]Part of the \LaTeX{} distribution
\item[memoir.cls]\CTANref{memoir}
\item[multind.sty]\CTANref{multind}
\item[splitidx.sty \bgroup\nothtml{\normalfont}and \egroup splitindex]%
\CTANref{splitindex}
\end{ctanrefs}
|