\chapter{Telling \LATEX{} Where It Goes}\label{telling} The environments described in Chapter~2 tell \LATEX{} the logical structure of your document. Sometimes this isn't enough and you have to give \LATEX{} more explicit formatting instructions. You may want to do something, like drawing a picture, that can't be described in any other way; you may disagree with the way \LATEX{} wants to format something; and, occasionally, you may have to help \LATEX{} because it's too stupid to do the right thing by itself. This chapter describes the commands for telling \LATEX{} exactly what you want it to do. \section{Space}\index{space} \label{space} There are simple commands to leave extra space---for example, you can produce \begin{quote} I like\hspace{.25in}extra \hspace{.25in}space \hspace{.25in} between words \end{quote} by typing \begin{example} I like\\hspace\{.25in\}extra \\hspace\{.25in\}space \\hspace\{.25in\} between words \end{example} The {\tt \\hspace}\index{!hspace} command leaves the indicated amount of extra horizontal\index{horizontal space} space, in this case .25 inch. Observe that \\TEX{} regards the {\tt \\hspace} command as a word when deciding where to leave blank space between words. That's why the actual space is slightly different in the three places where {\tt \\hspace} appears. The {\tt \\hspace} command leaves a horizontal space. There's a corresponding {\tt \\vspace}\index{!vspace} command for leaving vertical \index{vertical space} space. If you use it between paragraphs, then it has the expected effect of leaving the specified amount of additional space between the paragraphs. If\vspace{.125in} you use it in the middle of a paragraph, then it puts the extra vertical space after the line in which it appears. For example, the preceding sentence was typed as \begin{example} If\\vspace\{.125in\} you use it ... \end{example} Note that had I left a space after the {\tt If}, \TEX{} would have put inter-word space before and after the {\tt \\vspace} command, leaving too much space between ``If'' and ``you''. The space produced by an {\tt \\hspace} command will vanish if \TEX{} decides to break the line right where it appears. Similarly, the space produced by a {\tt \\vspace} will vanish if \TEX{} breaks the page there. You can produce space that doesn't vanish by using the {\tt \\hspacer}\index{!hspacer}\index{vertical spacer} or {\tt \\vspacer}\index{!vspacer}\index{horizontal spacer} commands, which work like {\tt \\hspace} and {\tt \\vspace} except in this respect. For example, you'll want to use a {\tt \\vspacer} command to leave some space between the top of a title page and the title. \section{Distance and Dimension} \label{distance}\index{distance} \subsection{Distances} So far, we've specifyied the distance in a {\tt \\CRSP}\index{!CRSP} command or in one of the above spacing commands in \index{inches}inches. You can also use metric units, writing {\tt \\hspace\{6.35mm\}}\index{mm} or \index{cm}{\tt \\hspace\{.635cm\}}, both of which are equivalent to \index{in}{\tt \\hspace\{.25in\}}. You can also specify distance in terms of the {\it point}\index{point}, which equals about $1/72^{\rm nd}$ of an inch, so {\tt 18pt}\index{pt} is about equal to {\tt .25in}. All of these dimensional units provide bad ways to specify distances. You should avoid using any command that does not work for all page layouts and document styles. A space of .25 inches that looks right for one page layout may look terrible if the pages are made narrower, or if you switch from single to double column pages. You should use distances that change with the page layout and document style. Various distances are provided for this purpose. The simplest one is the basic \TEX{} unit of distance called the \index{em}{\tt em}. This distance equals about the width of an ``M'' and depends upon the current type size and style. Here's an {\tt em} ruler for the current font. \begin{center} \dimdef0{1em} \begin{picture}(30,2.7)(0,0) \put(0,0){\line(1,0){30}} \multiput(1,0)(1,0){29}{\upline{.3}} \multiput(5,0)(10,0){3}{\upline{.45}} \put(9,1.5){\makebox(2,1){b}{10}} \put(19,1.5){\makebox(2,1){b}{20}} \put(29,1.5){\makebox(2,1){b}{30}} \thicklines \multiput(0,0)(10,0){4}{\upline{.6}} \end{picture} \end{center} \begin{small} And here's a ruler for the {\tt small} Roman font. \begin{center} \dimdef0{1em} \begin{picture}(30,2.7)(0,0) \put(0,0){\line(1,0){30}} \multiput(1,0)(1,0){29}{\upline{.3}} \multiput(5,0)(10,0){3}{\upline{.45}} \put(9,1.5){\makebox(2,1){b}{10}} \put(19,1.5){\makebox(2,1){b}{20}} \put(29,1.5){\makebox(2,1){b}{30}} \thicklines \multiput(0,0)(10,0){4}{\upline{.6}} \end{picture} \end{center} \end{small} The {\tt ex}\index{ex} is another unit of distance that depends upon current font. One {\tt ex} equals the height of the letter ``x''. Here's an {\tt ex} ruler for the current font. \begin{center} \dimdef0{1ex} \begin{picture}(30,2.7)(0,0) \put(0,0){\line(1,0){30}} \multiput(1,0)(1,0){29}{\upline{.6}} \multiput(5,0)(10,0){3}{\upline{.9}} \put(9,1.5){\makebox(2,1){b}{10}} \put(19,1.5){\makebox(2,1){b}{20}} \put(29,1.5){\makebox(2,1){b}{30}} \thicklines \multiput(0,0)(10,0){4}{\upline{1.2}} \end{picture} \end{center} \TEX{} regards the {\tt em} and {\tt ex} as basic units of distance, just like the {\tt in}, so you can write things like {\tt \\hspace\{3.2em\}}. It's a good idea to use the {\tt em} for horizontal distances and the {\tt ex} for vertical distances. Here are some more style-dependent distances that you might want to use. \begin{description}{{\tt \\the\\parindent}:} \labelitem{{\tt \\the\\parindent}:}\index{!the!parindent}The distance \index{!parindent}which the first line of a new paragraph is indented in the current environment. \labelitem{{\tt \\the\\parskip}:}\index{!parskip}\index{!the!parskip}The extra vertical space put between paragraphs in the current environment. \labelitem{{\tt \\textheight}:} \index{!textheight}The height that \TEX{} tries to make a page of text. This is the height of the actual text, and does not include any heading or page number that appears above or below the text. \labelitem{{\tt \\textwidth}:} \index{!textwidth}The width of the text on the page. \labelitem{{\tt \\columnwidth}:}\index{!columnwidth}The width of one column of printing on the page. In a single-column format like the one in which most of this document is printed, \hbox{\tt \\columnwidth} equals \hbox{\tt \\textwidth}. \labelitem{{\tt \\the\\hsize}:}\index{!hsize}\index{!the!hsize}The line width of the current environment. It usually equals \goodlinebreak \hbox{\tt \\columnwidth}, but is different inside some environments such as \index{verse environment}{\tt verse}. \end{description} Don't to forget the {\tt \\the} in \hbox{\tt \\the\\parindent}, \hbox{\tt \\the\\parskip} and \hbox{\tt \\the\\hsize}. Remember also that {\tt 0}\index{0} is not a distance, and you'll get an error message if you try to use it as one. The following {\it are\/} distances: {\tt 0in}, {\tt 0cm}, {\tt 0em}, {\it etc}. A distance of {\tt .25in} may not wind up being {\tt .25in} when it appears on the printed page. There may be some uniform scaling of all dimensions, depending upon the page layout and document style used. All that you can rely upon is that a distance of {\tt .25in} will be precisely half as long as a distance of {\tt .5in}. \subsection{Dimensions} \index{dimensions}\label{dimensions} Let's look more closely at a distance like {\tt .25in}. It has the format {\it scale factor\/} times {\it dimension\/}. A distance like \hbox{\tt \\the\\hsize} is not a dimension and can't be multiplied by a scale factor; you'll get a mysterious error message if you try using \hbox{\tt .05\\the\\hsize} as a distance. To help you produce a space that's \(1/20^{\rm th}\){} the distance of {\tt \\the\\hsize}, \LATEX{} provides ten definable\index{definable dimensions}\index{dimensions, definable} dimensions called {\tt \\dim0}\index{!dim} \(\ldots\){} {\tt \\dim9}. Dimension \hbox{\tt \\dim0} is used by the {\tt picture}\index{picture environment} of Section~\ref{picture}, so you should use the other nine for other things. These dimensions are set by a command like \begin{example} \\dimdef3\{\\the\\hsize\}\index{!dimdef} \end{example} which sets {\tt \\dim3} to be a dimension such that {\tt 1\\dim3} equals the current value of {\tt \\the\\hsize}. You can then get a distance that is .05 times {\tt \\the\\hsize} by writing {\tt .05\\dim3}. You can also set a {\tt \\dim} to the width of an object, such as a piece of text, with the {\tt \\dimofdef}\index{!dimofdef} command. Typing \begin{example} \\dimofdef6\{gnus and gnats\} \end{example} makes {\tt 1\\dim6} equal to the width of the text ``gnus and gnats'', as set in the current font. Thus, subsequently typing \begin{example} \\begin\{verse\} gnus and gnats and armadillos \\CR \\hspacer\{1\\dim6\} and armadillos \\end\{verse\} \end{example} produces \dimofdef6{gnus and gnats} \begin{verse} gnus and gnats and armadillos \CR \hspacer{1\dim6} and armadillos \end{verse} The setting of a dimension by {\tt \\setdim} is local to the current environment and reverts to its previous setting upon leaving that environment. This convention should never be a problem, since any settings you want to remain in effect after an environment can be made before entering the environment, and it can sometimes be useful. However, it can cause trouble if you forget it. \subsection{Negative Distances} So far, I've mentioned only positive distances. Distances can also be negative. You get a negative distance by using a negative scale factor, writing something like {\tt -1.3em} or {\tt -0.7\\dim4}. Negative distances work the way they should in {\tt \\hspace} or {\tt \\vspace}. For example, typing \begin{example} A Misteak \\hspace\{-5em\}- - - - - - - - \end{example} produces \begin{quote} A Misteak \hspace{-5em}- - - - - - - - \end{quote} Small amounts of negative space are often useful for funny effects, like producing ``t\hspacer{-.1em}h\hspacer{-.1em}i\hspacer{-.1em}n'' by typing \begin{example} ``t\\hspacer\{-.1em\}h\\hspacer\{-.1em\}i\\hspacer\{-.1em\}n'' \end{example} Negative vertical space can be used to remove any unwanted space added by \LATEX{}. \subsection{Stretching and Shrinking}\index{stretching}\index{shrinking} \label{stretching} A distance like {\tt .25in} is fixed throughout the document; an {\tt \\hspace\{.25in\}} produces the same space anywhere it appears. However, \TEX{} also has some other distances that are not fixed in this way and can stretch or shrink a bit to make things fit better. For example, \index{!the!parskip} {\tt \\the\\parskip} will be such a stretchable distance in many document styles, so two different \begin{example} \\hspace\{\\the\\parskip\} \end{example} commands need not produce the same amount of space. However, dimensions are never stretchable, so if you set {\tt \\dim\{2\}} to {\tt \\the\\parskip}, you get a fixed dimension that equals the normal, unstretched distance of {\tt \\the\\parskip}. Spacers, the objects produced by {\tt \\hspacer}\index{!hspacer} and \index{!vspacer}{\tt \\vspacer} commands, also do not stretch or shrink; they assume the normal, unstretched distance of their argument. Exactly how one defines stretchable distances is not important; if you're curious, you can look it up in Chapter~12 of \knuth. What is important is that there's a special space {\tt \\hfill}\index{!hfill} that will stretch as far as it can---pushing everything else out of the way. The {\tt \\hfill} command can be used in various ways, as illustrated by \begin{example} \\begin\{description\}\{Armadillos:\} \\labelitem\{\\hfill Gnu:\} A \index{gnu}pesky animal% that comes right up to you. \\labelitem\{\\hfill Gnat:\\hfill\} A \index{gnat} middle of the road insect. \\labelitem\{Gnome\\hfill:\} A really spaced-out \index{gnome} fellow. \\labelitem\{\\hfill Armadillo:\} A creature \index{armadillo}% that takes up all the available room. \\end\{description\} \end{example} which produces: \begin{description}{Armadillo:} \labelitem{\hfill Gnu:} A pesky animal that likes to come right up to you. \labelitem{\hfill Gnat:\hfill } A middle of the road insect. \labelitem{Gnome\hfill :} A really spaced-out fellow. \labelitem{\hfill Armadillo:} A creature that takes up all the available room. \end{description} Note that two {\tt \\hfill}'s trying to stretch out in the same space produce equal distances; this is how \TEX{} centers things. If there's no room to stretch out, as in the last item label, {\tt \\hfill} produces a distance of {\tt 0in}. The distance produced by {\tt \\hfill} can stretch but not shrink. The command that {\tt \\hss}\index{!hss}. produces a distance that can shrink or stretch arbitrarily much. This distance can shrink not just to zero, but to an arbitrary negative distance, which is sometimes useful. You might want to experiment to see what happens when {\tt \\hfill} and {\tt \\hss} are used inside an environment like {\tt verse}\index{verse environment} or {\tt center}\index{center environment} in which lines are ended with \index{!CR}{\tt \\CR}. \section{Boxes, Little Boxes}\label{boxes}\index{boxes} The descripton of the {\tt picture} environment in Section~\ref{picture} had a lot to say about putting boxes in pictures. Well, you can also put boxes in the middle of your text. There are two reasons for doing this: \begin{itemize} \item \TEX{} won't split a box across two lines, or across two pages, so it provides a way of holding things together. \item You can specify the size of the box, and this provides a method for do-it-yourself formatting. \end{itemize} \TEX{} provides two flavors of boxes: horizontal\index{horizontal boxes} and \index{vertical boxes}vertical. You make a vertical box with the command \begin{example} \\vbox\{{\it{}contents of box\/}\}\index{!vbox} \end{example} You'll hardly ever use this, so I won't say anything more about it; the {\tt \\vbox} command is explained in chapters 11 and ?? of \knuth. Horizontal boxes are more common. There's an {\tt \\hbox} command for making a horizontal box that fits snugly around its argument. Typing \hbox{\tt \\hbox\{armadillo\}} produces exactly the same output as typing \hbox{\tt armadillo}, except that \TEX{} will never split the {\tt \\hbox} between two lines, whereas the plain {\tt armadillo} might be severed with a hyphen, and its two halves dumped on different lines. Horizontal boxes also keep stretchable distances\index{stretchable distance} in them from stetching or shrinking. If you type \begin{example} ``gnus and gnats'' \end{example} in the middle of a paragraph, the width of ``gnus and gnats'' can change because the space between the words is stretchable. However, typing \begin{example} \\hbox\{``gnus and gnats''\} \end{example} produces a box whose width is fixed. You can make a horizontal box with a \boxit{real box} around it by typing \begin{example} \\boxit\{real box\}\index{!boxit} \end{example} There are three commands for making boxes that can help with tricky format. The command \hbox{\tt \\lbox3\{{\it text\/}\}} \index{!lbox} produces a box whose width is {\tt 1\\dim3} \index{!dim} containing {\it text\/} left-justified\index{left justified} inside it. The commands {\tt \\rbox}\index{!rbox} and {\tt \\cbox}\index{!cbox} are the same except the text is right-justified\index{right justified} and centered\index{centered}, respectively. (Of course, you can use any {\tt \\dim}, not just {\tt \\dim3}.) These commands can be used to produce arrays, but there's not much point when you have the {\tt array}\index{array environment} and {\tt tabular}\index{tabular environment} environments. You can also use these commands is to fool \TEX{} into thinking that something is smaller than it is. For example, to get the {\tt \\magic}\index{!magic} in the example on page~\pageref{magic}, you can type \begin{example} \\dimdef2\{0in\}\\lbox2\{\\(\^\{(a)\}\\)\} \end{example} which first defines {\tt 1\\dim2} to be zero inches, then puts \(^{(a)}\), left-justified, in a box of width {\tt 1\\dim2}. (In Section~\ref{def}, you'll learn how to define the command named {\tt \\magic}.) You can produce a black box like \rule{.2in}{.1in}{-.05in} with the command \begin{example} \\rule\{.1in\}\{.2in\}\{-.05in\}\index{!rule} \end{example} The first argument is the width of the box, the second is its height, and the third is the distance above the ``baseline'' of its bottom edge. The baseline\index{baseline} is the vertical position at which \TEX{} puts the bottom of most letters---{\it i.e.}, letters like ``n'' and ``T'' that don't extend below the line the way ``g'' does. A line is just a thin box, so you can produce \rule{.5in}{.01in}{.05in} by typing \begin{example} \\rule\{.5in\}\{.01in\}\{.05in\} \end{example} A {\tt \\rule} with a zero width is called a ``strut''\index{strut}.\label{strut} Because it has no width, you can't see a strut. However, a strut does have height, and \TEX{} will adjust its the vertical spacing exactly as if there were a character there. For example, consider \begin{quote} \boxit{box} and \boxit{\rule{0ex}{3ex}{-1ex}box} \end{quote} which was typed as \begin{example} \\boxit\{box\} and \\boxit\{\\rule\{0ex\}\{3ex\}\{-1ex\}box\} \end{example} \section{The Tabbing Environment}\label{tabbing}\index{tabbing environment} \LATEX's \hbox{\tt tabbing} environment provides a way to format programs and other material in which text must be aligned. The {\tt array} \index{array environment} environment of Section~\ref{array} and the {\tt tabular} environment of Section~\ref{tabular} \index{tabular environment} also align text. There are two essential differences between the \hbox{\tt tabbing} environment and these other environments that will determine which you should use. \begin{itemize} \item \TEX{} can split \hbox{\tt tabbing} environments across two or more pages, so a long \hbox{\tt tabbing} environment can appear in the middle of your text. An {\tt array} or {\tt tabular} environment appears on a single page, so a long array or table should be placed in a {\tt figure}\index{figure environment} or {\tt table}\index{table environment} that ``floats'' to the top of the next page. \item \TEX{} figures out the width of each column of an {\tt array} or {\tt tabular} environment for you, based upon what is in the column. In the \hbox{\tt tabbing} environment, you must explicitly set the column widths using ``tab setting'' \index{tab setting} commands. \end{itemize} To give a precise description of the \hbox{\tt tabbing} environment commands, I'll start by defining some concepts. Each line of a {\tt tabbing} environment consists of \index{column}{\it columns}. Columns are begun by \index{tab stop}{\it tab stops}. Tab stop 0, which begins column 1, is always set at the prevailing left margin of the \hbox{\tt tabbing} environment. Column 2 begins at tab stop 1, and so on. Each line has a {\it left margin}, which is set at a tab stop. Text in a line normally begins at the left margin, so if the left margin is set at tab stop 2, then the text will normally begin in column 3. However, by issuing special commands, you can put text to the left of a line's left margin. At the start of the \hbox{\tt tabbing} environment, there is just a single column and a single tab stop---column 1 and tab stop 0; the left margin is set at tab stop 0. Let's suppose that we've set tab stops 1 through 5, so there are six columns (columns 1 though 6), and the left margin is currently set at tab stop 2. When we begin typing the current line of text, what we type will start at tab stop 2, which marks the beginning of column 3. If we type the command {\tt \\>}\index{!>} (read ``tab''\index{tab}), the subsequent text will begin at tab stop 3---that is, at the beginning of column 4.\footnote{The command {\tt \\>} has another meaning in raw \TEX{}. It, and the other formatting commands described in this section, revert to their ordinary \TEX{} meaning outside the \hbox{\tt tabbing} environment.} Another {\tt \\>} command takes us to tab stop 4, which is the beginning of column 5, and so on. The line is ended by a {\tt \\CR}\index{!CR} or {\tt \\CRSP}\index{!CRSP} command, just like the {\tt verse}\index{verse environment} environment of Section~\ref{paragraph}. (The argument of the {\tt \\CRSP} is a distance that specifies how much extra space to leave between this line and the next.) Thus, typing \begin{example} abc \\> def \\>\\> xyz \\CR a \\> d \\> g \\> ... \end{example} produces the following two lines, where the tab stops are indicated. \dimofdef1{gnat }\dimofdef2{gnu }\dimofdef3{arma}\dimofdef4{dillo } \dimofdef5{foo} \begin{tabbing} \lbox1{\rule{.03em}{1.5ex}{0pt}}\= \lbox2{\rule{.03em}{1.5ex}{0pt}}\= \lbox3{\rule{.03em}{1.5ex}{0pt}}\= \lbox4{\rule{.03em}{1.5ex}{0pt}}\= \lbox5{\rule{.03em}{1.5ex}{0pt}}\= \rule{.03em}{1.5ex}{0pt}\+\+\CR abc \> def \>\> xyz \CR a \> d \> g \> \(\ldots\){} \end{tabbing} If you put more text in a column than will fit, then the next {\tt \\>} command may move the current position to the left in order to put it at the next tab stop. This is really what you want to happen, since the next thing you type might be another {\tt \\>} command. However, you should realize that, unlike the tab key on a typewriter, a {\tt \\>} allows you to overwrite text. The left margin of the next and all following lines is moved one tab stop to the right by the command {\tt \\+}\index{!+}, and is moved one tab stop to the left by the command {\tt \\-}\index{!-}. Tab stops are set using the {\tt \\=} command. The easiest way to think of this command is that it is the same as {\tt \\>} except that the appropriate tab stop is set so that the {\tt \\>} has no effect. More precisely, if this command appears in the text of column $i$, it sets tab stop $i$ to the current text position and begins column \(i+1\). Thus, typing \begin{example} \\begin\{tabbing\} gnat \\= gnu \\= arma\\= dillo \\= foo \\= \\+\\+\\CR abc \\> def \\>\\> xyz \\CR a \\> d \\> g \\> ... \end{example} produces \begin{tabbing} gnat \= gnu \= arma\= dillo \= foo \= \+\+\CR abc \> def \>\> xyz \CR a \> d \> g \> \(\ldots\){} \end{tabbing} Note the effect of spaces in this example. Commands like {\tt \\=} and {\tt \\>} ``gobble up'' spaces\index{space} and carriage \index{carriage return}returns that follow them, but spaces that precede them count. (Remember that a carriage return and any number of spaces count as a single space, but two carriage returns means start a new paragraph, which would make no sense here, so it is an error.) It is convenient to be able to set tab stops without producing text. This is done with the command \index{!XCR}{\tt \\XCR}, which is just like {\tt \\CR} except that it throws away the current line instead of producing output for it. The effect of any {\tt \\=}, {\tt \\+} or {\tt \\-} in that line remains. Thus, replacing the first {\tt \\CR} in the above example by {\tt \\XCR} produces the output of the first example. It is nice to be able to put something to the left of the current left margin without changing the margin---{\it i.e.}, without having to use {\tt \\+} and {\tt \\-} commands. The command {\tt \\<}\index{!<} at the beginning of a line has the effect of moving the current text position one tab stop to the left without changing the current margin. You can use as many {\tt \\<} commands in a row as you want, as long as you don't try to go past tab stop 0, but they must appear at the beginning of the line. With the above commands, it is easy to left-justify text in columns. However, one often wants to right-justify text. This can be done with the {\tt \\'}\index{!'} command. This command moves everything that you have typed so far in the current column---everything starting from the most recent {\tt \\>}, {\tt \\<}, {\tt \\'}, {\tt \\CR}, {\tt \\CRSP} or {\tt \\XCR} command---to the left of the current column, leaving you positioned once again at the beginning of the column. To see how it works, let's once again assume that the current left margin is at tab stop 2. Typing \begin{example} a \\> b \\>c \\>d \\CR dillo:\\' a \\> \\> nat\\' d \end{example} produces \begin{tabbing} \lbox1{\vrule height 1.5ex}\= \lbox2{\vrule height 1.5ex}\= \lbox3{\vrule height 1.5ex}\= \lbox4{\vrule height 1.5ex}\= \lbox5{\vrule height 1.5ex}\=\+\+\XCR a \> b \>c \>d \CR dillo:\' a \> \> nat\' d \end{tabbing} The {\tt \\'} command leaves a fixed amount of space to the right of the text, before the beginning of the column. (The amount of space is determined by the document style\index{document style}.) The {\tt \\'} command allows you to right-justify\index{right justified} text to the left of any tab stop. (You can even use it to put text to the left of tab stop 0, causing the text to extend into the page margin.) However, it can't right-justify text in the last column because there's no tab stop to the right of it. The \index{!`}{\tt \\`} command right-justifies all the text that follows it, up to the {\tt \\CR} or {\tt \\CRSP}, moving it to the prevailing right margin of the \hbox{\tt tabbing} environment. There must be no {\tt \\>} or {\tt \\'} command between the {\tt \\`} and the command that ends the line. These commands make it easy to produce left-justified and right-justified text. Getting text \index{centered} centered in a column isn't as easy, but it can be done using {\tt \\dim}\index{!dim} commands. For example, to center text in column 4, you can set \index{!dim}{\tt \\dim4} to the desired column width, set column 4 to that width by typing \hbox{\tt \\= \\cbox4\{\}\\=}, and use a \index{!cbox}{\tt \\cbox4} command to produce a centered entry in column 4. Definitions made in a \hbox{\tt tabbing} environment are local to the column in which they appear. This includes {\tt \\dim} definitions. Therefore, when using {\tt \\dim} commands for formatting inside a \hbox{\tt tabbing} environment, you should define the {\tt \\dim} sizes before the environment. Finally, you may want to change your tab stop settings for a few lines and then return to the original settings. If you type a \hbox{\tt \\pushtabs}\index{!pushtabs} command, all the tab stop settings you then make disappear when you type \hbox{\tt \\poptabs}\index{!poptabs}, reverting to their previous settings. You can nest \hbox{\tt \\pushtabs} and \hbox{\tt \\poptabs} commands in the obvious way. However, every \hbox{\tt \\pushtab} in the \hbox{\tt tabbing} environment must have a corresponding \hbox{\tt \\poptab}. As with the {\tt array} and {\tt tabular} macros, any environment that is begun in one column must be ended in the same column. More precisely, no environment can contain any of the following commands unless it contains the entire \hbox{\tt tabbing} environment: {\tt \\>}, {\tt \\+}, {\tt \\-}, {\tt \\CR}, {\tt \\CRSP}, {\tt \\XCR}, {\tt \\<}, {\tt \\=}, {\tt \\'}, {\tt \\`} \hbox{\tt \\pushtabs} or \hbox{\tt \\poptabs}. \begin{figure}{A sample picture.} \dimdef0{.7pt} \begin{small} \begin{picture}(440,150)(0,0) \put(10,125){\makebox(150,20){b}{sender}} \put(140,125){\makebox(150,20){b}{transmission medium}} \put(270,125){\makebox(150,20){b}{receiver}} \put(40,0){\dashbox(90,120){10}} \put(50,10){\frame{\makebox(70,100){}{SENDER}}} \put(300,0){\dashbox(90,120){10}} \put(310,10){\frame{\makebox(70,100){}{RECEIVER}}} \put(170,0){\dashbox(90,120){10}} \thicklines \put(180,70){\frame{\makebox(70,40){}{MXMIT}}} \put(180,10){\frame{\makebox(70,40){}{AXMIT}}} \thinlines \put(20,60){\rarrowline(1,0){30}} \put(0,10){\makebox(20,100){l}{\lstack{S\cr E\cr N\cr D}}} \put(380,60){\larrowline(1,0){30}} \put(410,10){\makebox(20,100){r}{\stack{R\cr E\cr C\cr E\cr I\cr V\cr E}}} \put(120,30){\rarrowline(1,0){60}} \put(120,90){\larrowline(1,0){60}} \put(250,30){\rarrowline(1,1){60}} \put(250,90){\larrowline(1,-1){60}} \end{picture} \end{small} \label{pictexam} \end{figure} \section{Pictures} \index{pictures}\index{picture environment}\label{picture} The {\tt picture} environment allows you to create just about any kind of picture you want containing text, lines, arrows and circles.\footnote{This environment is based upon macros written by Brendan D. McKay \cite{mcckay}.} Figure~\ref{pictexam} gives an example of the kind of pictures you can draw. You tell \LATEX{} where to put things in the picture by specifying their coordinates. A coordinate\index{coordinate} is a number that may have a decimal point and a minus sign---a number like {\tt 5}, {\tt 2.3} or {\tt -3.1416}. A coordinate specifies a distance in multiples of the unit dimension \hbox{\tt \\dim0}\index{!dim0}, so in \hbox{\tt \\dim0} has been set to a distance of {\tt 1cm}, then the coordinate {\tt 2.54} specifies a distance of 2.54 centimeters. Section~\ref{dimensions} on page\pageref{dimensions} describes how to set {\tt \\dim0}. A {\it position\/}\index{position} is a pair of coordinates, such as \hbox{\tt (2.4,-5)}, which specifies the point with $x$-coordinate {\tt 2.4} and $y$-coordinate {\tt -5}. Coordinates are specified in the usual way with respect to an \index{origin}origin, which is determined by the arguments to the \hbox{\tt picture} environment. Note that when a position appears as an argument, it is not enclosed in braces; the parentheses serve to delimit the argument. The \hbox{\tt picture} environment has two arguments, both positions. The first argument specifies the size of the picture. \TEX{} treats the picture as a rectangle with width equal to this argument's $x$-coordinate, and height equal to its $y$-coordinate. The second argument gives the coordinates of the point at the lower-left corner of the picture (thereby determining the origin). For example, if \hbox{\tt \\dim0} has been set to {\tt 1pt}, the command \begin{example} \\begin\{picture\}(100,200)(10,20) \end{example} produces a picture of width 100 points and height 200pts, whose upper-right corner is the point \hbox{\tt (110,220)}. When you first draw a picture, you will make the second argument \hbox{\tt (0,0)}, so the origin is at the lower-left corner. However, you will sometimes want to modify a picture by shifting everything, which is easy to do by changing the second argument. The environment's first argument determines the nominal size of the picture. This need bear no relation to how large the picture really is; \LATEX{} will happily allow you to put things outside the picture, or even off the page. The picture's nominal size is used by the surrounding environment to determine where the picture is placed. In a \index{figure environment}{\tt figure}, it is horizontally centered, and its height is used to compute the height of the figure. However, a {\tt picture} environment can appear anywhere, even in the middle of a paragraph. The most common picture command is \begin{example} \\put($x$,$y$)\{{\it{}object\/}\}\index{!put} \end{example} which puts the specified object in the picture, with its {\it reference point\/} at coordinates $(x,y)$. The most common objects and their reference points, are listed below. \begin{description}{{\it Arrows\/}:} \labelitem{{\it Text\/}:}Ordinary text, which may include \hbox{\tt math} \index{math environment}environments is put on a single line. Its reference point is the lower-left corner of the first (left-most) character. \labelitem{{\it Lines\/}:}The command \hbox{\tt \\upline\{$l$\}}\index{!upline} draws a vertical line of height $l$ units having its bottom as its reference point, where $l$ is a coordinate. The command \index{!line}\hbox{\tt \\line($x$,$y$)\{$l$\}} produces a nonvertical line whose horizontal extent is $l$ units, whose slope is $x/y$, and whose reference point is its leftmost point. In other words, if placed on the origin, it would extend to the point with coordinates $(l, ly/x)$. Thus, the line extends to the right and upwards if $y > 0$, downwards if $y < 0$, and horizontally if $y=0$. Both $x$ and $y$ must be integers (numbers without decimal points) with $0 < x \leq 6$ and $0 \leq |y| \leq 6$, and they must have no common divisors.\footnote{More precisely, they must have no common divisors unless $y = 0$, in which case you should let $x=1$.} Thus, the following positions are {\it not\/} valid arguments of a {\tt \\line} command: \hbox{\tt (1.4, 3)}, \hbox{\tt (2,4)}, \hbox{\tt (0,1)}, and \hbox{\tt (1,7)}. \labelitem{{\it Arrows\/}:}Vertical \index{arrows}arrows are drawn by the {\tt \\uparrow\{$l$\}}\index{!uparrow} and \index{!downarrow}{\tt \\downarrow\{$l$\}} commands. They are the same as the {\tt \\upline} command, except an arrowhead is placed at the appropriate end of the line. In both cases, the reference point is at the bottom of the arrow. Nonvertical arrows are drawn with the \index{!larrowline}{\tt \\larrowline} and \index{!rarrowline}{\tt \\rarrowline} commands, having the same arguments as the {\tt \\line} command. They draw a line just like the corresponding {\tt \\line} command, except with an arrowhead at the appropriate end. However, the first pair of arguments $(x,y)$ must satisfy the additional constraints: $x,|y| \,\leq\,4$. Drawing an arrow of length zero produces just the arrowhead. If you simply must have an arrow with slope (2,5), try combining a line of that slope with an arrowhead of slope (1,3). \labelitem{{\it Boxes\/}:}The \index{boxes}command \begin{example} \\makebox($x$,$y$)\{{\it{}pos\/}\}\{{\it{}obj\/}\}\index{!makebox} \end{example} produces a rectangular object of width $x$ units and height $y$ units, with its bottom left corner as reference point. The item specified by {\it obj\/} is positioned within this rectangle as specified by the {\it pos\/} argument. If {\it pos\/} is null, then the item is centered. Putting one or two of the following characters in the {\it pos\/} argument changes this as indicated below: \begin{description}{{\tt b}:} \labelitem{{\tt t}:}Moves \index{t}the item to the top of the rectangle. \labelitem{{\tt b}:}Moves \index{b}the item to the bottom. \labelitem{{\tt l}:}Moves \index{l}the item to the left. \labelitem{{\tt r}:}Moves \index{r}the item to the right. \end{description} The {\it obj\/} argument can be any object---but the results will be surprising if you use a line or arrow. You can also use a list of {\tt \\put} commands as the {\it obj\/} argument. This has the obvious effect, with the reference\index{reference point} point of the {\tt \\makebox} object serving as the origin for the {\tt \\put}s. However, the {\it pos\/} argument of the {\tt \\makebox} should be {\tt bl} or strange things will happen. The {\tt \\frame}\index{!frame} command is used to place a rectangular outline around an object. Typing $$\hbox{\tt \\frame\{\\makebox (20,30) $\ldots$ \}}$$ produces a $20\times30$ rectangle around the contents of the {\tt \\makebox}. You should use this command rather than the \hbox{\tt \\boxit}\index{!boxit} command of Section~\ref{boxes} in a picture because \hbox{\tt \\boxit} adds extra space that will mess things up. The command \begin{example} \\dashbox($x$, $y$)\{$d$\}\index{!dashbox} \end{example} produces a rectangle of dimension $x \times y$ drawn with dashed lines, where $d$ is the width of each dash. It looks best when $x$ and $y$ are both multiples of $d$. \labelitem{{\it stacks\/}:}The command\index{stacks} \begin{example} \\stack\{${\it{}obj\/}â??{1}$ \\cr ${\it{}obj\/}â??{2}$ \\cr $\ldots$% ${\it{}obj\/}â??{n}$\}\index{!stack} \end{example} produces an object containing the subobjects ${\it obj\/}â??{i}$ stacked vertically. Its reference point is the lower left corner of the stack, and each object is centered in the stack. The command \hbox{\tt \\lstack}\index{!lstack} works the same, except the objects are left-justified. Don't leave any extra spaces in the argument, except after a \hbox{\tt \\cr}\index{!cr} command. (As explained in Section~\ref{commands}, spaces always vanish after a command name.) \labelitem{{\it dots\/}:}The \index{dots}command \index{!spec}{\tt \\spec} produces a dot at its reference point. \labelitem{{\it circles\/}:}There \index{circles}will be commands to draw circles, arcs \index{arcs}of circles, and perhaps some \index{ellipses}ellipses. These have not yet been implemented. \end{description} You can do almost everything with the commands described above, but there are some additional commands that raise new possibilities, and make some things a little easier. \begin{itemize} \item The command \index{!savebox}\hbox{\tt \\savebox$i$} is like \hbox{\tt \\makebox} except that instead of drawing the object, it saves the object in {\it picture box\/}\index{picture box} \(i\), where $i$ is a number from {\tt 0} through {\tt 9}. The saved object can be recalled with the command \index{!usebox}{\tt \\usebox$i$}. For example, \begin{example} \\savebox3(22,17.3)\{t\}\{{\it{}obj}\} \\put(0,-3.5)\{\\usebox3\} \end{example} draws the same thing as \begin{example} \\put(0,-3.5)\{\\makebox3(22,17.3)\{t\}\{{\it{}obj}\}\} \end{example} and saves the drawn object for future use. If a \hbox{\tt \\savebox} is used in a \hbox{\tt picture} environment, the object is saved only for that picture. You can save an object for use in more than one picture by putting the \hbox{\tt \\savebox} command outside of any environment. However, saved pictures use \TEX's memory space, so you should get rid of them as soon as possible by putting a null object in the picture box with a command such as \hbox{\tt \\savebox3(0,0)\{\}\{\}}. \item The command \begin{example} \\multiput($x$,$y$)($\Delta x$,$\Delta y$)\{$n$\}\{{\it{}obj\/}\}% \index{!multiput} \end{example} is equivalent to the $n$ commands \begin{example} \\put($x+i\Delta x$,$y + i\Delta y$)\{{\it{}obj\/}\} \end{example} for $i = 0,\ldots,n-1$. Thus, it puts $n$ copies of the specified object into the picture, starting at position $(x,y)$ and stepping the position by $(\Delta x,\Delta y)$ units each time. Don't use a {\tt \\multiput} with $n$ much greater than 100, or \TEX{} may run out of room. \item You can increase the width of all lines---including the ones produced by a {\tt \\frame} command---with the command \index{!thicklines}{\tt \\thicklines}. The command \index{!thinlines}{\tt \\thinlines} \linebreak switches back to ordinary width lines. These commands are local to the current environment. To make a global change, applicable to all future {\tt picture} environments, you must put the {\tt \\thickline} or {\tt \\thinline} command outside any environment, at the outermost text level. \end{itemize} That's all there is to it, so you can let your creative imagination run wild. Before you do, you should remember the following simple rules to help avoid mistakes. \begin{itemize} \item The {\tt picture} environment has two position arguments. \item Remember the constraints on the slopes of lines and arrows. Don't try to draw a vertical line with the {\tt \\line command}. \item The {\tt \\line} command and its {\tt arrowline} derivatives specify the horizontal extent of the line, not its length. \item The reference point of a {\tt \\larrowline} or {\tt \\downarrow} command is the tip of its arrowhead. \item When you have a list of {\tt \\put}s inside a {\tt \\makebox}, use the {\tt bl} position option for the {\tt \\makebox}, and remember that the origin for the {\tt \\put} coordinates is the reference point of the {\tt \\makebox}. \end{itemize} \section{Numbering Your Own Footnotes}\label{nfootnote}\index{footnotes} In Section~\ref{footnotes}, I said that \LATEX{} sometimes messes up the footnote numbering when footnotes are numbered consecutively within a page. There is a fundamental reason why this happens that sheds some useful light on how \TEX{} operates, so I will explain it in some detail. \label{page-breaking} \TEX{} always finishes the current paragraph before deciding where to start a new \index{page breaking} page. It does this in order to produce the best-looking line and page breaks. Consequently, \TEX{} has to finish the paragraph containing a footnote, which means choosing the footnote number, before it knows what page the footnote will be on. The {\tt \\footnote} command guesses that the current footnote will appear on the current page of output, and produces a number accordingly. However, if the footnote appears on the last paragraph that is begun on the current page, \TEX{} may decide to break the paragraph before the footnote, so the command's guess will be wrong. This is the reason for certain other anomalies---like some of \LATEX's warning messages occasionally giving the wrong page number. You shouldn't worry about them now, but if you find that some page number is off by one, this may be the reason. But these anomalies are rare and unimportant; the table of contents, index entries and cross-references {\it never\/} get the wrong page number. (Well, hardly ever.) Meanwhile, what do we do if \LATEX{} does produce an incorrect footnote number? You shouldn't do a thing. When you rewrite the manuscript, it will change where the page breaks occur and the problem may go away. Only when you're sure that this is the final version should you worry about the problem. At that time, you must replace the offending {\tt \\footnote} commands by \hbox{\tt \\nfootnote}\index{!nfootnote} commands to tell \LATEX{} what footnote number to use. The \hbox{\tt \\nfootnote} command has two arguments, the first of which is the number of the footnote to be produced. For example, if the footnotes are ``numbered'' \(^{\ast}\), \(^{\dagger}\), \(^{\ddagger}\), then you type \begin{example} \\nfootnote\{2\}\{ ... \} \end{example} to produce a footnote ``numbered'' \(^{\dagger}\). \section{Giving \TEX{} a Break}\label{break} Your manuscript file is a string of characters. To turn it into a printed document, your it must first be broken into lines, and these lines must then be broken into pages. \TEX{} does a very good job of this, but sometimes it needs your help. You needn't worry about page and line breaking until \TEX{} does something wrong, at which time you can read this section to find out what to do. \subsection{Line Breaking}\label{lbreak} \index{line breaking} \TEX{} is happy to break a line anywhere you leave a space between words. For example, if you type \hbox{\tt page 5}, the ``page'' and the ``5'' might end up on two lines, which is generally considered bad form. To prevent this, you type {\tt page\~5}\index{\string ~}; the {\tt \~} creates a space at which \TEX{} will not break the line. \TEX{} is a perfectionist; it isn't satisfied unless it can find a good way to break a paragraph into lines. Very often, it can find no way that meets its standards. Since \TEX{} can't bear the thought of producing a bad-looking paragraph, it produces a horrible one with a word sticking past the right margin, knowing that you'll have to do something about it. When this happens, it types a warning message like \begin{example} Overfull \\hbox (21.022pt too wide) in paragraph at lines 77--81 \\tenrm he pre-ferred to call the gnu com-puter ``GNAT6969'' \end{example} and also writes this plus some additional stuff on the {\tt log} \index{log file} file. In the manuscript file that produced this message, lines 77--81 contained a paragraph having the phrase \begin{example} he preferred to call the gnu computer ``GNAT6969'' \end{example} The hyphens \index{hyphens} in the warning message tell you what hypenations\index{hyphenation} \TEX{} tried in its attempt to find a good place for a line break. On the printed output, the word ``GNAT6969'' stuck out 21.022 points past the right margin. In many document \index{document style}styles, there will also be a black line next to ``GNAT6969'', so you can't miss it. When \TEX{} produces such a bad line break, the best thing to do is ignore it. Chances are that before you're finished writing the document, the offending paragraph will be changed and the problem will go away. Don't fix a bad line break until you're absolutely definitely certainly positive that this is the final version of the paragraph. Okay, let's suppose that you're now preparing the final version and the bad line break is still there. You first have to decide why \TEX{} couldn't break the line properly. One possible reason is that it couldn't figure out how to hyphenate the word that doesn't fit. The hyphens in the warning message will tell you if that's the problem. If it is, you can give \TEX{} a hand by putting {\tt \\-}\index{!-} any place where it is allowed to hyphenate. You can put lots of {\tt \\-}'s in, since they only permit \TEX{} to hyphenate, they don't force it to. \TEX{} is very good at hyphenating, so most of the time the problem arises because the thing that sticks out simply can't be hyphenated---as in ``GNAT6969'', or if it's something you put in an {\tt \\hbox}\index{!hbox} to make sure it {\it wouldn't\/} be hypenated. In this case, there is no good way to break the paragraph into lines. You then have two choices: either rewrite the text, or convince \TEX{} to make a not-so-good line break. You probably won't want to change your masterful prose and will choose the second option. The best way to do this is to try to {\it coax\/} \TEX{} into breaking the line where you think it should be broken---probably just before the word that doesn't fit. (In rare cases, when the word comes very close to fitting, you may be able to get \TEX{} to put more words on a line than it did.) This coaxing is done by inserting a \hbox{\tt \\goodlinebreak}\index{!goodlinebreak} command into your manuscript at that point. The \hbox{\tt \\goodlinebreak} command tries to convince \TEX{} that this is really a much better place for a line break than it thought. Sometimes, despite the \hbox{\tt \\goodlinebreak} command, \TEX{} is stubborn and refuses to break the line where you want it to. In that case, you must get tough and use a \hbox{\tt \\linebreak} command, which says to \TEX{}: ``Break the line here whether you like it or not!'' The problem with the \hbox{\tt \\linebreak} command is that you'll have to remove it when you change your manuscript. (Did you really believe that this would be the final version?) \TEX{} ignores a \hbox{\tt \\goodlinebreak} command if it produces a really rotten line break, but it will always obey the \hbox{\tt \\linebreak} command. A \hbox{\tt \\linebreak} command stretchs the broken line so that it reaches the prevailing right margin. Sometimes you want to break a line without doing that, \newline as I just did. This is done with the {\tt \\newline}\index{!newline} command---for example, by typing \begin{example} without doing that, \\newline as I just did. \end{example} \subsection{Page Breaking}\index{page breaking}\label{pbreak} \TEX{} is just as fussy about page breaks as it is about line breaks. As with line breaking, sometimes there is no good way to break a page. When \TEX{} is forced to make a bad page break, it warns you by typing a message like \begin{example} Underfull \\vbox (badness 1137) has occurred while \\output is active \end{example} To figure out on what page this happened, notice that as \TEX{} processes your file it types out a sequence of numbers in square brackets. The number {\tt [27]} is typed out when \TEX{} writes page 27 onto the {\tt dvi}\index{dvi file} file. The bad page is the next one that \TEX{} writes after typing the warning message. Now, what should you do when you get such a message? First, look at the ``badness''\index{badness} value. If it's less than 10000, then \TEX{} has done a reasonable job of page breaking and you'll want to do something about it only if you're fussy and you're producing the last, final, ultimate, irrevocable version. If the badness equals 10000, it means that \TEX{} considered all the ways of breaking the page to be terrible. When this happens, \TEX{} simply refuses to think about such terrible page breaking and chooses a completely arbitrary place to break the page. Thus, because it can't find a page break that meets its standards, \TEX{} might produce a page containing just one or two lines, even though it could have fit a reasonable amount on the page. Fortunately, this shouldn't happen very often. (If it does, \LATEX{} will be modified to try to avoid the problem.) As with line breaking, \LATEX{} provides commands both to cajole and to order \TEX{} to break a page where you want it to. The commands \goodlinebreak \hbox{\tt \\goodpagebreak}\index{!goodpagebreak} and \hbox{\tt \\pagebreak}\index{!pagebreak} are the analogues of \hbox{\tt \\goodlinebreak} and \hbox{\tt \\linebreak}, the former coaxing and the latter commanding. When used in the middle of a paragraph, they instruct \TEX{} to break the page after the line on which they appear. If \TEX{} produces an almost empty page 27, you should put the \hbox{\tt \\pagebreak} command where you'd like the end of that page to be. This will work as long as the material from the top of the almost empty page 27 to the \hbox{\tt \\pagebreak} will fit on one page. There are also {\tt \\badpagebreak}\index{!badpagebreak} and \hbox{\tt \\nopagebreak}\index{!nopagebreak} commands to discourage and forbid \TEX{} from breaking a page. They won't help when \TEX{} produces a really short page; if it generates a page with two lines, a \hbox{\tt \\nopagebreak} command after the second line will probably just get you a three line page. However, it can be used to fine tune things when the badness is less than 10000. The \hbox{\tt \\goodpagebreak} and \hbox{\tt \\pagebreak} commands stretch the page out to the bottom margin. The \hbox{\tt \\newpage}\index{!newpage} command is used to terminate the page right where it is, leaving empty space at the bottom if necessary. This command ends the current paragraph, so the text that follows will begin with a paragraph indentation. If you want to suppress this indentation, use a \hbox{\tt \\noindent}\index{!noindent} command. The {\tt \\noindent} command can be used at the beginning of any paragraph, not just after a {\tt \\newpage} command. There's also a {\tt \\clearpage}\index{!clearpage} command that is similar to \hbox{\tt \\newpage}. The difference is that if there are any figures \index{figures} waiting to be put onto the next page, the \hbox{\tt \\clearpage} command will put them on one or more separate pages with no text. The \hbox{\tt \\clearpage} command may also change the page \index{page style}style of the pages that it produces, as described on page~\pageref{clearpage} of Section~\ref{clearpage}. The {\tt \\chapter}\index{!chapter} command uses this command to begin a new page. You don't have to worry about creating a blank page with an extra \hbox{\tt \\newpage} or \hbox{\tt \\clearpage}; two \hbox{\tt \\newpage} commands are equivalent to a single one. If you want to leave a blank \index{blank page}page, then you have to put something invisible on that page, such as an empty box. \section{Going To Pieces By Yourself} When you make small changes to a document, it's good to generate only the pages that have changed and not have to spend all that time processing the whole document. In fact, when you're producing your first draft, you should really be running your manuscript through \LATEX{} a little at a time as you write it rather than saving it all up to run at once, or processing everything starting with Section~1.1.1 every time you complete another few pages. It would be nice if \LATEX{} could figure out what has changed and only process that part, but there are lots of reasons why it can't. \LATEX{} provides a convenient method for processing your manuscript a piece at a time; it is described in Section~\ref{parts} on page~\pageref{parts}. However, even when you use it, you may want to process still smaller pieces by themselves; this section tells you how. The commands in Section~\ref{pbreak} allow you to begin and end a page right where you want, so you can produce a manuscript file that generates just the pages that have changed. Of course, if you've added or subtracted too much material, things might not fit on the same number of pages. However, if this is just an initial draft, you won't care if some pages have a lot of blank space at the bottom. There is still one problem. Suppose you're using the {\tt report}\index{report document style} document style\index{document style}, which has chapters\index{chapter}, and you want to generate only Section~2.8 which begins on page~24. You can't just start your mansuscript with \begin{example} ... \\text \\section\{Gnats and Gnus\} \end{example} because that would label {\it Gnats and Gnus\/} as Section~.1 starting\index{section} on page~1. (It has that funny section number because you started a section without first starting a chapter.) How can you tell \LATEX{} that you want to begin with section number 2.8 and page number~24? The page numbering\index{page numbering} is easy, you just write \begin{example} \\setpagenumber\{24\}\index{!setpagenumber} \end{example} You'd write this even if the page number appeared on the bottom of the page as {\it xxiv\/}---page numbers are just integers, regardless of how they're printed. \label{counters} To learn how to produce the right section number, you have to understand about {\it counters}\index{counters}. Everything \LATEX{} numbers for you has a counter associated with it. The name of the counter is the same as the name of the environment or command that produces the number. For example, there are counters named \hbox{\tt chapter}\index{chapter}, \index{section}\hbox{\tt section}, \hbox{\tt theorem}, and so on. The value of a counter is a single integer; things that have multiple numbers get their numbers from multiple counters---{\it e.g.}, Section~2.8 has that number because the \hbox{\tt chapter} counter has the value 2 and the \hbox{\tt section} counter has the value 8. You can set the value of a counter with the {\tt \\setcounter}\index{!setcounter} command,\footnote{Don't confuse the \LATEX{} \hbox{\tt \\setcounter} command with the \hbox{{\tt \\setcount}} command of raw \TEX.} so your manuscript should look like this. \begin{example} ... \\text \\setpagenumber\{24\} \\setcounter\{chapter\}\{2\} \\setcounter\{section\}\{7\} \\section\{Gnats and Gnus\} \end{example} Whoops, you wanted to start with Section~2.8, so why did we set the \hbox{\tt section} counter to 7? All counters are initialized to 0 and this causes the first section to be numbered 1, so to get the first section to be numbered 8 you must set its counter to 7. (However, there's no page number counter; you have to set the page number of the first page to 1 not 0.) There's one environment that \LATEX{} numbers for you that has a nonobvious counter name: the \hbox{\tt enumerate} \index{enumerate environment}environment. The counter for an outermost enumeration is {\tt enum1}, the counter for the first inner enumeration is {\tt enum2}, {\it etc}. Remember that the value of a counter is an integer, so to start with item~(d) you have to set the appropriate counter to 3. (That's right, 3 not 4.) This can be useful for restarting interrupted enumerations. The \hbox{\tt \\begin} command sets the enumeration counter to 0, so you have to put the \hbox{\tt \\setcounter} command after the \hbox{\tt \\begin}. There's one final problem with processing part of a document in this way. \LATEX{} produces a number of different \index{auxiliary files}auxiliary \index{files}files when it generates a document---files it will use for cross referencing\index{cross referencing}, making a \index{table of contents}table of contents, {\it etc}. the next time you process the manuscript. These files will have the right information only if they are generated when the entire manuscript file is run through \LATEX; you shouldn't generate them when you're processing part of the manuscript. To prevent \LATEX{} from writing these files, put a {\tt \\nofiles}\index{!nofiles} command in the {\it processing commands\/} \index{processing commands}section of your manuscript file. \section{The {\tt list} Environment}\index{list environment}\index{lists} \label{list-environment} \LATEX{} uses a general {\tt list} environment to define the paragraph-formatting and list-making environments of sections \ref{paragraph} and \ref{list-making}. The {\tt list} environment produces a list of items, each of which is begun by one of the four commands \index{!item}{\tt \\item}, \index{!labelitem}{\tt \\labelitem}, \index{!noparitem}{\tt \\noparitem} or \index{!noparlabelitem}{\tt \\noparlabelitem} described in Section~\ref{list-making}. The {\tt list} environment has two arguments. The first specifies how items begun with an {\tt \\item} or {\tt \\noparitem} should be labeled. This argument is a piece of text that is inserted in a box to form the label. The text is normally left-justified in the box, but you can change that by inserting one or more \index{!hfill}{\tt \\hfill} commands, as described in Section~\ref{stretching}. Items are numbered by including the appropriate numbering command \index{item numbers}\index{numbering}\index{numbering commands}in this argument. For example, to make the {\tt \\item} command generate the labels {\bf Item-1:}, {\bf Item-2:}, \(\ldots\)~, you begin the {\tt list} environment with \begin{example} \\begin\{list\}\{\{\\bf Item-\\arabic :\}\}\{...\}\index{!arabic} \end{example} The numbers 1, 2, \(\ldots\){} are generated by the {\tt \\arabic} command, the \hbox{\tt \{\\bf \(\ldots\){} \}} produces the boldface font, and the {\tt Item-} and {\tt :} generate the rest of the label. In addition to {\tt \\arabic}, the following commands are available: \begin{description}{{\tt \\Roman}:} \labelitem{{\tt \\Roman}:} \index{!Roman}Produces upper-case roman numerals: I, II, \(\ldots\) \labelitem{{\tt \\roman}:} \index{!roman}Produces lower-case roman numerals: i, ii, \(\ldots\) \labelitem{{\tt \\Alph}:} \index{!Alph}Produces upper-case letters: A, B, \(\ldots\) \labelitem{{\tt \\alph}:} \index{!alph}Produces lower-case letters: a, b, \(\ldots\) \end{description} Trying to number more than twenty-six items with {\tt \\Alph} or {\tt \\alph} produces an error. The second argument of the {\tt list} environment specifies the spacing parameters for the list. Below is a list of all the parameters. To change a parameter such as {\it topsep\/}, you put the command \hbox{\tt \\topsep\{{\it dist\/}\}} in the second argument, where {\it dist\/} is a distance. (See Section~\ref{distance} for a description of how to specify distances.) If you don't specify a spacing parameter, then the default value is used for the list. \begin{description}{{\it listparindent\/}:} \labelitem{{\it topsep\/}:} \index{topsep}The extra vertical space inserted between the first list item and the preceding paragraph. Its default value is the {\it itemsep\/} of the enclosing list, or {\tt \\the\\parskip} \index{!parskip}\index{!the!parskip}if this list is not contained inside another one. \labelitem{{\it itemsep\/}:} The extra \index{itemsep}vertical space between successive list items. Its default value is the same as for {\it topsep}. \labelitem{{\it parsep\/}:} The extra \index{parsep}vertical space between paragraphs within an item. Its default value is {\it parsep\/} of the enclosing list, or {\tt \\the\\parskip} if this list is not contained inside another. \labelitem{{\it leftmargin\/}:} The horizontal distance\index{leftmargin} between the left margin of the enclosing environment and the left margin of the list. It must be nonnegative. Its default value is determined by the document \index{document style}style. The command \index{!leftmarginof}{\tt \\leftmarginof\{{\it text\/}\} } sets {\it leftmargin\/} to the width of {\it text}. \labelitem{{\it rightmargin\/}:} The horizontal distance\index{rightmargin} between the right margin of the enclosing environment and the right margin of the list. It must be nonnegative. Its default value is {\tt 0in}. \labelitem{{\it listparindent\/}:} The amount of \index{listparindent}extra indentation added to the first line of every paragraph of a list. It may be negative! This indentation is added {\it before\/} the label. Usually, labeled lists have {\it listparindent\/} equal to {\tt 0in}, which is its default value. \labelitem{{\it labelwidth\/}:} The \index{labelwidth}width of the box that contains the label. It must be nonnegative. Its default value is determined by the document style.\index{document style} The command \hbox{\tt \\labelwidthof\{{\it text\/}\}}\index{!labelwidthof} sets {\it labelwidth\/} equal to the \linebreak width of {\it text}. \labelitem{{\it labelsep\/}:} The space between the end of the label box and the text of the item. It may be negative! Its default value is determined by the document style.\index{document style} \end{description} \section{Defining Your Own Commands}\label{def}\index{definitions} \label{definitions} You can save yourself a lot of typing by defining your own \TEX{} commands to serve as abbreviations. For example, suppose your document contains the expression \hbox{$\alpha$---$\omega$} in many places. You can define the control sequence {\tt \\alom} by writing the definition \begin{example} \\def\\alom\{\$\\alpha\$---\$\\omega\$\} \end{example} You can then type \begin{example} The letters \\alom are often used. \end{example} to produce \begin{quote} The letters \hbox{$\alpha$---$\omega$}are often used. \end{quote} Whoops, you forgot what I told you in Section~\ref{commands} on page~\pageref{commands}; \TEX{} gobbles up the space\index{space} after a control sequence. Next time, type \hbox{\tt \\alom\{\} are}. You can also define commands with \index{argument}arguments. For example, suppose that your formulas have lots of expressions of the form \hbox{$x^{2.73} + y^{3.72}$} for different $x$ and $y$. You can define the command {\tt \\tnp} by writing \begin{example} \\def\\tnp\#1\#2\{ \#1\^\{2.73\} + \#2\^\{3.72\} \} \end{example} You can then produce a formula like \[ q^{2.73} + r^{3.72} = 27(m^{2.73} + n^{3.72}) \] by typing \begin{example} \\[ \\tnp\{q\}\{r\} = 27 ( \\tnp\{m\}\{n\} ) \\] \end{example} The {\tt \#1} in the definition is replaced by the first argument and the {\tt \#2} by the second. In addition to reducing your typing, using definitions makes it easy to change notation. For example, if you decided that there should be more space around the ``+'' in all those {\tt \\tnp} expressions, you just change the definition. Had you typed all those formulas yourself, you'd have to go back and change each one individually. Sometimes you'll want to give a new name to an already existing command---for example, if you'd like to write \hbox{\tt \\chap} instead of \hbox{\tt \\chapter}\index{!chapter}. This is done by writing \begin{example} \\let\\chap=\\chapter\index{!let} \end{example} A command\index{command names} name can be any string of letters, but it must consist entirely of letters; you can't define a command named {\tt \\gnu2} or \hbox{\tt \\gnu-two}. However, \LATEX{} regards {\tt \@}\index{@} as a letter, so you can define a command \hbox{\tt \\gnu\@{}two}. Remember that \TEX{} regards upper-case and lower-case letters to be completely different, so {\tt \\Gnu} and {\tt \\gnu} are two different commands. Strange things may happen if you redefine commands that have already been defined by \TEX{} or \LATEX{}. To prevent you from accidentally stumbling upon \LATEX's internal command names, they all begin with the ``letter'' {\tt \@}, so you should never define a command like {\tt \\\@{}gnu} that begins with {\tt \@}. The commands that \LATEX{} provides for your use, and all of \TEX's own commands, begin with an ordinary letter. These commands are listed in Appendix~\ref{command-list}. If you want to use a command name that sounds like someone else may have also thought of using it---a name like {\tt \\if} or {\tt \\when}---check Appendix~\ref{command-list} first. The best place to put your definitions is near the beginning of the manuscript, right before the {\tt \\text}\index{!text} command, but you can put them anywhere. However, any definition that you make inside an \index{environments}environment disappears when you leave that environment.\footnote{There are some exceptions to this rule, such as when using the short form of a math \index{math environment} environment, but they're not places you're likely to put a definition.}