Test File Based on Obsolete 13 December 1983 Version of LATEX Manual Leslie Lamport Created 7 July 1984 Run March 4, 200...
39 downloads
1925 Views
717KB Size
Report
This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
Report copyright / DMCA form
Test File Based on Obsolete 13 December 1983 Version of LATEX Manual Leslie Lamport Created 7 July 1984 Run March 4, 2005 c Copyright 1984
Preface This is still a preliminary version of the LATEX manual. In the final version, this preface will thank those who have helped me. The people who have helped me so far, by their comments on an earlier version or by their help in getting LATEX running, are: Todd Allen, Robert Amsler, David Bacon, Stephen Barnard, Daniel Brotsky, David Fuchs, Richard Furuta, Andrew Hanson, Arthur Keller, Donald E. Knuth, Kenneth Laws, Tim Morgan, Mark Moriconi, Oren Patashnik, Martin Reges, Lynn Ruggles, Michael Spivak, and Gio Wiederhold. (Please let me know if your name was inadvertently omitted from this list.) You can join this select list by giving me your comments and suggestions on the following topics. • This manual. Let me know about any errors, omissions, or things that aren’t clear. • LATEX itself. People obviously will complain about bugs, but I’d also like to know about anomalies such as poor page breaking, and about anything else that LATEX does or doesn’t do which you find surprising. To all you early users of LATEX, good luck. Those who come after you will appreciate your efforts. Menlo Park December 1983
iii
Contents Preface
iii
Introduction
1
1 Getting Started 1.1 Preparing an Input File . . . . . . . . . . 1.2 Starting and Ending . . . . . . . . . . . . 1.3 Typing Simple Text . . . . . . . . . . . . 1.4 Commands . . . . . . . . . . . . . . . . . 1.4.1 Command Names and Arguments 1.4.2 The Taxonomy of Commands . . . 1.5 Modes . . . . . . . . . . . . . . . . . . . . 1.6 Getting Fancier . . . . . . . . . . . . . . . 1.7 Running LATEX . . . . . . . . . . . . . . . 1.8 Some Words of Advice . . . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
4 4 7 8 10 10 15 19 21 21 27
2 The Basics 2.1 Changing the Typeface . . . . . . . . . . . . . . 2.1.1 Specifying the Type Style . . . . . . . . 2.1.2 Specifying the Type Size . . . . . . . . . 2.1.3 Accents and Special Symbols . . . . . . 2.2 Paragraph-Making Environments . . . . . . . . 2.2.1 Simple Paragraph-Making Environments 2.2.2 List-Making Environments . . . . . . . 2.2.3 Centering and “Flushing” . . . . . . . . 2.3 Mathematical Formulas . . . . . . . . . . . . . 2.3.1 Subscripts and Superscripts . . . . . . . 2.3.2 Math Symbols . . . . . . . . . . . . . . 2.3.3 Spacing in Math Mode . . . . . . . . . . 2.3.4 Arrays . . . . . . . . . . . . . . . . . . . 2.3.5 Putting One Thing Above Another . . . 2.3.6 Delimiters . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
29 29 29 30 32 33 34 37 40 42 44 44 48 49 52 53
iv
. . . . . . . . . .
. . . . . . . . . .
v
2.4
2.5
2.6
2.3.7 Mathematical Miscellany . . . . . . . . . . 2.3.8 Changing Typeface and Style . . . . . . . . 2.3.9 What to Do When Nothing Works . . . . . Text That Migrates . . . . . . . . . . . . . . . . . 2.4.1 Footnotes . . . . . . . . . . . . . . . . . . . 2.4.2 Figures, Tables, and Other Floating Bodies 2.4.3 Marginal Notes . . . . . . . . . . . . . . . . Sectioning . . . . . . . . . . . . . . . . . . . . . . . 2.5.1 The Sectioning Commands . . . . . . . . . 2.5.2 Table of Contents, Etc. . . . . . . . . . . . 2.5.3 The Appendix . . . . . . . . . . . . . . . . The Title Page . . . . . . . . . . . . . . . . . . . .
3 Doing It Yourself 3.1 Defining Things . . . . . . . . . . . . . . . . . 3.1.1 Commands . . . . . . . . . . . . . . . 3.1.2 Lengths . . . . . . . . . . . . . . . . . 3.1.3 Counters . . . . . . . . . . . . . . . . 3.2 Spaces and Boxes . . . . . . . . . . . . . . . . 3.2.1 Spaces . . . . . . . . . . . . . . . . . . 3.2.2 Boxes . . . . . . . . . . . . . . . . . . 3.3 Line and Page Breaking . . . . . . . . . . . . 3.3.1 The \\ Command . . . . . . . . . . . 3.3.2 Line Breaking . . . . . . . . . . . . . . 3.3.3 Page Breaking . . . . . . . . . . . . . 3.4 Formatting it Yourself . . . . . . . . . . . . . 3.4.1 The tabbing Environment . . . . . . 3.4.2 The tabular and array Environments 3.4.3 The picture Environment . . . . . . 3.4.4 The list Environment . . . . . . . . 3.4.5 Verbatim . . . . . . . . . . . . . . . . 3.5 Changing the Style . . . . . . . . . . . . . . . 3.5.1 The Page Layout and Document Style 3.5.2 Page Styles . . . . . . . . . . . . . . . 3.5.3 Style Parameters . . . . . . . . . . . . 3.6 Using Raw TEX . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
. . . . . . . . . . . .
54 55 56 57 57 59 64 66 66 67 69 69
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
71 71 71 73 76 78 78 80 86 86 87 90 91 92 96 100 108 110 111 111 112 114 118
4 Two-Column Text 5 Getting Bigger 5.1 Doing it in Parts . . . . . . . 5.2 Index and Glossary . . . . . . 5.3 Cross References . . . . . . . 5.4 Bibliographies and Citations .
120
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
122 122 126 127 128
vi
5.5 5.6
Auxiliary Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
6 Errors 6.1 About Errors . . . . . . 6.2 LATEX’s Error Messages 6.3 TEX’s Error Messages . 6.4 LATEX Warnings . . . . 6.5 TEX Warnings . . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
134 134 136 139 142 142
A Document Styles
144
B The Bibliography Database
145
C Making Slides
146
List of Figures 1.1
The file myfile.tex. . . . . . . . . . . . . . . . . . . . . . . . . .
22
2.1 2.2 2.3
A Sample Figure. . . . . . . . . . . . . . . . . . . . . . . . . . . . The first half of a two-in-one figure. . . . . . . . . . . . . . . . . The second half of a two-in-one figure. . . . . . . . . . . . . . . .
60 61 61
3.1 3.2 3.3 3.4
A grand example. . . . . . . . . . . . . Input for a Grand Example. . . . . . . Points and their coordinates. . . . . . \put (1.4,2.6){\line(3,-1){4.8}}
vii
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. 98 . 99 . 100 . 103
List of Tables 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11
Accents. . . . . . . . . . . . Foreign Symbols . . . . . . Variant Greek letters. . . . Binary Operation Symbols. Relation Symbols . . . . . . Arrow Symbols . . . . . . . Miscellaneous Symbols . . . Variable-sized Symbols. . . “Log-like” Functions. . . . . Math Mode Accents. . . . . Delimiters. . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
viii
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
33 33 45 45 45 46 46 47 48 53 54
Introduction LATEX is a computer program for generating many kinds of printed documents. You type in your text and some commands to say how you want it formatted, and LATEX does the rest. For example, typing \chapter{Getting Started} produced the chapter heading on page 4, complete with chapter number, and the table of contents entry on page iv. Even the page references in the preceding sentence were generated by LATEX; as I’m typing this, I don’t know on what page things will appear.1 Of course, LATEX also does the obvious things, like deciding where to start a new line or a new page. LATEX is a version of Donald Knuth’s TEX typesetting system, but it is much easier to use than the standard version of TEX. This manual tells you everything you need to know to generate most documents; no prior knowledge of TEX is required. The first thing you probably want to know about LATEX is how it’s pronounced. I won’t tell you because I believe that pronunciation should be determined by usage rather than fiat. TEX is usually pronounced teck, so lah-teck, lah-teck, and lay-teck are logical choices. Since logic doesn’t have much to do with such things, lay-tecks is also a possibility. However, pronouncing it as “L. A. TEX” is definitely frowned upon. LATEX was inspired by Brian Reid’s Scribe system While many ideas were stolen directly from Scribe, LATEX does not attempt to emulate Scribe. A primary goal of a document preparation system like Scribe or LATEX is to separate the specification of the document’s logical structure from the specification of how it is to be printed. I typed \chapter{Getting Started} to specify the beginning of a new chapter, a chapter being a logical component of the document. LATEX decided how this logical structure is to be translated onto the printed page—i.e., by starting a new page, printing a chapter number followed by the chapter name in large type, etc. 1 And
...
I produced this footnote by typing
will appear.\footnote {And I produced this footnote by ...
1
}
You tell LATEX how it should print things like chapter headings by specifying the document style. LATEX provides several standard document styles for you to choose from. You can easily change some aspects of the document style, such as producing a larger indentation at the beginning of a paragraph, or using Roman instead of Arabic numerals in the chapter number. Using the standard document styles with suitable modifications, most people will like the way LATEX typesets their papers, reports and books. There will always be special cases that no standard document style can handle. For example, the standard LATEX document styles aren’t well suited for typesetting the Old Testament. Fortunately, you can design your own document style. Unfortunately, it’s not easy to do; you have to know a lot about TEX, and you have to read the LATEX Document-Style Designer’s Guide, which has not yet been written. I expect there to be a few hardy souls who design new document styles and make them available to other LATEX users. A document style created for typesetting the Old Testament can be used by someone else to typeset the New Testament. However, most users will be happy with document styles designed by others. A document style tells LATEX how to print logical structures like chapters and enumerated lists. However, no document style can know about all possible logical structures. A recipe is a logical component of a cookbook, but none of the standard document styles knows about recipes. There’s no \recipe command that’s analogous to the \chapter command; you have to tell LATEX how to print your recipe. LATEX has commands for specifying exactly how something is to be printed—what type style to use for the list of ingredients, how to number the cooking steps, etc. You can even define your own \recipe command. While LATEX provides simple commands for typesetting things the way you want them, these commands are not as powerful as the more complicated ones provided by TEX. Since LATEX is a version of TEX, you can use almost all the ordinary TEX commands in LATEX. So, if you find yourself trying to do something that you can’t in LATEX, you can read The TEXbook by Donald Knuth to learn how to use the ordinary version of TEX. TEX was designed especially for typesetting mathematics, and it has many powerful commands for producing complicated mathematical formulas. If your documents contain only a few formulas, you’ll be able to get by with the LATEX commands and a little fudging. If they contain many formulas, then you’ll probably want to read the parts of The TEXbook that talk about typesetting mathematics. If you are a mathematician, or a mathematician’s typesetter, you should find out about AMS-TEX, a version of TEX specially made for mathematicians. There will also be a version called LAMS-TEX that combines the features of LATEX and AMS-TEX. Producing a document with LATEX is a lot different from typing it directly. Your input file is filled with lots of funny commands, and you can’t see exactly what the printed output will look like. Various document-production programs
2
have been developed that are a lot easier to use—programs that show you on the screen what your document will look like when it’s printed. These are sometimes called “what you see is what you get” formatting systems, so I’ll call them “WYSIWYG systems”. If these WYSIWYG programs are so easy to use, why did Knuth bother to implement TEX, and why did I compound the foolishness by implementing LATEX on top of it? There are two reasons why someone should use LATEX instead of a WYSIWYG program. The first is that it produces better quality output. The quality of typesetting done by TEX is comparable to that of a book publisher, so your LATEX output will look as good as an ordinary typeset book or journal. This is not true of any WYSIWYG system that I know about. The second and more important reason for using LATEX is the enormous flexibility that it provides. In the words of Brian Reid, these WYSIWYG systems are “what you see is all you’ve got” formatters. They can produce exactly what you see on your screen, but that’s all they can do. With LATEX, by changing a few declarations, you can completely change the appearance of your document. The same text may appear first in a short note, then as a chapter of a final report, and again as a journal article. Each time, it should be formatted differently. Even if your document will be printed only once, you may change your mind about how you want it formatted. With a WYSIWYG program, you’d have to reformat it yourself each time. With LATEX, you just change some declarations. When casually reading this manual, it may seem like the names “TEX” and “LATEX” have been used interchangeably. However, the careful reader will note that I have tried to distinguish between standard TEX and those features provided by LATEX. This distinction is important only when you read The TEXbook, where you will learn that most of the LATEX commands you have grown to know and love are not part of standard TEX. Before telling you how to use LATEX, I need to tell you how to use this manual. Chapter 1 tells you everything you have to know to start using LATEX. You should read it very carefully, and finish reading it before doing anything else. The rest of the manual is a reference book; you can turn to it when you come to something that you don’t know how to do. Chapter 1 tells you how to find what you need.
3
Chapter 1
Getting Started 1.1
Preparing an Input File
Your input to LATEX is a text file. On most computers, file names have two parts separated by a period, like always.iys. The first part of your input file’s name can be anything, but the second part should be tex. I’ll use myfile.tex as my standard example input-file name, but you can use any name you like. I assume that you know how to prepare a file with a text editor, so I’ll just tell you what should go into the manuscript file, not how to get it there. First, however, I’ll mention some important things about text files that you may not be aware of. A text file is a string of characters. There are two kinds of characters, printing and nonprinting ones. The printing characters are all those characters like q , % or = that light up phosphors on the screen, or put ink on the paper when the file is printed. All the rest are nonprinting characters. The nonprinting characters are just as real as the printing ones, and it’s important to know about them. When you look at a text file, it appears to be a series of lines composed of characters and horizontal spaces, the characters usually being grouped into words. The lines and spaces are actually produced by certain nonprinting characters that are in the file. The spaces between words are most often the result of space characters that are put into the file when you hit the space bar on your keyboard. In this manual, I’ll usually denote space characters by blank spaces, just like they appear on your terminal’s screen. However, when I want to emphasize that there’s a space character present in the input file, I’ll use the symbol to denote that character. Unlike an ordinary character such as q , it’s often hard to tell whether you’ve typed one or two space characters. Fortunately, you don’t have to worry about that. LATEX treats any number of consecutive characters just the same as a single one. There’s another key on your terminal that produces empty space on the
4
CHAPTER 1. GETTING STARTED
5
screen or printed page: the tab key. Hitting this key enters a nonprinting character called tab that acts like one or more space characters. LATEX treats a tab character exactly the same as a character. Since one is the same as several to LATEX, you never have to worry about whether that blank space on your screen is caused by a tab character or some characters. I usually won’t mention the tab character, but everything I say about will apply to tab as well. Your file is broken into a series of lines by a nonprinting character called carriage return that appears between the lines. I will use as the name for this carriage return character.1 The characters were probably entered in your file by hitting the key marked return on your terminal. Just like a q or a , a is a full-fledged character. Most of the time, TEX treats a as if it were a , but you’ll see that there are cases when this isn’t true. There’s one other nonprinting character that you might find in your file: the new-page character, sometimes called Control-L. If your text editor has a command for starting a new page, it probably works by putting a new-page character in the file. TEX treats a new-page character as if it were a blank line. Text files can also contain some weird nonprinting characters, like the one that makes your terminal beep. Those characters don’t belong there; TEX will come to a grinding halt if it finds one. Fortunately, it’s hard to get such characters into your file, so you needn’t worry about them. There are a number of funny printing characters hiding in the corners of your keyboard that you may find yourself typing for the first time when you prepare LATEX input. First and foremost is the \ character (pronounced “backslash”). It should not be confused with the more familiar / character, as in 1/2. You’d better practice typing the \ because you’ll use it a lot. Every LATEX command begins with a \. In typing the input for this chapter, I’ve used the \ characters about as often as the letter d. Your keyboard should have three kinds of bracketing pairs: parentheses ( and ), square brackets [ and ], and curly braces { and }. LATEX makes special use of the square brackets and curly braces. There should be three quote characters on your keyboard: ", ’ and ‘. You can forget about the " (double quote); you won’t need it at all. The ’ is called “right quote” and the ‘ is called “left quote” for reasons that will soon be obvious. The ’ is probably in a prominent position on the keyboard, perhaps over the 7; it may look more like 0 or on your screen. The ‘ is probably squirreled away in a corner, and may appear on your screen as ` . Among the printing characters, the following ten play a special role in TEX and are called special printing characters, or simply special characters. # $ % & ~ _ ^ \ { } 1 On many computer systems, a carriage return is really two characters—a plain carriage return and a line feed. This is of no concern, since TEX treats them as a single character.
CHAPTER 1. GETTING STARTED
6
While you’re perusing your keyboard, it would be a good idea to pick them out. The first four are everyday symbols that you’re familiar with. The tilde character ~ is probably hidden at the edge of your keyboard; the caret ^ may be denoted by a ↑ ; the underscore _ sometimes appears on the screen as a ←. You might want to paint these ten special character keys red because they are the characters that have a special meaning to TEX. Whenever you put one of these characters into your file, you’re doing something special. The remaining printing characters are called the ordinary printing characters. They are the upper- and lowercase letters, the ten digits 0 . . . 9 and the following. . : ; , ? ! " ‘ ’ ( ) [ ] < > - = + / * | @ Note that uppercase and lowercase letters are distinct characters. Don’t confuse the uppercase letter O (oh) with the digit 0 (zero). Also, don’t confuse the letter l (the lowercase el ) with the digit 1 (one). The only characters that should appear in your file are the ordinary and , tab and newspecial printing characters and the nonprinting characters , page. Some terminals have a variety of keys with strange characters etched on them. Pressing one of these keys usually issues a command to your editor without putting the strange character in the file. However, some of them may put weird characters in your file. TEX does not like such characters and will either complain bitterly or do strange things if it finds one in an input file. If your keyboard happens to have a key labeled ≤ , you will be tempted to try to produce 1 ≤ 2 by typing 1≤2. Don’t, unless you’ve been assured by a local expert that it works; otherwise, it probably won’t. It’s easy enough to generate a ≤ with ordinary LATEX commands. To get a document formatted properly, you have to tell LATEX what you want. This involves a lot of typing. Being a fast typist helps, but it’s still quite a chore. For example, a boldface word like bold is produced by typing {\bf bold}, which means typing six characters besides the four in bold. All these extra characters can add up to a lot of extra work. Fortunately, a good text editor like EMACS can be customized to reduce the amount of typing required. In my own personal version of EMACS, typing a single control character produces {\bf } and leaves the cursor just before the }. Typing {\bf bold} takes only two extra keystrokes (the second to move past the }) instead of six. This special EMACS command, together with a bunch of similar ones, saves me a lot of work. If you can’t do this with an editor available on your computer, you should complain. A good text editor can also help you avoid errors. The easiest error to make in your input is to leave out a curly brace. TEX expects braces to come in matched pairs and gets very unhappy when they don’t. With my editor, a single keystroke generates a pair of braces, so I can’t forget to type the closing }. There’s also a command that checks the entire file for unmatched braces, in
CHAPTER 1. GETTING STARTED
7
case I accidentally deleted a single brace. Adding these commands to my editor eliminated 90% of my TEX errors.
1.2
Starting and Ending
Your input file starts with commands to tell TEX how you want your document formatted—how wide the text should be, how sections are to be numbered, and so on. You may eventually want to decide all this yourself, but to start out, you’ll choose some standard format. The first part of the format is called the page layout. Your own computer installation will have its own selection of page layouts, but there should be a standard one called normal. To use it, you begin your file with the command \pagelayout{normal} The \pagelayout command specifies the dimensions of things on the page, such as the height and width of the text. The second part of the format that you must specify is called the document style. It determines such things as how sections are numbered and where figures are placed. Two standard document styles are report and article. The major difference between them is that the largest division in the report style is the chapter, each chapter starting on a new page, while the largest division in the article style is the section, where a section need not start on a new page. Both styles have sections, subsections and subsubsections. To choose the article document style, the second command in your file will be: \documentstyle{article} You can, of course, obtain the report style by typing report instead of article. The \pagelayout and \documentstyle commands are then followed by a \begin{document} command. After this comes the actual text of the document. The file ends with the command \end{document} The \begin{document} and \end{document} will make more sense to you later. For now, just remember that they have to be there, and concentrate on the important stuff—the text that generates the printed output. So, you just need to know that your file looks like this: \pagelayout{normal} \documentstyle{article} \begin{document} ... your text goes here ... \end{document}
CHAPTER 1. GETTING STARTED
1.3
8
Typing Simple Text
Producing simple text is easy; you can pretty much type what comes naturally. The rest is done for you. For example, the preceding two sentences were obtained by typing Producing simple text is easy; you can pretty much type what comes naturally. The rest is done for you. TEX ignored how many spaces I put between words—it treats any number of consecutive characters like a single . It also considers a to be the same as a and does its own line breaking. A new paragraph is begun by leaving one or more blank lines—in other words, by any sequence of and characters containing at least two ’s. A new paragraph is normally indented, but the indentation can be suppressed by typing \noindent at the beginning of the paragraph. Below is a list of other things that come up frequently in simple text. Quotes: Double quotes are produced by typing two ‘ characters for the left quotes and two ’ characters for the right quotes. For example, typing ‘‘quote’’ produces “quote”. You get single quotes, as in ‘single’ by typing single ‘ and ’ characters, as in ‘single’. The observant reader will note that I use the logical rather than the conventional method of mixing quotation marks and punctuation, writing “this”, and not “this.” “This”, being my own personal preference, is not a LATEX policy. You can type ‘‘this’’, or ‘‘that,’’ to produce “this”, or “that,” as you prefer. Dashes: TEX provides three sizes of dash: -, –, and —. They are produced by typing one, two, or three - characters, respectively, as in three sizes of dash: -, --, and ---. A minus sign, as in 4 − 2 = 2, is not the same as a dash. If you’re using a minus sign, then you’re writing a mathematical formula and you should refer to Section 2.3 on page 42. Space after periods: TEX tries to put a little extra space after a sentenceending period, but not after a period that doesn’t end a sentence. However, TEX is rather simple-minded, and it thinks that a period ends a sentence unless it follows an upper-case letter. This works most of the time, but look what happens if you type: Euclid et al. proved I + I = II. TEX produces
Meanwhile ...
CHAPTER 1. GETTING STARTED
9
Euclid et al. proved I + I = II. Meanwhile . . . thinking that the period after al ends a sentence, and the period after II doesn’t. To force TEX to do the right thing, you should type: Euclid et al.\
proved ... II\mbox{}.
Meanwhile ...
The \ tells TEX to make an ordinary space, and the \mbox{} separates the upper-case I from the period. Special characters: All of the ordinary printing characters listed on page 6 produce more or less what you’d expect them to. For example, typing + produces +, and typing [ produces [ . However, the ten special characters # $ % & ~ _ ^ \ { } have special meanings for TEX. The following six can be produced by typing a \ in front of them: # $ % & { } For example, typing \$20 yields $20. The other four special characters are used so seldom in text that LATEX doesn’t provide such a simple method of generating them. How to obtain them, as well as a host of other symbols, is explained in in Sections 2.1.3 and 2.3.2. Preventing line breaks: TEX produces nice, neat, justified paragraphs from your ragged input, hyphenating words if necessary. Sometimes it breaks a line where you don’t want it to. For example, it looks bad if I refer to page 28, and the line is broken between the “page” and the “28”. You can prevent this from happening by typing page~28. The ~ acts like a single , except that it prevents TEX from breaking the line there. Don’t leave a space before or after the ~ ; it will produce an extra space in the document. Comments: Sometimes you may want to leave little notes to yourself in the input file that you don’t want printed. Typing % tells TEX to ignore everything else on the current line, including the at the end. For example, you might type as what’s his name% Look up the name! showed in 1976. to produce as what’s his nameshowed in 1976. However, the next time you’ll remember that the % causes TEX to ignore the as well as the text, and you’ll type name % . You’ll also remember this if you ever want to end a line in your input file without putting space in the output.
CHAPTER 1. GETTING STARTED
10
Now that you know how to enter ordinary text, you’ll want to structure your text in units—sections, subsections and subsubsections if you’re using the article style, or chapters, sections, subsections and subsubsections if you’re using the report style. I’ve already mentioned that this chapter was begun by typing the command \chapter{Getting Started} and you can probably guess that the following section was begun with \section{Commands} The \subsection and \subsubsection commands are similar. You can find more information about these and other sectioning commands in Section 2.5 on page 66. Warning: Don’t try putting any LATEX commands in the name of a chapter or (sub[sub])section before reading Section 2.5. There are still a few more things you’d probably like to add, such as a title page and a table of contents. After finishing this chapter, you’ll be able to find and read the sections in later chapters that tell you how. Although you’ll eventually want to do that, you should probably start out the easy way—by copying from a friend. Given a LATEX input file, it’s pretty simple to figure out which commands create the title page, and what you have to change to generate your name instead of his. In fact, the friendly people who install LATEX on your computer system should also provide some sample input files for you to browse through.
1.4
Commands
To type fancier text, you have to issue LATEX commands. Before learning about what the commands do, you should learn their syntax and taxonomy. The material in this section may seem abstract and unmotivated, but knowing it will make it easier for you to understand how commands work. Your effort now will be amply rewarded in a little while. I will illustrate the general rules by using some specific commands as examples. Don’t worry about what these commands do; for now we’re just interested in the syntax. The commands themselves are explained in later chapters.
1.4.1
Command Names and Arguments
A LATEX command begins with the command name, which consists of a \ followed by either (i) a string of letters or (ii) a single nonletter. Here are some of the commands you’ve encountered so far. \bf
\mbox
\noindent
\begin \$
CHAPTER 1. GETTING STARTED
11
Another useful command is \today, which causes LATEX to produce today’s date—that is, the date on which you ran your file through LATEX. Here’s how I can tell you that this edition of this chapter was generated on March 4, 2005. Here’s how ... was generated on \today. Most command names are of the first kind, having of a string of letters. TEX regards lowercase and uppercase letters as completely different, so \large, \Large and \LARGE are three different commands. Most LATEX command names have only lowercase letters; the exceptions are generally like the three “large” commands, where uppercase letters are used to distinguish otherwise identicallyspelled commands. (As you’ll see in Section 2.1.2, \LARGE is larger than \Large, which is larger than \large.) If you write \$one, TEX knows that this is a \$ command followed by the text one because the only command names having nonletters are two-character names like \$. However, if you write \todayone , TEX wouldn’t think that this is the command \today followed by the text one . Instead, it regards it as a command named \todayone, and since there’s no such command, it will report an error. You have to tell TEX where a command name ends by putting a nonletter after it. You can write \today1 or \today one or \today-one, since 1, and - are nonletters. The most common way to end a command name is with a , so TEX ignores all spaces following a command name. However, this can cause trouble, since typing \today
was a sunny day.
produces March 4, 2005was a sunny day. Leaving more spaces after the \today won’t help—TEX treats any series of spaces the same as a single space. You can get TEX to stop ignoring spaces by typing {}. I can tell you that March 4, 2005 was a sunny day by typing either of the following: \today{} was a sunny day \today {} was a sunny day. The special character commands like \$ and \# are exceptions to this rule; spaces are not ignored after these commands. Typing \$ .99 produces $ .99. Many commands have arguments, which are enclosed in curly braces. For example, when you type \mbox{xyz}, xyz is the argument of the \mbox command. Typing \mbox{} gives \mbox a null argument. If a command takes more than one argument, each one is enclosed by curly braces. \parbox is a command taking two arguments, so you type
CHAPTER 1. GETTING STARTED
12
\parbox {2in}{A Parbox} to give a \parbox command whose first argument is 2in and whose second argument is A Parbox . Don’t worry about what these commands mean; just observe the syntax. Spaces after the command name are ignored, but you must not leave any spaces between arguments. Some commands have one or more optional arguments, an optional argument being enclosed in square brackets. The \parbox command has an optional argument that may appear before the other two, so \parbox [t]{2in}{A Parbox} has the optional argument t and with the same two mandatory arguments as before. The place where an optional argument comes is fixed; for \parbox it can come only right after the command name. TEX will be very confused if you try to put it somewhere else, like between the two mandatory arguments. There should be no space between any two arguments, whether they’re optional or mandatory. Some LATEX commands have a variant form indicated by writing a * at the end of its name. The variant form is also called the *-form. For example, there’s a \chapter* command that works just like the \chapter command except that it doesn’t add a chapter number or a table of contents entry. 44 % of the cases. You now know how to write commands in the normal 99 100 Let’s learn what surprises the other .56% has to offer. Optional arguments provide two kinds of surprises. Consider a command like \item that has one optional argument and no mandatory ones, so you can type either \item[foo] or \item foo. In the first case foo is the argument of the \item command, and in the second case it is the text that follows the command. Now, what happens if we want to type an \item command followed by the text [foo]? If we type \item [foo], TEX ignores the space and considers foo to be the argument. To prevent this, we must type \item{}[foo] or \item {}[foo]. The {} tells LATEX to stop looking for an optional argument as well as telling it to stop ignoring spaces. Now suppose we want to make not foo but [foo] the optional argument of the \item command, with the square brackets as part of the argument. If we type \item[[foo]], LATEX will take [foo to be the argument, enclosed by the first [ and the first ], and it will regard the second ] as part of the text following the \item[[foo] command. Once again, curly braces come to the rescue. If we type \item[{[foo]}], then LATEX will interpret {[foo]} as argument; the extra curly braces will do no harm. This trick must be used whenever there’s a [ in the text that could be mistaken for the left bracket delimiting an optional argument. The *-commands provide a related surprise. Although we think of the * as part of the command name, TEX actually regards it as an optional argument. Unlike the ordinary optional arguments that are enclosed by square brackets,
CHAPTER 1. GETTING STARTED
13
you can leave spaces between the * and the following argument. Thus, any of the following is acceptable:
CHAPTER 1. GETTING STARTED
14
\chapter*{Introduction} \chapter* {Introduction} \chapter *{Introduction} If a command with no mandatory arguments has a *-form, then we have the same problem, and the same solution, as with the \item command. One such command is \\ . To follow the plain \\ command with a * as part of the text, we must use a {}—typing \\ {}* instead of \\ * . LATEX would interpret \\ * as the *-form of the command. These problems are actually quite rare. Most of the time, you just have to know the following rules. • Command names begin with \. • Spaces following a command name are ignored, except for the specialcharacter commands like \$ . Use {} to make TEX stop ignoring spaces. • The variant form of a command has a * at the end of the name. • Mandatory arguments are enclosed by curly braces {}. • Optional arguments are enclosed by square brackets []. • There must be no spaces between arguments. There are a few minor exceptions to some of these rules, but you’ll hardly notice them. They are all as benign as the exception to the first rule that you’ve already encountered: the ~ command. To avoid rare but unpleasant surprises, you should also remember these exceptional situations. • Use {} if a [ can be mistaken for the beginning of an optional argument. • A ] that’s part of an optional argument must be inside braces. • Use {} if a * can be mistaken for a variant-command indicator. There’s one more little thing you might like to know about command arguments. It’s not important, but it can save you a bit of typing. An argument need not be enclosed in braces if it consists of either a single command name or a single letter or digit. If the second argument of a \parbox command is the single command \today, then you can type either of the following: \parbox {2in}\today \parbox {2in}{\today} However, if the argument is \mbox{\today}, then you must use braces because the \parbox’s argument then consists of a command name plus argument rather than just a command name.
CHAPTER 1. GETTING STARTED
1.4.2
15
The Taxonomy of Commands
There are five classes of LATEX commands. Understanding the differences among these classes will enable you to use the commands properly and will help you to remember individual commands. Text-Producing Commands A text-producing command places a piece of text in the document. The actual text is usually specified by an argument, as in the \mbox command. There may be other arguments that specify how the text is to be formatted; the argument that specifies the text is almost always the last argument. Sometimes, as in the \today command, there is no text-specifying argument because LATEX decides what text to insert. An important subclass of text-producing commands are the space-producing commands. The “text” they produce consists of blank space, an argument specifying how much blank space. Most text-producing commands put their text at the current position in the document. There are two cases in which the text may appear elsewhere: • Footnotes appear at the bottom of the page. • Marginal notes are placed in the margin, like the one on the right. Figures and tables may also be moved from where they appear in the input file, but they’re not made with text-producing commands. Environments Text-producing commands are designed for formatting short pieces of text. To format a large piece, you use an environment. An environment begins with a \begin command and ends with a matching \end command. The above itemized list was produced with an itemize environment, which I typed as follows. \begin{itemize} \item Footnotes appear ... \item Marginal notes ... \end{itemize} The environment is begun with the \begin{itemize} command and is ended with the \end{itemize}. The stuff between these two commands is not an argument. Don’t worry now about what goes between the \begin and the \end commands; just remember that the itemize environment has no arguments. Some environments do have arguments. These arguments appear as extra arguments to the \begin command. For example, there’s an array environment, used to make arrays in mathematical formulas, with a single mandatory argument. Typing
This is an example of a marginal note.
CHAPTER 1. GETTING STARTED
16
\begin{array}{llr} ... \end{array} creates an array environment whose argument is llr . Environment arguments can be mandatory or optional. Just remember that the environment’s arguments become additional arguments to the \begin, and all the rules given in Section 1.4.1 apply. Environments can be nested in the obvious way. For example, figures are made by the figure environment. To make a figure that contains an itemized list, you type: \begin{figure} ... \begin{itemize} ... \end{itemize} ... \end{figure} In fact, your entire document is produced by a document environment—that’s what the \begin{document} and \end{document} commands are for. Each environment has rules about what other environments may appear inside it. For example, the document environment can’t contain another document environment, so you’ll only have one \begin{document} command in your file. \begin and \end commands have to come in matched pairs, just like curly braces. Forgetting an \end is a common error that your text editor should help you avoid. Mine produces a matching \begin–\end pair with a single command. A few environments have *-forms. For example, if you’re producing twocolumn output, the figure environment makes a figure that’s one-column wide and the figure* environment makes a two-column-wide figure. To use the figure* environment, you type \begin{figure*} ... \end{figure*} Notice that the * becomes part of the environment name. It does not act like an optional argument, as in ordinary commands. Declarations A declaration is a command that causes TEX to change the way it’s doing things. For example, the \bf command tells TEX to start using boldface type, as I just did by typing ... using \bf boldface type, as I just did by ... Note how TEX typeset everything after the \bf command in boldface. How did I get TEX to stop using the bold typeface and revert to its normal typeface? For the answer, you first have to understand the concept of nesting. As TEX processes your input, it can best be thought of as traveling through the levels of a subterranean building. TEX starts out at street level. Every time it encounters a { or a \begin , TEX goes down a flight of stairs to the next lower level, and every time it encounters a } or an \end it goes up a flight of
CHAPTER 1. GETTING STARTED
17
stairs to the next higher level. Thus, it remains underground from the time it hits your \begin{document} command until it reaches the \end{document}. Every time TEX descends a flight of stairs, it paints on them what led it down those steps, painting either a { or a \begin command, and covering over anything that what was previously painted there. When it next ascends those steps, it must have been directed to do so by the corresponding } or \end . If it had painted \begin{itemize} on the steps, it can only be directed up them by an \end{itemize}, not by a } or an \end{figure}. Thus, you can’t type \begin{figure} {
... \end{figure} } is wrong!
because the \end{figure} would cause TEX to try walking up a flight of steps painted with a { . The braces that enclose an argument are somewhat different from other braces. In almost all cases, the braces enclosing an argument of a LATEX command cause TEX to go down a flight of steps to start processing the argument, and back up the steps when it’s through. So, when TEX encounters the command \mbox{arg}, it’s at a lower level when processing the arg than it is before and after the command. As explained in Section 3.1.1, when you define your own commands, you can choose whether or not the argument braces should cause TEX to change levels. A declaration normally stays in effect as long as TEX remains at or below the current level. As soon as TEX returns to the next higher level, it forever forgets about the declaration. The region in which a declaration is in effect is called its scope. We can produce a single bold word by typing {\bf bold} because the scope of the \bf declaration ends with the right brace. The following input shows how TEX reacts to a \bf declaration, assuming that it begins when TEX is producing output in a Roman typeface. This is Roman. {Still Roman. \bf Start boldface \begin{itemize} ... boldface ... \end{itemize} Still boldface.} Back to Roman. {Still Roman.} One declaration can be superceded by a countermanding declaration. The \bf declaration in our example superceded a prior declaration that told TEX to use a Roman typeface. The \bf declaration can in turn be superceded by another typeface declaration, such as \it , which tells TEX to use an italic typeface. Adding an \it command to the previous example gives the following. This is Roman. {Still Roman. \bf Start boldface \begin{itemize} ... boldface. \it Start italic ... \end{itemize} Back to boldface.} Back to Roman. {Still Roman.}
CHAPTER 1. GETTING STARTED
18
Note that the \end{itemize} ends the scope of the \it command, but leaves TEX within the scope of the \bf . Any declaration can be used as an environment—you just remove the \ to get the environment name. For example, you can type \begin{bf} A bold sentence.\end{bf} The environment is the scope of the \bf command, so this is equivalent to typing {\bf A bold sentence.} You should use the bf environment when one or more paragraph are all in boldface, since you’ll probably find it hard to keep braces matched properly when they’re far apart. Some environments make changes within them that supersede declarations made outside the environment. These will be mentioned when the environment is explained. Some declarations are global, meaning that they remain in effect even when TEX climbs above its current level. These are generally declarations whose effects you would not expect to end with the current environment. For example, page numbering is outside the province of environments and normal scoping, so a declaration like \pagenumbering{roman}, which causes LATEX to number the current page i, the next page ii, and so on, is global. Page-Breaking and Line-Breaking Commands This is a small class of commands that tell TEX where to end a page or a line, or where not to end it. Indirect Commands This class is a mixed bag of commands that have one thing in common: they don’t have any direct effect on TEX’s output. For example, Section 2.5 describes an indirect command for adding a table of contents entry with the current page number. Executing it has no effect on what is produced during the current execution—TEX probably generated the table of contents before seeing the command. However, the next time you run your file through LATEX, the entry will magically appear in the table of contents. An indirect command is sometimes placed right in the middle of a paragraph, usually between words. When this happens, you’re faced with the question of whether to leave a space on each side of the command, or to attach the command to one of the two adjoining words. Usually it makes no difference. However, sometimes you may wind up with an extra space between the words, or, less often, with no space between them. When that happens, it will be obvious what you should do to correct the situation. However, by the time you see your output, you’ll probably have forgotten all about the indirect command and all
CHAPTER 1. GETTING STARTED
19
you’ll see is the extra space. When that happens, remember to look at the input to see if there’s an indirect command causing the problem. An extra space is removed by attaching the command to either of the adjacent words. A missing space is usually corrected by adding a space before the command.
1.5
Modes
When TEX is processing your input text, it is always in one of three modes: • Paragraph mode • Math mode • Left-to-right mode, called LR mode for short. TEX changes mode only when it goes up or down a staircase to a different level, though not all level changes produce mode changes. Mode changes occur only when entering or leaving an environment, or when TEX is processing the argument of certain text-producing commands. The description of each environment and text-producing command describes whether it causes a mode change. Paragraph mode is the most common; it’s the one TEX is in when processing ordinary text. In that mode, TEX breaks your text into lines and breaks the lines into pages. TEX is in math mode when it’s generating a mathematical formula—you’ll learn about that in Section 2.3. Before getting to LR mode, I must explain a bit more about how TEX processes text. As I explained in Section 1.1, the input to TEX is a string of characters. TEX’s output is a sequence of pages, each page consisting of a sequence of lines and vertical spaces, and each line consisting of a sequence of characters and horizontal spaces. To distinguish the printed representation of a character from the input character, I will call the former a glyph. Thus, the character t in your input file might generate any one of the following glyphs in the printed output. t t
t
t
In paragraph mode, TEX translates each ordinary printing character into the corresponding glyph and translates and characters into horizontal spaces—except when they end a paragraph. TEX regards each string of glyphs as a word, and it breaks the text into lines of words, with space between them. If necessary, it will hyphenate words to keep the spaces between them from getting too large. Text-producing commands generate glyphs and/or spaces. Typing \today today (March 4, 2005) produces exactly the same sequence of glyphs and spaces as typing March 4, 2005
CHAPTER 1. GETTING STARTED
20
TEX could start a new line between the day and the year. However, some textproducing commands produce a box , which is a chunk of text that TEX treats exactly like a single glyph. One such command is \mbox. Typing \mbox{no way} tells TEX to make a box with “no way” inside it. Just looking at the output, there’s usually no way of knowing that I used an \mbox command instead of simply typing no way . However, the output is a lot different to TEX. TEX regards the box produced by a \mbox command as if it were a single glyph, so the command \mbox{no way} produces something that looks to TEX like no way There’s no way that TEX can split no way across two different lines, just as there is no way for it to split the glyph A into two pieces. So, if you want keep TEX from splitting something across lines, just use the \mbox command to put it in a box. Now let’s return to LR mode. The canonical example of when TEX is in LR mode is while it is processing the argument of an \mbox command. In LR mode, as in paragraph mode, TEX considers the output that it produces to be a string of words with spaces between them. However, unlike paragraph mode, TEX keeps going from right to left; it never starts a new line in LR mode. Even if you put a hundred words into an \mbox, TEX would keep typesetting them from left to right inside a single box, and then complain because the resulting box was too wide to fit on a line. TEX is in LR mode when it starts making a box with an \mbox command. You can get it to enter a different mode inside the box—for example, you can make it enter math mode to put a formula in the box. There are also several text-producing commands and environments for making a box that put TEX in paragraph mode. The box made by one of the commands or environments will be called a parbox, named after \parbox, the exemplar of these commands. When TEX is in paragraph mode while making a box, it is said to be in inner paragraph mode. Its normal paragraph mode, which it starts out in, is called outer paragraph mode. There are some things, like making footnotes, that TEX can do in outer paragraph mode but not in inner paragraph mode. I’ll warn you about them as we go along. While we’re on the subject of boxes, I should mention that sometimes you’ll want to make a great big box and stick it on its own line. If you leave a blank line before and after the box, TEX will view it as if it were a one-character paragraph. However, remember that you must use a \noindent command if you don’t want the paragraph indentation.
CHAPTER 1. GETTING STARTED
1.6
21
Getting Fancier
Section 1.3 told you how to produce simple output. Most of the rest of this manual is about how to produce fancier output. The purpose of this section is to help you find what you need. The first place to look for something is in the table of contents. Suppose you want to write theorems and would like an environment to format them for you. Scanning through the table of contents quickly reveals that Section 2.2.1 is the place to look. However, you shouldn’t go right there. The information in this manual is tree-structured. Section 2.2.1 is a subsection of Section 2.2.1, which is a subsection of Section 2.2. Before reading Section 2.2.1, you should read the introduction to Section 2.2 and the introduction to Section 2.2.1. The introduction to a section is everything from the beginning of the section until the beginning of its first subsection, so the introduction to Section 2.2.1 starts at the beginning of that section and ends at the beginning of Section 2.2.1.1. To use a command or environment, you may have to understand other things about LATEX. I assume that you know everything in this chapter—especially the material in Section 1.4 and 1.5. When knowledge of other material is required, I will tell you where to find that material. The introduction to each section tells you what’s in that section. If you think you might need a paragraph-making environment, but don’t know what kind, you should read the introduction to Section 2.2. If the table of contents doesn’t help, you might can try the index. However, the index is designed to help you find information about a specific topic like footnotes, not to tell you what features LATEX provides. Chapter 2 contains the more elementary commands—the ones you’re likely to use right away. The environments and commands of this chapter generally allow LATEX to handle the formatting, under the control of the document style. Chapter 3 contains commands and environments that allow you to control exactly how things are formatted, as well as commands for changing documentstyle parameters. Chapter 4, which discusses two-column output, should really be part of Chapter 3. However, I wanted to show you an example of two-column output, and it’s hard to produce just part of a chapter in that format. Chapter 5 describes commands that you won’t need until you start producing larger documents. These include commands for splitting your input into several files, and cross-referencing commands. Finally, Chapter 6 will help you cope when something goes wrong.
1.7
Running LATEX
You now know how to prepare an input file; it’s time to learn how to run LATEX on that file. Let’s suppose that you’ve created an input file named myfile.tex, you’ve checked that there are no unmatched curly braces, and you’re ready to
CHAPTER 1. GETTING STARTED
22
\pagelayout{normal} \documentstyle{article} \begin{document} Look at this \begin{simple} error. And at this \parbox{nasty} one. Is there a little town in Wales called Llegharffysloughlarwaghaurllysgnforghallyl? \end{document} Figure 1.1: The file myfile.tex. run it and see what happens. I’d like to tell you that your file will sail through LATEX and produce beautiful output, but the chances of that happening on the first try are rather slim. Your input file will almost certainly contain errors, so you must be prepared to deal with them. To give you some idea of what you’ll run into, we’ll try the short input shown in Figure 1.1. Note that it has two errors: there’s a spurious \begin{simple} command, and the \parbox command is missing one of its mandatory arguments. The first thing we must do is start the LATEX program. On my computer, I , but you may have to type something else on yours. do this by typing latex It all depends upon what operating system you’re using. LATEX starts by typing **, which is its way of asking for the name of the input file. Since our file is . LATEX then types out named myfile.tex, we respond by typing myfile the following bunch of junk. (It may type something a little different on your computer.) This is TeX, Tops-20 Version 1.0 (preloaded format=lplain 84.02.07) (PS:MYFILE.TEX.4 LaTeX Version 2.0 - Release 7 Feb 84 (PS:NORMAL.PLO.2 Page Layout ’normal’ -- version of 21 Mar 1984. ) (PS:ARTICLE.STY.65 Document Style ’article’. Version 1.0 - released 8 Jun 1984 ) No file myfile.aux.
We needn’t worry about any of this, it’s just LATEX’s way of saying hello. The first time you run LATEX on your system, it’s a good idea to check that the version number it types is 2.0. If it isn’t, then the version of LATEX you’re running is different from the version described in this manual, and you should ask a local expert if there are any important changes that you should know about.
CHAPTER 1. GETTING STARTED
23
The ‘No file myfile.aux’ message appears the first time we run LATEX on myfile.tex. Afterwards, a file named myfile.aux will appear in our directory. As explained in Section 5.3, the file myfile.aux is used to implement LATEX’s automatic cross-referencing feature. Since we’re not doing any cross-referencing, this file is totally useless. If we don’t delete it, then the next time we run the file through LATEX, that message will be replaced by: (PS:MYFILE.AUX.1 )
The next thing that LATEX types is much more important; it’s the error message for the spurious \begin{simple} command. Before we look at it, I should explain the precise relation between LATEX and TEX. Most of the commands that you use are LATEX commands, which means that they were defined by me in terms of more primitive TEX commands. LATEX makes some effort to catch errors, but it won’t catch them all. (It would slow LATEX down too much to do a lot of error checking.) If LATEX misses an error, TEX will probably catch it. Unfortunately, it will appear to TEX as an error in one of the TEX commands that I wrote that implements the LATEX command you typed. Keeping all this in mind, let’s look at what’s typed out when the \begin{simple} command is encountered. LaTeX error. See LaTeX manual for explanation. Type H for immediate help. ! Environment simple undefined. \@latexerr ...for immediate help.}\errmessage {#1} \endgroup l.4 Look at this \begin{simple} error. ?
The first two lines of this message tell us that we’re in luck—the error was detected by LATEX before any lower-level TEX errors occurred. The next line, beginning with the ! , is called the error indication line. It tells us what the problem is. Section 6.2 gives a list of all LATEX-generated error indications, and tells you how to find out exactly what caused them. In this case, the problem is simple—there’s no such environment as simple. After the error indication line, there is a bunch of stuff that will be quite meaningless to you and should be ignored. (If you’re curious, you’ll have to read The TEXbook to find out what it all means.) After it comes a pair of lines called the error locator, followed by a line containing only a question mark. In this message, the error locator begins with l.4. The error locator tells us how much of our input TEX had read when the error was discovered. The l.4 says that the error was found when processing the fourth line of our input. Following the l.4, TEX types input line four, split into two lines. Where the split occurs tells us exactly how far TEX had gotten when it discovered the error—the first line showing what TEX had read and the second line showing what it hadn’t. In this case, the error was discovered right
CHAPTER 1. GETTING STARTED
24
after TEX read the \begin{simple} command. An error locator might consist of a single line followed by a blank line, meaning that TEX had read everything on the line before finding the error. The error locator might also be completely blank, indicating that TEX discovered the error when it was processing a blank input line. The final line of the message, the one consisting of the question mark, tells us that TEX has stopped and is waiting for us to tell it what to do. We’ll accept . It responds with the following helpful LATEX’s offer of help and type H message. Your command was ignored. Type I to replace it with another command, or to continue without it. ?
The question mark at the end again tells us that TEX has stopped and wants us to type something. Since there’s nothing that we want to replace the \begin{simple} command with, we’ll just type and let LATEX proceed. The next message we get is caused by the error in the \parbox command. ! Missing number, treated as zero. n <argument> n asty \@iparbox ...true $\vcenter \fi \fi \fi {\hsize #2 \@parboxrestore #3}\if@pbo... l.5 And at this \parbox{nasty} o ne. ?
The absence of the ‘LaTeX Error’ at the beginning tells us that the error was detected by TEX instead of LATEX. TEX’s error-handling mechanism doesn’t know anything about LATEX commands, so we can’t expect much help from the the error indicator line. Some common TEX error indicators and their causes are listed in Section 6.3, so you can try looking there for help. You can also type H and see what advice TEX gives you, but most of the time it won’t be too helpful. Right now, let’s see what we can discover by ourselves. As usual, we can ignore everything between the error indicator and the error locator. The error locator tells us that the error was detected right after TEX read the o that followed the \parbox command. As this example shows, TEX can go past the point where the real error is before it discovers that something is wrong. Fortunately, it didn’t go very far, and we have the incorrect \parbox command displayed before us. Unfortunately, there’s nothing we can do about it now. At this point, you may be tempted to stop LATEX, correct the errors, and try again. Don’t. You should always let LATEX go as far as it can in your file before giving up. Whenever you find one error there are probably several more
CHAPTER 1. GETTING STARTED
25
beyond it, so you should find as many as you can each time you run LATEX. To . We then get the following error message. let LATEX continue, we type ! Illegal unit of measure (pt inserted). n <argument> n asty \@iparbox ...true $\vcenter \fi \fi \fi {\hsize #2 \@parboxrestore #3}\if@pbo... l.5 And at this \parbox{nasty} o ne. ?
Once again, this message was generated by TEX rather than LATEX, so we can ignore everything but the error locator. It tells us that TEX hasn’t gotten any further; it’s at the same place in our input where it was the last time. TEX found something else wrong when processing the incorrect \parbox command. Undaunted, we type and carry on. TEX next types the following message. Overfull \hbox (68.3333pt too wide) in paragraph at lines 5--5 []\tenrm nastyo \hbox(6.19444+1.94444)x0.0 .\hbox(0.0+0.0)x40.0 .\tenrm n .\tenrm a .\tenrm s .\tenrm t .etc.
This is a warning message rather than an error message. There’s no questionmark line, so TEX is still running. The fact that it’s warning us about something at “lines 5--5” gives us a clue that the problem was probably caused by the bad \parbox command, and the presence of the word “nasty”, the argument of that command, in the message confirms our suspicions. TEX is telling us that our incorrect \parbox command produced some bad-looking output, which isn’t surprising. The next thing that TEX types is the following: 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+1.94444)x340.0, glue set - 1.0 .\hbox(0.0+0.0)x40.0 .\tenrm I .\tenrm s .\glue 3.33333 plus 1.66666 minus 1.1111 .\tenrm t .etc.
CHAPTER 1. GETTING STARTED
26
This is also a warning—in fact, the same kind of “Overfull \hbox” warning we saw above. You’ll see a lot of these warnings. They happen when TEX can’t find a good way to break a paragraph into lines, so it gives up and leaves a line sticking out in the margin. Section 3.3.2 on page 87 tells you how to deal with this problem. Another warning you’re likely to see is an ‘Underfull \vbox’ message. It occurs when TEX can’t find a good place to start a new page. You needn’t worry about this warning, but you should check Section 3.3.3 on page 90 if, when you look at the output, you’re not happy with TEX’s page breaking. Other warning messages are explained in Chapter 6. While we’ve been pondering this message, LATEX has continued processing the input file, printing: [1] (PS:MYFILE.AUX.2)
TEX typed the [1] right after producing the first page of output. Had there been a second page, it would have typed [2] immediately after that page was produced. Of course our tiny file produced only a single page, but you should pay attention to those numbers when you’re running LATEX; they’ll help you correlate the error messages on your terminal with the printed output. The ‘(PS:MYFILE.AUX.2)’ can be ignored, but it does tell you that TEX has reached your \end{document} command and is now finishing up. TEX’s final words to us are: Output written on PS:MYFILE.DVI.2 (1 page, 392 bytes). Transcript written on PS:MYFILE.LST.2.
They tell us that the output was written on a file called myfile.dvi, and that everything TEX typed out on our terminal plus some additional information was also written on the file myfile.lst. We didn’t bother writing down all the error information that was typed because it will be waiting for us on this “.lst” file. We’ve finished running LATEX, but we still haven’t seen our output. At the moment, it’s just sitting on the file myfile.dvi. We have to run some other program to actually print it. Exactly how this is done depends upon your particular computer system, so you’ll have to ask a local expert what to do next. In this example, things went pretty smoothly. Even though there was a nasty error (the missing \parbox argument), we could get TEX to continue past it by typing after the two error messages. A single error can easily generate five or ten error TEX messages. Sometimes TEX gets so confused by an error that it either won’t go any further, producing error after error with the same error locator, or else it starts thinking that almost everything is an error. If that happens, you’ll have to correct the error and rerun TEX in order to get any further. The best way to stop LATEX after an error is to type I \stop in response to its question mark. If that just produces another error message,
CHAPTER 1. GETTING STARTED
27
then you should type X ; this will always cause TEX to quit. TEX will produce a .dvi file with the output that was generated so far, as well as a .lst file with all the error messages. TEX may stop without any error message, simply typing a *. The most likely cause of this is a missing \end{document} command, but other errors can also . If that doesn’t work, have this result. If it happens, you should type \stop you’ll have to stop TEX by whatever means your operating system provides for halting uncooperative programs. Even experienced LATEX users are sometimes mystified by an error. When that happens to you, the most important thing to remember is
DON’T PANIC. Instead, turn to Chapter 6 to find out what to do.
1.8
Some Words of Advice
A major goal of LATEX is to allow you to change the way your document is formatted by changing a few declarations without having to change the text itself. However, no matter how much one tries, changing the format may require some changes to the text. You can change the width of your lines with a single declaration, but, if you make the lines too narrow, you may have to change some things that no longer fit on a single line. The proper use of LATEX allows you to minimize the number of changes that have to be made to your text when you reformat it. When you tell LATEX how to print a recipe, you’ll probably specify how far the list of ingredients should be indented from the left margin. You could give the distance in inches, but you might have to change that distance if you changed the line width. A better method would be to specify the distance as a certain fraction of the line width, so the same LATEX commands would produce the right indentation regardless of the line width. An even better way to avoid having to change the text of your recipes when changing the format is to define a \recipe command, using the \newcommand command described in Section 3.1.1. That way, you just have to change the definition of the \recipe command to change how every recipe is printed; you never have to change the individual recipes. Whenever your document contains a special class of objects like recipes, you should define a command to generate them. This will usually save you a lot of typing, since you don’t have to repeat the formatting commands every time. However, even if it doesn’t, you should still define a command to generate these objects because that makes it easier to change how they are formatted. Defining a command \hoare so that
CHAPTER 1. GETTING STARTED
28
\hoare{P}{S}{Q} produces {P } S {Q} doesn’t save any typing. But, if you decide that there should be more space in the expression, so it looks like {P } S {Q} then only the definition of \hoare has to be changed; you don’t have to change every occurrence of the notation. The experienced LATEX user makes extensive use of its command-defining features. Another thing the experienced LATEX user does is avoid wasting his time and his computer’s time running LATEX over and over again with the same input. Documents, except for very short ones, are written a little bit at a time. You’ll naturally want to see LATEX’s output as you produce the input. However, after you write the first ten pages and get LATEX to print them for you, it’s silly to keep regenerating those ten pages every time you write some more input. It’s especially silly to wait while LATEX processes those ten pages again in order to find the errors in your new input. You should always run LATEX on new input by itself, without any of the old input. Only after there are no more errors in the new input should it be added to the old. If it’s fairly short, then the entire document might be processed by LATEX every time you add new text. For a larger document, you should use the methods described in Section 5.1 to avoid this reprocessing.
Chapter 2
The Basics This chapter describes the basic text-producing commands, environments and declarations. Most of these commands specify the logical structure of the text and leave the formatting to LATEX. However, commands for telling LATEX what typeface to use and how to do some simple formatting, like centering text, are also included. Remember that, as described in Section 1.4.2, any declaration can be used as an environment.
2.1
Changing the Typeface
As I explained in Section 1.5, TEX translates an ordinary printing character like A into a glyph. Whether it’s translated into the glyph A or the glyph A depends upon the typeface. You specify a typeface by giving the size and the style. For example, this sentence is printed in 10-point italic. The 10-point is the size, a point being a unit of length used by printers, and italic is the style. A typeface is also called a font.
2.1.1
Specifying the Type Style
Below is a list of the type styles available with LATEXand the declarations for obtaining them. They work like the \bf command for generating boldface, which you’ve already seen in Section 1.4.2. Note that, like \bf, the type-style declaration commands all have two-letter names. \rm: Roman. This is an example of the Roman typeface; it is the typeface ordinarily used by LATEX. \it: Italic. This is an example of the italic typeface. \bf: Boldface. This is an example of the bold typeface.
29
CHAPTER 2. THE BASICS
30
\sl: Slanted. This is an example of the slanted typeface. \sf: Sans serif. This is an example of the sans serif typeface. \sc: Small caps. This is an example of the small caps typeface. \tt: Typewriter. This is an example of the typewriter typeface. The \rm command may seem useless, since Roman is what you get when you don’t specify any other typeface. However, you can type {\rm word} to make just the “word” appear in Roman in the middle of a boldface or italic sentence. There’s one little trick you should know when using the italic and slanted fonts in order to produce the finest quality output. Examine closely the word didn’t , which I produced by typing {\it did}n’t. Notice how the slanting d of did bumps into the n of n’t . To prevent this, you have to add some extra space after did . The \/ command adds just the right amount of extra space. You type {\it did\/}n’t to produce did n’t , which looks much nicer. It’s a good idea to use the \/ whenever switching back from an italic or slanted typeface to an upright one like Roman. The one exception is that you shouldn’t put the \/ right before a period or comma. Warning: If you use a type-style-changing command in math mode, then the scope of that command should end before TEX “climbs the stairs” leading it out of math mode. What this means is that any style-changing command like \bf in a math formula should always be enclosed in curly braces that lie within the formula.
2.1.2
Specifying the Type Size
The Normal Type Size Printers specify type size in points, where 24-point type is twice as big as 12point type. The ordinary text of most books is, like this manual, set in 10-point type. It looks quite normal in a book, but you may find it rather small for your 00 own reports and papers—especially if they’re printed on standard 8 12 × 1100 paper. You might want to consider 11-point or 12-point type, illustrated in the following two paragraphs.
This paragraph is set in 11-point type. You can get LATEX to set your entire document in this size type by choosing an 11-point document style. This is done by specifying the 11pt substyle for the document style you’ve chosen. For example, you type \documentstyle{article,11pt} in place of the ordinary \documentstyle command to get the elevenpoint version of the article style, and similarly for the report style. Make sure that there are no spaces in the argument.
CHAPTER 2. THE BASICS
31
This paragraph is set in 12-point type. You can get your entire document set in this type size by choosing the 12pt substyle for the document style you’ve chosen. The 11pt and 12pt document substyles may change the line width and other parameters to produce a more aesthetically pleasing document. You shouldn’t judge these type sizes by these two paragraphs, since they were produced with parameters chosen for 10-point type. Instead of specifying a substyle as part of the same \documentstyle command, as in \documentstyle{report,12pt} you can make it a separate \documentstyle command, writing \documentstyle{report} \documentstyle{12pt} The main style command, in this case report, must come before the substyle command. Additional Type Sizes The document style defines the normal type size. LATEX provides the following commands for producing text with different type sizes within the document. Here is what they produce in a 10-point document style; they will usually produce correspondingly larger type in an 11-point or 12-point document style. \normalsize: This is an example of the normal type size. \large: This is an example of the large type size. \Large:
This is an example of the Large type size.
\LARGE:
This is an example of the LARGE type size.
\huge:
This is a huge type size.
\small: This is an example of the small type size. \footnotesize:
This is an example of the footnotesize type size. It is the type size normally used in footnotes.
\scriptsize:
This is an example of the scriptsize type size. It is the type size normally used in subscripts and superscripts.
\tiny:
This is an example of the tiny type size. It is the smallest type size provided.
CHAPTER 2. THE BASICS
32
Each of these size-changing declarations switches to the Roman type style. Thus, if TEX is currently using the \normalsize type size, we have: {\bf normal boldface {\large large Roman} back to normal boldface } Because the information needed to generate each typeface takes up valuable room inside TEX, not all type styles are available in all sizes. Different computer systems may provide a different selection of typefaces. However, all styles should be available in the \normalsize, \small and \large sizes. If you request a typeface that’s not available, LATEX will produce an error with the following error indication. ! Typeface not available. Warning: If you want to typeset one or more entire paragraphs in a different type size, then you must be sure to end the scope of the size-changing declaration after the blank line that ends the last paragraph in that size. For example, you should type \begin{large} Beginning of large typeface paragraph ... ... end of large typeface paragraph. \end{large} Omitting the blank line before the \end{large} command will produce funnylooking output. Warning: Don’t issue a size-changing command in math mode. If you want to use a different type size for an entire mathematical formula, then put the entire formula in the scope of the size-changing command. If you want part of a formula to be in a different type size, then use an \mbox in the formula and put the size-changing command inside the \mbox.
2.1.3
Accents and Special Symbols
Accents TEX enables you to generate any kind of accent you’re likely to need. Table 2.1 shows how to do it. The letter o is used in the table, but you can replace it with any other letter. These accents work properly with all the usual type styles except for the typewriter (\tt) style. They can’t be used in that style. The letters i and j need special treatment because they should lose their dots when accented—typing \’{i} produces ´ı . The commands \i and \j produce a dotless i and j , respectively, so typing \’{\i} gives ´ı .
CHAPTER 2. THE BASICS Type \‘{o} \’{o} \^{o} \"{o} \~{o}
to get o ` o ´ o ˆ o ¨ o ˜
33 Type \={o} \.{o} \u{o} \v{o} \H{o}
to get ¯o o˙ ˘o ˇo ˝o
Type \t{oo} \c{o} \d{o} \b{o}
to get o o o¸ o. o ¯
Table 2.1: Accents. Type \oe \OE \ae \AE
to get œ Œ æ Æ
Type \aa \AA \o \O
to get ˚ a ˚ A ø Ø
Type \l \L \ss
to get l L ß
Table 2.2: Foreign Symbols Symbols Table 2.2 shows how to make some of the special symbols used by Western languages other than English. These commands can appear in paragraph and LR modes. However, they won’t work when a typewriter (\tt) type style is in effect. There are a large number of mathematical symbols that can be used only in math mode. These are described in Section 2.3.2. TEX also provides five special symbols that can be used in any mode: Type \dag \ddag
2.2
to get † ‡
Type \S \P
to get § ¶
Type \copyright
to get c
Paragraph-Making Environments
This section describes LATEX environments for producing various kinds of paragraphs, used for quotations, poetry, etc. In all these environments, a blank line begins a new paragraph. This causes the appropriate amount of interparagraph vertical space to be inserted. The first line of a paragraph is indented in some environments, but not in others. The output generated by a paragraph-making environment starts on a new line, as does the output that follows the environment. Whether you should leave blank lines before and after the environment depends upon the logical structure of the document. Leave a blank line before the \begin command unless the environment is logically part of the same paragraph as the preceding text; leave a blank line after the \end command unless it is logically part of the same
CHAPTER 2. THE BASICS
34
paragraph as the following text. LATEX will automatically format the output to express this logical relationship. For example, it will put a normal paragraph indentation at the beginning of the following text if and only if there is a blank line after the environment. In some paragraph-making environments, like verse, you want to specify when to end a line and begin a new one. The standard command for telling LATEX to end a line is \\. Spaces before and after the \\ command have no effect. See Section 3.3.1 on page 86 for a complete description of this command, including variants for adjusting the interline spacing and preventing page breaking. The \\ command has both a *-form and an optional argument, so remember the anomalies discussed in Section 1.4.1. The \\ command separates lines; it is not used after the last line of the environment. Two successive \\ commands should never appear with no intervening text. To produce get a blank line, you must make a line with invisible text, as is produced by a \mbox{} command. A paragraph-making environment can be used only in paragraph mode, and TEX is in paragraph mode while processing it. Even in the centering and “flushing” environments of Section 2.2.3, in which you normally use the \\ command to end lines, TEX is in paragraph mode and will break a line for you if it’s too large. If TEX started in outer paragraph mode, then it’s still in outer paragraph mode inside the environment. Paragraph-making environments can be nested within one another, except where explicitly noted otherwise. Warning: Most of these environments should not be used in a parbox except in the minipage environment. The only ones that can be used in an ordinary parbox are the theorem environments of Section 2.2.1 and the centering and flushing environments of Section 2.2.3,
2.2.1
Simple Paragraph-Making Environments
The following environments are defined in terms of a general list environment that is described in Section 3.4.4 on page 108. If they don’t do what you want, the general the list environment will. Quotations LATEX provides two standard environments for quotations: the quotation environment and the quote environment. Here is a sample of a quotation. This is a quotation. Note that the margins are indented on the left and the right, the text is justified at both margins, and there is a paragraph indentation. Leaving a blank line produces a new paragraph like this one. It was produced by typing
CHAPTER 2. THE BASICS
\begin{quotation} This is a quotation. Note ... paragraph indentation.
35
that ...
Leaving a blank line produces ... \end{quotation} The quote environment is similar, but paragraphs are not indented. Verse The verse environment is designed for poetry, though you may find other uses for it. You can produce a masterpiece like There is an environment named verse Whose features some poets will curse. For instead of making Them do all line breaking, It allows them to put too many words on a line when they’d rather be forced to be terse. by typing the following input \begin{verse} There is an environment named {\tt verse} \\ Whose features some poets will curse. For instead of making\\ Them do {\it all\/} line breaking,\\ It allows them to put too many words on a line when they’d rather be forced to be terse. \end{verse} As usual, TEX ignores where you break lines in your input. You tell it to start a new output by line typing \\ . Since TEX is in paragraph mode, leaving a blank line starts a new paragraph, which in this case leaves some extra vertical space and starts a new line. You don’t use a \\ command after a line that ends a paragraph. Theorems, Lemmas, Etc. If you’re writing mathematics, you’ll probably want to include some theorems. You’d like to type
CHAPTER 2. THE BASICS
36
\begin{theorem} All theorem numbers are interesting. \end{theorem} to produce something like the following. Theorem 1 All theorem numbers are interesting. I can’t anticipate the assortment of theorem-like statements that you will want in your document. You might want lemmas numbered the same as theorems, so Lemma 5 follows Theorem 4, or you might want them numbered separately. You might want propositions numbered within chapters, or numbered consecutively from the beginning. In addition to theorems, lemmas and propositions, you might want to number definitions, axioms, assertions, conjectures, wild guesses, and so on. Rather than trying to force some particular style on you, LATEX provides a \newtheorem command that lets you define your own theorem-like environments. Suppose you want an environment called guess to produce something like: Conjecture 1 All conjectures are interesting. You define such an environment with the command \newtheorem{guess}{Conjecture} This causes your conjectures to be numbered consecutively from the start of the document. If you want them numbered consecutively within sections, you type \newtheorem{guess}{Conjecture}[section] The same input as before then produces the following. Conjecture 2.2.1 All conjectures are interesting. This is Conjecture 2.2.1 because it’s the first conjecture in Section 2.2. To get your conjectures numbered within chapters instead of sections, you’d type: \newtheorem{guess}{Conjecture}[chapter] Finally, suppose you want another environment named hunch that is numbered the same as the guess environment, but is labeled Hunch rather than Conjecture. You define this hunch environment by typing: \newtheorem{hunch}[guess]{Hunch} The input
CHAPTER 2. THE BASICS
37
\begin{hunch} Some interesting conjectures are numbered. \end{hunch} then produces the following. Hunch 2.2.2 Some interesting conjectures are numbered. It is Hunch is number 2.2.2 because it is the first hunch or guess environment after Conjecture 2.2.1. This is all summarized below. numbered within
\newtheorem{guess}{Conjecture}[section] YH H H printed label environment name @ R @ \newtheorem{hunch}[guess]{Hunch} same numbering as Remember the discussion in Section 1.4.1 about not letting a [ be confused with an optional argument. The numbering of an environment defined with the \newtheorem command is controlled by a counter having the same name as the environment. Counters are discussed in Section 3.1.3, which tells you how to change both the values of individual theorem numbers and the way those numbers are printed—for example, to get theorems numbered I, II, III, etc. The \newtheorem command is a global declaration—one whose scope does not end when TEX “climbs the stairs” to a higher level. You can put the \newtheorem command anywhere before the environment is used, but it must come after the \documentstyle command. The natural place for it is before the \begin{document} command.
2.2.2
List-Making Environments
LATEX provides environments for making three different kinds of lists, which are described below. Like the simple paragraph-making environments described above, they are defined using the general list environment of Section 3.4.4 on page 108. If none of these three list-making environments does what you want, the generic list environment will. In all of these environments, each list item including the first is begun with an \item command. A blank line within an item begins a new paragraph of that item. Blank lines between items have no effect. Each item in a list environment is marked with a label. For example, in an enumerate environment, the label is the item number. The \item command has a single optional argument, which specifies how the item is to be labeled. If that
CHAPTER 2. THE BASICS
38
argument is missing, then the default label is used—for example, the number in an enumerate environment. You normally use the default labels in the itemize and enumerate environments and specify the labels in the description environment. Enumerated Lists Here are some of the things you should know about enumerated lists. 1. An enumerated list, like this one, is created with the enumerate environment. 2. Enumerations can be: (a) Nested within one another, up to four levels deep. (b) Nested within other paragraph-making environments. 3. Each item of an enumerated list begins with an \item command. This enumerated list was created by the following input. \begin{enumerate} \item An enumerated list, like ... \item Enumerations can be: \begin{enumerate} \item Nested within one another ... \item Nested within other ... \end{enumerate} \item Each item of an ... \end{enumerate} The indentation of the input is for clarity only, TEX pays no attention to how many spaces you type—one space is as good as a hundred. However, it’s a good idea to format your input like this because it can help you catch missing \end commands. The numbering in an enumerate environment is controlled by the enumerate counter. See Section 3.1.3 to find out how to change its value to circumvent the default numbering—for example, to begin with item number 7. Itemized Lists The itemize environment works the same way as the enumerate environment. Thus, replacing enumerate by itemize in the example from the preceding section yields the following. • An itemized list, like this one, is created with the itemize environment.
CHAPTER 2. THE BASICS
39
• Itemizations can be: – Nested within one another, up to four levels deep. – Nested within other paragraph-making environments. • Each item in an itemized list begins with an \item command. Descriptions The description environment is used to make labeled lists like the following. Gnat: A very small animal that causes no end of trouble in the North Woods. It should be avoided at all costs. Gnu: A very large animal that causes no end of trouble in crossword puzzles. It should be avoided at all costs. Armadillo: A medium-sized animal having a medium-sized Texas city named after it. This list was created with the following input text. \begin{description}{Armadillo:} \item[Gnat:] A very small animal ... \item[Gnu:] A very large animal ... \item[Armadillo:] A medium-sized animal ... \end{description} Observe how the optional argument of the \item command produces the label. The description environment has a single mandatory argument, which should be the widest item label. More precisely, the argument of the environment should be the same as the argument of the \item command that produces the widest label. LATEX doesn’t look ahead when processing a description environment, so it needs the argument to tell it to leave enough space for an Armadillo: when making the label Gnat: . The argument of the description environment provides the default label, which you get if you omit the \item command’s optional argument. Thus, in the above example, I could have typed \item instead of \item[Armadillo:]. This makes it easy to use the description environment to make itemized lists with your own choice of tick marks. TEX is in LR mode when processing the argument of an \item command. It places the text of the label at the left of a box of the appropriate width. See Section 3.2.1 to find out how to move the text elsewhere in the box.
CHAPTER 2. THE BASICS
2.2.3
40
Centering and “Flushing”
LATEX allows you to create a paragraph consisting of lines that are centered like these two. You can also create a paragraph with lines that are flushed right to the right-hand margin like these or a with a series of lines that are flushed left to the left-hand margin like these. They are created with the center, flushright, and flushleft environments, respectively. For example, the last one was produced by typing \begin{flushleft} flushed left to the \\ left-hand margin like these. \end{flushleft} As usual, a new line is started with the \\ command. These three environments can be nested with other paragraph-making environments in reasonable ways. For example, You can put a flushright environment inside a quote. by typing \begin{quote} \begin{flushright} You can put\\ a flushright environment \\ inside a quote. \end{flushright} \end{quote} This is useful because, unlike most of the other paragraph-making environments, the centering and flushing environments don’t change the margins. To understand what makes some nestings unreasonable, you need to know that the \item command does not actually produce the label. Instead, it causes the label to be attached as an appendage to the first piece of text that follows it. Thus,
CHAPTER 2. THE BASICS
41
\begin{itemize} \item The following is reasonable. \begin{center} It produces a centered paragraph within the item. \end{center} \item \begin{center} This is unreasonable. It puts the item label in a strange place. \end{center} \end{itemize} As with all paragraph-making environments, TEX is in paragraph mode when processing these environments, so it will break any line that’s too long. The centering and flushing environments work by making certain magical declarations to change how TEX makes paragraphs. These declarations are available by themselves as the LATEX commands \centering, \raggedleft and \raggedright. Instead of using the flushright environment, the above example could have been made using a \raggedleft command as follows. \begin{quote} \raggedleft You can put\\ a flushright environment \\ inside a quote. \end{quote} Remember the following correspondence between the environments and the declarations: environment center flushright flushleft
↔ ↔ ↔
declaration \centering \raggedleft \raggedright
These declarations are particularly useful inside parboxes. For example, \parbox{3in}{\raggedright Suite 123 \\ 4567 Ave. of the Armadillos \\ Gnu York, G.Y. } produces a parbox with three lines moved flush against the left-hand margin of the box. You could also use these declarations in ordinary paragraphs, but there is seldom any need to. Remember that the declarations work by changing the way TEX forms a paragraph. To have any effect, their scope must include the blank line that ends the paragraph.
CHAPTER 2. THE BASICS
42
Warning: You can put any of these three environments inside a parbox. However, if they appear at the beginning or end of the parbox, then they produce an extra vertical space above or below it, respectively. Section 3.2.1 on page 78 tells you how to insert a negative space to cancel this extra space. However, most of the time you’ll want the centered or flushed text to fill the entire parbox, so you can use the declarations instead of the environments.
2.3
Mathematical Formulas
If you type x+y=z in paragraph or LR mode, you get x+y=z . While this may look acceptable, it doesn’t look nearly as good as the formula x + y = z that TEX produces in math mode. You want TEX to be in math mode when it’s generating mathematical formulas. There are three environments that put TEX in math mode: math, displaymath and equation. The math environment is for formulas that appear right in the text, like the expression x2 + y 2 . The displaymath environment is for formulas that appear on their own line, like φxy =
d2 x dx dy
The equation environment is the same as the displaymath environment except that it adds an equation number: z=
n X
x2i .
(2.1)
i=1
It is equation number 2.1 because it’s the first equation environment in Chapter 2. The report document style numbers equations this way; the article style numbers them consecutively from the beginning of the document. Other document styles may number equations differently. As explained in Section 5.3, I can symbolically label Equation 2.1 by inserting the command \label{eq-sum} in the equation environment, and refer to Equation 2.1 by typing and refer to Equation~\ref{eq-sum} by typing You can replace eq-sum by the label of your choice. The math environment can be used in both paragraph and LR mode, but the displaymath and equation environments can be used only in paragraph mode. The math and displaymath environments are used so often that they have the following short forms: \( . . . \) instead of \begin{math} . . . \end{math} \[ . . . \] instead of \begin{displaymath} . . . \end{displaymath}
CHAPTER 2. THE BASICS
43
In fact, the math environment is so common that it has an even shorter form: you can type $ . . . $ instead of \( . . . \) The shorter forms are easier to type, but they make it easier to forget one of the delimiters. I recommend letting the size of the formula determine which form you use, reserving the shorter forms for shorter formulas. For example, you might type: $x+y$
and
\( 2a + 3b + 4c + 5d + 26z \),
using the regular \begin–\end form for really long formulas. Most of what goes into a math formula is typed just the way you would expect. The ordinary printing characters do what you’d expect them to in math mode. Typing x+1=y-2 , \+ , \- , or \< command to try to step to a nonexistent tab position. ! \< in mid line. You are using a \< command in the middle of a line in a tabular environment. The \< command may appear only at the beginning of a line.
CHAPTER 6. ERRORS
6.3
139
TEX’s Error Messages
Here is an alphabetical list of some of TEX’s error messages and what may have caused them. ! Double subscript. There are two subscripts in a row in a mathematical formula—i.e., you typed something like x_{2}_{3} , which makes no sense. If you meant x23 , then you should have typed x_{2_{3}} . ! Double superscript. There are two superscripts in a row in a mathematical formula—i.e., you typed 3 something like x^{2}^{3} , which makes no sense. If you meant x2 , then you should have typed x^{2^{3}} . ! Extra alignment tab has been changed to \cr. You are trying to put too many column entries into a single row in an array or tabular environment. In other words, there were too many &’s before the end of the row. ! Extra }, or forgotten $. Your braces or $’s don’t match properly. You’ve probably forgotten a { or $ somewhere. ! I can’t find file ‘...’. TEX couldn’t find the input file that you asked for. You can get this as a result of typing in the wrong file name when you start LATEX, or specifying a nonexistent input file with an \input or \include command. When this error occurs, TEX will type Please type another input file name: and wait for you to type the correct file name. ! Illegal unit of measure (pt inserted). If you just got an ! Illegal number, treated as zero. message, then this is part of the same problem. If not, it means that LATEX was expecting a length as an argument and it got a number instead. The most common cause of this error is writing 0 for a length of zero instead of writing 0in . In this case, you can type and your output should be all right. However, the error can also be caused by omitting a mandatory argument. ! Illegal parameter number in definition of ... . This is probably caused by a \newcommand or \renewcommand command in which you used an argument number that’s bigger than the number of arguments—for example, you might have put a #3 in the second mandatory argument after specifying that the command you’re definiting should have only two arguments.
CHAPTER 6. ERRORS
140
If the “...” in the error indicator is \@gtempa, then you’ve probably put a # in the argument of a \label command. ! Misplaced alignment tab character &. You’ve used the special character & in ordinary text. You probably meant to type \& . ! Missing control sequence inserted. You have probably typed a \newcommand, \renewcommand or \newlength command whose first argument is not a command name. ! Missing number, treated as zero. TEX was probably in the middle of executing a LATEX command that expected either a number or length as an argument and didn’t get one. Perhaps you omitted a mandatory argument, or a square bracket in your text was mistaken for the beginning of an optional argument. ! Missing { inserted. ! Missing } inserted. TEX has gotten confused somewhere along the line. These error messages often occur after the point where the incorrect input is. ! Missing $ inserted. TEX probably a command that can be used only in math mode when it wasn’t in math mode. The commands of Section 2.3 are designed for making mathematical formulas and must be used in one of the math environments. Remember that TEX is not in math mode when it begins processing the argument of a box-making command, even if that command is in a math environment. This error also occurs if TEX encounters a blank line when it’s in math mode. ! Not a letter. You may have put something in the argument of a \hyphenation command that doesn’t belong there. ! Paragraph ended before ... was complete. You have a blank line in a command argument where it doesn’t belong. You probably forgot the right brace at the end of an argument. ! TeX capacity exceeded, sorry [...]. TEX has just run out of space and aborted its execution. Before you panic, remember that the least likely cause of this error is that TEX doesn’t have the capacity to process your document. You probably made some error that caused TEX to keep chasing its tail until it ran out of room. The end of the error indicator tells you what kind of space TEX ran out of. The following are the cases in which you there’s a reasonable chance that you actually exceeded TEX’s capacity. box memory size: You may be creating so complicated a page of output that TEX can’t hold all the information needed to generate it. Such complicated
CHAPTER 6. ERRORS
141
output can be produced by large tabbing, tabular, array and picture environments. TEX’s space may also be filled up with figures and tables waiting for a place to go. To find out if you’ve really exceeded TEX’s capacity, put a \clearpage command in your file right before the place where TEX ran out of room and try running it again. If it doesn’t run out of room with the \clearpage command there, then you did exceed its capacity. If it still runs out of room, then there’s probably an error in your file. What can you do if you have run TEX out of room? TEX always processes a complete paragraph before deciding where to start a new page. Inserting a \newpage command may save the day by letting TEX write out the current page without having to process the part of the paragraph that goes on the next page. If the problem is caused by accumulating figures and tables, you can try to prevent them from accumulating—either by moving them further back in the document or by trying to get them to come out sooner. See Section 2.4.2 on page 62 to find out how to do this. exception dictionary: You have used \hyphenation commands to give TEX more hyphenation information than it has room for. hash size: You ran TEX out of room by defining too many command names and/or using too many cross-referencing labels. pool size: You probably ran TEX out of room by using too many cross-referencing labels and/or defining too many new command names. More precisely, the labels and command names that you defined have too many characters, so you can try using shorter ones. However, before assuming that this is the case, make sure you didn’t forget a right brace on the argument of a counter command like \setcounter, or in a \newtheorem or \newlist command. ! Text line contains an invalid character. Your input contains one of those weird characters that I warned you about in Section 1.1. ! Undefined control sequence. You probably spelled a command name incorrectly. In this case, if you type H , TEX will tell you how to type in the correct command, but you’ll still have to change your input file later. TEX may also produce this message in the middle of executing a LATEX command. This probably means that there’s a LATEX command in the wrong place—for example, an \item command that’s not inside a list environment. Another possibility is that you left out the \pagelayout or \documentstyle command. ! Use of ... doesn’t match its definition. If the “...” is a LATEX command, then it’s probably one of the commands for
CHAPTER 6. ERRORS
142
drawing pictures described in Section 3.4.3, and you probably used the wrong syntax for specifying an argument. If it’s \@array that doesn’t match its definition, then you have put something you shouldn’t have in an @-expression in the argument of an array or tabular environment. Otherwise, I don’t know what you might have done wrong; you’ll have to figure it out yourself. ! You can’t use ‘macro parameter character #’ in ... mode. You’ve used the special character # in ordinary text. You probably meant to type \# .
6.4
LATEX Warnings
LATEX’s warning messages all begin with LaTeX Warning: Below is an alphabetical list of all such warning messages and what they mean. Citation ‘...’ on page ... undefined. The symbolic citation name in a \cite command was not defined by a \bibitem command. Label ‘...’ multiply defined. Two \label or \bibitem commands had the same argument the last time LATEX processed your input. Label(s) may have changed. Rerun to get cross-references right. The numbers printed by \ref, \pageref or \cite commands may be wrong. Marginpar on page ... moved. A marginal note had to be moved down on the page to avoid printing on top of a previous marginal note. It will therefore not line up with the place in the text where the \marginpar command appeared. Oval too small. An \oval command specified an oval so small that LATEX can’t draw small enough quarter-circles to put in its corners, so it had to draw a funny-looking oval. Reference ‘...’ on page ... undefined. The argument of a \ref or \pageref command was not defined by a \label command. If you don’t understand why it wasn’t, see Section 5.5 on page 130.
6.5
TEX Warnings
You can tell a TEX warning message because it’s not an error message, so TEX doesn’t stop running, and it doesn’t begin with “LaTeX Warning:”. Below is an alphabetical list of some of TEX’s warnings.
CHAPTER 6. ERRORS
143
Overfull \hbox ... See Section 3.3.2 on page 87. Overfull \vbox ... Because it couldn’t find a good place for a page break, TEX put more on the page than it should. See Section 3.3.3 on page 90 for how to deal with page-breaking problems. Underfull \hbox Check your output for extra vertical space. If you find some, it was probably caused by a problem with a \\ or \newline command—for example, having two \\ commands in succession. This warning can also be caused by inserting a \linebreak command. Underfull \vbox See Section 3.3.3 on page 90.
Appendix A
Document Styles A description of the various document styles will appear here. In addition to various options for the article and report styles, there will also be other document styles like letter. Suggestions for document styles are welcome.
144
Appendix B
The Bibliography Database A description of how to make a bibliographic database file—a .bib file—will go here.
145
Appendix C
Making Slides There will be a special version of LATEX, called SLITEX, that can be used to make make slides for overhead projectors. SLITEX produces pages of output, just the way LATEX does. However, these pages are formatted so they can be copied onto transparencies to make slides. SLITEX provides a simple mechanism for making color slides, which are produced by generating a separate page for each color on the slide, copying each page onto a transparency of the appropriate color, and then overlaying the colored transparencies.
146
Index ’, 5, 8 ’,in math mode, 43 *, 12, 27 **, 22 *-expression, in array or tabular argument, 96 *-form, 12 *-form of float environments, 64 .aux file, 23, 127 .aux files, 130 .dvi file, 26, 130 .glo file, 130 .idx file, 126, 130 .idx file, producing, 126 .lof file, 68, 130, 132 .lot file, 68, 130, 132 .lst file, 26, 130, 132 .lst file, putting things in, 133 .plo file, 112 .sty file, 112 .toc file, 67, 130, 132 [, 5 &, 49 “$, 43 ], 5 ‘, 5, 8 “Log-like” functions, 48 Paragraph-Making Parameters, 117 11-point type, 30 11pt, 112 11pt substyle, 30 12-point type, 31 12pt, 112 12pt substyle, 31
0, 6 1, 6 accents, 32 appendix, 69 arguments, 10, 72 armadillo, 39, 41 array environment, 15, 49, 52, 78, 86, 91, 96, 137, 139, 141, 142 array environment, parameters, 118 arrays, 49 arrows, in a picture, 104 article document style, 7, 10, 30, 66 article document style, appendix, 69 article document style, equation numbering in, 42 article document style, float-placement in, 62 article documentstyle, figure numbering in, 61 aux files, 129 auxiliary file, 127 b, 51, 101 b float-placement position, 62 backslash, 5 badness, 90 bibliography, 128 bibliography database file, 129 bibtex, 131 blank line, 32 blank lines, 94 blank lines, before and after environments, 33 blank page, 91
147
INDEX
blobs, rectangular, 84 boldface, 6, 16, 29 bottom of line, 74, 85 bottomnumber, 116 box, 20 box, centered on its own line, 80 box, moving text around in, 79 boxes, 80 boxes, making with frames, 82 braces, 5, 14, 30 braces,matching, 6 brackets, 5
148
counters, printing their values, 77 cross references, 127 cross-referencing, 23, 122 cross-referencing labels, using too many, 141
dashes, 8 database file, 129 dbltopnumber, 116 declaration, global, 37 declarations, 16 declarations as environments, 18 defining length commands, 75 c, 49 delimiter, unmatched, 54 calligraphic symbols, 44 delimiters, 53 caret, 6 depth, changing apparent, 85 carriage return, 5 description environment, 38, 39, 79 carriage return, in tabbing environment, descriptions, 39 94 display math style, 55 case, 127 displaymath environment, 42, 55 center environment, 40, 86 document environment, 16 centered, 95 document style, 2, 7, 65, 109, 112, 113 centering, 40 document style parameters, for two-column centering a box, 80 format, 121 centering, array column, 49 document style, 11-point, 30 circles, 105 document styles, new, 2 citations, 128 document substyle, 30, 31 cm, 73 dots, 55 column, 92 dots, filling space with, 80 columns, evening in two-column for- double-column, see two-column, 120 mat, 120 dvi file, 90 comma, 30 el, 6 command classes, 15 ellipsis, 55 command-names, 10 em, 73 commands, 10 commands, entering from keyboard, 133 emacs, 6 empty page style, 113 commands, latex versus tex, 23 enumerate counter, 38, 77, 78 commands,defining, 27 enumerate environment, 37, 38, 77 comments, 9, 132 enumerate environment, changing left contents files, 68 margin, 109 control-l, 5 enumerate environments, nested too deeply, coordinate, 100 138 counter command, 141 environment, 15 counters, 37, 76, 124
INDEX
environment arguments, 15 Environments, 15 environments, paragraph-making, 33 equation environment, 42, 55 equation numbering, 42 error indication line, 23 error locator, 23, 134 errors, 22, 134 ex, 73 figure environment, 16, 60, 137, 138 figure placement, 62 figure* environment, 16, 64, 138 figures, 15, 16, 59, 91 figures, labeling, 127 file names, 4 float page, 62 float pages, 91 float parameters, 115 float placement, 62 float placement specifier, 62 float-placement constraints, 63, 115 float-placement parameters, 138 floats, 59 flushing, 40 flushing, in a tabbing environment, 94 flushleft environment, 40, 86 flushleft, array column, 49 flushright environment, 40, 86 flushright, array column, 49 font, 29 footnote counter, 59, 78, 84 footnotes, 15, 20, 57 footnotes, in minipage, 84 footnotes, parameter, 115 foreign symbols, 33 formulas, 42 fractions, 55 galley, 59 glo, 127 global declarations, 18 glossary, 126 glyph, 19
149
glyphs, 86 gnat, 39 gnu, 39, 41 Greek letters, 44 Greek letters,variant, 44 h float-placement position, 62 headings page style, 113 height, changing apparent, 85 horizontal braces, 52 horizontal line in math mode, 52 horizontal lines, in tabular or array environment, 97 horizontal space,adding, 78 hyphenation, 19, 88 hyphens, 88 i, dotless, 32 i,dotless, 53 IEEE, 129 indentation,paragraph, 8 index, 126 index entry, 126 index file, 126 index subentry, 126 index subsubentry, 126 index, using, 21 indirect commands, 18 initial declaration, 114 inner paragraph mode, 20 input file, 4 input, entering from keyboard, 133 interaction, 132 interline spacing, 34 invisible text, 34 italic, 17, 29 italic, upper-case Greek, 44 item label, 37 itemize environment, 15, 38 itemize environment, changing left margin, 109 itemized lists, with your choice of tick marks, 39 j, dotless, 32
INDEX
j,dotless, 53 keyboard, 44 knuth, 2, 3 Knuth, Donald E., 1 l, 6, 49, 101 l, shortstack argument, 105 l, argument of makebox, 81 labeled lists, 39 lablst.tex, 128 left quote, 5 left-to-right mode, 19 lemmas, 35 length, 73 length command, 74 letter document style, 144 library of declarations, 123 line breaking, 8, 9, 26, 87 line breaking, preventing, 9, 89 line breaking, with , 86 lines, horizontal, 85 lines, thickness in a picture, 106 lines, vertical, 85 list counter, 77, 108 list environment, 34, 37, 77, 92, 108 list environments, nested too deeply, 138 list of figures, 61, 67 list of figures, .aux file entry for, 131 list of tables, 61, 67 list of tables, .aux file entry for, 131 lists, 37, 108 logical structure, 1 lower-case, 127 lowering text, 85 LR box, 95 LR mode, 19, 39, 42, 75, 80, 85, 95 macro expansion, 73 main file, 123 making boxes of a specified width, 81
150
marginal note, moved, 142 marginal notes, 15, 64 marginal notes, in two-column format, 120 marginal notes, parameters, 115 math environment, 42, 55 math environments, short forms, 42 math italic, 56, 80 math mode, 19, 42, 44, 50 math mode, type-size changing, 32 math mode, type-style changing, 30 math style, 55 mathematical formulas, 42 medium space in math mode, 48 messages, generating, 132 minipage, 34 minipage environment, 58, 83, 84 minipage environment, footnotes in, 57 minipage environment, nesting, 84 minus sign, 8 mm, 73 modes, 19 mpfootnote counter, 76, 78, 84 myfile, 22 myfile.tex, 4, 21, 123, 126, 127 myheadings page style, 113 negative space,adding, 78 negative thin space in math mode, 48 nesting, 16 nesting environments, 16 nesting of paragraph-making environments, 34 nesting, of paragraph environments, 40 new-page character, 5 nonprinting characters, 4 normal page layout, 7, 112 null delimiter, 54 O, 6 oh, 6 one, 6 one-column text, 120 one-sided printing, 65
INDEX
151
operating system, 22 pictures, 100 optional arguments, 12 plain page style, 113 ordering of floats, 64 point, 73 ordinary printing character, 29 points, 30 ordinary printing characters, 6, 9 position, 100 ordinary printing characters,in math mode, printing characters, 4 43 programs, 60 origin, 100 pronunciation, 1 outer paragraph mode, 20, 57, 58, 137 pt, 73 ovals, 106 question mark, 23 overfull quotation environment, 34 hbox, 26, 87 quotations, 34 overlining, 52 quote characters, 5 p float-placement position, 62 quote environment, 34, 110, 138 p-expression, 97 quotes, 8 page breaking, 26, 90, 143 r, 49, 101 page breaking, preventing, 34 r, page counter, 77 shortstack argument, 105 page layout, 7, 111 raising text, 85 Page Layout Parameters, 114 rectangular blobs, 84 page numbering, 18, 77, 114 reference points, 101 page style, 112 page-breaking commands, in two-column reid,brian, 1, 3 report document style, 7, 10, 91 format, 120 report document style, appendix, 69 pages, in input file, 134 report document style, equation numparagraph, 8 bering in, 42 paragraph indentation, suppressing, 8 paragraph mode, 19, 34, 42, 80, 83, 86 report document style, figure-placement in, 62 paragraph-making environments, in a report document style, float-placement minipage, 84 in, 62 parbox, 20, 57, 60, 64, 96 report documentstyle, figure numberparbox in tabular environment, 97 ing in, 61 parbox, paragraph-making environments right quote, 5 in, 34 rigid length, 74 parboxes, 41 roman, 16, 29 parentheses, 5 Roman type style, 56 parsep, 108 roots, 55 parts, 122 rubber lengths, 74, 116 percent, 9, 110, 132 rule boxes, 84 period, 30 period, space after, 8 picture environment, 57, 92, 100, 141 sans serif, 30 scope, 17 picture environment, reusing, 82
INDEX
scribe, 1, 129 script math style, 55 scriptscript math style, 55 sectioning command, 78 sectioning commands, 10, 66 simple text, 8 single-column, see one-column, 120 size,type, 29 slanted, 30 slitex, 146 small caps, 30 space, 8, 48, 49 space character, 4, 8 space, after command, 72 space, around a float environment, 61 space, around an indirect command, 18 space, between array columns, 50 space, in math mode, 48 space, in verbatim, 110 space-producing commands, 15 spaces, 11 spaces, in math mode, 43 spaces, in tabbing environment, 94 spacing, 78 spacing, figures and tables, 116 special character commands, 14 special characters, 9, 92 special printing characters, 5 special symbols, 33, 51 square brackets, 12 square root, 55 stairs, 16 stopping latex, 26 stopping latex, effect on .aux files, 131 storage bins, 82 stretchable lengths, 79 string space, 128 strut, 85 style parameters, 114 style, math, 55 style, type, 29 subscripts, 44, 55 subscripts, double, 139 superscripts, 44, 55
152
superscripts, double, 139 symbolic labeling of equations, 42 symbolic names, making list of, 128 symbols,math, 44 symbols,nonmath, 33 t, 51, 101 t float-placement position, 62 tab, 5, 93 tab stop, 92 tab, in verbatim, 111 tabbing commands, 95 tabbing environment, 86, 91, 92, 141 tabbing environment, parameters, 118 table, 91 table environment, 60, 137, 138 table of contents, 18, 61, 67 table of contents parameters, 117 table of contents, .aux file entry for, 131 table of contents, using, 21 table* environment, 64, 138 tables, 15, 59, 91 tables, labeling, 127 tabular environment, 78, 86, 91, 96, 105, 137, 139, 141, 142 tabular environment, parameters, 118 terminal, 6 tex, 1, 118 TEX macros, 73 texbook, 2, 23 text editing, 16, 44 text math style, 50, 55 text-producing commands, 15, 19 textfraction, 116 textheight, 111 the paragraph indentation, in two-column format, 121 thebibliography environment, 129 theindex environment, 120, 126 theorems, 21, 35 thick space in math mode, 48 thin space in math mode, 48 tilde, 6, 9, 127
INDEX
title page, 69 titlepage environment, 69 topnumber, 115 totalnumber, 116 two-column floats, 64 two-column output, 16 two-column text, 120 two-sided printing, 65, 91 twocolumn document style option, 120 twoside, 112 type size, 29, 30 type style, 29 type styles, 32 typeface, 29 typeface, unavailable, 138 typefaces, in math mode, 56 typesetting mathematics, 2 typewriter, 32, 33 typewriter typeface, 30 Underfull hbox message, 89 underlining, 52 underscore, 6 upper-case, 127 variable-sized math symbols, 47 variant commands, 12 variant Greek letters, 44 verbatim, 110 verbatim environment, 92, 110 verbatim* environment, 111 verse, 35, 138 verse environment, 35, 86, 110 vertical line, between columns, 121 vertical lines, in tabular or array environment, 96 vertical positioning of arrays, 51 vertical spacing, 79 warning message, 25 warning, marginpar moved, 64 weird characters, 5 what you see is what you get, 3
153
wide accents, 53 WYSIWYG systems, 3 zero, 6 zero length, 73 zero-width boxes, 82