diff options
Diffstat (limited to 'Master/texmf-doc/doc/english/make-tex-work/html/ch02.html')
-rw-r--r-- | Master/texmf-doc/doc/english/make-tex-work/html/ch02.html | 2438 |
1 files changed, 2438 insertions, 0 deletions
diff --git a/Master/texmf-doc/doc/english/make-tex-work/html/ch02.html b/Master/texmf-doc/doc/english/make-tex-work/html/ch02.html new file mode 100644 index 00000000000..77c3f6ec357 --- /dev/null +++ b/Master/texmf-doc/doc/english/make-tex-work/html/ch02.html @@ -0,0 +1,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> + |