\chapter{Environments} \index{environments} \LATEX{} provides {\it environments\/} for telling it how to format a particular part of the document. For example, by putting some text in an {\tt enumerate} environment, you are telling \LATEX{} that the text is an enumerated list, and should be formatted accordingly. Environments can be nested within one another---for example, to produce sublists of lists. When typing ordinary text, as I am now, you're in an implicit outermost text environment. The standard way to begin an environment is with a {\tt \\begin}\index{!begin} command---for example, the {\tt enumerate}\index{enumerate environment} environment is begun with a \begin{example} \\begin\{enumerate\} \end{example} command. If the environment requires arguments, they follow the {\tt \\begin} command. For example, the {\tt figure}\index{figure environment} environment has the figure caption as an argument, so a {\tt figure} environment is begun with a command like \begin{example} \\begin\{figure\}\{A bevy of gnus.\} \end{example} An environment begun with a {\tt \\begin} command must be ended with the corresponding {\tt \\end}\index{!end} command, so an {\tt enumerate} environment is ended by the command \begin{example} {\tt \\end\{enumerate\}} \end{example} Some environments, usually ones that appear in the middle of a paragraph, can be invoked with shorter commands. To italicize the single word {\it word\/}, it would be rather awkward to have to type \begin{example} \\begin\{italic\}word\\end\{italic\}\index{italic environment} \end{example} \noindent Instead, you can begin the italic environment by typing {\tt \{\\it} and end it by typing {\tt \}}. Thus, the word {\it word\/} is italicized by typing {\tt \{\\it word\}}. A space is needed after the {\tt \\it}; otherwise, \TEX{} would think you were typing the command {\tt \\itword}. Environments must be properly \index{nesting environments}nested. An {\tt italic} environment begun inside an {\tt enumerate} environment must be ended before the {\tt \\end\{enumerate\}}. If you want the material following the enumeration to be italicized, you have to start a new {\tt italic} environment after the {\tt \\end\{enumerate\}}. This chapter describes the most commonly used environments. Some other environments are described in the next chapter. \section{Environments that Change the Font} \label{fontchange} \subsection{Changing Type Style}\index{type style}\index{style, type} The environments for changing type style all have short command forms\index{short command form}\index{command, short} similar to the one used for the {\tt italic} environment: {\tt \{{\it command\/}~$\ldots$~\}}, where {\it command\/} is a three-character command name like {\tt \\it}. The following list describes all the standard style-changing environments, with their short command names. \begin{description}{{\tt typewriter}:} \labelitem{{\tt italic}:}\index{italic environment}\index{!tt}Short command name: {\tt \\it}. {\it An italic font.} \labelitem{{\tt boldface}:}\index{boldface environment}\index{!bf}Short command name: {\tt \\bf}. {\bf A boldface font.} \labelitem{{\tt roman}:}\index{roman environment}\index{!rm}Short command name: {\tt \\rm}. A Roman font (the ordinary type face). Since this is the font that you normally get without asking for a special type style, you'll rarely use the \hbox{\tt roman} environment. {\it However, you might find it useful for putting a single {\rm Roman} word inside an italic environment.} \labelitem{{\tt slanted}:}\index{slanted environment}\index{!tt}Short command name: {\tt \\sl}. {\sl A slanted font.} (See chapter 4 of \knuth{} for a discussion of the difference between italic and slanted.) \labelitem{{\tt sansserif}:}\index{sansserif environment}\index{!ss}Short command name: {\tt \\sf}. {\sf A \index{sans serif}sans serif font.} \labelitem{{\tt typewriter}:}\index{typewriter environment}\index{!tt}Short command name: {\tt \\tt}. {\tt A fixed-width typewriter font.} \end{description} There is one small point about the italic and slanted fonts that you should be aware of. Examine closely the following sentence: \begin{quote} ``You {\it did}n't,'' she said. \end{quote} Notice how the slanting {\it d\/} of ``{\it did\/}'' bumps into the n of ``n't''. That's what happens if you just type \begin{example} ``You \{\\it did\}n't,'' she said. \end{example} To prevent this, you have to add some extra space after ``{\it did\/}''. The {\tt \\/}\index{!/} command adds just the right amount of extra space. You type \begin{example} ``You \{\\it did\\/\}n't,'' she said. \end{example} to get \begin{quote} ``You {\it did\/}n't,'' she said. \end{quote} The easiest way to remember this is to get in the habit of ending every {\tt \{\\it} environment with {\tt \\/\}}. This will always produce something that looks pretty good. However, if you're fussy, you'll want to eliminate the {\tt \\/} before periods and commas. \subsection{Changing the Font Size} \label{fontsize}\index{font size} In addition to changing their style, you use the environments listed below to can change the size of the type that \LATEX{} produces. The exact size of type that they produce will depend upon the document style. Whenever you enter a font-size environment, the type style is set to {\tt roman}, regardless of what it was in the enclosing environment. When you leave the font-size environment, you return to the type style of the enclosing environment. Some type styles are not available in some font sizes. Exactly what styles are available in any size will depend upon the version of \LATEX{} you are using. The \hbox{\tt roman}\index{roman} and \hbox{\tt italic}\index{italic} styles should be available in all sizes, \hbox{\tt boldface}\index{boldface} should be exist in most sizes, and you'll have to check a local expert to find out about the other type styles. \begin{description}{{\tt footnotesize}:} \labelitem{{\tt normal}:} \index{normal environment}This produces the normal type size. All type styles are available. \labelitem{{\tt title}:} \index{title environment}This produces a type size suitable for ``small titles''. \begin{title} It looks like this. \end{title} This environment can be entered by typing {\tt \{\\tit}\index{!tit} and exited by typing {\tt \}}. Most type styles are available. \labelitem{{\tt Title}:}\index{Title environment}This produces a type size suitable for ``big titles''. \begin{Title} It looks like this. \end{Title} This environment can be entered by typing {\tt \{\\Tit}\index{!Tit} and exited by typing {\tt \}}. It is the largest type size used by \LATEX. Very few type styles will be available. Also, mathematical symbols used in this envirionment may appear in a smaller size. Note that this is an example of an environment and a command name that are not all lower-case letters. \labelitem{{\tt small}:}\index{small environment}This is the next type size smaller than {\tt normal}. Most type styles are available. \begin{small} It looks like this. \end{small} \labelitem{{\tt footnotesize}:}This is the type size used in footnotes.\footnote{It looks like this.} Most type styles are available. \labelitem{{\tt scriptsize}:}\index{scriptsize environment}This is the size used in the {\tt normal} type size for subscripts and superscripts. \begin{scriptsize}It looks like this.\end{scriptsize} There may be no type styles other than {\tt roman} and {\tt italic} available. \end{description} \section{Paragraph-Formatting Environments} \index{paragraph-formatting environments}\label{paragraph} \label{paragraph-formatting}\LATEX{} provides a number of environments to change the way \TEX{} makes paragraphs. They are useful for quotations, poetry, {\it etc}. In all paragraph-formatting environments, a blank line begins a new paragraph. This causes a normal interparagraph vertical space to be inserted. The first line of a paragraph is indented in some environments like {\tt quotation}, but not in others. In some paragraph-formatting environments, like {\tt verse}, you tell \LATEX{} when to end a line and begin a new one. The command for doing this is {\tt \\CR}\index{!CR}. This is another exception to \LATEX's rule of using lower-case letters in command names; it is made because \TEX{} already has a command {\tt \\cr}\index{!cr}. (See Chapter ?? of \knuth.) Sometimes you'll want to add extra space between the lines of such an environment. For this, you use the command {\tt \\CRSP}\index{!CRSP} which takes a distance\index{distance} as an argument. Distances are discussed in Section~\ref{distance} on page \pageref{distance}. For now, we'll express distances in inches, which \TEX{} abbreviates as {\tt in}, and write commands such as {\tt \\CRSP\{.125 in\}}, which leaves an extra 1/8-inch space between lines. As explained in Section~\ref{distance}, it's a bad idea to express distances in physical units like inches, but we won't worry about that now. (The argument of {\tt \\CRSP} is actually a ``stretchable'' distance\index{stretchable distance}---a concept explained in Section~\ref{stretching}.) Remember that {\tt \\CR} and {\tt \\CRSP} are used to separate lines and are not needed after the last line. Putting an extra {\tt \\CR} or {\tt \\CRSP}---either between lines or at the end---will produce a blank line, thereby leaving extra space. Here is a list of the standard paragraph-formatting environments. \begin{description}{{\tt quotation}:} \labelitem{{\tt quotation}:}\index{quotation environment}Produces a wide left margin with indented paragraphs. Lines are right-justified, and line breaking is done by \TEX. \labelitem{{\tt quote}:}\index{quote environment}Same as {\tt quotation} except that paragraphs are not indented. \labelitem{{\tt verse}:}\index{verse environment}Produces wide left margin; paragraphs are not indented. Lines are broken by using {\tt \\CR} or {\tt \\CRSP}; extra-long lines will be split by \TEX, the remainder being placed on additional indented lines. Thus, typing \begin{example} \\begin\{verse\} If you're a poet \\CR But others don't know it, \\CRSP\{.125in\} Perhaps it's because \\CR You try to squeeze too much into a single line without giving the reader a pause. \\end\{verse\} \end{example} produces \begin{verse} If you're a poet \CR But others don't know it, \CRSP{.125in} Perhaps it's because \CR You try to squeeze too much into a single line without giving the reader a pause. \end{verse} \labelitem{{\tt example}:}\index{example environment}This is the environment used to produce the examples in this report. There is a widened left margin, no paragraph indentation, and a \hbox{\tt typewriter} type style is used. Spaces in the manuscript produce extra spaces in the output and a carriage return in the manuscript starts a new line of output. This is the only standard \LATEX{} environment in which extra spaces\index{space} in the manuscript have any effect, and in which a single carriage return\index{carriage return} is not equivalent to a space. Recall that you can get \TEX{} to ignore the carriage return at the end of a line by typing {\tt \%}\index{\string\%}. (See page~\pageref{percent} in Section~\ref{percent}.) You can therefore use a {\tt \%} to end a manuscript line without starting a new line of output. The \hbox{\tt example} environment is a bit tricky because spaces and carriage returns aren't their usual selves. They may have strange effects in in any environment contained in the \hbox{\tt example} environment, so you should be very careful when using another environment inside an \hbox{\tt example}. The environment has been designed to do the right thing if you follow the \hbox{\tt \\begin\{example\}} command with a carriage return, then type the first line of your example, and if you type the {\tt \\end} command on a new line. \end{description} For all of these environments, blank lines\index{blank lines}\label{blank-line} before the {\tt \\begin} command have no effect; blank lines after the {\tt \\end} command determine whether the following text begins a new paragraph. For example, this paragraph was produced with the following input \begin{example} For all of these environments ... this paragraph was produced with the following input \\begin\{example\} For all of these ... \\end\{example\} to get this sentence to continue ... \end{example} to get this sentence to continue without a paragraph break. On the other hand, I am now typing the following text. \begin{example} On the other hand, I am now typing \\begin\{example\} ... \\end\{example\} See how the blank line ... \end{example} See how the blank line caused the start of a new paragraph. At any point in the manuscript, there are prevailing left\index{left margin} and right\index{right margin} \index{prevailing margin}\index{margin} margins. The paragraph-formatting environments all change the prevailing left margin, widening it by a fixed amount. The {\tt verse}\index{verse environment} environment also changes the prevailing right margin, widening it by a fixed amount. When environments are nested, the changes to the margins add in the obvious way. \index{environment nesting}\index{nesting environments} The paragraph-formatting environments may appear inside, and include within them, most environments---including paragraph-formatting environments. Such nesting has the expected effect. However, there is one important rule that must be observed: \begin{quote} \begin{italic} \label{nestingrestriction}No environment may contain a\/{} {\tt \\CR}\index{!CR} or\/{} {\tt \\CRSP}\index{!CRSP} command belonging to an enclosing environment. \end{italic} \end{quote} For example, you must {\it not\/} type \begin{example} \\begin\{verse\} \{\\it Gnats\index{gnats} and Gnus\index{gnus} \\CR May break my shoes \} \\CR ... \\end\{verse\} \end{example} because the italic environment begun by {\tt \{\\it} contains a {\tt \\CR} command from the enclosing {\tt verse} environment. The paragraph-formatting environments are defined in terms of a general {\tt list} environment\index{list environment} that is described in Section~\ref{list-environment} on page~\pageref{list-environment}. If you're not happy with the standard paragraph-formatting environments, you can do things exactly the way you want with the {\tt list} environment. \section{Environments for Making Lists}\index{lists}\label{list-making} \LATEX{} provides environments for making three different kinds of lists. \begin{enumerate} \item An enumerated list like this one, created with the {\tt enumerate}\index{enumerate environment} environment. \item \label{enumerateexample}An unnumbered list of items, like the following: \begin{itemize} \item Gnats \index{gnats} \item Gnus \index{gnus} \end{itemize} This list was created with the {\tt itemize}\index{itemize environment} environment. There are lots of wonderful things you can do with an {\tt itemize} environment, but I've forgotten them all. \item A labeled list, like the following, is created with a {\tt description}\index{description environment}environment. \begin{description}{Armadillo:} \labelitem{Gnat:} A very small animal that causes no end of trouble in the North Woods. It should be avoided at all costs. \labelitem{Gnu:} A very large animal that causes no end of trouble in crossword puzzles. It should be avoided at all costs. \labelitem{Armadillo:} A \index{armadillo} medium-sized animal having a medium-sized Texas city named after it. \end{description} \end{enumerate} Each item in an {\tt enumerate} or {\tt itemize} environment is begun with the command {\tt \\item}. Each item of a {\tt description} is begun with a {\tt \\labelitem} command having the label as an argument. The {\tt description} environment takes as an argument a piece of text telling it how much space to leave for label items. You should make that argument the longest {\tt \\labelitem} label in the list. A blank line in one of these environments begins a new paragraph within the current item, as in item~\ref{enumerateexample} of the above example. The entire example was typed as follows. \begin{example} \\begin\{enumerate\} \\item An enumerated list like this ... \\item An unnumbered list of items, like the following: \\begin\{itemize\} \\item Gnats \\item Gnus \\end\{itemize\} This list was created with ... There are lots of wonderful ... \\item A labeled list, like the ... \\begin\{description\}\{Armadillo:\} \\labelitem\{Gnat:\} A very small animal ... \\labelitem\{Gnu:\} A very large animal ... \\labelitem\{Armadillo:\} A medium-sized ... \\end\{description\} \\end\{enumerate\} \end{example} These list-making environments are quite forgiving about allowing you to leave or omit blank lines\index{blank lines}. It makes no difference whether or not you put blank lines before or after the {\tt \\begin} and {\tt \\end} commands, or before an {\tt \\item} or {\tt \\labelitem} command. There's only one rule that you must follow: \begin{quote} \it \label{blank-line-rule} Never leave a blank line between a command that begins an item and the text of the item. \end{quote} The rule for blank lines at the end of an outermost list environment is the same as for paragraph-formatting environments, explained on page~\pageref{blank-line}: leave a blank line to start a new paragraph. When you have nested\index{nesting environments} {\tt enumerate} environments, the numbering scheme changes with the level. The same is true of {\tt itemize} environments. The {\tt enumerate} or {\tt itemize} environments each cannot be nested more than four levels deep. To find out how to get the first item of an enumeration to be numbered 7 or (g) instead of 1 or (a), see the discussion of counters\index{counters} on page~\pageref{counters} of Section~\ref{counters}. List-making environments can be nested within one another quite naturally, except for the peculiar case when an item of one list begins with a list, as in the second item of: \begin{enumerate} \item Normal Animals \item \begin{enumerate} \noparitem Gnats \item Gnus \item Armadillos \end{enumerate} \item Plants \end{enumerate} To get the results that you want, the first item of the inner list is begun with the command {\tt \\noparitem}\index{!noparitem} instead of {\tt \\item}. Thus, the above example is typed as: \begin{example} \\begin\{enumerate\} \\item Normal Animals \\item \\begin\{enumerate\} \\noparitem Gnats \\item Gnus \\item Armadillos \\end\{enumerate\} \\item Plants \\end\{enumerate\} \end{example} There's also a corresponding \hbox{\tt \\noparlabelitem} command. I'm sorry about this kludge\index{kludge}, but I don't know any other way of getting \TEX{} to do the right thing without destroying some of the nice properties of these environments. Note that the result looks rather ugly if the inner list is made with the standard list-making environments because the spacing is all wrong. To get it to look right, you'll have to use the general {\tt list} environment described in Section~\ref{list-environment}. \section{Centering and Justifying}\index{centering}\index{justifying} \label{centering} You can create a series of lines in your document that are \begin{center} centered \CR like these \end{center} or a series of lines that are \begin{flushright} right-justified\CR like these. \end{flushright} They are created with the {\tt center}\index{center environment} and {\tt flushright}\index{flushright environment} environments. As with the para\-graph-formatting environments, blank lines\index{blank lines} before the {\tt begin} have no effect, and blank lines following the {\tt end} cause a paragraph break. (See page~\pageref{blank-line}.) Lines are broken with the {\tt \\CR}\index{!CR} and {\tt \\CRSP}\index{!CRSP} commands, just as in {\tt verse}\index{verse environment} and {\tt example}\index{example environment}, so the nesting\index{nesting environments} restriction discussed on page~\pageref{nestingrestriction} applies. There is also a {\tt flushleft}\index{flushleft environment} environment in which lines are broken with {\tt \\CR} and {\tt \\CRSP} commands. This environment is {\it not\/} the mirror image of the {\tt flushright} environment. The {\tt center} and {\tt flushright} environments cause a paragraph break and create lines that stretch between the prevailing\index{prevailing margin} margins\index{margin}, within which the text is either centered or right-justified. Thus, a {\tt flushright} always moves its lines all the way to the right, even if it's inside a {\tt center} environment. Moreover, you cannot put a footnote\index{footnotes} inside a \hbox{\tt flushleft} environment. The {\tt flushleft} environment does not start a new paragraph. Instead, it creates a box\index{boxes} comprising a sequence of left-justified lines. (Boxes are discussed in Section~\ref{boxes} on page~\pageref{boxes}.) This box is put right where it appears in the text, giving you the ability to do some \begin{flushleft} very bizarre \CR things \end{flushleft} by typing \begin{example} allowing you to do some \\begin\{flushleft\} very bizarre \\CR things \\end\{flushleft\} by typing ... \end{example} More important, it allows you to do some very natural things by putting a {\tt flushleft} environment inside a {\tt center} or {\tt flushright} environment. For example, typing \begin{example} \\begin\{flushright\} \\begin\{flushleft\} Suite 666 \\CR 2727 Ave. of the Armadillos \\CR Gnu York, G.Y. \\end\{flushleft\} \\end\{flushright\} \end{example} produces \begin{flushright} \begin{flushleft} Suite 666 \CR 2727 Ave. of the Armadillos \CR Gnu York, G.Y. \end{flushleft} \end{flushright} This is summarized in the following list. \begin{description}{{\tt flushright}:} \labelitem{{\tt center}:}\index{center environment}Lines are centered with respect to the prevailing margins; they are broken by {\tt \\CR} or {\tt \\CRSP}. \labelitem{{\tt flushright}:}\index{flushright environment}Lines are moved flush against the prevailing right margin; they are broken by {\tt \\CR} or {\tt \\CRSP}. \labelitem{{\tt flushleft}:} A \index{flushleft environment} sequence of left-justified lines is formed, where the lines are ended by {\tt \\CR} or {\tt \\CRSP}. These lines are positioned as specified by the enclosing environment. \end{description} Paragraph-formatting\index{paragraph-formatting environments} and list\index{list environments} environments should not \index{nesting environments}appear inside any of these three environments. \section{Environments for Mathematics}\label{mathenvironments} There are three environments for mathematical formulas\index{mathematical formulas}\index{formulas}: {\tt math}\index{math environment}, {\tt displaymath}\index{displaymath environment} and {\tt equation}\index{equation environment}. The {\tt math} environment is used for formulas that appear right in the text, like the expression $x^{2}+y^{2}$. The {\tt displaymath} environment is used for formulas that appear on their own line, like \begin{displaymath} \phiâ??{xy} = {d^{2}x\over dx\,dy} \end{displaymath} The {\tt equation} environment is the same as {\tt displaymath} except that it adds an equation number: \begin{equation} z = \sumâ??{i=1}^{n} xâ??{i}^{2}. \end{equation} A \hbox{\tt displaymath} or \hbox{\tt equation} environment should not start a paragraph nor form a paragraph by itself, otherwise you'll get too much space above it. The {\tt math} and {\tt displaymath} environments can be invoked with the following short forms:\index{!(}\index{!)}\index{![}\index{!]} \begin{example} \\( ... \\) {\rm instead of} \\begin\{math\} ... \\end\{math\} \\[ ... \\] {\rm instead of} \\begin\{displaymath\} ... \\end\{displaymath\} \end{example} There's an even shorter form for the {\tt math} environment: you can type \hbox{\tt \${} ...\ \$}\index{\string\$} instead of \hbox{\tt \\( ...\ \\)}. The longer form has the advantage that because the left and right delimiters of the environment are different, it's easier for you to find a missing delimiter, and \LATEX{} can do a better job of error checking. I recommend using \hbox{\tt \\( ...\ \\)} for long formulas, and using \hbox{\tt \${} ...\ \$} for short ones, such as single characters. {\bf Note: for version 0.95 of \TEX, you should use \hbox{\tt \${} ...\ \$} instead of \hbox{\tt \\( ...\ \\)}. You can use \hbox{\tt \\( ...\ \\)} with version 0.96 on.} \TEX{} also provides another short form for the \hbox{\tt displaymath} environment, allowing you to write \hbox{\tt \$\${} ...\ \$\$}\index{\string\$\string\$} instead of \hbox{\tt \\[ ...\ \\]}, but there's no good reason to use it. Most of what goes into a math formula is typed just the way you would expect. For example, to get $x+x$ you simply type {\tt x+x} in your formula. It isn't obvious how to generate some things, like subscripts, because there's no natural way to enter them on your terminal. The rest of this section tells you how to do all those things that make mathematical formulas so much fun. Note that when you type something like \begin{quote} Every \(x\){} in \(S\){} is also in \(T\). \end{quote} the letters representing mathematical symbols are set in a different type face from the rest of the sentence. The sentence should be typed as follows so these letters look the same in the sentence as they do in mathematical formulas. \begin{example} Every \$x\$\ in \$S\$\ is also in \$T\$. \end{example} \subsection{Su(b/per)scripts}\index{subscripts}\index{superscripts} To get an expression $exp$ to appear as a subscript, you just type {\tt \â??\{exp\}}, where {\tt \â??} is the usual underscore\index{underscore} key on your terminal. To get \(exp\){} to appear as a subscript, you type {\tt \^\{exp\}}, where the character {\tt \^} may appear on your keyboard as an uparrow\index{uparrow} the way it's printed here, or as a caret\index{caret} (\char'017\relax{}). This is illustrated by the following: $$\vcenter{\halign{\hss$# $\hss\quad & \hss\hbox{\tt{} #}\hss\cr \underline{\hbox{\rm to get}} & $\underline{\hbox{\tt you type}}$ \cr x^{2y} & x\^\{2y\} \cr xâ??{3} & x\â??\{3\} \cr \noalign{\vskip .2ex} x^{y^{2}} & x\^\{y\^\{2\}\} \cr xâ??{1}^{y} & x\â??\{1\}\^\{y\} \cr }}$$ That's all there is to it. \TEX{} handles superscripted superscripts and all of that stuff in the natural way. It even does the right thing when something has both a subscript and a superscript. To save yourself some typing, you can omit the braces if the sub- or superscript has only a single letter---e.g., typing {\tt x\^2} to get $x^{2}$. However, my customized text editor produces the entire {\tt \^\{\}} with a single keystroke, so I never bother. \subsection{Special Symbols}\label{symbols} Most of the symbols you will need are available in \TEX{} by typing the appropriate command. Producing Greek letters\index{Greek letters} is as easy as \index{pi}\index{!pi}$\pi$. You just type \begin{example} ... as easy as \$\\pi\$. \end{example} You produce \(\Pi\){} by typing {\tt \\Pi}\index{!Pi}, and the same convention holds for all the Greek letters: capitalize the first letter of the name for the upper-case letter. (If the upper-case Greek letter is the same as its Roman equivalent, as in upper-case alpha, there is no command to generate it.) Note that characters in a math environment are ordinarily set in an italic\index{italic} typeface, including Greek letters like \(\Pi\). To get \({\rm \Pi}\), an unitalicized upper-case pi, you must specify a Roman\index{roman} type face by typing something like {\tt \$\{\\rm \\Pi\}\$}.\index{!rm} Commands to generate other symbols\index{symbols} are listed in Appendix~\ref{symbol-list} on page \pageref{symbol-list}. These include both standard \TEX{} commands and commands found only in \LATEX. Appendix % ~ REMOVED FOR BAD LINE BREAK \ref{operators} on page \pageref{operators} lists some common operators \index{operators} that you type as command sequences---{\it e.g.\/}, typing ``{\tt \\max}'' \index{!max} to get ``$\max$''. This may not seem very useful, since you can type the ``max'' by yourself, but \TEX{} is clever about such things as what font to use and where to put subscripts\index{subscripts} and \index{superscripts}superscripts. Thus, if you type {\tt \\[max\â??\{0 0\)), is formatted according to {\it format\/}, and consists of {\it item\/}. A {\tt multispan} command with \(n=1\){} allows you to change the way an individual entry is formatted. The {\it format\/} argument of a {\tt \\multispan} command can contain anything that can appear in a {\tt tabular} environment's format, except that there can be at most one {\tt c}, {\tt l} or {\tt r}. (If there is none, then the {\it item\/} argument is ignored.) There is also one additional character that can appear: a {\tt \hspace{.3em}-\hspace{.3em}}\index{-} produces a useful space; it is described below. The format of the {\tt \\multispan} replaces the format of the corresponding columns from the {\tt tabular} environment's format. This raises the following question: to what column does a {\tt |} or an {\tt s-expression} in the format belong? The answer is given by the following rule: \begin{quote} {\it Every column after the first is begun by a {\tt c}, {\tt l} or {\tt r}.} \end{quote} Thus, the format \hbox{\tt [c|ls\{ : \}lr]} comprises the four columns {\tt [c|}, \hbox{\tt ls\{ : \}}, {\tt l}, and {\tt r]}. (Of course, the first column may also begin with a {\tt c}, {\tt l} or {\tt r}.) Now, when do you need to put a {\tt \hspace{.3em}-\hspace{.3em}} in the spanning format? Remember that \LATEX{} puts a default space between columns when there is no {\tt |} or {\tt s}-expression there. The {\tt \hspace{.3em}-\hspace{.3em}} is needed in the {\tt \\multispan} format to put in that space. The default space is considered to be at the end of a column (rather than at the beginning of the next column), so a little thought reveals the following rule: \begin{quote} {\it The spanning command's format should end with {\tt \hspace{.3em}-\hspace{.3em}} if the command does not span the last column, and if the {\tt tabular} environment's format for the last column that is spanned ends with a {\tt c}, {\tt l} or {\tt r}.} \end{quote} Thus, if the {\tt tabular} format is {\tt l|cc|r}, you need the {\tt \hspace{.3em}-\hspace{.3em}} only for a {\tt \\multispan} that spans columns 1 and 2, or that spans only column 2. The {\tt \hspace{.3em}-\hspace{.3em}} produces a space that is the same width as the line and surrounding space produced by a {\tt |}, so you may find other uses for it as well. There's just one more thing you need to know before creating the most magnificent of tables---how to put horizontal\index{horizontal lines} lines in them. You can put a horizontal line before any row of a {\tt tabular} environment (or of an {\tt array}\index{array environment} environment) by putting the following incantation right before that row: \begin{example} \\noalign\{\\hline\}\index{!noalign}\index{!hline} \end{example} The {\tt \\noalign} tells \TEX{} that its argument is a separate line and is not part of the following row; the {\tt \\hline} makes the horizontal line. You can also use a vertical\index{vertical spacer} spacer inside a {\tt \\noalign} to put an extra space before the next row. (Vertical spacers are explained in Section~\ref{space}.) Finally, if a {\tt \\noalign} must go in front of a row, how can you put a horizontal line after the last row of the table? Simple---you just end the table with a null row, made with a {\tt \\multispan} having a null format. Yes, that's a bit of a \index{kludge}kludge, but it's a lot neater than the corresponding raw \TEX{} commands. Let's put this all together for one grand example, using the following input to create Figure~\ref{tabularfig}. You'll have to wait until Section~\ref{boxes} to find out how to perform the {\tt \\magic}\index{!magic}\label{magic} that generates the superscript \(a\){} in the last {\tt s}-expression in such a way that \TEX{} thinks that it takes up no room, thereby preventing it from messing up the alignment. \begin{example} \\begin\{figure\}\{A grand example.\} \\begin\{tabular\}\{[r|c|r]\} \\noalign\{\\hline\} \\multispan\{3\}\{[c]\}\{AT\\\&T Common Stock\} \\cr \\noalign\{\\hline\} \\multispan\{1\}\{[c|\}\{Year\} \& Price \& \\multispan\{1\}\{c]\}\{Dividend\} \\cr \\noalign\{\\hline\} 1973 \& 46-51 \& \\\$2.87 \\cr \\noalign\{\\hline\} 4 \& 40-53 \& 3.24 \\cr \\noalign\{\\hline\} 5 \& 45-52 \& 3.40 \\cr \\noalign\{\\hline\} 6 \& 51-59 \& \\multispan\{1\}\{rs\{\\magic\{a\}\}]\}\{.95\} \\cr \\noalign\{\\hline\} \\multispan\{3\}\{l\}\{\\(\^\{a\}\\)(first quarter only)\} \\end\{tabular\} \\end\{figure\} \end{example} Remember that as with the array environments, an environment begun in one entry must end in that entry. More precisely, any environment containing an {\tt \&}, {\tt \\cr}, \hbox{\tt \\multispan} or \hbox{\tt \\noalign} command must contain the entire \hbox{\tt tabular} environment. \section{Programs}\index{programs} There will eventually be special environments for formatting program text; for example, there might be a special \hbox{\tt pascal}\index{pascal environment} environment for formatting Pascal programs. The available environments will depend upon the particular document style\index{document style}. Program environments will be based upon the {\tt tabbing}\index{tabbing environment} environment described in Section~\ref{tabbing}. In the meantime, the {\tt tabbing} environment provides a convenient method of formatting programs just the way you want them. \section{The Title Page}\index{title page}\index{titlepage environment} The {\tt titlepage} environment creates a title page---that is, a page with no printed page number or heading. You can put a {\tt titlepage} environment any place in your document, but there's seldom any reason to put it anywhere but the first page. The page created by the {\tt titlepage} environment is just an ordinary page; it has a number like every other page, only that number is not printed. The layout of the title page is left all to you. With the various font-changing environments of Section~\ref{fontchange}, and the environments of Section~\ref{centering} for centering and justifying text, you know just about everything you need in order to do this. However, you will find the spacing commands of Section~\ref{space} on page~\pageref{space} and the {\tt \\noindent}\index{!noindent} command command described in Section~\ref{pbreak} to be helpful. Another command that you are likely to use on a title page is the \hbox{\tt \\today}\index{!today} command, which produces today's \index{date}date in a format determined by the document\index{document style} style. \LATEX{} produced this page of the manual on \today, as I told you by typing \begin{example} ... the manual on \\today, as I ... \end{example}