\chapter{Doing It Yourself} \label{doit} This chapter describes commands that give you more control over how \LATEX{} formats your text. With these commands, you can specify exactly what the output should look like. \section{Defining Things} \label{defining} When processing a document, \LATEX{} keeps track of what it's doing by assigning meanings to certain commands. Sometimes you have to assign those meanings, as when you use the commands of Section~\ref{theorems} to assign a meaning to \begin{verbatim} \begin{theorem} ... \end{theorem} \end{verbatim} This section describes how to define new commands and change the meaning of old ones, which is one way of changing how \LATEX{} formats your text. There are several different kinds of commands that are defined in different ways, as explained below. \subsection{Commands} \label{defcom} \newcommand{\alom}{$\alpha$---$\omega$} You can save yourself a lot of typing by defining your own commands to serve as abbreviations. For example, suppose your document contains the expression \mbox{$\alpha$---$\omega$} in many places. You can define the control sequence \verb"\alom" to mean \mbox{$\alpha$---$\omega$} by typing \begin{verbatim} \newcommand{\alom}{$\alpha$---$\omega$} \end{verbatim} (See Section~\ref{math} for an explanation of the the \verb"\alpha" and \verb"\omega" commands and the \verb"$"'s.) %%% $ -matchingxbra You can then type \begin{verbatim} The letters \alom are often used. \end{verbatim} to produce \begin{quote} The letters \alom are often used. \end{quote} Whoops, remember what you learned in Section~\ref{command-names} on page~\pageref{command-names}: \TEX{} gobbles up the space\index{space, after command} after a command name. So, you should type \verb*"\alom{} ". The \verb"\newcommand" command has an optional argument that lets you define commands with \index{arguments}arguments. Suppose your formulas have lots of expressions of the form $-x^{2} + y^{3}/x$ for different $x$ and $y$. You'd want to define a command \verb"\tnp" such that \verb"\tnp{m}{(n+1)}" was equivalent to typing \begin{verbatim} -m^{2} + (n+1)^{3}/m \end{verbatim} This is done with the command \begin{verbatim} \newcommand{\tnp}[2]{-#1^{2} + #2^{3}/#1} \end{verbatim} The optional argument specifies that \verb"\tnp" should have two arguments. The expressions \verb"#1" and \verb"#2" in the definition are replaced by the first and second arguments when the command is used. The braces enclosing the last argument of a \verb"\newcommand" command do not become part of the definition. If you define \begin{verbatim} \newcommand{\makebold}[#1]{\bf #1} \end{verbatim} then \TEX{} replaces \verb"\makebold{bold}" by \verb"\bf bold", with no braces around it. If you want \verb"\makebold{bold}" to mean \verb"{\bf bold}", limiting the scope of the \verb"\bf" declaration, then you should define \verb"\makebold" by \begin{verbatim} \newcommand{\makebold}[#1]{{\bf #1}} \end{verbatim} As I explained on page~\pageref{advice} of Section~\ref{advice}, definitions not only save you typing, but they also make it easy to change how things are formatted. For example, if you decide that there should be more space around the ``+'' in all those \verb"\tnp" expressions, you just change the definition. Had you typed out each formula, you'd have to go back and change each one individually. It would be disastrous if you accidentally redefined some ordinary \LATEX{} command. For example, \verb"\topfraction"\index{!topfraction} is a parameter \LATEX{} uses in its figure-placement algorithm. It would be fatal to redefine it to mean something else. Therefore, \verb"\newcommand" will produce an error if you try to redefine an existing command, and will not change the definition. This prevents you from accidentally redefining a \LATEX{} parameter. If you really want to change the definition of \verb"\topfraction", you should use the \index{!renewcommand@}\verb"\renewcommand" command. It works exactly the same as \verb"\newcommand" except that it doesn't object if the command is already defined. \yspace Before you try to do anything clever by defining your own commands, you should know a little more about how they work. When \TEX{} encounters a command that takes arguments, it looks for that command's arguments before trying to interpret any more commands. If you're a computer programmer who knows about macro \index{macro expansion} expansion, then you'll understand why the following restriction applies. If not, then just remember the restriction. \begin{quote} \it Never define a command that produces arguments for another command without producing that other command. \end{quote} For example, you can't write \begin{verbatim} \newcommand{\gnu}{{x}{y}} \tnp\gnu is wrong \end{verbatim} because the macro \verb"\gnu" produces the arguments for the \verb"\tnp" command, but it doesn't generate that command. However, you can write \begin{verbatim} \newcommand{\gnat}{\tnp{x}} \gnat{y} \end{verbatim} where \verb"\gnat{y}" produces \verb"\tnp{x}{y}", since the \verb"\gnat" produces the \verb"\tnp" command as well as its first argument. \yspace \noindent {\bf Warning:} Don't define a command that produces a \hbox{\verb"\newcommand"} or \linebreak %%%%%% \hbox{\verb"\renewcommand"} command. When you find yourself wanting to do things like that, you should either wait until the urge passes or else read Chapter~20 of \knuth{} and become a full-fledged \TEX{} \index{TEX macros}macro hacker. \subsection{Lengths}\index{length}\label{length} A length is a measure of distance. Many \LATEX{} commands take a length as an argument---for example, the \verb"\hspace"\index{!hspace} command for leaving a horizontal space. Typing \verb"\hspace{1in}" leaves a one-inch space. The length {\tt 1in} can also be represented in metric units as \index{cm}{\tt 2.54cm} or \index{mm}{\tt 25.4mm}. This length is approximately equal to \index{pt}{\tt 72pt}, where {\tt pt} denotes \index{point}{\it point}---a unit of length popular with printers. Lengths can also be negative, like {\tt -2.54cm}. \yspace \noindent {\bf Warning:} {\tt 0} is not a length. A length \index{zero length} of zero is written {\tt 0in} or {\tt 0cm} or {\tt 0pt}, not {\tt 0}. This is a common mistake, so be careful. \yspace While inches and points are convenient units, they usually work only for a specific format. 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 one- to two-column pages. It's better to use units of length that change with the page layout and document style. The simplest such units are the {\tt em}\index{em} and the {\tt ex}\index{ex}. A {\tt 1em} length is about equal to the width of an ``M'', and {\tt 1ex} is about the height of the letter ``x''. These units vary with the type size and style. The {\tt em} is best used for horizontal lengths and the {\tt ex} for vertical lengths. Here's an {\tt em} ruler for the current font \begin{center} \setlength{\unitlength}{1em} \begin{picture}(30,2.7)(0,0) \put(0,0){\line(1,0){30}} \multiput(1,0)(1,0){29}{\line(0,1){.3}} \multiput(5,0)(10,0){3}{\line(0,1){.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}{\line(0,1){.6}} \end{picture} \end{center} and here's an {\tt ex} ruler. \begin{center} \setlength{\unitlength}{1ex} \begin{picture}(30,2.7)(0,0) \put(0,0){\line(1,0){30}} \multiput(1,0)(1,0){29}{\line(0,1){.6}} \multiput(5,0)(10,0){3}{\line(0,1){.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}{\line(0,1){1.2}} \end{picture} \end{center} \begin{small} \noindent Here's an {\tt em} ruler for the {\tt small} Roman font. \begin{center} \setlength{\unitlength}{1em} \begin{picture}(30,2.7)(0,0) \put(0,0){\line(1,0){30}} \multiput(1,0)(1,0){29}{\line(0,1){.3}} \multiput(5,0)(10,0){3}{\line(0,1){.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}{\line(0,1){.6}} \end{picture} \end{center} \end{small} \yspace In addition to writing explicit lengths like {\tt 1in} or {\tt 3.5em}, you can also express lengths in terms of {\it length \index{length command}commands}. A length command is a command whose value is a length. One example of a length command is \index{!parindent}\verb"\parindent", whose value is the distance by which the beginning of a paragraph is indented. The command \verb"\hspace{\parindent}" leaves a horizontal space of length \linebreak %%%%%% \hbox{\verb"\parindent"}. You can also type \hbox{\verb"2.5\parindent"} for a length that's 2.5 times as large as the \verb"\parindent" length, or \hbox{\verb"-2.5\parindent"} for the negative of that length. As you'd expect, \hbox{\verb"-\parindent"} is the same as \hbox{\verb"-1.0\parindent"}. Below is a list of some other length commands that are used by \LATEX{}. A more complete list is given in Section~\ref{parameters}. By expressing lengths in terms of these length commands, you can make your formatting commands work with different document styles. \begin{description}{{\tt \bs marginparwidth}:} \item[{\tt \bs parindent}:] The \index{!parindent} paragraph indentation. \item[{\tt \bs textwidth}:] The \index{!textwidth} width of text on the page. \item[{\tt \bs textheight}:] The \index{!textheight} height of the text on a page, excluding the running head and the page number. \item[{\tt \bs parskip}:] The extra vertical space inserted between paragraphs. \item[{\tt \bs baselineskip}:] The normal vertical distance from the bottom of \index{bottom of line} one line to the bottom of the next line in the same paragraph. Thus, \verb"\textwidth"$\,\div\,$ \linebreak %%%%% \verb"\baselineskip" equals the number of lines of text that would appear on a page if it were all one paragraph. \end{description} A length like \verb"\parindent" is a rigid \index{rigid length} length. If the value of \verb"\parindent" is {\tt 1cm}, then every \verb"\hspace{1cm}" command produces exactly the same amount of space, which will be about {\tt 1cm} wide. (It may not be exactly {\tt 1cm} because your output device can uniformly change the size of all dimensions---for example, it might magnify everything by 5\%.) However, there are also {\it rubber \index{rubber lengths}lengths\/} that can vary. The space that \TEX{} puts between words has a rubber length, so it can stretch or shrink as required. This space stretches or shrinks just enough so the whole line has the required width, which is how \TEX{} right-justifies lines. Section~\ref{spacing} explains how to create one kind of useful rubber space. Most of the time you don't need to worry about rubber spaces, but you should be aware that they exist. Of the length commands described above, only \verb"\parskip" is a rubber length; the rest are rigid. \yspace \LATEX{} provides the following declarations for the values of length commands and for creating new length commands. These declarations obey the usual scope rules. \begin{description}{{\tt \bs addtolength}:} \item[{\tt \bs newlength}:] Used to \index{!newlength@} define \index{defining length commands} a new length command. You type \begin{verbatim} \newlength{\gnat} \end{verbatim} to make \verb"\gnat" a length command with value {\tt 0in}. An error occurs if a \verb"\gnat" command already exists. \item[{\tt \bs setlength}:] Used \index{!setlength@} to set the value of a length command. Typing \begin{verbatim} \setlength{\gnat}{.01in} \end{verbatim} defines the length \verb"\gnat" to be .01 inches. \item[{\tt \bs addtolength}:] Increments a length \index{!addtolength@} by a specified amount. If the current value of \verb"\gnat" is .01 inches, then the command \begin{verbatim} \addtolength{\gnat}{-.1\gnat} \end{verbatim} changes the value to .009 inches---its original value plus -.1 times its original value. \item[{\tt \bs settowidth}:] Sets the value of a length command equal \index{!settowidth@} to the width of a specified piece of text. The command \begin{verbatim} \settowidth{\gnat}{\it small} \end{verbatim} sets \verb"\gnat" to the width of the text {\it small}---i.e., the width of the text produced by typesetting \begin{verbatim} {\it small} \end{verbatim} Note that \TEX{} is in LR \index{LR mode} mode when processing the second argument of the \verb"\settowidth" command. \end{description} If you create a length command with \verb"\newlength", then you can change its value any time you please. This is also the case for some of \LATEX's lengths, such as \index{!parindent}\verb"\parindent". Some lengths, like \index{!textwidth}\hbox{\verb"\textwidth"} and \hbox{\verb"\textheight"}\index{!textheight}, can be changed only before the \hbox{\verb"\begin{document}"} command. Others, like the remaining lengths from the previous list, can be changed in the middle of the document, but only with extreme care. Still others should never be changed at all. Before changing the value of any of \LATEX's lengths, you should consult Section~\ref{parameters} to find out when you're allowed to do so. \subsection{Counters} \label{counters} \index{counters@} Everything \LATEX{} numbers for you has a {\it counter\/} associated with it. The name of the counter is the same as the name of the environment or command that produces the number, except with no \xsp{}\verb"\"\Xsp. Below is a list of the counters created by \LATEX{} when you're using the {\tt report} document style. \[ \begin{tabular}{l@{\s{30pt}}l@{\s{30pt}}l} {\tt chapter} & {\tt figure} & {\tt footnote} \\ {\tt section} & {\tt table} & {\tt mpfootnote}\\ {\tt subsection} & {\tt equation} & {\tt enumerate} \\ {\tt subsubsection} & {\tt page} & {\tt list} \end{tabular} \] (The {\tt mpfootnote}\index{mpfootnote counter} counter is explained in Section~\ref{parbox} on page~\pageref{parbox}.) In addition, an environment created with the \index{!newtheorem}\verb"\newtheorem" command of Section~\ref{theorems} has a counter of the same name, so a {\tt theorem} environment will have a {\tt theorem} counter. The value of a counter is a single nonnegative integer. Things that have multiple numbers get those numbers from multiple counters, so 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. The initial value of a counter is zero, and it is incremented by the appropriate command or environment. For example, the \hbox{\verb"\section"} command increments the \hbox{\tt section} counter before it generates the section number. The \hbox{\tt section} counter is reset to zero when the \hbox{\tt chapter} counter is incremented, causing section numbers to start again from one in the new chapter. You can set the value of a counter with the \verb"\setcounter"\index{!setcounter@} command, where \begin{verbatim} \setcounter{footnote}{17} \end{verbatim} sets the value of the {\tt footnote} counter to 17. The first \verb"\footnote" command following this \verb"\setcounter" command will look like this.\footnote[18]{Remember that it's numbered 18 because the counter is stepped by the \hbox{\tt \bs footnote} command before the number is generated.} The \verb"addtocounter"\index{!addtocounter@} command increments the counter by the specified \linebreak %%%%%%%% amount, so \begin{verbatim} \addtocounter{footnote}{-2} \end{verbatim} decreases the value of the {\tt footnote} counter by two. When solving tricky footnote-placement problems, as discussed in Section~\ref{footnotes}, you should remember that the {\tt footnote} counter is incremented by the \hbox{\verb"\footnotemark"}\index{!footnotemark} command, but not by the \hbox{\verb"\footnotetext"}\index{!footnotetext} command. The \verb"\setcounter" and \hbox{\verb"\addtocounter"} commands affect only the specified counter. Changing the \hbox{\tt chapter} counter does not affect the \hbox{\tt section} counter. The commands to change counter values are global declarations, their effects are not limited by the normal scope rules for declarations. The {\tt page}, {\tt enumerate} and {\tt list} counters are somewhat different from the rest. The {\tt page} \index{page counter}\index{page numbering}counter is used to generate the page number. It differs from the other counters in that its value is the number of the current page (the next one to be written out), so a \verb"\setcounter{page}{27}" in the middle of the document causes the current page to be numbered 27. For this reason, the {\tt page} counter is initialized to one instead of zero. The \index{enumerate counter}{\tt enumerate} and \index{list counter}{\tt list} counters, used by the {\tt enumerate}\index{enumerate environment} and {\tt list}\index{list environment} environments to number list items, are also exceptional. These counters are reset to zero upon entry to the environment, so any change to their values has no effect after exiting from the environment. These counters are incremented by the \verb"\item"\index{!item} command. However, they are {\it not\/} incremented by an \verb"\item" command that has an optional argument. \yspace \index{counters, printing their values} In addition to changing the value of a counter, you can change the way that value is printed. For example, you can get the section number to print as ``II-C'' instead of ``2.3''. \LATEX{} provides a number of commands for printing counter values in different ways. Their use is explained below, under the assumption that the value of the {\tt subsection} counter is \arabic{subsection}, as it is right now in this document. \[ \begin{tabular}{lc} \multicolumn{1}{c}{\underline{\it Typing}} & \underline{\it Gives} \\[2pt] \verb"\arabic{subsection}" & \arabic{subsection} \index{!arabic@} \\ \verb"\roman{subsection}" & \roman{subsection} \index{!roman@} \\ \verb"\Roman{subsection}" & \Roman{subsection} \index{!Roman@} \\ \verb"\alph{subsection}" & \alph{subsection} \index{!alph@} \\ \verb"\Alph{subsection}" & \Alph{subsection} \index{!Alph@} \end{tabular} \] The \verb"\newnumbering"\index{!newnumbering@} command redefines the way \LATEX{} prints the number for the indicated counter. For example, if you want the third section of the second chapter to be numbered ``II-C'' instead of ``2.3'', you type the command \begin{verbatim} \newnumbering{section}{\Roman{chapter}-\Alph{section}} \end{verbatim} The \verb"\section" command will then produce the desired section numbers---in both the section heading and the table of contents entry. You'll seldom want to change the way sections are numbered in just part of your document, so the obvious place for a \hbox{\verb"\newnumbering"} command is before the \hbox{\verb"\begin{document}"} command. However, \hbox{\verb"\newnumbering"} is an ordinary declaration, obeying the usual scoping rules. \LATEX{} provides a single \verb"\pagenumbering"\index{!pagenumbering@} command that changes the way pages are numbered and resets the page number. The command \begin{verbatim} \pagenumbering{roman} \end{verbatim} has the same effect as \begin{verbatim} \newnumbering{page}{\roman{page}} \setcounter{page}{1} \end{verbatim} except that it acts like a global declaration. You can't use the \verb"\newnumbering" command on the \hbox{\tt footnote}\index{footnote counter}, \hbox{\tt mpfootnote}\index{mpfootnote counter}, or \hbox{\tt enumerate} \index{enumerate counter} counter. To change the way footnotes are numbered, you must use a different document style. If you don't like the way enumerated lists are numbered, you can create your own with the {\tt list} environment described in Section~\ref{list}. You can't use \hbox{\verb"\newnumbering"} for the {\tt list} counter either, but there's no reason you'd want to. \section{Spaces and Boxes} The simplest kind of do-it-yourself formatting in \LATEX{} involves the use of spacing and box-making commands. You should read Section~\ref{length} on page~\pageref{length} before trying to learn about these commands. \subsection{Spaces} \label{spacing} \index{spacing} Horizontal \index{horizontal space,adding}space is added with the \verb"\hspace"\index{!hspace@} command. For example, typing \begin{verbatim} produces a \hspace{.25in} .25-inch space. \end{verbatim} produces a \hspace{.25in} .25-inch space. More precisely, it produces a blank ``word'' that is .25 inch wide. \TEX{} will leave space around this blank word, just as it leaves space around any word. If you want the space between the ``a'' and the ``.25-inch'' to be exactly .25 inch, then you should type \begin{verbatim} a\hspace{.25in}.25-inch space. \end{verbatim} You can add negative \index{negative space,adding} as well as positive space with an \verb"\hspace" command. Adding negative space is like backspacing. You can do funny\hspace{-2.7em}///// weird things by typing \begin{verbatim} funny\hspace{-2.7em}///// weird \end{verbatim} Whenever you type a \xsp{}\verb*" "\xsp{} between two words, \TEX{} puts a space between them. However, it removes that space if the first word ends a line and the second one begins a new line. \TEX{} treats the space produced by an \verb"\hspace" command the same as ordinary interword space, and may remove it. If you want the space to appear even if it would be at the beginning or end of a line, then use an \verb"\hspace*"\index{!hspace*@} command. This {\tt *}-variant is the same as the ordinary \verb"\hspace" command, except that the space it produces is never removed. The command \xsp{}\verb"\s"\index{!s@}\xsp{} is an abbreviation for the \index{!hspace, abbreviation for} the \verb"\hspace" command. It has no {\tt *}-form. The \xsp{}\verb"\s"\xsp{} command can be used in some places where \verb"\hspace" can't, including the argument of a sectioning \index{sectioning command} command or table of contents command (Section~\ref{sectioning}) and an {\tt @}-expression\index{@-expression} in an {\tt array}\index{array environment} or {\tt tabular}\index{tabular environment} environment (Sections \ref{array} and \ref{tabular}). \yspace Vertical \vspace{.1in} space \index{vertical spacing} is added by the \verb"\vspace"\index{!vspace@} command. The usual place for a \verb"\vspace" command is between paragraphs, where it adds the indicated space between the paragraphs. If a \verb"\vspace" command comes in the middle of a paragraph, then the vertical space is added after the line in which it appears. I obtained the extra vertical space in this paragraph by typing paragraph by starting the paragraph with \begin{verbatim} Vertical \vspace{.1in} space is added ... \end{verbatim} \LATEX{} provides three standard vertical spacing commands to add extra space between paragraphs: \hbox{\verb"\smallskip"}\index{!smallskip@}, \hbox{\verb"\medskip"}\index{!medskip@}, and \hbox{\verb"\bigskip"}\index{!bigskip@}. The \linebreak %%%%% \hbox{\verb"\smallskip"} command is an abbreviation for \hbox{\verb"\vspace{\smallskipamount}"}\index{!smallskipamount@}, where \hbox{\verb"\smallskipamount"} is a length determined by the document style. The other two commands are similarly abbreviations for \hbox{\verb"\vspace"}'s of \linebreak %%%%% \hbox{\verb"\medskipamount"}\index{!medskipamount@} and \hbox{\verb"\bigskipamount"}\index{!bigskipamount@}. These are rubber lengths, which can stretch or shrink a bit. The amount of vertical space added by these commands when no stretching or shrinking takes place is shown below. \sbox0{\begin{picture}(12,0) \put(0,0){\line(1,0){12}} \put(0,0){\line(0,1){1.5}} \put(12,0){\line(0,1){1.5}} \end{picture}} \sbox1{\begin{picture}(12,0) \put(0,0){\line(1,0){12}} \put(0,0){\line(0,-1){1.5}} \put(12,0){\line(0,-1){1.5}} \end{picture}} \sbox2{\begin{picture}(12,0) \put(0,0){\line(1,0){12}} \put(0,0){\line(0,1){1}} \put(12,0){\line(0,1){1}} \end{picture}} \sbox3{\begin{picture}(12,0) \put(0,0){\line(1,0){12}} \put(0,0){\line(0,-1){1}} \put(12,0){\line(0,-1){1}} \end{picture}} \[ \begin{tabular}{ll} \verb"\smallskip": & \unitlength \smallskipamount \begin{picture}(1,0) \put(0,0){\usebox2} \put(0,1){\usebox3} \end{picture}\\[3pt] \verb"\medskip": & \unitlength \medskipamount \begin{picture}(1,0) \put(0,0){\usebox0} \put(0,1){\usebox1} \end{picture}\\[5pt] \verb"\bigskip": & \unitlength \bigskipamount \begin{picture}(1,0) \put(0,0){\usebox0} \put(0,1){\usebox1} \end{picture} \end{tabular} \] \sbox0{}\sbox1{}\sbox2{}\sbox3{} Just as it removes horizontal space that comes at the end of a line, \TEX{} removes vertical space that comes at the end of a page. To create vertical space that is never removed, use a \verb"\vspace*"\index{!vspace*} command. \yspace Spaces with stretchable \index{stretchable lengths} lengths are usually of interest only to people who design document styles. However, a space that stretches as much as it can is useful for \index{box, moving text around in} centering objects in a box or pushing them to one side of the box. The command \verb"\hfill"\index{!hfill@} produces such a horizontal space. You should think of an \verb"\hfill" as a spring that pushes things away from it; if two or more \verb"\hfill"'s ``fight'' one another, they produce equal-length spaces. As an example of how the \verb"\hfill" command is used, consider the {\tt description} \index{description environment} environment described in Section~\ref{list-making}. Each item label is put in a box of a fixed width. The \verb"\hfill" command can move text around in that box, as shown by the following {\tt description} environment which is begun with a \begin{verbatim} \begin{description}{gnomes:} \end{verbatim} command, and where the \verb"\item" command generating each label is shown. A rectangle is drawn around the label box to make the spacing easier to see; it doesn't really appear in the output. \newlength{\temp} \settowidth{\temp}{gnomes:} \addtolength{\temp}{7pt} \begin{description}{\framebox[\temp]{gnomes:}} \item[{\framebox[\temp][l]{gnu:}}] \verb"\item[gnu:]" --- The label is normally moved to the left of the box. \item[{\framebox[\temp]{\hfill gnu:}}] \verb"\item[\hfill gnu:]" --- The \verb"\hfill" pushes the ``gnu:'' to the right of the box. \item[{\framebox[\temp]{gnu\hfill:}}] \verb"\item[gnu\hfill :]" --- The \verb"\hfill" pushed the ``gnu'' and the ``:'' to opposite sides of the box. \item[{\framebox[\temp]{\hfill gnu:\hfill}}] \verb"\item[\hfill gnu:\hfill]" --- The two \verb"\hfill"'s push the label to the center of the box. \item[{\framebox[\temp]{\hfill gnomes:}}] \verb"\item[\hfill gnomes:]" --- The \verb"\hfill" does nothing because the ``gnomes:'' already fills the box, so there's nowhere to push it. \end{description} \yspace Sometimes, instead of just creating a rubber space, you'd like to fill that space with something. The \verb"\dotfill"\index{!dotfill@} command acts just like \verb"\hfill" except it produces dots\index{dots, filling space with} instead of spaces. The command \verb"\hrulefill"\index{!hrulefill@} works the same, except it produces a horizontal rule. They are illustrated below. \[ \begin{tabular}{ll} \multicolumn{1}{c}{\underline{\it Typing}} & \underline{\it Gives} \\[2pt] \verb"\item[g\dotfill :]" & \framebox[\temp]{g\dotfill :}\\[2pt] \verb"\item[g\hrulefill :]" & \framebox[\temp]{g\hrulefill :}\\[2pt] \end{tabular} \] \subsection{Boxes} \index{boxes} \label{boxes} You learned in Section~\ref{modes} that a box is a chunk of text that \TEX{} treats as a unit, just as if it were a single letter. If you leave a blank line before it, the box will start a new paragraph---complete with paragraph indentation. You'll often want to center\index{centering a box}\index{box, centered on its own line} a box in a line by itself. The easiest way to do this is to pretend that the box is a mathematical formula and use the \verb"\[ ... \]" commands described in Section~\ref{math} on page~\pageref{math}. \LATEX{} provides a number of commands for making boxes. There are three general kinds of boxes: LR boxes, in which the contents of the box is processed in LR \index{LR mode} mode, parboxes, in which the contents of the box is processed in paragraph \index{paragraph mode} mode, and rule boxes that consist of just a rectangular blob of ink. A box-making command can be used in any mode, and the declarations in effect at that point in the document are used in typesetting the contents of the box. For example, if a bold typeface has been declared, then the text in the box will appear in boldface, unless another typeface declaration is made. An exception is that the math-italic \index{math italic} typeface, described in \ref{math-style}, will be used only in math mode. When a box-making command appears inside math mode, the typeface chosen is the most recently declared typeface other than math italic---usually the one in effect outside the math formula. Declarations made inside a box are local to the box. In other words, the braces around the text-producing argument are ``staircase'' braces, as described on page~\pageref{decls} of Section~\ref{decls}. \subsubsection{LR Boxes} \label{lr-boxes} We've already encountered the \verb"\mbox"\index{!mbox@} command, which produces a box containing its argument, processed in LR mode. The command \verb"\mbox" is an abbreviation for the \verb"\makebox"\index{!makebox@} command. However, the \verb"\makebox" command has optional arguments, which the \verb"\mbox" command doesn't. The box created by an \verb"\mbox" command is just wide enough to hold the text created by its argument. You can specify the size of the box \index{making boxes of a specified width} by using the \hbox{\verb"\makebox"} with an optional argument. Typing \begin{verbatim} \makebox[1in]{gnu} \end{verbatim} creates a box whose width is {\tt 1in}, having ``gnu'' centered within it. You can put the ``gnu'' at the left of the box by adding a second optional argument as \index{l, argument of !makebox} follows: \begin{verbatim} \makebox[1in][l]{gnu} \end{verbatim} Replacing the \xsp{}{\tt l}\xsp{} by an \xsp{}{\tt r}\xsp{} puts the ``gnu'' at the right of the box. The \verb"\makebox" command provides a hackish way of formatting things yourself. For example, you can generate \begin{quote}\raggedright \makebox[.75in][l]{Armadillo:}\makebox[.4in][r]{1147.2} \\ \makebox[.75in][l]{Gnat:}\makebox[.4in]{---} \\ \makebox[.75in][l]{Gnu:}\makebox[.4in][r]{322} \end{quote} with the following input. (See Section~\ref{paragraph-making} for an explanation of the {\tt quote} environment and the \verb"\raggedright" and \verb"\\" commands.) \begin{verbatim} \begin{quote} \raggedright \makebox[.75in][l]{Armadillo:}\makebox [.4in][r]{1147.2} \\ \makebox[.75in][l]{Gnat:}\makebox[.4in]{---} \\ \makebox[.75in][l]{Gnu:}\makebox[.4in][r]{322} \end{quote} \end{verbatim} The environments of Section~\ref{tab-tab} provide much easier ways of doing this kind of formatting; this example is given only to illustrate the \verb"\makebox" command. In addition to the positioning obtained with the \hbox{\verb"\makebox"'s} second optional argument, you can also move things around inside the box by adding spaces---especially the rubber spaces provided by the \verb"\hfill"\index{!hfill} command of Section~\ref{spacing}. \yspace When you provide a width argument to a \verb"\makebox" command, \LATEX{} assumes that to be the width of the box---even if the text in the box is wider. If you say that the box is {\tt 1in} wide, \LATEX{} will leave one inch for it. If the text in the box is wider than one inch, then it will stick outside the space reserved for the box and may overlap surrounding text. On which side the text sticks out depends on where the text is positioned in the box, as indicated below. \[ \begin{tabular}{l@{\s{.75in}}c} \verb"\makebox[.25in]{big armadillos}" & \framebox[24pt]{big armadillos}\\[4pt] \verb"\makebox[.25in][l]{big armadillos}" & \framebox[24pt][l]{big armadillos}\\[4pt] \verb"\makebox[.25in][r]{big armadillos}" & \framebox[24pt][r]{big armadillos} \end{tabular} \] An especially useful instance of this is to put text in a box \index{zero-width boxes} of zero width, which makes \TEX{} act as if the text took up no horizontal space. This would produce absurd results if done in ordinary text, but it can be very helpful in making arrays and tables with the commands described in Section~\ref{tab-tab}. Remember, though, that the width must be written as something like {\tt 0in}, not just as {\tt 0}. \yspace You can specify the height as well as the width of the box by giving another kind of optional argument to the \verb"\makebox" command. This is generally used only in the {\tt picture} environment, so it is described in Section~\ref{pictures}. \yspace The \verb"\framebox"\index{!framebox@} command is exactly the same \index{boxes, making with frames} as the \verb"\makebox" command, except it puts a frame around the outside of the box that it creates. For example, you can produce \framebox[.5in][l]{gnu} by typing \begin{verbatim} produce \framebox[.5in][l]{gnu} by typing \end{verbatim} There's also an \verb"\fbox"\index{!fbox@} command that's an abbreviation for a \verb"\framebox" with no optional arguments. Typing \verb"\fbox{gnu}" produces \fbox{gnu}. The \verb"\framebox" command produces a rule of thickness \verb"\fboxrule"\index{!fboxrule@}, and leaves a space of \verb"\fboxsep"\index{!fboxsep@} between the rule and the contents of the box. You can change these length commands at will, as described in Section~\ref{length}. \yspace Sometimes you'll use a single piece of text in several places. The \hbox{\verb"\newcommand"} command described in Section~\ref{defcom} will define a command that produces the text. However, every time \TEX{} encounters this command, it will have to go through all the trouble of typesetting the text again. If the text is complicated---especially if it contains a \hbox{\tt picture}\index{picture environment, reusing} environment---\TEX{} will waste a lot of time typesetting it over and over again. The \verb"\savebox"\index{!savebox@} command allows you to create and save a box which can then be used as many times as you want. \LATEX{} provides ten storage \index{storage bins} bins for saving boxes. The bins are numbered 0 through~9, and each one can hold a single box. The command \hbox{\verb"\savebox3"} acts exactly like a \hbox{\verb"\makebox"} command except that instead of printing the box, it saves it in storage bin~3. You can print the contents of storage bin~3 any time by giving the command \index{!usebox@}\hbox{\verb"\usebox3"}. Of course, the \xsp{}{\tt 3}\xsp{} can be any digit from {\tt 0} through~{\tt 9}. For example, if I \savebox7[1in][r]{\fbox{good} \fbox{gnus}}type \begin{verbatim} \savebox7[1in][r]{\fbox{good} \fbox{gnus}} \end{verbatim} somewhere earlier in the text, then typing \begin{verbatim} this is \usebox7. \end{verbatim} produces \begin{quote} this is \usebox7. \end{quote} The command \verb"\sbox"\index{!sbox@} is the short form of \verb"\savebox" when it has no optional arguments. The \verb"\savebox" and \verb"\sbox" commands are declarations, with the usual scope rules. \subsubsection{parboxes} \label{parbox} A parbox is a box whose contents are created in paragraph \index{paragraph mode} mode. Several environments create parboxes---for example, the {\tt figure} and {\tt table} environments described in Section~\ref{figures}. There are two ways to create parboxes in ordinary text: with the \verb"\parbox"\index{!parbox@} command and the {\tt minipage} \index{minipage environment} environment. ``Small'' parboxes, containing little text, can be made with the \hbox{\verb"\parbox"} command. This command has two mandatory arguments: a length that specifies the width of the parbox, and the text that goes inside the parbox. \fbox{\parbox{1.52in}{A parbox in the middle of text looks rather strange.}} This observation, which was contained in a parbox 1.5 inches wide, was made by typing \begin{verbatim} \fbox{\parbox{1.5in}{A parbox ... strange.}} This observation ... \end{verbatim} (See Section~\ref{lr-boxes} above for a description of the \verb"\fbox" command.) There is no paragraph indentation inside the parbox because the \verb"\parindent"\index{!parindent, in a parbox} length that specifies the amount of indentation is set to zero. You can set it to any other value with the commands of Section~\ref{length}. Notice that the parbox was vertically positioned so its center lined up with the center of the text line. An optional first argument allows you to line up either the top or bottom line of the parbox. The equation \[ \parbox[t]{.6in}{This is a {\tt t} par\-box.} \s{10pt}+\s{10pt} \parbox[b]{.6in}{This is a {\tt b} par\-box.} \s{10pt}=\s{10pt} \parbox{.6in}{This is a plain par\-box.} \] was produced by typing \begin{verbatim} \[ \parbox[t]{.6in}{This is a {\tt t} parbox.} + \parbox[b]{.6in}{This is a {\tt b} parbox.} = \parbox{.6in}{This is a plain parbox.} \] \end{verbatim} If you need finer control of the vertical positioning, see the description of the \verb"\raisebox"\index{!raisebox} command in Section~\ref{raisebox}. These examples are all quite silly, but there are perfectly reasonable situations in which you'll want to use a parbox---for example, to place text inside a picture. The \verb"\parbox" command is used for a parbox containing a small piece of text, with nothing fancy inside. In particular, you shouldn't use any of the paragraph-making environments described in Section~\ref{paragraph-making} inside a \verb"\parbox" argument. For larger pieces of text, including ones containing a paragraph-making environment, you should use a {\tt minipage} \index{minipage environment@} environment. This environment takes the same optional position argument and mandatory width argument as the \verb"\parbox" command. Thus, the above example could have been typed as \begin{verbatim} \[ \begin{minipage}[t]{.6in} This is a {\tt t} parbox. \end{minipage} + ... \end{verbatim} Footnotes in a \index{footnotes, in minipage} {\tt minipage} environment are handled in a way that is particularly useful for putting footnotes in figures or tables. To understand it, you should first read the description of the footnote commands in Section~\ref{footnotes} on page~\pageref{footnotes}. A \hbox{\verb"\footnote"}\index{!footnote, in a minipage} or \index{!footnotetext, in a minipage}\hbox{\verb"\footnotetext"} command puts the footnote at the bottom of the minipage instead of at the bottom of the page, and it uses the \hbox{\tt mpfootnote} \index{mpfootnote counter} counter instead of the ordinary {\tt footnote} \index{footnote counter} counter. Moreover, these commands can be used anywhere in the minipage environment---even inside another box-making command. To get an ordinary footnote that goes at the bottom of the regular page, you can use the \hbox{\verb"\footnotemark"} command as usual. \yspace \noindent {\bf Warning:} Don't put one {\tt minipage} environment \index{minipage environment, nesting} inside another if you are using footnotes; they may wind up at the bottom of the wrong minipage. \yspace \noindent {\bf Warning:} If a {\tt minipage} environment begins or ends with one of the paragraph-making \index{paragraph-making environments, in a minipage} environments described in Section~\ref{paragraph-making}, it will put extra vertical space at the top or bottom of the minipage, respectively. The extra space at the top of the minipage equals the value of the \verb"\parsep"\index{!parsep} length command. It can be cancelled by a \verb"\vspace*{-\parsep}"\index{!vspace*, at top of minipage} command at the beginning of the minipage. (See Section~\ref{spacing} for a description of the spacing commands.) Exactly how much extra space is put at the bottom of the minipage will depend upon the situation. It can be cancelled by a \verb"\vspace"\index{!vspace, at bottom of minipage} of an appropriate negative length at the end of the {\tt minipage} environment. Remember that you must use a \verb"\vspace*" at the beginning and a \verb"\vspace" at the end. \subsubsection{Rule Boxes}\index{rule boxes} A rule box is a rectangular \index{blobs, rectangular}\index{rectangular blobs} blob of ink. It is made with the \verb"\rule"\index{!rule@} command, which has two mandatory arguments that specify the width and height of the blob. Thus, typing \verb"\rule{.25in}{.02in}" produces \rule{.25in}{.02in}. The command has an optional first argument that specifies how high to raise the rule. Thus, typing \verb"\rule[.5ex]{.25in}{.02in}" produces \rule[.5ex]{.25in}{.02in}, the same rule as before raised a distance of {\tt .5ex}. You can lower the rule by raising it a negative distance. Note that a thin enough rule is just a line, so the \verb"\rule" command allows you to draw horizontal \index{lines, horizontal} or vertical \index{lines, vertical} lines of arbitrary length and thickness. A rule whose width is zero is called a \label{strut}{\it strut}\index{strut}. Since it has no width, a strut is invisible. However, a strut does have height, and \TEX{} will adjust its vertical spacing exactly as if there were a box there. You can get some idea of how struts are used by considering \begin{quote} \fbox{box} and \fbox{\rule[-1ex]{0ex}{3ex}box} \end{quote} which was produced by typing \begin{verbatim} \fbox{box} and \fbox{\rule[-1ex]{0ex}{3ex}box} \end{verbatim} \subsubsection{Raising and Lowering Boxes} \label{raisebox} \index{raising text}\index{lowering text} Sometimes you want to \raisebox{.4ex}{raise} or \raisebox{-.4ex}{lower} text. This is done with the \verb"\raisebox"\index{!raisebox@} command, as I just did by typing \begin{verbatim} to \raisebox{.4ex}{raise} or \raisebox{-.4ex}{lower} \end{verbatim} The first argument specifies how high the text is to be raised. The text itself is processed in LR \index{LR mode} mode, so \hbox{\verb"\raisebox{0in}{...}"} is equivalent to \hbox{\verb"\mbox{...}"}\index{!mbox}. Sometimes it's useful to make \TEX{} think something has a different size than it really does---or a different size than \TEX{} would normally think it has. Section~\ref{lr-boxes} tells you how to use the \hbox{\verb"\makebox"}\index{!makebox} command to change how wide \TEX{} thinks something is. The \verb"\raisebox" command lets you tell \TEX{} how \index{height, changing apparent} tall it is. Typing \begin{verbatim} \raisebox{.4ex}[1.5ex][.75ex]{text} \end{verbatim} not only raises \raisebox{.4ex}{text} by {\tt .4ex}, it also makes \TEX{} thinks that the \raisebox{.4ex}{text} extends {\tt 1.5ex} above the bottom of the line and {\tt .75ex} \index{depth, changing apparent} below the bottom of the line. (The \index{bottom of line} ``bottom'' of the line is where most characters sit; some letters like {\it y\/} extend below the bottom of the line.) If you omit the second optional argument, \TEX{} will think it sticks as far below the line as it actually does. Changing how tall \TEX{} thinks something is changes how much space \TEX{} leaves for it. If I make a rule like \rule{.01in}{.25in} by typing \verb"\rule{.01in}{.25in}", \TEX{} leaves an extra vertical so the rule doesn't extend into the preceding line. However, I can produce a rule like \xsp{}\raisebox{0in}[0in]{\rule{.01in}{.25in}}\xsp{} that does extend into the preceding line by typing \begin{verbatim} \raisebox{0in}[0in]{\rule{.01in}{.25in}} \end{verbatim} \section{Line and Page Breaking} The first thing \TEX{} does when processing ordinary text is to translate your input file into a string of glyphs \index{glyphs} and spaces. To produce a printed document, this string must be broken into lines, and these lines must be broken into pages. In some environments, you do the line breaking yourself with the \xsp\verb"\\"\xsp\index{!!} command, but \TEX{} usually does it for you. \TEX{} does a very good job of line and page breaking, but sometimes it needs your help. When it does, you can read Sections \ref{line-breaking} and \ref{page-breaking} to find out what to do. \subsection{The {\tt \bs\bs} Command} \index{!!@} \label{cr} \index{line breaking, with !!} The \xsp\verb"\\"\xsp{} command tells \TEX{} to start a new line. It has an optional argument that specifies how much extra vertical space is to be left after the line. A negative argument causes \TEX{} to leave less space than usual. There's also a {\tt *}-form, which is exactly the same as the ordinary form except it also tells \TEX{} not to start a new page after the line. Thus, I produced \begin{center} GNOMES and GNUS \\*[5pt] {\scriptsize and} \\[-4pt] {\scriptsize gnats} \\* by D.\ Knudson \end{center} by typing \begin{verbatim} \begin{center} GNOMES and GNUS \\*[5pt] {\scriptsize and} \\[-4pt] {\scriptsize gnats} \\* by D.\ Knudson \end{center} \end{verbatim} I allowed a page break only between the {\scriptsize and} and the {\scriptsize gnats}. You normally do your own line breaking with the \xsp\verb"\\"\xsp{} command in the following environments: \[\begin{tabular}{l@{\s{.4in}}l@{\s{.4in}}l} \tt array\index{array environment} & \tt verse\index{verse environment} & \tt flushleft\index{flushleft environment} \\ \tt tabular\index{tabular environment} & \tt center\index{center environment} & \tt flushright\index{flushright environment} \\ \tt tabbing\index{tabbing environment} \end{tabular} \] You also use \xsp\verb"\\"\xsp{} in the \verb"\shortstack"\index{!shortstack} command, described in Section~\ref{pictures} and in the scope of a \hbox{\verb"\centering"}\index{!centering}, \hbox{\verb"\raggedright"}\index{!raggedright}, or \hbox{\verb"\raggedleft"}\index{!raggedleft} command. The {\tt *}-option is redundant in the \hbox{\tt array} and \hbox{\tt tabular} environments and in the \hbox{\verb"\shortstack"} command, since \TEX{} can never start a new page in the middle of them. You can also use a \xsp{}\verb"\\"\xsp{} command whenever you're in \\*[.1in] paragraph\index{paragraph mode} mode as I just did by typing \begin{verbatim} you're in \\*[.1in] paragraph mode \end{verbatim} \yspace \noindent {\bf Warning:} The amount of vertical space added by a \xsp{}\verb"\\[...]"\xsp{} command may not be what you expect---especially in the {\tt array}\index{array environment, !![...] command in} and {\tt tabular}\index{tabular environment, !![...] command in} environments. When this happens, you can find the right argument for the \xsp{}\verb"\\"\xsp{} command by experimentation. \yspace Some people don't like typing \xsp{}\verb"\\"\xsp{} after every line in an environment like {\tt center}, and would rather let \LATEX{} start a new line at every \carrtn{} in the input. This is a thoroughly bad idea, and you should forget all about it. However, if you're so foolish as to ignore my warnings, \LATEX{} does provide a way for you to do this. The declaration \verb"\obeycr"\index{!obeycr@} makes a \carrtn{}\index{!!carrtn, making it a !!} synonymous with a \xsp{}\verb"\\"\xsp{} command. The example that began this section could also have been produced by typing \begin{verbatim} \begin{center} \obeycr GNOMES and GNUS *[5pt]{\scriptsize and} [-4pt]{\scriptsize gnats} *by D.\ Knudson \end{center} \end{verbatim} There are two things to note here: \begin{itemize} \item The \verb"\obeycr" makes \carrtn{} completely synonymous with \xsp{}\verb"\\"\Xsp, right down to the {\tt *}-form and optional argument. \item A \carrtn{} immediately following the \verb"\obeycr" command is ignored. This is the only \carrtn{} that is ignored in the scope of the \verb"\obeycr" declaration. However, everything following a \xsp{}\verb"%"\xsp{} up to and including the \carrtn{} at the end of the line is still considered a comment and is ignored. \end{itemize} The declaration \verb"\restorecr"\index{!restorecr@} is the inverse of \verb"\obeycr", restoring \carrtn{} to its normal status as a space-producing character. You can use \verb"\obeycr" and get away with it most of the time. However, changing the meaning of \carrtn{} this way is a tricky business, and sooner or later you'll run into trouble. The \verb"\obeycr" command is the only \LATEX{} command that comes with no guarantee of satisfaction. If funny things happen when you use it, don't complain to me. \subsection{Line Breaking}\label{line-breaking} \index{line breaking} \TEX{} is a perfectionist when it comes to line breaking. 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 an ``\verb"Overfull \hbox"'' \index{overfull !hbox} message, like \begin{footnotesize} \begin{verbatim} Overfull \hbox (1.94412pt too wide) in paragraph at lines 7--9 []\tenrm Is there a lit-tle town in Wales called Llegharffys-lough-lar-waghau-r llysgn- \hbox(6.94444+ ... \end{verbatim} \end{footnotesize} \noindent which you saw on page~\pageref{running-ex} in Section~\ref{running-ex}, when we ran \LATEX{} on the input shown in Figure~\ref{fig:rn}. If you were to look closely at the output, you'd find the following line \begin{quote} \makebox[0pt][l]{\footnotesize Is there a little town in Wales called Llegharffysloughlarwaghaurllysgn-} \end{quote} sticking 1.94412 points beyond the right margin. In some document styles, there'd also be a black bar like this \xsp{}\rule{5pt}{8.5pt}\xsp{} next to it. The hyphens \index{hyphens} in the warning message tell us where \TEX{} was willing to hyphenate \index{hyphenation} words in its attempt to find a good place for a line break. \TEX{} is very good at hyphenating, and it will usually find all correct hyphenation points. However, here we obviously have an exceptional case. Despite a valiant try using its built-in hyphenation rules, \TEX{} couldn't find enough hyphenation points in \begin{verbatim} Llegharffysloughlarwaghaurllysgnforghallyl \end{verbatim} to break the line properly. The simplest way around this problem is to give \TEX{} permission to hyphenate the word at another place. This is done with a \xsp{}\verb"\-"\index{!-@}\xsp{} command, which tells \TEX{} that it may hyphenate the word at that point. We could solve this line-breaking problem by changing our input to \begin{verbatim} Llegharffysloughlarwaghaurlly\-sgnforghallyl \end{verbatim} which will provide \TEX{} with the necessary extra hyphenation point. However, we should really put a \xsp{}\verb"\-"\xsp{} everywhere \TEX{} is allowed to hyphenate this word, since we might later change the input in such a way that it will have to break the word at another point. It doesn't hurt to put in lots of \xsp{}\verb"\-"\xsp{} commands, since they only permit \TEX{} to hyphenate, they don't force it to. You can teach \TEX{} to hyphenate individual words properly so you don't have to keep typing \xsp{}\verb"\-"\xsp{} commands. For example, \TEX{} doesn't know how to hyphenate the word {\it gnomon}. You could type \verb"gno\-mon" all the time, but that's a nuisance if you use lots of {\it gnomons} in your text. Instead, you can put the following command before the \hbox{\verb"\begin{document}"}:\index{!hyphenation@} \begin{verbatim} \hyphenation{gno-mon gno-mons gno-mon-ic} \end{verbatim} This will tell \TEX{} how to hyphenate {\it gnomon}, {\it gnomons} and {\it gnomonic}, but \TEX{} still won't know how to hyphenate {\it gnomonly} (which isn't a gnomonly used word). You can use many separate \hbox{\verb"\hyphenation"} commands. \yspace Since \TEX{} is really quite good at hyphenation, most of the time a bad line break can't be fixed in this way. If this happens, 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. If adding hyphens doesn't help, it means there's simply 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. There are two common methods of getting \TEX{} to break lines where it normally doesn't want to. The easiest way is to tell \TEX{} not to be so fussy, which you can do with the \verb"\sloppy"\index{!sloppy@} command. This declaration tells \TEX{} to accept less pleasing line breaks---ones that allow the distance between words to stretch or shrink more. There is also the countermanding declaration \verb"\fussy"\index{!fussy@} that restores \TEX{} to its ordinary fussy self. These declarations obey the standard scoping rules described on \linebreak[3] page~\pageref{decls} of Section~\ref{decls}. \TEX{} does its line breaking when it comes to the first blank line at the end of the paragraph. Therefore, to affect the line breaking of a paragraph, the scope of the \verb"\sloppy" command must include that blank line. The second way of fixing a bad line break is to use a \verb"\linebreak"\index{!linebreak@} command to tell \TEX{} exactly where the break should occur. The \verb"\linebreak" should be inserted right before the word that didn't fit. However, this will produce a line with a lot of blank space between the words, and may produce an ``\verb"Underfull \hbox"''\index{Underfull !hbox message} message. By giving an optional argument to the \verb"\linebreak" command, you convert it from a demand that \TEX{} break the line there to a request that it do so. The optional argument must be a digit from {\tt 0} through {\tt 4}. The higher the number, the more insistent the request is. A \verb"\linebreak[0]" command simply allows \TEX{} to break the line there, but doesn't say that it's a good or bad thing to do. A \verb"\linebreak[4]" command is equivalent to a plain \verb"\linebreak"; it says that the line must be broken there. The arguments {\tt 1}, {\tt 2} and {\tt 3} provide intermediate degrees of insistence. They will occasionally coax \TEX{} into overcoming a bad line break, but not very often. They are mostly good for giving it a hint about how to do the most aesthetically pleasing job of line breaking. The \verb"\linebreak[0]" command is useful for allowing \TEX{} to break a line where it normally wouldn't. \yspace Usually, the problem is coaxing \TEX{} to break a line where you want it to. However, sometimes you'll find the reverse problem of trying \index{line breaking, preventing} to prevent it from breaking a line. This is done with the \verb"\nolinebreak"\index{!nolinebreak@} command, which prevents \TEX{} from breaking the line at that point. As with the \hbox{\verb"\linebreak"} command, \hbox{\verb"\nolinebreak"} takes a digit from {\tt 0} through {\tt 4} as an optional argument, which converts the demand into a suggestion that this isn't such a good place to break the line---the higher the number, the more insistent the suggestion. A \hbox{\verb"\nolinebreak[0]"} is equivalent to a \hbox{\verb"\linebreak[0]"}, and a \hbox{\verb"\nolinebreak[4]"} is equivalent to a \verb"\nolinebreak". \yspace The \verb"\linebreak" command causes \TEX{} to stretch the line so it extends to the right margin. The \verb"\newline"\index{!newline@} command breaks the line \newline right where it is, as I just did by typing \begin{verbatim} ... the line \newline right where ... \end{verbatim} Like the \verb"\linebreak" command, the \verb"\newline" command can be used only in paragraph mode. It is equivalent to the \verb"\\" command described in Section~\ref{cr}, but has no {\tt *}-form or optional argument. \LATEX{} provides the \verb"\newline" command only to maintain a complete correspondence between the line-breaking commands of this section and the page-breaking commands of Section~\ref{page-breaking} below. \subsection{Page Breaking}\index{page breaking}\label{page-breaking} \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{footnotesize} \begin{verbatim} Underfull \vbox (badness 1137) has occurred while \output is active \end{verbatim} \end{footnotesize} \noindent To figure out on what page this happened, remember that \TEX{} prints output page numbers on your terminal as it goes along. \TEX{} prints {\tt [27]} when it writes page 27 onto the {\tt dvi}\index{dvi file} file. The number of the bad page is the next page number appears on your terminal after the warning message. When you get an ``\hbox{\tt Underfull \bs vbox}'' message, you should first look at the ``badness''\index{badness} value. If it's less than 10000, then \TEX{} has probably done a reasonable job of page breaking and you'll want to do something about it only if you're very very fussy and are producing the last, final, ultimate, irrevocable version. \TEX{} has probably done a pretty good job even if the badness is 10000, but in this case you should look at the page to check. \TEX's criteria for good page breaking are purely visual; it has no idea what you're trying to tell the reader. A page break that it finds quite all right may be terrible because it derails the reader's train of thought. If this happens, you'll have to take matters into your own hands and tell \TEX{} where to break the page; but remember, don't do this until you're ready to produce the final version. The page-breaking commands are analogous to the line-breaking commands described in Section~\ref{line-breaking} above, so you should read that section before going any further. As with line breaking, \LATEX{} provides commands both to cajole and to order \TEX{} to break a page where you want it to. The \hbox{\verb"\pagebreak"}\index{!pagebreak@} and \hbox{\verb"\nopagebreak"}\index{!nopagebreak@} commands are the analogues of \hbox{\verb"\linebreak"}\index{!linebreak} and \hbox{\verb"\nolinebreak"}\index{!nolinebreak}. When used in the middle of a paragraph, they apply right after the line on which they appear. Thus, a \hbox{\verb"\pagebreak"} command insists that \TEX{} start a new page right after the current line, and \hbox{\verb"\nopagebreak[3]"} suggests rather strongly that it should {\it not\/} start a new page there. The \verb"\newpage"\index{!newpage@} command is the analogue of the \hbox{\verb"\newline"}\index{!newline} command. While \hbox{\verb"\pagebreak"} causes the page to be stretched right to the bottom margin, \linebreak %%%%%% \hbox{\verb"\newpage"} ends it right where it is. There's also a \hbox{\verb"\clearpage"}\index{!clearpage@} command that is similar to \hbox{\verb"\newpage"}. The difference is that if there are any figures\index{figures} or tables\index{tables} waiting to be put onto the next page, \hbox{\verb"\clearpage"} will put them on one or more separate float \index{float pages} pages with no text. In the \hbox{\tt report} \index{report document style} document style, the \hbox{\verb"\chapter"}\index{!chapter} command uses \hbox{\verb"\clearpage"} to begin a new page. An extra \verb"\newpage" or \verb"\clearpage" command won't create a blank page; two such commands in a row 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. This may seem like a nuisance, but it's actually very convenient to have the \hbox{\verb"\newpage"} and \hbox{\verb"\clearpage"} commands work this way. These commands are called by others like \hbox{\verb"\chapter"}, and you don't want two of those other commands in a row to generate a unwanted blank page. When producing output for printing on both sides of a page, \index{two-sided printing} you will sometimes want to start a chapter or section on a right-hand page. The \linebreak %%%% \hbox{\hbox{\verb"\cleardoublepage"}}\index{!cleardoublepage@} command is the same as \hbox{\verb"\clearpage"} except that it produces a blank page if necessary so that the next page will be a right-hand (odd-numbered) page. \section{Formatting it Yourself} \label{tab-tab} We now come to a number of environments that allow you to control precisely how things are formatted. The first two, the {\tt tabbing\index{tabbing environment}} and {\tt tabular\index{tabular environment}} environments, are used to align text in columns. The {\tt tabular} environment is similar to the {\tt array} \index{array environment} environment described in Section~\ref{array}, except that it is for ordinary text rather than mathematical formulas. The {\tt tabbing} and {\tt tabular} environments differ in the following ways. \begin{itemize} \item The {\tt tabbing} environment can be used only in paragraph mode, and makes a separate paragraph---just like the environments described in Section~\ref{paragraph-making}. The {\tt tabular} environment makes a box, and can be used in any mode. \item \TEX{} can start a new page in the middle of a {\tt tabbing} environment, but not in the middle of a {\tt tabular} environment. This means that a long {\tt tabbing} environment can go in the middle of your text, but a long {\tt tabular} environment should be put in a figure\index{figures} or table\index{table} where it can float to another page. (See Section~\ref{figures}.) \item \TEX{} automatically determines the widths of the columns in the {\tt tabular} environment; you have to do that yourself in the {\tt tabbing} environment. \item It's easy to change the formatting in the middle of a {\tt tabbing} en\-vi\-ron\-ment---for example, to change the number of columns, but hard to do in the {\tt tabular} environment. \end{itemize} The {\tt tabbing} and {\tt tabular} environments allow you to specify the horizontal positioning in order to make neat columns. The {\tt picture\index{picture environment}} environment allows you to specify the precise horizontal and vertical positioning of every item, and to draw lines, arrows and circles. Its primary use is for drawing diagrams, but it can be used as a last resort to solve any formatting problem. The {\tt list} \index{list environment} environment allows you to produce the kind of paragraph-making environments described in Section~\ref{paragraph-making}, except exactly the way you want them. The {\tt verbatim\index{verbatim environment}} environment is used mainly for writing instruction manuals for computer users, in which you want to show the reader what he or the computer types on his terminal. It reproduces as closely as possible exactly what you type on your terminal, and is the one environment in which \TEX's ten special \index{special characters} characters act just like ordinary characters. \subsection{The {\tt tabbing} Environment} \label{tabbing} \index{tabbing environment@} \LATEX's {\tt tabbing} environment provides a way to format programs and other material in which text must be aligned in columns. It works by setting tab stops and tabbing to them much the way you do with an ordinary typewriter. To give a precise description of the {\tt tabbing} environment commands, I'll start by defining some terminology. 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. The prevailing left margin is the ordinary left margin unless you're in the middle of some paragraph-making environment like {\tt itemize} that changes the left margin. \begin{itemize} \item A {\tt tabbing} environment inside this {\tt itemize} environment might have the following tab stops and columns.\\[\parsep] {\setlength{\unitlength}{\linewidth}\small \begin{picture}(1,.16) \put(0,0){\line(0,1){.1}} \put(.3,0){\line(0,1){.1}} \put(.75,0){\line(0,1){.1}} \put(1,0){\line(0,1){.1}} \put(0,0){\makebox(.3,.1){column 1}} \put(.3,0){\makebox(.45,.1){column 2}} \put(.75,0){\makebox(.25,.1){column 3}} \put(0,.105){\makebox(0,.05){\shortstack{\it tab stop\\[-2pt]\it 0}}} \put(.3,.105){\makebox(0,.05){\shortstack{\it tab stop\\[-2pt]\it 1}}} \put(.75,.105){\makebox(0,.05){\shortstack{\it tab stop\\[-2pt]\it 2}}} \end{picture}} \end{itemize} The vertical lines don't actually appear, they are drawn here and in the remaining examples to make it easy to see the columns. Each line has a {\it local left margin}, which is set at a tab stop. Text in a line normally begins at the local left margin, so if the local 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 local 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. \newcommand{\tabrule}[1]{\makebox[0pt]{\raisebox {0pt}[0pt]{\rule{\fboxrule}{#1\baselineskip}}}} Let's suppose that we've set tab stops 1 through 5, so there are six columns (columns 1 though 6), and the local left margin is currently set at tab stop~2, as shown below. \begin{tabbing} gnomon \= agnostic \= arma\= dillo \= gnash \= \kill \makebox[0pt]{\it 0} \> \makebox[0pt]{\it 1} \> \makebox[0pt]{\bf 2} \> \makebox[0pt]{\it 3} \> \makebox[0pt]{\it 4} \> \makebox[0pt]{\it 5}\\* \rule{0pt}{1.5\baselineskip}\tabrule{1.5} \> \tabrule{1.5} \> \hspace{-.5\fboxrule}\tabrule{1.5}\hspace{.9\fboxrule}\tabrule{1.5} \> \tabrule{1.5} \> \tabrule{1.5} \> \tabrule{1.5} \` \tabrule{1.5} \end{tabbing} 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 \xsp{}\verb"\>"\index{!>@}\xsp{} (pronounced ``tab''\index{tab}), the subsequent text will begin at tab stop~3---that is, at the beginning of column~4. Another \xsp{}\verb"\>"\xsp{} command takes us to tab stop~4, which is the beginning of column~5, and so on. The line is ended by the \xsp{}\verb"\\"\index{!!}\xsp{} command, which is described, along with its optional argument and {\tt *}-form, in Section~\ref{cr} on page~\pageref{cr}. Thus, typing \begin{verbatim} gnu \> gneisses \> \> gnarl \\ u \> e \> g \end{verbatim} produces the following two lines in the {\tt tabbing} environment. \begin{tabbing} gnomon \= agnostic \= arma\= dillo \= gnash \= \kill \label{tab-ex} \> \> gnu \> gneisses \> \> gnarl \\* \tabrule{2} \>\tabrule{2} \> \tabrule{2}u \> \tabrule{2}e \> \tabrule{2}g \>\tabrule{2} \`\tabrule{2} \end{tabbing} Again, remember that the vertical lines are only for clarity; they are not produced by the {\tt tabbing} command. Although I aligned the input to make it easier to read, \TEX{} paid no attention. As usual, it doesn't matter whether you type one space or fifty. If you put more text in a column than will fit, then the next \xsp{}\verb"\>"\xsp{} command may move the current position to the left in order to put it at the next tab stop. For example, the first \xsp{}\verb"\>"\xsp{} command after \hbox{\tt gneisses} in the above example moved took us to tab stop~4 (about where the second \xsp{}{\tt s}\xsp{} began, and the next \xsp{}\verb"\>"\xsp{} took us to tab stop~5. This is not the way the tab key on a typewriter works; you can overwrite text with a \verb"\>" command. The left margin of the next and all following lines is moved one tab stop to the right by the command \xsp{}\verb"\+"\index{!+@}\Xsp, and is moved one tab stop to the left by the command \xsp{}\verb"\-"\index{!-@}\Xsp. Tab stops are set using the \xsp{}\verb"\="\index{!=@}\xsp{} command. The easiest way to think of this command is that it is the same as \xsp{}\verb"\>"\xsp{} except the appropriate tab stop is set so that the \xsp{}\verb"\>"\xsp{} 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{verbatim} \begin{tabbing} gnomon \= agnostic \= arma\= dillo \= gnash \= \+\+ \\ gnu \> gneisses \> \> gnarl \\ u \> e \> g \end{tabbing} \end{verbatim} produces the following. \begin{tabbing} gnomon \= agnostic \= arma\= dillo \= gnash \= \\* \> \> gnu \> gneisses \> \> gnarl \\* \tabrule{3} \>\tabrule{3} \> \tabrule{3}u \> \tabrule{3}e \> \tabrule{3}g \>\tabrule{3} \`\tabrule{3} \end{tabbing} Note the effect of spaces in this example. Commands like \xsp{}\verb"\="\xsp{} and \xsp{}\verb"\>"\xsp{} ``gobble up'' spaces---that is, \xsp{}\verb*" "\index{spaces, in tabbing environment}\xsp{} and \xsp{}\carrtn{}\index{carriage return, in tabbing environment}\xsp{} characters---that follow them, but spaces that precede them do count. You should not put blank \index{blank lines} lines in a {\tt tabbing} environment. When using the {\tt tabbing} environment, you'll often find that you want to set tab stops without producing text. This is done with the command \index{!kill}\verb"\kill", which is just like \xsp{}\verb"\\"\xsp{} except that it throws away the current line instead of producing output for it. The effect of any \xsp{}\verb"\="\xsp{}, \xsp{}\verb"\+"\xsp{} or \xsp{}\verb"\-"\xsp{} in that line remains. Thus, replacing the first \xsp{}\verb"\\"\xsp{} in the above example by \verb"\kill" produces the output of the preceding example on page~\ref{tab-ex}. Unlike \xsp{}\verb"\\"\Xsp, the \verb"\kill" command has no optional argument or {\tt *}-form. The \xsp{}\verb"\<"\index{!<}\xsp{} command allows you to put something to the left of the local left margin without changing the margin---that is, without having to use \xsp{}\verb"\+"\xsp{} and \xsp{}\verb"\-"\xsp{} commands. A \xsp{}\verb"\<"\xsp{} command 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 \xsp{}\verb"\<"\xsp{} 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 get text flushed \index{flushing, in a tabbing environment} left at the beginning of a column. However, you may want text flushed right at the end of a column. This can be done with the \xsp{}\verb"\'"\index{!'@}\xsp{} command. This command moves everything that you have typed so far in the current column---everything starting from the most recent \xsp{}\verb"\>"\Xsp, \xsp{}\verb"\<"\Xsp, \xsp{}\verb"\'"\Xsp, \xsp{}\verb"\\"\Xsp, or \verb"\kill" command---to the right of the previous column, flush against the current column's tab stop. The command leaves you positioned once again at the beginning of the current column. To see how it works, let's once again assume that the current left margin is at tab stop~2. Typing \begin{verbatim} a \> b \>c \> d \\ dillo:\' a \> \> ma\' c \end{verbatim} produces the following. \begin{tabbing} gnomon \= agnostic \= arma\= dillo \= gnash \= \kill \> \> a \> b \> c \> d \\* \tabrule{2} \> \tabrule{2} \> dillo:\' \tabrule{2}a \>\tabrule{2} \> ma\' \tabrule{2}c \> \tabrule{2} \`\tabrule{2} \end{tabbing} The \xsp{}\verb"\'"\xsp{} command doesn't push the text right up against the tab stop, but leaves some space between the text and the tab stop. The space left by the \verb"\'" to the right of the text is the value of the length command \verb"\tabbingsep"\index{!tabbingsep}. It can be set at will with the commands of Section~\ref{length}. The \xsp{}\verb"\'"\xsp{} command allows you to put text flushed right against any tab stop, including tab stop~0. (Putting text to the left of tab stop 0 may cause it to extend into the page margin.) However, it can't move text to the right of the last column because there's no tab stop there. The \xsp{}\verb"\`"\index{!`@}\xsp{} command moves all the the text that follows it, up to the \xsp{}\verb"\\"\xsp{} or \verb"\end{tabbing}" command that ends the line, to the right margin of the \hbox{\tt tabbing} environment. There must be no \xsp{}\verb"\>"\xsp{} or \xsp{}\verb"\'"\xsp{} command between the \xsp{}\verb"\`"\xsp{} and the command that ends the line. Remember that \xsp{}\verb"\'"\xsp{} moves text to the left and \xsp{}\verb"\`"\xsp{} moves text to the right. These commands make it easy to put text at the left or right of any column. Getting text \index{centered}centered in a column isn't as easy, but it can be done using the box-making and length commands of Sections \ref{lr-boxes} and \ref{length}. However, centering text in a column is quite simple with the {\tt tabular} environment, so perhaps that's what you should be using if you need centered columns. 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 \verb"\pushtabs"\index{!pushtabs} command, all the tab stop settings you then make disappear when you type \verb"\poptabs"\index{!poptabs}, reverting to their previous settings. You can nest \verb"\pushtabs" and \verb"\poptabs" commands in the obvious way. However, every \verb"\pushtab" in the \hbox{\tt tabbing} environment must have a corresponding \verb"\poptab". \yspace \noindent {\bf Warning} Each column entry in a {\tt tabbing} environment is a separate LR \index{LR box} box. This means that \TEX{} is in LR \index{LR mode} mode when it is processing each entry. Declarations in a \hbox{\tt tabbing} environment are local to the entry in which they appear. More precisely, the scope of any declaration extends only up to the next tabbing command, where the tabbing \index{tabbing commands} commands are the following: \begin{verbatim} \> \< \= \+ \- \\ \kill \' \` \pushtabs \poptabs \end{tabbing} \end{verbatim} Since each column entry is a separate LR box, any environment begun in one entry must be ended in the same column. Thus, no environment can contain any of the above tabbing commands unless it contains the entire \hbox{\tt tabbing} environment. \yspace \noindent {\bf Warning:} In Section~\ref{accents} on page~\pageref{accents}, you learned that the commands \xsp{}\verb"\`"\index{!`,alternate definitions}\Xsp, \xsp{}\verb"\'"\index{!',alternate definitions}\xsp{} and \xsp{}\verb"\="\index{!=,alternate definitions}\xsp{} are used for producing accents. However, when inside a {\tt tabbing} environment, they are the tabbing commands described in this section. This means that they can't be used to produce accents in a {\tt tabbing} environment. This will seldom be a problem. However, if you need to put ``Sous\'e'' in a {\tt tabbing} environment, you use a \verb"\savebox"\index{!savebox} command outside the environment to save the ``Sous\'e'', and put a \verb"\usebox"\index{!usebox} where you want it to go. (The \hbox{\verb"\savebox"} and \hbox{\verb"\usebox"} commands are described in Section~\ref{lr-boxes}.) Outside the {\tt tabbing} environment, the \xsp{}\verb"\-"\index{!-}\xsp{} command affects \TEX's line-breaking algorithm, as described in Section~\ref{line-breaking}. The only time \TEX{} will be breaking lines for you inside a \hbox{\tt tabbing} environment is in a parbox\index{parbox}, and \xsp{}\verb"\-"\Xsp, \xsp{}\verb"\'"\Xsp, \xsp{}\verb"\`"\Xsp, and \xsp{}\verb"\="\xsp{} have their ordinary paragraph-mode meanings inside a parbox. \subsection{The {\tt tabular} and {\tt array} Environments} \index{tabular environment@} \index{array environment} \label{tabular} The {\tt tabular} and {\tt array} environments are almost identical, so most of Section~\ref{array} applies to both of them. You should turn to page~\pageref{array} and read that section if you haven't already done so. You should also read about the \xsp{}\verb"\\"\xsp{} command in Section~\ref{cr} on page~\pageref{cr}. The following are the only differences between the {\tt tabular} and {\tt array} environments. \begin{itemize} \item The {\tt tabular} environment can be used in any mode, the {\tt array} environment can be used only in math mode. \item \TEX{} is in LR mode when processing the entries of a {\tt tabular} environment, and in math mode when processing the entries of an {\tt array} environment. \item \TEX{} is in LR mode when processing an {\tt @}-expression\index{@-expression} of a {\tt tabular} environment, but in math mode when processing an {\tt @}-expression of an {\tt array} environment. \end{itemize} In practice, these differences mean that you should use an {\tt array} environment only for mathematical formulas, and otherwise use the {\tt tabular} environment. Both environments produce a box. In Section~\ref{array}, you learned about the following items in an {\tt array} or {\tt tabular} environment's argument: \begin{verbatim} r l c @{ ... } \end{verbatim} (Don't forget the restrictions on what can go into an {\tt @}-expression.) There are three more things that can go into the argument. A \xsp{}\verb"|"\index{|, in array or tabular argument}\xsp{} produces a vertical line between columns. You can put as many \verb"|"'s in a row as you want---for example, writing \xsp{}\verb"|||"\xsp{} puts three vertical \index{vertical lines, in tabular or array environment}lines between columns. A {\tt *}-expression\index{*-expression, in array or tabular argument} allows you to repeat a portion of an argument an indicated number of times. Writing \begin{verbatim} *{7}{r|l|} \end{verbatim} is equivalent to writing \begin{verbatim} r|l|r|l|r|l|r|l|r|l|r|l|r|l| \end{verbatim} which is seven copies of \xsp{}\verb"r|l|"\xsp{}. You can nest one {\tt *}-expression inside another in the obvious way. You may want a single entry in a {\tt tabular} environment to have several rows of text. You can do this by placing a \verb"\parbox"\index{!parbox} command in the entry. (See Section~\ref{parbox} on page~\pageref{parbox} for an explanation of parboxes.) However, you can let every entry in \index{parbox in tabular environment} a column be a parbox by using a {\tt p}-expression\index{p-expression} in the environment argument. For example, the input \begin{verbatim} \begin{tabular}{lp{1in}} First Item: & This is a rather tiny parbox \\[.1in] Second Item: & This is another tiny parbox \end{tabular} \] \end{verbatim} produces the following \[ \begin{tabular}{lp{1in}} First Item: & This is a rather tiny par\-box \\[.1in] Second Item: & This is another tiny par\-box \end{tabular} \] Note that the ``argument'' of the {\tt p}-expression is the width of the parbox. You can use a {\tt p}-expression in an {\tt array} as well as a {\tt tabular} environment, but you'd rarely do so. Also, recall what I said in Section~\ref{cr} about the amount of space left by a \verb"\\[...]" command and note how much space the \verb"\\[.1in]" actually produced. \yspace \noindent {\bf Warning:} In a parbox created by an ordinary \verb"\parbox" command, \xsp{}\verb"\\"\xsp{} has its normal meaning of ``start a new paragraph in the parbox''. This is not true of the parbox created by a {\tt p}-expression, where \xsp{}\verb"\\"\xsp{} has the meaning of ``start a new line in the {\tt tabular} or {\tt array} environment''. \yspace A \xsp{}\verb"|"\xsp{} in the environment's argument puts a vertical line through the entire environment. Sometimes you may want to put a vertical line in just a single entry. This is done with the \verb"\vline"\index{!vline@} command. An \verb"\hline"\index{!hline@} command puts a horizontal \index{horizontal lines, in tabular or array environment} line across all columns of a {\tt tabular} or {\tt array} environment. This command can appear only right after a \xsp{}\verb"\\"\xsp{} command or right after the environment's \verb"\begin" command. You can make an entry that spans several columns with a \verb"\multicolumn"\index{!multicolumn} command. The command \begin{verbatim} \multicolumn{3}{|c|}{wide entry} \end{verbatim} creates an entry, with the text ``{\tt wide entry}'', that spans three columns. This three-column entry is formatted according to the specifier \xsp{}\verb"|c|"\Xsp, so the {\tt wide entry} is centered in it and there are vertical lines on either side of the three-column space. The second argument of a \verb"\multicolumn" command may contain anything that can appear in a {\tt tabular} environment's format, except that there may be at most one {\tt c}, {\tt l} or {\tt r}. (If there is none, then the third argument is ignored.) This argument replaces the items for the corresponding columns from the {\tt tabular} or {\tt array} environment's argument, which may include \xsp{}\verb"|"\xsp{} items and {\tt @}-expressions. (We don't have to worry about {\tt *}-expressions because they're expanded into the requisite number of copies of their argument.) This raises the following question: to what column does a {\tt |} or an {\tt @}-expression in the environment's argument 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 {\tt tabular} environment argument \xsp{}\verb"|c|l@{ : }lr|"\xsp{} comprises the four columns \xsp{}{\tt |c|}\xsp{}, \xsp{}\verb"l@{ : }"\Xsp, \xsp{}{\tt l}\Xsp, and \xsp{}{\tt r|}\Xsp. (Of course, the first column may also begin with a {\tt c}, {\tt l} or {\tt r}.) A \verb"\multicolumn" command to span a single column serves to override the normal entry positioning for that column. The command \begin{verbatim} \multicolumn{1}{c}{entry} \end{verbatim} causes the single-column entry to be centered in its column, regardless of what positioning the environment's argument specifies for that column. Most of these features are illustrated in the grand example of Figure~\ref{fig:tabular}, \begin{figure} \centering \begin{tabular}{||r|c|r||} \hline \multicolumn{3}{||c||}{AT\&T Common Stock} \\ \hline \multicolumn{1}{||c|}{Year} & Price & \multicolumn{1}{c||}{Dividend} \\ \hline 1973 & 46-51 & \$2.87 \\ \hline 4 & 40-53 & 3.24 \\ \hline 5 & 45-52 & \parbox[t]{.25in}{\raggedright Gr: \\ 3.40} \vline{} \parbox[t]{.25in}{\raggedright Nt: \\ 1.73} \\ \hline 6 & 51-59 & .95\makebox[0pt][l]{$^{a}$}\\ \hline \multicolumn{3}{l}{$^{a}$(first quarter only)} \end{tabular} \caption{A grand example.} \label{fig:tabular} \end{figure} which was produced by the input shown in Figure~\ref{fig:tabin}. \begin{figure} \begin{verbatim} \begin{tabular}{||r|c|r||} \hline \multicolumn{3}{||c||}{AT\&T Common Stock} \\ \hline \multicolumn{1}{||c|}{Year} & Price & \multicolumn{1}{c||}{Dividend} \\ \hline 1973 & 46-51 & \$2.87 \\ \hline 4 & 40-53 & 3.24 \\ \hline 5 & 45-52 & \parbox[t]{.25in}{\raggedright Gr: \\ 3.40} \vline{} \parbox[t]{.25in}{\raggedright Nt: \\ 1.73} \\ \hline 6 & 51-59 & .95\makebox[0pt][l]{$^{a}$}\\ \hline \multicolumn{3}{l}{$^{a}$(first quarter only)} \end{tabular} \end{verbatim} \caption{Input for a Grand Example.} \label{fig:tabin} \end{figure} (See Section~\ref{math} for an explanation of the \xsp{}\verb"$"\xsp{} and \xsp{}\verb"^"\Xsp, Section~\ref{lr-boxes} for the \verb"\makebox" command, and Section~\ref{parbox} for the \verb"\parbox" command.) There should be some more space at the bottom of the ``Gr:'' and ``Nt:'' subcolumns. It can be added by putting a strut at the end of one of the \verb"\parbox" arguments. (See page~\pageref{strut} for an explanation of struts.) When making a complex table like this, you'll usually have to add some final touches like that to get it just right. \yspace \noindent {\bf Warning:} Each entry in a {\tt tabular} or {\tt array} environment is a separate box. Declarations are local to the entry in which they appear. More precisely, the scope of any declaration extends only up to the next \xsp{}\verb"&"\xsp{} or \xsp{}\verb"\\"\Xsp. No environment can contain either of these commands unless it contains the entire \hbox{\tt tabular} or \hbox{\tt array} environment. \subsection{The {\tt picture} Environment} \index{pictures}\index{picture environment}\label{pictures} The {\tt picture} environment allows you to create just about any kind of picture you want containing text, lines, arrows and circles. 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 length in multiples of the unit length \verb"\unitlength"\index{!unitlength}, so if \verb"\unitlength" has been set to {\tt 1cm}, then the coordinate {\tt 2.54} specifies a length of 2.54 centimeters. You can change the value of \verb"\unitlength" anywhere you want, using the commands of Section~\ref{length} on page~\pageref{length}, but strange things will happen if you try changing it inside the {\tt picture} environment. 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 normally at the lower-left corner of the picture. Note that when a position appears as an argument, it is not enclosed in braces; the parentheses serve to delimit the argument. Figure~\ref{fig:coords} \begin{figure}\centering \begin{picture}(250,150)(-100,-30) \put(-100,0){\vector(1,0){250}} \put(0,-30){\vector(0,1){130}} \put(10,-15){\vector(-1,0){10}} \put(40,-15){\vector(1,0){10}} \put(50,0){\line(0,-1){20}} \put(10,-30){\makebox(30,30){\footnotesize \shortstack{unit\\length}}} \put(155,-10){\makebox(20,20)[l]{$x$}} \put(-10,100){\makebox(20,15){$y$}} \thicklines \multiput(100,0)(0,20){4}{\line(0,1){10}} \multiput(0,70)(20,0){5}{\line(1,0){10}} \put(100,-5){\makebox(0,0)[t]{2}} \put(-5,70){\makebox(0,0)[r]{1.4}} \put(105,75){\makebox(0,0)[bl]{(2,1.4)}} \put(100,70){\circle*{4}} \multiput(-90,0)(0,20){3}{\line(0,1){10}} \multiput(0,50)(-20,0){5}{\line(-1,0){10}} \put(-90,-5){\makebox(0,0)[t]{-1.8}} \put(5,50){\makebox(0,0)[l]{1}} \put(-95,55){\makebox(0,0)[br]{(-1.8,1)}} \put(-90,50){\circle*{4}} \end{picture} \caption{Points and their coordinates.}\label{fig:coords} \end{figure} illustrates how points are located by their coordinates. The \hbox{\tt picture} environment has one mandatory argument, which is a position. It specifies the size of the picture. The environment produces a rectangular box with width and height determined by this argument's $x$- and $y$-coordinates. (Recall the discussion of boxes in Section~\ref{modes}.) The {\tt picture} environment also has an optional position argument, following the size argument, that can change the origin. (Unlike ordinary optional arguments, this argument is not contained in square brackets.) The optional argument gives the coordinates of the point at the lower-left corner of the picture (thereby determining the origin). For example, if \verb"\unitlength" has been set to {\tt 1mm}, the command \begin{verbatim} \begin{picture}(100,200)(10,20) \end{verbatim} produces a picture of width 100 millimeters and height 200 millimeters, whose lower-left corner is the point {\tt (10,20)} and whose upper-right corner is therefore the point \hbox{\tt (110,220)}. When you first draw a picture, you will omit the optional argument, leaving the origin at the lower-left corner. If you then want to modify your picture by shifting everything, you just add the appropriate optional argument. The environment's mandatory 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 \TEX{} in determining how much room to leave for it. Everything that appears in a picture is drawn by the \verb"\put"\index{!put} command. The command \begin{verbatim} \put (11.3,-.3){ ... } \end{verbatim} puts the object specified by ``{\tt ...}'' in the picture, with its {\it reference point\/} at coordinates {\tt (11.3,-.3)}. The reference points\index{reference points} for various objects will be described below. The \verb"\put" command creates an LR box, so you should review the discussion of LR boxes in Section~\ref{lr-boxes} on page~\pageref{lr-boxes}. You can put anything in the text argument of the \verb"put" command that you'd put into the argument of an \verb"\mbox" and related commands of Section~\ref{lr-boxes}. When you do this, the reference point will be the lower left corner of the box. The \verb"\makebox"\index{!makebox, in a picture} command, and the related \verb"\framebox"\index{!framebox, in a picture} and \verb"\savebox"\index{!savebox, in a picture} commands, have special forms designed for use in with pictures. The command \begin{verbatim} \makebox(20,30){ ... } \end{verbatim} forms a box 20 units (multiples of \verb"\unitlength") wide and 30 units high. As with the ordinary \hbox{\verb"\makebox"} command, there is an optional argument to specify the position of the object in the box. However, both the vertical and horizontal positions can be specified. With no argument, the object is centered vertically and horizontally. An optional argument, following the position argument, can consist of one or two of the following letters: \begin{description}{{\tt b}:} \item[{\tt t}:] Moves \index{t}the item to the top of the rectangle. \item[{\tt b}:] Moves \index{b}the item to the bottom. \item[{\tt l}:] Moves \index{l}the item to the left. \item[{\tt r}:] Moves \index{r}the item to the right. \end{description} The letters can appear in either order. When a position isn't specified, centering is assumed. Thus, \begin{verbatim} \put(25,-4.5){\makebox(10,20)[tl]{gnu}} \end{verbatim} makes a box of width 10 units and height 20 units, with ``gnu'' at the top left corner, and places that box with its lower left corner at coordinate position {\tt (25,-4.5)}. %%%%%%%%%%%%%%%%%%%% The \verb"\framebox" and \verb"\savebox" commands are analogous. This version of \verb"\framebox" command differs from the ordinary one described in Section~\ref{lr-boxes} in two respects: \begin{itemize} \item No extra \verb"\fboxsep"\index{!fboxsep} space is left between the frame and the box contents. The command \begin{verbatim} \framebox(100,30)[r]{gnu} \end{verbatim} produces something like \[ \framebox(100,30)[r]{gnu} \] \item The thickness of the lines in the frame is not determined by \verb"\fboxrule", but is equal to the width of line produced by other picture commands, as described below. \end{itemize} %%%%%%%%%%%%%%%%%%%% You can use the \verb"\savebox" command inside or outside a {\tt picture} environment; just remember that it's a declaration with normal scoping rules. It takes \LATEX{} a long time to draw a pictures, especially if they have slanted lines in them, so it's a good idea to use \verb"\savebox" commands whenever the same object appears in different pictures, or in different places within the same picture. However, a saved box also uses \TEX's valuable memory space, so you should not save pictures any longer than you need to. The space used by a saved box is reclaimed when \TEX{} leaves the scope of the \verb"\savebox" declaration. If you've saved a picture in storage bin~{\tt 7}, you can unsave it, reclaiming its space, with the command \begin{verbatim} \sbox7{} \end{verbatim} which puts an empty box in bin~{\tt 7}. There is another command in the \verb"\makebox" ``family'' that is designed only for use in a {\tt picture} environment. This is the \verb"\dashbox"\index{!dashbox@} command, which draws a dashed box like \[ \dashbox{5}(30,20)[t]{gnu} \] This was drawn with the command \begin{verbatim} \dashbox {5}(30,20)[t]{gnu} \end{verbatim} Note that it has an extra argument at the beginning, which specifies the width of each dash. This command produced a rectangle of width 30~units and height~20 units, drawn with dashed lines, where the length of each dash is 5~units. A dashed box looks best when the width and the height are both multiples of the dash length. As with any box, the reference point of the dashed box is its lower left corner, so a \verb"\put(3,-.2)" command will put that corner of the box at the point {\tt (3,-.2)}. Anything that you could normally put inside an LR box can be used as the argument for a \verb"\put" command. In addition, the following objects are designed especially for use with the \verb"\put" command. \yspace \noindent {\it Lines\/}: The way you'd probably like to draw a line is by specifying the two endpoints. That would work fine if \LATEX{} could draw a line with any arbitrary slope. Unfortunately, \LATEX{} can draw lines with a fixed, though large, choice of slopes. Specifying the endpoints of a line wouldn't work very well because, with a fixed collection of slopes, \LATEX{} can't draw a line through any two points. Therefore, \LATEX{} provides the following \verb"\line"\index{!line@} command for specifying the slope and the length of a line. You may find it a little hard getting used to this command, but it's the best one I could think of for drawing lines with \LATEX. You draw a line by writing a command of the form \begin{quote} \tt \bs put($xâ??{0}$,$yâ??{0}$)\lb\bs line($x$,$y$)\lb $len$\rb\rb \end{quote} where {\tt ($xâ??{0}$,$yâ??{0}$)} specifies the starting point, {\tt ($x$,$y$)} specifies the slope, and $len$ specifies its length, as I'll now explain. (See Figure~\ref{fig:line} \begin{figure} \setlength{\unitlength}{.8pt} \begin{picture}(350,155) \put(0,0){\vector(1,0){350}} \put(355,0){\makebox(0,0)[l]{$x$}} \put(0,0){\vector(0,1){150}} \put(0,155){\makebox(0,0)[b]{$y$}} \multiput(0,130)(20,0){4}{\line(1,0){10}} \put(-5,130){\makebox(0,0)[r]{2.6}} \multiput(70,0)(0,20){7}{\line(0,1){10}} \put(70,-5){\makebox(0,0)[t]{1.4}} \put(65,125){\makebox(0,0)[tr]{$pâ??{0}$}} \put(70,130){\circle*{4}} \put(315,55){\makebox(0,0)[bl]{$pâ??{1}$}} \put(310,50){\circle*{4}} \put(70,130){\line(0,1){15}} \put(135,140){\vector(-1,0){65}} \put(220,130){\line(0,1){15}} \put(155,140){\vector(1,0){65}} \put(145,140){\makebox(0,0){3}} \put(220,80){\line(1,0){15}} \put(220,130){\line(1,0){15}} \put(230,115){\vector(0,1){15}} \put(230,95){\vector(0,-1){15}} \put(230,105){\makebox(0,0){1}} \put(170,40){\vector(-1,0){100}} \put(210,40){\vector(1,0){100}} \put(190,40){\makebox(0,0){4.8}} \put(310,50){\line(0,-1){15}} \put(10,150){\line(3,-1){340}} \thicklines \put(70,130){\line(3,-1){240}} \multiput(70,130)(20,0){8}{\line(1,0){10}} \multiput(220,130)(0,-20){3}{\line(0,-1){10}} \end{picture} \caption{\tt \bs put (1.4,2.6)\lb \bs line(3,-1)\lb 4.8\rb\rb} \label{fig:line} \end{figure} for an example that illustrates this explanation.) Let $pâ??{0}$ be the point with coordinates $(xâ??{0}, yâ??{0})$. Starting at $pâ??{0}$, move $x$ units to the right and $y$ units up to find the point $pâ??{1}$. In other words, $pâ??{1}$ has coordinates \[ (xâ??{0}+x, yâ??{0}+y)\] Note that moving right a distance of $-2$~units means moving 2~units to the left, and similarly for a negative vertical distance. The line drawn by this command will lie along the straight line through $pâ??{0}$ and $pâ??{1}$. The line will start at $pâ??{0}$ and go in the direction of $pâ??{1}$. To determine its length, there are two cases: \begin{description}{$x\neq 0$:} \item[$x\neq 0$:] This means that the line is nonvertical. In this case, the line extends $len$ units of distance horizontally to the right or left of $pâ??{0}$ (depending upon whether $x$ is positive or negative). \item[$x = 0$:] This means that the line is vertical. In this case, the line extends $len$ units of distance above or below $pâ??{0}$ (depending upon whether $y$ is positive or negative). \end{description} Note that $len$, which must be a nonnegative number, always specifies a horizontal distance except in the case of a vertical line, in which case the horizontal distance is zero so you must specify the vertical distance. It equals the length of the line, as measured along it, only for horizontal and vertical lines. Since only a fixed number of slopes are available, there are only a limited number of values that $x$ and $y$ can assume. They must both be integers (numbers without decimal points) lying between $-6$ and $+6$. Moreover, they can't have any common divisors bigger than one. In other words, $x/y$ must be a fraction in its simplest form, so you can't have $x=2$ and $y=-4$, you must use $x=1$ and $y=-2$ instead. The following are all {\it illegal\/} arguments of a \verb"\line" command: \hbox{\tt (1.4, 3)}, \hbox{\tt (3,6)}, \hbox{\tt (0,2)}, and \hbox{\tt (1,7)}. \LATEX{} draws slanted (neither horizontal nor vertical) lines using a special typeface whose glyphs consist of small line segments. This means that there is a smallest slanted line that it can draw---its length is about 10 points, or 1/7-inch. If you try to draw a smaller slanted line, \LATEX{} will print nothing. Also, since it has to print lots of line segments to make up a line, \LATEX{} takes a long time to draw slanted line segments. This doesn't apply to horizontal or vertical lines, which can be draw to any length in essentially the same amount of time. \yspace \noindent {\it Arrows\/:} \LATEX{} provides a \verb"\vector"\index{!vector@} command for drawing \index{arrows, in a picture} arrows, which works exactly like the \verb"\line" command. In the notation used to describe the \verb"\line" command, the tail of the arrow is at point $pâ??{0}$ and the tip of the arrowhead is at $pâ??{1}$. This is true even if the arrowhead is longer than the distance from $pâ??{0}$ to $pâ??{1}$. In particular, the command \begin{verbatim} \put(10,20.5){\vector(2,3){0}} \end{verbatim} which specifies an arrow of length zero, puts an arrowhead having slope {\tt (2,3)} with its tip at the point $(10,20.5)$. \LATEX{} can't draw arrows with as many different slopes as it can lines. The $x$ and $y$ values of the \verb"\vector" command's argument must lie between $-4$ and $+4$, inclusive. Remember that, as in the \verb"\line" command, the values of $x$ and $y$ that specify the slope must have no common divisor. \yspace \noindent {\it stacks\/}: The \verb"\shortstack"\index{!shortstack@} command produces a stack of objects, just like a one-column {\tt tabular} \index{tabular environment} environment. (See Section~\ref{tabular} for a description of that environment.) In fact, the command \begin{verbatim} \shortstack {x \\ yy \\ zzz} \end{verbatim} acts pretty much like an abbreviation for \begin{verbatim} \begin{tabular}[b]{c} x \\ yy \\ zzz \end{tabular} \end{verbatim} producing \[ \shortstack{x \\ yy \\ zzz} \] If you look closely, you'll note that there's a little less space between the items than the {\tt tabular} environment produces, which makes \verb"\shortstack" better suited for use in a picture. The \verb"\shortstack" command normally centers each item horizontally in the stack. By adding an optional {\tt l}\index{l, !shortstack argument} or {\tt r}\index{r, !shortstack argument} argument, you can get them to be flushed left or right in the stack, as in \[ \shortstack[r]{x \\ yyyy \\ zzzzzzzz} \] which I produced by typing \begin{verbatim} \shortstack[r]{x \\ yyyy \\ zzzzzzzz} \end{verbatim} The \verb"\shortstack" command makes a box. As usual, the reference point of that box is its lower-left corner, so its the position of this corner that the \verb"\put" command specifies. You can use this command outside the picture environment, but you'll seldom have any need to. \yspace \noindent {\it circles\/}: \LATEX{} provides a \verb"\circle"\index{!circle@} command for drawing circles\index{circles}. The command \begin{verbatim} \put(24,35){\circle{10}} \end{verbatim} draws a circle whose {\it diameter\/} is 10 units and whose {\it center\/} is at the point {\tt (24,35)}. More precisely, its diameter will be as close to 10 units as \LATEX{} can achieve with the fixed collection of circles that it can draw. At the moment, the largest circle in its repertoire is \[ \makebox(40,40){\circle{100}} \] but there may be a larger circles available in the version of \LATEX{} that you are using. The \verb"\circle*"\index{!circle*} command draws solid circles like \makebox(10,6){\circle*{6}}. \LATEX{} can't draw solid circles as big as its larger open circles, but you'd have little need for such big solid circles. \yspace \noindent {\it Ovals and Curved Corners\/}: An oval\index{ovals} is a rectangle with rounded corners. The command\index{!oval@} \begin{verbatim} \put(100,20){\oval(50,30)} \end{verbatim} draws an oval 50~units wide and 30~units high, rounding the corners as much as possible to produce something like \[ \makebox(50,30){\oval(50,30)}\] with its center at the point (100,20). An optional argument allows you to choose any half or quarter of the oval. For example the command \begin{verbatim} \put(100,20){\oval(50,30)[tr]} \end{verbatim} produces \[ \makebox(25,15)[bl]{\oval(50,30)[tr]} \] It is positioned just as before, with the center of the oval at position (100,20). The optional argument \xsp{}{\tt bl}\xsp{} would produce the bottom-left quadrant, \xsp{}{\tt r}\xsp{} would produce the right half, \xsp{}{\tt b} the bottom half, and so on. In all cases, the reference point is the center of the complete oval. \yspace \noindent {\it Framing\/}: The \verb"\framebox" command allows you to put a frame of a fixed size around an object. However, sometimes you'd like the size of the object to determine the size of the frame. This is what the \verb"\fbox"\index{!fbox} command of Section~\ref{lr-boxes} does, but that command leaves extra space around the object that you usually don't want in a picture. \LATEX{} therefore provides the \verb"\frame"\index{!frame} command, which works very much like the \verb"\fbox" command except it doesn't leave any extra space. Thus, typing \begin{verbatim} \frame{\shortstack{a \\ b}} \end{verbatim} produces \[ \frame{\shortstack{a \\ b}} \] \yspace \LATEX{} provides two standard \index{lines, thickness in a picture} thicknesses for the lines in a picture---thin and thick. They are obtained with the declarations \hbox{\verb"\thinlines"}\index{!thinlines@} and \hbox{\verb"\thicklines"}\index{!thicklines@}, respectively. The default is the thickness specified by \hbox{\verb"\thinlines"}. \LATEX{} also allows you to choose the thickness of horizontal and vertical lines yourself with the \hbox{\verb"\linethickness"}\index{!linethickness@} command. Writing \begin{verbatim} \linethickness{.4mm} \end{verbatim} will make all horizontal and vertical lines .4mm thick. However, it will not affect the thickness of slanted lines and circles. You will therefore get strange results if you give an \verb"\oval" command after setting the line thickness with a \hbox{\verb"\linethickness"} command, since the straight lines and the rounded corners may have different thicknesses. These three commands are ordinary declarations, and can be used at any time. \yspace There's one more picture-drawing command that doesn't provide any new abilities, but does make some things a lot easier. It is used when you're putting the same object in a regular pattern across the picture. The \verb"\multiput"\index{!multiput@} command has the following form: \begin{quote} \makebox[0pt][l]{\tt \bs multiput($x$,$y$)($\Delta x$,$\Delta y$)\lb $n$\rb \lb{\it obj\/}\rb} \end{quote} It is equivalent to the $n$ commands \begin{quote} \begin{tabular}{l} \tt \bs put($x$,$y$)\lb {\it obj\/}\rb \\ \tt \bs put($x+\Delta x$,$y+\Delta y$)\lb {\it obj\/}\rb \\ \tt \bs put($x+2\Delta x$,$y+2\Delta y$)\lb {\it obj\/}\rb \\ $\ldots$ \\ \tt \bs put($x+(n-1)\Delta x$,$y+(n-1)\Delta y$)\lb {\it obj\/}\rb \\ \end{tabular} \end{quote} 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 \verb"\multiput" with $n$ greater than about 100, or \TEX{} may run out of room. \yspace That's all there is to it, so you can let your creative imagination run wild. Before you do, I will offer some advice based upon my experience. I suggest using a small unit length, like a {\tt 1pt} or {\tt 1mm}, so you seldom have to worry about decimals. You should lay out your figure on ``graph'' paper, so you know how everything fits. However, if I'm connecting things with lines or arrows, I find it best to determine the actual positions of objects by calculation rather than from the picture. For example if I draw a box with \begin{verbatim} \put(100,20){\framebox(30,15){...}} \end{verbatim} and want to draw an arrow from the middle of its right side, then a simple calculation shows that I should have \begin{verbatim} \put(130,27.5){\vector ...} \end{verbatim} This type of calculation is especially important because of the limited choice of line slopes that \LATEX{} provides. When using slanted lines, I find myself basing the positions of boxes upon where slanted lines can go. %%%%%%%%%%%%%%%%%%%% \subsection{The {\tt list} Environment}\index{list environment}\index{lists} \label{list} \LATEX{} uses a general {\tt list} environment to define most of the paragraph-making environments of Section~\ref{paragraph-making}. The {\tt list} environment produces a list of items, each of which is begun by the \verb"\item"\index{!item} command described in Section~\ref{list-making} on page~\pageref{list-making}. The {\tt list} environment has two arguments. The first specifies how items should be labeled when no argument is given to the \verb"\item" command. 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}\verb"\hfill" commands, as described in Section~\ref{spacing}. Items are numbered by using the {\tt list}\index{list counter} counter, which is incremented by every \verb"\item" command that does not have an argument. See Section~\ref{counters} on page~\pageref{counters} for an explanation of how to generate numbers from a counter. For example, writing \begin{verbatim} \begin{list}{(\alph{list})}{...} \end{verbatim} creates a list whose items are labeled (a), (b), etc. The second argument of the {\tt list} environment contains commands to \linebreak %%%%% change the spacing parameters for the list. When this argument is evaluated, the spacing parameters have been given default values. Any spacing parameters not changed by the commands in this argument will retain their default values. The spacing parameters are all length commands, which can be changed by the commands of Section~\ref{length} on page~\pageref{length}. Below is a list of these parameters. \begin{description}{{\tt\bs listparindent}:} \item[{\tt\bs topsep}:] \index{!topsep@}The extra vertical space inserted between the first list item and the preceding paragraph. If the {\tt list} environment is preceded by a blank line, then its default value is the value of \verb"\topsep" in the surrounding environment. At the outermost {\tt document} environment, \verb"\topsep" equals \verb"\parskip"\index{!parskip}, one of the parameters described in Section~\ref{parameters}. If the {\tt list} environment is not preceded by a blank line, then the default value is \hbox{\verb"\topsepcorrection"}\index{!topsepcorrection@} times the value of \verb"\topsep" of the enclosing environment. The parameter \verb"\topsepcorrection" is a number such as {\tt .75} or {\tt 1}, and can be changed by the \hbox{\verb"\renewcommand"}\index{!renewcommand} command of Section~\ref{defcom}. \item[{\tt\bs itemsep}:] The extra \index{!itemsep@}vertical space between successive list items. Its default value is the same as for \verb"\topsep". \item[{\tt\bs parsep}:] The extra \index{parsep}vertical space between paragraphs within an item. Its default value is the smaller of the following two lengths: \verb"\parsep" of the enclosing environment and the default value of \verb"\topsep". At the outermost {\tt document} environment, the value of \verb"\parsep" equals the value of \verb"\parskip".\footnote{There is actually some extra ``stretchiness'' in {\tt \bs parskip} that is not in {\tt \bs parsep}, but that shouldn't concern you.} \item[{\tt\bs 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 depends upon the nesting level of the {\tt list} environment. For an outermost list, the default value is \hbox{\verb"\leftmargini"}\index{!leftmargini}, for the next level it's \hbox{\verb"\leftmarginii"}\index{!leftmarginii}, and so on up to \hbox{\verb"\leftmarginvi"}\index{!leftmarginvi}. Lists can be nested at most six levels deep. You can change the values of \hbox{\verb"\leftmargini"} through \hbox{\verb"\leftmarginvi"} at any time, but the sensible place to do so is before the \hbox{\verb"\begin{document}"} command. Note that changing these values will affect the \hbox{\tt itemize}\index{itemize environment, changing left margin} and \hbox{\tt enumerate}\index{enumerate environment, changing left margin} environments as well. \item[{\tt\bs 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}. \item[{\tt\bs listparindent}:] The amount of \index{!listparindent@}extra indentation added to the first line of every paragraph of an item after the first. It is not added to the the first line of the item. Labeled lists usually have \verb"listparindent" equal to {\tt 0cm}, which is its default value. Note that its value may be negative. \item[{\tt \bs itemindent}:] The amount of \index{!itemindent@} extra indentation added to the beginning of each item. This indentation is added {\it before\/} the label. Its default value is {\tt 0mm}. \item[{\tt\bs 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} \item[{\tt\bs labelwidth}:] The normal \index{!labelwidth@}width of the box that contains the label. It must be nonnegative. Its default value is \verb"\leftmargin"$-$\verb"\labelsep"---in other words, just large enough so the left edge of the label box is flush with the left margin of the enclosing environment. \end{description} Note that the distance between the bottom of the list and the following text is not specified by any parameter. If there is no blank line following the \verb"\end{list}", then the vertical space below the list will be the same as the vertical space above it. If there is a blank line following the \verb"\end{list}", then the interparagraph space of the enclosing environment is used. The item's label is normally placed in a box of width \verb"\labelwidth", with its right edge a distance of \verb"\labelsep" to the left of the item's left margin. However, if the label is wider than \verb"\labelwidth", then it will be placed in a larger box, and the box allowed to extend further than normal to the right. In other words, the left edge of the box will be a distance \verb"\labelwidth"$+$\verb"\labelsep" to the left of the item's left margin, and there will be a \verb"\labelsep" space to the right of the label. \yspace You can define your own paragraph-making environment with the \verb"\newlist"\index{!newlist@} command. A command of the form \begin{quote} \makebox[0pt][l]{\tt\bs newlist\lb mylist\rb \lb {\it larg1\/}\rb \lb{\it larg2\/}\rb \lb{\it iarg\/}\rb} \end{quote} defines a \verb"\begin{mylist}" command to be equivalent to \begin{quote} \makebox[0pt][l]{\tt \bs begin \lb list\rb\lb {\it larg1\/}\rb \lb{\it larg2\/}\rb {\it iarg\/}} \end{quote} and makes \verb"\end{mylist}" synonymous with \verb"\end{list}". The {\it iarg\/} argument is most often used to add an \verb"\item" command to the beginning. Every one of \LATEX's paragraph-making environments that indents the margin is defined in terms of the {\tt list} environment. For example, the \verb"quote" \index{quote environment} environment, in which paragraphs are unindented and the right margin is indented the same as the left can be defined as follows. \begin{verbatim} \newlist{quote}{}{\setlength{\rightmargin}% {\leftmargin}}{\item[]} \end{verbatim} (Remember the use of \verb"%"\index{percent} to start a new line without adding a space, as explained in Section~\ref{simple-text} on page~\pageref{simple-text}.) The {\tt verse} \index{verse environment} environment uses negative values for \hbox{\verb"\itemindent"} and \hbox{\verb"\listparindent"}. The right combination of parameters will provide any kind of list-making environment you're likely to want. \subsection{Verbatim}\index{verbatim}\label{verbatim} The {\tt verbatim} \index{verbatim environment} environment is a paragraph-making environment that gets \LATEX{} to print exactly what you type in. For example, typing \begin{quote}\tt\raggedright produces the following:\\* \verb"\begin{verbatim}"\\* Look, Ma!\\* \verb" "Special characters:\\* \verb"% $ & # \ ~ ^ â?? { }"\\* \verb"\end{verbatim}" \end{quote} produces the following: \begin{verbatim} Look, Ma! Special characters: % $ & # \ ~ ^ â?? { } \end{verbatim} The {\tt verbatim} environment turns \LATEX{} into a typewriter, with \carrtn{}\index{!!carrtn, in verbatim} and \xsp{}\verb*" "\index{space, in verbatim}\xsp{} characters having the same effect that they would on a typewriter. Every character in a verbatim environment produces itself; even the \xsp{}\verb"\"\index{!, in verbatim}\xsp{} acts like an ordinary printing character. The only thing that you can't put inside a {\tt verbatim} environment is the character string \begin{quote} \verb"\end{verbatim}" \end{quote} There's also a \verb"\verb"\index{!verb@} command that typesets its argument in ``verbatim mode''. For example, a sentence like this one containing \verb"\#{}$%" can be typed as \begin{verbatim} ... this one containing \verb+\#{}$%+ can be ... \end{verbatim} In this example, the argument of the \verb"\verb" command is \xsp{}\verb"\#{}$%"\Xsp, the {\tt +}'s serving to delimit the argument. You can use any ordinary printing character instead of \xsp{}{\tt +}\xsp{} to delimit the argument. (See page~\pageref{ordinary} in Section~\ref{ordinary} if you don't remember what the ordinary printing characters are.) The {\tt verbatim} \index{verbatim* environment} environment and the \index{!verb*}\verb"\verb" command have {\tt *}-forms that differ only in that they cause a space to print like ``\verb*" "'' instead of just leaving a blank space. For example, I can print \verb*"{x + y}" by typing \begin{verbatim} \verb*"{x + y}" \end{verbatim} Be careful to include the \verb"\end{verbatim}" or matching argument delimiter for the \verb"\verb" command. If you forget it, \LATEX{} may process the rest of your document, including the \verb"\end{document}", as part of the verbatim text. Needless to say, the result would be disastrous. \yspace \noindent {\bf Warning:} You cannot put a {\tt verbatim} environment or a \verb"\verb" command in an argument of any other command. For example, \begin{verbatim} \mbox{x + \verb"\verb!${}#!" + y} is wrong \end{verbatim} won't work right. \yspace \noindent {\bf Warning:} A tab \index{tab, in verbatim} character is not the same as a space in a {\tt verbatim} or \verb"\verb" command. Also, you should not put a \index{!!carrtn, in !verb argument}\carrtn{} in the argument of a \verb"\verb" command. \section{Changing the Style} Many aspects of the way \LATEX{} formats your document can be ``tweaked'' by commands to choose different style options and to change parameters. This section describes how it's done. \subsection{The Page Layout and Document Style} \label{docsty} Recall that your document begins with a \verb"\pagelayout"\index{!pagelayout} command followed by a \verb"\documentstyle"\index{!documentstyle} command. The \verb"\pagelayout" command defines the {\it page \index{page layout} layout}---where things are placed on the page. A page of output consists of three units: the head, the text and the foot. The head and foot are used for page numbers and various things that people like to put at the top and bottom of pages, such as the title of the current chapter. The text consists of everything that comes directly from your manuscript file, including figures and footnotes. The \verb"pagelayout"\index{!pagelayout@} command specifies the size of each of these three units and where they go on the page. It determines the size of the \verb"\textwidth"\index{!textwidth} and \verb"\textheight"\index{textheight} lengths, which are the dimensions of the text on the page. (See Section~\ref{length}.) The argument of the \verb"\pagelayout" command consists of the name of the chosen layout plus one or more options, separated by commas. Executing the command causes \LATEX{} to read a special command file that sets the appropriate parameters. The \hbox{\tt normal} \index{normal page layout} page layout will be on a file named {\tt normal.plo}\index{.plo file} on some system directory. If you can find a copy of this file, browsing through it might be informative. The standard version of most page layouts is designed for documents that will be printed on just one side of the paper. Most formats have a \hbox{\tt twoside}\index{twoside} option for documents that are printed on both sides, like real books. For example, the command \begin{verbatim} \pagelayout{normal,twoside} \end{verbatim} selects the {\tt normal} page layout with the {\tt twoside} option. After your \verb"\pagelayout" command comes the \verb"\documentstyle"\index{!documentstyle} command to specify the document \index{document style} style. I've already discussed the standard document styles. The command \begin{verbatim} \documentstyle{article} \end{verbatim} causes \LATEX{} to read a file named {\tt article.sty}\index{.sty file} from a system directory, which is a special command file that sets certain parameters and defines some style-specific commands, such as sectioning commands. This file is of interest only to confirmed \TEX{} hackers; ordinary people should not attempt to look at it. Like page layouts, document styles can have options. The {\tt 11pt\index{11pt}} and {\tt 12pt\index{12pt}} style options, which choose an 11-point and 12-point type size, are discussed in Section~\ref{normal-size} on page~\pageref{normal-size}. You should check with your local expert to find out what other options are available. \subsection{Page Styles}\index{page style} The page layout determines the size and position of the page's head and foot. The {\it page style\/}\index{page style} determines what goes in them. The page style changes at various points in a document. For example, the title page has no page number, and the first page of a chapter has a different head and foot from the rest of the text. Fortunately, you don't have to worry about these changes; \LATEX{} handles them automatically. However, there are certain points in the manuscript, usually when you're beginning a new part of the document, where you may want to tell \LATEX{} to change the page style---for example, when you begin the table of contents or go from the introduction to the main body of the text. Also, you can override \LATEX's choice of page style if you disagree with it. The \verb"\pagestyle"\index{!pagestyle@} and \verb"\thispagestyle"\index{!thispagestyle@} commands are used to change the page style. They are the same except that the \verb"\pagestyle" command changes the style from the current page on, while \verb"\thispagestyle" changes it only for the current page, reverting afterwards to the style specified by the preceding \verb"\pagestyle" command. However, be careful if you execute a style-changing command in the middle of a page, because you and \TEX{} may have different ideas about what the ``current page'' is when it is processing your command. You will seldom have any trouble, though, if you put the style-changing command between paragraphs, with a blank line before and after it. The argument of the \verb"\pagestyle" or \verb"\thispagestyle" command specifies the page style. What page styles are available will depend upon the document \index{document style}style. Below are some standard options that will be available in many document styles. \begin{description}{{\tt myheadings}:} \item[{\tt plain}:]Just\index{plain page style} a plain page number. \item[{\tt empty}:] Produces \index{empty page style}empty heads and feet---no page number. \item[{\tt headings}:] Puts\index{headings page style} running headings on each page. The document \index{document style}style specifies what goes in the headings; there may be other options that provide different kinds of headings. \item[{\tt myheadings}:] You\index{myheadings page style} specify what is to go in the heading. The command \linebreak %%%%% \hbox{\verb"\head{Gnus}"}\index{!head@} tells \LATEX{} to make ``Gnus'' the text of the heading. For two-sided printing, you can give an optional \xsp{}{\tt l}\xsp{} or \xsp{}{\tt r}\xsp{} argument to indicate that the heading should go on the left- or right-hand page. Thus, \begin{verbatim} \head[l]{Gnats} \head[r]{Gnus} \end{verbatim} will make ``Gnats'' the heading on left-hand pages and ``Gnus'' the heading on right-hand pages. These commands change the heading starting with the current page. They specify only the text of the headings; the document style determines the type style and where the page number goes. {\bf Warning:} The restrictions on what can go into the optional argument of a sectioning command, described in Section~\ref{sec-commands} on page~\pageref{sec-commands}, apply to the argument of a \verb"\head" command. \end{description} Remember that the \verb"pagestyle" command changes the style starting with the current page. If you want the \verb"headings" page style to begin after the introduction, starting with the first chapter, then the correct sequence of commands is: \begin{verbatim} ... ending our introduction. \newpage \pagestyle{headings} \chapter{Armadillos I Have Known} \end{verbatim} The \verb"\chapter" command may need to know what page style is in effect in order to set up the headings, so it is preceded by the \verb"\pagestyle" command. The \verb"headings" page style won't take effect until the second page of the chapter because \verb"\chapter" executes a \verb"\thispagestyle" command that takes precedence. Although the document style determines where the page number goes, you get to \index{page numbering} decide what the number looks like. The \verb"\pagenumbering"\index{!pagenumbering} command allows you to change the numbering style and reset the page number to one. You can write \begin{verbatim} \pagenumbering{arabic} \end{verbatim} for arabic numbering and \begin{verbatim} \pagenumbering{roman} \end{verbatim} for Roman numerals. Section~\ref{counters} provides additional options. \subsection{Style Parameters}\index{style parameters}\label{parameters} In this section are listed all the style parameters that you might want to use or change, except some that are described elsewhere. They are all lengths, unless otherwise specified. Any restrictions on where they can be changed are stated; otherwise they can be changed at will. The phrase ``initial declaration\index{initial declaration} only'' means that the parameter can be changed only before the \verb"\begin{document}" command. Remember that a length which \TEX{} regards as one inch may not appear as exactly one inch on the printed page. The output device may provide a uniform magnification of all lengths. \newcommand{\param}[1]{\item[{\tt \bs #1}:]\index{!#1@}\ignorespaces} \newcommand{\descriparg}{\hbox to 2in{}} \subsubsection{Page Layout Parameters}\index{Page Layout Parameters} The parameters that specify distances from the physical edge of the page should not be taken literally, since they measure the distance from where \TEX{} thinks the physical edge of the page should be, not where your output device thinks it is. \begin{description}{\descriparg} \param{topmargin} The distance from the top of the physical page to the pages's head. Initial declaration only. \param{oddsidemargin} The distance between the left side of the page and the text's normal left margin. For two-sided printing (specified by the {\tt twoside} page-layout option), it applies only to odd-numbered (right-hand) pages, otherwise it applies to all pages. Initial declaration only. \param{evensidemargin} Same as \verb"\oddsidemargin" except used for even-numbered pages in two-sided printing. Initial declaration only. \param{headheight} Height of the head---the box at the top of the page that holds the running head. Initial declaration only. \param{headsep} The vertical distance between the bottom of the head and the top of the text. Initial declaration only. \param{footheight} Height of the foot---the box at the bottom of the page that may hold the page number. Initial declaration only. \param{footskip} The vertical distance between the bottom of the last line of text and the bottom of the foot. Note difference between \verb"\footskip" and \verb"\headsep". Initial declaration only. \param{textheight} The height of the text on the page, excluding the head and foot. Initial declaration only. \param{textwidth} The normal width of the text. Initial declaration only. \param{columnwidth} The width of the current column. In single-column text it equals \verb"\textwidth", but it will be different in two-column text. Do not change. \param{columnsep} The distance between the two columns in two-column text. It can be changed before the \verb"\begin{document}" command, or before a command that switches from one-column to two-column style. \param{columnseprule} The width of the rule between columns on two-column pages. Its normal value is zero. \param{footnotesep} The \index{footnotes, parameter} height of a strut placed at the beginning of every footnote. (See page~\pageref{strut} of Section~\ref{strut} for a discussion of struts.) \param{marginparwidth} The \index{marginal notes, parameters} width of a marginal note. \param{marginparsep} The horizontal space between the margin and the marginal note. \param{marginparpush} The minimum amount of vertical space that \LATEX{} will leave between two marginal notes. \end{description} \subsubsection{Float Parameters} \index{float parameters} \label{float-param} The following parameters are the float-placement \index{float-placement constraints} constraints mentioned in Section~\ref{float-place}. Changes made to these parameters before the \linebreak %%%%% \hbox{\verb"\begin{document}"} command apply from the first page on. Changes made after the \hbox{\verb"\begin{document}"} take effect on the next page, not the current one. \begin{description}{\descriparg} \item[{\tt topnumber}:] The \index{topnumber@} maximum number of floats allowed at the top of a page. This is a counter, so it can be changed by the commands of Section~\ref{counters}. \item[{\tt \bs topfraction}:] The \index{!topfraction@} maximum fraction of the page that can be occupied by floats at the top of the page. The value {\tt .25} specifies that the top quarter of the page may be devoted to floats. It is changed with the \verb"\renewcommand" command of Section~\ref{defcom}. \item[{\tt bottomnumber}:] Same \index{bottomnumber@} as {\tt topnumber} except for the bottom of the page. \item[{\tt \bs bottomfraction}:] Same \index{!bottomfraction@} as \verb"\topfraction" except for the bottom of the page. \item[{\tt totalnumber}:] The \index{totalnumber@} maximum number of floats that can appear on a single page, irrespective of their positions. It is a counter. \item[{\tt \bs textfraction}:] The \index{textfraction} minimum fraction of a text page that must be devoted to text. The other $1-\verb"\textfraction"$ fraction may be occupied by floats. It is changed with \verb"\renewcommand". \item[{\tt \bs floatpagefraction}:] The \index{!floatpagefraction@} minimum fraction of a float page that must be occupied by floats. This limits the amount of blank space allowed on a float page. It is changed with the \verb"\renewcommand" command. \item[{\tt dbltopnumber}:] The analogue \index{dbltopnumber} of \hbox{\tt topnumber} for two-column floats (in two-col\-umn style). \item[{\tt \bs dbltopfraction}:] The {\tt dbltopnumber} analogue of \hbox{\tt \bs topfraction} for two-col\-umn floats. \item[{\tt \bs dblfloatpagefraction}:] The \index{!dblfloatpagefraction@} analogue of \verb"\floatpagefraction" for two-col\-umn float pages. \end{description} \yspace The following parameters control the space left between and around \index{spacing, figures and tables} floats. Their values are rubber \index{rubber lengths}lengths, so you should not change them unless you've read Chapter~12 of \knuth{}. You can effectively change their values by controlling the amount of space you put in each float. \begin{description}{\descriparg} \param{floatsep} The distance between floats that appear at the top or bottom of a text page. \param{textfloatsep} The distance between the floats appearing at the top or bottom of a page and the text on that page. \param{intextsep} The vertical space placed above and below a float that is put in the middle of the text with the {\tt h} float-placement option. \param{dblfloatsep} Same as \verb"\floatsep" except for double-width floats on a two-column page. \param{dbltextfloatsep} Same as \verb"\textfloatsep" except for double-width floats on a two-column page. \end{description} \subsubsection{Paragraph-Making Parameters} \index{{Paragraph-Making Parameters}} See also the parameters used by the {\tt list} environment, described in Section~\ref{list}. \begin{description}{\descriparg} \param{parskip} The extra vertical space added between paragraphs. It should be a ``rubber'' length, so don't try changing it unless you have read Chapter~12 of \knuth. \param{parindent} The horizontal indentation added at the beginning of a paragraph. \param{baselineskip} The normal distance from the bottom of one line of a paragraph to the bottom of the next line. Should only be changed locally. If you want to change its value for the entire document, see \hbox{\verb"\mainbaselineskip"}. \param{mainbaselineskip} The value of \hbox{\verb"baselineskip"} for the \hbox{\verb"\normalsize"}\index{!normalsize} type size. Should be changed only before the \hbox{\verb"\begin{document}"} command. \param{parstretch} A ``rubber'' length whose natural length is zero. It is used to provide the vertical stretch between paragraphs and items in a list. Don't change it unless you've read Chapter~12 of \knuth. \param{linewidth} The width of the current line. It will differ from \verb"\columnwidth" only when inside a {\tt list} environment, or one of the environments defined in terms of the {\tt list} environment. \end{description} \subsubsection{Box Parameters} \begin{description}{\descriparg} \param{fboxrule} The thickness of the lines in the frame produced by the \hbox{\verb"\framebox"\index{!framebox}} and \hbox{\verb"\fbox"\index{!fbox}} commands. \param{fboxsep} The space between the frame and the text that it's framing in the \hbox{\verb"\framebox"} and \verb"\fbox" commands. \end{description} \subsubsection{Table of Contents Parameters}\index{table of contents parameters} \label{toc-param} \begin{description}{\descriparg} \param{begintableofcontents} A command that produces the heading for a table of contents. It must include all the necessary formatting commands. It is changed with the \verb"\renewcommand" command of Section~\ref{defcom}. \param{beginlistoffigures} The analogue of \hbox{\verb"\begintableofcontents"} for the list of figures. \param{beginlistoftables} The analogue of \hbox{\verb"\begintableofcontents"} for the list of tables. \end{description} \subsubsection{{\tt tabbing}, {\tt tabular}, and {\tt array}} \index{tabbing environment, parameters} \index{tabular environment, parameters} \index{array environment, parameters} \begin{description}{\descriparg} \param{tabbingsep} The distance to the left of a tab stop moved by the {\tt tabbing} environment's \xsp{}\verb"\'"\index{!'}\xsp command. \param{arraycolsep} Half the width of the space left between columns in an {\tt array} environment. \param{tabcolsep} Half the width of the space left between columns in a {\tt tabular} environment. \param{arrayrulewidth} The width of the rule created in a {\tt tabular} or {\tt array} environment by a \xsp{}{\tt |}\xsp{} in the argument, an \verb"\hline"\index{!hline, width of rule} command, and a \verb"\vline"\index{!vline, width of rule} command. \param{doublerulesep} The horizontal distance between the two vertical rules created by a \xsp{}{\tt ||}\xsp{} in the argument of a {\tt tabular} or {\tt array} environment. \end{description} \section{Using Raw \TEX} \index{tex} \label{tex} With \LATEX{}, you can format things any way you like, but it may not be as easy as you'd like. \LATEX{} will print a recipe exactly the way you want it, but it may not allow you to define a \verb"\recipe" command that does it all automatically. For that, you may have to delve into \knuth{} and learn to use the more primitive \TEX{} commands. However, before you do that, be sure it's worth it. You can format a lot of recipes in the time it takes you to learn how to write that \verb"\recipe" command. \LATEX{} has been carefully planned so its commands fit together into a single system. Many compromises have been made to ensure that a command will work properly when used in any reasonable way with other \LATEX{} commands. It may not work properly when used with raw \TEX{} commands. Every effort will be made to correct errors found in \LATEX. However, I will not even look at an error unless every command in the input that produced it is either listed in the index of this manual or defined using a command listed in the index. In other words, you're on your own when you use raw \TEX. Now that I've disclaimed all responsibility, I'll give you some idea of what you can do without getting into trouble. A good general rule is not to mix \LATEX{} commands with plain \TEX{} commands. More precisely, you shouldn't combine a \LATEX{} command with any \TEX{} commands that might modify parameters it uses. For example, it would be foolish to think you could use a \TEX{} \hbox{\verb"\hangindent"} command or modify \verb"\hsize" inside one of \LATEX's list environments. You should not modify any parameters that are used by \LATEX's \hbox{\verb"\output"} routine, except as specified in this manual. In particular, you should forget about most of what's in Chapter~15 of \knuth. However, \LATEX{} does obey all of \TEX's conventions for the allocation of registers, so you can define your own counts, boxes, etc.\ with the normal \TEX{} commands. Most of the \TEX{} commands described in \knuth{} have been retained in \LATEX, even though they may not officially be part of \LATEX. The exceptions are commands used only in \TEX's standard \verb"\output" routine, and certain commands that have been replaced by more powerful \LATEX{} commands, such as the tabbing commands in Chapter~22 of \knuth. A few \TEX{} commands have been displaced by \LATEX{} commands of the same name---for example \LATEX's \verb"\end" command is completely different from \TEX's. There are also a few of \TEX's commands that have been given slightly different definitions. For example, \LATEX's \verb"\input" command works with the \LATEX{} convention of enclosing its argument in braces, as well as with the \TEX{} convention of omitting the braces.