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
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator"
content="HTML Tidy for Linux/x86 (vers 1st March 2002), see www.w3.org" />
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1" />
<title>Chapter 2. Editing</title>
<link rel="stylesheet" href="mtw.css" type="text/css" />
<meta name="generator"
content="DocBook XSL Stylesheets V1.53.0" />
<link rel="home" href="index.html" title="Making TeX Work" />
<link rel="up" href="pt01.html"
title="Part I. An Introduction to TeX" />
<link rel="previous" href="ch01.html"
title="Chapter 1. The Big Picture" />
<link rel="next" href="ch03.html"
title="Chapter 3. Running TeX" />
</head>
<body>
<div class="navheader">
<table border="0" cellpadding="0" cellspacing="0"
width="100%" summary="Navigation table">
<tr>
<td align="left"> <a title="Making TeX Work"
href="index.html"><img src="figures/nav-home.png"
alt="Home" border="0" /></a> <a
title="Chapter 1. The Big Picture"
href="ch01.html"><img src="figures/nav-prev.png"
alt="Prev" border="0" /></a> <a
title="Part I. An Introduction to TeX"
href="pt01.html"><img src="figures/nav-up.png" alt="Up"
border="0" /></a> <a
title="Chapter 3. Running TeX"
href="ch03.html"><img src="figures/nav-next.png"
alt="Next" border="0" /></a></td>
<td align="right"><i>Making TeX Work</i> Version 1.0.1
<span class="alpha-version">(<a
href="co01.html"><em>Alpha</em></a>)</span></td>
</tr>
</table>
</div>
<div class="chapter">
<div class="titlepage">
<div>
<h2 class="title"><a id="chap.editing"
name="chap.editing"></a>Chapter 2. Editing</h2>
</div>
<div>
<p class="releaseinfo">$Revision: 1.1 $</p>
</div>
<div>
<p class="pubdate">$Date: 2002/08/23 14:31:13 $</p>
</div>
<hr class="component-separator" />
</div>
<p>This chapter describes several writing environments
available for creating and modifying TeX documents. In
practice, you can use almost any editing program<a
id="id2788466" class="indexterm" name="id2788466"></a><a
id="id2788476" class="indexterm" name="id2788476"></a><a
id="id2788489" class="indexterm" name="id2788489"></a> you
wish, but I'll focus on GNU emacs<a id="id2788501"
class="indexterm" name="id2788501"></a> in this chapter. I've
chosen GNU emacs for two reasons: it is a popular and very
powerful editor available on many platforms (unix, NeXT,
MS-DOS, OS/2, Macintosh, VMS, Amiga, $…$), and it has
the most comprehensive TeX editing environment that I've ever
seen. At the end of the chapter, I'll discuss several other
editors for MS-DOS and OS/2 that also have TeX editing
environments.</p>
<p>The sole requirement for a TeX editor is that it must save
files in a flat, ASCII<a id="id2788517" class="indexterm"
name="id2788517"></a> format without any additional
formatting characters or special encodings. Word processors,
such as Microsoft Word<a id="id2788382" class="indexterm"
name="id2788382"></a>, usually add special formatting
information to your document when they save it to disk. TeX
will not understand this information, so you cannot use a
word processor to edit TeX documents.<sup>[<a id="id2788393"
name="id2788393" href="#ftn.id2788393">17</a>]</sup></p>
<p>A program that allows you to edit flat ASCII files is
usually called an editor (as opposed to a word processor<a
id="id2788413" class="indexterm" name="id2788413"></a>, for
example). Choosing an editor is a remarkably personal
decision. Computer programmers and other people who use
editors every day frequently become very attached to a
particular editor. This chapter explores a number of features
that an editor can provide to make editing TeX documents
easier. If possible, choose an editor that offers these
features. In any event, make sure you choose an editor you
will be comfortable using. You'll spend a lot of time using
it.</p>
<p>Many editors have some sort of built-in programming
language. The features described in this chapter rely on
modifying the behavior of the editor with its programming
language. This does not mean that <span
class="emphasis"><em>you</em></span> will have to do any
programming. All of the editors discussed in this chapter
have TeX editing environments already available. However, if
you use another editor and it doesn't have a programming
language, it's unlikely that these features will be available
to you.</p>
<p>The next section explores some helpful editor features.
All of the editors in this chapter provide some or all of the
features discussed, and require little or no programming on
your part.</p>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a
id="sec.whatcando" name="sec.whatcando"></a>What Can an
Editor Do?</h2>
</div>
</div>
<p>You will do most of your work with TeX in the editor<a
id="id2862669" class="indexterm" name="id2862669"></a>.
There are two ways that an editor can help you edit TeX
documents. One is to provide typing shortcuts that are
either intuitive replacements for cumbersome operations or
quick ways of typing common TeX commands. The other way
that an editor can help is by running TeX for you and
automatically displaying the location of formatting errors
in your document.</p>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="sec.auctex"
name="sec.auctex"></a>Quoting Automatically</h3>
</div>
</div>
<a id="id2862700" class="indexterm" name="id2862700"></a>
<p>Most typewriters and many word processors use the same
symbol for opening and closing quotations. You are
probably used to typing the double-quote key to insert
quotation marks into your text. However, if you look
carefully at TeX output (or any professionally typeset
document) you will notice that the opening and closing
quotation marks do not look the same. The proper way to
type an opening quote (“) in TeX is with two single
back-quotes in a row (<tt>``</tt>). A closing quote
(”) is entered with two single quotes (apostrophes)
in a row (<tt>''</tt>). This process is tedious and
error-prone since you are used to typing something
else.</p>
<p>If you accidentally use the double quote symbol in
your input, you most frequently get text that looks like
”this.” The exact result is actually
dependent upon the font you are using. This is explained
in Chapter <a href="ch05.html"
title="Chapter 5. Fonts">Chapter 5</a>,
<span class="emphasis"><em><a href="ch05.html"
title="Chapter 5. Fonts">Chapter 5</a></em></span>.
Most programmable editors can change the meaning of the
double-quote key to insert the correct quotation
marks.</p>
<p>If you are interested in programming your editor to do
this, you can use the following algorithm to select the
correct quotation marks most of the time: if the
character to the immediate left of the cursor is a space,
opening brace, parenthesis, or bracket, insert opening
quotes; otherwise, insert closing quotes. As a further
enhancement, double quotes should be inserted immediately
following a backslash.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2862787"
name="id2862787"></a>Matching Braces</h3>
</div>
</div>
<a id="id2862792" class="indexterm" name="id2862792"></a>
<p>Braces, as mentioned in Chapter <a
href="ch01.html"
title="Chapter 1. The Big Picture">Chapter 1</a>,
<span class="emphasis"><em><a href="ch01.html"
title="Chapter 1. The Big Picture">Chapter 1</a></em></span>,
are used by TeX to delimit sections of text; they appear
often in TeX documents. GNU emacs<a id="id2862829"
class="indexterm" name="id2862829"></a>, Multi-Edit<a
id="id2862842" class="indexterm" name="id2862842"></a>,
and <b>Brief</b><a id="id2862858" class="indexterm"
name="id2862858"></a> can all be programmed to highlight
the matching open brace whenever you type a closing
brace.</p>
<p>For example, if you have entered the text</p>
<pre class="screen">
\footnote{This is {\it not} the only case.}
</pre>
<p>and the next character that you type is <b>}</b>, the
open brace immediately following the word \footnote is
highlighted, or all of the text between that brace and
the current cursor position is highlighted. This feature
makes it easier to find places where you have forgotten
to insert a closing brace.</p>
<p>If you usually work in “insert” mode, you
may also find it convenient to have the editor insert
braces in pairs and then insert text between them. This
can be accomplished in almost any editor that can be
programmed, even one that isn't equipped to handle brace
matching.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2862919"
name="id2862919"></a>Inserting Common Control
Sequences</h3>
</div>
</div>
<p>Most editors can be programmed to insert arbitrary
text when a special key is pressed. This feature can be
used to insert common control sequences<a id="id2862931"
class="indexterm" name="id2862931"></a>. For example, you
might have <b>Alt-c</b> insert the \chapter control
sequence or <b>Ctrl-e</b> insert \begin{enumerate}.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2862968"
name="id2862968"></a>Running TeX Automatically</h3>
</div>
</div>
<p>One of the nicest features that an editor can provide
is the ability to run TeX automatically<a id="id2862979"
class="indexterm" name="id2862979"></a> without leaving
the editor. This is a feature that programmers demand
because it allows them to run compilers<a id="id2862995"
class="indexterm" name="id2862995"></a> directly from the
editor. Editors that provide this feature usually include
some mechanism for programming the editor to locate the
position of errors reported by the compiler. The editor
searches for error messages<a id="id2863008"
class="indexterm" name="id2863008"></a> in the output
generated by the compiler, and it positions the cursor at
the location of each error. This speeds up the
traditional edit/compile/debug cycle of programming. You
can take advantage of these features to shorten the
edit/typeset/rewrite cycle of creating a TeX
document.</p>
<p>All of the editors discussed in this chapter can
easily be adapted to run TeX in this way. If you already
have a favorite editor and want to add this functionality
for TeX, see the section “<a
href="ch02.html#sec.texcomp" title="Running TeX">the
section called “Running TeX”</a>” later
in this chapter; it describes the process at a very
general level.</p>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2863045"
name="id2863045"></a>GNU Emacs</h2>
</div>
</div>
<p>This section describes the TeX modes distributed as part
of GNU emacs<a id="id2863054" class="indexterm"
name="id2863054"></a>. Emacs is one of the most popular and
most powerful editors around. Distributed by the Free
Software Foundation (FSF)<a id="id2863066"
class="indexterm" name="id2863066"></a>, GNU emacs is the
de facto standard editor in many unix environments.
Recently, GNU emacs has been ported to many other
platforms, including MS-DOS (<b>demacs</b><a id="id2863083"
class="indexterm" name="id2863083"></a>), OS/2, Macintosh,
VMS, Amiga, and NeXT.</p>
<div class="sidebar">
<p>This section and the following section on aucTeX
assume that you are familiar with general emacs concepts.
In particular, you should be familiar with the concepts
of buffers, files, regions, command keys, editing modes,
and prefix arguments. If you are unfamiliar with these
concepts, you can learn about them in the online help,
called Info pages, for GNU emacs. Info pages should be
available by pressing <b>Ctrl-H</b> <b>i</b> in emacs.
You can also consult a reference to GNU emacs, such as
<span class="emphasis"><em>Learning GNU
Emacs</em></span> [<a
href="bi01.html#or:emacs">or:emacs</a>] for more
information.</p>
</div>
<p>Customizing some of the features of GNU emacs requires
familiarity with GNU emacs lisp<a id="id2863141"
class="indexterm" name="id2863141"></a>, which is also
described in the Info pages.</p>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2863154"
name="id2863154"></a>Starting TeX Mode</h3>
</div>
</div>
<p>GNU emacs<a id="id2863163" class="indexterm"
name="id2863163"></a> provides two similar TeX editing
modes: one designed for editing Plain TeX documents
(<span class="emphasis"><em>plain-tex-mode</em></span>)
and the other for editing LaTeX documents (<span
class="emphasis"><em>latex-mode</em></span>). The <span
class="emphasis"><em>latex-mode</em></span> is a superset
of <span class="emphasis"><em>plain-tex-mode</em></span>
that provides additional shortcut keys for some LaTeX
control sequences.</p>
<p>There are three ways to start TeX mode in GNU
emacs:</p>
<div class="informaltable">
<table border="1">
<colgroup>
<col />
<col />
</colgroup>
<tbody>
<tr>
<td><b>M-x tex-mode</b></td>
<td>Attempts to select the correct mode.</td>
</tr>
<tr>
<td><b>M-x plain-tex-mode</b></td>
<td>Always selects Plain TeX mode.</td>
</tr>
<tr>
<td><b>M-x latex-mode</b></td>
<td>Always selects LaTeX mode.</td>
</tr>
</tbody>
</table>
</div>
<p>If you use <b>M-x tex-mode</b>, emacs examines the top
of the buffer in order to select the appropriate mode. If
the control sequences \documentstyle or \begin{document}
occur near the top of the buffer, <span
class="emphasis"><em>latex-mode</em></span> is selected;
otherwise, the default mode is selected. The default mode
is stored in the emacs lisp variable
<tt>TeX-default-mode</tt>.</p>
<p>You can also tell emacs to invoke TeX mode
automatically whenever you edit a file that has a name
ending in <tt>.tex</tt><a id="id2863317"
class="indexterm" name="id2863317"></a>. To do so, add
the following lines to your emacs startup file<a
id="id2863326" class="indexterm" name="id2863326"></a>,
usually called <tt>.emacs</tt> in your home
directory:<sup>[<a id="id2863345" name="id2863345"
href="#ftn.id2863345">18</a>]</sup></p>
<pre class="screen">
(setq auto-mode-alist (append '(("\\.tex$" . tex-mode))
auto-mode-alist))
</pre>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2863366"
name="id2863366"></a>Typing in Emacs</h3>
</div>
</div>
<p>The emacs TeX modes change the meaning of several keys
to provide features useful for editing TeX documents.
These special<a id="id2863375" class="indexterm"
name="id2863375"></a><a id="id2863388" class="indexterm"
name="id2863388"></a> key bindings apply only to buffers
that you edit while emacs is in <span
class="emphasis"><em>plain-tex-mode</em></span> or <span
class="emphasis"><em>latex-mode</em></span>.</p>
<p>Automatic quotation, brace balancing in paragraphs,
inserting brace pairs, skipping over unmatched braces,
and closing open environments are supported.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2863418"
name="id2863418"></a>Running TeX Automatically</h3>
</div>
</div>
<p>When TeX typesets your document, it produces
processing and error messages. By<a id="id2863429"
class="indexterm" name="id2863429"></a><a id="id2863442"
class="indexterm" name="id2863442"></a> running TeX for
you, emacs can capture these messages and display them in
a window. You can use this feature to help locate and
correct errors.</p>
<p>Functions that run TeX from inside the editor rely on
emacs' ability to run a subshell<a id="id2863463"
class="indexterm" name="id2863463"></a>. Some
implementations of emacs, particularly implementations
for MS-DOS, which is unable to run concurrent processes,
cannot use this feature. aucTeX, a different editing
environment for GNU emacs, does allow you to use these
features with MS-DOS ports<a id="id2863473"
class="indexterm" name="id2863473"></a> of GNU emacs.
(aucTeX is described in the next section.)</p>
<p>GNU emacs supports processing of both buffers and
regions. These modes don't locate errors for you
automatically, but they do place the output from TeX in
an emacs buffer so that you can find them yourself.
Chapter <a href="ch03.html"
title="Chapter 3. Running TeX">Chapter 3</a>,
<span class="emphasis"><em><a href="ch03.html"
title="Chapter 3. Running TeX">Chapter 3</a></em></span>,
describes how to interpret TeX output and find the
location of errors.</p>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2863525"
name="id2863525"></a>aucTeX</h2>
</div>
</div>
<p>This section provides an overview of aucTeX<a
id="id2863533" class="indexterm" name="id2863533"></a>,<a
id="id2863544" class="indexterm" name="id2863544"></a> a
powerful emacs macro package for editing LaTeX documents.
aucTeX is available on the CTAN archives in
<tt>support/auctex</tt>. More detailed information about
installing and customizing aucTeX can be found in the
documentation distributed with the package.</p>
<p>aucTeX provides extensive support for editing TeX and
LaTeX documents in emacs. It provides many more features
than the ordinary GNU emacs TeX modes. Although useful for
both Plain TeX and LaTeX documents, aucTeX is designed with
the LaTeX user in mind.</p>
<p>aucTeX is <span class="emphasis"><em>a lot</em></span>
more complex than GNU emacs TeX mode. In fact, it is so
complex that it may not be useful if you have a relatively
slow computer.<sup>[<a id="id2863594" name="id2863594"
href="#ftn.id2863594">19</a>]</sup> On my machine,<sup>[<a
id="id2863603" name="id2863603"
href="#ftn.id2863603">20</a>]</sup> aucTeX's performance
leaves a lot to be desired. On the other hand, aucTeX is
extensively configurable, and it is possible to streamline
it quite a bit.</p>
<p>The descriptions that follow are for aucTeX version 8.0.
The versions change frequently as new features are added.
Consult the documentation which comes with aucTeX for a
list of the new features that have been added since this
book was published.</p>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="sec.multifile"
name="sec.multifile"></a>Starting aucTeX</h3>
</div>
</div>
<p>The instructions provided with each release of aucTeX
describe how to build and install the software so that
aucTeX will automatically be invoked<a id="id2863666"
class="indexterm" name="id2863666"></a> when you edit a
file with a name ending in <tt>.tex</tt>.</p>
<p>If you think aucTeX is already installed on your
system (because the emacs Info page for it is present,
for example), ask your system administrator where it is
installed. One common location is
<tt>/usr/local/lib/emacs/site-lisp/auctex</tt>.</p>
<p>Adding the following line to your emacs startup file<a
id="id2863710" class="indexterm" name="id2863710"></a>
(typically <tt>.emacs</tt> in your home directory) will
load aucTeX each time you start emacs:</p>
<div class="informalexample">
<pre class="screen">
(load-file "<span
class="emphasis"><em>/path/for/auctex</em></span>/tex-site.elc")
</pre>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2863748"
name="id2863748"></a>Typing in aucTeX</h3>
</div>
</div>
<p>aucTeX provides a large number of typing shortcuts<a
id="id2863758" class="indexterm" name="id2863758"></a>.
Many of the keystroke shortcuts are designed specifically
to aid in typing LaTeX documents. In addition to command
keys, aucTeX provides another typing shortcut---command
completion<a id="id2863775" class="indexterm"
name="id2863775"></a> for LaTeX control sequences with
<b>C-c</b> <b>TAB</b>.</p>
<p>If you type a backslash followed by the beginning of a
control sequence name into a buffer and then type
<b>C-c</b> <b>TAB</b>, aucTeX completes as much of the
control sequence as possible. Every time aucTeX adds
another letter to the control sequence name, it compares
the resulting name to a configurable list of LaTeX
control sequences. If it reaches a point where the
control sequence could be continued in two different
ways, it stops and displays all the possible completions.
For example, there are two control sequences in standard
LaTeX that begin with \re: \renewcommand and
\renewenvironment.</p>
<p>If you type:</p>
<div class="informalexample">
<pre class="screen">
\re <b>C-c</b> <b>TAB</b>
</pre>
</div>
<p>aucTeX will insert <tt>new</tt> because that much of
the control sequence name can be deduced from the known
possibilities. This changes the text in your document
to:</p>
<pre class="screen">
\renew
</pre>
<p>Because aucTeX cannot figure out which of the
possibilities you want, it displays a list of the LaTeX
commands that begin with \renew. You can complete the
command by typing <span class="bold"><b>c</b></span> or
<span class="bold"><b>e</b></span> and pressing
<b>C-c</b> <b>TAB</b> again. If you want the
\renewcommand function, type:</p>
<div class="informalexample">
<pre class="screen">
\renewc<b>C-c</b> <b>TAB</b>
</pre>
</div>
<p>Now, aucTeX will insert <tt>ommand</tt> and return to
normal typing mode with the cursor positioned just after
the control sequence name:</p>
<pre class="screen">
\renewcommand _
</pre>
<p>aucTeX has special support for LaTeX sectioning
commands and environments, changing fonts, commenting out
sections of a document, reformatting the input text, and
entering mathematics.</p>
<p>TeX contains a lot of support for typesetting
mathematics<a id="id2863993" class="indexterm"
name="id2863993"></a>. In that spirit, aucTeX provides
a<a id="id2864010" class="indexterm"
name="id2864010"></a> minor mode<sup>[<a id="id2864021"
name="id2864021" href="#ftn.id2864021">21</a>]</sup> for
entering mathematical formulae.</p>
<p>In mathematics minor mode, pressing <b>`</b> changes
the meaning of the next character you type. The next
character is interpreted as an abbreviation for a
mathematical symbol or function. For example, in aucTeX,
typing</p>
<div class="informalexample">
<p><b>$</b> <b>C-c</b> <b>~</b> <b>`</b> <b>a</b>
<b>`</b> <b><</b> <b>`</b> <b>b</b> <b>$</b></p>
</div>
<p>inserts</p>
<pre class="screen">
$α \leq β$
</pre>
<p>into your document (which is typeset like this:
α≤β).</p>
<p>Table <a href="ch02.html#tbl.mathops"
title="Table 2.1. aucTeX Math Operators in Mathematics Minor-mode">
Table 2.1</a> lists all of the abbreviations. The
first column of the table displays the shortcut keys. The
second and third columns show the command inserted in
your document and the typeset symbol, respectively <a
id="id2864136" class="indexterm" name="id2864136"></a><a
id="id2864171" class="indexterm"
name="id2864171"></a>.</p>
<div class="table">
<a id="tbl.mathops" name="tbl.mathops"></a>
<p class="title"><b>Table 2.1. aucTeX Math
Operators in Mathematics Minor-mode</b></p>
<table
summary="aucTeX Math Operators in Mathematics Minor-mode"
border="1">
<colgroup>
<col />
<col />
<col />
<col />
<col />
<col />
</colgroup>
<thead>
<tr>
<th>Keys</th>
<th>Control Sequence</th>
<th>Symbol</th>
<th>Keys</th>
<th>Control Sequence</th>
<th>Symbol</th>
</tr>
</thead>
<tbody>
<tr>
<td><tt>`a</tt></td>
<td><tt>\alpha</tt></td>
<td>$\alpha$</td>
<td><tt>`C-f</tt></td>
<td><tt>\rightarrow</tt></td>
<td>$\rightarrow$</td>
</tr>
<tr>
<td><tt>`b</tt></td>
<td><tt>\beta</tt></td>
<td>$\beta$</td>
<td><tt>`C-p</tt></td>
<td><tt>\uparrow</tt></td>
<td>$\uparrow$</td>
</tr>
<tr>
<td><tt>`d</tt></td>
<td><tt>\delta</tt></td>
<td>$\delta$</td>
<td><tt>`C-n</tt></td>
<td><tt>\downarrow</tt></td>
<td>$\downarrow$</td>
</tr>
<tr>
<td><tt>`e</tt></td>
<td><tt>\epsilon</tt></td>
<td>$\epsilon$</td>
<td><tt>`<</tt></td>
<td><tt>\leq</tt></td>
<td>$\leq$</td>
</tr>
<tr>
<td><tt>`f</tt></td>
<td><tt>\phi</tt></td>
<td>$\phi$</td>
<td><tt>`></tt></td>
<td><tt>\geq</tt></td>
<td>$\geq$</td>
</tr>
<tr>
<td><tt>`g</tt></td>
<td><tt>\gamma</tt></td>
<td>$\gamma$</td>
<td><tt>`~</tt></td>
<td><tt>\tilde</tt></td>
<td>$\tilde{\phantom{a}}</td>
</tr>
<tr>
<td><tt>`h</tt></td>
<td><tt>\eta</tt></td>
<td>$\eta$</td>
<td><tt>`I</tt></td>
<td><tt>\infty</tt></td>
<td>$\infty$</td>
</tr>
<tr>
<td><tt>`k</tt></td>
<td><tt>\kappa</tt></td>
<td>$\kappa$</td>
<td><tt>`A</tt></td>
<td><tt>\forall</tt></td>
<td>$\forall$</td>
</tr>
<tr>
<td><tt>`l</tt></td>
<td><tt>\lambda</tt></td>
<td>$\lambda$</td>
<td><tt>`E</tt></td>
<td><tt>\exists</tt></td>
<td>$\exists$</td>
</tr>
<tr>
<td><tt>`m</tt></td>
<td><tt>\mu</tt></td>
<td>$\mu$</td>
<td><tt>`!</tt></td>
<td><tt>\not</tt></td>
<td>$\not\phantom{=}$</td>
</tr>
<tr>
<td><tt>`n</tt></td>
<td><tt>\nu</tt></td>
<td>$\nu$</td>
<td><tt>`i</tt></td>
<td><tt>\in</tt></td>
<td>$\in$</td>
</tr>
<tr>
<td><tt>`o</tt></td>
<td><tt>\omega</tt></td>
<td>$\omega$</td>
<td><tt>`*</tt></td>
<td><tt>\times</tt></td>
<td>$\times$</td>
</tr>
<tr>
<td><tt>`p</tt></td>
<td><tt>\pi</tt></td>
<td>$\pi$</td>
<td><tt>`.</tt></td>
<td><tt>\cdot</tt></td>
<td>$\cdot$</td>
</tr>
<tr>
<td><tt>`q</tt></td>
<td><tt>\theta</tt></td>
<td>$\theta$</td>
<td><tt>`@{</tt></td>
<td><tt>\subset</tt></td>
<td>$\subset$</td>
</tr>
<tr>
<td><tt>`r</tt></td>
<td><tt>\rho</tt></td>
<td>$\rho$</td>
<td><tt>`@}</tt></td>
<td><tt>\supset</tt></td>
<td>$\supset$</td>
</tr>
<tr>
<td><tt>`s</tt></td>
<td><tt>\sigma</tt></td>
<td>$\sigma$</td>
<td><tt>`[</tt></td>
<td><tt>\subseteq</tt></td>
<td>$\subseteq$</td>
</tr>
<tr>
<td><tt>`t</tt></td>
<td><tt>\tau</tt></td>
<td>$\tau$</td>
<td><tt>`]</tt></td>
<td><tt>\supseteq</tt></td>
<td>$\supseteq$</td>
</tr>
<tr>
<td><tt>`v</tt></td>
<td><tt>\vee</tt></td>
<td>$\vee$</td>
<td><tt>`\</tt></td>
<td><tt>\backslash</tt></td>
<td>$\backslash$</td>
</tr>
<tr>
<td><tt>`u</tt></td>
<td><tt>\upsilon</tt></td>
<td>$\upsilon$</td>
<td><tt>`/</tt></td>
<td><tt>\setminus</tt></td>
<td>$\setminus$</td>
</tr>
<tr>
<td><tt>`x</tt></td>
<td><tt>\chi</tt></td>
<td>$\chi$</td>
<td><tt>`+</tt></td>
<td><tt>\cup</tt></td>
<td>$\cup$</td>
</tr>
<tr>
<td><tt>`y</tt></td>
<td><tt>\psi</tt></td>
<td>$\psi$</td>
<td><tt>`-</tt></td>
<td><tt>\cap</tt></td>
<td>$\cap$</td>
</tr>
<tr>
<td><tt>`z</tt></td>
<td><tt>\zeta</tt></td>
<td>$\zeta$</td>
<td><tt>`(</tt></td>
<td><tt>\langle</tt></td>
<td>$\langle$</td>
</tr>
<tr>
<td><tt>`D</tt></td>
<td><tt>\Delta</tt></td>
<td>$\Delta$</td>
<td><tt>`)</tt></td>
<td><tt>\rangle</tt></td>
<td>$\rangle$</td>
</tr>
<tr>
<td><tt>`G</tt></td>
<td><tt>\Gamma</tt></td>
<td>$\Gamma$</td>
<td><tt>`C-e</tt></td>
<td><tt>\exp</tt></td>
<td>$\exp$</td>
</tr>
<tr>
<td><tt>`Q</tt></td>
<td><tt>\Theta</tt></td>
<td>$\Theta$</td>
<td><tt>`C-s</tt></td>
<td><tt>\sin</tt></td>
<td>$\sin$</td>
</tr>
<tr>
<td><tt>`L</tt></td>
<td><tt>\Lambda</tt></td>
<td>$\Lambda$</td>
<td><tt>`C-c</tt></td>
<td><tt>\cos</tt></td>
<td>$\cos$</td>
</tr>
<tr>
<td><tt>`Y</tt></td>
<td><tt>\Psi</tt></td>
<td>$\Psi$</td>
<td><tt>`C-^</tt></td>
<td><tt>\sup</tt></td>
<td>$\sup$</td>
</tr>
<tr>
<td><tt>`P</tt></td>
<td><tt>\Pi</tt></td>
<td>$\Pi$</td>
<td><tt>`C-_</tt></td>
<td><tt>\inf</tt></td>
<td>$\inf$</td>
</tr>
<tr>
<td><tt>`S</tt></td>
<td><tt>\Sigma</tt></td>
<td>$\Sigma$</td>
<td><tt>`C-d</tt></td>
<td><tt>\det</tt></td>
<td>$\det$</td>
</tr>
<tr>
<td><tt>`U</tt></td>
<td><tt>\Upsilon</tt></td>
<td>$\Upsilon$</td>
<td><tt>`C-l</tt></td>
<td><tt>\lim</tt></td>
<td>$\lim$</td>
</tr>
<tr>
<td><tt>`V</tt></td>
<td><tt>\Phi</tt></td>
<td>$\Phi$</td>
<td><tt>`C-t</tt></td>
<td><tt>\tan</tt></td>
<td>$\tan$</td>
</tr>
<tr>
<td><tt>`O</tt></td>
<td><tt>\Omega</tt></td>
<td>$\Omega$</td>
<td><tt>`^</tt></td>
<td><tt>\hat</tt></td>
<td>$\hat{\phantom{a}}$</td>
</tr>
<tr>
<td><tt>`C-b</tt></td>
<td><tt>\leftarrow</tt></td>
<td>$\leftarrow$</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
</div>
<p>Additional miscellaneous commands in aucTeX provide
automatic quotation, completion of “items” in
appropriate environments (<tt>itemize</tt> and
<tt>enumeration</tt> environments, for example), and
insertion of brace pairs<a id="id2865777"
class="indexterm" name="id2865777"></a> and skeletal
control sequences.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2865794"
name="id2865794"></a>aucTeX Outline Mode</h3>
</div>
</div>
<p>Outline mode<a id="id2865803" class="indexterm"
name="id2865803"></a> is a convenient way to edit large
documents. In outline mode, portions of the document that
you are not editing are hidden from view. They aren't
removed or deleted. Emacs indicates hidden text with
ellipses.</p>
<p>For example, in a large document with many sections,
you can use outline mode to hide all text except the
section headings, and then selectively expand just the
sections that you wish to edit.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2865831"
name="id2865831"></a>Intelligent Paragraph
Reformatting</h3>
</div>
</div>
<p>aucTeX understands the TeX constructions for many
kinds of environments (the list environments, for
example) and performs paragraph reformatting<a
id="id2865843" class="indexterm" name="id2865843"></a>
within the restrictions of these environments. aucTeX
won't concatenate a whole series of list items together
into one huge paragraph, for example.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2865862"
name="id2865862"></a>Multi-file Documents</h3>
</div>
</div>
<p>It is often convenient to edit a large document in
small pieces<a id="id2865873" class="indexterm"
name="id2865873"></a> rather than in one huge file. For
example, when writing a book, it is convenient to work on
chapters independently and store them in different files.
If you are working on a collaborative project, it may be
absolutely necessary to separate the document into
pieces.</p>
<p>The TeX \input command allows you to construct a
driver file that automatically combines the individual
files that make up your document when you run TeX. The
driver file contains the document style options and other
setup information for the whole document. Each chapter
contains just the necessary text. When TeX encounters an
\input command, it typesets all of the text in the
specified file before continuing with the current
document. Example <a href="ch02.html#ex.driver"
title="Example 2.1. A Simple Driver File">Example 2.1</a>
shows an example of a driver file.</p>
<div class="example">
<a id="ex.driver" name="ex.driver"></a>
<p class="title"><b>Example 2.1. A Simple
Driver File</b></p>
<pre class="screen">
\documentstyle[ora]{book}
\begin{document}
\input{intro}
\input{chap1}
\input{chap2}
\end{document}
</pre>
</div>
<p>aucTeX provides seamless support for multi-file
documents. In order to provide this support, aucTeX
relies on the “file variables” feature of
emacs, which allows you to associate editor variables
with particular buffers. An editor variable<a
id="id2865956" class="indexterm" name="id2865956"></a><a
id="id2865966" class="indexterm" name="id2865966"></a> is
a named variable that is local to the current buffer and
accessible by macro packages like aucTeX running under
emacs. Look up file variables in your emacs reference for
a more complete description. Example <a
href="ch02.html#ex.localvars"
title="Example 2.2. Local Variables in an Emacs Buffer">
Example 2.2</a> shows some common local variables in
aucTeX.</p>
<p>When you run TeX on a buffer, aucTeX looks for the
editor variable <tt>TeX-master</tt>. If
<tt>TeX-master</tt> is set to a filename, aucTeX runs TeX
on that file instead of running it directly on the file
you are editing. This is a tremendously useful feature
because it means that you do not have to put macro
definitions, document style options, and other setup
information at the top of each chapter. Simply set the
<tt>TeX-master</tt> variable in each chapter to name the
driver file.</p>
<p>If you do not set the <tt>TeX-master</tt> variable,
aucTeX will prompt you for it the first time you run a
command. If the \documentstyle command occurs near the
top of your document, aucTeX assumes that the current
buffer <span class="emphasis"><em>is</em></span> the
master (because it contains setup information) and will
not prompt you for a different master file.</p>
<p>Editor variables are defined by a “Local
Variables” declaration at the bottom of your file.
aucTeX inserts a Local Variables declaration
automatically if it prompts you for a master file.
Example <a href="ch02.html#ex.localvars"
title="Example 2.2. Local Variables in an Emacs Buffer">
Example 2.2</a> shows how local variables
<tt>TeX-master</tt><a id="id2866076" class="indexterm"
name="id2866076"></a> and <tt>TeX-command-default</tt><a
id="id2866102" class="indexterm" name="id2866102"></a>
can be set to <tt>driver.tex</tt> and <tt>LaTeX</tt>,
respectively. Because these lines begin with a percent
sign, they are considered comments by TeX and do not
appear in the output. These should be the last lines in
the file.</p>
<div class="example">
<a id="ex.localvars" name="ex.localvars"></a>
<p class="title"><b>Example 2.2. Local
Variables in an Emacs Buffer</b></p>
<pre class="screen">
% Local Variables:
% TeX-master: "driver.tex"
% TeX-command-default: "LaTeX"
% End:
</pre>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="sec.texcomp"
name="sec.texcomp"></a>Running TeX</h3>
</div>
</div>
<p>Like GNU emacs TeX mode, aucTeX allows you to run
TeX<a id="id2866176" class="indexterm"
name="id2866176"></a> directly from within emacs as a
subshell. Running a program inside emacs creates a
process<a id="id2866196" class="indexterm"
name="id2866196"></a>. You can have only one active
process for each document, plus one process for TeXing a
region<a id="id2866208" class="indexterm"
name="id2866208"></a>. If you try to run two processes on
the same document, aucTeX will ask for permission to kill
the first before running the second. aucTeX supports the
processing of both the documents and the regions of a
document.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2866224"
name="id2866224"></a>Finding Errors</h3>
</div>
</div>
<p>No matter how much experience you have with TeX, some
of the documents that you write will contain errors<a
id="id2866235" class="indexterm" name="id2866235"></a>.
aucTeX eases the burden of correcting these errors by
locating them automatically in your document.</p>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2866254"
name="id2866254"></a>Multi-Edit</h2>
</div>
</div>
<p><b>Multi-Edit<a id="id2866268" class="indexterm"
name="id2866268"></a></b><a id="id2866275"
class="indexterm" name="id2866275"></a> is an editor for
the MS-DOS environment. This section describes the
text-based version of <b>Multi-Edit</b>. A Windows version
is in the works, and it may exist by the time you read
this.</p>
<p>Built to be a programmer's editor, <b>Multi-Edit</b> has
a number of features designed to add language-specific
intelligence to the editing environment. These features
(template editing, a customizable spellchecker, and
configurable brace matching) can be exploited for TeX as
readily as for any programming language. For several years,
at least since version 5.0, <b>Multi-Edit</b> has included
support for TeX.</p>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2866322"
name="id2866322"></a>Setting Up TeX Support</h3>
</div>
</div>
<p>Support for TeX<a id="id2866330" class="indexterm"
name="id2866330"></a> is included as a language type in
<b>Multi-Edit</b>. Language types are selected by
filename extension; this means that you configure
<b>Multi-Edit</b> to provide support for the “TeX
language” whenever you edit files with the
extension <tt>.tex</tt><a id="id2866371"
class="indexterm" name="id2866371"></a> (and other
extensions if you choose).</p>
<p>Selecting the “Other/Install/Filename
extensions...” menu displays a list of configured
extensions. If TEX is not listed, press <b>Insert</b> to
add it. You will see a screen like the one shown in
Figure <a href="ch02.html#fig.meextsetup"
title="Figure 2.1. Extension setup in Multi-Edit">
Figure 2.1</a>.</p>
<div class="figure">
<a id="fig.meextsetup" name="fig.meextsetup"></a>
<p class="title"><b>Figure 2.1. Extension
setup in Multi-Edit</b></p>
<div class="mediaobject">
<img src="figures/tex.02.01.png" alt="Screenshot" />
</div>
</div>
<p>Customize the right margin, tab spacing, indent style,
and colors to values that you find comfortable. The edit
mode should be “text,” and the tab settings
should be set to “use tab and margin settings,
ignore format line.”</p>
<p>Select TEX as the language type, and add TeX as a
compiler. One possible setting for TeX as a compiler (for
LaTeX documents, in this case) is shown in Figure <a
href="ch02.html#fig.melatexcmp"
title="Figure 2.2. LaTeX as a compiler in Multi-Edit">
Figure 2.2</a>.</p>
<div class="figure">
<a id="fig.melatexcmp" name="fig.melatexcmp"></a>
<p class="title"><b>Figure 2.2. LaTeX as a
compiler in Multi-Edit</b></p>
<div class="mediaobject">
<img src="figures/tex.02.02.png" alt="Screenshot" />
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2866543"
name="id2866543"></a>Typing in Multi-Edit</h3>
</div>
</div>
<p>Brace matching<a id="id2866552" class="indexterm"
name="id2866552"></a> is provided automatically with
Multi-Edit's template expansion support. Consult your
Multi-Edit reference for more information about
templates.</p>
<p>Multi-Edit language support does not include any TeX
key bindings by default. However, the macros are
provided, and you can install them with the
“Other/Install/Key mapping...” menu. The
following macros are available:</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p><tt>tex^texquote</tt> inserts the appropriate
quotation marks. This macro can be bound to
<b>"</b> to provide smart quoting<a id="id2866605"
class="indexterm" name="id2866605"></a>.</p>
</li>
<li>
<p><tt>tex^texnquote</tt> inserts the literal
double quote. It can be bound to <b>Alt-"</b>, for
example.</p>
</li>
<li>
<p><tt>tex^texreformat</tt> is a replacement for
the reformat macro. If the filename extension is
<tt>.tex</tt>, this macro reformats the paragraph
with sensitivity to TeX macros. Otherwise it calls
the default reformatting macro.</p>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2866670"
name="id2866670"></a>Running TeX</h3>
</div>
</div>
<p>Running TeX within Multi-Edit is accomplished by
specifying a compiler for TeX or LaTeX documents<a
id="id2866678" class="indexterm" name="id2866678"></a>.
In Figure <a href="ch02.html#fig.melatexcmp"
title="Figure 2.2. LaTeX as a compiler in Multi-Edit">
Figure 2.2</a>, a batch file called <tt>TEXIT</tt>
is being used as the compiler for documents with the
extension <tt>.tex</tt>.</p>
<p>Automatic compilation and location of errors is
provided by Multi-Edit language support when you have
selected <tt>TEX</tt> as the language-type for
<tt>.tex</tt> files.</p>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2866742"
name="id2866742"></a>Brief</h2>
</div>
</div>
<p><b>Brief</b><a id="id2866755" class="indexterm"
name="id2866755"></a><a id="id2866765" class="indexterm"
name="id2866765"></a><a id="id2866775" class="indexterm"
name="id2866775"></a> is a powerful programmer's editor
recently acquired by Borland International<a id="id2866788"
class="indexterm" name="id2866788"></a>. It is available
for both DOS and OS/2 systems. Like the other editors
discussed in this section, <b>Brief</b> offers a strong set
of programming features, including the ability to run
compilers automatically, and a flexible, C-like macro
programming language that allows you to customize the
editor.</p>
<p>There is a LaTeX editing environment for <b>Brief</b> in
the CTAN archives. It includes multiple-language support
(currently supporting Norwegian) and control-key shortcuts
for many common LaTeX commands.</p>
<p>The installation and setup program includes instructions
for defining program compilers. TeX can be defined to
process files with particular extensions. Once again, it is
a good idea to have the editor run a batch file so that the
batch file can determine what format file to use when
processing the document.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2866836"
name="id2866836"></a>MicroEMACS</h2>
</div>
</div>
<p><b>MicroEMACS</b><a id="id2866848" class="indexterm"
name="id2866848"></a><a id="id2866855" class="indexterm"
name="id2866855"></a><a id="id2866865" class="indexterm"
name="id2866865"></a> is a powerful emacs-like editor for
MS-DOS and Microsoft Windows.<sup>[<a id="id2866878"
name="id2866878" href="#ftn.id2866878">22</a>]</sup>
Figure <a href="ch02.html#fig.editing.mew"
title="Figure 2.3. Editing a file with MicroEMACS">
Figure 2.3</a> shows an example of <b>MicroEMACS</b>
editing a LaTeX document. In this case, the LaTeX
extensions to <b>MicroEMACS</b> have been loaded, and
“Help” is selected.</p>
<div class="figure">
<a id="fig.editing.mew" name="fig.editing.mew"></a>
<p class="title"><b>Figure 2.3. Editing a file
with MicroEMACS</b></p>
<div class="mediaobject">
<img src="figures/tex.02.03.png" alt="Screenshot" />
</div>
</div>
<p>The online help for LaTeX is shown in Figure <a
href="ch02.html#fig.winhelp"
title="Figure 2.4. Microsoft Windows online help for LaTeX">
Figure 2.4</a>. This is a Microsoft Windows help file,
available independently of <b>MicroEMACS</b> (although it
is nicely integrated here).</p>
<div class="figure">
<a id="fig.winhelp" name="fig.winhelp"></a>
<p class="title"><b>Figure 2.4. Microsoft
Windows online help for LaTeX</b></p>
<div class="mediaobject">
<img src="figures/tex.02.04.png" alt="Screenshot" />
</div>
</div>
<p>The <b>MicroEMACS</b> environment also has the ability
to run other programs (including TeX to process documents)
and process the error output to aid in locating errors.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2867057"
name="id2867057"></a>epm: OS/2's Enhanced Editor</h2>
</div>
</div>
<p><b>epm</b><a id="id2867070" class="indexterm"
name="id2867070"></a><a id="id2867077" class="indexterm"
name="id2867077"></a>, the enhanced editor for OS/2, can be
used to edit TeX documents. The <b>epmtex</b><a
id="id2867094" class="indexterm" name="id2867094"></a>
package adds a TeX item to the menu bar as shown in
Figure <a href="ch02.html#fig.editing.epm"
title="Figure 2.5. Editing a TeX document with epm under OS/2">
Figure 2.5</a>.</p>
<div class="figure">
<a id="fig.editing.epm" name="fig.editing.epm"></a>
<p class="title"><b>Figure 2.5. Editing a TeX
document with epm under OS/2</b></p>
<div class="mediaobject">
<img src="figures/tex.02.05.png" alt="Screenshot" />
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2867165"
name="id2867165"></a>Other Tools</h2>
</div>
</div>
<p>There are many other editors that can be effective tools
for editing TeX documents. Some of the editors that you
might want to consider are <b>Jove</b><a id="id2867182"
class="indexterm" name="id2867182"></a>, an emacs-like
editor; <b>Xnot</b><a id="id2867203" class="indexterm"
name="id2867203"></a>, a Windows port of emacs;
<b>LSedit</b><a id="id2867217" class="indexterm"
name="id2867217"></a>, the VMS language-sensitive editor;
and <b>Alpha</b><a id="id2867232" class="indexterm"
name="id2867232"></a> and <b>BBedit</b><a id="id2867246"
class="indexterm" name="id2867246"></a>, two Macintosh
editors described in Chapter <a href="ch15.html"
title="Chapter 15. TeX on the Macintosh">Chapter 15</a>,
<span class="emphasis"><em><a href="ch15.html"
title="Chapter 15. TeX on the Macintosh">Chapter 15</a></em></span>.</p>
<p>There are also a number of tools designed specifically
for editing TeX documents. <b>Scientific Word</b><a
id="id2867285" class="indexterm" name="id2867285"></a>, a
commercial environment, is described in Chapter <a
href="ch14.html"
title="Chapter 14. Commercial Environments">Chapter 14</a>,
<span class="emphasis"><em><a href="ch14.html"
title="Chapter 14. Commercial Environments">Chapter 14</a></em></span>.
Several free tools (<b>MathPad</b><a id="id2867324"
class="indexterm" name="id2867324"></a>, <b>Doc</b>, and
<b>XTeXShell</b><a id="id2867344" class="indexterm"
name="id2867344"></a>, for example) also exist, although
none were available<sup>[<a id="id2867356" name="id2867356"
href="#ftn.id2867356">23</a>]</sup> in time for review in
this edition of <i>Making TeX Work</i>.</p>
<p>Another helpful tool is <b>LaCheck</b><a id="id2867378"
class="indexterm" name="id2867378"></a>, a LaTeX syntax
checker. <b>LaCheck</b> attempts to find and identify
problems with your document that will cause it to format
incorrectly. It runs much more quickly than TeX over a long
document and may identify some things (like</p>
<p>missing italic correction) that are potentially
incorrect, even though they are not errors that will
prevent the document from formatting.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2867406"
name="id2867406"></a>TeX as a Compiler</h2>
</div>
</div>
<p>This section discusses how to use TeX like a compiler<a
id="id2867415" class="indexterm" name="id2867415"></a> from
within your editor, and it is rather technical. You should
read this section before you attempt to program your own
editor to run TeX (if it doesn't already include support
for TeX). You may not be interested in this material if you
aren't planning to do that programming yourself. More
details on the types of TeX output used in this section can
be found in Chapter <a href="ch03.html"
title="Chapter 3. Running TeX">Chapter 3</a>,
<span class="emphasis"><em><a href="ch03.html"
title="Chapter 3. Running TeX">Chapter 3</a></em></span>.</p>
<p>Many editors can run a compiler, capture the error
messages that the compiler produces, and walk through the
source file highlighting each error. Most editors with this
functionality can run TeX as a “compiler” for
documents.</p>
<p>The discussion that follows is at a very abstract level.
The details vary so much from one editor to the next that
presenting more detail only confuses the issue further. To
implement this feature, you'll need to read your editor
reference carefully, and probably experiment on your own a
little bit.</p>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2867481"
name="id2867481"></a>Processing a Document</h3>
</div>
</div>
<p>Establish the TeX program as a compiler using whatever
features your editor provides to set up a compiler.
Experiment with your editor until you can process an
error-free document.</p>
<p>After you have everything working, it may be desirable
to modify the compiler to run a batch file or shell
script instead of invoking the TeX program directly. This
will allow you to program the shell script so that it can
determine which format file to use.</p>
<p>Running TeX is only the first step. Next, you have to
interpret the error messages<a id="id2867509"
class="indexterm" name="id2867509"></a> that TeX
produces. As a concrete example, Example <a
href="ch02.html#ex.madeuperr"
title="Example 2.3. A Contrived Error">Example 2.3</a>
shows some contrived output which demonstrates an
“undefined control sequence” error on line 6
of the file <tt>wilma.tex</tt>.</p>
<div class="example">
<a id="ex.madeuperr" name="ex.madeuperr"></a>
<p class="title"><b>Example 2.3. A Contrived
Error</b></p>
<pre class="screen">
This is TeX version 3.141...
** (flintstone.tex
some
messages [1]
(fred.tex [2]
some more
messages
[3] ) (wilma.tex [4]
! Undefined control sequence.
the dog \dino
tipped over the car.
l.6 the dog \dino tipped over the car.
</pre>
</div>
<p>Here are some suggestions for attacking the problem of
programming your favorite editor to process TeX error
messages<a id="id2867574" class="indexterm"
name="id2867574"></a>:</p>
<div class="variablelist">
<dl>
<dt><span class="term">Using the log file</span></dt>
<dd>
<p>Don't worry about capturing the error messages
that TeX produces. It is much easier to get the
information from the log file<a id="id2867609"
class="indexterm" name="id2867609"></a>. Log files
are described in the section called “<a
href="ch03.html#sec.logfiles" title="Log Files">the
section called “Log Files”</a>”
in Chapter <a href="ch03.html"
title="Chapter 3. Running TeX">Chapter 3</a>,
<span class="emphasis"><em><a href="ch03.html"
title="Chapter 3. Running TeX">Chapter 3</a></em></span>.</p>
</dd>
<dt><span class="term">Finding error
messages</span></dt>
<dd>
<p>Any line in the log file that begins with an
exclamation point is an error message. In
Example <a href="ch02.html#ex.madeuperr"
title="Example 2.3. A Contrived Error">Example 2.3</a>,
the line that begins</p>
<pre class="screen">
! Undefined control sequence.
</pre>
<p>is an example of an error message.</p>
</dd>
<dt><span class="term">Finding the source
line</span></dt>
<dd>
<p>Following the error message, TeX shows the
context in which the error occurred. After that,
the line that begins with
<tt>l.<i><tt>nnn</tt></i></tt> (where
<tt><i><tt>nnn</tt></i></tt> is some decimal
number) identifies the line of the input file that
TeX was processing when the error occurred (in
Example <a href="ch02.html#ex.madeuperr"
title="Example 2.3. A Contrived Error">Example 2.3</a>,
TeX was on line 6 when the error occurred).</p>
</dd>
<dt><span class="term">Finding the source
file</span></dt>
<dd>
<p>When processing a document that uses the \input
command to include other files, there is no
guaranteed method of finding out the name of the
file TeX was processing when the error occurred.
Whenever TeX starts processing a file, it prints an
open parenthesis followed by the name of the file.
When it finishes processing the document, it prints
a close parenthesis.<sup>[<a id="id2867763"
name="id2867763"
href="#ftn.id2867763">24</a>]</sup> So the
following algorithm <span
class="emphasis"><em>usually</em></span> identifies
what file the error occurred in:</p>
<p>Beginning at the line in the log file that
announces the error message (the line beginning
with “!”), search backwards for the
first unmatched open parenthesis. The word
following that open parenthesis is probably the
name of the file TeX was processing when the error
occurred.</p>
</dd>
<dt><span class="term">Ignoring errors</span></dt>
<dd>
<p>When you run TeX “by hand,” you want
TeX to stop and report errors to you as they occur
in your document. But if your editor is going to
handle any errors that occur, it is inconvenient to
have TeX stop and ask questions. In fact, it may
not be possible to run TeX from your editor in a
way that makes it even <span
class="emphasis"><em>feasible</em></span> for TeX
to stop and ask questions. You can use several
built-in control sequences to control the way TeX
responds to errors. They are summarized in
Table <a href="ch02.html#tab.modes"
title="Table 2.2. TeX Modes of Interaction ">
Table 2.2</a>.</p>
<div class="table">
<a id="tab.modes" name="tab.modes"></a>
<p class="title"><b>Table 2.2. TeX
Modes of Interaction</b></p>
<table summary="TeX Modes of Interaction "
border="1">
<colgroup>
<col align="left" />
<col align="left" />
</colgroup>
<thead>
<tr>
<th align="left">Mode</th>
<th align="left">TeX's Behavior</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">\errorstopmode</td>
<td align="left">Stop on errors (the
default behavior)</td>
</tr>
<tr>
<td align="left">\scrollmode</td>
<td align="left">Scroll errors, stop on
missing files</td>
</tr>
<tr>
<td align="left">\nonstopmode</td>
<td align="left">Scroll errors and missing
files</td>
</tr>
<tr>
<td align="left">\batchmode</td>
<td align="left">Scroll both and don't
summarize on screen</td>
</tr>
</tbody>
</table>
</div>
<p>One common way of invoking TeX from an editor to
process a document is to use the command:</p>
<pre class="screen">
tex \nonstopmode \input flintstone
</pre>
<p>This uses the features discussed in the section
“<a href="ch03.html#sec.clineopts"
title="The Command Line">the section called
“The Command Line”</a>” in
Chapter <a href="ch03.html"
title="Chapter 3. Running TeX">Chapter 3</a>
to pass a command to TeX on the command line. In
this case, the command tells TeX not to stop on any
kind of error.</p>
</dd>
<dt><span class="term">Handling other
errors</span></dt>
<dd>
<p>When searching for errors in the log file, you
may find it helpful to search for lines that begin
with the words “Overfull box”<a
id="id2868015" class="indexterm"
name="id2868015"></a> or “Underfull
box”<a id="id2868029" class="indexterm"
name="id2868029"></a> as well as lines that begin
with an exclamation point. Because TeX does not
print the <tt>l.nnn</tt> form of line-number
message in this case, you will have to look for the
line numbers in the warning message.</p>
<p>Overfull box messages have the form:</p>
<div class="informalexample">
<pre class="screen">
Overfull <span class="emphasis"><em>box</em></span> (<span
class="emphasis"><em>99.9</em></span>pt too wide) in paragraph at lines <span
class="emphasis"><em>n--m</em></span>
</pre>
</div>
<p>The <tt><i><tt>box</tt></i></tt> will be either
<tt>hbox</tt>, indicating that something is too
wide, or <tt>vbox</tt> indicating that something is
too tall or too deep. The distance,
<tt><i><tt>99.9</tt></i>pt</tt>, indicates how
badly the box is overfull, and
<tt><i><tt>n</tt></i></tt> is the first line of the
paragraph in which the error occurs. Underfull box
messages are the same, except that they begin with
the word “Underfull.”</p>
<p>There are several control sequences that you can
use to control how sensitive TeX is to
“bad” boxes. Any good TeX reference
will discuss these parameters in detail.</p>
</dd>
</dl>
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2868148"
name="id2868148"></a>Spellchecking</h2>
</div>
</div>
<p>Checking for spelling mistakes<a id="id2868157"
class="indexterm" name="id2868157"></a> is an important
part of any document creation process. Checking TeX
documents is difficult because these documents contain
control sequences that aren't words in the traditional
sense.</p>
<p>Some editors offer ways of customizing the spellchecker.
Multi-Edit, for example, allows you to indicate that any
word beginning with a backslash should be ignored for the
purpose of spellchecking. Figure <a
href="ch02.html#fig.mespell"
title="Figure 2.6. Edit settings control word delimiters">
Figure 2.6</a> shows the “Other/Install/Edit
Settings...” dialog where word delimiters are
controlled. This simple customization goes a long way
towards making spellchecking tolerable.</p>
<p>External spellcheckers, such as the ones described here,
can also frequently be customized to ignore TeX control
sequences.</p>
<div class="figure">
<a id="fig.mespell" name="fig.mespell"></a>
<p class="title"><b>Figure 2.6. Edit settings
control word delimiters</b></p>
<div class="mediaobject">
<img src="figures/tex.02.06.png" alt="Screenshot" />
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2868250"
name="id2868250"></a>ispell</h3>
</div>
</div>
<p><b>ispell</b><a id="id2868263" class="indexterm"
name="id2868263"></a> is a common unix spellchecker. In
addition to being available from the shell prompt, GNU
emacs includes an <span
class="emphasis"><em>ispell-mode</em></span> that handles
TeX documents intelligently.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2868280"
name="id2868280"></a>amSpell</h3>
</div>
</div>
<p><b>amSpell<a id="id2868293" class="indexterm"
name="id2868293"></a></b> is an MS-DOS spellchecker that
includes special support for TeX documents. When
spellchecking a TeX document, <b>amSpell</b> ignores all
TeX control sequences, as well as mathematics and the
arguments to reference and citation commands. The
standard accent primitives are also recognized, and
<b>amSpell</b> can identify and correct misspellings in
words that use them.</p>
<p>An example of <b>amSpell</b> checking a document is
shown in Figure <a href="ch02.html#fig.amspell"
title="Figure 2.7. Spellchecking a document with amSpell">
Figure 2.7</a>.</p>
<div class="figure">
<a id="fig.amspell" name="fig.amspell"></a>
<p class="title"><b>Figure 2.7. Spellchecking
a document with amSpell</b></p>
<div class="mediaobject">
<img src="figures/tex.02.07.png" alt="Screenshot" />
</div>
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2868394"
name="id2868394"></a>Revision Control</h2>
</div>
</div>
<p>Revision control<a id="id2868403" class="indexterm"
name="id2868403"></a> allows you to track modifications to
a file. It is frequently associated with programming where
the ability to find and correct bugs relies on being able
to recreate a problem exactly. It can be just as useful for
writers wishing to keep track of changes to an evolving
document. For example, I use revision control to keep track
of which versions of each chapter my editor has seen.</p>
<p>One of the most common revision control systems is RCS<a
id="id2868424" class="indexterm" name="id2868424"></a>,
which was derived from SCCS<a id="id2868433"
class="indexterm" name="id2868433"></a>, a commercial
package. RCS is freely available under the GNU license. It
is possible to use RCS under unix, MS-DOS, and OS/2.</p>
<p>The TeX macros shown in Example <a
href="ch02.html#ex.rcsmac"
title="Example 2.4. Revision Control Macros for TeX Documents Using RCS}">
Example 2.4</a> can be used to include RCS information
as marginal notes in a document. The marginal notes in this
example are printed only when a draft is being
produced.</p>
<p>These macros are my own, you will find others in the
CTAN archives in the directory
<tt>macros/latex/contrib/misc</tt>.</p>
<div class="example">
<a id="ex.rcsmac" name="ex.rcsmac"></a>
<p class="title"><b>Example 2.4. Revision
Control Macros for TeX Documents Using RCS}</b></p>
<pre class="screen">
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RCS definitions...
\newif\ifdraft
\def\RCSID$#1${
\ifdraft{\tolerance=100000
\hbadness=100000
\raggedright
\marginpar{\tiny Draft #1}}
\typeout{Draft #1}
\else\typeout{Production run #1}\fi
}
\def\RCSmargid$#1: #2 #3 #4 #5 #6 #7${
% #1 = “Id”
% #2 = filename
% #3 = vers
% #4 = date
% #5 = time
% #6 = author
% #7 = state [locker]
\ifdraft
\setbox0=\hbox to 0pt{
\tolerance=100000
\hbadness=100000
\parbox{4in}{
\rm\tiny #2\\ #3\\ #4}
\hss}
\marginpar{\box0}
\typeout{Draft Id: #2 #3 #4 #5 #6 #7}
\fi
}
</pre>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h2 class="title" style="clear: both"><a id="id2868511"
name="id2868511"></a>TeX Shells</h2>
</div>
</div>
<p>The iterative nature of TeX (edit, TeX, BibTeX, make
indexes, preview, repeat) can be tedious to perform by
hand. As a result, several TeX “shells”<a
id="id2868526" class="indexterm" name="id2868526"></a> have
been developed which provide a more automatic interface to
many aspects of the TeX process. Several of these packages
are described below. In everyday use, they make TeX much
more user friendly.</p>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2868544"
name="id2868544"></a>TeXShell</h3>
</div>
</div>
<p>TeXShell<a id="id2868553" class="indexterm"
name="id2868553"></a> was designed as an add-on for
emTeX<a id="id2868569" class="indexterm"
name="id2868569"></a> (it installs directly into the
emTeX directory hierarchy). This character-based
interface is available for both MS-DOS and OS/2. TeXShell
provides an editor, a complete help system, and fully
customizable push-button access to TeX. An example of the
TeXShell interface is shown in Figure <a
href="ch02.html#fig.texshell"
title="Figure 2.8. TeXShell">Figure 2.8</a>.
The default TeX menu and help windows are shown.</p>
<div class="figure">
<a id="fig.texshell" name="fig.texshell"></a>
<p class="title">
<b>Figure 2.8. TeXShell</b></p>
<div class="mediaobject">
<img src="figures/tex.02.08.png" alt="Screenshot" />
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2868647"
name="id2868647"></a>TeXPert</h3>
</div>
</div>
<p>TeXPert<a id="id2868656" class="indexterm"
name="id2868656"></a> is a character-based shell for TeX.
MS-DOS and OS/2 versions of TeXPert are available in
either German or English. The default configuration files
for TeXPert are designed to work with emTeX, but TeXPert
does not install directly into the emTeX directory
heirarchy. The TeXPert interface is shown in
Figure <a href="ch02.html#fig.texpert"
title="Figure 2.9. TeXPert">Figure 2.9</a>.</p>
<div class="figure">
<a id="fig.texpert" name="fig.texpert"></a>
<p class="title">
<b>Figure 2.9. TeXPert</b></p>
<div class="mediaobject">
<img src="figures/tex.02.09.png" alt="Screenshot" />
</div>
</div>
<p>TeXPert provides an editor, an archive tool for speedy
access to commonly used files, and an interface to
<b>grep</b> for quickly scanning files. The exact look
and feel of TeXPert can be customized.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2868748"
name="id2868748"></a>4TeX</h3>
</div>
</div>
<p>The 4TeX<a id="id2868757" class="indexterm"
name="id2868757"></a> system uses the <b>4DOS</b><a
id="id2868776" class="indexterm" name="id2868776"></a>
extended batch language and a number of utilities to
integrate emTeX<a id="id2868784" class="indexterm"
name="id2868784"></a> with a wide variety of free,
shareware, and commercial tools. The system is well
documented in a manual that describes installation,
setup, use, and customization. The 4TeX interface is
shown in Figure <a href="ch02.html#fig.fourtex"
title="Figure 2.10. 4TeX">Figure 2.10</a>.</p>
<div class="figure">
<a id="fig.fourtex" name="fig.fourtex"></a>
<p class="title"><b>Figure 2.10. 4TeX</b></p>
<div class="mediaobject">
<img src="figures/tex.02.10.png" alt="Screenshot" />
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2868860"
name="id2868860"></a>PMTeX</h3>
</div>
</div>
<p>PMTeX<a id="id2868868" class="indexterm"
name="id2868868"></a> is an OS/2 presentation manager
program. Although it does not provide a built-in editor,
it can control four independent DOS and OS/2 sessions,
one each for editing, TeX processing, previewing, and
printing. The options passed to each program can be
controlled from the PMTeX Options menu.</p>
<p>PMTeX was designed to work with emTeX, but can be
configured to use any TeX system. PMTeX was also designed
to support two preprocessors for phonetic transcription:
the TeuTeX-P<a id="id2868895" class="indexterm"
name="id2868895"></a> and ALDTeX-P<a id="id2868905"
class="indexterm" name="id2868905"></a> scanners. These
scanners are useful in dialectology and are available
separately from PMTeX's author.</p>
<p>A example of the PMTeX interface is shown in
Figure <a href="ch02.html#fig.pmtex"
title="Figure 2.11. PMTeX">Figure 2.11</a>.
Note that the menu bar is very wide and does not fit in a
standard 640x480 VGA window.</p>
<div class="figure">
<a id="fig.pmtex" name="fig.pmtex"></a>
<p class="title">
<b>Figure 2.11. PMTeX</b></p>
<div class="mediaobject">
<img src="figures/tex.02.11.png" alt="Screenshot" />
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<h3 class="title"><a id="id2868984"
name="id2868984"></a>TeXit</h3>
</div>
</div>
<p>The TeXit<a id="id2868993" class="indexterm"
name="id2868993"></a> shell (which I wrote) is much less
ambitious in many ways. Written entirely in Perl, TeXit
does not offer a full screen interface or an editor at
all. Instead, it provides a simple menu of choices as
shown in Figure <a href="ch02.html#fig.texit"
title="Figure 2.12. TeXit">Figure 2.12</a>
(all of the menu choices are completely
customizable).</p>
<div class="figure">
<a id="fig.texit" name="fig.texit"></a>
<p class="title">
<b>Figure 2.12. TeXit</b></p>
<pre class="screen">
Processing: ./driver.tex
Again? [?]status, [T]eX & View, [b]ibtex, [c]leanup,
[e]dit a file, [p]rint, [q]uery printer, [t]ex,
[v]iew, e[x]it:
</pre>
</div>
<p>One of TeXit's strengths is its ability to parse the
log file created by TeX and to determine when additional
actions are required. For example, TeXit will recognize
when a document contains unresolved references and
citations and can automatically run BibTeX and repeatedly
run TeX to resolve the references. With the addition of a
few “user specified” rules in the document,
TeXit can easily handle index construction and other more
sophisticated relationships.</p>
</div>
</div>
<div class="footnotes">
<br />
<hr width="100" align="left" />
<div class="footnote">
<p><sup>[<a id="ftn.id2788393" name="ftn.id2788393"
href="#id2788393">17</a>]</sup> Most word processors can
be coerced into saving your document in plain text. If
your word processor can do this, you may be able to edit
TeX documents with it.</p>
</div>
<div class="footnote">
<p><sup>[<a id="ftn.id2863345" name="ftn.id2863345"
href="#id2863345">18</a>]</sup> On file systems that
don't allow filenames to begin with a period, the name
frequently begins with an underscore instead.</p>
</div>
<div class="footnote">
<p><sup>[<a id="ftn.id2863594" name="ftn.id2863594"
href="#id2863594">19</a>]</sup> That's one of the reasons
that the regular GNU emacs TeX modes are described
first.</p>
</div>
<div class="footnote">
<p><sup>[<a id="ftn.id2863603" name="ftn.id2863603"
href="#id2863603">20</a>]</sup> A 16MHz 386SX machine
with only 8Mb of memory struggling to run GNU emacs under
OS/2. ;-)</p>
</div>
<div class="footnote">
<p><sup>[<a id="ftn.id2864021" name="ftn.id2864021"
href="#id2864021">21</a>]</sup> A minor mode is a kind of
editing environment provided by GNU emacs. If you are
unfamiliar with minor modes, consult your emacs
reference.</p>
</div>
<div class="footnote">
<p><sup>[<a id="ftn.id2866878" name="ftn.id2866878"
href="#id2866878">22</a>]</sup> There are two versions of
the program; the one discussed here is the version for
Windows.</p>
</div>
<div class="footnote">
<p><sup>[<a id="ftn.id2867356" name="ftn.id2867356"
href="#id2867356">23</a>]</sup> Or known to me,
anyway.</p>
</div>
<div class="footnote">
<p><sup>[<a id="ftn.id2867763" name="ftn.id2867763"
href="#id2867763">24</a>]</sup> Unfortunately,
parentheses can occur in the log file for other
reasons.</p>
</div>
</div>
</div>
<div class="navfooter">
<table width="100%" summary="Navigation table">
<tr>
<td width="40%" align="left"><a
title="Chapter 1. The Big Picture"
href="ch01.html"><img src="figures/nav-prev.png"
alt="Prev" border="0" /></a> </td>
<td width="20%" align="center"><a title="Making TeX Work"
href="index.html"><img src="figures/nav-home.png"
alt="Home" border="0" /></a></td>
<td width="40%" align="right"> <a
title="Chapter 3. Running TeX"
href="ch03.html"><img src="figures/nav-next.png"
alt="Next" border="0" /></a></td>
</tr>
<tr>
<td width="40%" align="left">Chapter 1. The Big
Picture </td>
<td width="20%" align="center"><a
title="Part I. An Introduction to TeX"
href="pt01.html"><img src="figures/nav-up.png" alt="Up"
border="0" /></a></td>
<td width="40%" align="right">
 Chapter 3. Running TeX</td>
</tr>
</table>
</div>
</body>
</html>
|