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

% debug
% \overfullrule=15pt

\documentclass[a4paper,12pt]{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{color}     % coloured stuff
\usepackage{ifpdf}     % ps/pdf output
\ifpdf
  \usepackage[pdftex]{graphicx}
  \pdfcompresslevel=9
\else
  \usepackage{graphicx}
\fi
\usepackage{alltt}     % like verbatim, but obeys LaTeX commands
\usepackage{dcolumn}   % aligning numbers to digital position
\usepackage{url}       % urls and links
\usepackage{colortbl}  % colour tables
\usepackage{pifont}    % dinglist
\usepackage{fancyvrb}  % fancy verbatim
\usepackage{boxedminipage} % what it says
\usepackage{framed}    % frames around stuff
\usepackage{rotating}  % rotate stuff
\usepackage[colorlinks,
            urlcolor=blue,
	    filecolor=magenta,
	    linkcolor=darkred,
	    hyperfootnotes=false]{hyperref} % browseable links
\usepackage{fancyhdr}  % fancy headers and footers
\usepackage{marvosym}  % Euro sign and other nice characters
\usepackage[gen]{eurosym} % Euro sign
\usepackage{mflogo}    % Metafont logo
\usepackage{setspace}  % custom line spacing
\usepackage{tabularx}  % extended tabular environment
\usepackage{exa}       % local package for typesetting LaTeX examples
\usepackage{enumerate} % optional args for enumerate environment
\usepackage{wrapfig}   % wrapping text around figures
\usepackage[normalem]{ulem} % underline styles
\usepackage{slashbox}  % slashed box in tables
\usepackage{paralist}  % paragraph lists

% --- Definitions and new commands ---

\def\version {1.0.7}
\def\bs      {\textbackslash}
\def\unix    {\textsc{Unix}}
% \def\warning {\marginpar{\Huge{\textcolor{red}{\Stopsign}}}}
\def\note    {\marginpar{\Huge{\textcolor{magenta}{\Writinghand}}}}
\def\PS      {\textsc{PostScript}}
\definecolor {darkred}{rgb}{0.75,0,0}

\hyphenation{lo-cal-tex-mf land-sca-pe}

\newcounter{fnsym}
\setcounter{fnsym}{1}
%\newcounter{tmpbaselineskip}
%\setlength{tmpbaselineskip}{\value{\baselineskip}}

\newenvironment{margins}[2]
{ 
  \begin{list}{} {
    \setlength{\leftmargin}{#1}
    \setlength{\rightmargin}{#2}
  } \item }
{\end{list}}

\newenvironment{warn}
{ % beg def
  \medskip
  \begin{minipage}[t]{0.1\linewidth}
    \vspace{0pt}
    \textcolor{magenta}{\Huge{\Pointinghand}}
  \end{minipage}%
  \begin{minipage}[t]{0.88\textwidth}
    \vspace{0pt}
    \begin{small}
      \begin{spacing}{0.97}
}
{ % end def
      \end{spacing}
    \end{small}
  \end{minipage}
  \medskip
}

\newcommand{\package}[1]
{\textsf{#1}}

\newcommand{\parm}[1]
{\texttt{#1}}

\newcommand{\cmdparm}[1]
{\textit{#1}}

\newcommand{\env}[1]
{\texttt{#1}}

\newcommand{\cmd}[1]
{\texttt{\bs{}#1}}

\newcommand{\cmdline}[1]
{\texttt{#1}}

\newcommand{\menu}[1]
{\textsf{#1}}

\newcommand{\entry}[2]
{\textsf{#1/#2}}

\newcommand{\app}[1]
{\texttt{#1}}

\newcommand{\file}[1]
{\texttt{#1}}

\newcommand{\style}[1]
{\texttt{#1}}

% --- end of definitions and new commands ---
% ok, let's start

\begin{document}

\pagenumbering{roman}
\setlength{\parindent}{0pt}
\setlength{\parskip}{3pt}

\title{\LaTeX{} for Word Processor Users\\version \version}

\author{Guido Gonzato, Ph.D.\\
\texttt{guido.gonzato@univr.it}\\
Universit\`a di Verona (Italy)\\
Direzione Informatica}

% I want to use the dagger sign as footnote symbol
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\setcounter{footnote}{2}

\date{\today}

% let's put things back to normal
\renewcommand{\thefootnote}{\arabic{footnote}}
\setcounter{footnote}{1}

\maketitle

\begin{abstract}

  Text processing with \LaTeX{} offers several advantages over word
  processing. However, beginners may find it hard to figure out how to
  perform common tasks and obtain certain features. This manual
  attempts to ease the transition by drawing comparisons between word
  processing and \LaTeX{} typesetting. The main word processor
  capabilities are listed, along with their equivalent \LaTeX{}
  commands. Many examples are provided.

\end{abstract}

\begin{footnotesize}
  \tableofcontents
  \listoftables
  \listoffigures
\end{footnotesize}

% INTRODUCTION

\pagestyle{fancy}
\pagenumbering{arabic}

\section{Introduction}

First of all, let me state that this is \emph{not} a \LaTeX{} primer!
If you're reading this document, I assume that you have at least a
basic understanding of \LaTeX{} and of its basic commands. In this
guide, I'll explain how to replace a word processor effectively using
\LaTeX.

Word processors are the `killer app' in modern office automation.
They're perceived to be easier than \LaTeX{} as they have a friendly
WYSIWYG interface, and the average secretary will learn to use them in
a relatively short time. The problem is, these beasts keep growing
slow, bloated,\footnote{once upon a time, I wrote my thesis on a 128k
RAM, Z80-based home computer. The word processor WordStar and my
thesis fit on a single CP/M-bootable 720K floppy, with lots of room to
spare!} buggy, crash-prone, expensive, virus ridden, and incompatible
with each other. Not to talk about their default output quality.

\LaTeX{} is a good alternative; but if you try to write casual,
unstructured documents, it will rightly stand in the way.

To sum up, sometimes you may want to use word processor-like
features---but using \LaTeX. It would be nice to know how to obtain
some effects with \LaTeX{} when you know how to get them with your
once-favourite \texttt{:-)} word processor.

That's why I wrote this quick reference. As I said, it assumes some
basic \LaTeX{} knowledge; if it's not the case, I suggest that you go
to \url{http://www.ctan.org/starter.html} and download `The (Not So)
Short Introduction to \LaTeX2e{}'. Another good primer is
\url{http://en.wikibooks.org/wiki/LaTeX/}.

In the following sections, we shall navigate through the menus and
menu items of an imaginary word processor, finding out the
corresponding \LaTeX{} way of doing the same work. If you're a
\LaTeX{} purist and this approach makes you sick{\ldots} don't hurt
yourself, please stop here.

% -----

% WP WITH LATEX

\subsection{Preliminaries}

Many word processor features are implemented by the editor; others by
standard \LaTeX{} commands; others still are obtained using
\emph{packages}. These are sets of macros that extend \LaTeX{}
providing new commands and environments. There are lots of packages
around: the only problem is knowing where they are, what they do, and
how to install them. More about packages in
Section~\ref{sec:packages}.

Packages and other \TeX{}-related material are available at many sites
that constitute the CTAN: the Comprehensive TeX Archive Network. I
already mentioned \url{http://www.ctan.org}; this site has a wide list
of mirrors. From now on, \href{http://www.ctan.org}{CTAN:} means `your
favourite CTAN mirror here, starting from the \TeX{} directory'. For
instance, you can get \LaTeX{} for your platform from
\href{http://www.tex.ac.uk/tex-archive/systems}{CTAN://systems} (e.g.\
\url{http://www.tex.ac.uk/tex-archive/systems/}).

To write your documents, you will need a good text editor. A better
choice for beginners is a \emph{\LaTeX{} shell}, i.e.\ an editor
dedicated to writing \LaTeX{} source, with preview and many
facilities.

I suggest that you install one of the programs listed below; all of
them are Free/Open Source software.

\begin{itemize}

  \item Texmaker (multiplatform):\\
  \url{http://www.xm1math.net/texmaker/index.html}

  \item TeXworks (multiplatform):\\
  \url{http://tug.org/texworks/}
  
  \item LyX, an almost-WYSIWYG \LaTeX{} editor (multiplatform):\\
  \url{http://www.lyx.org/}
  
  \item TeXShop (Mac OS X):\\
  \url{http://www.uoregon.edu/~koch/texshop/}
  
  \item TeXnicCenter (Windows):\\
  \url{http://www.texniccenter.org/}
    
\end{itemize}

A comprehensive list of \LaTeX{} shells for Windows can be found at
\url{http://home.arcor.de/itsfd/texwin}. Information about \LaTeX{} on
the Mac can be found at \url{http://www.esm.psu.edu/mac-tex/}.

% -----

% EDITOR-SUPPORTED

\subsubsection{Editor-Supported Features}

\LaTeX{} is just a formatter: things like cut and paste, search and
replace etc. are delegated to the editor. Table~\ref{tab:editing}
summarises the main commands of popular editors for geeks: GNU
\app{emacs} and \app{vim} with their native key bindings, and
\app{jed} configured for Borland IDE key bindings.

\begin{table}[htbp]
\begin{center}
\begin{tabular}{|lccc|} \hline
\textbf{Action} & \textbf{Emacs} & \textbf{Vim} & \textbf{Jed} \\
\hline
command mode & \texttt{Alt-X} & \texttt{ESC} & \texttt{Alt-X} \\
insert mode & n/a & \texttt{i a o O} & n/a \\
line editor mode & n/a & \texttt{:} & n/a \\
%\hline
\multicolumn{4}{|c|}{\textit{\rule{0pt}{0.3cm}file operations}} \\
%\hline
open file & \texttt{Ctrl-X Ctrl-F} & \texttt{:e} & \texttt{Ctrl-KE}\\
insert file & \texttt{Ctrl-Xi} & \texttt{:r} & \texttt{Ctrl-KR}\\
save file & \texttt{Ctrl-X Ctrl-S} & \texttt{:w} & \texttt{Ctrl-KD}\\
save as & \texttt{Ctrl-X Ctrl-W name} & \texttt{:w name} & \texttt{Ctrl-KS}\\
close file & \texttt{Ctrl-XK} & \texttt{:q} & \texttt{Ctrl-KQ}\\
change buffer & \texttt{Ctrl-XB} & \texttt{bN} & \texttt{Ctrl-KN}\\
undo & \texttt{Ctrl-XU} & \texttt{u} & \texttt{Ctrl-U}\\
redo & \texttt{Ctrl-\^} & \texttt{Ctrl-R} & \texttt{Ctrl-G Ctrl-U}\\
exit & \texttt{Ctrl-X Ctrl-C} & \texttt{:qa!} & \texttt{Ctrl-KX}\\
%\hline
\multicolumn{4}{|c|}{\textit{\rule{0pt}{0.3cm}moving around}}\\
%\hline
word left & \texttt{Alt-B} & \texttt{b} & \texttt{Ctrl-A}\\
word right & \texttt{Alt-F} & \texttt{w} & \texttt{Ctrl-F}\\
start of line & \texttt{Ctrl-A} & \texttt{0} & \texttt{Ctrl-QS}\\
end of line & \texttt{Ctrl-E} & \texttt{\$} & \texttt{Ctrl-QD}\\
page up & \texttt{Alt-V} & \texttt{Ctrl-U} & \texttt{Ctrl-R}\\
page down & \texttt{Ctrl-V} & \texttt{Ctrl-D} & \texttt{Ctrl-C}\\
start of buffer & \texttt{Alt-<} & \texttt{1G} & \texttt{Ctrl-QR}\\
end of buffer & \texttt{Alt->} & \texttt{G} & \texttt{Ctrl-QC}\\
line n. & \texttt{Alt-G n.} & \texttt{n.G} & \texttt{Ctrl-QI}\\
%\hline
\multicolumn{4}{|c|}{\textit{\rule{0pt}{0.3cm}deleting}}\\
%\hline
character left & \texttt{Ctrl-H} & \texttt{X} & \texttt{BS}\\
character right & \texttt{Ctrl-D} & \texttt{x} & \texttt{Alt-G}\\
word left & \texttt{Alt-DEL} & \texttt{db} & \texttt{Alt-BS}\\
word right & \texttt{Alt-D} & \texttt{dw} &\texttt{Ctrl-T} \\
end of line & \texttt{Ctrl-K} & \texttt{d\$} & \texttt{Ctrl-QY} \\
line & \texttt{Ctrl-A Ctrl-K} & \texttt{dd} & \texttt{Ctrl-Y} \\
%\hline
\multicolumn{4}{|c|}{\textit{\rule{0pt}{0.3cm}search \& replace}}\\
%\hline
search & \texttt{Ctrl-S text} & \texttt{/text} & \texttt{Ctrl-QS}\\
replace & \texttt{Alt-\%} & \texttt{:s/old/new/g} & \texttt{Ctrl-QA}\\
%\hline
\multicolumn{4}{|c|}{\textit{\rule{0pt}{0.3cm}blocks}}\\
%\hline
start selection & \texttt{Ctrl-SPACE} & \texttt{v} & \texttt{Ctrl-KB} \\
cut & \texttt{Ctrl-W} & \texttt{D} & \texttt{Ctrl-KY} \\
copy & \texttt{Alt-W} & \texttt{Y} & \texttt{Ctrl-KH} \\
paste & \texttt{Ctrl-Y} & \texttt{P} & \texttt{Ctrl-KC} \\
\hline
\end{tabular}
\caption{Useful key bindings for Emacs, Vim, and Jed in IDE mode.}
\label{tab:editing}
\end{center}
\end{table}

% -----

% ADDING PACKAGES

\subsubsection{Adding Packages}
\label{sec:packages}

The following information applies to \app{TeX Live}, which ships with
most GNU/Linux distributions. It may also work on MacTeX, but I have
no first-hand experience. Instructions for MiK\TeX{} (probably the
most popular implementation for Windows) will follow below.

A large collection of \LaTeX{} packages is natively supported; for
instance, Ubuntu provides lots of \app{texlive-*} packages. If you
need to install an unsupported package, do the following.

\begin{enumerate}

  \item create this directory structure:
  
  \begin{verbatim}
  $ mkdir -p ~/texmf/tex/latex
  \end{verbatim}
  
  Under this directory, new packages will be installed.

  \item get the package (typically as a zip-compressed directory) from
  your favourite CTAN mirror; let's call it \app{foo.zip}
  
  \item unpack it in the right place:
  
  \begin{verbatim}
  $ mkdir ~/texmf/tex/latex/foo
  $ mv foo.zip ~/texmf/tex/latex/foo
  $ cd ~/texmf/tex/latex/foo ; unzip foo.zip
  \end{verbatim}
 
  \item If no \texttt{.sty} file exists, run the command
  \texttt{latex foo.ins} or \texttt{latex foo.dtx} to create it;
  
  \item run the command \cmdline{texhash ~/texmf}.
    
\end{enumerate}

To add a package to MiK\TeX, create the directory
\path{\latex\newpackage} under \path{C:\localtexmf\tex\} and put the
relevant files in there. Proceed as above, then run MiKTeX Options and
click on the `Refresh now' button. Alternatively, issue the command
\cmdline{initexmf -u}. That's it!

Once a package is installed, you make it available in your documents
adding a line under the \texttt{documentclass} declaration:

\begin{verbatim}
\usepackage{foo}
\end{verbatim}

% -----

% GOLDEN RULES

\subsection{The Golden Rules}

Before we start, please keep this in mind:

\begin{enumerate}

  \item get used to \emph{structuring} your documents: think in terms of
  parts, chapters, sections, and so on. This holds true even if you're
  not writing a scientific paper.

  \item \LaTeX{} explicitly discourages the user from messing about with
  formatting parameters. Don't worry too much about the \emph{looks}
  of what you're writing, concentrate on the \emph{contents}.

\end{enumerate}

Convince yourself, apply the rules, and your printed material will
magically look professional! Again, let me recommend that you study a
real \LaTeX{} primer.

These rules apply to most documents. However, if the stuff you are
going to write is largely unstructured (circulars, notices, etc.),
then you asked for that: go ahead and read the rest of this guide.

\bigskip
{\color{blue} \dingline{45}}

% -----

% FILE

\section{The \menu{File} Menu}

Obviously, some entries of this menu have nothing to do with \LaTeX{}:
\entry{File}{Open}, \entry{File}{Save}, \entry{File}{Close} depend on
the editor. 

% -----

% FILE/NEW

\subsection{\entry{File}{New}}
\label{sec:filenew}

This is the \LaTeX{} equivalent of a blank page:

\begin{Verbatim}[fontsize=\small]
\documentclass{article}
\begin{document}
% This is a comment. Write your stuff here.
\end{document}
\end{Verbatim}

As documents written in \LaTeX{} are inherently structured, this is a
more realistic example:

\begin{Verbatim}[fontsize=\small]
\documentclass[a4paper,12pt]{article}
\begin{document}
\title{My Document}
\author{John Smith}
\date{London, \today}
\maketitle
\begin{abstract}
This is a very short article.
\end{abstract}
\tableofcontents
\listoftables
\listoffigures
\section{First Section}
\label{sec:start}
This is the text of the section. See \cite{Gonzato} for details.
\section{End}
\label{sec:end}
This is the end of the document. Please go to Section
\ref{sec:start} to read it again.
\begin{thebibliography}{99}
\bibitem{Gonzato} Gonzato G. \textit{\LaTeX{} for Word Processor
Users}. CTAN, 2001.
\end{thebibliography}
\end{document}
\end{Verbatim}

More document templates are listed in Appendix~\ref{ap:templates}.

% -----

% FILE/SAVE AS

\subsection{\entry{File}{Save As{\ldots}}}

The following tools are handy if you want to convert \LaTeX{} to other
formats:

\begin{itemize}

  \item \app{\TeX4ht} is probably the best \LaTeX{} to HTML converter:\\
  \url{http://www.cse.ohio-state.edu/~gurari/TeX4ht/}

  \item \app{latex2html}, another converter to HTML:\\
    \url{http://saftsack.fs.uni-bayreuth.de/~latex2ht/},\\
    \href{http://www.ctan.org/tex-archive/support/latex2html}
    {CTAN://support/latex2html}
    
  \item \app{latex2rtf}, a converter to Rich Text Format:\\
  \href{http://www.ctan.org/tex-archive/support/latex2rtf}
  {CTAN://support/latex2rtf}

  \item \app{detex} (a command line converter) removes all \LaTeX{} tags and
  outputs plain text:\\
  \url{http://www.cs.purdue.edu/homes/trinkle/detex/}, \\
  \href{http://www.ctan.org/tex-archive/support/detex}
  {CTAN://support/detex/}

  
\end{itemize}

See also Section~\ref{sec:prpreview} for details on PDF creation.

% -----

% FILE/SAVE AS TEMPLATE

\subsection{\entry{File}{Save As Template}}

Saving a \LaTeX{} `template' would mean, as I see it, create a new
\LaTeX{} package. This is complex matter that goes beyond the scopes
of this guide.

% -----

% FILE/IMPORT

\subsection{\entry{File}{Import}}

These tools convert from other formats to \LaTeX{}:

\begin{itemize}

  \item \app{rtf2latex}: 
  \href{http://www.ctan.org/tex-archive/support/rtf2latex}
  {CTAN://support/rtf2latex}
  
  \item \app{html2latex}: 
  \href{http://www.ctan.org/tex-archive/support/html2latex}
  {CTAN://support/html2latex}
  
  \item \app{wvware} is a set of tools that convert from MS Word to
  several formats including \LaTeX{};
  \url{http://wvware.sourceforge.net}
  
  \item the free word processor Abiword, \url{http://www.abisource.com},
  imports MS Word and can export \LaTeX.
  
  \item \app{txt2tex}: 
  \href{http://www.ctan.org/tex-archive/support/txt2tex}
  {CTAN://support/txt2tex} does a fairly good job at converting plain
  text files into \LaTeX.
  
\end{itemize}

Other \texttt{*2latex} converters are available at the same address.

Another interesting extension is OOoLatex, a set of macros for
OpenOffice: \url{http://ooolatex.sourceforge.net/}.


% -----

% FILE/PAGE SETUP

\subsection{\entry{File}{Page Setup}}
\label{sec:pagesetup}

The normal method for setting paper size, orientation, and margins, is
to use parameters in \cmd{documentclass}. Paper size can be
\parm{a4paper}, \parm{a5paper}, \parm{b5paper}, \parm{letterpaper},
\parm{legalpaper}, \parm{executivepaper}; orientation is
\parm{portrait} by default, or optionally \parm{landscape}. For
example, 

\begin{Verbatim}[fontsize=\small]
\documentclass[a5paper,landscape,12pt]{article}
\end{Verbatim}

Document-wide margins are set with these commands:

\begin{Verbatim}[fontsize=\small]
\setlength{\leftmargin}{2cm}
\setlength{\rightmargin}{2cm}
\setlength{\oddsidemargin}{2cm}
\setlength{\evensidemargin}{2cm}
\setlength{\topmargin}{-1cm}
\setlength{\textwidth}{18cm}
\setlength{\textheight}{25cm}
\end{Verbatim}

The \package{geometry} package allows for complete control of
parameters such as paper size, margins width, and so on.
\package{geometry} has far too many options to list them all, and
you're invited to read its documentation. A fairly complete example of
its usage is shown below. In this example, some parameters are not
compatible with each other, and are there for purpose of argument
only.

\begin{Verbatim}[fontsize=\small]
\usepackage{geometry}  % top of document
...
\geometry{paperwidth=25cm}
\geometry{paperheight=35cm}
% or: \geometry{papersize={25cm,35cm}}
\geometry{width=20cm}  % total width
\geometry{heigth=30cm} % total heigth
% or: \geometry{total={20cm,30cm}}
\geometry{textwidth=18cm}  % width - marginpar
\geometry{textheight=25cm} % heigth - header - footer
% or: \geometry{body={18cm,25cm}}
\geometry{left=3cm}    % left margin
\geometry{right=1.5cm} % right margin
% or: \geometry{hmargin={3cm,2cm}}
\geometry{top=2cm}     % top margin
\geometry{bottom=3cm}  % bottom margin
% or: \geometry{vmargin={2cm,3cm}}
\geometry{marginparwidth=2cm}
\geometry{head=1cm}    % header space
\end{Verbatim}

Options can also be set this way:

\begin{Verbatim}[fontsize=\small]
\usepackage[left=3cm, right=2cm]{geometry}
\end{Verbatim}

% -----

% FILE/PAGE SETUP/HEADERS AND FOOTERS

\subsubsection{\entry{Page Setup}{Headers and Footers}}
\label{sec:headers_footers}

The \package{fancyhdr} package provides the new command
\cmd{pagestyle\{fancy\}}. This will create a header reporting the
current section (\style{chapter} in \style{book.cls}) and subsection,
and a footer with the page number: pretty fancy indeed. Headers and
footers can obviously be customised. They are made of three parts: a
left-aligned part, a centre-aligned part, and a right-aligned part. To
set those, use the commands like in this example:

\begin{Verbatim}[fontsize=\small]
\usepackage{fancyhdr}
...
\lhead{} % empty
\chead{Hello, world!}
\rhead{Page \thepage} % page number
\lfoot{}              
\cfoot{\textbf{Hello!}}
\rfoot{}
\end{Verbatim}

% -----

% FILE/PRINTER SETUP

\subsection{\entry{File}{Printer Setup}}

This is highly OS-dependent, and definitely outside of the scopes of
\LaTeX{}. Assuming that you're using a \unix-like system, these tips
may come in handy:

\begin{itemize}

  \item \cmdline{lpr -P printername} prints to the specified printer;
  
  \item \cmdline{lpr -\# 10} prints 10 copies;
  
  \item \cmdline{lpr -r} removes the file after printing it

\end{itemize}

See below for more tips.

% -----

% FILE/PRINT PREVIEW

\subsection{\entry{File}{Print Preview}}
\label{sec:prpreview}

When the \LaTeX{} input file is ready, you have several options:

\begin{itemize}

  \item convert it to \file{.dvi} (\cmdline{latex file.tex}) and previewing
    it with \app{xdvi}, \app{yap} or other DVI previewer;
    
  \item convert the \file{.dvi} to \PS{} with \app{dvips}, then use
    some variant of \app{Ghostview};
    
  \item producing a \file{.pdf} file with \app{dvipdf} or directly
  with \app{pdflatex}.
  
\end{itemize}

In my opinion, producing a \file{.pdf} file is the best option, as it
makes for widest portability.

While \app{dvipdf} is just a script that converts the \file{.dvi} to
\file{.ps} then to \file{.pdf}, using \app{pdflatex} is more
interesting. In fact, some packages like \package{hyperref} and
\package{url} make the resulting \file{.pdf} file browseable; see
Section~\ref{sec:hyperlink}. However, \note{} using \app{pdflatex} you
might experience problems with other packages. More details in
Section~\ref{sec:figure}.

% -----

% FILE/PRINT

\subsection{\entry{File}{Print}}

Simply use \cmdline{lpr file.ps} from the command line, or via the
\entry{File}{Print} menu entry of your previewer.

% TO DO: print the LaTeX source, pretty-formatted

% -----

% FILE/VERSIONS

\subsection{\entry{File}{Versions}}

Although the \package{version} package provides basic facilities for
versioning \LaTeX{} sources, it's better to use external tools like
RCS (Revision Control System) or CVS (Concurrent Version Control
System), possibly integrated with the editor. For a quick introduction
to CVS and RCS, please visit
\url{http://www.faqs.org/docs/Linux-HOWTO/CVS-RCS-HOWTO.html}.

% -----

% EDIT

\section{The \menu{Edit} Menu}

This menu has more to do with the editor than \LaTeX{} features. To
begin with, refer to Table~\ref{tab:editing} that shows the key
bindings for the entries \entry{Edit}{Cut}, \entry{Edit}{Copy},
\entry{Edit}{Paste}, \entry{Edit}{Find}, and \entry{Edit}{Replace} of
some common editors.

Selecting text is not only performed for subsequent cut and paste, but
also for applying styles to the selected text. The equivalent action
in \LaTeX{} is to enclose the text either between braces, or in an
environment. For example, to apply the bold attribute to a portion of
text you will use one of the following:

\begin{example}
this is \textbf{bold text;}\\
this is also
{\bfseries bold text;}\\
\begin{bfseries}
this is bold text, too!
\end{bfseries}
\end{example}

% -----

% EDIT/AUTOTEXT

\subsection{\entry{Edit}{Autotext}}

We call \emph{autotext} the feature that makes you type, say, `PS' to
have the word `PostScript' automatically expanded. This is an editor
feature, but there's a rough \LaTeX{} equivalent:

\begin{Verbatim}[fontsize=\small]
\def\PS    {\textsc{PostScript}}
\end{Verbatim}

which will insert the equivalent of \verb|\textsc{PostScript}|
whenever you type \verb|\PS|. Beware, case is important.

% -----

% INSERT

\section{The \menu{Insert} Menu}
\label{sec:menu_insert}

% -----

% INSERT/BREAKS

\subsection{\entry{Insert}{Breaks}}

\begin{itemize}

  \item a non-breakable space is set with \textasciitilde{} (tilde)
  
  \item to force a line break, use \cmd{linebreak} or \cmd{newline};
  see below for details
  
  \item to start a new paragraph use a blank line, or \cmd{\bs} (possibly
  followed by an optional space, as in \cmd{\bs[1cm]}), or \cmd{par}
  
  \item finally, for a page break use \cmd{newpage} or \cmd{clearpage}
  
\end{itemize}

Unlike \cmd{newline}, \cmd{linebreak} stretches the line to the
margins:

\begin{example}
I am stretched!\linebreak
But I am not.\newline
Ok, now you get it.
\end{example}

Besides, \cmd{clearpage} differs from \cmd{newpage} in that it prints
all pending \emph{floats}, that is figures and tables. Floats will be
explained in Section~\ref{sec:figure}.

% -----

% INSERT/ENUMERATED LIST

\subsection{\entry{Insert}{Enumerated List}}

Bulleted and enumerated lists correspond to the \env{itemize} and
\env{enumerate} environments. To customise the bullet in a list
environment, you can specify it as an argument to \cmd{item}:

\begin{example}
\begin{itemize}
  \item[*] with an asterisk;
  \item[-] with a dash;
  \item[.] with a dot.
\end{itemize}
\end{example}

Another way is to redefine the style of the counters that refer to the
digits in the first- to fourth-level lists.\footnote{These are
\cmd{labelitemi}, \cmd{labelitemii}, \cmd{labelitemiii} and
\cmd{labelitemiv}.} There are several styles: \cmd{arabic} for
`normal' numbers, \cmd{roman} for lower-case roman numerals (e.g. viii
is 8), \cmd{Roman} for upper-case roman numerals, \cmd{alph} and
\cmd{Alph} for lower- and upper-case letters, and \cmd{fnsymbol} that
I will not explain for now:

\begin{example}
\begin{itemize}
\renewcommand{\labelitemi}{*}
\renewcommand{\labelitemii}{-}
  \item first level, item 1
  \item first level, item 2
  \begin{itemize}
    \item second level, item 1
    \item second level, item 2
  \end{itemize}
  \item first level, item 3
\end{itemize}
\end{example}

To use, say, roman numbers and uppercase letters in enumerated lists,
do this:

\begin{example}
\begin{enumerate}
\renewcommand{\labelenumi}
  {\Alph{enumi}}
\renewcommand{\labelenumii}
  {\roman{enumii}}
  \item first level, item 1
  \item first level, item 2
  \begin{enumerate}
    \item second level, item 1
    \item second level, item 2
  \end{enumerate}
  \item first level, item 3
\end{enumerate}
\end{example}

Alternatively, use the \package{enumerate} package. It redefines the
\env{enumerate} environment with the ability to specify an optional
argument. Any occurrence of one of the characters \texttt{A a I i 1}
will produce the value of the counter, using (respectively)
\cmd{Alph}, \cmd{alph}, \cmd{Roman}, \cmd{roman}, or \cmd{arabic}. To
include some text, enclose it in braces:

\begin{example}
\begin{enumerate}[{Example} I.]
  \item First example.\label{item:first}
  \item Second example.
  \item Last example.
    Go to Item~\ref{item:first}.
\end{enumerate}
\end{example}

Lists within paragraphs are implemented by the \package{paralist}
package, which provides the \env{inparaenum} environment:

\begin{example}
I'll throw in a list of items: 
\begin{inparaenum}
  \item apples,
  \item pears, and
  \item oranges.
\end{inparaenum}
The same list can be labelled
with letters:
\begin{inparaenum}
  [\itshape a) \upshape]
  \item apples, \label{first}
  \item pears, and
  \item oranges. The first item is \ref{first}.
\end{inparaenum}
\end{example}

As seen above, the characters \texttt{A a I i 1} can be used to modify
the counter. \package{paralist} can do much more, and I suggest that
you read its documentation.

% Finally, to change the indentation and distance between items you do:

% There are many counters associated with countable things like
% \cmd{section}, \cmd{page}, \cmd{table}, and so on: these have the same name
% of the environment or command that produces the number, but no leading \bs.

% To force a counter to a given number, do something like this:

% \begin{Verbatim}[fontsize=\small]
% \setcounter{counter_name}{value}
% \end{Verbatim}

% For instance, to force a page number to 100 you'll do:

% \begin{Verbatim}[fontsize=\small]
% \setcounter{page}{100}
% \end{Verbatim}

% -----

% INSERT/SYMBOL

\subsection{\entry{Insert}{Special Character}}

First of all, let's remind that some characters have a special meaning
in \LaTeX{}. They must be entered either with a leading \bs, or using
them in math mode, or even writing special commands: see
Table~\ref{tab:characters}.

\begin{table}
\begin{center}
  \begin{tabular}{ll}
  \hline
  \textbf{Character} & \textbf{\LaTeX{} Sequence} \\
  \hline
  \$ & \verb|\$| or \verb|\textdollar| \\
  \& & \verb|\&| \\
  \% & \verb|\%| \\
  \_ & \verb|\_| or \verb|\textunderscore| \\
  \{ & \verb|\{| or \verb|\textbraceleft| \\
  \} & \verb|\}| or \verb|\textbraceright| \\
  $<$ & \verb|$<$| or \verb|\textless| \\
  $>$ & \verb|$>$| or \verb|\textgreater| \\
  \bs & \verb|\textbackslash| \\
  \textbar & \verb|\textbar| \\
  \textbullet & \verb|\textbullet| \\
  \textdaggerdbl & \verb|\textdaggerdbl| \\
  \textdagger & \verb|\textdagger| \\
  \textparagraph & \verb|\textparagraph| \\
  \textsection & \verb|\textsection| \\
  \textcopyright & \verb|\textcopyright| \\
  \textasciicircum & \verb|\textasciicircum| \\
  \textasciitilde & \verb|\textasciitilde| or \verb|\~{}| \\
  $\sim$ & \verb|$\sim$| \\
  \textregistered & \verb|\textregistered| \\
  \texttrademark & \verb|\texttrademark| \\
  \textordfeminine & \verb|\textordfeminine| \\
  \textordmasculine & \verb|\textordmasculine| \\
  \hline
  \end{tabular}
  \caption{How to obtain some special characters.}
  \label{tab:characters}
\end{center}
\end{table}

Another way to enter special characters is using their ASCII code and
the \cmd{char} command. For example, you could insert the characters
\texttt{\char36 \char38 \char94 \char126} entering \cmd{char36}
\cmd{char38} \cmd{char94} \cmd{char126}.

There are packages that provide thousands of unusual characters and
symbols. For instance, \package{pifont} provides the commands
\cmd{ding}, \cmd{dingfill}, \cmd{dingline}, and \cmd{dinglist}. The
first command produces the Dingbat character of the specified code.
The other commands are equivalent to the \cmd{fill}, \cmd{line}, and
\cmd{list} commands and environment, but use the Dingbat code given as
parameter:

\begin{example}
\begin{dinglist}{43}
  \item one
  \item two
  \item three
\end{dinglist}
\end{example}

Another nice variant is this:

\begin{example}
\begin{dingautolist}{172}
  \item one
  \item two
  \item three
\end{dingautolist}
\end{example}

There are far too many symbols to mention them all in this guide.
Rather, I'll point you to `The Comprehensive \LaTeX{} Symbol List' at
\href{http://www.ctan.org/tex-archive/info/symbols/comprehensive}
{CTAN://info/symbols/comprehensive}.

% -----

\subsubsection{The \euro{} Sign}

The official Euro sign is provided by the \package{eurosym} package,
which can be used in two ways:

\begin{verbatim}
\usepackage[gen]{eurosym}
\usepackage[official]{eurosym}
\end{verbatim}

Both provide the \cmd{euro} command, which produces \euro. The actual
shape of the symbol depends on the declaration: the \verb|[gen]|
option provides a symbol that works with all font styles; the second
declaration produces \officialeuro. Please note the difference. The
latter shape can always be obtained with \cmd{officialeuro}.

Another package that provides the Euro sign is \package{marvosym},
which also provides many more fine characters. You get \EUR{} with
\cmd{EUR}.

% -----

% INSERT/FORMULA

\subsection{\entry{Insert}{Formula}}

\LaTeX{} is particularly strong at typesetting math. To insert math
symbols in the main text, you must enclose them between \texttt{\$}:

\begin{example}
I like math: $x^n + y^n \neq
z^n \forall n \neq 2$
is my favourite theorem.
\end{example}

The environments \env{displaymath} and \env{equation} typeset formulae
aside from the text. The latter adds an equation number for later
reference:

\begin{example}
Fermat's Last Theorem is
defined as:
\begin{equation}
x^n + y^n \neq z^n
\forall n \neq 2 
\label{eq:fermat}
\end{equation}
Can you prove
Eq.~\ref{eq:fermat}?
\end{example}

% -----

% INSERT/FOOTNOTE

\subsection{\entry{Insert}{Footnote}}

The command \verb|\footnote[n]{footnote text}| is all you need; the
optional parameter \verb|[n]| modifies the footnote number. The
\verb|\footnote| command should be placed after commas, full stops,
and other punctuation signs that follow the word.

To use a symbol or arbitrary text instead of a number, redefine the
counter associated with \cmd{footnote}:

% can't use example, it uses minipages!
\medskip

\begin{minipage}[c]{0.5\textwidth}
  \begin{Verbatim}[fontsize=\small]
\renewcommand{\thefootnote}{read me!}
This footnote\footnote
{I mean this one.}
says it all.
  \end{Verbatim}
\end{minipage}%
\begin{boxedminipage}[c]{0.5\textwidth}
  \renewcommand{\thempfootnote}{read me!}
  This footnote\footnote
  {I mean this one.}
  says it all.
\end{boxedminipage}

\medskip

Using this method, you can get footnote numbers in roman numerals, or
replaced by nice symbols:

\medskip

\begin{minipage}[c]{0.5\textwidth}
  \begin{Verbatim}[fontsize=\small]
\renewcommand{\thefootnote}
{\Roman{footnote}}
This\footnote{The first.}
is the first footnote,
and this\footnote{The second.}
is the second.
\renewcommand{\thefootnote}
{\fnsymbol{footnote}}
The end.\footnote[8]{At last!}
  \end{Verbatim}
\end{minipage}%
\begin{boxedminipage}[c]{0.5\textwidth}
  \renewcommand{\thempfootnote}
  {\Roman{footnote}}
  This\footnote{The first.}
  is the first footnote,
  and this\footnote{The second.}
  is the second.
  \renewcommand{\thempfootnote}
  {\fnsymbol{footnote}}
  The end.\footnote[8]{At last!}
\end{boxedminipage}

\medskip

Note the \verb|\fnsymbol{footnote}| thing. It uses 9 symbols
associated with the values 1{\ldots}9 of the \texttt{footnote}
counter: \fnsymbol{fnsym} \stepcounter{fnsym} \fnsymbol{fnsym}
\stepcounter{fnsym} \fnsymbol{fnsym} \stepcounter{fnsym}
\fnsymbol{fnsym} \stepcounter{fnsym} \fnsymbol{fnsym}
\stepcounter{fnsym} \fnsymbol{fnsym} \stepcounter{fnsym}
\fnsymbol{fnsym} \stepcounter{fnsym} \fnsymbol{fnsym}
\stepcounter{fnsym} \fnsymbol{fnsym}.

% gosh. How do you write the `for ()' loop in TeX?

To make several references to the same footnote, don't write its
number explicitly. Rather, do this:

\medskip

\begin{minipage}[c]{0.5\textwidth}
  \begin{Verbatim}[fontsize=\small]
This\footnote{the first.}
\newcounter{\myfootnote}
\setcounter{\myfootnote}
  {\value{footnote}}
and that\footnote{the second.}
are footnotes: please read note
\footnotemark
[\value{\myfootnote}] again.
  \end{Verbatim}
\end{minipage}%
\begin{boxedminipage}[c]{0.5\textwidth}
\renewcommand{\thempfootnote}{\arabic{mpfootnote}}
This\footnote{the first.} \newcounter{myfootnote}%
\setcounter{myfootnote}{\value{mpfootnote}}%
and this\footnote{the second.} are footnotes: please read note%
\footnotemark[\value{myfootnote}] again.
% This footnote\footnote{I mean this one.} says it all. Please read 
% note\footnotemark[\value{mpfootnote}] again.
\end{boxedminipage}

\medskip

Warning: minipages use their own counters, \texttt{mpfootnote} and
\texttt{thempfootnote}.

% -----

\subsubsection{Footnotes at End of Document}

The \package{endnotes} package lets you move all footnotes at the end
of the document. You'll have to add this line to the preamble:

\begin{Verbatim}[fontsize=\small]
\let\footnote=\endnote
\end{Verbatim}

and these lines as the last thing in your document:

\begin{Verbatim}[fontsize=\small]
\newpage
\begingroup
\parindent 0pt
\parskip 2ex
\def\enotesize{\normalsize}
\theendnotes
\endgroup
\end{Verbatim}

Other commands are available, please read the \file{endnotes.sty}
source.

% -----

% INSERT/INDICES

\subsection{\entry{Insert}{Indices}}
\label{sec:tocs}

Generating and inserting a table of contents, list of tables, and list
of figures is a trivial task in \LaTeX. All you have to do is insert
these lines before the first \cmd{section} or \cmd{chapter} of your
document:

\begin{Verbatim}[fontsize=\small]
\tableofcontents
\listoffigures
\listoftables
\end{Verbatim}

% TO DO: how to customise the table of contents.

% The table of contents can be customised. 

% \setcounter{tocdepth}{3}

% http://stackoverflow.com/questions/544051/how-does-one-change-the-paragraph-formatting-in-latex


% -----

% INSERT/SPACE

\subsection{\entry{Insert}{Vertical and Horizontal Space}}
\label{sec:space}

This entry doesn't actually exist in any word processor I am aware of.
This is in fact a limitation that \LaTeX{} fills in a very elegant
way.

\emph{Space filling} is used to center text horizontally, vertically,
or both; this is a difficult task to perform with any word processor,
and requires a lot of trial end error. Use a combination of \cmd{null}
or \verb|~| to set fixed marks, followed by \cmd{vfill} and
\cmd{hfill} like in this example:

\begin{example}
one \hfill two\\
\vfill
~ \hfill three \hfill ~\\
\vfill
four \hfill five
\null
\end{example}

Normally, \LaTeX{} won't let you insert blank spaces at your will.
However, if you do want to make your document look messy, use \verb|~|
to make a non-breakable space.

Also, use the command \cmd{hspace} like in this example:

\begin{example}
This is a \hspace{2cm}
2-cm-wide hole.
\end{example}

% -----

% INSERT/TABS

\subsection{\entry{Insert}{Tabs}}

The \env{tabbing} environment provides a rough equivalent to the
action of the TAB key. See this example:

\begin{example}
\begin{tabbing}
% let's set the tab positions
~ \hspace{1cm} \= ~ \hspace{2cm} \= 
~ \hspace{3cm} \= \kill % discard text
Zero \> One \> Two \> Three \\
Zero \> One \> \> Three \+ \\ % go right
Zero \> Two \> Three \- \\ % go left
Zero \> One \> Two \\
\pushtabs % save tab positions
new tab 1{\ldots} \= new tab 2 \\
new \> tab \\
\poptabs  % restore tab positions
Zero \> One \> Two \> Three
\end{tabbing}
\end{example}

See also the \env{tabular} and \env{table} environments.

% -----

% INSERT/CROSS REFERENCE

\subsection{\entry{Insert}{Cross Reference}}
\label{sec:xrefs}

The commands \cmd{label}, \cmd{ref}, and \cmd{pageref} are all you
need to insert labels in the text and do cross referencing. The
standard format of labels is the \texttt{prefix:suffix} form, where
\texttt{prefix} is one of the following: \texttt{cha} for chapters,
\texttt{eq} for equations, \texttt{fig} for figures, \texttt{sec} for
(sub)sections, and \texttt{tab} for tables.

References to a page (section, table, figure, etc.) number can be
obtained using \cmd{label} and \cmd{ref} as in this example:

\begin{example}
\paragraph{Example.}
\label{par:example}
This paragraph appears
in Section~\ref{par:example}
on page \pageref{par:example}.
\end{example}

Of course, you may use your own prefixes. For example, take this
enumerated list:

\begin{example}
\begin{enumerate}
  \item{first step: skip to 
  \ref{item:end} \label{item:start}}
  \item{another step (unreferenced)}
  \item{end: go back to
  \ref{item:start} \label{item:end}}
\end{enumerate}
\end{example}

% -----

% INSERT/MARGIN NOTES

\subsection{\entry{Insert}{Margin Notes}}

Very simple: use \verb|\marginpar{text}|. 

% -----

% INSERT/FRAME

\subsection{\entry{Insert}{Frame}}

Let's imagine you want to typeset a poster or a sign: you'll need a
way to put text and figures on fixed position on the page. Use the
\package{textpos} package, as shown in the example listed in
Figure~\ref{fig:poster} (see Appendix~\ref{ap:templates}).

\medskip

\begin{boxedminipage}[c]{0.6\linewidth}
A simpler approach is using \emph{minipages}: literally, miniature pages.
This text is included in a \texttt{minipage} environment. Actually, to be
more precise, a \texttt{boxedminipage}, courtesy of the
\package{boxedminipage} package. I used this declaration:
\begin{verbatim}
\begin{boxedminipage}[c]{0.6\linewidth}
... text ...
\end{boxedminipage}
\end{verbatim}
\end{boxedminipage}


% -----

% INSERT/FIGURE

\subsection{\entry{Insert}{Figure}}
\label{sec:figure}

(The reference guide for graphic inclusion in \LaTeX{} is `Using
Imported Graphics in \LaTeX2e', a.k.a. \texttt{epslatex.ps}.)

A `figure' can be not only a picture, but also a portion of text, a
table, etc.\ that you put in a \env{figure} environment. This is an
example:

\begin{figure}[htbp]
  \begin{minipage}[c]{0.6\textwidth}
  \begin{Verbatim}[fontsize=\small]
\begin{figure}[htbp]
% [htbp] specifies the 
% preferred placement: here, top,
% bottom, or separate page.
  \begin{center}
  \texttt{=8-)}
  \end{center}
  \caption{A smiley representing 
  the author of this guide.}
  \label{fig:mysmiley}
\end{figure}
  \end{Verbatim}
  \end{minipage}%
  \begin{boxedminipage}[c]{0.4\textwidth}
      \begin{center}
      \texttt{=8-)}
      \end{center}
      \caption{A smiley representing the author of this guide.}
      \label{fig:mysmiley}
  \end{boxedminipage}
\end{figure}

Please \note note that figures are not guaranteed to appear exactly
where you write the code! In fact, the main difference with word
processors is that figures don't have a fixed placement; they `float'
to the optimal position that \LaTeX{} finds for them. So, the text
shouldn't refer to a figure like `the figure below' or `the figure
above'; rather, use `\verb|see Figure~\ref{fig:label}|'.

Owing to this property, figures and tables are called \emph{floats}.
If you do need to position a float exactly, use the \package{here}
package that provides an optional placement argument \texttt{H}.

Given a picture in Encapsulated \PS{} (\texttt{.eps}) format, you
insert it in a \LaTeX{} source file using the \package{graphicx}
package and commands like those shown in Figure~\ref{fig:gnuplot}.

\medskip

\begin{figure}[htbp]
  \begin{minipage}[c]{0.5\textwidth}
  \begin{Verbatim}[fontsize=\small]
\begin{figure}
\begin{center}
\fbox{\includegraphics
[width=0.5\textwidth, angle=-90]
{gnuplot.ps}}
\caption{A Gnuplot graph.}
\label{fig:gnuplot}
\end{center}
\end{figure}
  \end{Verbatim}
  \end{minipage}%
  \begin{minipage}[c]{0.5\textwidth}
    \begin{center}
      \ifpdf
        \fbox{\includegraphics[width=0.6\textwidth, angle=-90]{gnuplot.pdf}}
      \else
        \fbox{\includegraphics[width=0.6\textwidth, angle=-90]{gnuplot.ps}}
      \fi
    \caption{A Gnuplot graph.}
    \label{fig:gnuplot}
    \end{center}
  \end{minipage}
\end{figure}

When you typeset your document with \cmd{latex} then \app{dvips},
graphic inclusion only works with \texttt{EPS} files; \app{pdflatex}
accepts JPG, PNG, and of course PDF files.

There are several packages that convert common graphic formats like
\file{.jpg}, \file{.gif}, \file{.png} etc. to \texttt{.eps}; for
example, ImageMagik (\url{http://www.imagemagik.org}) and The GIMP
(\url{http://www.gimp.org}). However, these applications produce huge
\PS{} files.

Best results are obtained using applications that wrap the bitmap,
turning it into a compact \PS{} file. You'll want to use \app{jpeg2ps}
(\url{http://www.pdflib.com/jpeg2ps/index.html}) or \app{bmeps}
(\href{http://www.ctan.org/tex-archive/support/bmeps}
{CTAN://support/bmeps}). The former is often the best choice for
wrapping \file{.jpg} files, but the latter handles more graphics
formats.

\begin{warn}

  If you use PDF\LaTeX{}, you must convert your pictures to
  \file{.pdf} with the command \app{epstopdf} and modify the source
  accordingly! 

\end{warn}

If you wish to make both \file{.pdf} and \file{.ps} from the same
source file, include these commands:

\begin{Verbatim}[fontsize=\small]
\usepackage{ifpdf}
...
% include the right options
\ifpdf
  \usepackage[pdftex]{graphicx}
  \pdfcompresslevel=9
\else
  \usepackage{graphicx}
\fi
...
% include the right graphic file
\ifpdf
  \includegraphics{file.pdf}
\else
  \includegraphics{file.eps}
\fi
\end{Verbatim}

\begin{warn}

  If you have more than 18 figures without text between them, you'll
  get the `Too many unprocessed floats' \LaTeX{} error. The quickest
  way to solve this problem is to put \cmd{clearpage} after three or
  four figures.

\end{warn}

% -----

\subsubsection{Wrapping Floats}

For a magazine-like layout, use the \package{wrapfig} package:

\begin{example}
If you meet this guy, give him some money.

\begin{wrapfigure}[4]{l}[5pt]{2cm}
{\Huge
 \texttt{=8-)}
}
\end{wrapfigure}

The reason may not be apparent to you,
but I can assure that your money
will end up in good hands.
I say again, if you meet this guy,
give him some money: he knows how to
use it properly. OK?
\end{example}

The parameters are the number of lines to be narrowed, the figure
placement, the overhang, and the figure width.

% -----

% INSERT/SHAPES

\subsection{\entry{Insert}{Shapes}}

\LaTeX{} provides a \env{picture} environment whithin which you use
commands like \cmd{circle}, \cmd{oval} and so on. In my opinion,
drawing pictures without a graphical environment is just too hard, and
\env{picture} has several limitations too. It's much better to use the
drawing program Xfig (\url{http://www.xfig.org}), only available for
\unix. It has a couple of good tricks in store.

\medskip

\begin{figure}[htbp]
  \centering
  \ifpdf
    \includegraphics{xfig.png}
  \else
    \includegraphics{xfig.eps}
  \fi
  \caption{A quick drawing made with Xfig.}
  \label{fig:xfig}
\end{figure}

\medskip

Xfig looks ugly, but is very powerful. One of its greatest advantages
is that it exports drawings in several formats, some of which are
recognised by \LaTeX. Another bonus is that text objects will be
rendered by \LaTeX{} if their `special flag' field is set, letting you
enter ordinary \TeX{} formulae and symbols in drawings.

So, let's suppose you made a drawing called \file{small.fig}
(Figure~\ref{fig:xfig}). If you're going to use \app{pdflatex}, select
\entry{File}{Export{\ldots}} and select `Combined PDF/LaTeX (both
parts)' from the \menu{Language} menu. Xfig will create two files,
\file{small.pdf} and \file{small.pdf\_t}. To include the drawing in a
document, you'll do:

\medskip

\begin{minipage}[c]{0.5\textwidth}
  \begin{Verbatim}[fontsize=\small]
  \usepackage[pdftex]{graphicx}
  ...
  Here's an Xfig drawing:
  
  \input{small.pdf_t}
  \end{Verbatim}
\end{minipage}%
\begin{boxedminipage}[c]{0.5\textwidth}
Here's an Xfig drawing:

\ifpdf
  \input{small.pdf_t}
\else
  \input{small.eepic}
\fi

\end{boxedminipage}

\medskip

If you're going to use plain \app{latex}, select
\entry{File}{Export{\ldots}} and choose `LaTeX picture + eepic macros'
from the \menu{Language} menu. You'll obtain another file,
\file{small.eepic}. To include the drawing in a document, you'll have
to use the \package{epic} and \package{eepic} packages:

\medskip

\begin{minipage}[c]{0.5\textwidth}
  \begin{Verbatim}[fontsize=\small]
  \usepackage{epic}
  \usepackage{eepic}
  ...
  This is a picture 
  drawn with Xfig:\\
  \input{small.eepic}
  \end{Verbatim}
\end{minipage}%

\medskip

There's a caveat though: it looks like \package{epic} and
\package{eepic} clash with \package{hyperref}, as the \verb|\path|
command is redefined by the latter. Another good reason to use
\cmdline{pdflatex}.

If you wish to do real magic, then check out the \package{pgf}
package, \url{http://sourceforge.net/projects/pgf/}. Or 
\package{pstricks}: \url{http://tug.org/PSTricks/main.cgi/}. These
packages let you make fine \PS{} drawings in \LaTeX. Another wonderful
program is ePiX
(\url{http://mathcs.holycross.edu/~ahwang/current/ePiX.html}),
specialised in producing scientific plots and figures for inclusion in
\LaTeX{} documents. Many more are available; search the web for
``LaTeX vector graphics''.

% -----

% INSERT/LINE

\subsection{\entry{Insert}{Line}}

Draw lines of any length and thickness with \cmd{rule}:

\begin{example}
This is a page-wide
rule:\\
\rule{\linewidth}{1pt}
but this one is shorter
and thicker:\\
\rule{2cm}{2mm}
\end{example}

Another interesting `line' is that made of dots (\cmd{dotfill}), often
used to relate things. This is how it's done:

\begin{example}
Total price \dotfill \euro~10
\end{example}

% -----

% INSERT/HYPERLINK

\subsection{\entry{Insert}{Hyperlink}}
\label{sec:hyperlink}

The \package{url} package lets you write URLs and have them hyphenated
correctly. When used together with the package \package{hyperref} and
\app{dvipdf} or \app{pdflatex}, \package{url} lets you make browseable
\file{.pdf} documents! For instance, this document uses this
declaration:

\begin{Verbatim}[fontsize=\small]
\usepackage[colorlinks,urlcolor=blue,filecolor=magenta]{hyperref}
\usepackage{url}
\end{Verbatim}

Let's see an example:

\begin{example}
The \hypertarget{ctan}{CTAN} main site
is \url{http://www.ctan.org}, a.k.a
\href{http://www.ctan.org}{CTAN://}.

Listen to \href{run:midifile.mid}
{this MIDI file}.

Click \hyperlink{ctan}{here} to go
back to the top.
\end{example}

The \cmd{hypertarget} and \cmd{hyperlink} commands provide internal
links, just like HTML; \cmd{href} creates links to URLs or external
files. Note the \texttt{run:} parameter: you can run external programs
like multimedia players, office applications, whatever. As far as I
know, this feature only works in Adobe Reader, Okular, and Evince.

On Linux and possibly other \unix{} variants, you'll have to instruct
your favourite PDF reader what to run when an external file is
referenced. Insert lines like the following in your \file{.mailcap} or
\file{/etc/mailcap}:

\begin{verbatim}
audio/midi;/usr/bin/timidity %s
audio/*; xmms %s
video/*; xine -pfhq %s
\end{verbatim}

Please read \package{hyperref}'s documentation for further examples
and possibilities.

% -----

% INSERT/COMMENT

\subsection{\entry{Insert}{Comment}}

This is done inserting \% before each line, or by using the package
\package{comment} that provides the environment of the same name.

% -----

% FORMAT

\section{The \menu{Format} Menu}

In general, the main format properties of a document are set with
parame\-ters in \cmd{document\-class}: default font size (10, 11, or
12pt), paper (\texttt{a4paper}, \texttt{a5paper}, \texttt{b5paper},
\texttt{letterpaper}, \texttt{legalpaper}, \texttt{executivepaper}),
and orientation (\texttt{portrait}, \texttt{landscape}). For example, 

\begin{Verbatim}[fontsize=\small]
\documentclass[a5paper,landscape,12pt]{article}
\end{Verbatim}

Alternative font sizes can be specified as explained in
Section~\ref{sec:extsizes}.

% -----

% FORMAT/LINE SPACING

\subsection{\entry{Format}{Line Spacing}}

The package \package{setspace} provide the environments
\env{singlespace}, \env{onehalfspace}, and \env{double\-space}. In
addition, the environment/command \cmd{spacing}\cmdparm{\{amount\}}
will set the spacing to the specified amount:

\begin{example}
\begin{spacing}{2.5}
These two lines \\
are crazily spaced!
\end{spacing}
\begin{spacing}{1}
Much better, these lines\\
have a pretty space.
\end{spacing}
\end{example}

To apply line spacing to the whole document, use the
\cmd{linespread\{factor\}} command in the preamble. Default value of
\texttt{factor} is 1; larger values give larger line spacing (1.6 is
roughly double line spacing).

% -----

% FORMAT/CHARACTER

\subsection{\entry{Format}{Character}}

Standard character properties are listed in
Table~\ref{tab:properties}, font sizes in Table~\ref{tab:font_sizes}.

\begin{table}[htbp]
\begin{center}
\begin{tabular}{lll} \hline
\textbf{Text attribute} & \textbf{Environment form} & \textbf{Example} \\
\hline
\cmd{textnormal} & \verb|textnormal| & main document font \\
\cmd{textrm} & \verb|rmfamily| & \textrm{roman} \\
\cmd{textit} & \verb|itshape| & \textit{italics} \\
\cmd{emph} & n/a & \emph{emphasis} \\
\cmd{textmd} & \verb|mdseries| & \textmd{medium weight (default)} \\
\cmd{textbf} & \verb|bfseries| & \textbf{boldface} \\
\cmd{textup} & \verb|upshape| & \textup{upright (default)} \\
\cmd{textsl} & \verb|slshape| & \textsl{slanted} \\
\cmd{textsf} & \verb|sffamily| & \textsf{sans serif} \\
\cmd{textsc} & \verb|scshape| & \textsc{small caps} \\
\cmd{texttt} & \verb|ttfamily| & \texttt{typewriter} \\
\cmd{underline} & \verb|underline| & \underline{underline} \\
\cmd{textsuperscript} & n/a & this is \textsuperscript{superscript} \\
\cmd{mathrm} & n/a & $\mathrm{x^n + y^n \neq z^n \forall n \neq 2}$ \\
\cmd{mathbf} & n/a & $\mathbf{x^n + y^n \neq z^n \forall n \neq 2}$ \\
\cmd{mathsf} & n/a & $\mathsf{x^n + y^n \neq z^n \forall n \neq 2}$ \\
\cmd{mathtt} & n/a & $\mathtt{x^n + y^n \neq z^n \forall n \neq 2}$ \\
\cmd{mathit} & n/a & $\mathit{x^n + y^n \neq z^n \forall n \neq 2}$ \\
\cmd{mathnormal} & n/a & $\mathnormal{x^n + y^n \neq z^n \forall n \neq 2}$ \\
\cmd{mathcal} & n/a & $\mathcal{x^n + y^n \neq z^n \forall n \neq 2}$ \\
\hline
\end{tabular}
\caption{Font attributes.}
\label{tab:properties}
\end{center}
\end{table}

Please note the difference between italics and emphasised text.
\textit{For example, this portion of text is typeset in italics, and
\emph{these words} are emphasised in upright}. As you can see,
\cmd{emph} is a \emph{logical} rather than typographic command.

Also, please note that underscript is normally used in math mode only.
The trick to use it in normal text is:

\begin{example}
this is 
$_{\mbox{\footnotesize{subscript}}}$
\end{example}

\begin{table}[ht]
\begin{center}
\begin{tabular}{ll} \hline
\textbf{Font size} & \textbf{Example} \\
\hline
\verb|tiny| & \tiny{sample text} \\
\verb|scriptsize| & \scriptsize{sample text} \\
\verb|footnotesize| & \footnotesize{sample text} \\
\verb|small| & \small{sample text} \\
\verb|normalsize| & \normalsize{sample text} \\
\verb|large| & \large{sample text} \\
\verb|Large| & \Large{sample text} \\
\verb|LARGE| & \LARGE{sample text} \\
\verb|huge| & \huge{sample text} \\
\verb|Huge| & \Huge{sample text} \\
\hline
\end{tabular}
\caption{Font sizes}
\label{tab:font_sizes}
\end{center}
\end{table}

% -----

\subsubsection{Underline styles}

Normally, \uline{underline} is not used. It's just a relic of the old
teletype era, and it doesn't look really good. If you still want to
use underline, the \package{ulem} package provides some fancy styles:

\begin{example}
\uline{important}
\uuline{urgent}
\uwave{boat}
\sout{wrong}
\xout{removed}
\end{example}

Beware: \package{ulem} redefines the \cmd{emph} command, which will be
replaced by underline. To avoid this behaviour, use this declaration:

\begin{verbatim}
\usepackage[normalem]{ulem}
\end{verbatim}


% -----

% FORMAT/CHARACTER SIZE

\subsubsection{\entry{Format}{Character Size}}
\label{sec:extsizes}

If the standard font sizes aren't enough for you, the package
\package{extsizes} may be handy. It provides `extended' versions of
the standard document classes, with support for sizes 8--12, 14, 17,
and 20 pt.

For example, let's suppose you want to typeset an article using a 17
pt font. You'll use this document preamble:

\begin{Verbatim}[fontsize=\small]
\documentclass[17pt]{extarticle}
\end{Verbatim}

Another way to get big fonts is to use the package \package{type1cm},
which provides commands like the following:

\begin{Verbatim}[fontsize=\small]
\fontsize{72pt}{72pt}\selectfont
No Smoking
\end{Verbatim}

(The example above is way too large to fit on this page{\ldots})

Parameters are font size and baseline. Yet another approach is this:

\begin{example}
\resizebox{!}{1cm}{1-cm tall}
\end{example}

% -----

% FORMAT/FONT

\subsubsection{\entry{Format}{Character Font}}

\LaTeX{} uses its own fonts, automatically generated when needed by
the \MF{} subsystem. This ensures portability and yields very good
results. However, many of us are accustomed to other fonts: Times,
Helvetica, Sans Serif{\ldots}

Fortunately, \LaTeX{} can use \PS{} fonts. Try using one of the
following packages: \package{avant}, \package{avangar},
\package{bookman}, \package{chancery}, \package{charter},
\package{courier}, \package{helvet}, \package{helvetic},
\package{ncntrsbk}, \package{newcent}, \package{palatcm},
\package{palatino}, \package{pifont}, \package{times},
\package{utopia}, \package{zapfchan}. Insert \verb|\usepackage{times}|
and enjoy the results. The only caveat is that \LaTeX{} handles maths
at its best only with Computer Modern fonts: using \PS{} fonts might
render your formulas slightly less appealing.

The packages above set the font for the whole document. To use a \PS{}
font for a region of text only, specify the font family as in the
example below. Common font families are listed in
Table~\ref{tab:font_families}. 

\begin{warn}
  Beware, some font shapes may be unavailable on some systems!
\end{warn}

\begin{example}
This is Computer Modern Roman,
{\fontfamily{phv}\selectfont
this is Helvetica!}
\end{example}

\begin{table}
\begin{center}
  \begin{tabular}{ll}
  \hline
  \textmd{Family} & \textmd{Name}\\
  \hline
  \texttt{cmr} & Computer Modern Roman\\
  \texttt{cmss} &
  {\fontfamily{cmss}\selectfont Computer Modern Sans Serif}\\
  \texttt{cmtt} &
  {\fontfamily{cmtt}\selectfont Computer Modern Typewriter}\\
  \texttt{pag} &
  {\fontfamily{pag}\selectfont Avantgarde}\\
  \texttt{pbk} &
  {\fontfamily{pbk}\selectfont Bookman}\\
  \texttt{phv} &
  {\fontfamily{phv}\selectfont Helvetica}\\
  \texttt{pnc} &
  {\fontfamily{pnc}\selectfont New Century Schoolbook}\\
  \texttt{ppl} &
  {\fontfamily{ppl}\selectfont Palatino}\\
  \texttt{ptm} &
  {\fontfamily{ptm}\selectfont Times}\\
  \texttt{pcr} &
  {\fontfamily{pcr}\selectfont Courier}\\
  \hline
  \end{tabular}
  \caption{Common font families.}
  \label{tab:font_families}
\end{center}
\end{table}

\medskip

Yet another possibility is replacing a standard \LaTeX{} font with a
\PS{} one: for example, you may want to use Avantgarde whenever
Computer Modern Sans Serif would appear. These commands can be renewed
as in the example below:

\begin{itemize}

  \item \verb|\rmdefault| (roman)
  \item \verb|\sfdefault| (sans serif)
  \item \verb|\ttdefault| (typewriter)
  \item \verb|\bfdefault| (boldface)
  \item \verb|\mddefault| (medium)
  \item \verb|\itdefault| (italics)
  \item \verb|\sldefault| (slanted)
  \item \verb|\scdefault| (small caps)
  \item \verb|\updefault| (upright)

\end{itemize}

\begin{Verbatim}[fontsize=\small]
 % Avantgarde replaces sans serif
\renewcommand{\sfdefault}{pag}
\end{Verbatim}

% -----

% FORMAT/COLOUR

\subsubsection{\entry{Format}{Character Colour}}
\label{sec:charcol}

You can colour words using the package \package{color} and appropriate
commands. Predefined colours are black, white, red, green, blue, cyan,
magenta, and yellow; you can also define your own.

\begin{example}
\textcolor{red}{This is red.}\\
\color{blue}
This text is blue!\\
So is this. Let's change.\\
\definecolor{mygreen}
{rgb}{0.1,1,0.1}
\color{mygreen}
This is my shade of green!\\
\color{black}
\colorbox{cyan}{A cyan box}\\
\fcolorbox{blue}{green}
{A green box in a blue frame}
\end{example}

Moreover, the command \cmd{pagecolor} lets you specify{\ldots} guess
what?

% -----

% FORMAT/PARAGRAPH

\subsection{\entry{Format}{Paragraph}}

Let's remind what a paragraph is according to \LaTeX{}: a portion of
text that either ends with \verb|\\|, or is followed by a blank line.

\emph{Environments} are \LaTeX{}'s way of specifying properties like
text alignment or font selection for a given portion of text. It's
like selecting text with the mouse, then choosing the property you
wish from a menu or clicking on a button. Another way is to enclose
the text between brackets.

Environments have this general form:

\begin{Verbatim}[fontsize=\small]
\begin{environment}
...text goes here...
\end{environment}
\end{Verbatim}

For example, if you want to center a paragraph you'll use the
\env{center} environment:

\begin{example}
\begin{center}
this text is centered
\end{center}
\end{example}

Standard environments are listed in Table~\ref{tab:environments}. In the
following sections, I'll show you what to use and when.

\begin{table}[p]
\begin{center}
\begin{tabular}{ll} \hline
\textbf{Environment} & \textbf{Purpose} \\
\hline
\verb|array| & Math arrays \\
\verb|center| & Centered lines \\
\verb|description| & Labelled lists \\
\verb|enumerate| & Numbered lists \\
\verb|eqnarray| & Sequence of aligned equations \\
\verb|equation| & Displayed equation \\
\verb|figure| & Floating figures \\
\verb|flushleft| & Flushed left lines \\
\verb|flushright| & Flushed right lines \\
\verb|itemize| & Bulleted lists \\
\verb|letter| & Letters \\
\verb|list| & Generic list environment \\
\verb|minipage| & Miniature page \\
\verb|picture| & Picture with text, arrows, lines and circles \\
\verb|quotation| & Indented environment with paragraph indentation \\
\verb|quote| & Indented environment with no paragraph indentation \\
\verb|tabbing| & Align text arbitrarily \\
\verb|table| & Floating tables \\
\verb|tabular| & Align text in columns \\
\verb|thebibliography| & Bibliography or reference list \\
\verb|theorem| & Theorems, lemmas, etc \\
\verb|titlepage| & For hand crafted title pages \\
\verb|verbatim| & Simulating typed input \\
\verb|verse| & For poetry and other things \\
\hline
\end{tabular}
\caption{Standard \LaTeX{} environments.}
\label{tab:environments}
\end{center}
\end{table}

% -----

% FORMAT/PARAGRAPH HORIZONTAL ALIGNMENT

\subsubsection{\entry{Format}{Paragraph Horizontal Alignment}}

By default, the text is justified. To get left--aligned,
right--aligned or centered text, use the \env{flushleft},
\env{flushright} and \env{center} environments. The commands
\cmd{raggedright}, \cmd{ragged\-left}, and \cmd{centering} are
equivalent to their correspondent environments, but they do not start
a new paragraph.

% -----

% FORMAT/PARAGRAPH VERTICAL ALIGNMENT

\subsubsection{\entry{Format}{Paragraph Vertical Alignment}}

The way paragraphs are separated is often puzzling to word processor
users.  \emph{Empty lines and multiple spaces are treated like a
single empty line or space}. The commands \cmd{smallskip},
\cmd{medskip}, and \cmd{bigskip} provide some space between
paragraphs.

If you need more space, use the command
\cmd{vskip}\{\textit{parameter}\} as in this example:

% \begin{margins}{-1cm}{-0.5cm}
\begin{example}
These paragraphs will be
separated by 1.3 cm:\\
\vskip 1.3cm
there is a 1.3 cm gap above me.
\end{example}

Note that \cmd{vskip} only works between paragraphs. What if you
wanted to start a page after an additional margin of, say, 1.5 cm?
You'll have to use \cmd{null}, which sets a `mark' in the text:

\begin{example}
\null
\vskip 1.3 cm
This text comes after 1.3 cm...
\end{example}

Finally, the command \cmd{vfill} is used to add empty lines between
two paragraphs so that the second paragraph goes exactly to the bottom
of the page. For example, 

% \begin{example} will not work here
\medskip

\begin{minipage}[c]{0.49\textwidth}
  \begin{Verbatim}[fontsize=\small]
  This appears at the top of 
  the page{\ldots}
  \vfill
  {\ldots}and this at the bottom.
  \end{Verbatim}
\end{minipage}
\begin{boxedminipage}[c]{0.49\textwidth}
  This appears at the top of
  the page{\ldots}
  \vskip 1.3 cm
  {\ldots}and this at the bottom.
\end{boxedminipage}

% -----

% FORMAT/PARAGRAPH MARGINS

\subsubsection{\entry{Format}{Paragraph Margins}}

Normally, the margins are set for the whole document as seen in
Section~\ref{sec:pagesetup}. Redefining them for a section of text
will not work: if you want to set a paragraph's margins, you'll have
to create a new environment like in the following example:

\begin{Verbatim}[fontsize=\small]
\newenvironment{margins}[2]
{ 
  \begin{list}{} {
    \setlength{\leftmargin}{#1}
    \setlength{\rightmargin}{#2}
  } \item }
{\end{list}}
\end{Verbatim}

Then you will use the new environment:

\begin{example}
As you can see, this paragraph
has normal margins.
\begin{margins}{0.5cm}{1cm}
 But please note that this
 paragraph has custom margins. 
\end{margins}
\end{example}

% -----

% FORMAT/PARAGRAPH INDENTATION

\subsubsection{\entry{Format}{Paragraph Indentation}}

To set the amount of indentation of the first line of a paragraph, use
the command \cmd{parindent}. In the following example, we set a 1-cm
indentation:

\begin{Verbatim}[fontsize=\small]
\setlength{\parindent}{1cm}
\end{Verbatim}

The commands \cmd{indent} and \cmd{noindent} allow/disallow
indentation on the following paragraph. Finally, the distance between
paragraphs is set by \cmd{parskip}:

\begin{Verbatim}[fontsize=\small]
\setlength{\parskip}{3pt}
\end{Verbatim}

% -----

% FORMAT/BORDER

\subsection{\entry{Format}{Paragraph Border and Shade}}

To get framed (bordered) paragraphs or words, you have the choice of
using the \package{framed} package or the \cmd{parbox} command. The
package \package{calc} is required in the latter case.

This is the simplest method, using \package{framed}:

% \begin{example} will not work here
\medskip

\begin{minipage}[c]{0.5\textwidth}
  \begin{Verbatim}[fontsize=\small]
  \setlength{\FrameRule}{2pt}
  \setlength{\FrameSep}{5pt}
  \begin{framed}
    this is a framed paragraph!
  \end{framed}
  \definecolor{shadecolor}{rgb}
  {0.9,0.8,1}
  \begin{shaded}
    this is a shaded paragraph,
    do you like it?
  \end{shaded}
  \end{Verbatim}
\end{minipage}%
\begin{minipage}[c]{0.5\textwidth}
\setlength{\FrameRule}{2pt}
\setlength{\FrameSep}{5pt}
\begin{framed}
  this is a framed paragraph!
\end{framed}
\definecolor{shadecolor}{rgb}
  {0.9,1,1}
  \begin{shaded}
    this is a shaded paragraph,
    do you like it?
  \end{shaded}
\end{minipage}

\medskip

Equivalently, use the \package{boxedminipage} package and the equally
named environment. For those who want to know more: the commands

\begin{Verbatim}[fontsize=\small]
\framebox{
  \begin{minipage}[c]{\linewidth}
  text to be framed
  \end{minipage}
}
\end{Verbatim}

are functionally equivalent to the \env{boxedminipage} environment.

This example uses \cmd{parbox}:

\begin{example}
\noindent
\fbox{
  \parbox{\linewidth 
    -2 \fboxsep -2 \fboxrule}
  {again, a framed paragraph!}
}
\end{example}

\cmd{linewidth} sets the width of the minipage equal to that of the
remaining text. Obviously, you can specify the width as you like.

Finally, to frame something adapting the frame to the width of the text:

\begin{example}
this is a 
\framebox[\width]{framed}
word
\end{example}

Modifying the parameter, you can adjust the frame width:

\begin{example}
this is another
\framebox[2\width][r]{framed}
word
\end{example}

Note that the second optional parameter specifies the alignment (to
the right in this example).

% -----

% FORMAT/COLOUR

\subsection{\entry{Format}{Colour}}

Now that you have a bordered paragraph, you'll want to set its colour
too. Do this:

\begin{example}
\colorbox{yellow}{
  \begin{minipage}
  {0.8\linewidth}
  I am a minipage, my colour
  is yellow!
  \end{minipage}
}
\end{example}

More about colours in Section~\ref{sec:charcol}.

% -----

% FORMAT/COLUMNS

\subsection{\entry{Format}{Columns}}

The commands \cmd{twocolumn} and \cmd{onecolumn} start a new page and
set the number of columns; they can also be used as parameters in
\cmd{documentclass}. If this is not enough for you, the package 
\package{multicols} provides an environment of the same name. I could
have set this section in two columns with these commands:

\begin{Verbatim}[fontsize=\small]
\columnseprule=1pt
\begin{multicols}{2}[\subsection{\entry{Format}{Columns}}]
The commands \cmd{twocolumn} ...
\end{multicols}
\end{Verbatim}

The space between columns is controlled by the parameter
\cmd{columnsep}, and the thickness of the rule between columns by
\cmd{columnseprule}. The text given as optional parameter in brackets
is excluded from the environment.

% -----

% TABLE

\section{The \menu{Table} Menu}

Quite a complex subject{\ldots} A \emph{table} is a float (as
explained in Section~\ref{sec:figure}) that must fit on one page. It
usually contains a \env{tabular} environment, even though other
possibilities exist. By default, a table adjusts its width to match
the width of its contents.

This is the general format of a table:

\begin{Verbatim}[fontsize=\footnotesize]
\begin{table}[htbp] % placement: here, top, bottom, separate page
% \begin{small}     % sets the table font
\begin{center}      % optional
% 4-column table; alignment is left, centered, right, fixed width
\begin{tabular}{|l|c|rp{4cm}|} 
\hline              % horizontal line
\textbf{Left} & \textbf{Centre} & \textbf{Right} & \textbf{4 cm} \\
\hline
row 1, col 1 & row 1, col 2 & row 1, col 3 & row 1, col 4 \\
\cline{1-2}         % horizontal line spanning columns 1-2
row 2, col 1 & row 2, col 2 & row 2, col 3 & row 2, col 4 \\
\cline{1-2}
\multicolumn{2}{|c|}{spanning two columns} & row 3, col 3 & 
row 3, col 4 \\
\cline{1-3}
row 4, col 1 & row 4, col 2 & row 4, col 3 & ~ \hfill right \\
% force a space with "\ "
row 5, col 1 & row 5, col 2 & row 5, col 3 & left \hfill ~ \\
row 5, col 1 & row 5, col 2 & row 5, col 3 & 
~ \hfill centre \hfill ~ \\
\hline
\end{tabular}
\caption{A sample table.}
% labels are used for cross references;
% for example, "see Table~\ref{tab:sampletab}"
\label{tab:sampletab}
\end{center}
% \end{small}
\end{table}
\end{Verbatim}

Table~\ref{tab:sampletab} shows the result.

\begin{table}[htbp] % placement: here, top, bottom, separate page
% \begin{tiny}
\begin{center}      % optional
% 4-column table; alignment is left, centered, right, fixed width
\begin{tabular}{|l|c|rp{4cm}|} 
\hline              % horizontal line
\textbf{Left} & \textbf{Centre} & \textbf{Right} & \textbf{4 cm} \\
\hline
row 1, col 1 & row 1, col 2 & row 1, col 3 & row 1, col 4 \\
\cline{1-2}         % horizontal line spanning columns 1-2
row 2, col 1 & row 2, col 2 & row 2, col 3 & row 2, col 4 \\
\cline{1-2}
\multicolumn{2}{|c|}{spanning two columns} & row 3, col 3 & 
row 3, col 4 \\
\cline{1-3}
row 4, col 1 & row 4, col 2 & row 4, col 3 & ~ \hfill right \\
% force a space with "\ "
row 5, col 1 & row 5, col 2 & row 5, col 3 & left \hfill ~ \\
row 5, col 1 & row 5, col 2 & row 5, col 3 & 
~ \hfill centre \hfill ~ \\
\hline
\end{tabular}
\caption{A sample table.}
% labels are used for cross references;
% for example, "see Table~\ref{tab:sampletab}"
\label{tab:sampletab}
\end{center}
% \end{small}
\end{table}

Sometimes, a table is too wide and won't fit on the page. In that
case, the \package{rotating} package provides the new environment
\env{sidewaystable}. Also, \package{rotating} makes it possible to
rotate the contents of a cell by a specified angle. Finally, the
\package{tabularx} package lets one specify tables of fixed width: the
\texttt{X} column specifier indicates that a column can be spread as
needed.

Here's an example:

% \begin{example} will not work here
\medskip

\begin{minipage}[c]{0.6\textwidth}
  \begin{Verbatim}[fontsize=\small]
  \begin{sidewaystable}
    \begin{tabularx}{7.5cm}{|l|X|X|}
      \hline
      \textbf{normal} & \textbf{tilted} & 
      \textbf{wider} \\
      \hline
      normal & \rotatebox{30}{I'm tilted!} & 
      I'm wider \\
      \hline
    \end{tabularx}
  \end{sidewaystable}
\end{Verbatim}
\end{minipage}%
\begin{minipage}[c]{0.4\textwidth}
% here we cheat. Tabularx won't work inside a minipage,
% so let's load the picture.
\ifpdf
  \includegraphics[width=0.9\textwidth]{tbx.pdf}
\else
  \includegraphics[width=0.9\textwidth]{tbx.eps}
\fi

\end{minipage}

\medskip

The \note standard \env{tabular} environment cannot span more than one
page! There are some packages that overcome this limitation: you will
want to try out \package{longtable}, \package{supertabular}, and
\package{xtab}.

To enable colours in tables, you use the \package{colortbl} package:

\begin{example}
Colour by row:\\\vskip 2mm
\begin{tabular}{|l|c|r|}
  \hline
  \rowcolor{cyan}
  one & two & three\\
  \rowcolor{green}
  one & two & three\\
  \rowcolor{yellow}
  one & two & three\\
  \hline
\end{tabular}
\end{example}

\begin{example}
Colour by column:\\\vskip 2mm
\begin{tabular}
  {|>{\columncolor{cyan}}l|
  >{\color{red}
  \columncolor{green}}c|
  >{\columncolor{yellow}}r|}
  \hline
  one & two & three\\
  one & two & three\\
  one & two & three\\
  \hline
\end{tabular}
\end{example}

To conclude the subject, a neat little trick. If you think that
writing \LaTeX{} tables is too complicated, you could be relieved by
OpenOffice Calc and Calc2LaTeX. The former is the well-known free
spreadsheet, while the latter is a plugin that that lets you turn a
cell range into a \LaTeX{} table. Links:
\url{http://www.openoffice.org/}, 
\url{http://calc2latex.sourceforge.net/}.


% -----

\subsection{Line Spacing}

A line adjusts itself to the height of the text it contains. To add
some space \emph{before} a line, the trick is to start it with a
\texttt{\textbackslash{}rule} of 0 length and specified height. To add
space \emph{after} a line, use
\texttt{\textbackslash{}\textbackslash{}} followed by optional space.
Here is an example:

\begin{example}
\begin{tabular}{lll}
one & two & three\\
0.3 centimeters & \textbf{after} &
  this line\\[0.3cm]
one & two & three\\
one & two & three\\
\rule{0pt}{1.2cm}1.2 centimeters &
  \textbf{before} & this line\\
\end{tabular}
\end{example}

% -----

\subsection{Rule Width}

% TO DO: \setlength{\arrayrulewidth}{<width>}

\begin{example}
\begin{tabular}{|lll|}
\hline
%\setlength{\arrayrulewidth}{5pt}
one & two & three\\
\hline
four & five & six\\
%\setlength{\arrayrulewidth}{1pt}
\hline
\end{tabular}
\end{example}

% -----

\subsection{Aligning Numbers}

A special case of a tabular environment is when we want to align
numbers with respect to the decimal positions. 

The simplest method is using the \texttt{@} column specifier, which in
practice is useful in tables containing only numbers. The column
separator \texttt{\&} is replaced by the decimal dot:

\begin{example}
\begin{tabular}{r@{.}l}
 3&14159\\
 1&61803\\
 1&41421\\
 100&00000
\end{tabular}
\end{example}

Alternatively, use the \package{dcolumn} package, which adds the
\texttt{D} column specifier. \texttt{D} has three arguments: the
separator to use in the \LaTeX{} source and in output (usually the
same, `.'), and the number of digits to the right of the decimal place
indicator. Optionally, the third argument can specify the number of
digits to the left and to the right of the decimal place indicator,
separated by a dot. Lastly, if the third argument is -1, the material
of the column is centered around the separator.

All material in the table is typeset in math mode. To insert headings,
you'll have to put the text in an \cmd{mbox}.

% \begin{example} will not work here
\medskip

\begin{minipage}[c]{0.5\textwidth}
  \begin{Verbatim}[fontsize=\small]
  \begin{tabular}{|D{.}{,}{4.2}|%
  D{.}{.}{5}|D{.}{.}{-1}|}
  \hline
  \mbox{One} & \mbox{Two} &
  \mbox{Three} \\
  10.33 & 10.33 & 10.33 \\
  1000 & 1000 & 1000 \\
  5.1 & 5.1 & 5.1 \\
  3.14 & 3.14159 & 3.14159 \\
  \hline
  \end{tabular}
  \end{Verbatim}
\end{minipage}%
\begin{minipage}[c]{0.5\textwidth}
\begin{tabular}{|D{.}{,}{4.2}|%
D{.}{.}{5}|D{.}{.}{-1}|}
\hline
\mbox{One} & \mbox{Two} &
\mbox{Three} \\
10.33 & 10.33 & 10.33 \\
1000 & 1000 & 1000 \\
5.1 & 5.1 & 5.1 \\
3.14 & 3.14159 & 3.14159 \\
\hline
\end{tabular}
\end{minipage}

% -----

\subsection{Using \package{slashbox}}

This package add the \cmd{backslashbox} command:

\medskip

\begin{minipage}[c]{0.5\textwidth}
  \begin{Verbatim}[fontsize=\small]
\begin{tabular}{|l|l|l|}
  \hline
  \backslashbox[2cm]{Lesson}{Date} & 
  Monday & Tuesday \\
  \hline
  Stratigraphy & room A & room A \\
  Chemistry & room B & Lab $\alpha$ \\
  Physics & room C & Lab $\beta$ \\
  \hline
\end{tabular}
\end{Verbatim}
\end{minipage}%
\begin{minipage}[c]{0.5\textwidth}
\begin{tabular}{|l|l|l|}
  \hline
  \backslashbox[2cm]{Lesson}{Date} & 
  Monday & Tuesday \\
  \hline
  Stratigraphy & room A & room A \\
  Chemistry & room B & Lab $\alpha$ \\
  Physics & room C & Lab $\beta$ \\
  \hline
\end{tabular}
\end{minipage}

\medskip

% \emph{TODO: mention \cmd{newcolumntype} and \package{floatflt}}

% -----

\subsection{Importing Data in \LaTeX{} Tables}

For many people, data files are the bread and butter of everyday's
work. Most data files are simply ASCII text with columns of numbers,
but some people use spreadsheets. Nearly all spreadsheet applications
can export sheets in the ASCII-based \file{.cvf} file format; values
are separated by the `;' character.

Converting a data file into a \LaTeX{} table is quite a tedious
process. The following script for \unix{} will convert a datafile with
an arbitrary number of columns to a table. It will also work on
\file{.cvf} files.

\begin{Verbatim}[fontsize=\small]  
#!/bin/sh

# dat2tex: converts tabular data to a tabular environment

if [ $# != 1 ]; then
  echo "Usage: $0 <datafile>"
  exit 1
fi

# is this a cvs file?
grep ";" $1 > /dev/null
if [ $? = 0 ]; then
  AWK="awk -F;"
else
  AWK=awk
fi

# ok awk, make my day
$AWK '{if (1 == FNR) { \
        printf "\\begin\{tabular\}\{"; \
        for (i = 1; i <= NF; i++) {printf "l"}; \
        printf "\}\n"
      }
      for (i = 1; i < NF; i++) \
        {printf $i" & "} printf $NF" \\\\ \n"} \
      END {printf "\\end\{tabular\}\n"}' $1

# end of dat2tex
\end{Verbatim}

% -----

% TOOLS

\section{The \menu{Tools} Menu}

% -----

% TOOLS/MAIL MERGES

\subsection{\entry{Tools}{Mail Merges}}

This useful and time-saving tool is implemented in \LaTeX{} by the
\package{textmerg} package. Let's consider a simple document, in which
the name, surname, and title of people we're writing to may vary. The
remaining text does not change.

We'll define three \emph{fields}, which are the variable part of the
text: \cmd{Name}, \cmd{Surname}, and \cmd{Title}. Their values will be
gathered from an external file, \file{data.dat}.

\begin{Verbatim}[fontsize=\small]
\documentclass{article}
\usepackage{textmerg}
\begin{document}
% let's declare the variable fields:
% \Void is for empty lines
\Fields{\Name\Surname\Title-\Void}
\Merge{data.dat}{%
Dear \Title{} \Surname,\\
may I call you \Name?\\
Yours,\\
\hspace{3cm}Guido\clearpage}
\end{document}
\end{Verbatim}

The fourth field, \cmd{Void}, isn't really necessary and it's there
for illustration. It's preceded by a minus sign, which indicates that
it can be empty in the data file. Simply put, we want to separate the
records using empty lines.

The file \file{data.dat} reads:

\begin{Verbatim}[fontsize=\small]
Guido
Gonzato
Dr.

Francesco
Mulargia
Prof.

Marie
Curie
Mme

\end{Verbatim}

That's it: the resulting output will contain the merged text, one page
for each recipient.

% -----

% TOOLS/LABELS

\subsection{\entry{Tools}{Labels}}

If making mail merges was easy, making labels is even trivial. Let's
suppose you want to make 20 equal labels on a 3$\times$8 peel--off
label sheet. The package to use, predictably, is called
\package{labels}. In this example, we'll make 10 plain labels and 10
boxed labels:

\begin{Verbatim}[fontsize=\small]
\documentclass[a4paper,12pt]{article}
\usepackage{labels}
\LabelCols=3      % n. of columns of labels
\LabelRows=8      % n. of rows of labels
\LeftBorder=8mm   % borders of each label
\RightBorder=8mm
\TopBorder=5mm
\BottomBorder=5mm
\LabelGridtrue      % show the grid
\numberoflabels=10  % number of labels of each type to print
% the text of the label is specified by
% the \addresslabel[]{} macro:
\begin{document}
  \addresslabel[\large] % optional arguments
  {\textbf{Guido Gonzato}, Ph.D.\\
  \textsl{Linux system manager}}
  % now on to the boxed labels
  \boxedaddresslabel[\fboxsep=4mm\fboxrule=1mm]
  {\textbf{Guido Gonzato}, Ph.D.\\
  \textsl{Linux system manager}}
\end{document}
\end{Verbatim}

% You'll also have to choose the correct paper size and adjust the page
% margins (use \package{geometry}; omitted in this example).

To make labels containing different addresses, you may use either an
external file or insert the addresses in the main file:

\begin{Verbatim}[fontsize=\small]
\documentclass[a4paper,12pt]{article}
\usepackage{labels}
\LabelCols=3
\LabelRows=8
\LeftBorder=3mm
\RightBorder=3mm
\TopBorder=8mm
\BottomBorder=8mm
\LabelGridtrue
\begin{document}
% use either this environment:
\begin{labels}
  1$^{st}$ name
  1$^{st}$ address
  1$^{st}$ city, state, zipcode

  2$^{nd}$ name
  2$^{nd}$ address
  2$^{nd}$ city, state, zipcode

  3$^{rd}$ name
  3$^{rd}$ address
  3$^{rd}$ city, state, zipcode
\end{labels}
% or an external file containing exactly the same text:
% \labelfile{addresses.dat}
\end{document}
\end{Verbatim}

It is left to you to combine \package{textmerg} and \package{labels}!

% -----

% TOOLS/LANGUAGE

\subsection{\entry{Tools}{Default Language}}

\LaTeX{} default language is English, but other languages are
supported. By language support I mean the translation of terms like
`Chapter' or `Index', correct hyphenation, and the possibility of
inserting characters like `\c c' or `\'e' directly via your keyboard.
(The normal way being typing \texttt{\bs{}c c} and \texttt{\bs{}'e}.)

Your \LaTeX{} distribution contains a file called \file{language.dat}
(usually \path{$TEXMF/tex/generic/config/language.dat} that contains a
list of languages. Editing this file you choose the languages for
which you want hyphenation patterns.

If you are not a native English speaker, you'll want to use the
package \package{babel} as in the following example:

\begin{Verbatim}[fontsize=\small]
\usepackage[italian,english]{babel}
\end{Verbatim}

\begin{warn}
  \package{babel} alters the way some characters behave in a
  language-dependent way. If you experience odd problems, insert the
  offending characters using the \cmd{charXX} syntax.
\end{warn}

In addition, to type accented letters and in general non-standard
ASCII characters\footnote{in computer jargon, `standard ASCII
characters' are the characters whose code is included between 32
(space) and 126 (tilde).} you may want to use the package
\package{isolatin1}. However, this is not a recommended practice,
because it reduces the legibility and portability of your file: you
had better stick to the \TeX{} way.

If you just can't stand typying all those three- or four-letter
clusters, then you could configure your editor to type those for you.
For example, I set up my editor of choice (\app{jed}) to have it
insert \texttt{\bs{}'e} whenever I type `\'e'. I included this in my
\file{.jedrc}:

{\small
\begin{alltt}
define latex_mode_hook ()
\{
  set_abbrev_mode (1);
  if ( () = abbrev_table_p ("LaTeX") )
    use_abbrev_table ("LaTeX");
#ifdef WIN32
  % prevent clash with movement keys
  undefinekey ("\`a\`a", "LaTeX-Mode");
  definekey (" \bs\bs`a", "\`a\`a", "LaTeX-Mode");
#else
  local_setkey (" \bs\bs`a",     "\`a");
#endif
  local_setkey (" \bs\bs'e",     "\'e");
  local_setkey (" \bs\bs`e",     "\`e");
  local_setkey (" \bs\bs`\bs\bs{}i\{\}", "\`\i");
  local_setkey (" \bs\bs`o",     "\`o");
  local_setkey (" \bs\bs`u",     "\`u");
\}
\end{alltt}
}

Please consult your editor's documentation.

% -----

% TOOLS/HYPHEN

\subsection{\entry{Tools}{Hyphenation}}

Although \LaTeX{} usually does a good job at hyphenating words,
sometimes manual intervention may yield better results. Manual hyphens
are specified inserting \verb|\-| where we want the word to be broken.
A better way is to declare hyphenation rules:

\begin{Verbatim}[fontsize=\small]
\hyphenation{ge-o-phy-sics ge-o-lo-gy earth}
\end{Verbatim}

The above declaration instructs \LaTeX{} not to hyphen the word
`earth'. Another way to prevent a word to be hyphenated is to put it
in \cmd{mbox}:

\begin{Verbatim}[fontsize=\small]
Do not hyphen \mbox{internationalisation}, please. I'm a masochistic.
\end{Verbatim}

% -----

% TOOLS/SPELL CHECK

\subsection{\entry{Tools}{Spell Check}}

\LaTeX{} is not aware of spell spelling. This task is done using
external tools like \app{ispell}, \app{aspell} or others. Under \unix,
you can use \app{ispell} this way:

\begin{Verbatim}[fontsize=\small]
shell> ispell -t mydocument.tex
\end{Verbatim}

The \texttt{-t} switch instructs \app{ispell} to ignore \TeX{} and
\LaTeX{} commands. If your language is not English, specify the
appropriate dictionary with the \texttt{-d} switch:

\begin{Verbatim}[fontsize=\small]
shell> ispell -d italiano -t mydocument.tex
\end{Verbatim}

% -----

% HELP

\section{The \menu{Help} Menu}

There are many ways of getting help with \LaTeX{}, both online and offline.
The best place to start is the CTAN site,
\url{http://www.ctan.org/tex-archive/info/}.

\begin{itemize}

  \item \verb|info latex| (\unix{} systems) gives a concise but very complete
    on-line summary of commands and concepts;
    
  \item \url{http://www.giss.nasa.gov/latex/} is a comprehensive on-line
    reference. Lots of useful links!
    
  \item \url{http://www.ctan.org/tex-archive/info/LatexHelpBook/} is a very
    nice help system for \LaTeX{}, fully integrated with Windows.
    
  \item don't forget the \url{news:comp.text.latex} newsgroup: it's an
  invaluable source of help.
  
\end{itemize}

As of 2010, most GNU/Linux distributions ship with \app{TeXLive},
probably the most complete \TeX/\LaTeX{} systems. A lot of
documentation is provided; on my Ubuntu machine, it's found in
\path{/usr/share/doc/texlive-doc/}.

% -----

\section{The End}

This document is copyleeft \textcopyright{} Guido Gonzato, 2001--2010,
and released under the GNU Free Documentation Licence. I really hope
you'll find this guide useful. For any suggestions or comments, please
feel free to contact me.

\newpage

% -----

\appendix

\section{Document Templates}
\label{ap:templates}

A template for the class \texttt{article} was presented in
Section~\ref{sec:filenew}. More examples are shown in the following
figures.

% -----

% BOOK

\begin{figure}[htbp]
\begin{Verbatim}[fontsize=\small]
\documentclass[twoside,11pt]{book}
\begin{document}
\frontmatter
\begin{titlepage}
\title{The Book of Mine}
\end{titlepage}
\author{John B. Smith}
\maketitle
\tableofcontents
\mainmatter
\part{The Beginning}
\chapter{Introduction}
\section{Let's Start}
The book starts here.
\part{The End}
\backmatter
Thank you for reading this book.
\end{document}
\end{Verbatim}
\caption{Book template.}
\end{figure}

% -----

% REPORT

\begin{figure}[htbp]
\begin{Verbatim}[fontsize=\small]
\documentclass[twoside,12pt]{report}
% tables and figures at the end:
\usepackage{endfloat}
\begin{document}
\title{Final Report}
\author{John B. Smith}
\date{London, \today}
\maketitle
\begin{abstract}
This is the final report.
\end{abstract}
\tableofcontents
\listoftables
\listoffigures
\part{Start}
\chapter{Begin}
\section{Introduction}
The report starts here.
\end{document}
\end{Verbatim}
\caption{Report template.}
\end{figure}

% -----

% LETTER

\begin{figure}[htbp]
\begin{Verbatim}[fontsize=\small]
\documentclass[12pt]{letter}
\begin{document}
\address{My address}
\signature{Guido}
\begin{letter}{John's address}
\opening{Dear John,}
Thank you for being my friend.
\closing{Hope to see you soon,}
\ps{P.S. Say hello to granny!}
\encl{My son's photographs!}
\end{letter}
\end{document}
\end{Verbatim}
\caption{Letter template.}
\end{figure}

% -----

% NOTICE

\begin{figure}[htbp]
\begin{Verbatim}[fontsize=\small]
\documentclass[a4paper]{article}
\usepackage{type1cm}
\usepackage{times}
\usepackage{color}
\usepackage{rotating}
\pagestyle{empty}
\begin{document}
\begin{sidewaysfigure}
  \fontsize{2.5cm}{2.5cm}\selectfont
  \centerline{\textcolor{blue}{\textbf{Please:}}}
  \vskip 1cm
  \fontsize{4cm}{3cm}\selectfont
  \centerline{\textcolor{red}{DO NOT}}
  \centerline{\textcolor{red}{SMOKE}}
  \centerline{\textcolor{red}{HERE!}}
  \vskip 1cm
  \fontsize{2cm}{2cm}\selectfont
  \centerline{\textcolor{magenta}{If you do,}}
  \centerline{\textcolor{magenta}{you'll be \emph{deboned!}}}
\end{sidewaysfigure}
\end{document}
\end{Verbatim}
\caption{How to write a notice.}
\end{figure}

% -----

% POSTER

\begin{figure}[htbp]
\begin{Verbatim}[fontsize=\small]
\documentclass{article}
\usepackage[absolute,showboxes]{textpos}
\usepackage{color}
\usepackage{framed}
\usepackage{graphicx}
\setlength{\TPHorizModule}{10mm} % standard unit of length
\setlength{\TPVertModule}{\TPHorizModule}
\setlength{\TPboxrulesize}{1pt}  % box line width
% start everything near the top-left corner
\textblockorigin{0mm}{0mm}

\begin{document}
\setlength{\parindent}{0pt}
\definecolor{shadecolor}{rgb}{0.9,1,1}
\begin{textblock}{5}(0,0)
% this block is 5 modules wide; height is
% automatically determined
\begin{center}
  \begin{minipage}[c]{0.8 \linewidth}
  \begin{shaded}
  This block is placed with its top left corner at the `origin'
  on the page, which has been set to (0mm,0mm). The internal
  margin and the shading are provided by the \texttt{minipage}
  and \texttt{shaded} environments.
  \end{shaded}
  \end{minipage}
\end{center}
\end{textblock}
\begin{textblock}{6}(10,1)
  \includegraphics[width=6cm,angle=-90]{gnuplot.ps}
  This picture is at (10,1). Note that rotating it
  by -90 makes it overflow the margin.
\end{textblock}
\begin{textblock}{5}[0.5,0.5](2.5,8)
This block is at position (2.5,8), but because the optional
argument [0.5,0.5] has been given, it is the centre of the block
which is located at that point, rather than the top-left corner.
\end{textblock}
\begin{textblock}{3,4}(6,4)
The dimensions of this block are 3$\times$4 cm.
Its origin is position (6,4) on the page. Note that the text
overflows the margin in some cases; you'll want to 
use the \texttt{minipage} environment to prevent that.
\end{textblock}
\end{document}
\end{Verbatim}
\caption{How to write a poster.}
\label{fig:poster}
\end{figure}

% -----

% The End

\end{document}