1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This document is an unofficial reference manual for LaTeX, a
document preparation system, version of October 2018.
This manual was originally translated from LATEX.HLP v1.0a in the
VMS Help Library. The pre-translation version was written by
George D. Greenwade of Sam Houston State University. The
LaTeX 2.09 version was written by Stephen Gilmore. The
LaTeX2e version was adapted from this by Torsten Martinsen. Karl
Berry made further updates and additions, and gratefully acknowledges
using Hypertext Help with LaTeX, by Sheldon Green, and
LaTeX Command Summary (for LaTeX 2.09) by
L. Botway and C. Biemesderfer (published by the TeX Users
Group as TeXniques number 10), as reference material. We also
gratefully acknowledge additional material appearing in
latex2e-reference by Martin Herbert Dietze. (From these references no
text was directly copied.)
Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013,
2014, 2015, 2016, 2017, 2018 Karl Berry.
Copyright 1988, 1994, 2007 Stephen Gilmore.
Copyright 1994, 1995, 1996 Torsten Martinsen.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the entire
resulting derived work is distributed under the terms of a permission
notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions. -->
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Environments (LaTeX2e unofficial reference manual (October 2018))</title>
<meta name="description" content="Environments (LaTeX2e unofficial reference manual (October 2018))">
<meta name="keywords" content="Environments (LaTeX2e unofficial reference manual (October 2018))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="latex2e_0.html#Top" rel="start" title="Top">
<link href="latex2e_30.html#Index" rel="index" title="Index">
<link href="latex2e_0.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="latex2e_0.html#Top" rel="up" title="Top">
<link href="latex2e_9.html#Line-breaking" rel="next" title="Line breaking">
<link href="latex2e_7.html#g_t_005cref" rel="prev" title="\ref">
<style type="text/css">
<!--
body {margin: 1em; margin-top: 0px; padding-top: 1px}
a.anchor {float: right}
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body id="top" lang="en">
<a name="Environments" class="anchor"></a>
<a name="Environments-1" class="anchor"></a>
<h2 class="chapter">Environments</h2>
<a name="index-environments" class="anchor"></a>
<a name="index-_005cbegin" class="anchor"></a>
<a name="index-_005cend" class="anchor"></a>
<p>LaTeX provides many environments for delimiting certain behavior.
An environment begins with <code>\begin</code> and ends with <code>\end</code>,
like this:
</p>
<div class="example">
<pre class="example">\begin{<var>environment-name</var>}
...
\end{<var>environment-name</var>}
</pre></div>
<p>The <var>environment-name</var> at the beginning must exactly match that at
the end. For instance, the input
<code>\begin{table*}...\end{table}</code> will cause an error like:
‘<samp>! LaTeX Error: \begin{table*} on input line 5 ended by
\end{table}.</samp>’
</p>
<a name="index-group_002c-and-environments" class="anchor"></a>
<p>Environments are executed within a group.
</p>
<hr>
<a name="abstract" class="anchor"></a>
<a name="abstract-1" class="anchor"></a>
<h3 class="section"><code>abstract</code></h3>
<a name="index-environment_002c-abstract" class="anchor"></a>
<a name="index-abstract-environment" class="anchor"></a>
<a name="index-abstracts" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{abstract}
...
\end{abstract}
</pre></div>
<p>Produce an abstract, possibly of multiple paragraphs. This environment
is only defined in the <code>article</code> and <code>report</code> document classes
(see <a href="latex2e_3.html#Document-classes">Document classes</a>).
</p>
<p>Using the example below in the <code>article</code> class produces a displayed
paragraph. Document class option <code>titlepage</code> causes the abstract
to be on a separate page (see <a href="latex2e_3.html#Document-class-options">Document class options</a>); this is the
default only in the <code>report</code> class.
</p>
<div class="example">
<pre class="example">\begin{abstract}
We compare all known accounts of the proposal made by Porter Alexander
to Robert E Lee at the Appomattox Court House that the army continue
in a guerrilla war, which Lee refused.
\end{abstract}
</pre></div>
<p>The next example produces a one column abstract in a two column document (for
a more flexible solution, use the package <samp>abstract</samp>).
</p>
<div class="example">
<pre class="example">\documentclass[twocolumn]{article}
...
\begin{document}
\title{Babe Ruth as Cultural Progenitor: a Atavistic Approach}
\author{Smith \\ Jones \\ Robinson\thanks{Railroad tracking grant.}}
\twocolumn[
\begin{@twocolumnfalse}
\maketitle
\begin{abstract}
Ruth was not just the Sultan of Swat, he was the entire swat
team.
\end{abstract}
\end{@twocolumnfalse}
]
{ % by-hand insert a footnote at page bottom
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\footnotetext[1]{Thanks for all the fish.}
}
</pre></div>
<hr>
<a name="array" class="anchor"></a>
<a name="array-1" class="anchor"></a>
<h3 class="section"><code>array</code></h3>
<a name="index-environment_002c-array" class="anchor"></a>
<a name="index-array-environment" class="anchor"></a>
<a name="index-arrays_002c-math" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{array}{<var>cols</var>}
<var>column 1 entry</var> &<var>column 2 entry</var> ... &<var>column n entry</var> \\
...
\end{array}
</pre></div>
<p>or:
</p>
<div class="example">
<pre class="example">\begin{array}[<var>pos</var>]{<var>cols</var>}
<var>column 1 entry</var> &<var>column 2 entry</var> ... &<var>column n entry</var> \\
...
\end{array}
</pre></div>
<p>Produce a mathematical array. This environment can only be used in math
mode, and normally appears within a displayed mathematics environment
such as <code>equation</code> (see <a href="#equation">equation</a>). Inside of each row the
column entries are separated by an ampersand, (<code>&</code>). Rows are
terminated with double-backslashes (see <a href="latex2e_9.html#g_t_005c_005c">\\</a>).
</p>
<p>This example shows a three by three array.
</p>
<div class="example">
<pre class="example">\begin{equation*}
\chi(x) =
\left| % vertical bar fence
\begin{array}{ccc}
x-a &-b &-c \\
-d &x-e &-f \\
-g &-h &x-i
\end{array}
\right|
\end{equation*}
</pre></div>
<p>The required argument <var>cols</var> describes the number of columns, their
alignment, and the formatting of the intercolumn regions. For instance,
<code>\begin{array}{rcl}...\end{array}</code> gives three columns: the
first flush right, the second centered, and the third flush left. See
<a href="#tabular">tabular</a> for the complete description of <var>cols</var> and of the
other common features of the two environments, including the optional
<var>pos</var> argument.
</p>
<p>There are two ways that <code>array</code> diverges from <code>tabular</code>. The
first is that <code>array</code> entries are typeset in math mode, in
textstyle (see <a href="latex2e_17.html#Modes">Modes</a>) except if the <var>cols</var> definition specifies
the column with <code>p{...}</code>, which causes the entry to be typeset in
text mode. The second is that, instead of <code>tabular</code>’s parameter
<code>\tabcolsep</code>, LaTeX’s intercolumn space in an <code>array</code> is
governed by
<a name="index-_005carraycolsep" class="anchor"></a>
<code>\arraycolsep</code>, which gives half the width between columns. The
default for this is ‘<samp>5pt</samp>’ so that between two columns comes
10pt of space.
</p>
<a name="index-package_002c-amsmath" class="anchor"></a>
<a name="index-amsmath-package" class="anchor"></a>
<p>To obtain arrays with braces the standard is to use the <samp>amsmath</samp>
package. It comes with environments <code>pmatrix</code> for an array
surrounded by parentheses <code>(...)</code>, <code>bmatrix</code> for an array
surrounded by square brackets <code>[...]</code>, <code>Bmatrix</code> for an
array surrounded by curly braces <code>{...}</code>, <code>vmatrix</code> for
an array surrounded by vertical bars <code>|...|</code>, and
<code>Vmatrix</code> for an array surrounded by double vertical
bars <code>||...||</code>, along with a number of other array constructs.
</p>
<a name="index-package_002c-amsmath-1" class="anchor"></a>
<a name="index-amsmath-package-1" class="anchor"></a>
<p>The next example uses the <samp>amsmath</samp> package.
</p>
<div class="example">
<pre class="example">\usepackage{amsmath} % in preamble
\begin{equation}
\begin{vmatrix}{cc} % array with vert lines
a &b \\
c &d
\end{vmatrix}=ad-bc
\end{equation}
</pre></div>
<a name="index-package_002c-array-_0028package_0029" class="anchor"></a>
<a name="index-array-_0028package_0029-package" class="anchor"></a>
<a name="index-package_002c-dcolumn" class="anchor"></a>
<a name="index-dcolumn-package" class="anchor"></a>
<p>There are many packages concerning arrays. The <samp>array</samp> package has
many useful extensions, including more column types. The <samp>dcolumn</samp>
package adds a column type to center on a decimal point. For both see
the documentation on CTAN.
</p>
<hr>
<a name="center" class="anchor"></a>
<a name="center-1" class="anchor"></a>
<h3 class="section"><code>center</code></h3>
<a name="index-environment_002c-center" class="anchor"></a>
<a name="index-center-environment" class="anchor"></a>
<a name="index-centering-text_002c-environment-for" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{center}
<var>line1</var> \\
<var>line2</var> \\
...
\end{center}
</pre></div>
<p>Create a new paragraph consisting of a sequence of lines that are
centered within the left and right margins. Use
double-backslash, <code>\\</code>, to get a line break (see <a href="latex2e_9.html#g_t_005c_005c">\\</a>).
<a name="index-_005c_005c-_0028for-center_0029" class="anchor"></a>
If some text is too long to fit on a line then LaTeX will insert line
breaks that avoid hyphenation and avoid stretching or shrinking any
interword space.
</p>
<p>This environment inserts space above and below the text body. See
<a href="#g_t_005ccentering">\centering</a> to avoid such space, for example inside a <code>figure</code>
environment.
</p>
<p>This example produces three centered lines. There is extra vertical
space between the last two lines.
</p>
<div class="example">
<pre class="example">\begin{center}
A Thesis Submitted in Partial Fufillment \\
of the Requirements of \\[0.5ex]
the School of Environmental Engineering
\end{center}
</pre></div>
<p>In this example, depending on the page’s line width, LaTeX may choose
a line break for the part before the double backslash. If so, it will
center each of the two lines and if not it will center the single line.
Then LaTeX will break at the double backslash, and will center the
ending.
</p>
<div class="example">
<pre class="example">\begin{center}
My father considered that anyone who went to chapel and didn't drink
alcohol was not to be tolerated.\\
I grew up in that belief. --Richard Burton
\end{center}
</pre></div>
<p>A double backslash after the final line is optional. If present it
doesn’t add any vertical space.
</p>
<p>In a two-column document the text is centered in a column, not in the
entire page.
</p>
<hr>
<a name="g_t_005ccentering" class="anchor"></a>
<a name="g_t_005ccentering-1" class="anchor"></a>
<h4 class="subsection"><code>\centering</code></h4>
<a name="index-_005ccentering" class="anchor"></a>
<a name="index-centering-text_002c-declaration-for" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">{\centering ... }
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">\begin{group}
\centering ...
\end{group}
</pre></div>
<p>Center the material in its scope. It is most often used inside an
environment such as <code>figure</code>, or in a <code>parbox</code>.
</p>
<p>This example’s <code>\centering</code> declaration causes the graphic to be
horizontally centered.
</p>
<div class="example">
<pre class="example">\begin{figure}
\centering
\includegraphics[width=0.6\textwidth]{ctan_lion.png}
\caption{CTAN Lion} \label{fig:CTANLion}
\end{figure}
</pre></div>
<p>The scope of this <code>\centering</code> ends with the <code>\end{figure}</code>.
</p>
<p>Unlike the <code>center</code> environment, the <code>\centering</code> command does
not add vertical space above and below the text. That’s its advantage
in the above example; there is not an excess of space.
</p>
<p>It also does not start a new paragraph; it simply changes how LaTeX
formats paragraph units. If <code>ww {\centering xx \\ yy} zz</code> is
surrounded by blank lines then LaTeX will create a paragraph whose
first line ‘<samp>ww xx</samp>’ is centered and whose second line, not centered,
contains ‘<samp>yy zz</samp>’. Usually what is desired is for the scope of the
declaration to contain a blank line or the <code>\end</code> command of an
environment such as <code>figure</code> or <code>table</code> that ends the
paragraph unit. Thus, if <code>{\centering xx \\ yy\par} zz</code> is
surrounded by blank lines then it makes a new paragraph with two
centered lines ‘<samp>xx</samp>’ and ‘<samp>yy</samp>’, followed by a new paragraph with
‘<samp>zz</samp>’ that is formatted as usual.
</p>
<hr>
<a name="description" class="anchor"></a>
<a name="description-1" class="anchor"></a>
<h3 class="section"><code>description</code></h3>
<a name="index-environment_002c-description" class="anchor"></a>
<a name="index-description-environment" class="anchor"></a>
<a name="index-labelled-lists_002c-creating" class="anchor"></a>
<a name="index-description-lists_002c-creating" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{description}
\item[<var>label of first item</var>] <var>text of first item</var>
\item[<var>label of second item</var>] <var>text of second item</var>
...
\end{description}
</pre></div>
<p>Environment to make a list of labeled items. Each item’s <var>label</var> is
typeset in bold and is flush left, so that long labels continue into the
first line of the item text. There must be at least one item; having
none causes the LaTeX error ‘<samp>Something's wrong--perhaps a
missing \item</samp>’.
</p>
<p>This example shows the environment used for a sequence of definitions.
</p>
<div class="example">
<pre class="example">\begin{definition}
\item[lama] A priest.
\item[llama] A beast.
\end{definition}
</pre></div>
<p>The labels ‘<samp>lama</samp>’ and ‘<samp>llama</samp>’ are output in boldface, with the
left edge on the left margin.
</p>
<a name="index-_005citem" class="anchor"></a>
<p>Start list items with the <code>\item</code> command (see <a href="#g_t_005citem">\item</a>). Use the
optional labels, as in <code>\item[Main point]</code>, because there is
no sensible default. Following the <code>\item</code> is optional text, which
may contain multiple paragraphs.
</p>
<a name="index-bold-typewriter_002c-avoiding" class="anchor"></a>
<a name="index-typewriter-labels-in-lists" class="anchor"></a>
<p>Since the labels are in bold style, if the label text calls for a font
change given in argument style (see <a href="latex2e_4.html#Font-styles">Font styles</a>) then it will come
out bold. For instance, if the label text calls for typewriter with
<code>\item[\texttt{label text}]</code> then it will appear in bold
typewriter, if that is available. The simplest way around this, in this
example to get non-bold typewriter, is to use declarative style:
<code>\item[{\tt label text}]</code>. Similarly, get the standard roman
font with <code>\item[{\rm label text}]</code>.
</p>
<p>For other major LaTeX labelled list environments, see <a href="#itemize">itemize</a>
and <a href="#enumerate">enumerate</a>. Unlike those environments, nesting
<code>description</code> environments does not change the default label; it is
boldface and flush left at all levels.
</p>
<p>For information about list layout parameters, including the default
values, and for information about customizing list layout, see
<a href="#list">list</a>. The package <samp>enumitem</samp> is useful for customizing
lists.
</p>
<p>This example changes the description labels to small caps.
</p>
<div class="example">
<pre class="example">\renewcommand{\descriptionlabel}[1]{%
{\hspace{\labelsep}\textsc{#1}}}
</pre></div>
<hr>
<a name="displaymath" class="anchor"></a>
<a name="displaymath-1" class="anchor"></a>
<h3 class="section"><code>displaymath</code></h3>
<a name="index-environment_002c-displaymath" class="anchor"></a>
<a name="index-displaymath-environment" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{displaymath}
<var>mathematical text</var>
\end{displaymath}
</pre></div>
<p>Environment to typeset the math text on its own line, in display style
and centered. To make the text be flush-left use the global option
<code>fleqn</code>; see <a href="latex2e_3.html#Document-class-options">Document class options</a>.
</p>
<p>In the <code>displaymath</code> environment no equation number is added to the
math text. One way to get an equation number is to use the
<code>equation</code> environment (see <a href="#equation">equation</a>).
</p>
<p>LaTeX will not break the <var>math text</var> across lines.
</p>
<a name="index-package_002c-amsmath-2" class="anchor"></a>
<a name="index-amsmath-package-2" class="anchor"></a>
<p>Note that the <samp>amsmath</samp> package has significantly more extensive
displayed equation facilities. For example, there are a number of
ways in that package for having math text broken across lines.
</p>
<p>The construct <code>\[<var>math text</var>\]</code> is essentially a synonym for
<code>\begin{displaymath}<var>math text</var>\end{displaymath}</code> but the
latter is easier to work with in the source file; for instance,
searching for a square bracket may get false positives but the word
<code>displaymath</code> will likely be unique. (The construct
<code>$$<var>math text</var>$$</code> from Plain TeX is sometimes
mistakenly used as a synonym for <code>displaymath</code>. It is not a
synonym, because the <code>displaymath</code> environment checks that it isn’t
started in math mode and that it ends in math mode begun by the matching
environment start, because the <code>displaymath</code> environment has
different vertical spacing, and because the <code>displaymath</code>
environment honors the <code>fleqn</code> option.)
</p>
<p>The output from this example is centered and alone on its line.
</p>
<div class="example">
<pre class="example">\begin{displaymath}
\int_1^2 x^2\,dx=7/3
\end{displaymath}
</pre></div>
<p>Also, the integral sign is larger than the inline version
<code>\( \int_1^2 x^2\,dx=7/3 \)</code> produces.
</p>
<hr>
<a name="document" class="anchor"></a>
<a name="document-1" class="anchor"></a>
<h3 class="section"><code>document</code></h3>
<a name="index-environment_002c-document" class="anchor"></a>
<a name="index-document-environment" class="anchor"></a>
<p>The <code>document</code> environment encloses the entire body of a document.
It is required in every LaTeX document. See <a href="latex2e_2.html#Starting-and-ending">Starting and ending</a>.
</p>
<hr>
<a name="g_t_005cAtBeginDocument" class="anchor"></a>
<a name="g_t_005cAtBeginDocument-1" class="anchor"></a>
<h4 class="subsection"><code>\AtBeginDocument</code></h4>
<a name="index-_005cAtBeginDocument" class="anchor"></a>
<a name="index-beginning-of-document-hook" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\AtBeginDocument{<var>code</var>}
</pre></div>
<p>Save <var>code</var> and execute it when <code>\begin{document}</code> is
executed, at the very end of the preamble. The code is executed after
the font selection tables have been set up, so the normal font for the
document is the current font. However, the code is executed as part of
the preamble so you cannot do any typesetting with it.
</p>
<p>You can issue this command more than once; the successive code lines
will be executed in the order that you gave them.
</p>
<hr>
<a name="g_t_005cAtEndDocument" class="anchor"></a>
<a name="g_t_005cAtEndDocument-1" class="anchor"></a>
<h4 class="subsection"><code>\AtEndDocument</code></h4>
<a name="index-_005cAtEndDocument" class="anchor"></a>
<a name="index-end-of-document-hook" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\AtEndDocument{<var>code</var>}
</pre></div>
<p>Save <var>code</var> and execute it near the end of the document.
Specifically, it is executed when <code>\end{document}</code> is executed,
before the final page is finished and before any leftover floating
environments are processed. If you want some of the code to be executed
after these two processes then include a <code>\clearpage</code> at the
appropriate point in <var>code</var>.
</p>
<p>You can issue this command more than once; the successive code lines
will be executed in the order that you gave them.
</p>
<hr>
<a name="enumerate" class="anchor"></a>
<a name="enumerate-1" class="anchor"></a>
<h3 class="section"><code>enumerate</code></h3>
<a name="index-environment_002c-enumerate" class="anchor"></a>
<a name="index-enumerate-environment" class="anchor"></a>
<a name="index-lists-of-items_002c-numbered" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{enumerate}
\item[<var>optional label of first item</var>] <var>text of first item</var>
\item[<var>optional label of second item</var>] <var>text of second item</var>
...
\end{enumerate}
</pre></div>
<p>Environment to produce a numbered list of items. The format of the
label numbering depends on the nesting level of this environment; see
below. The default top-level numbering is ‘<samp>1.</samp>’, ‘<samp>2.</samp>’,
etc. Each <code>enumerate</code> list environment must have at least one item;
having none causes the LaTeX error ‘<samp>Something's wrong--perhaps a
missing \item</samp>’.
</p>
<p>This example gives the first two finishers in the 1908 Olympic marathon.
As a top-level list the labels would come out as ‘<samp>1.</samp>’ and
‘<samp>2.</samp>’.
</p>
<div class="example">
<pre class="example">\begin{enumerate}
\item Johnny Hayes (USA)
\item Charles Hefferon (RSA)
\end{enumerate}
</pre></div>
<a name="index-_005citem-1" class="anchor"></a>
<p>Start list items with the <code>\item</code> command (see <a href="#g_t_005citem">\item</a>). If you
give <code>\item</code> an optional argument by following it with square
brackets, as in <code>\item[Interstitial label]</code>, then the next item
will continue the interrupted sequence (see <a href="#g_t_005citem">\item</a>). That is, you
will get labels like ‘<samp>1.</samp>’, then ‘<samp>Interstitial label</samp>’, then
‘<samp>2.</samp>’. Following the <code>\item</code> is optional text, which may
contain multiple paragraphs.
</p>
<p>Enumerations may be nested within other <code>enumerate</code> environments,
or within any paragraph-making environment such as <code>itemize</code>
(see <a href="#itemize">itemize</a>), up to four levels deep. This gives LaTeX’s
default for the format at each nesting level, where 1 is the top level,
the outermost level.
</p>
<ol>
<li> arabic number followed by a period: ‘<samp>1.</samp>’, ‘<samp>2.</samp>’, …
</li><li> lowercase letter inside parentheses: ‘<samp>(a)</samp>’, ‘<samp>(b)</samp>’ …
</li><li> lowercase roman numeral followed by a period: ‘<samp>i.</samp>’, ‘<samp>ii.</samp>’, …
</li><li> uppercase letter followed by a period: ‘<samp>A.</samp>’, ‘<samp>B.</samp>’, …
</li></ol>
<a name="index-_005cenumi" class="anchor"></a>
<a name="index-_005cenumii" class="anchor"></a>
<a name="index-_005cenumiii" class="anchor"></a>
<a name="index-_005cenumiv" class="anchor"></a>
<a name="enumerate-enumi" class="anchor"></a><a name="enumerate-enumii" class="anchor"></a><a name="enumerate-enumiii" class="anchor"></a><a name="enumerate-enumiv" class="anchor"></a><p>The <code>enumerate</code> environment uses the counters <code>\enumi</code> through
<code>\enumiv</code> (see <a href="latex2e_13.html#Counters">Counters</a>).
</p>
<p>For other major LaTeX labeled list environments, see
<a href="#description">description</a> and <a href="#itemize">itemize</a>. For information about list layout
parameters, including the default values, and for information about
customizing list layout, see <a href="#list">list</a>. The package <samp>enumitem</samp> is
useful for customizing lists.
</p>
<a name="index-_005clabelenumi" class="anchor"></a>
<a name="index-_005clabelenumii" class="anchor"></a>
<a name="index-_005clabelenumiii" class="anchor"></a>
<a name="index-_005clabelenumiv" class="anchor"></a>
<a name="enumerate-labelenumi" class="anchor"></a><a name="enumerate-labelenumii" class="anchor"></a><a name="enumerate-labelenumiii" class="anchor"></a><a name="enumerate-labelenumiv" class="anchor"></a><p>To change the format of the label use <code>\renewcommand</code>
(see <a href="latex2e_12.html#g_t_005cnewcommand-_0026-_005crenewcommand">\newcommand & \renewcommand</a>) on the commands <code>\labelenumi</code>
through <code>\labelenumiv</code>. For instance, this first level list will be
labelled with uppercase letters, in boldface, and without a trailing
period.
</p>
<a name="index-_005cAlph-example" class="anchor"></a>
<div class="example">
<pre class="example">\renewcommand{\labelenumi}{\textbf{\Alph{enumi}}}
\begin{enumerate}
\item Shows as boldface A
\item Shows as boldface B
\end{enumerate}
</pre></div>
<p>For a list of counter-labeling commands see <a href="latex2e_13.html#g_t_005calph-_005cAlph-_005carabic-_005croman-_005cRoman-_005cfnsymbol">\alph \Alph \arabic \roman \Roman \fnsymbol</a>.
</p>
<hr>
<a name="eqnarray" class="anchor"></a>
<a name="eqnarray-1" class="anchor"></a>
<h3 class="section"><code>eqnarray</code></h3>
<a name="index-environment_002c-eqnarray" class="anchor"></a>
<a name="index-eqnarray-environment" class="anchor"></a>
<a name="index-equations_002c-aligning" class="anchor"></a>
<a name="index-aligning-equations" class="anchor"></a>
<a name="index-align-environment_002c-from-amsmath" class="anchor"></a>
<a name="index-amsmath-package_002c-replacing-eqnarray" class="anchor"></a>
<a name="index-Madsen_002c-Lars" class="anchor"></a>
<p>The <code>eqnarray</code> environment is obsolete. It has infelicities,
including spacing that is inconsistent with other mathematics elements.
(See “Avoid eqnarray!” by Lars Madsen
<a class="external" href="http://tug.org/TUGboat/tb33-1/tb103madsen.pdf">http://tug.org/TUGboat/tb33-1/tb103madsen.pdf</a>). New documents
should include the <samp>amsmath</samp> package and use the displayed
mathematics environments provided there, such as the <code>align</code>
environment. We include a description only for completeness and for
working with old documents.
</p>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{eqnarray}
<var>first formula left</var> &<var>first formula middle</var> &<var>first formula right</var> \\
...
\end{eqnarray}
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">\begin{eqnarray*}
<var>first formula left</var> &<var>first formula middle</var> &<var>first formula right</var> \\
...
\end{eqnarray*}
</pre></div>
<a name="index-_005c_005c-_0028for-eqnarray_0029" class="anchor"></a>
<p>Display a sequence of equations or inequalities. The left and right
sides are typeset in display mode, while the middle is typeset in text
mode.
</p>
<p>It is similar to a three-column <code>array</code> environment, with items
within a row separated by an ampersand (<code>&</code>), and with rows
separated by double backslash <code>\\</code>).
<a name="index-_005c_005c_002a-_0028for-eqnarray_0029" class="anchor"></a>
The starred form of line break (<code>\\*</code>) can also be used to separate
equations, and will disallow a page break there (see <a href="latex2e_9.html#g_t_005c_005c">\\</a>).
</p>
<a name="index-_005cnonumber" class="anchor"></a>
<a name="index-equation-numbers_002c-omitting" class="anchor"></a>
<p>The unstarred form <code>eqnarray</code> places an equation number on every
line (using the <code>equation</code> counter), unless that line contains a
<code>\nonumber</code> command. The starred form <code>eqnarray*</code> omits
equation numbering, while otherwise being the same.
</p>
<a name="index-_005clefteqn" class="anchor"></a>
<p>The command <code>\lefteqn</code> is used for splitting long formulas across
lines. It typesets its argument in display style flush left in a box of
zero width.
</p>
<p>This example shows three lines. The first two lines make an inequality,
while the third line has not entry on the left side.
</p>
<div class="example">
<pre class="example">\begin{eqnarray*}
\lefteqn{x_1+x_2+\cdots+x_n} \\
&\leq &y_1+y_2+\cdots+y_n \\
&= &z+y_3+\cdots+y_n
\end{eqnarray*}
</pre></div>
<hr>
<a name="equation" class="anchor"></a>
<a name="equation-1" class="anchor"></a>
<h3 class="section"><code>equation</code></h3>
<a name="index-environment_002c-equation" class="anchor"></a>
<a name="index-equation-environment" class="anchor"></a>
<a name="index-equations_002c-environment-for" class="anchor"></a>
<a name="index-formulas_002c-environment-for" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{equation}
<var>mathematical text</var>
\end{equation}
</pre></div>
<p>The same as a <code>displaymath</code> environment (see <a href="#displaymath">displaymath</a>)
except that LaTeX puts an equation number flush to the right margin.
The equation number is generated using the <code>equation</code> counter.
</p>
<p>You should have no blank lines between <code>\begin{equation}</code> and
<code>\begin{equation}</code>, or LaTeX will tell you that there is a
missing dollar sign.
</p>
<a name="index-package_002c-amsmath-3" class="anchor"></a>
<a name="index-amsmath-package-3" class="anchor"></a>
<p>The package <samp>amsmath</samp> package has extensive displayed equation
facilities. New documents should include this package.
</p>
<hr>
<a name="figure" class="anchor"></a>
<a name="figure-1" class="anchor"></a>
<h3 class="section"><code>figure</code></h3>
<a name="index-environment_002c-figure" class="anchor"></a>
<a name="index-figure-environment" class="anchor"></a>
<a name="index-inserting-figures" class="anchor"></a>
<a name="index-figures_002c-inserting" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{figure}[<var>placement</var>]
<var>figure body</var>
\caption[<var>loftitle</var>]{<var>title</var>} % optional
\label{<var>label}</var> % optional
\end{figure}
</pre></div>
<p>or:
</p>
<div class="example">
<pre class="example">\begin{figure*}[<var>placement</var>]
<var>figure body</var>
\caption[<var>loftitle</var>]{<var>title</var>} % optional
\label{<var>label}</var> % optional
\end{figure*}
</pre></div>
<p>Figures are for material that is not part of the normal text. An
example is material that you cannot have split between two pages, such
as a graphic. Because of this, LaTeX does not typeset figures in
sequence with normal text but instead “floats” them to a convenient
place, such as the top of a following page (see <a href="latex2e_5.html#Floats">Floats</a>).
</p>
<p>The <var>figure body</var> can consist of imported graphics
(see <a href="latex2e_22.html#Graphics">Graphics</a>), or text, LaTeX commands, etc. It is typeset in a
<code>parbox</code> of width <code>\textwidth</code>.
</p>
<p>The possible values of <var>placement</var> are <code>h</code> for ‘<samp>here</samp>’,
<code>t</code> for ‘<samp>top</samp>’, <code>b</code> for ‘<samp>bottom</samp>’, and <code>p</code> for
‘<samp>on a separate page of floats</samp>’. For the effect of these options on
the float placement algorithm, see <a href="latex2e_5.html#Floats">Floats</a>.
</p>
<p>The starred form <code>figure*</code> is used when a document is in
double-column mode (see <a href="latex2e_5.html#g_t_005ctwocolumn">\twocolumn</a>). It produces a figure that
spans both columns, at the top of the page. To add the possibility of
placing at a page bottom see the discussion of <var>placement</var> <code>b</code>
in <a href="latex2e_5.html#Floats">Floats</a>.
</p>
<p>The label is optional; it is used for cross references (see <a href="latex2e_7.html#Cross-references">Cross references</a>).
<a name="index-_005ccaption" class="anchor"></a>
The optional <code>\caption</code> command specifies caption text for the
figure. By default it is numbered. If <var>loftitle</var> is present, it is
used in the list of figures instead of <var>title</var> (see <a href="latex2e_25.html#Table-of-contents-etc_002e">Table of contents etc.</a>).
</p>
<p>This example makes a figure out of a graphic. LaTeX will place that
graphic and its caption at the top of a page or, if it is pushed to the
end of the document, on a page of floats.
</p>
<div class="example">
<pre class="example">\usepackage{graphicx} % in preamble
...
\begin{figure}[t]
\centering
\includegraphics[width=0.5\textwidth]{CTANlion.png}
\caption{The CTAN lion, by Duane Bibby}
\end{figure}
</pre></div>
<hr>
<a name="filecontents" class="anchor"></a>
<a name="filecontents_003a-Write-an-external-file" class="anchor"></a>
<h3 class="section"><code>filecontents</code>: Write an external file</h3>
<a name="index-environment_002c-filecontents" class="anchor"></a>
<a name="index-filecontents-environment" class="anchor"></a>
<a name="index-environment_002c-filecontents_002a" class="anchor"></a>
<a name="index-filecontents_002a-environment" class="anchor"></a>
<a name="index-external-files_002c-writing" class="anchor"></a>
<a name="index-writing-external-files" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{filecontents}{<var>filename</var>}
<var>text</var>
\end{filecontents}
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">\begin{filecontents*}{<var>filename</var>}
<var>text</var>
\end{filecontents*}
</pre></div>
<p>Create a file named <var>filename</var> and fill it with <var>text</var>. The
unstarred version of the environment <code>filecontents</code> prefixes the
content of the created file with a header; see the example below. The
starred version <code>filecontents*</code> does not include the header.
</p>
<p>This environment can be used anywhere in the preamble, although it often
appears before the <code>\documentclass</code> command. It is typically used
when a source file requires a nonstandard style or class file. The
environment will write that file to the directory containing the source
and thus make the source file self-contained. Another use is to include
<code>bib</code> references in the file, again to make it self-contained.
</p>
<p>The environment checks whether a file of that name already exists and if
so, does not do anything. There is a <samp>filecontents</samp> package that
redefines the <code>filecontents</code> environment so that instead of doing
nothing in that case, it will overwrite the existing file.
</p>
<p>For example, this document
</p>
<div class="example">
<pre class="example">\documentclass{article}
\begin{filecontents}{JH.sty}
\newcommand{\myname}{Jim Hef{}feron}
\end{filecontents}
\usepackage{JH}
\begin{document}
Article by \myname.
\end{document}
</pre></div>
<p>produces this file <samp>JH.sty</samp>.
</p>
<div class="example">
<pre class="example">%% LaTeX2e file `JH.sty'
%% generated by the `filecontents' environment
%% from source `test' on 2015/10/12.
%%
\newcommand{\myname}{Jim Hef{}feron}
</pre></div>
<hr>
<a name="flushleft" class="anchor"></a>
<a name="flushleft-1" class="anchor"></a>
<h3 class="section"><code>flushleft</code></h3>
<a name="index-environment_002c-flushleft" class="anchor"></a>
<a name="index-flushleft-environment" class="anchor"></a>
<a name="index-left_002djustifying-text_002c-environment-for" class="anchor"></a>
<a name="index-ragged-right-text_002c-environment-for" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{flushleft}
<var>line1</var> \\
<var>line2</var> \\
...
\end{flushleft}
</pre></div>
<a name="index-_005c_005c-for-flushleft" class="anchor"></a>
<p>An environment that creates a paragraph whose lines are flush to the
left-hand margin, and ragged right. If you have lines that are too long
then LaTeX will linebreak them in a way that avoids hyphenation and
stretching or shrinking spaces. To force a new line use a double
backslash, <code>\\</code>. For the declaration form
see <a href="#g_t_005craggedright">\raggedright</a>.
</p>
<p>This creates a box of text that is at most 3 inches wide, with the text
flush left and ragged right.
</p>
<div class="example">
<pre class="example">\noindent\begin{minipage}{3in}
\begin{flushleft}
A long sentence that will be broken by \LaTeX{}
at a convenient spot. \\
And, a fresh line forced by the double backslash.
\end{flushleft}
\end{minipage}
</pre></div>
<hr>
<a name="g_t_005craggedright" class="anchor"></a>
<a name="g_t_005craggedright-1" class="anchor"></a>
<h4 class="subsection"><code>\raggedright</code></h4>
<a name="index-_005craggedright" class="anchor"></a>
<a name="index-ragged-right-text" class="anchor"></a>
<a name="index-left_002djustifying-text" class="anchor"></a>
<a name="index-justification_002c-ragged-right" class="anchor"></a>
<p>Synopses:
</p>
<div class="example">
<pre class="example">{\raggedright ... }
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">\begin{<var>environment</var>} \raggedright
...
\end{<var>environment</var>}
</pre></div>
<p>A declaration which causes lines to be flush to the left margin and
ragged right. It can be used inside an environment such as <code>quote</code>
or in a <code>parbox</code>. For the environment form
see <a href="#flushleft">flushleft</a>.
</p>
<p>Unlike the <code>flushleft</code> environment, the <code>\raggedright</code>
command does not start a new paragraph; it only changes how LaTeX
formats paragraph units. To affect a paragraph unit’s format, the
scope of the declaration must contain the blank line or <code>\end</code>
command that ends the paragraph unit.
</p>
<p>Here <code>\raggedright</code> in each second column keeps LaTeX from doing
very awkward typesetting to fit the text into the narrow column. Note
that <code>\raggedright</code> is inside the curly braces <code>{...}</code> to
delimit its effect.
</p>
<div class="example">
<pre class="example">\begin{tabular}{rp{2in}}
Team alpha &{\raggedright This team does all the real work.} \\
Team beta &{\raggedright This team ensures that the water
cooler is never empty.} \\
\end{tabular}
</pre></div>
<hr>
<a name="flushright" class="anchor"></a>
<a name="flushright-1" class="anchor"></a>
<h3 class="section"><code>flushright</code></h3>
<a name="index-environment_002c-flushright" class="anchor"></a>
<a name="index-flushright-environment" class="anchor"></a>
<a name="index-ragged-left-text_002c-environment-for" class="anchor"></a>
<a name="index-right_002djustifying-text_002c-environment-for" class="anchor"></a>
<div class="example">
<pre class="example">\begin{flushright}
<var>line1</var> \\
<var>line2</var> \\
...
\end{flushright}
</pre></div>
<a name="index-_005c_005c-_0028for-flushright_0029" class="anchor"></a>
<p>An environment that creates a paragraph whose lines are flush to the
right-hand margin and ragged left. If you have lines that are too long
to fit the margins then LaTeX will linebreak them in a way that
avoids hyphenation and stretching or shrinking spaces. To force a new
line use a double backslash, <code>\\</code>. For the declaration form
see <a href="#g_t_005craggedleft">\raggedleft</a>.
</p>
<p>For an example related to this environment, see <a href="#flushleft">flushleft</a>.
</p>
<hr>
<a name="g_t_005craggedleft" class="anchor"></a>
<a name="g_t_005craggedleft-1" class="anchor"></a>
<h4 class="subsection"><code>\raggedleft</code></h4>
<a name="index-_005craggedleft" class="anchor"></a>
<a name="index-ragged-left-text" class="anchor"></a>
<a name="index-justification_002c-ragged-left" class="anchor"></a>
<a name="index-right_002djustifying-text" class="anchor"></a>
<p>Synopses:
</p>
<div class="example">
<pre class="example">{\raggedleft ... }
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">\begin{<var>environment</var>} \raggedleft
...
\end{<var>environment</var>}
</pre></div>
<p>A declaration which causes lines to be flush to the right margin and
ragged left. It can be used inside an environment such as <code>quote</code>
or in a <code>parbox</code>. For the environment form
see <a href="#flushright">flushright</a>.
</p>
<p>Unlike the <code>flushright</code> environment, the <code>\raggedleft</code>
command does not start a new paragraph; it only changes how LaTeX
formats paragraph units. To affect a paragraph unit’s format, the
scope of the declaration must contain the blank line or <code>\end</code>
command that ends the paragraph unit.
</p>
<p>For an example related to this environment, see <a href="#g_t_005craggedright">\raggedright</a>.
</p>
<hr>
<a name="itemize" class="anchor"></a>
<a name="itemize-1" class="anchor"></a>
<h3 class="section"><code>itemize</code></h3>
<a name="index-environment_002c-itemize" class="anchor"></a>
<a name="index-itemize-environment" class="anchor"></a>
<a name="index-_005citem-2" class="anchor"></a>
<a name="index-lists-of-items" class="anchor"></a>
<a name="index-unordered-lists" class="anchor"></a>
<a name="index-bulleted-lists" class="anchor"></a>
<a name="index-bullet-lists" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{itemize}
\item[<var>optional label of first item</var>] <var>text of first item</var>
\item[<var>optional label of second item</var>] <var>text of second item</var>
...
\end{itemize}
</pre></div>
<p>Produce a list that is unordered, sometimes called a bullet list. The
environment must have at least one <code>\item</code>; having none causes the
LaTeX error ‘<samp>Something's wrong--perhaps a missing \item</samp>’.
</p>
<p>This gives a two-item list.
</p>
<div class="example">
<pre class="example">\begin{itemize}
\item Pencil and watercolor sketch by Cassandra
\item Rice portrait
\end{itemize}
</pre></div>
<p>As a top-level list each label would come out as a bullet, •.
The format of the labeling depends on the nesting level; see below.
</p>
<a name="index-_005citem-3" class="anchor"></a>
<p>Start list items with the <code>\item</code> command (see <a href="#g_t_005citem">\item</a>). If you
give <code>\item</code> an optional argument by following it with square
brackets, as in <code>\item[Optional label]</code>, then by default it will
appear in bold and be flush right, so it could extend into the left
margin. For labels that are flush left see the <a href="#description">description</a>
environment. Following the <code>\item</code> is optional text, which may
contain multiple paragraphs.
</p>
<a name="index-_005clabelitemi" class="anchor"></a>
<a name="index-_005clabelitemii" class="anchor"></a>
<a name="index-_005clabelitemiii" class="anchor"></a>
<a name="index-_005clabelitemiv" class="anchor"></a>
<a name="itemize-labelitemi" class="anchor"></a><a name="itemize-labelitemii" class="anchor"></a><a name="itemize-labelitemiii" class="anchor"></a><a name="itemize-labelitemiv" class="anchor"></a><p>Itemized lists can be nested within one another, up to four levels deep.
They can also be nested within other paragraph-making environments, such
as <code>enumerate</code> (see <a href="#enumerate">enumerate</a>). The <code>itemize</code> environment
uses the commands <code>\labelitemi</code> through <code>\labelitemiv</code> to
produce the default label (this also uses the convention of lowercase
roman numerals at the end of the command names that signify the nesting
level). These are the default marks at each level.
</p>
<ol>
<li> • (bullet, from <code>\textbullet</code>)
</li><li> <b>-<span class="nolinebreak">-</span><!-- /@w --></b> (bold en-dash, from <code>\normalfont\bfseries\textendash</code>)
</li><li> * (asterisk, from <code>\textasteriskcentered</code>)
</li><li> . (centered dot, rendered here as a period, from <code>\textperiodcentered</code>)
</li></ol>
<p>Change the labels with <code>\renewcommand</code>. For instance, this makes
the first level use diamonds.
</p>
<div class="example">
<pre class="example">\renewcommand{\labelitemi}{$\diamond$}
</pre></div>
<a name="index-_005cleftmargin" class="anchor"></a>
<a name="index-_005cleftmargini" class="anchor"></a>
<a name="index-_005cleftmarginii" class="anchor"></a>
<a name="index-_005cleftmarginiii" class="anchor"></a>
<a name="index-_005cleftmarginiv" class="anchor"></a>
<a name="index-_005cleftmarginv" class="anchor"></a>
<a name="index-_005cleftmarginvi" class="anchor"></a>
<a name="itemize-leftmargin" class="anchor"></a><a name="itemize-leftmargini" class="anchor"></a><a name="itemize-leftmarginii" class="anchor"></a><a name="itemize-leftmarginiii" class="anchor"></a><a name="itemize-leftmarginiv" class="anchor"></a><a name="itemize-leftmarginv" class="anchor"></a><a name="itemize-leftmarginvi" class="anchor"></a><p>The distance between the left margin of the enclosing environment and
the left margin of the <code>itemize</code> list is determined by the
parameters <code>\leftmargini</code> through <code>\leftmarginvi</code>. (Note the
convention of using lowercase roman numerals a the end of the command
name to denote the nesting level.) The defaults are: <code>2.5em</code> in
level 1 (<code>2em</code> in two-column mode), <code>2.2em</code> in level 2,
<code>1.87em</code> in level 3, and <code>1.7em</code> in level 4, with smaller
values for more deeply nested levels.
</p>
<p>For other major LaTeX labeled list environments, see
<a href="#description">description</a> and <a href="#enumerate">enumerate</a>. For information about list
layout parameters, including the default values, and for information
about customizing list layout, see <a href="#list">list</a>. The package
<samp>enumitem</samp> is useful for customizing lists.
</p>
<p>This example greatly reduces the margin space for outermost itemized
lists.
</p>
<div class="example">
<pre class="example">\setlength{\leftmargini}{1.25em} % default 2.5em
</pre></div>
<a name="index-_005cparskip-example" class="anchor"></a>
<p>Especially for lists with short items, it may be desirable to elide
space between items. Here is an example defining an <code>itemize*</code>
environment with no extra spacing between items, or between paragraphs
within a single item (<code>\parskip</code> is not list-specific,
see <a href="latex2e_15.html#g_t_005cparindent-_0026-_005cparskip">\parindent & \parskip</a>):
</p>
<div class="example">
<pre class="example">\newenvironment{itemize*}%
{\begin{itemize}%
\setlength{\itemsep}{0pt}%
\setlength{\parsep}{0pt}}%
\setlength{\parskip}{0pt}}%
{\end{itemize}}
</pre></div>
<hr>
<a name="letter" class="anchor"></a>
<a name="letter-environment_003a-writing-letters" class="anchor"></a>
<h3 class="section"><code>letter</code> environment: writing letters</h3>
<a name="index-environment_002c-letter" class="anchor"></a>
<a name="index-letter-environment" class="anchor"></a>
<p>This environment is used for creating letters. See <a href="latex2e_26.html#Letters">Letters</a>.
</p>
<hr>
<a name="list" class="anchor"></a>
<a name="list-1" class="anchor"></a>
<h3 class="section"><code>list</code></h3>
<a name="index-environment_002c-list" class="anchor"></a>
<a name="index-list-environment" class="anchor"></a>
<a name="index-lists-of-items_002c-generic" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{list}{<var>labeling</var>}{<var>spacing</var>}
\item[<var>optional label of first item</var>] <var>text of first item</var>
\item[<var>optional label of second item</var>] <var>text of second item</var>
...
\end{list}
</pre></div>
<p>An environment for constructing lists.
</p>
<p>Note that this environment does not typically appear in the document
body. Most lists created by LaTeX authors are the ones that come
standard: the <code>description</code>, <code>enumerate</code>, and <code>itemize</code>
environments (see <a href="#description">description</a>, <a href="#enumerate">enumerate</a>, and <a href="#itemize">itemize</a>).
</p>
<p>Instead, the <code>list</code> environment is most often used in macros. For
example, many standard LaTeX environments that do not immediately
appear to be lists are in fact constructed using <code>list</code>, including
<code>quotation</code>, <code>quote</code>, and <code>center</code> (see <a href="#quotation-_0026-quote">quotation & quote</a>, see <a href="#center">center</a>).
</p>
<p>This uses the <code>list</code> environment to define a new custom
environment.
</p>
<div class="example">
<pre class="example">\newcounter{namedlistcounter} % number the items
\newenvironment{named}
{\begin{list}
{Item~\Roman{namedlistcounter}.} % labeling
{\usecounter{namedlistcounter} % set counter
\setlength{\leftmargin}{3.5em}} % set spacing
}
{\end{list}}
\begin{named}
\item Shows as ``Item~I.''
\item[Special label.] Shows as ``Special label.''
\item Shows as ``Item~II.''
\end{named}
</pre></div>
<p>The mandatory first argument <var>labeling</var> specifies the default
labeling of list items. It can contain text and LaTeX commands, as
above where it contains both ‘<samp>Item</samp>’ and ‘<samp>\Roman{...}</samp>’.
LaTeX forms the label by putting the <var>labeling</var> argument in a box
of width <code>\labelwidth</code>. If the label is wider than that, the
additional material extends to the right. When making an instance of a
list you can override the default labeling by giving <code>\item</code> an
optional argument by including square braces and the text, as in the
above <code>\item[Special label.]</code>; see <a href="#g_t_005citem">\item</a>.
</p>
<p>The mandatory second argument <var>spacing</var> has a list of commands.
This list can be empty. A command that can go in here is
<code>\usecounter{<var>countername</var>}</code> (see <a href="latex2e_13.html#g_t_005cusecounter">\usecounter</a>). Use this
to tell LaTeX to number the items using the given counter. The
counter will be reset to zero each time LaTeX enters the environment,
and the counter is incremented by one each time LaTeX encounters an
<code>\item</code> that does not have an optional argument.
</p>
<a name="index-_005cmakelabel" class="anchor"></a>
<a name="list-makelabel" class="anchor"></a><p>Another command that can go in <var>spacing</var> is
<code>\makelabel</code>, which constructs the label box. By default it puts
the contents flush right. Its only argument is the label, which it
typesets in LR mode (see <a href="latex2e_17.html#Modes">Modes</a>). One example of changing its
definition is that to the above <code>named</code> example, before the
definition of the environment add
<code>\newcommand{\namedmakelabel}[1]{\textsc{#1}}</code>, and between
the <code>\setlength</code> command and the parenthesis that closes the
<var>spacing</var> argument also add <code>\let\makelabel\namedmakelabel</code>.
Then the items will be typeset in small caps. Similarly, changing the
second code line to <code>\let\makelabel\fbox</code> puts the labels inside a
framed box. Another example of the <code>\makelabel</code> command is below,
in the definition of the <code>redlabel</code> environment.
</p>
<p>Also often in <var>spacing</var> are commands to redefine the spacing for the
list. Below are the spacing parameters with their default values.
(Default values for derived environments such as <code>itemize</code> can be
different than the values shown here.) See also the figure that follows
the list. Each is a length (see <a href="latex2e_14.html#Lengths">Lengths</a>). The vertical spaces are
normally rubber lengths, with <code>plus</code> and <code>minus</code> components,
to give TeX flexibility in setting the page. Change each with a
command such as <code>\setlength{itemsep}{2pt plus1pt minus1pt}</code>.
For some effects these lengths should be zero or negative.
</p>
<dl compact="compact">
<dt><code>\itemindent</code>
<a name="index-_005citemindent" class="anchor"></a>
</dt>
<dd><a name="list-itemindent" class="anchor"></a><p>Extra horizontal space indentation, beyond <code>leftmargin</code>, of the
first line each item. Its default value is <code>0pt</code>.
</p>
</dd>
<dt><code>\itemsep</code>
<a name="index-_005citemsep" class="anchor"></a>
</dt>
<dd><a name="list-itemsep" class="anchor"></a><p>Vertical space between items, beyond the <code>\parsep</code>. The defaults
for the first three levels in LaTeX’s ‘<samp>article</samp>’, ‘<samp>book</samp>’,
and ‘<samp>report</samp>’ classes at 10 point size are: <code>4pt plus2pt
minus1pt</code>, <code>\parsep</code> (that is, <code>2pt plus1pt minus1pt</code>), and
<code>\topsep</code> (that is, <code>2pt plus1pt minus1pt</code>). The defaults at
11 point are: <code>4.5pt plus2pt minus1pt</code>, <code>\parsep</code> (that is,
<code>2pt plus1pt minus1pt</code>), and <code>topsep</code> (that is, <code>2pt
plus1pt minus1pt</code>). The defaults at 12 point are: <code>5pt plus2.5pt
minus1pt</code>, <code>\parsep</code> (that is, <code>2.5pt plus1pt minus1pt</code>), and
<code>\topsep</code> (that is, <code>2.5pt plus1pt minus1pt</code>).
</p>
</dd>
<dt><code>\labelsep</code>
<a name="index-_005clabelsep" class="anchor"></a>
</dt>
<dd><a name="list-labelsep" class="anchor"></a><p>Horizontal space between the label and text of an item.
The default for LaTeX’s ‘<samp>article</samp>’, ‘<samp>book</samp>’,
and ‘<samp>report</samp>’ classes is <code>0.5em</code>.
</p>
</dd>
<dt><code>\labelwidth</code>
<a name="index-_005clabelwidth" class="anchor"></a>
</dt>
<dd><a name="list-labelwidth" class="anchor"></a><p>Horizontal width. The box containing the label is nominally this wide.
If <code>\makelabel</code> returns text that is wider than this then the first
line of the item will be indented to make room for this extra material.
If <code>\makelabel</code> returns text of width less than or equal to
<code>\labelwidth</code> then LaTeX’s default is that the label is typeset
flush right in a box of this width.
</p>
<p>The left edge of the label box is
<code>\leftmargin</code>+<code>\itemindent</code>-<code>\labelsep</code>-<code>\labelwidth</code>
from the left margin of the enclosing environment.
</p>
<p>The default for LaTeX’s ‘<samp>article</samp>’, ‘<samp>book</samp>’, and
‘<samp>report</samp>’ classes at the top level is
<code>\leftmargini</code>-<code>\labelsep</code>, (which is <code>2em</code> in one column
mode and <code>1.5em</code> in two column mode). At the second level it is
<code>\leftmarginii</code>-<code>\labelsep</code>, and at the third level it is
<code>\leftmarginiii</code>-<code>\labelsep</code>. These definitions make the
label’s left edge coincide with the left margin of the enclosing
environment.
</p>
</dd>
<dt><code>\leftmargin</code>
<a name="index-_005cleftmargin-1" class="anchor"></a>
</dt>
<dd><a name="list-leftmargin" class="anchor"></a><p>Horizontal space between the left margin of the enclosing environment
(or the left margin of the page if this is a top-level list), and the
left margin of this list. It must be non-negative.
</p>
<p>In the standard LaTeX document classes, a top-level list has this set
to the value of <code>\leftmargini</code>, while a list that is nested inside
a top-level list has this margin set to <code>\leftmarginii</code>. More
deeply nested lists get the values of <code>\leftmarginiii</code> through
<code>\leftmarginvi</code>. (Nesting greater than level five generates the
error message ‘<samp>Too deeply nested</samp>’.)
</p>
<p>The defaults for the first three levels in LaTeX’s ‘<samp>article</samp>’,
‘<samp>book</samp>’, and ‘<samp>report</samp>’ classes are: <code>\leftmargini</code> is
<code>2.5em</code> (in two column mode, <code>2em</code>), <code>\leftmarginii</code> is
<code>2.2em</code>, and <code>\leftmarginiii</code> is <code>1.87em</code>.
</p>
</dd>
<dt><code>\listparindent</code>
<a name="index-_005clistparindent" class="anchor"></a>
</dt>
<dd><a name="list-listparindent" class="anchor"></a><p>Horizontal space of additional line indentation, beyond
<code>\leftmargin</code>, for second and subsequent paragraphs within a list
item. A negative value makes this an “outdent”. Its default value
is <code>0pt</code>.
</p>
</dd>
<dt><code>\parsep</code>
<a name="index-_005cparsep" class="anchor"></a>
</dt>
<dd><a name="list-parsep" class="anchor"></a><p>Vertical space between paragraphs within an item. In the ‘<samp>book</samp>’
and ‘<samp>article</samp>’ classes The defaults for the first three levels in
LaTeX’s ‘<samp>article</samp>’, ‘<samp>book</samp>’, and ‘<samp>report</samp>’ classes at 10
point size are: <code>4pt plus2pt minus1pt</code>, <code>2pt plus1pt
minus1pt</code>, and <code>0pt</code>. The defaults at 11 point size are:
<code>4.5pt plus2pt minus1pt</code>, <code>2pt plus1pt minus1pt</code>, and
<code>0pt</code>. The defaults at 12 point size are: <code>5pt plus2.5pt
minus1pt</code>, <code>2.5pt plus1pt minus1pt</code>, and <code>0pt</code>.
</p>
</dd>
<dt><code>\partopsep</code>
<a name="index-_005cpartopsep" class="anchor"></a>
</dt>
<dd><a name="list-partopsep" class="anchor"></a><p>Vertical space added, beyond <code>\topsep</code>+<code>\parskip</code>, to the top
and bottom of the entire environment if the list instance is preceded by
a blank line. (A blank line in the LaTeX source before the list
changes spacing at both the top and bottom of the list; whether the line
following the list is blank does not matter.)
</p>
<p>The defaults for the first three levels in LaTeX’s ‘<samp>article</samp>’,
‘<samp>book</samp>’, and ‘<samp>report</samp>’ classes at 10 point size are: <code>2pt
plus1 minus1pt</code>, <code>2pt plus1pt minus1pt</code>, and <code>1pt plus0pt
minus1pt</code>. The defaults at 11 point are: <code>3pt plus1pt minus1pt</code>,
<code>3pt plus1pt minus1pt</code>, and <code>1pt plus0pt minus1pt</code>). The
defaults at 12 point are: <code>3pt plus2pt minus3pt</code>, <code>3pt plus2pt
minus2pt</code>, and <code>1pt plus0pt minus1pt</code>.
</p>
</dd>
<dt><code>\rightmargin</code>
<a name="index-_005crightmargin" class="anchor"></a>
</dt>
<dd><a name="list-rightmargin" class="anchor"></a><p>Horizontal space between the right margin of the list and the right
margin of the enclosing environment. Its default value is <code>0pt</code>.
It must be non-negative.
</p>
</dd>
<dt><code>\topsep</code>
<a name="index-_005ctopsep" class="anchor"></a>
</dt>
<dd><a name="list-topsep" class="anchor"></a><p>Vertical space added to both the top and bottom of the list, in addition
to <code>\parskip</code> (see <a href="latex2e_15.html#g_t_005cparindent-_0026-_005cparskip">\parindent & \parskip</a>). The defaults for
the first three levels in LaTeX’s ‘<samp>article</samp>’, ‘<samp>book</samp>’, and
‘<samp>report</samp>’ classes at 10 point size are: <code>8pt plus2pt minus4pt</code>,
<code>4pt plus2pt minus1pt</code>, and <code>2pt plus1pt minus1pt</code>. The
defaults at 11 point are: <code>9pt plus3pt minus5pt</code>, <code>4.5pt
plus2pt minus1pt</code>, and <code>2pt plus1pt minus1pt</code>. The defaults at 12
point are: <code>10pt plus4pt minus6pt</code>, <code>5pt plus2.5pt minus1pt</code>,
and <code>2.5pt plus1pt minus1pt</code>.
</p>
</dd>
</dl>
<p>This shows the horizontal and vertical distances.
</p>
<div class="float">
<img src="latex2e-figures/list.png" alt="latex2e-figures/list">
</div>
<p>The lengths shown are listed below. The key relationship is that the
right edge of the bracket for <var>h1</var> equals the right edge of the
bracket for <var>h4</var>, so that the left edge of the label box is at
<var>h3</var>+<var>h4</var>-(<var>h0</var>+<var>h1</var>).
</p>
<dl compact="compact">
<dt><var>v0</var></dt>
<dd><p><em><code>\topsep</code> + <code>\parskip</code></em> if
the list environment does not start a new paragraph, and
<code>\topsep</code>+<code>\parskip</code>+<code>\partopsep</code> if it does
</p>
</dd>
<dt><var>v1</var></dt>
<dd><p><code>\parsep</code>
</p>
</dd>
<dt><var>v2</var></dt>
<dd><p><code>\itemsep</code>+<code>\parsep</code>
</p>
</dd>
<dt><var>v3</var></dt>
<dd><p>Same as <var>v0</var>. (This space is affected by whether a blank line
appears in the source above the environment; whether a blank line
appears in the source below the environment does not matter.)
</p>
</dd>
<dt><var>h0</var></dt>
<dd><p><code>\labelwidth</code>
</p>
</dd>
<dt><var>h1</var></dt>
<dd><p><code>\labelsep</code>
</p>
</dd>
<dt><var>h2</var></dt>
<dd><p><code>\listparindent</code>
</p>
</dd>
<dt><var>h3</var></dt>
<dd><p><code>\leftmargin</code>
</p>
</dd>
<dt><var>h4</var></dt>
<dd><p><code>\itemindent</code>
</p>
</dd>
<dt><var>h5</var></dt>
<dd><p><code>\rightmargin</code>
</p>
</dd>
</dl>
<p>The list’s left and right margins, shown above as <var>h3</var> and <var>h5</var>,
are with respect to the ones provided by the surrounding environment, or
with respect to the page margins for a top-level list. The line width
used for typesetting the list items is <code>\linewidth</code> (see <a href="latex2e_5.html#Page-layout-parameters">Page layout parameters</a>). For instance, set the list’s left margin to be one
quarter of the distance between the left and right margins of the
enclosing environment with
<code>\setlength{\leftmargin}{0.25\linewidth}</code>.
</p>
<p>Page breaking in a list structure is controlled by the three
parameters below. For each, the LaTeX default is
<code>-\@lowpenalty</code>, that is, <code>-51</code>. Because it is negative,
it somewhat encourages a page break at each spot. Change it with,
e.g., <code>\@beginparpenalty=9999</code>; a value of 10000 prohibits a
page break.
</p>
<dl compact="compact">
<dt><code>\@beginparpenalty</code>
<a name="index-_005c_0040beginparpenalty" class="anchor"></a>
</dt>
<dd><a name="list-beginparpenalty" class="anchor"></a><p>The page breaking penalty for breaking before the list (default <code>-51</code>).
</p>
</dd>
<dt><code>\@itempenalty</code>
<a name="index-_005c_0040itempenalty" class="anchor"></a>
</dt>
<dd><a name="list-itempenalty" class="anchor"></a><p>The page breaking penalty for breaking before a list item (default <code>-51</code>).
</p>
</dd>
<dt><code>\@endparpenalty</code>
<a name="index-_005c_0040endparpenalty" class="anchor"></a>
</dt>
<dd><a name="list-endparpenalty" class="anchor"></a><p>The page breaking penalty for breaking after a list (default <code>-51</code>).
</p>
</dd>
</dl>
<a name="index-package_002c-enumitem" class="anchor"></a>
<a name="index-enumitem-package" class="anchor"></a>
<p>The package <code>enumitem</code> is useful for customizing lists.
</p>
<p>This example has the labels in red. They are numbered, and the left
edge of the label lines up with the left edge of the item text.
See <a href="latex2e_13.html#g_t_005cusecounter">\usecounter</a>.
</p>
<div class="example">
<pre class="example">\usepackage{color}
\newcounter{cnt}
\newcommand{\makeredlabel}[1]{\textcolor{red}{#1.}}
\newenvironment{redlabel}
{\begin{list}
{\arabic{cnt}}
{\usecounter{cnt}
\setlength{\labelwidth}{0em}
\setlength{\labelsep}{0.5em}
\setlength{\leftmargin}{1.5em}
\setlength{\itemindent}{0.5em} % equals \labelwidth+\labelsep
\let\makelabel=\makeredlabel
}
}
{\end{list} }
</pre></div>
<hr>
<a name="g_t_005citem" class="anchor"></a>
<a name="g_t_005citem_003a-An-entry-in-a-list" class="anchor"></a>
<h4 class="subsection"><code>\item</code>: An entry in a list</h4>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\item text of item
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">\item[<var>optional-label</var>] text of item
</pre></div>
<p>An entry in a list. The entries are prefixed by a label, whose default
depends on the list type.
</p>
<p>Because the optional label is surrounded by square brackets
‘<samp>[...]</samp>’, if you have an item whose text starts with ‘<samp>[</samp>’, you
have to hide the bracket inside curly braces, as in: <code>\item
{[} is an open square bracket</code>; otherwise, LaTeX will think it
marks the start of an optional label.
</p>
<p>Similarly, if the item does have the optional label and you need a
close square bracket inside that label, you must hide it in the same
way: <code>\item[Close square bracket, {]}]</code>. See <a href="latex2e_2.html#LaTeX-command-syntax">LaTeX command syntax</a>.
</p>
<p>In this example the enumerate list has two items that use the default
label and one that uses the optional label.
</p>
<div class="example">
<pre class="example">\begin{enumerate}
\item Moe
\item[sometimes] Shemp
\item Larry
\end{enumerate}
</pre></div>
<p>The first item is labelled ‘<samp>1.</samp>’, the second item is labelled
‘<samp>sometimes</samp>’, and the third item is labelled ‘<samp>2.</samp>’. Because
of the optional label in the second item, the third item is not
labelled ‘<samp>3.</samp>’.
</p>
<hr>
<a name="trivlist" class="anchor"></a>
<a name="trivlist_003a-A-restricted-form-of-list" class="anchor"></a>
<h4 class="subsection"><code>trivlist</code>: A restricted form of <code>list</code></h4>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{trivlist}
...
\end{trivlist}
</pre></div>
<p>A restricted version of the list environment, in which margins are not
indented and an <code>\item</code> without an optional argument produces no
text. It is most often used in macros, to define an environment where
the <code>\item</code> command as part of the environment’s definition. For
instance, the <code>center</code> environment is defined essentially like
this:
</p>
<div class="example">
<pre class="example">\newenvironment{center}
{\begin{trivlist}\centering\item\relax}
{\end{trivlist}}
</pre></div>
<p>Using <code>trivlist</code> in this way allows the macro to inherit some
common code: combining vertical space of two adjacent environments;
detecting whether the text following the environment should be
considered a new paragraph or a continuation of the previous one;
adjusting the left and right margins for possible nested list
environments.
</p>
<p>Specifically, <code>trivlist</code> uses the current values of the list
parameters (see <a href="#list">list</a>), except that <code>\parsep</code> is set to the
value of <code>\parskip</code>, and <code>\leftmargin</code>, <code>\labelwidth</code>,
and <code>\itemindent</code> are set to zero.
</p>
<p>This example outputs the items as two paragraphs, except that (by
default) they have no paragraph indent and are vertically separated.
</p>
<div class="example">
<pre class="example">\begin{trivlist}
\item The \textit{Surprise} is not old; no one would call her old.
\item She has a bluff bow, lovely lines.
\end{trivlist}
</pre></div>
<hr>
<a name="math" class="anchor"></a>
<a name="math-1" class="anchor"></a>
<h3 class="section"><code>math</code></h3>
<a name="index-environment_002c-math" class="anchor"></a>
<a name="index-math-environment" class="anchor"></a>
<a name="index-in_002dline-formulas" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{math}
<var>math</var>
\end{math}
</pre></div>
<p>The <code>math</code> environment inserts given <var>math</var> material within
the running text. <code>\(...\)</code> and <code>$...$</code> are synonyms.
See <a href="latex2e_16.html#Math-formulas">Math formulas</a>.
</p>
<hr>
<a name="minipage" class="anchor"></a>
<a name="minipage-1" class="anchor"></a>
<h3 class="section"><code>minipage</code></h3>
<a name="index-environment_002c-minipage" class="anchor"></a>
<a name="index-minipage-environment" class="anchor"></a>
<a name="index-minipage_002c-creating-a" class="anchor"></a>
<p>Synopses:
</p>
<div class="example">
<pre class="example">\begin{minipage}{<var>width</var>}
<var>contents</var>
\end{minipage}
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">\begin{minipage}[<var>position</var>][<var>height</var>][<var>inner-pos</var>]{<var>width</var>}
<var>contents</var>
\end{minipage}
</pre></div>
<p>Put <var>contents</var> into a box that is <var>width</var> wide. This is like a
small version of a page; it can contain its own footnotes, itemized
lists, etc. (There are some restrictions, including that it cannot have
floats.) This box will not be broken across pages. So <code>minipage</code>
is similar to <code>\parbox</code> (see <a href="latex2e_20.html#g_t_005cparbox">\parbox</a>) but here you can have
paragraphs.
</p>
<p>This example will be 3 inches wide, and has two paragraphs.
</p>
<div class="example">
<pre class="example">\begin{minipage}{3in}
Stephen Kleene was a founder of the Theory of Computation.
He was a student of Church, wrote three influential texts,
was President of the Association for Symbolic Logic,
and won the National Medal of Science.
\end{minipage}
</pre></div>
<p>See below for a discussion of the paragraph indent inside a
<code>minipage</code>.
</p>
<p>The required argument <var>width</var> is a rigid length (see <a href="latex2e_14.html#Lengths">Lengths</a>).
It gives the width of the box into which <var>contents</var> are typeset.
</p>
<p>There are three optional arguments, <var>position</var>, <var>height</var>, and
<var>inner-pos</var>. You need not include all three. For example, get the
default <var>position</var> and set the <var>height</var> with
<code>\begin{minipage}[c][2.54cm] <var>contents</var> \end{minipage}</code>.
(Get the natural height with an empty argument, <code>[]</code>.)
</p>
<p>The optional argument <var>position</var> governs how the <code>minipage</code>
vertically aligns with the surrounding material.
</p>
<dl compact="compact">
<dt><code>c</code></dt>
<dd><p>(synonym <code>m</code>) Default. Positions the <code>minipage</code> so its
vertical center lines up with the center of the adjacent text line (what
Plain TeX calls <code>\vcenter</code>).
</p>
</dd>
<dt><code>t</code></dt>
<dd><p>Match the top line in the <code>minipage</code> with the baseline of the
surrounding text (Plain TeX’s <code>\vtop</code>.
</p>
</dd>
<dt><code>b</code></dt>
<dd><p>Match the bottom line in the <code>minipage</code> with the baseline of the
surrounding text (Plain TeX’s <code>\vbox</code>.
</p></dd>
</dl>
<p>To see the effects of these, contrast running this
</p>
<div class="example">
<pre class="example">---\begin{minipage}[c]{0.25in}
first\\ second\\ third
\end{minipage}
</pre></div>
<p>with the results of changing <code>c</code> to <code>b</code> or <code>t</code>.
</p>
<p>The optional argument <var>height</var> is a rigid length (see <a href="latex2e_14.html#Lengths">Lengths</a>).
It sets the height of the <code>minipage</code>. You can enter any value
larger than, or equal to, or smaller than the <code>minipage</code>’s natural
height and LaTeX will not give an error or warning. You can also set
it to a height of zero or a negative value.
</p>
<p>The final optional argument <var>inner-pos</var> controls the placement of
<var>content</var> inside the box. These are the possible values are (the
default is the value of <var>position</var>).
</p>
<dl compact="compact">
<dt><code>t</code></dt>
<dd><p>Place <var>content</var> at the top of the box.
</p>
</dd>
<dt><code>c</code></dt>
<dd><p>Place it in the vertical center.
</p>
</dd>
<dt><code>b</code></dt>
<dd><p>Place it at the box bottom.
</p>
</dd>
<dt><code>s</code></dt>
<dd><p>Stretch <var>contents</var> out vertically; it must contain vertically
stretchable space.
</p>
</dd>
</dl>
<p>The <var>inner-pos</var> argument makes sense when the <var>height</var> option
is set to a value larger than the <code>minipage</code>’s natural height. To
see the effect of the options, run this example with the various choices
in place of <code>b</code>.
</p>
<div class="example">
<pre class="example">Text before
\begin{center}
---\begin{minipage}[c][3in][b]{0.25\textwidth}
first\\ second\\ third
\end{minipage}
\end{center}
Text after
</pre></div>
<a name="index-indentation-of-paragraphs_002c-in-minipage" class="anchor"></a>
<a name="index-paragraph-indentation_002c-in-minipage" class="anchor"></a>
<a name="index-_005cparindent" class="anchor"></a>
<p>By default paragraphs are not indented in a <code>minipage</code>. Change
that with a command such as <code>\setlength{\parindent}{1pc}</code> at
the start of <var>contents</var>.
</p>
<a name="index-footnotes-in-figures" class="anchor"></a>
<a name="index-figures_002c-footnotes-in" class="anchor"></a>
<p>Footnotes in a <code>minipage</code> environment are handled in a way that is
particularly useful for putting footnotes in figures or tables. A
<code>\footnote</code> or <code>\footnotetext</code> command puts the footnote at
the bottom of the minipage instead of at the bottom of the page, and it
uses the <code>\mpfootnote</code> counter instead of the ordinary
<code>footnote</code> counter (see <a href="latex2e_13.html#Counters">Counters</a>).
</p>
<p>This puts the footnote at the bottom of the table, not the bottom of the
page.
</p>
<div class="example">
<pre class="example">\begin{center} % center the minipage on the line
\begin{minipage}{2.5in}
\begin{center} % center the table inside the minipage
\begin{tabular}{ll}
\textsc{Monarch} &\textsc{Reign} \\ \hline
Elizabeth II &63 years\footnote{to date} \\
Victoria &63 years \\
George III &59 years
\end{tabular}
\end{center}
\end{minipage}
\end{center}
</pre></div>
<p>If you nest minipages then there is an oddness when using footnotes.
Footnotes appear at the bottom of the text ended by the next
<code>\end{minipage}</code> which may not be their logical place.
</p>
<p>This puts a table containing data side by side with a map graphic. They
are vertically centered.
</p>
<div class="example">
<pre class="example">\newcommand*{\vcenteredhbox}[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}}
...
\begin{center}
\vcenteredhbox{\includegraphics[width=0.3\textwidth]{nyc.png}}
\hspace{0.1\textwidth}
\begin{minipage}{0.5\textwidth}
\begin{tabular}{r|l}
\multicolumn{1}{r}{Borough} &Pop (million) \\ \hline
The Bronx &$1.5$ \\
Brooklyn &$2.6$ \\
Manhattan &$1.6$ \\
Queens &$2.3$ \\
Staten Island &$0.5$
\end{tabular}
\end{minipage}
\end{center}
</pre></div>
<hr>
<a name="picture" class="anchor"></a>
<a name="picture-1" class="anchor"></a>
<h3 class="section"><code>picture</code></h3>
<a name="index-environment_002c-picture" class="anchor"></a>
<a name="index-picture-environment" class="anchor"></a>
<a name="index-creating-pictures" class="anchor"></a>
<a name="index-pictures_002c-creating" class="anchor"></a>
<p>Synopses:
</p><div class="example">
<pre class="example">\begin{picture}(<var>width</var>,<var>height</var>)
<var>picture commands</var>
\end{picture}
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">\begin{picture}(<var>width</var>,<var>height</var>)(<var>xoffset</var>,<var>yoffset</var>)
<var>picture commands</var>
\end{picture}
</pre></div>
<p>An environment to create simple pictures containing lines, arrows,
boxes, circles, and text. Note that while this environment is not
obsolete, new documents typically use much more powerful graphics
creation systems, such as <code>TikZ</code>, <code>PSTricks</code>, <code>MetaPost</code>,
or <code>Asymptote</code>. These are not covered in this document; see CTAN.
</p>
<p>This shows the parallelogram law for adding vectors.
</p>
<a name="index-_005cunitlength" class="anchor"></a>
<div class="example">
<pre class="example">\setlength{\unitlength}{1cm}
\begin{picture}(6,6) % picture box will be 6cm wide by 6cm tall
\put(0,0){\vector(2,1){4}} % for every 2 over this vector goes 1 up
\put(2,1){\makebox(0,0)[l]{\ first leg}}
\put(4,2){\vector(1,2){2}}
\put(5,4){\makebox(0,0)[l]{\ second leg}}
\put(0,0){\line(1,1){6}}
\put(3,3){\makebox(0,0)[r]{sum\ }}
\end{picture}
</pre></div>
<p>You can also use this environment to place arbitrary material at an
exact location.
</p>
<div class="example">
<pre class="example">\usepackage{color,graphicx} % in preamble
...
\begin{center}
\setlength{\unitlength}{\textwidth}
\begin{picture}(1,1) % leave space, \textwidth wide and tall
\put(0,0){\includegraphics[width=\textwidth]{desertedisland.jpg}}
\put(0.25,0.35){\textcolor{red}{X Treasure here}}
\end{picture}
\end{center}
</pre></div>
<p>The red X will be precisely a quarter of the <code>\linewidth</code> from
the left margin, and <code>0.35\linewidth</code> up from the bottom. Another
example of this usage is to put similar code in the page header to get
repeat material on each of a document’s pages.
</p>
<p>The <code>picture</code> environment has one required argument, a pair of
numbers (<var>width</var>,<var>height</var>). Multiply these by the value
<code>\unitlength</code> to get the nominal size of the output, the space that
LaTeX reserves on the output page. This nominal size need not be how
large the picture really is; LaTeX will draw things from the picture
outside the picture’s box.
</p>
<p>This environment also has an optional argument
(<var>xoffset</var>,<var>yoffset</var>). It is used to shift the origin. Unlike
most optional arguments, this one is not contained in square brackets.
As with the required argument, it consists of two real numbers.
Multiply these by <code>\unitlength</code> to get the point at the lower-left
corner of the picture.
</p>
<p>For example, if <code>\unitlength</code> has been set to <code>1mm</code>, the
command
</p>
<div class="example">
<pre class="example">\begin{picture}(100,200)(10,20)
</pre></div>
<p>produces a box of width 100 millimeters and height 200 millimeters. The
picture’s origin is the point (10mm,20mm) and so the lower-left corner
is there, and the upper-right corner is at (110mm,220mm). When you
first draw a picture you typically omit the optional argument, leaving
the origin at the lower-left corner. If you then want to modify your
picture by shifting everything, you can just add the appropriate
optional argument.
</p>
<a name="index-position_002c-in-picture" class="anchor"></a>
<p>Each <var>picture command</var> tells LaTeX where to put something by
naming its position. A <em>position</em> is a pair such as <code>(2.4,-5)</code>
giving the x- and y-coordinates. A <em>coordinate</em> is a not a length,
it is a real number (it may have a decimal point or a minus sign). It
specifies a length in multiples of the unit length <code>\unitlength</code>,
so if <code>\unitlength</code> has been set to <code>1cm</code>, then the coordinate
2.54 specifies a length of 2.54 centimeters.
</p>
<p>LaTeX’s default for <code>\unitlength</code> is <code>1pt</code>. it is a rigid
length (see <a href="latex2e_14.html#Lengths">Lengths</a>). Change it with the <code>\setlength</code> command
(see <a href="latex2e_14.html#g_t_005csetlength">\setlength</a>). Make this change only outside of a <code>picture</code>
environment.
</p>
<p>Coordinates are given with respect to an origin, which is normally at
the lower-left corner of the picture. Note that when a position appears
as an argument, as with <code>\put(1,2){...}</code>, it is not enclosed in
braces since the parentheses serve to delimit the argument. Also,
unlike in some computer graphics systems, larger y-coordinates are
further up the page.
</p>
<p>There are four ways to put things in a picture: <code>\put</code>,
<code>\multiput</code>, <code>\qbezier</code>, and <code>\graphpaper</code>. The most
often used is <code>\put</code>. This
</p>
<div class="example">
<pre class="example">\put(11.3,-0.3){...}
</pre></div>
<p>places the object with its reference point at coordinates
<em>(11.3,-0.3)</em>. The reference points for various objects will be
described below.
<a name="index-LR-box" class="anchor"></a>
The <code>\put</code> command creates an <em>LR box</em> (see <a href="latex2e_17.html#Modes">Modes</a>).
Anything that can go in an <code>\mbox</code> (see <a href="latex2e_20.html#g_t_005cmbox-_0026-_005cmakebox">\mbox & \makebox</a>) can
go in the text argument of the <code>\put</code> command. The reference point
will be the lower left corner of the box. In this picture
</p>
<div class="example">
<pre class="example">\setlength{\unitlength}{1cm}
...\begin{picture}(1,1)
\put(0,0){\line(1,0){1}}
\put(0,0){\line(1,1){1}}
\end{picture}
</pre></div>
<p>the three dots are just slightly left of the point of the angle formed
by the two lines. (Also, <code>\line(1,1){1}</code> does not call for a
line of length one; rather the line has a change in the x coordinate of
1.)
</p>
<p>The <code>\multiput</code>, <code>qbezier</code>, and <code>graphpaper</code> commands are
described below.
</p>
<p>This draws a rectangle with a wavy top, using <code>\qbezier</code> for
that curve.
</p>
<div class="example">
<pre class="example">\begin{picture}(3,1.5)
\put(0,0){\vector(1,0){8}} % x axis
\put(0,0){\vector(0,1){4}} % y axis
\put(2,0){\line(0,1){3}} % left side rectangle
\put(4,0){\line(0,1){3.5}} % right side
\qbezier(2,3)(2.5,2.9)(3,3.25)
\qbezier(3,3.25)(3.5,3.6)(4,3.5)
\thicklines % below here, lines are twice as thick
\put(2,3){\line(4,1){2}}
\put(4.5,2.5){\framebox{Trapezoidal Rule}}
\end{picture}
</pre></div>
<hr>
<a name="g_t_005cput" class="anchor"></a>
<a name="g_t_005cput-1" class="anchor"></a>
<h4 class="subsection"><code>\put</code></h4>
<a name="index-_005cput" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\put(<var>xcoord</var>,<var>ycoord</var>){<var>content</var>}
</pre></div>
<p>Place <var>content</var> at the coordinate (<var>xcoord</var>,<var>ycoord</var>). See
the discussion of coordinates and <code>\unitlength</code> in <a href="#picture">picture</a>.
The <var>content</var> is processed in LR mode (see <a href="latex2e_17.html#Modes">Modes</a>) so it cannot
contain line breaks.
</p>
<p>This includes the text into the <code>picture</code>.
</p>
<div class="example">
<pre class="example">\put(4.5,2.5){Apply the \textit{unpoke} move}
</pre></div>
<p>The reference point, the location (4.5,2.5), is the lower left of the
text, at the bottom left of the ‘<samp>A</samp>’.
</p>
<hr>
<a name="g_t_005cmultiput" class="anchor"></a>
<a name="g_t_005cmultiput-1" class="anchor"></a>
<h4 class="subsection"><code>\multiput</code></h4>
<a name="index-_005cmultiput" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\multiput(<var>x</var>,<var>y</var>)(<var>delta_x</var>,<var>delta_y</var>){<var>num-copies</var>}{<var>obj</var>}
</pre></div>
<p>Copy <var>obj</var> a total of <var>num-copies</var> times, with an increment of
<var>delta_x,delta_y</var>. The <var>obj</var> first appears at position
<em>(x,y)</em>, then at <em>(x+\delta_x,y+\delta_y)</em>, and so on.
</p>
<p>This draws a simple grid with every fifth line in bold (see also
<a href="#g_t_005cgraphpaper">\graphpaper</a>).
</p>
<div class="example">
<pre class="example">\begin{picture}(10,10)
\linethickness{0.05mm}
\multiput(0,0)(1,0){10}{\line(0,1){10}}
\multiput(0,0)(0,1){10}{\line(1,0){10}}
\linethickness{0.5mm}
\multiput(0,0)(5,0){3}{\line(0,1){10}}
\multiput(0,0)(0,5){3}{\line(1,0){10}}
\end{picture}
</pre></div>
<hr>
<a name="g_t_005cqbezier" class="anchor"></a>
<a name="g_t_005cqbezier-1" class="anchor"></a>
<h4 class="subsection"><code>\qbezier</code></h4>
<a name="index-_005cqbezier" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\qbezier(<var>x1</var>,<var>y1</var>)(<var>x2</var>,<var>y2</var>)(<var>x3</var>,<var>y3</var>)
\qbezier[<var>num</var>](<var>x1</var>,<var>y1</var>)(<var>x2</var>,<var>y2</var>)(<var>x3</var>,<var>y3</var>)
</pre></div>
<p>Draw a quadratic Bezier curve whose control points are given by the
three required arguments <code>(<var>x1</var>,<var>y1</var>)</code>,
<code>(<var>x2</var>,<var>y2</var>)</code>, and <code>(<var>x3</var>,<var>y3</var>)</code>. That is,
the curve runs from <var>(x1,y1)</var> to <var>(x3,y3)</var>, is quadratic, and is
such that the tangent line at <var>(x1,y1)</var> passes through
<var>(x2,y2)</var>, as does the tangent line at <var>(x3,y3)</var>.
</p>
<p>This draws a curve from the coordinate (1,1) to (1,0).
</p>
<div class="example">
<pre class="example">\qbezier(1,1)(1.25,0.75)(1,0)
</pre></div>
<p>The curve’s tangent line at (1,1) contains (1.25,0.75), as does the
curve’s tangent line at (1,0).
</p>
<p>The optional argument <var>num</var> gives the number of calculated
intermediate points. The default is to draw a smooth curve whose
maximum number of points is <code>\qbeziermax</code> (change this value with
<code>\renewcommand</code>).
</p>
<hr>
<a name="g_t_005cgraphpaper" class="anchor"></a>
<a name="g_t_005cgraphpaper-1" class="anchor"></a>
<h4 class="subsection"><code>\graphpaper</code></h4>
<a name="index-_005cgraphpaper" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\graphpaper(<var>x_init</var>,<var>y_init</var>)(<var>x_dimen</var>,<var>y_dimen</var>)
\graphpaper[<var>spacing</var>](<var>x_init</var>,<var>y_init</var>)(<var>x_dimen</var>,<var>y_dimen</var>)
</pre></div>
<p>Draw a coordinate grid. Requires the <code>graphpap</code> package.
The grid’s origin is <code>(<var>x_init</var>,<var>y_init</var>)</code>.
Grid lines come every <var>spacing</var> units (the default is 10).
The grid extends <var>x_dimen</var> units to the right and <var>y_dimen</var> units up.
All arguments must be positive integers.
</p>
<p>This make a grid with seven vertical lines and eleven horizontal lines.
</p>
<div class="example">
<pre class="example">\usepackage{graphpap} % in preamble
...
\begin{picture}(6,20) % in document body
\graphpaper[2](0,0)(12,20)
\end{picture}
</pre></div>
<p>The lines are numbered every ten units.
</p>
<hr>
<a name="g_t_005cline" class="anchor"></a>
<a name="g_t_005cline-1" class="anchor"></a>
<h4 class="subsection"><code>\line</code></h4>
<a name="index-_005cline" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\line(<var>x_run</var>,<var>y_rise</var>){<var>travel</var>}
</pre></div>
<p>Draw a line. It slopes such that it vertically rises <var>y_rise</var> for
every horizontal <var>x_run</var>. The <var>travel</var> is the total horizontal
change — it is not the length of the vector, it is the change in
<em>x</em>. In the special case of vertical lines, where
(<var>x_run</var>,<var>y_rise</var>)=(0,1), the <var>travel</var> gives the change in
<em>y</em>.
</p>
<p>This draws a line starting at coordinates (1,3).
</p>
<div class="example">
<pre class="example">\put(1,3){\line(2,5){4}}
</pre></div>
<p>For every over 2, this line will go up 5. Because <var>travel</var>
specifies that this goes over 4, it must go up 10. Thus its
endpoint is <em>(1,3)+(4,10)=(5,13)</em>. In particular, note that
<em><var>travel</var>=4</em> is not the length of the line, it is the change in
<em>x</em>.
</p>
<p>The arguments <var>x_run</var> and <var>y_rise</var> are integers that can be
positive, negative, or zero. (If both are 0 then LaTeX treats the
second as 1.) With
<code>\put(<var>x_init</var>,<var>y_init</var>){\line(<var>x_run</var>,<var>y_rise</var>){<var>travel</var>}}</code>,
if <var>x_run</var> is negative then the line’s ending point has a first
coordinate that is less than <var>x_init</var>. If <var>y_rise</var> is negative
then the line’s ending point has a second coordinate that is less than
<var>y_init</var>.
</p>
<p>If <var>travel</var> is negative then you get <code>LaTeX Error: Bad \line or
\vector argument.</code>
</p>
<a name="index-pict2e-package" class="anchor"></a>
<a name="index-graphics-packages" class="anchor"></a>
<a name="index-package_002c-pict2e" class="anchor"></a>
<a name="index-pict2e-package-1" class="anchor"></a>
<a name="index-package_002c-TikZ" class="anchor"></a>
<a name="index-TikZ-package" class="anchor"></a>
<a name="index-package_002c-PSTricks" class="anchor"></a>
<a name="index-PSTricks-package" class="anchor"></a>
<a name="index-package_002c-MetaPost" class="anchor"></a>
<a name="index-MetaPost-package" class="anchor"></a>
<a name="index-package_002c-Asymptote" class="anchor"></a>
<a name="index-Asymptote-package" class="anchor"></a>
<p>Standard LaTeX can only draw lines with a limited range of slopes
because these lines are made by putting together line segments from
pre-made fonts. The two numbers <var>x_run</var> and <var>y_rise</var> must have
integer values from -6 through 6. Also, they must be
relatively prime, so that <var>(x_run,y_rise)</var> can be (2,1) but not
(4,2) (if you choose the latter then instead of lines you get sequences
of arrowheads; the solution is to switch to the former). To get lines
of arbitrary slope and plenty of other shapes in a system like
<code>picture</code>, see the package <samp>pict2e</samp> on CTAN. Another solution
is to use a full-featured graphics system such as <samp>TikZ</samp>, or
<samp>PSTricks</samp>, or <samp>MetaPost</samp>, or <samp>Asymptote</samp>
</p>
<hr>
<a name="g_t_005clinethickness" class="anchor"></a>
<a name="g_t_005clinethickness-1" class="anchor"></a>
<h4 class="subsection"><code>\linethickness</code></h4>
<a name="index-_005clinethickness" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\linethickness{<var>dim</var>}
</pre></div>
<p>Declares the thickness of subsequent horizontal and vertical lines in a
picture to be <var>dim</var>, which must be a positive length
(see <a href="latex2e_14.html#Lengths">Lengths</a>). It differs from <code>\thinlines</code> and
<code>\thicklines</code> in that it does not affect the thickness of slanted
lines, circles, or ovals.
</p>
<hr>
<a name="g_t_005cthinlines" class="anchor"></a>
<a name="g_t_005cthinlines-1" class="anchor"></a>
<h4 class="subsection"><code>\thinlines</code></h4>
<a name="index-_005cthinlines" class="anchor"></a>
<p>Declaration to set the thickness of subsequent lines, circles, and ovals
in a picture environment to be 0.4pt. This is the default
thickness, so this command is unnecessary unless the thickness has been
changed with either <a href="#g_t_005clinethickness">\linethickness</a> or <a href="#g_t_005cthicklines">\thicklines</a>.
</p>
<hr>
<a name="g_t_005cthicklines" class="anchor"></a>
<a name="g_t_005cthicklines-1" class="anchor"></a>
<h4 class="subsection"><code>\thicklines</code></h4>
<a name="index-_005cthicklines" class="anchor"></a>
<p>Declaration to set the thickness of subsequent lines, circles, and ovals
in a picture environment to be 0.8pt. See also
<a href="#g_t_005clinethickness">\linethickness</a> and <a href="#g_t_005cthinlines">\thinlines</a>. This command is illustrated
in the Trapezoidal Rule example of <a href="#picture">picture</a>.
</p>
<hr>
<a name="g_t_005ccircle" class="anchor"></a>
<a name="g_t_005ccircle-1" class="anchor"></a>
<h4 class="subsection"><code>\circle</code></h4>
<a name="index-_005ccircle" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\circle{<var>diameter</var>}
\circle*{<var>diameter</var>}
</pre></div>
<p>Produces a circle with a diameter as close as possible to the specified
one. The <code>*</code> form produces a filled-in circle.
</p>
<p>This draws a circle of radius 6, centered at <code>(5,7)</code>.
</p>
<div class="example">
<pre class="example">\put(5,7){\circle{6}}
</pre></div>
<p>The available radii for <code>circle</code> are, in points, the even
numbers from 2 to 20, inclusive. For <code>circle*</code> they are all the
integers from 1 to 15.
</p>
<hr>
<a name="g_t_005coval" class="anchor"></a>
<a name="g_t_005coval-1" class="anchor"></a>
<h4 class="subsection"><code>\oval</code></h4>
<a name="index-_005coval" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\oval(<var>width</var>,<var>height</var>)
\oval(<var>width</var>,<var>height</var>)[<var>portion</var>]
</pre></div>
<p>Produce a rectangle with rounded corners. The optional argument
<var>portion</var> allows you to produce only half or a quarter of the oval.
For half an oval take <var>portion</var> to be one of these.
</p>
<dl compact="compact">
<dt><code>t</code></dt>
<dd><p>top half
</p></dd>
<dt><code>b</code></dt>
<dd><p>bottom half
</p></dd>
<dt><code>r</code></dt>
<dd><p>right half
</p></dd>
<dt><code>l</code></dt>
<dd><p>left half
</p></dd>
</dl>
<p>Produce only one quarter of the oval by setting <var>portion</var> to
<code>tr</code>, <code>br</code>, <code>bl</code>, or <code>tl</code>.
</p>
<p>This draws the top half of an oval that is 3 wide and 7 tall.
</p>
<div class="example">
<pre class="example">\put(5,7){\oval(3,7)[t]}
</pre></div>
<p>The (5,7) is the center of the entire oval, not just the center of the
top half.
</p>
<p>These shapes are not ellipses. They are rectangles whose corners are
made with quarter circles. These circles have a maximum radius of
20pt (see <a href="#g_t_005ccircle">\circle</a> for the sizes). Thus large ovals are just
boxes with a small amount of corner rounding.
</p>
<hr>
<a name="g_t_005cshortstack" class="anchor"></a>
<a name="g_t_005cshortstack-1" class="anchor"></a>
<h4 class="subsection"><code>\shortstack</code></h4>
<a name="index-_005cshortstack" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\shortstack[<var>position</var>]{<var>line 1</var> \\ ... }
</pre></div>
<p>Produce a vertical stack of objects.
</p>
<p>This labels the <em>y</em> axis.
</p>
<div class="example">
<pre class="example">\put(0,0){\vector(1,0){4}} % x axis
\put(0,0){\vector(0,1){2}} % y
\put(-0.25,2){\makebox[0][r]{\shortstack[r]{$y$\\ axis}}}
</pre></div>
<p>For a short stack, the reference point is the lower left of the stack.
In the above example the <a href="latex2e_20.html#g_t_005cmbox-_0026-_005cmakebox">\mbox & \makebox</a> puts the stack flush
right in a zero width box so in total the short stack sits slightly to
the left of the <em>y</em> axis.
</p>
<p>The valid positions are:
</p>
<dl compact="compact">
<dt><code>r</code></dt>
<dd><p>Make objects flush right
</p></dd>
<dt><code>l</code></dt>
<dd><p>Make objects flush left
</p></dd>
<dt><code>c</code></dt>
<dd><p>Center objects (default)
</p></dd>
</dl>
<a name="index-_005c_005c-_0028for-_005cshortstack-objects_0029" class="anchor"></a>
<p>Separate objects into lines with <code>\\</code>. These stacks are short in
that, unlike in a <code>tabular</code> or <code>array</code> environment, here the
rows are not spaced out to be of even heights. Thus, in
<code>\shortstack{X\\o\\o\\X}</code> the first and last rows are taller than
the middle two. You can adjust row heights either by putting in the
usual interline spacing with <code>\shortstack{X\\ \strut o\\o\\X}</code>,
or by hand, via an explicit zero-width box <code>\shortstack{X \\
\rule{0pt}{12pt} o\\o\\X}</code> or by using <code>\\</code>’s optional
argument <code>\shortstack{X\\[2pt] o\\o\\X}</code>.
</p>
<p>The <code>\shortstack</code> command is also available outside the
<code>picture</code> environment.
</p>
<hr>
<a name="g_t_005cvector" class="anchor"></a>
<a name="g_t_005cvector-1" class="anchor"></a>
<h4 class="subsection"><code>\vector</code></h4>
<a name="index-_005cvector" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\vector(<var>x_run</var>,<var>y_rise</var>){<var>travel</var>}
</pre></div>
<p>Draw a line ending in an arrow. The slope of that line is: it
vertically rises <var>y_rise</var> for every horizontal <var>x_run</var>. The
<var>travel</var> is the total horizontal change — it is not the
length of the vector, it is the change in <em>x</em>. In the special case
of vertical vectors, if (<var>x_run</var>,<var>y_rise</var>)=(0,1), then
<var>travel</var> gives the change in <em>y</em>.
</p>
<p>For an example see <a href="#picture">picture</a>.
</p>
<p>For elaboration on <var>x_run</var> and <var>y_rise</var> see <a href="#g_t_005cline">\line</a>. As
there, the values of <var>x_run</var> and <var>y_rise</var> are limited. For
<code>\vector</code> you must chooses integers between -4 and 4,
inclusive. Also, the two you choose must be relatively prime. Thus,
<code>\vector(2,1){4}</code> is acceptable but <code>\vector(4,2){4}</code> is
not (if you use the latter then you get a sequence of arrowheads).
</p>
<hr>
<a name="g_t_005cmakebox-_0028picture_0029" class="anchor"></a>
<a name="g_t_005cmakebox-_0028picture_0029-1" class="anchor"></a>
<h4 class="subsection"><code>\makebox</code> (picture)</h4>
<a name="index-_005cmakebox-_0028for-picture_0029" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\makebox(<var>rec-width</var>,<var>rec-height</var>){<var>text</var>}
\makebox(<var>rec-width</var>,<var>rec-height</var>)[<var>position</var>]{<var>text</var>}
</pre></div>
<p>Make a box to hold <var>text</var>. This command fits with the
<code>picture</code> environment, although you can use it outside of there,
because <var>rec-width</var> and <var>rec-height</var> are numbers specifying
distances in terms of the <code>\unitlength</code> (see <a href="#picture">picture</a>). This
command is similar to the normal <code>\makebox</code> command (see <a href="latex2e_20.html#g_t_005cmbox-_0026-_005cmakebox">\mbox & \makebox</a>) except here that you must specify the width and height. This
command is fragile (see <a href="latex2e_12.html#g_t_005cprotect">\protect</a>).
</p>
<p>This makes a box of length 3.5 times <code>\unitlength</code> and height 4
times <code>\unitlength</code>.
</p>
<div class="example">
<pre class="example">\put(1,2){\makebox(3.5,4){...}}
</pre></div>
<p>The optional argument <code><var>position</var></code> specifies where in the box
the <var>text</var> appears. The default is to center it, both horizontally
and vertically. To place it somewhere else, use a string with one or
two of these letters.
</p>
<dl compact="compact">
<dt><code>t</code></dt>
<dd><p>Puts <var>text</var> the top of the box.
</p>
</dd>
<dt><code>b</code></dt>
<dd><p>Put <var>text</var> at the bottom.
</p>
</dd>
<dt><code>l</code></dt>
<dd><p>Put <var>text</var> on the left.
</p>
</dd>
<dt><code>r</code></dt>
<dd><p>Put <var>text</var> on the right.
</p>
</dd>
</dl>
<hr>
<a name="g_t_005cframebox-_0028picture_0029" class="anchor"></a>
<a name="g_t_005cframebox-_0028picture_0029-1" class="anchor"></a>
<h4 class="subsection"><code>\framebox</code> (picture)</h4>
<a name="index-_005cframebox" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\framebox(<var>rec-width</var>,<var>rec-height</var>){<var>text</var>}
\framebox(<var>rec-width</var>,<var>rec-height</var>)[<var>position</var>]{<var>text</var>}
</pre></div>
<p>This is the same as <a href="#g_t_005cmakebox-_0028picture_0029">\makebox (picture)</a> except that it puts a frame
around the outside of the box that it creates. The reference point is
the bottom left corner of the frame. This command fits with the
<code>picture</code> environment, although you can use it outside of there,
because lengths are numbers specifying the distance in terms of the
<code>\unitlength</code> (see <a href="#picture">picture</a>). This command is fragile
(see <a href="latex2e_12.html#g_t_005cprotect">\protect</a>).
</p>
<p>This example creates a frame 2.5 inches by 3 inches and puts
the text in the center.
</p>
<div class="example">
<pre class="example">\setlength{\unitlength}{1in}
\framebox(2.5,3){test text}
</pre></div>
<p>The required arguments are that the rectangle has overall width
<var>rect-width</var> units and height <var>rect-height</var> units.
</p>
<p>The optional argument <var>position</var> specifies the position of
<var>text</var>; see <a href="#g_t_005cmakebox-_0028picture_0029">\makebox (picture)</a> for the values that it can
take.
</p>
<a name="index-_005cfboxrule-1" class="anchor"></a>
<a name="index-_005cfboxsep-1" class="anchor"></a>
<p>The rule has thickness <code>\fboxrule</code> and there is a blank space
<code>\fboxsep</code> between the frame and the contents of the box.
</p>
<p>For this command, you must specify the <var>width</var> and <var>height</var>. If
you want to just put a frame around some contents whose dimension is
determined in some other way then either use <code>\fbox</code> (see <a href="latex2e_20.html#g_t_005cfbox-_0026-_005cframebox">\fbox & \framebox</a>) or <code>\frame</code> (see <a href="#g_t_005cframe">\frame</a>).
</p>
<hr>
<a name="g_t_005cframe" class="anchor"></a>
<a name="g_t_005cframe-1" class="anchor"></a>
<h4 class="subsection"><code>\frame</code></h4>
<a name="index-_005cframe" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\frame{<var>contents</var>}
</pre></div>
<p>Puts a rectangular frame around <var>contents</var>. The reference point is
the bottom left corner of the frame. In contrast to <code>\framebox</code>
(see <a href="#g_t_005cframebox-_0028picture_0029">\framebox (picture)</a>), this command puts no extra space is put
between the frame and the object. It is fragile (see <a href="latex2e_12.html#g_t_005cprotect">\protect</a>).
</p>
<hr>
<a name="g_t_005cdashbox" class="anchor"></a>
<a name="g_t_005cdashbox-1" class="anchor"></a>
<h4 class="subsection"><code>\dashbox</code></h4>
<a name="index-_005cdashbox" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\dashbox{<var>dash-len</var>}(<var>rect-width</var>,<var>rect-height</var>){<var>text</var>}
\dashbox{<var>dash-len</var>}(<var>rect-width</var>,<var>rect-height</var>)[<var>position</var>]{<var>text</var>}
</pre></div>
<p>Create a dashed rectangle around <var>text</var>. This command fits with the
<code>picture</code> environment, although you can use it outside of there,
because lengths are numbers specifying the distance in terms of the
<code>\unitlength</code> (see <a href="#picture">picture</a>).
</p>
<p>The required arguments are: dashes are <var>dash-len</var> units long, with
the same length gap, and the rectangle has overall width
<var>rect-width</var> units and height <var>rect-height</var> units.
</p>
<p>The optional argument <var>position</var> specifies the position of
<var>text</var>; see <a href="#g_t_005cmakebox-_0028picture_0029">\makebox (picture)</a> for the values that it can
take.
</p>
<p>This shows that you can use non-integer value for <var>dash-len</var>.
</p>
<div class="example">
<pre class="example">\put(0,0){\dashbox{0.1}(5,0.5){My hovercraft is full of eels.}}
</pre></div>
<p>Each dash will be <code>0.1\unitlength</code> long, the box’s width is
<code>5\unitlength</code> and its height is <code>0.5\unitlength</code>.
</p>
<p>As in that example, a dashed box looks best when <var>rect-width</var> and
<var>rect-height</var> are multiples of the <var>dash-len</var>.
</p>
<hr>
<a name="quotation-_0026-quote" class="anchor"></a>
<a name="quotation-_0026-quote-1" class="anchor"></a>
<h3 class="section"><code>quotation</code> & <code>quote</code></h3>
<a name="index-environment_002c-quotation" class="anchor"></a>
<a name="index-quotation-environment" class="anchor"></a>
<a name="index-quoted-text-with-paragraph-indentation_002c-displaying" class="anchor"></a>
<a name="index-displaying-quoted-text-with-paragraph-indentation" class="anchor"></a>
<a name="index-paragraph-indentations-in-quoted-text" class="anchor"></a>
<a name="index-environment_002c-quote" class="anchor"></a>
<a name="index-quote-environment" class="anchor"></a>
<a name="index-quoted-text-without-paragraph-indentation_002c-displaying" class="anchor"></a>
<a name="index-displaying-quoted-text-without-paragraph-indentation" class="anchor"></a>
<a name="index-paragraph-indentations-in-quoted-text_002c-omitting" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{quotation}
<var>text</var>
\end{quotation}
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">\begin{quote}
<var>text</var>
\end{quote}
</pre></div>
<p>Include a quotation. Both environments indent margins on both sides by
<code>\leftmargin</code> and the text is right-justified.
</p>
<p>They differ in how they treat paragraphs. In the <code>quotation</code>
environment, paragraphs are indented by 1.5em and the space
between paragraphs is small, <code>0pt plus 1pt</code>. In the <code>quote</code>
environment, paragraphs are not indented and there is vertical space
between paragraphs (it is the rubber length <code>\parsep</code>).
</p>
<div class="example">
<pre class="example">\begin{quotation} \small\it
Four score and seven years ago
... shall not perish from the earth.
\hspace{1em plus 1fill}---Abraham Lincoln
\end{quotation}
</pre></div>
<hr>
<a name="tabbing" class="anchor"></a>
<a name="tabbing-1" class="anchor"></a>
<h3 class="section"><code>tabbing</code></h3>
<a name="index-environment_002c-tabbing" class="anchor"></a>
<a name="index-tabbing-environment" class="anchor"></a>
<a name="index-tab-stops_002c-using" class="anchor"></a>
<a name="index-lining-text-up-using-tab-stops" class="anchor"></a>
<a name="index-alignment-via-tabbing" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{tabbing}
<var>row1col1</var> \= <var>row1col2</var> ... \\
<var>row2col1</var> \> <var>row2col2</var> ... \\
...
\end{tabbing}
</pre></div>
<p>Align text in columns, by setting tab stops and tabbing to them much as
was done on a typewriter. This is less often used than the environments
<code>tabular</code> (see <a href="#tabular">tabular</a>) or <code>array</code> (see <a href="#array">array</a>) because
in those the width of each column need not be constant and need not be
known in advance.
</p>
<p>This example has a first line where the tab stops are set to explicit
widths, ended by a <code>\kill</code> command (which is described below):
</p>
<div class="example">
<pre class="example">\begin{tabbing}
\hspace{0.75in} \= \hspace{0.40in} \= \hspace{0.40in} \kill
Ship \> Guns \> Year \\
\textit{Sophie} \> 14 \> 1800 \\
\textit{Polychrest} \> 24 \> 1803 \\
\textit{Lively} \> 38 \> 1804 \\
\textit{Surprise} \> 28 \> 1805 \\
\end{tabbing}
</pre></div>
<p>Both the <code>tabbing</code> environment and the more widely-used
<code>tabular</code> environment put text in columns. The most important
distinction is that in <code>tabular</code> the width of columns is
determined automatically by LaTeX, while in <code>tabbing</code> the user
sets the tab stops. Another distinction is that <code>tabular</code>
generates a box, but <code>tabbing</code> can be broken across pages.
Finally, while <code>tabular</code> can be used in any mode, <code>tabbing</code>
can be used only in paragraph mode and it starts a new paragraph.
</p>
<p>A <code>tabbing</code> environment always starts a new paragraph, without
indentation. Moreover, as shown in the example above, there is no need
to use the starred form of the <code>\hspace</code> command at the beginning
of a tabbed row. The right margin of the <code>tabbing</code> environment is
the end of line, so that the width of the environment is
<code>\linewidth</code>.
</p>
<a name="index-row_002c-tabbing" class="anchor"></a>
<p>The <code>tabbing</code> environment contains a sequence of <em>tabbed
rows</em>. The first tabbed row begins immediately after
<code>\begin{tabbing}</code> and each row ends with <code>\\</code> or
<code>\kill</code>. The last row may omit the <code>\\</code> and end with just
<code>\end{tabbing}</code>.
</p>
<p>At any point the <code>tabbing</code> environment has a current tab stop
pattern, a sequence of <em><var>n</var> > 0</em> tab stops, numbered 0, 1,
etc. These create <var>n</var> corresponding columns. Tab stop 0 is
always the left margin, defined by the enclosing environment. Tab
stop number <var>i</var> is set if it is assigned a horizontal
position on the page. Tab stop number <var>i</var> can only be set if
all the stops 0, …, <em>i-1</em> have already been set; normally
later stops are to the right of earlier ones.
</p>
<p>By default any text typeset in a <code>tabbing</code> environment is typeset
ragged right and left-aligned on the current tab stop. Typesetting is
done in LR mode (see <a href="latex2e_17.html#Modes">Modes</a>).
</p>
<p>The following commands can be used inside a <code>tabbing</code> environment.
They are all fragile (see <a href="latex2e_12.html#g_t_005cprotect">\protect</a>).
</p>
<dl compact="compact">
<dt><code>\\ <span class="roman">(tabbing)</span></code>
<a name="index-_005c_005c-_0028tabbing_0029" class="anchor"></a>
</dt>
<dd><p>End a tabbed line and typeset it.
</p>
</dd>
<dt><code>\= <span class="roman">(tabbing)</span></code>
<a name="index-_005c_003d-_0028tabbing_0029" class="anchor"></a>
</dt>
<dd><p>Sets a tab stop at the current position.
</p>
</dd>
<dt><code>\> <span class="roman">(tabbing)</span></code>
<a name="index-_005c_003e-_0028tabbing_0029" class="anchor"></a>
</dt>
<dd><a name="index-_005c_003e" class="anchor"></a>
<p>Advances to the next tab stop.
</p>
</dd>
<dt><code>\<</code>
<a name="index-_005c_003c" class="anchor"></a>
</dt>
<dd><p>Put following text to the left of the local margin (without changing
the margin). Can only be used at the start of the line.
</p>
</dd>
<dt><code>\+</code>
<a name="index-_005c_002b" class="anchor"></a>
</dt>
<dd><p>Moves the left margin of the next and all the
following commands one tab stop to the right, beginning tabbed line if
necessary.
</p>
</dd>
<dt><code>\-</code>
<a name="index-_005c_002d" class="anchor"></a>
</dt>
<dd><p>Moves the left margin of the next and all the
following commands one tab stop to the left, beginning tabbed line if
necessary.
</p>
</dd>
<dt><code>\' <span class="roman">(tabbing)</span></code>
<a name="index-_005c_0027-_0028tabbing_0029" class="anchor"></a>
</dt>
<dd><p>Moves everything that you have typed so far in the current column, i.e.,
everything from the most recent <code>\></code>, <code>\<</code>, <code>\'</code>,
<code>\\</code>, or <code>\kill</code> command, to the previous column and aligned
to the right, flush against the current column’s tab stop.
</p>
</dd>
<dt><code>\` <span class="roman">(tabbing)</span></code>
<a name="index-_005c_0060-_0028tabbing_0029" class="anchor"></a>
</dt>
<dd><p>Allows you to put text flush right against any tab stop, including tab
stop 0. However, it can’t move text to the right of the last
column because there’s no tab stop there. The <code>\`</code> command moves
all the text that follows it, up to the <code>\\</code> or
<code>\end{tabbing}</code> command that ends the line, to the right margin
of the <code>tabbing</code> environment. There must be no <code>\></code> or
<code>\'</code> command between the <code>\`</code> and the <code>\\</code> or
<code>\end{tabbing}</code> command that ends the line.
</p>
</dd>
<dt><code>\a <span class="roman">(tabbing)</span></code>
<a name="index-_005ca-_0028tabbing_0029" class="anchor"></a>
</dt>
<dd><a name="index-_005ca_0027-_0028acute-accent-in-tabbing_0029" class="anchor"></a>
<a name="index-_005ca_0060-_0028grave-accent-in-tabbing_0029" class="anchor"></a>
<a name="index-_005ca_003d-_0028macron-accent-in-tabbing_0029" class="anchor"></a>
<p>In a <code>tabbing</code> environment, the commands <code>\=</code>, <code>\'</code> and
<code>\`</code> do not produce accents as usual (see <a href="latex2e_23.html#Accents">Accents</a>). Instead,
use the commands <code>\a=</code>, <code>\a'</code> and <code>\a`</code>.
</p>
</dd>
<dt><code>\kill</code>
<a name="index-_005ckill" class="anchor"></a>
</dt>
<dd><p>Sets tab stops without producing text. Works just like <code>\\</code> except
that it throws away the current line instead of producing output for it.
Any <code>\=</code>, <code>\+</code> or <code>\-</code> commands in that line remain in
effect.
</p>
</dd>
<dt><code>\poptabs</code>
<a name="index-_005cpoptabs" class="anchor"></a>
</dt>
<dd><a name="index-_005cpoptabs-1" class="anchor"></a>
<p>Restores the tab stop positions saved by the last <code>\pushtabs</code>.
</p>
</dd>
<dt><code>\pushtabs</code>
<a name="index-_005cpushtabs" class="anchor"></a>
</dt>
<dd><p>Saves all current tab stop positions. Useful for temporarily changing
tab stop positions in the middle of a <code>tabbing</code> environment.
</p>
</dd>
<dt><code>\tabbingsep</code>
<a name="index-_005ctabbingsep" class="anchor"></a>
</dt>
<dd><p>Distance of the text moved by <code>\'</code> to left of current tab stop.
</p>
</dd>
</dl>
<p>This example typesets a Pascal function:
</p>
<div class="example">
<pre class="example">\begin{tabbing}
function \= fact(n : integer) : integer;\\
\> begin \= \+ \\
\> if \= n > 1 then \+ \\
fact := n * fact(n-1) \- \\
else \+ \\
fact := 1; \-\- \\
end;\\
\end{tabbing}
</pre></div>
<p>The output looks like this.
</p>
<div class="example">
<pre class="example">function fact(n : integer) : integer;
begin
if n > 1 then
fact := n * fact(n-1);
else
fact := 1;
end;
</pre></div>
<a name="index-package_002c-algorithm2e" class="anchor"></a>
<a name="index-algorithm2e-package" class="anchor"></a>
<a name="index-package_002c-listings" class="anchor"></a>
<a name="index-listings-package" class="anchor"></a>
<a name="index-package_002c-minted" class="anchor"></a>
<a name="index-minted-package" class="anchor"></a>
<a name="index-package_002c-fancyvrb" class="anchor"></a>
<a name="index-fancyvrb-package" class="anchor"></a>
<p>This example is just for illustration of the environment. To actually
typeset computer code in typewriter like this, a verbatim environment
(see <a href="#verbatim">verbatim</a>) would normally be best. For pretty-printed code,
there are quite a few packages, including <code>algorithm2e</code>,
<code>fancyvrb</code>, <code>listings</code>, and <code>minted</code>.
</p>
<hr>
<a name="table" class="anchor"></a>
<a name="table-1" class="anchor"></a>
<h3 class="section"><code>table</code></h3>
<a name="index-environment_002c-table" class="anchor"></a>
<a name="index-table-environment" class="anchor"></a>
<a name="index-tables_002c-creating" class="anchor"></a>
<a name="index-creating-tables" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{table}[<var>placement</var>]
<var>table body</var>
\caption[<var>loftitle</var>]{<var>title</var>} % optional
\label{<var>label}</var> % also optional
\end{table}
</pre></div>
<p>A class of floats (see <a href="latex2e_5.html#Floats">Floats</a>). They cannot be split across pages
and so they are not typeset in sequence with the normal text but instead
are floated to a convenient place, such as the top of a following page.
</p>
<p>This example <code>table</code> environment contains a <code>tabular</code>
</p>
<div class="example">
<pre class="example">\begin{table}
\centering\small
\begin{tabular}{ll}
\multicolumn{1}{c}{\textit{Author}}
&\multicolumn{1}{c}{\textit{Piece}} \\ \hline
Bach &Cello Suite Number 1 \\
Beethoven &Cello Sonata Number 3 \\
Brahms &Cello Sonata Number 1
\end{tabular}
\caption{Top cello pieces}
\label{tab:cello}
\end{table}
</pre></div>
<p>but you can put many different kinds of content in a <code>table</code>,
including text, LaTeX commands, etc.
</p>
<p>For the possible values of <var>placement</var> and their effect on the
float placement algorithm, see <a href="latex2e_5.html#Floats">Floats</a>.
</p>
<p>The table body is typeset in a <code>parbox</code> of width <code>\textwidth</code>.
It can contain text, commands, graphics, etc.
</p>
<p>The label is optional; it is used for cross references (see <a href="latex2e_7.html#Cross-references">Cross references</a>).
<a name="index-_005ccaption-1" class="anchor"></a>
The <code>\caption</code> command is also optional. It specifies caption text
for the table. By default it is numbered. If its optional
<var>lottitle</var> is present then that text is used in the list of tables
instead of <var>title</var> (see <a href="latex2e_25.html#Table-of-contents-etc_002e">Table of contents etc.</a>).
</p>
<p>In this example the table and caption will float to the bottom of a page,
unless it is pushed to a float page at the end.
</p>
<div class="example">
<pre class="example">\begin{table}[b]
\centering
\begin{tabular}{r|p{2in}} \hline
One &The loneliest number \\
Two &Can be as sad as one.
It's the loneliest number since the number one.
\end{tabular}
\caption{Cardinal virtues}
\label{tab:CardinalVirtues}
\end{table}
</pre></div>
<hr>
<a name="tabular" class="anchor"></a>
<a name="tabular-1" class="anchor"></a>
<h3 class="section"><code>tabular</code></h3>
<a name="index-environment_002c-tabular" class="anchor"></a>
<a name="index-tabular-environment" class="anchor"></a>
<a name="index-lines-in-tables" class="anchor"></a>
<a name="index-lining-text-up-in-tables" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{tabular}[<var>pos</var>]{<var>cols</var>}
<var>column 1 entry</var> &<var>column 2 entry</var> ... &<var>column n entry</var> \\
...
\end{tabular}
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">\begin{tabular*}{<var>width</var>}[<var>pos</var>]{<var>cols</var>}
<var>column 1 entry</var> &<var>column 2 entry</var> ... &<var>column n entry</var> \\
...
\end{tabular*}
</pre></div>
<p>Produce a table, a box consisting of a sequence of horizontal rows.
Each row consists of items that are aligned vertically in columns. This
illustrates many of the features.
</p>
<div class="example">
<pre class="example">\begin{tabular}{l|l}
\textit{Player name} &\textit{Career home runs} \\
\hline
Hank Aaron &755 \\
Babe Ruth &714
\end{tabular}
</pre></div>
<p>The output will have two left-aligned columns with a vertical bar
between them. This is specified in <code>tabular</code>’s argument
<code>{l|l}</code>.
<a name="index-_0026" class="anchor"></a>
Put the entries into different columns by separating them with an
ampersand, <code>&</code>. The end of each row is marked with a double
backslash, <code>\\</code>. Put a horizontal rule below a row, after a double
backslash, with <code>\hline</code>.
<a name="index-_005c_005c-for-tabular" class="anchor"></a>
After the last row the <code>\\</code> is optional, unless an <code>\hline</code>
command follows to put a rule below the table.
</p>
<p>The required and optional arguments to <code>tabular</code> consist of:
</p>
<dl compact="compact">
<dt><var>pos</var></dt>
<dd><p>Optional. Specifies the table’s vertical position. The default is to
align the table so its vertical center matches the baseline of the
surrounding text. There are two other possible alignments: <code>t</code>
aligns the table so its top row matches the baseline of the surrounding
text, and <code>b</code> aligns on the bottom row.
</p>
<p>This only has an effect if there is other text. In the common case of a
<code>tabular</code> alone in a <code>center</code> environment this option makes
no difference.
</p>
</dd>
<dt><var>cols</var></dt>
<dd><p>Required. Specifies the formatting of columns. It consists of a
sequence of the following specifiers, corresponding to the types of
column and intercolumn material.
</p>
<dl compact="compact">
<dt><code>l</code></dt>
<dd><p>A column of left-aligned items.
</p>
</dd>
<dt><code>r</code></dt>
<dd><p>A column of right-aligned items.
</p>
</dd>
<dt><code>c</code></dt>
<dd><p>A column of centered items.
</p>
</dd>
<dt><code>|</code></dt>
<dd><p>A vertical line the full height and depth of the environment.
</p>
</dd>
<dt><code>@{<var>text or space</var>}</code></dt>
<dd><p>Insert <var>text or space</var> at this location in every row. The <var>text
or space</var> material is typeset in LR mode. This text is fragile
(see <a href="latex2e_12.html#g_t_005cprotect">\protect</a>).
</p>
<p>If between two columns there is no @-expression then LaTeX’s
<code>book</code>, <code>article</code>, and <code>report</code> classes will put on
either side of each column a space of length <code>\tabcolsep</code>, which by
default is 6pt. That is, by default adjacent columns are
separated by 12pt (so <code>\tabcolsep</code> is misleadingly named
since it is only half of the separation between tabular columns). In
addition, a space of 6pt also comes before the first column and
after the final column, unless you put a <code>@{...}</code> or <code>|</code>
there.
</p>
<p>If you override the default and use an @-expression then LaTeX does
not insert <code>\tabcolsep</code> so you must insert any desired space
yourself, as in <code>@{\hspace{1em}}</code>.
</p>
<p>An empty expression <code>@{}</code> will eliminate the space. In
particular, sometimes you want to eliminate the space before the first
column or after the last one, as in the example below where the
tabular lines need to lie on the left margin.
</p>
<div class="example">
<pre class="example">\begin{flushleft}
\begin{tabular}{@{}l}
...
\end{tabular}
\end{flushleft}
</pre></div>
<p>The next example shows text, a decimal point between the columns,
arranged so the numbers in the table are aligned on it.
</p>
<div class="example">
<pre class="example">\begin{tabular}{r@{$.$}l}
$3$ &$14$ \\
$9$ &$80665$
\end{tabular}
</pre></div>
<a name="index-_005cextracolsep" class="anchor"></a>
<p>An <code>\extracolsep{<var>wd</var>}</code> command in an @-expression causes an
extra space of width <var>wd</var> to appear to the left of all subsequent
columns, until countermanded by another <code>\extracolsep</code>. Unlike
ordinary intercolumn space, this extra space is not suppressed by an
@-expression. An <code>\extracolsep</code> command can be used only in an
@-expression in the <code>cols</code> argument. Below, LaTeX inserts the
right amount of intercolumn space to make the entire table 4 inches
wide.
</p>
<div class="example">
<pre class="example">\begin{tabular*}{4in}{l@{\extracolsep{\fill}}l}
Seven times down, eight times up \ldots
&such is life!
\end{tabular*}
</pre></div>
<p>To insert commands that are automatically executed before a given
column, load the <code>array</code> package and use the <code>>{...}</code>
specifier.
</p>
</dd>
<dt><code>p{<var>wd</var>}</code></dt>
<dd><p>Each item in the column is typeset in a parbox of width <var>wd</var>, as if
it were the argument of a <code>\parbox[t]{wd}{...}</code> command.
</p>
<p>A line break double backslash <code>\\</code> may not appear in the item,
except inside an environment like <code>minipage</code>, <code>array</code>, or
<code>tabular</code>, or inside an explicit <code>\parbox</code>, or in the scope of
a <code>\centering</code>, <code>\raggedright</code>, or <code>\raggedleft</code>
declaration (when used in a <code>p</code>-column element these declarations
must appear inside braces, as with <code>{\centering .. \\
..}</code>). Otherwise LaTeX will misinterpret the double backslash as
ending the row. Instead, to get a line break in there use
<code>\newline</code> (see <a href="latex2e_9.html#g_t_005cnewline">\newline</a>).
</p>
</dd>
<dt><code>*{<var>num</var>}{<var>cols</var>}</code></dt>
<dd><p>Equivalent to <var>num</var> copies of <var>cols</var>, where <var>num</var> is a
positive integer and <var>cols</var> is a list of specifiers. Thus the
specifier <code>\begin{tabular}{|*{3}{l|r}|}</code> is equivalent to
the specifier <code>\begin{tabular}{|l|rl|rl|r|}</code>. Note that
<var>cols</var> may contain another <code>*</code>-expression.
</p>
</dd>
</dl>
</dd>
<dt><var>width</var></dt>
<dd><p>Required for <code>tabular*</code>, not allowed for <code>tabular</code>. Specifies
the width of the <code>tabular*</code> environment. The space between columns
should be rubber, as with <code>@{\extracolsep{\fill}}</code>, to allow
the table to stretch or shrink to make the specified width, or else you
are likely to get the <code>Underfull \hbox (badness 10000) in alignment
...</code> warning.
</p>
</dd>
</dl>
<p>Parameters that control formatting:
</p>
<dl compact="compact">
<dt><code>\arrayrulewidth</code>
<a name="index-_005carrayrulewidth" class="anchor"></a>
</dt>
<dd><a name="tabular-arrayrulewidth" class="anchor"></a><p>A length that is the thickness of the rule created by <code>|</code>,
<code>\hline</code>, and <code>\vline</code> in the <code>tabular</code> and <code>array</code>
environments. The default is ‘<samp>.4pt</samp>’. Change it as in
<code>\setlength{\arrayrulewidth}{0.8pt}</code>.
</p>
</dd>
<dt><code>\arraystretch</code>
<a name="index-_005carraystretch" class="anchor"></a>
</dt>
<dd><a name="tabular-arraystrech" class="anchor"></a><p>A factor by which the spacing between rows in the <code>tabular</code> and
<code>array</code> environments is multiplied. The default is ‘<samp>1</samp>’, for
no scaling. Change it as <code>\renewcommand{\arraystretch}{1.2}</code>.
</p>
</dd>
<dt><code>\doublerulesep</code>
<a name="index-_005cdoublerulesep" class="anchor"></a>
</dt>
<dd><a name="tabular-doublerulesep" class="anchor"></a><p>A length that is the distance between the vertical rules produced by the
<code>||</code> specifier. The default is ‘<samp>2pt</samp>’.
</p>
</dd>
<dt><code>\tabcolsep</code>
<a name="index-_005ctabcolsep" class="anchor"></a>
</dt>
<dd><a name="tabular-tabcolsep" class="anchor"></a><p>A length that is half of the space between columns. The default is
‘<samp>6pt</samp>’. Change it with <code>\setlength</code>.
</p>
</dd>
</dl>
<p>The following commands can be used inside the body of a <code>tabular</code>
environment, the first two inside an entry and the second two between
lines:
</p>
<hr>
<a name="g_t_005cmulticolumn" class="anchor"></a>
<a name="g_t_005cmulticolumn-1" class="anchor"></a>
<h4 class="subsection"><code>\multicolumn</code></h4>
<a name="index-_005cmulticolumn" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\multicolumn{<var>numcols</var>}{<var>cols</var>}{<var>text</var>}
</pre></div>
<p>Make an <code>array</code> or <code>tabular</code> entry that spans several columns.
The first argument <var>numcols</var> gives the number of columns to span.
The second argument <var>cols</var> specifies the formatting of the entry,
with <code>c</code> for centered, <code>l</code> for flush left, or <code>r</code> for
flush right. The third argument <var>text</var> gives the contents of that
entry.
</p>
<p>In this example, in the first row, the second and third columns are
spanned by the single heading ‘<samp>Name</samp>’.
</p>
<div class="example">
<pre class="example">\begin{tabular}{lccl}
\textit{ID} &\multicolumn{2}{c}{\textit{Name}} &\textit{Age} \\
\hline
978-0-393-03701-2 &O'Brian &Patrick &55 \\
...
\end{tabular}
</pre></div>
<p>What counts as a column is: the column format specifier for the
<code>array</code> or <code>tabular</code> environment is broken into parts, where
each part (except the first) begins with <code>l</code>, <code>c</code>, <code>r</code>,
or <code>p</code>. So from <code>\begin{tabular}{|r|ccp{1.5in}|}</code>
the parts are <code>|r|</code>, <code>c</code>, <code>c</code>,
and <code>p{1.5in}|</code>.
</p>
<p>The <var>cols</var> argument overrides the <code>array</code> or <code>tabular</code>
environment’s intercolumn area default adjoining this multicolumn
entry. To affect that area, this argument can contain vertical bars
<code>|</code> indicating the placement of vertical rules, and <code>@{...}</code>
expressions. Thus if <var>cols</var> is ‘<samp>|c|</samp>’ then this multicolumn
entry will be centered and a vertical rule will come in the intercolumn
area before it and after it. This table details the exact behavior.
</p>
<div class="example">
<pre class="example">\begin{tabular}{|cc|c|c|}
\multicolumn{1}{r}{w} % entry one
&\multicolumn{1}{|r|}{x} % entry two
&\multicolumn{1}{|r}{y} % entry three
&z % entry four
\end{tabular}
</pre></div>
<p>Before the first entry the output will not have a vertical rule because
the <code>\multicolumn</code> has the <var>cols</var> specifier ‘<samp>r</samp>’ with no
initial vertical bar. Between entry one and entry two there will be a
vertical rule; although the first <var>cols</var> does not have an ending
vertical bar, the second <var>cols</var> does have a starting one. Between
entry two and entry three there is a single vertical rule; despite that
the <var>cols</var> in both of the surrounding <code>multicolumn</code>’s call for
a vertical rule, you only get one rule. Between entry three and entry
four there is no vertical rule; the default calls for one but the
<var>cols</var> in the entry three <code>\multicolumn</code> leaves it out, and
that takes precedence. Finally, following entry four there is a
vertical rule because of the default.
</p>
<p>The number of spanned columns <var>numcols</var> can be 1. Besides giving
the ability to change the horizontal alignment, this also is useful to
override for one row the <code>tabular</code> definition’s default intercolumn
area specification, including the placement of vertical rules.
</p>
<p>In the example below, in the <code>tabular</code> definition the first column
is specified to default to left justified but in the first row the entry
is centered with <code>\multicolumn{1}{c}{\textsc{Period}}</code>.
Also in the first row, the second and third columns are spanned by a
single entry with <code>\multicolumn{2}{c}{\textsc{Span}}</code>,
overriding the specification to center those two columns on the page
range en-dash.
</p>
<div class="example">
<pre class="example">\begin{tabular}{l|r@{--}l}
\multicolumn{1}{c}{\textsc{Period}}
&multicolumn{2}{c}{\textsc{Span}} \\ \hline
Baroque &1600 &1760 \\
Classical &1730 &1820 \\
Romantic &1780 &1910 \\
Impressionistic &1875 &1925
\end{tabular}
</pre></div>
<p>Although the <code>tabular</code> specification by default puts a vertical
rule between the first and second columns, no such vertical rule appears
in the first row here. That’s because there is no vertical bar in the
<var>cols</var> part of the first row’s first <code>\multicolumn</code> command.
</p>
<hr>
<a name="g_t_005cvline" class="anchor"></a>
<a name="g_t_005cvline-1" class="anchor"></a>
<h4 class="subsection"><code>\vline</code></h4>
<a name="index-_005cvline" class="anchor"></a>
<p>Draw a vertical line in a <code>tabular</code> or <code>array</code> environment
extending the full height and depth of an entry’s row. Can also be
used in an @-expression, although its synonym vertical
bar <code>|</code> is more common. This command is rarely used in the
body of a table; typically a table’s vertical lines are specified in
<code>tabular</code>’s <var>cols</var> argument and overridden as needed with
<code>\multicolumn</code> (see <a href="#tabular">tabular</a>).
</p>
<p>The example below illustrates some pitfalls. In the first row’s second
entry the <code>\hfill</code> moves the <code>\vline</code> to the left edge of the
cell. But that is different than putting it halfway between the two
columns, so between the first and second columns there are two vertical
rules, with the one from the <code>{c|cc}</code> specifier coming before the
one produced by the <code>\vline\hfill</code>. In contrast, the first row’s
third entry shows the usual way to put a vertical bar between two
columns. In the second row, the <code>ghi</code> is the widest entry in its
column so in the <code>\vline\hfill</code> the <code>\hfill</code> has no effect and
the vertical line in that entry appears immediately next to the
<code>g</code>, with no whitespace.
</p>
<div class="example">
<pre class="example">\begin{tabular}{c|cc}
x &\vline\hfill y &\multicolumn{1}{|r}{z} \\ % row 1
abc &def &\vline\hfill ghi % row 2
\end{tabular}
</pre></div>
<hr>
<a name="g_t_005ccline" class="anchor"></a>
<a name="g_t_005ccline-1" class="anchor"></a>
<h4 class="subsection"><code>\cline</code></h4>
<a name="index-_005ccline" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\cline{<var>i</var>-<var>j</var>}
</pre></div>
<p>In an <code>array</code> or <code>tabular</code> environment, draw a horizontal rule
beginning in column <var>i</var> and ending in column <var>j</var>. The
dash, <code>-</code>, must appear in the mandatory argument. To span a single
column use the number twice, as with <code>\cline{2-2}</code>.
</p>
<p>This example puts two horizontal lines between the first and second
rows, one line in the first column only, and the other spanning the
third and fourth columns. The two lines are side-by-side, at the same
height.
</p>
<div class="example">
<pre class="example">\begin{tabular}{llrr}
a &b &c &d \\ \cline{1-1} \cline{3-4}
e &f &g &h
\end{tabular}
</pre></div>
<hr>
<a name="g_t_005chline" class="anchor"></a>
<a name="g_t_005chline-1" class="anchor"></a>
<h4 class="subsection"><code>\hline</code></h4>
<a name="index-_005chline" class="anchor"></a>
<p>Draw a horizontal line the width of the enclosing <code>tabular</code> or
<code>array</code> environment. It’s most commonly used to draw a line at the
top, bottom, and between the rows of a table.
</p>
<p>In this example the top of the table has two horizontal rules, one above
the other, that span both columns. The bottom of the table has a single
rule spanning both columns. Because of the <code>\hline</code>, the
<code>tabular</code> second row’s line ending double backslash <code>\\</code>
is required.
</p>
<div class="example">
<pre class="example">\begin{tabular}{ll} \hline\hline
Baseball &Red Sox \\
Basketball &Celtics \\ \hline
\end{tabular}
</pre></div>
<hr>
<a name="thebibliography" class="anchor"></a>
<a name="thebibliography-1" class="anchor"></a>
<h3 class="section"><code>thebibliography</code></h3>
<a name="index-environment_002c-thebibliography" class="anchor"></a>
<a name="index-thebibliography-environment" class="anchor"></a>
<a name="index-bibliography_002c-creating-_0028manually_0029" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{thebibliography}{<var>widest-label</var>}
\bibitem[<var>label</var>]{<var>cite_key}</var>
...
\end{thebibliography}
</pre></div>
<p>Produce a bibliography or reference list. There are two ways to produce
bibliographic lists. This environment is suitable when you have only a
few references and can maintain the list by hand. See <a href="#Using-BibTeX">Using BibTeX</a>
for a more sophisticated approach.
</p>
<p>This shows the environment with two entries.
</p>
<div class="example">
<pre class="example">This work is based on \cite{latexdps}.
Together they are \cite{latexdps, texbook}.
...
\begin{thebibliography}{9}
\bibitem{latexdps}
Leslie Lamport.
\textit{\LaTeX{}: a document preparation system}.
Addison-Wesley, Reading, Massachusetts, 1993.
\bibitem{texbook}
Donald Ervin Knuth.
\textit{The \TeX book}.
Addison-Wesley, Reading, Massachusetts, 1983.
\end{thebibliography}
</pre></div>
<p>This styles the first reference as ‘<samp>[1] Leslie ...</samp>’, and so that
<code>\cite{latexdps}</code> produces the matching ‘<samp>... based on [1]</samp>’.
The second <code>\cite</code> produces ‘<samp>[1, 2]</samp>’. You must compile the
document twice to resolve these references.
</p>
<p>The mandatory argument <var>widest-label</var> is text that, when typeset, is
as wide as the widest item label produced by the <code>\bibitem</code>
commands. The tradition is to use <code>9</code> for bibliographies with less
than 10 references, <code>99</code> for ones with less than 100, etc.
</p>
<p>The bibliographic list is headed by a title such as ‘<samp>Bibliography</samp>’.
To change it there are two cases. In the <samp>book</samp> and <samp>report</samp>
classes, where the top level sectioning is <code>\chapter</code> and the
default title is ‘<samp>Bibliography</samp>’, that title is in the macro
<code>\bibname</code>. For <samp>article</samp>, where the class’s top level
sectioning is <code>\section</code> and the default is ‘<samp>References</samp>’, the
title is in macro <code>\refname</code>. Change it by redefining the command,
as with <code>\renewcommand{\refname}{Cited references}</code> after
<code>\begin{document}</code>.
</p>
<a name="index-package_002c-babel-1" class="anchor"></a>
<a name="index-babel-package-1" class="anchor"></a>
<p>Language support packages such as <samp>babel</samp> will automatically
redefine <code>\refname</code> or <code>\bibname</code> to fit the selected
language.
</p>
<hr>
<a name="g_t_005cbibitem" class="anchor"></a>
<a name="g_t_005cbibitem-1" class="anchor"></a>
<h4 class="subsection"><code>\bibitem</code></h4>
<a name="index-_005cbibitem" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\bibitem{<var>cite_key</var>}
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">\bibitem[<var>label</var>]{<var>cite_key</var>}
</pre></div>
<p>Generate an entry labeled by <var>label</var>. The default is for LaTeX to
generates a number using the <code>enumi</code> counter. The <em>citation key</em>
<a name="index-citation-key" class="anchor"></a>
<var>cite_key</var> is a string of
letters, numbers, and punctuation symbols (but not comma).
</p>
<p>See <a href="#thebibliography">thebibliography</a> for an example.
</p>
<p>The optional <var>label</var> changes the default label from an integer to the
given string. With this
</p>
<div class="example">
<pre class="example">\begin{thebibliography}
\bibitem[Lamport 1993]{latexdps}
Leslie Lamport.
\textit{\LaTeX{}: a document preparation system}.
Addison-Wesley, Reading, Massachusetts, 1993.
\bibitem{texbook}
Donald Ervin Knuth.
\textit{The \TeX book}.
Addison-Wesley, Reading, Massachusetts, 1983.
\end{thebibliography}
</pre></div>
<p>the first entry will be styled as ‘<samp>[Lamport 1993] Leslie ...</samp>’ (The
amount of horizontal space that LaTeX leaves for the label depends on
the <var>widest-label</var> argument of the <code>thebibliography</code>
environment; see <a href="#thebibliography">thebibliography</a>.) Similarly, <code>... based on
\cite{latexdps}</code> will produce ‘<samp>... based on [Lamport 1994]</samp>’.
</p>
<p>If you mix <code>\bibitem</code> entries having a <var>label</var> with those that
do not then LaTeX will number the unlabelled ones sequentially. In
the example above the <code>texbook</code> entry will appear as ‘<samp>[1]
Donald ...</samp>’, despite that it is the second entry.
</p>
<p>If you use the same <var>cite_key</var> twice then you get ‘<samp>LaTeX
Warning: There were multiply-defined labels</samp>’.
</p>
<p>Under the hood, LaTeX remembers the <var>cite_key</var> and <var>label</var>
information because <code>\bibitem</code> writes it to the auxiliary file
<samp><var>filename</var>.aux</samp>. For instance, the above example causes
<code>\bibcite{latexdps}{Lamport, 1993}</code> and
<code>\bibcite{texbook}{1}</code> to appear in that file. The <samp>.aux</samp>
file is read by the <code>\begin{document}</code> command and then the
information is available for <code>\cite</code> commands. This explains why
you need to run LaTeX twice to resolve references: once to write it
out and once to read it in.
</p>
<p>Because of this two-pass algorithm, when you add a <code>\bibitem</code> or
change its <var>cite_key</var> you may get ‘<samp>LaTeX Warning: Label(s) may
have changed. Rerun to get cross-references right</samp>’. Fix it by
recompiling.
</p>
<hr>
<a name="g_t_005ccite" class="anchor"></a>
<a name="g_t_005ccite-1" class="anchor"></a>
<h4 class="subsection"><code>\cite</code></h4>
<a name="index-_005ccite" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\cite{<var>keys</var>}
</pre></div>
<p>or
</p>
<div class="example">
<pre class="example">\cite[<var>subcite</var>]{<var>keys</var>}
</pre></div>
<p>Generate as output a citation to the references associated with
<var>keys</var>. The mandatory <var>keys</var> is a citation key, or a
comma-separated list of citation keys (see <a href="#g_t_005cbibitem">\bibitem</a>).
</p>
<p>This
</p>
<div class="example">
<pre class="example">The ultimate source is \cite{texbook}.
...
\begin{thebibliography}
\bibitem{texbook}
Donald Ervin Knuth.
\textit{The \TeX book}.
Addison-Wesley, Reading, Massachusetts, 1983.
\end{thebibliography}
</pre></div>
<p>produces output like ‘<samp>... source is [1]</samp>’. (You can change the
appearance of the citation with bibliography styles. More is in
<a href="#Using-BibTeX">Using BibTeX</a>.)
</p>
<p>The optional argument <var>subcite</var> is appended to the citation. For
example, <code>See 14.3 in \cite[p.~314]{texbook}</code> might produce
‘<samp>See 14.3 in [1, p. 314]</samp>’.
</p>
<p>In addition to what appears in the output, <code>\cite</code> writes
information to the auxiliary file <samp><var>filename</var>.aux</samp>. For
instance, <code>\cite{latexdps}</code> writes ‘<samp>\citation{latexdps}</samp>’
to that file. This information is used by BibTeX to include in your
reference list only those works that you have actually cited; see
<a href="#g_t_005cnocite">\nocite</a> also.
</p>
<p>If <var>keys</var> is not in your bibliography information then you get
‘<samp>LaTeX Warning: There were undefined references</samp>’, and in the output
the citation shows as a boldface question mark between square brackets.
There are two possible causes. If you have mistyped something, as in
<code>\cite{texbok}</code> then you need to correct the spelling. On the
other hand, if you have just added or modified the bibliographic
information and so changed the <samp>.aux</samp> file (see <a href="#g_t_005cbibitem">\bibitem</a>) then
the fix may be to run LaTeX again.
</p>
<hr>
<a name="g_t_005cnocite" class="anchor"></a>
<a name="g_t_005cnocite-1" class="anchor"></a>
<h4 class="subsection"><code>\nocite</code></h4>
<a name="index-_005cnocite" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example"><code>\nocite{<var>keys</var>}</code>
</pre></div>
<p>Produces no output but writes <var>keys</var> to the auxiliary file
<samp><var>doc-filename</var>.aux</samp>.
</p>
<p>The mandatory argument <var>keys</var> is a comma-separated list of one or
more citation keys (see <a href="#g_t_005cbibitem">\bibitem</a>). This information is used by
BibTeX to include these works in your reference list even though you
have not cited them (see <a href="#g_t_005ccite">\cite</a>).
</p>
<hr>
<a name="Using-BibTeX" class="anchor"></a>
<a name="Using-BibTeX-1" class="anchor"></a>
<h4 class="subsection">Using BibTeX</h4>
<a name="index-using-BibTeX" class="anchor"></a>
<a name="index-bibTeX_002c-using" class="anchor"></a>
<a name="index-bibliography_002c-creating-_0028automatically_0029" class="anchor"></a>
<a name="index-_005cbibliographystyle" class="anchor"></a>
<a name="index-_005cbibliography" class="anchor"></a>
<p>As described in <code>thebibliography</code> (see <a href="#thebibliography">thebibliography</a>), a
sophisticated approach to managing bibliographies is provided by the
BibTeX program. This is only an introduction; see the full
documentation on CTAN.
</p>
<p>With BibTeX, you don’t use <code>thebibliography</code>
(see <a href="#thebibliography">thebibliography</a>). Instead, include these lines.
</p>
<div class="example">
<pre class="example">\bibliographystyle{<var>bibstyle</var>}
\bibliography{<var>bibfile1</var>, <var>bibfile2</var>, ...}
</pre></div>
<p>The <var>bibstyle</var> refers to a file <samp><var>bibstyle</var>.bst</samp>, which
defines how your citations will look. The standard <var>bibstyle</var>’s
distributed with BibTeX are:
</p>
<dl compact="compact">
<dt><code>alpha</code></dt>
<dd><p>Labels are formed from name of author and year of publication.
The bibliographic items are sorted alphabetically.
</p></dd>
<dt><code>plain</code></dt>
<dd><p>Labels are integers.
Sort the bibliographic items alphabetically.
</p></dd>
<dt><code>unsrt</code></dt>
<dd><p>Like <code>plain</code>, but entries are in order of citation.
</p></dd>
<dt><code>abbrv</code></dt>
<dd><p>Like <code>plain</code>, but more compact labels.
</p></dd>
</dl>
<p>Many, many other BibTeX style files exist,
tailored to the demands of various publications. See CTAN’s listing
<a class="external" href="http://mirror.ctan.org/biblio/bibtex/contrib">http://mirror.ctan.org/biblio/bibtex/contrib</a>.
</p>
<p>The <code>\bibliography</code> command is what actually produces the
bibliography. Its argument is a comma-separated list, referring to
files named <samp><var>bibfile1</var>.bib</samp>, <samp><var>bibfile2</var>.bib</samp>,
… These contain your database in BibTeX format. This shows a
typical couple of entries in that format.
</p>
<div class="example">
<pre class="example">@book{texbook,
title = {The {{\TeX}}book},
author = {D.E. Knuth},
isbn = {0201134489},
series = {Computers \& typesetting},
year = {1983},
publisher = {Addison-Wesley}
}
@book{sexbook,
author = {W.H. Masters and V.E. Johnson},
title = {Human Sexual Response},
year = {1966},
publisher = {Bantam Books}
}
</pre></div>
<p>Only the bibliographic entries referred to via <code>\cite</code> and
<code>\nocite</code> will be listed in the document’s bibliography. Thus you
can keep all your sources together in one file, or a small number of
files, and rely on BibTeX to include in this document only those that
you used.
</p>
<hr>
<a name="theorem" class="anchor"></a>
<a name="theorem-1" class="anchor"></a>
<h3 class="section"><code>theorem</code></h3>
<a name="index-environment_002c-theorem" class="anchor"></a>
<a name="index-theorem-environment" class="anchor"></a>
<a name="index-theorems_002c-typesetting" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{theorem}
<var>theorem body</var>
\end{theorem}
</pre></div>
<p>Produces ‘<samp>Theorem <var>n</var></samp>’ in boldface followed by <var>theorem
body</var> in italics. The numbering possibilities for <var>n</var> are described under
<code>\newtheorem</code> (see <a href="latex2e_12.html#g_t_005cnewtheorem">\newtheorem</a>).
</p>
<div class="example">
<pre class="example">\newtheorem{lem}{Lemma} % in preamble
\newtheorem{thm}{Theorem}
...
\begin{lem} % in document body
text of lemma
\end{lem}
The next result follows immediately.
\begin{thm}[Gauss] % put `Gauss' in parens after theorem head
text of theorem
\end{thm}
</pre></div>
<a name="index-package_002c-amsmath-4" class="anchor"></a>
<a name="index-amsmath-package-4" class="anchor"></a>
<a name="index-package_002c-amsthm" class="anchor"></a>
<a name="index-amsthm-package" class="anchor"></a>
<p>Most new documents use the packages <code>amsthm</code> and <code>amsmath</code>
from the American Mathematical Society. Among other things these
packages include a large number of options for theorem environments,
such as styling options.
</p>
<hr>
<a name="titlepage" class="anchor"></a>
<a name="titlepage-1" class="anchor"></a>
<h3 class="section"><code>titlepage</code></h3>
<a name="index-environment_002c-titlepage" class="anchor"></a>
<a name="index-titlepage-environment" class="anchor"></a>
<a name="index-making-a-title-page" class="anchor"></a>
<a name="index-title-pages_002c-creating" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{titlepage}
... text and spacing ...
\end{titlepage}
</pre></div>
<p>Create a title page, a page with no printed page number or heading and
with succeeding pages numbered starting with page one.
</p>
<p>In this example all formatting, including vertical spacing, is left to
the author.
</p>
<div class="example">
<pre class="example">\begin{titlepage}
\vspace*{\stretch{1}}
\begin{center}
{\huge\bfseries Thesis \\[1ex]
title} \\[6.5ex]
{\large\bfseries Author name} \\
\vspace{4ex}
Thesis submitted to \\[5pt]
\textit{University name} \\[2cm]
in partial fulfilment for the award of the degree of \\[2cm]
\textsc{\Large Doctor of Philosophy} \\[2ex]
\textsc{\large Mathematics} \\[12ex]
\vfill
Department of Mathematics \\
Address \\
\vfill
\today
\end{center}
\vspace{\stretch{2}}
\end{titlepage}
</pre></div>
<p>To instead produce a standard title page without a <code>titlepage</code>
environment, use <code>\maketitle</code> (see <a href="latex2e_18.html#g_t_005cmaketitle">\maketitle</a>).
</p>
<hr>
<a name="verbatim" class="anchor"></a>
<a name="verbatim-1" class="anchor"></a>
<h3 class="section"><code>verbatim</code></h3>
<a name="index-environment_002c-verbatim" class="anchor"></a>
<a name="index-verbatim-environment" class="anchor"></a>
<a name="index-verbatim-text" class="anchor"></a>
<a name="index-simulating-typed-text" class="anchor"></a>
<a name="index-typed-text_002c-simulating" class="anchor"></a>
<a name="index-code_002c-typesetting" class="anchor"></a>
<a name="index-computer-programs_002c-typesetting" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{verbatim}
<var>literal-text</var>
\end{verbatim}
</pre></div>
<p>A paragraph-making environment in which LaTeX produces as output
exactly what you type as input. For instance inside <var>literal-text</var>
the backslash <code>\</code> character does not start commands, it
produces a printed ‘<samp>\</samp>’, and carriage returns and blanks are taken
literally. The output appears in a monospaced typewriter-like font
(<code>\tt</code>).
</p>
<div class="example">
<pre class="example">\begin{verbatim}
Symbol swearing: %&$#?!.
\end{verbatim}
</pre></div>
<p>The only restriction on <code>literal-text</code> is that it cannot include
the string <code>\end{verbatim}</code>.
</p>
<a name="index-package_002c-cprotect" class="anchor"></a>
<a name="index-cprotect-package" class="anchor"></a>
<p>You cannot use the verbatim environment in the argument to macros, for
instance in the argument to a <code>\section</code>. This is not the same as
commands being fragile (see <a href="latex2e_12.html#g_t_005cprotect">\protect</a>), instead it just cannot appear
there. (But the <code>cprotect</code> package can help with this.)
</p>
<a name="index-package_002c-listings-1" class="anchor"></a>
<a name="index-listings-package-1" class="anchor"></a>
<a name="index-package_002c-minted-1" class="anchor"></a>
<a name="index-minted-package-1" class="anchor"></a>
<p>One common use of verbatim input is to typeset computer code. There are
packages that are an improvement the <code>verbatim</code> environment. For
instance, one improvement is to allow the verbatim inclusion of external
files, or parts of those files. Such packages include <code>listings</code>,
and <code>minted</code>.
</p>
<a name="index-package_002c-fancyvrb-1" class="anchor"></a>
<a name="index-fancyvrb-package-1" class="anchor"></a>
<a name="index-package_002c-verbatimbox" class="anchor"></a>
<a name="index-verbatimbox-package" class="anchor"></a>
<p>A package that provides many more options for verbatim environments is
<code>fancyvrb</code>. Another is <code>verbatimbox</code>.
</p>
<p>For a list of all the relevant packages, see CTAN.
</p>
<hr>
<a name="g_t_005cverb" class="anchor"></a>
<a name="g_t_005cverb-1" class="anchor"></a>
<h4 class="subsection"><code>\verb</code></h4>
<a name="index-_005cverb" class="anchor"></a>
<a name="index-verbatim-text_002c-inline" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\verb <var>char</var> <var>literal-text</var> <var>char</var>
\verb* <var>char</var> <var>literal-text</var> <var>char</var>
</pre></div>
<p>Typeset <var>literal-text</var> as it is input, including special characters
and spaces, using the typewriter (<code>\tt</code>) font.
</p>
<p>This example shows two different invocations of <code>\verb</code>.
</p>
<div class="example">
<pre class="example">This is \verb!literally! the biggest pumpkin ever.
And this is the best squash, \verb+literally!+
</pre></div>
<p>The first <code>\verb</code> has its <var>literal-text</var> surrounded with
exclamation point, <code>!</code>. The second instead uses plus, <code>+</code>,
because the exclamation point is part of <code>literal-text</code>.
</p>
<p>The single-character delimiter <var>char</var> surrounds
<var>literal-text</var> — it must be the same character before and
after. No spaces come between <code>\verb</code> or <code>\verb*</code> and
<var>char</var>, or between <var>char</var> and <var>literal-text</var>, or between
<var>literal-text</var> and the second occurrence of <var>char</var> (the synopsis
shows a space only to distinguish one component from the other). The
delimiter must not appear in <var>literal-text</var>. The <var>literal-text</var>
cannot include a line break.
</p>
<a name="index-visible-space" class="anchor"></a>
<p>The <code>*</code>-form differs only in that spaces are printed with a visible
space character.
</p>
<p>The output from this will include a character showing the spaces.
</p>
<div class="example">
<pre class="example">The commands's first argument is \verb*!filename with extension! and ...
</pre></div>
<a name="index-package_002c-url" class="anchor"></a>
<a name="index-url-package" class="anchor"></a>
<p>For typesetting Internet addresses, urls, the package <code>url</code>
provides an option that is better than the <code>\verb</code> command, since
it allows line breaks.
</p>
<a name="index-package_002c-listings-2" class="anchor"></a>
<a name="index-listings-package-2" class="anchor"></a>
<a name="index-package_002c-minted-2" class="anchor"></a>
<a name="index-minted-package-2" class="anchor"></a>
<p>For computer code there are many packages with advantages over
<code>\verb</code>. One is <samp>listings</samp>, another is <samp>minted</samp>.
</p>
<a name="index-package_002c-cprotect-1" class="anchor"></a>
<a name="index-cprotect-package-1" class="anchor"></a>
<p>You cannot use <code>\verb</code> in the argument to a macro, for instance in
the argument to a <code>\section</code>. It is not a question of <code>\verb</code>
being fragile (see <a href="latex2e_12.html#g_t_005cprotect">\protect</a>), instead it just cannot appear there.
(But the <code>cprotect</code> package can help with this.)
</p>
<hr>
<a name="verse" class="anchor"></a>
<a name="verse-1" class="anchor"></a>
<h3 class="section"><code>verse</code></h3>
<a name="index-environment_002c-verse" class="anchor"></a>
<a name="index-verse-environment" class="anchor"></a>
<a name="index-poetry_002c-an-environment-for" class="anchor"></a>
<p>Synopsis:
</p>
<div class="example">
<pre class="example">\begin{verse}
<var>line1</var> \\
<var>line2</var> \\
...
\end{verse}
</pre></div>
<p>An environment for poetry.
</p>
<p>Here are two lines from Shakespeare’s Romeo and Juliet.
</p>
<div class="example">
<pre class="example">Then plainly know my heart's dear love is set \\
On the fair daughter of rich Capulet.
</pre></div>
<a name="index-_005c_005c-for-verse" class="anchor"></a>
<p>Separate the lines of each stanza with <code>\\</code>, and use one or more
blank lines to separate the stanzas.
</p>
<div class="example">
<pre class="example">\begin{verse}
\makebox[\linewidth][c]{\textit{Shut Not Your Doors} ---Walt Whitman}
\\[1\baselineskip]
Shut not your doors to me proud libraries, \\
For that which was lacking on all your well-fill'd shelves, \\
\qquad yet needed most, I bring, \\
Forth from the war emerging, a book I have made, \\
The words of my book nothing, the drift of it every thing, \\
A book separate, not link'd with the rest nor felt by the intellect, \\
But you ye untold latencies will thrill to every page.
\end{verse}
</pre></div>
<p>The output has margins indented on the left and the right, paragraphs
are not indented, and the text is not right-justified.
</p>
</body>
</html>
|