Stanford University Libraries Dept. o. Special Collections g _ Col) DOg^ Title — box _^_ fT^x n** O.A v tiro
Gourmet Guide to Typesetting Technical Text by Computer
WITH NUMEROUS EXPLICIT ILLUSTRATIONS
MICHAEL SPIVAK, Ph.D. THE JOY OF Tj^C by
Michael Spivak c
c
c
c Copyright. (C) I'JSO by tlic American Society
M;U!irm..tU\.l This is version —3 of the _A_4__r-T£X manual. _X_^ls_f-T[s( is meant to be used by some one who knows nothing about computers, except how to use a text editor, but this version is net meant for such technical typists. It is a very incomplete preliminary version, for l£X hackers, from whom suggestions for improvements arc being solicited. Please excuse the appearance of this version—it's not a very good advertise- ment for TVJ-, which is supposed to produce beautiful books! There arc lots of reasons and excuses for this (mainly lack or time), but things will look better later on; at the moment only the bare-bones output routine from Appendix B of the T]^< manual has been used, so there aren't even running heads to tell you what Chapter and section you are in. Some of the nifty macros mentioned here don't actually exist yet, but they should be operating soon (at certain points it will be clear that some are still oug;/y). Also, some of the fonts and symbols mentioned here aren't available yet, so some things were actually written in by hand. In particular, the symbols for "sidetrips" and "cautions" that are mentioned in the Introduction haven't been designed (on metafont) yet, so SIDETRIP and CAUTION appear instead; also the sidclrip:; haven't been set in smaller type, although they eventually will be. The ellipses . . . appear at several places. Sometimes this material hasn't been written because some design considerations still have to be made; sometimes I .was just too lazy. Anyone familiar with the T£X manual will know what to do about th.se points. Chapter 4 is quite incomplete—we just wanted to assure people thai if will be real easy to set matrices (none of this \vcenter{\halign{ stuff!. Eventually, we will be able to set partitioned matrices of all sorts and many kinds of commutative diagrams. There will also be a way of setting simple tables, the kinds that might actually appear in a math paper. A macro package to handle ___■ 1 1 the various sorts of tables, like ibl in troff, is clearly possible—it's just a question of getting some one to do it (it's not clear whether such a macro package should be part of this manual). Finally, only a few Exercises have been included. Basically, there just wasn't time to make the others. But we'd also be interested in suggestions for Exercises (interesting or tricky typesetting problems which you've come across). All suggestions and corrections, major and minor (misprints, complaints about the exposition, bugs, suggestions for nicer syntax in the macros, new macros that arc needed, etc.) will be gratefully received (but probably not acknowledged). They can he sent to the author by ordinary mail, the only kind he reads, c/o Publish or Perish, Inc., 2000 Center Street, Suite 1404, Berkeley, CA 94704. Or they can be sent via computer to palais mit-mc.
Q Introduction. WHAT 1&X CAN DO (and _.mnot do)
The title of this book is a little deceptive. It might give you wrong ideas about the pronunciation or T£.X, which actually stands for TAU EP3ILON CHI; according to its creator, Donald E. Knuth, insiders pronounce T^X so that it rhymes with blecchhh. Ts_ is thus an upper-case, or capital letter, form of rex, the beginning of the Creek word that means art, and that is also the root of English words like technology. This name emphasizes two basic features of '_£X:' il is a romputcr system for typesetting technical text, especially text containing n lot uf mathematics; and il is a system for producing beautiful text, comparable to the w-.. k of the finest printers. One other feature of the system needs to be emphasized: TfJ< allows you to do all of this easily . In fact, this is a manual for someone who knows nothing about computers (written by someone who knows nothing about computers). Actually, that last statement isn't quite true: the one thing we assume is that ycu ah .;..dy know how to use a computer terminal to create a file (in prac- tice, this knowing how to use an "editor", so lha* you can easily correct or change a" file). Nothing about typesetting itself is assumed, although a few printers' terms will be introduced along the way. You can remain blissfully ig- norant of the complicated rules that typesetters have developed for the proper setting of mathematics formulas —TfcX knows them all. Nor is any knowledge cf mathematics required. But you will still need to have a general idea of what printed mathematics ought to look like. Mathematicians and experienced tech- nical typists -who already know this—will find that 7&X allows them to specify mathematics formulas with less effort than before, yet with greater control over the finished product. Novice technical typists have a dual task: learning what mathematicians want, and learning how to get Tp/C to produce it. This manual will tell you all about the second, and give you as much help as possible with the first. In order to get some idea just how TjJ< works, we will examine a recent paper from a w.ll-known journal that was typeset by IfcX.
0-1
.nc.'n:, (.
. « BULLETIN (New Series) OF THE ASININE MATHEMATICAL SOCIETY Volume 23, Number 6, November 2001 co 2001 Asinine Mathematical Society 0002-990 1/01/0000-0503/502.00
WHAT EVERY YOUNG MATHEMATICIAN SHOULD KNOW K. ELVIN ( ABSTRACT. We evaluate an interesting definite integral. The purpose of this paper is to call attention to a result of which many math ematicians seem to be ignorant. THEOREM. The value off^^e -^dx is < c~x dx = >/*. /oo-oo PROOF: We have {I>'^-{IX'-'^lXy-^) /"°° f°° _ 2 _ 2 = / cx c v dxdy by Fubini J—oo J—oo *-&+*) dydx /oo-oo J/ oo 2 — * _ 2 r' r r = / / c rdrdO using polar coordinates
r rlit\ _r - =°o" -f[_]" = 7T . Remark.t. A mathematician is one to whom that is as obvious as that twicetwi two makes four is to you.
INSTITUTE FOll HAUGHTY ATTITUDES ( flcrrivrd by the editors April 2001 Hc-.r_irch supported in pari by ihr* National Foundation Mathematical Mubjrct cttts#ifirut ion(IU.)0). Primary '20A 00 Keywords:
(
/-oo
I, Snobbishnrss
Obvious. The author first wrote this paper by hand, and then, being a lazy fellow himself, gave it to a to c technical typist produce a computer file. Parts of this file are shown below, in a style of type which will always be used to indicate input typed on a terminal, as opposed to the output I^X will produce, or the contents of this manual itself; don't worry if your keyboard lacks some of these symbols— T£X has a way of getting around this.
C Xbeginpaper Xtitle What Every Young Mathematician Should Know\endtitle Xauthor K. Elvin Xendauthor
Xbegintext The purpose of this paper is to call attention to a result of wiiich many mathematicians seem to be ignorant. Xtheorem Theorem\\The value of $\int4.<-\infty>T\infty -.T-C-xT2>\, dxs is ?s\inti-C-\infLy>T\infty eT<-xT2>\, dx= c XsqrtXpi . ss\endtheorem Xproof ProofXX We have $$\al ign XleftC \intJ.{-\infty>T\infty eT<-xT2}\ , dx \right)T2 __=\left( \ir.t4-<-\infty>T\infty eT{-xT2>\, dx \right) c MeftC \int-K-\infty>?\infty eT-C-yT2>\, dy \right) \\ _.=\intJ.-C-\infty>T\infty \intJ-C-\infty>T\infty eT-OxT2>eT-C-yT2>\ , dx\, dy
Even a cursory examination of this file gives some idea how T^X is used. C For example, all of the English words that appear in the article are embedded somewhere in the file, while specifications for formulas are set off either by $ signs (when the formula is set within text), or by $$ signs (when it is displayed). In addition to the English words and the letters in formulas, there are lots of cryptic combinations,' called control sequences , which begin with \. Some con- trol sequences, like Xtitle, Xtheorem and \al ign, tell TgX how to process the input which follows. Other control sequences are the names of special symbols; for example, Xpi stands for tt, and \int stands for the "integral sign" /in /^° . Once this file was produced, a few simple instructions told T^X to set the paper in a style suitable for preprints, on a printer that quickly and cheaply produces output suitable for proofreading, though a little blurry: C
5
C c
What Every Young Mathematician Should Know K. ELVIN
Institute for Haughty Attitudes April 1, 2001
The purpose of this paper is to call attention to a result of which many mathematicians seem to be ignorant. e~'i THEOREM. The value of f^a) dx is
c~ lS dx = \fz. /oo-oo
PROOF: We have (/->SX/_>S(E -^) ,oo = / / c xc y dxdy by Fubini J— cc J—00 /«oo / e-^A-v^dydx /oo-oo J—oo 2 c r rdrdO using polar coordinates '0 /"oo c~r\dr dO Jo/
—y- dO
Remark. A mathematician is one to whom that is as obvious as that twice two makes four is to you.
Hesearrh supported in pari t>y the National Snubliisliiir,*... FoiimlaLiuu.
c
,00 i
Once satisfied with the reactions to his preprint, the author submitted the paper to the journal (all he had to do was send them the original computer file). The journal gave T&X a few other simple instructions that -caused it to typeset the paper in the journal's style, this time on a high-resolution printing device that produces camera copy suitable for printing.* Had the journal rejected the paper, the authorcould have sent it (that is, the computer file) to another journal, which could typeset it in their style, using another brief set of instructions. C As you can sec, T^X appears to be awfully knowledgeable! To understand how it attained to such worldly sophistication, three levels of T&X ought lo be distinguished.
(1) Stripped-down T^X, without any frills, is a system for manipulating letters and other symbols, combining them to form horizontal lines (automatically adjusting C the spacing so that lines of text al) come out the same length), combining the lines lo form paragraphs or displayed formulas (automatically adjusting them to the right heights), forming the paragraphs into pages, etc. There are control sequences like \hskip .sin, which is a "horizontal" blank space half an inch wide, and \vskip 3in, which isa "vertical" blank space 3 inches high extending c across the page, and so forth. There arc also a lot of control sequences for setting mathematics formulas, since that is one of TsC's basic aims. For example, \sqrt instructs T£X to properly place the "square-root" sign y/~ around the symbols which follow (automatically adjusting the height and width of the y/~~ sign). You can tell TfcX the information about many "fonts", each of which specifies the exact chape of a large number of letters and symbols of a certain size and \rv style, together with certain other infoimation that typesetters traditionally like to worry about (like the fact that the T' and "i" in "find" are joined together into the "ligature" fi). Once you have specified some fonts, you can create a paper by choosing a font, inserting a certain \vskip from the top of the page, then a certain \hskip to indent the paragraph, then some text, etc., etc. (Actu'_rily, T£X makes things a little easier than that! can V TfiX be told at the outset that all paragraphs will begin with an Xhskip .sin, and a special control sequence indicates when a new paragraph is beginning.)
(2) Like any reasonable system, T£X allows you to define new control sequences in terms of old ones. For example, the control sequence \align, which tells Tsi C how to align the equal signs in a long displayed equation, was defined in terms of 6 or 7 other control sequences; use of the single control sequence \al ign obviously
♦Nowadays virtually all prim inn is done by phot.o-o.Tset. Until the advent of computer-run photo-typesetting processes, camera copy was produced by setting metal type, printing one copy, and then destroying the type! c
7
c
c f
saves a lot of time. Since Xalign will be needed so often, it would be silly to ask each user to redefine it. So I^X also comes in a deluxe model, equipped with a whole bunch of new control sequences, defined once and for all. C (3) Setting mathematics papers involves a lot of other formatting besides the proper display of formulas. For example, the words "Theorem" and "Proof are often set in a different type-style, they might be indented or they might be set flush, there might be an extra line of space between the statement of the theorem and the previous paragraph, etc., etc. What a drag it would be to specify c all these requirements every time a theorem has to be stated! The solution to this problem calls for the construction of control sequences like Xtheorem that contain all this information. But most 1&X users won't want to worry about things like this—there's too much to learn and it's too hard to do correctly! In fact, most users T^X won't even want to worry about what type style and type ( size they should use, especially since these things will depend on which journal the paper eventually appears in. This problem is handled by having a "journal independent" format, which was used, for example, in the file on page 3. The control sequences Xbeginpaper, \title and Xtheorem appearing in this file do not have unique definitions. Instead, different definitions for these control sequences appear in separate files that specify a preprint style or a specific journal style. The appropriate file is added to the beginning of the main file when we teli T^X to print the paper.
This third level clearly represents a much more specialized system, which we will distinguished by the name J.J\VJ-Toi; it is a particularly easy system to use because it concentrates on the limited job of producing papers for jour- nal;., or in a preprint style. The sporty level-one T^X is a vehicle for the high- performance enthusiast; _yUl_f-'_EX serves those for whom reliability and.ease of operation arc the primary considerations. _4.Jt.f-TEX users will hardly ever need the lower-level sequences, control like Xhskips and \vskips; in fact, these i control sequences should be avoided, because they may interfere with _-__4l,_f- TeX's automatic journal-formatting processes (appropriate warnings will be issued whenever the workings of such control sequences arc divulged). Despite its specialized nature, JJiVJ-TQi will do almost anything that a mathematician will ever need. Moreover, __Ul_r-T£j( comes equipped with one other feature thai greatly increases its versatility: there is an easy way of making changes in the preprint format, so as to produce a format of one's own. Thus, a single file can be used by JJkf-Tty for printing in any journal style, as well as in the author's own personal format.
(
(
C
8 _
This is basically a manual for using the specialized system _4._/.b_?-TfcX, al- though we will often refer to it familiarly as T£X, and adopt the more formal c name only when we want to mention a feature of the system which, is peculiar to _X_4l.lf-I}.;X. The main body of the text concentrates on the most important construction,, in typesetting, while side-trips into more esoteric matter arc set in separate paragraphs that begin with the road-sign 0 Studying .bis manual will probably be much more pleasant if these sidctrips arc skipped the first time through—so they have been printed in small type to c discourage you from reading them. On the other hand, whenever you sec the sign
C you should Stop, Look and Listen! Approach with caution, or you may be mowed down by an unexpected train of thought. In Chapter 1 we will !": :rn how to produce a file for TeX containing ordinary text, and we .Hi also heve the opportunity to run TEX, to see what the output looks like. Chapter 2 concentrates on mathematics formulas. Chapter 3 is also c concerned with running TEX, but in greater detail than in Chapter 1. Finally, Chapter A tackles more difficult typesetting problems, like matrices. These four Chapters contain almost everything you need to know (and quite a few things you may want to skip). The last Chapter is a little different: it tells you how to go about making
r modifications in the standard preprint style, so as to get a style of jour own design. You can even use this for .citing most parts of a book, but you will probably need a more comprehensive format, designed by a TEXpcrt, to take care of things like beginnngs of chapters. Now that we've finally gotten to books, it is appropriate to mention a few of limitations (these apply both to and to _/__-.-._.-T£X). C TEX's TeX (1) TEX cannot be called upon to prepare an index, or a table of contents. (2) TeX does not have a facility for automatically keeping track of the numbering of theorems and equations. (3) TEX will not split long footnotes into parts and distribute them over the succeeding pages.
9 There is no inherent limitation to TfiX that prevents it from incorporating these subsidiary features; they justdidn't seem worth bothering about in the first version. Most of them aren't very important for setting mathematics papers, but c they do become important for setting books, and help is on the way. There will soon be programs for setting the table of contents (which actually isn't very hard by hand), and for preparing an index (which is hard). The indexing program will still depend on the author's selecting the entries that should appear—deciding what should go in an index is too important to be left to a dumb machine—but T£X will do all the cross-indexing, alphabetizing, etc. An automatic numbering c system for theorems and formulas would be extremely useful (especially when the author decides to insert a new equation, which requires changing the num- bering of all subsequent equations, and also all references in tlie text to these equations!). Probably some one, out of sheer frustration, will produce such a program soon—one problem real is that different authors have different ideas v.. about how numbering should be done. THERE ARE, IN ADDITION, LOTS OF OTHER THINGS THAT T&X won't do. For example, there is no easy way to have TeX automatically set the first line of each paragraph in upper-case letters, or to have it set the print automatically in a specified special shape, as some poetry by Dylan Thomas appears, oh!
Etc., etc., etc. Aren't you glad that mathematicians don't care about such things!
(
C
c
10 c Chapter 1. Learning TftX's Lingo.
This Chapter explains the fundamental steps in preparing a TeX file contain- ing ordinary English text. Lots of exercises have been interspersed throughout C the text, to clarify certain points, or just to provide practice. In most cases, the answers can simply be written on paper and checked with Appendix A, but there arc also a few more extensive Exercises that call for the creation of computer files. These files will be used as the input for TeX, so that you will get a chance to sec some TeX output. c Before we begin, it's a good idea to take a look at the keyboard of your terminal, because we want to note which symbols are sure to be available (most terminals also have their own choice of additional special keys). The following symbols should all appear; any exceptions will be discussed below. First we have the upper- and lower-case letters, and the numerals: c ABCDEFGHI JKL.MNOPQRSTUVW XYZ abedefghi jklmnopqrstuvwxyz 0123456789
You're probably already aware of the fact that the numeral i has to be distin- c guished from the irwer-case letter 1, and that the numeral 0 has to be distin- guished from the upper-case letter 0. On some terminals zero appears with a slash through it, as 0, while on other terminals the letter 0 appears this way; you should have no trouble determining which is which, since the zero will be close to the other numerals. (Printing devices also have differing conventions about slashing the letter 0 and the numeral zero, which might conflict with the c conventions on your terminal. Sigh.) Next we have the symbols
f i ' [apostrophe or single right quote ) - (single left quote ) C () C ] /(slash) -(hyphen) * (asterisk) which are used for punctuation, for writing numbers like 1,370.0003, for hyphen- ation and/or word-building, and for parenthetical remarks [possibly in brackets k"
11
C instead of parentheses]; on most fonfs the asterisk prints high* to serve as an indicator for footnotes. On your keyboard and screen, the quote marks * and * might appear as "genuine" quotes, deprived you ' and '. Don't feel if have less { aesthetically pleasing symbols—TeX will set them the right way. All terminals also have a double quote mark " (or "), but it hasn't been listed in this group because TEX has its own method for producing double quote marks. We should also mention that in addition to the hyphen - many terminals have a long horizontal line that appears on the screen as _ (underscore or underline). We will never use this symbol (not even to produce a sentence like this one). c Next come the few standard keyboard characters that will be used in math- ematics formulas:
-t- < > I
X The symbol I may appear broken, as ] , but TEX will always set it solid. T&X has control sequences to name all other mathematical symbols, including letters from foreign alphabets. Of course, English letters and numerals are also used in mathematics formulas, and most of the punctuation symbols arc used as well. For example, / is used in fractions like a/6, and the hyphen will be used for the minus sign in formulas, like x — y. However, Tj^X will use different spacing rules in mathematics, and the minus sign prints differently than a hyphen. Moreover, letter., arc normally italicized** in formulas. The fourth group of symbols that normally appear on every keyboard includes the following:
\ (bactelash ) < > $ & # % " (or ") O
Each of these symbols has a special usage in _A_s/V_._--'_eX; for example, as we mentioned on page 0-3, all control sequences begin with \, while $ signs or $$ signs arc used to set off mathematics formulas. This raises an interesting question: What if one is so crass as lo write a paper mentioning money (actual dollars and cents)—how can the dollar sign $ be intruded into the text? The answer is to use the control sequence Xs, which is the name of the $ symbol; as we shall learn in §3, all the special symbols can be named in one way or another. There is one further symbol that most users tend to overlook: pressing the
"Like this. **It is surprising how Tew mathematiciansare conscious of this fact!
12
.
C space bar produces a s3'inbol that appears blank on the screen. We will use the symbol C v whenever it is necessary to emphasize that the blank space has been entered We should also explicitly mention the (carriage-return) key, which moves the cursor down to the beginning of the next line. Prcs..i:ig (carriage-return) twice in succession produces a blank line on the screen. C Exceptions. If you have a peculiar terminal, one or two of these keys might not appear. Actually, as far as the internal workings of the machine is concerned, there is usually some combination of keys that will produce each symbol—but it might be something weird, like simultaneously pressing the control key and c the. space bar. (To find out things like this you will probably have to contact the people who sold you the terminal and scream.) J.J{J-I}^\ also provides you with control sequences for all these special symbols, in case you happen lo be the victim of such a clumsy arrangement. For example, typing \lq has the name effect, as far as X-.U-TeX is concerned, as typing the left quote X A complete list of these control sequences for missing keys is given in Appendix X (you'll c probably never need to look at it).
More Serious Problems. The general operating system on which you arc working has probably already assigned special meanings to certain symbols, and this is particularly likely with the symbols that Tj.]a treats specially. The wizards for :c your system will tell you what to do about this.
c
c
C
13 §1. Ordinary text. To set ordinary text you basically just type in what you want to come out, let and TEX worry about all the details. For example, suppose that you enter the ( following in your file:
This is the first paragraph of a 2,000 page document that has beon set by The System. The lines are automatically justified, i.e., they are c all set to the same length. To do this. The System inserts extra space between words, and/or hyphenates ones that are too long. ( But it can't correct errors.) C
Now let's get down to the nitty-gritty: how did The System know that it was supposed to begin a new paragraph here? Come, come, you really should be able to figure that out for yourself!
Using this input file, TeX will produce the following output: This i;; the first paragraph of a 2,000 page document that has been set by The System. The lines are automatically justified, i.e., they an; all sel to the same length. To do this, The System inserts extra space between words, and/or hyphenates ones thai are 100 long. ( But it can't correct errors.) Now let's get down to the nitty-gritty: how did The System know that it was supposed to begin a new paragraph here? Come, come, you really should he able to figure that out for yourself! Notice that the input lines can be of any convenient size; TeX automatically arranges them in paragraphs, with all lines made equally long. Similarly, extra spaces between words have no particular significance for TEX, which treats them as single spaces. The (carriage-return) at the end of a line also tells TeX to insert a space, and TEX then ignores any extra spaces that occur at the beginning of the next line. Although typists arc usually taught to leave two spaces after the punctuation marks :, ? and !, such niceties arc irrelevant to TEX, which uses its own judgement for the spacing after punctuation. But if you leave no space at all, then TeX also leaves no space, so that you can get expressions like "2,000"
( 14
(
C and "i.e.," in the output. On the other hand, the space between ( and But was a mistake, that caused an unwanted space in the output. TeX essentially set "(" c as a one-letter word; it might even have ended up setting "(" at the end of one line and the word "But" at the beginning of the next line! By now you've probably solved the paragraphing mystery. TeX ends a paragraph when it encounters a completely blank line (and it Btarts a new paragraph as soon as it sees the next letter). More precisely, TeX ends a paragraph C when it encounters two (carriage-return)s in succession; this produces a blank line on the screen. Of course, a blank line on the screen might really be the line
UULI consisting of three blank spaces (plus a (carriage-return))—in fact, it is easy to c end up with such lines when you use a text editor to delete all the visible portions of a line. Fortunately, this is no problem: TeX ignores the three blank spaces, since they come right after the (carriage-return) at the end of the previous line, so it still sees two (carriage-relurn)s in succession, and ends the paragraph. You can also leave as many blank lines in a row as you like, because TeX will ignore c "paragraphs" that are only zero lines long. Blank lines are not the only way to indicate the end of a paragraph. TeX will also end a paragraph when if encounters the control sequence Xpar, which has exactly the same significance in its mind as two (carriagc-return)s in succession. Suppose, for example, that we append our file as follows: c. out for yourself! Xpar Now we are in the third paragraph. For \sl.oo you can have a copy of this document.
Our output will then be appended as follows: ic
you really should be able to figure that out for yourself! Now we are in the third paragraph. For $1.00 you can have a copy of this document. ,c In this final paragraph we introduced the control sequence \$ in order to contrast it* with the control sequence Xpar. TeX recognizes two different kinds of
♦Recall that \$ is the name of the symbol S. If we had carelessly typed $ rather than \s, then TeX would have thought that a mathematicalformula was beginning, and it would have searched vainly for another $ sign to tell it where the formula ended! X
C
x
15 control sequences. The first kind, like \s, consists or \ followed by a single non- letter . The second kind, like Xpar, consists of \ followed by a string of letters, without any other symbols mixed in. No other possibilities arc allowed. So, for r example, neither \sa nor \par3 can be a control sequence. Control sequences of the first kind arc especially convenient to use, because there can never be any ambiguity about where they end. It is perfectly safe to type \si . 00, because there cannot be a control sequence \sl or \si . 0 etc. It is also OK to type \s|_li.oo (if you prefer keeping your control sequences segregated), c but the output will still be "$1.00": TeX always ignores any additional spaces after control sequences. So what do you do if you specifically want the output "$ 1.00", with a space between "$" and "1"? One possibility is to type \s\Ul . oo r using the control sequence \u (that is, X followed by a blank space). Here \l_j is the name for a blank space of output text; it is a control sequence of the first kind, just like \s. Exercise. What would you type to obtain the output "$ 1.00", with two spaces between "$" and "1"?
SIDETRIP. The control sequence \u specifics the amount of space that goes between words in ordinary text; it is actually a variable amount of space, since TeX has to stretch or shrink spaces when it adjusts the lengths of lines. On the other hand, the control sequence \. specifics a blank .pace which is exactly the width of any numeral 0, 1, . . . , 9 (each numeral is surrounded by a certain amount of non-variable space so that they all have the same total width). This can sometimes be useful for setting displays like $ 1.36 512.98 $ .17 which we'll learn about later. Control sequences of the second kind, like Xpar, require a little more finesse. Notice that in the input line
out for yourself ! Xpar Now the space after Xpar was necessary; without it, TfjX would have thought that we were trying to use a control sequence named XparNow. Of course, you can always (
C
16 » leave more than one space after Xpar—extra spaces will simply be ignored. A control sequence of the second kind is also ended automatically by any non- c Ititer . If we had appended our file to read out for yourself!\par\si .oo is the price of this document.\pari buck will get you a copy. c the output would have been appended to read
you really should be able to figure that out for yourself! $1.00 is the price of this document. c: 1 buck will get you a copy. Exercise Now that we've settled the matter of control sequences, we can turn our attention once again to literary matters. First cf all, single quote marks are produced in the obvious way: the input ' produces ' and the input * produces X To produce double-quote marks, you simply type two single-quote marks of the appropriate kind immediately in succession. The input
so that's how the letter *A' is produced!
C produces "Oh, so that's how the letter 'A' is produced!" Dashes are also important literary devices—as in sentences like this one. A dash is not the same as a hyphen or a minus sign. In fact, carefully printed mathematics books have hyphens, minus signs, and two kinds of dashes, an en-dash - and an em-dash — (traditionally the width of a capital N and M, respectively). En-dashes arc used for number ranges, like "pager J. 3 -3d", and also in contexts like "Fig. A-12" or "equation (3-4)". Em-dashes are used for punctuation in sentences—they are C the kinds of dashes to which the author of this manual has apparently become addicted. These different symbols can be produced as follows:
for a hyphen, type a hyphen (-); for an en-dash, type two hyphens ( —); for an em-dash, type three hyphens ( ).
17
C
c
Oh, * Notice that there arc usually no spaces on cither side of hyphens or dashes; don't put any into the input file unless you really want them to appear! As we have already indicated, a hyphen will automatically be turned into a minus sign when it is used between the $ signs which indicate mathematics formulas (in which case you won't have to worry about spaces, bcause TeX's own mathematics spacing conventions will take over). We mustn't omit mention of another literary device, the "ellipses" or three dots (. . .) which indicates an omission. If you simply type thrc-. periods in a row, the output is "...", with the dots too close together. So X/I_.f-'_EX gives you the (. control sequence \dots to help you. The input
Hmm \dots how do you space the dots?
produces "Hmm . . . how do you space the dots?" Thecontrol sequence \dots not only gives the right spacing between the periods, it also takes care of the spacing on cither side of them. It doesn't matter whether or not you leave spaces between Hmm and \dots; any spaces you leave are disregarded by \dots. (Of course, the spaces after \dots are certainly irrelevant, since they follow a control sequence). Exercise . . .
The most important literary devices are undoubtedly boldface print and italic print; and there's also slanted print (whiclfis a rather recent innovation). You can change to these fonts by using the control sequences \bf, \it and \sl; the control sequence \rm returns you to ordinary (roman) type. Thus, the input Don't .onfuse \it emphasising \rm something with boldly \bf asserting \rm it. produces the output Don't confuse emphasizing something with boldly asserting it. If the format you are using doesn't have slanted text, _..Xr_.f- TEX will substitute italic text instead. And if X/M-TeX happens to be setting text in a different type-size (as in a footnote), it will automatically choose the proper size type for the italic, bold, or slanted font. Despite these amenities, you might resent having to include al! the extra \rm instructions. They're certainly a nuisance to type, and an omission can be disastrous—you might end up with pages and pages of italicized words instead of just one! Fortunately, there's a way of switching fonts that's much better for most purposes. Use the input
Don't confuse {Ait emphasizing} something with boldly {\bf asserting} it.
18 The braces < and > are always used to "group" things in TeX input. They are used extensively for setting mathematics, but they also serve very nicely here X? to let TeX know that <\it emphasi7.e> and -C\bf asserting} arc separate groups within the ordinary roman type. Grouping is also useful in many other situations. For example, we indicated before that \s\Lii.oo % produces the output "$ 1.00". Another possibility is to type <\s>ui . oo with the braces isolating the control sequence \s. In this sit>- .lion, the blank space is taken seriously, because the rule for ignoring blank spaces after control sequences is applied only .} C within the group -C. . that contains this control se- quence. (So if you type <\$U>Ul . 00, the first blank space will be ignored, but the second one won't be.) Exercise. What output would be produced by the input ■C\s}_JUl .00? Another way to get the output "$ 1.00" is to type c \sOui ■ oo using an empty group; the <} combination is a group of no characters, so it produces no output, but it still isolates \$ and ends TEX's mission to search out and destroy extra blank spaces. The empty group <} may seem like a cheap trick, but it has loto of neat uses, and is sometimes almost indispensible. x. Exercise. What can you type if you want the output to contain two hyphens in a row? (You can't type — , but there arc many possible solutions.) Finally, what about the most primitive method of emphasizing text, by means of underlined words? Basically, you shouldn't use it—that's why italic type was invented! Underlining is really meant for mathematics formulas, where c letters or short expressions might be underlined, as in the formula x + A(z). As we shall see later, it is also possible lo underline individual words, but TeX will not lake a whole bunch of text, underline each word, and then arrange them in paragraphs. (Moreover, the letters g, j, p, q and y cause problems.) If you really want underlined text, you should use a "underlined font", in which each letter already has an underline as part C of it. Well, this has turned out to be a pretty long section, partly because literary folk have invented so many devices, and partly because TeX has so many devices to deal with them. Why not take a rest and come back some other time to work the following Exercise? It calls for the creation of a computer file, which we will use in the next section to get some output. C TeX
C
v
19 J §2. A first run. Although we've only covered the rudiments of TEXspcak, it's time to take a little break, lie back, and let the computer do some work. You produced a file at the end of the last section; we'll ask .>._>.-. if-T^X to process it and see what happens. This section is necessarilly a little imprecise because the details involved in running A/t_lf-TEX depend on the particular operating system you are using. To be specific, we'll describe a run in the TOPS 20 system, and indicate the places where changes might have to be made for other systems—you've probably been provided with a supplementary page explaining justwhich changes are necessary. First of all, the file which you constructed is not yet in a suitable state to be submitted to Xy.l>_f-TEX- To prepare it properly, first add the lines Xinput amstex C Xinput preprint Xbeginpaper Xbegintext
(in this order) at the beginning. The line Xinput amstex tells TeX to read in the file that contains all or _/DH>_f-TjEX's special features, and the line Xinput preprint tells TEX to read in the file that describes the standard "preprint" format. Between Xbeginpaper and Xbegintext we can put things like the title, author, etc. Jus;, for the fun of it, let's insert
Xtitle Our Very First Attempt to Make The System Turn Out a PaperXendtitle between Xbeginpaper and Xbegintext. The control sequence \endtitle serves the function of telling _*-TeX where this (absurdly long) title eilds, without having to put it in braces; as you can see from the file on page 0-3, similar constructions are used in several other situations. At the very end of your file you must add the line Xendpaper (carriage-return)
It is absolutely essential that you have the (carriage-return) at the end of the last line (so that the cursor moves down to the next line). If you forget it, then TEX will never actually finish reading the last line of your file, and you'll be stuck in TEX for all eternity! Finally, your file has to have a name—we'll assume that it is named paper . tex (if your operating system doesn't allow such names, one or two details will change .
<
_-__ .
110 later on). Now that the file paper.tex has been created, you can leave the editor. Once again you are in communication with the operating system, which has given you a prompt sign—to be specific, we'll assume that it's the symbol O. Now we're ready to go! First you have to ask the operating system to run TeX. To do this, you type tex (or perhaps run tex, or something of that sort). [Actually, you might encounter a problem before you even begin: TeX sometimes places such heavy demands on the computer's capabilities that your system might ( require TeX jobs lo be done in batch mode. For the moment, however, let's assume that you can sit at the terminal and have T)^_ talk to you.] After it has been invoked by the proper incantation, including the (carriage-return) at the end of the line, TeX will prompt you with an asterisk (*). Type c Xinput paper
This tell. TEX to read in your file. Notice that we type Xinput paper to process the file named p3per.tex (with other operating systems this arrangement may be different). As soon as you press (carriage-return), TeX will start to read your file, and when it sees the first line, Xinput amstex, it will dutifully in i read the appropriate file of AJU'S-Tj^'s special features. TeX will print a not very scrutiblc message to indicate that it has read the file, and then on the next line it will ask you a question:
C *\input paper amstex Do you want output? (y or n follow answer by return)
What's the meaning of this—what's the point of running TEX if you don't-get output? Well, you might have made a serious error, like omitting a } somewhere, or spelling a control sequence incorrectly, so that TeX doesn't recognize it. In such a case, TEX will become confused, issue an "error message", and wait for further instructions. So it's often a good idea lo first let TeX coldly appraise your file without asking for output. Chapter 3 discusses error messages in greater detail- -for the present we will simply assume that the file paper, tex contains no errors (check it carefully against the answer in Appendix A, and for heaven's sake, don't forget the \cndtitle at the end of the title!). Let's cross our fingers and ask for output: on the same line as the question, type y followed by (carriage-return). TEX will return to your file, read in the "preprint" file as instructed, print another message lo assure you that it has done C so, and then continue to talk to you. Soon (if your system isn't too overloaded)
111
X
«
Qtex your screen will look like this: Otex *\input paper r . . . amstex Do you want output? (y or n, follow answer by return) y . . . preprint ... Overfull box Overfull box [i] c Execution completed.
The [1] tells you that _4._4._f- TeX has processed enough of your file to make one page, which has been numbered "1"; no other numbers appeared, since the c output for the whole file will fit on one page. Once TfiX finished processing this page it gave you an Execution completed message, and returned you to the operating system, with its prompt ©. Assuming that paper.tex was error-free, no other messages should have appeared on the screen. But what about those Overf ul 1 box messages? These are "information messages", rather than "error ( messages", telling you that something is too big to be set properly. You haven't actually made an error—you've simply asked TeX to typeset something that won't fit where it's supposed to go. For example, \title . . . \endtitle specifics a one-line title (we'll learn later how to produce multi-line titles); the first Overfull box message arose because our title is too long to fit on one line. You'll have to take a look at the output in order to see vhat TeX did with the title, and to" discover why in the world one of the other lines was too long, thus generating the second Overfull box message. Now how do you actually get the output? When TeX flashed its Execution completed message, it had just constructed, and placed in your directory, a new file called paper, dvi. is "device-independent" This a file that can be used, ( with suitable supplementary programs, to run a Versatec, Varian, Alphatype, or any of several similar printers. If your operating system is particularly gracious, it may have automatically sent paper, dvi off to be printed; a message will probably appear on your screen telling you when your job is completed. But in most cases you will have to tell the system to print your paper. For example, on the TOPS 20 system, to run your file on a Versatec you type V vspool paper
—the system automatically interprets this as paper .dvi. Once you hit (carriage- return), the system will convert each page of the dvi-file into a file that runs the (
112
C
( t Versatec, and print out the numbers of the pages as they are completed
© vspool paper [1]
Now it's just a matter of waitingfor the printer to be free, so thatyour paper will actually be printed. There's probably some way for you to find out how many c pages are before you in the qucu^for the printer, and the system may flash you a message when your page is actually printed. We'll want to examine the printed paper carefully, so you should go pick it up as soon as possible. Before you do, however, remember that there's a new file paper . dvi in your directory—it has now served its purpose, and you probably want to delete il. But don't delete c paper . tex—we'll want to make some changes in it. [If your system doesn't allow you to call upon TeX from the terminal, you should submit a job control file to batch mode in the usual manner. Note that the y should be part of this file. Pick up the paper the next day, or whenever possible.] Once we have the printed output in hand, we can immediately sec the reason c for the first Overfull box message—the title extends beyond the margins. If the title had extended right off the paper the output would probably be pretty garbled, since most printing devices wrap the extra pieces around to the other margin (some printing devices just give up, and leave the line blank). Even though this overfull box isn't an "error", it certainly wants some fixing. One possibility c is to display the title on several lines, as explained in §5; for example, we might decide to break it as follows:
Our Very First Attempt to Make The System Turn Out A Paper C Clearly TeX can't be expected to do this formatting automatically—it requires an aesthetic decision (including capitalizing the word "A"). Our problem can also be solved immediately in another way—by choosing a more sensible title! So let's go back to the file paper.tex and change the title to "Our First Attempt". c The second overfull box is less conspicuous—il is the line ending with the word "Asterisk*" extending just a little beyond the margin. TeX didn't try to hyphenate "Asterisk*", even though it did hyphenate the word "asterisk" in the previous paragraph, because it never fools around with a "word" that contains upper-case letters or non-letters, like asterisks. Consequently, il was stuck with a line that it couldn't shrink down to the proper length, because the inter-word C
C
c
Q
113 spaces would have become too small; moreover, it couldn't move the final word to the next line because then the inter-word spaces would have become too large. What rotten luck! (Requiring innumerable hours for the author of this manual to fabricate.) Note also that better line breaks might have been possible if the word "*********" had been hyphenated on the previous line. TEX will sometimes miss such opportunities because it doesn't search through the dictionary to find all legitimate hyphenations— this consumes too much time and memory but C relies instead on some special rules which almost always work. In rare cases, like the present one, minor repairs will be necessary. Again, one possibility is to do some rewriting; in fact, careful authors will often resort to rewriting to make something appear better in print. It is also possible to give TeX a little help with its hyphenation. For example, in paper.tex you can replace and Asterisk* by ********** *****X-***** and As\-terisk* The control sequence \- indicates a "discretionary hyphen", a place where a word may be hyphenated if necessary. After inserting the discretionary hyphens into paper.tex, try printing it once again. This will provide a good review of all the steps that are involved in running J.JH>'J-T&. You will want to examine the output carefully to see how it was affected by the changes. Afterwards you can read the following consoling remarks.
In practice, missed hyphenations are quite rare, so you will seldom have to use TEX in this "in tractive" manner. Moreover, when proofreading the output from TeX, the amount of work needed to discover any hyphenation errors* is negligible compared to the amount ofwork proofreading already involves. Finally, _-.Jl.f- TEX keeps its own dictionary of troublesome words that commonly occur in mathematical works, but which aren't covered by its hyphenationrules; from tfme to time this dictionary will be expanded as the experience of its users dictates. It has perhaps not escaped your notice that the fancy word "interactive" was just a euphemism for "trial and error" . In the forsccablc future, however, TeX will have an additional feature making this word far more meaningful. As you type the input, TeX will display the output on the screen as it xvill actually appear on the printed page! So errors and overfull boxes will become known the moment they arise, and they can be corrected before anything ever gets printed. With
*On very rare occasions you may even find a word which T^X hyphenated incorrectly. You can easily (ix this hy typing the word with discretionary hyphensin the right places, since TeX won't add any hyphens to a word with discretionaryhyphens. You can evenput a discretionary itynhen at the end of the word if want to he sure that it, isn't hyphenated at all.
114
(
\
you this Utopian prospect before us, let us return to some of the humdrum details of typesetting.
115 41 §3. Special symbols and diacritical marks. Recall that the symbols r \<> $ * % & have special uses in X^-TeX, so some finagling is required to make them appear in the output. We know that \$ stands for the dollar sign $. Most of the other special symbols are produced similarly: r
Die input produces the output \< { \> } \$ $ ,4 C
% ,0
The undirected double quote mark " hasn't been added to this list for the simple reason that it really isn't a symbol at all—on most fonts it just doesn't appear, since printed books use directional quotes-"and ". (The undirected quote " docs appear on the font used for setting the input portions of this manual, but that's another story!) If X/M-TEX ever gets it into its head to add " as a special symbol, it can be named by some control sequence like Xquote (the obvious candidate.\" already has a special meaning, which we'll learn about soon). The backslash \ is another symbol that doesn't appear on any literary font. But \ is a fairly common mathematical symbol; in fact, it is used in a couple of different ways. Appendix S lists the special control sequences for this symbol. This leaves only the "tilde" or "squiggle" ~ to be accounted for. There is a large squiggle ~ that is used mainly in mathematical formulas, like A ~J3—it too has a special control sequence to name it, listed in Appendix S. The more common literary use for the tilde is as an accent or diacritical mark over letters in certain foreign words, like "canon". In fact, a whole slew of special symbols and diacritical marks is needed for foreign languages which still basically use the roman alphabet. If you are an English literary chauvinist, you might be tempted to skip the rest . of this section—after all, you can always type the usual sloppy approximation to non-English words and names, watch your foreign colleagues fume, and trust the journal editors to worry about details. But remember that accents are also used for mathematical symbols, like x, so you can't ignore it completely! (Accents in mathematics formulas arc treated in more detail in Chaptcr2§ll.) (
V.
(
,#
116 c
»- » The following control sequences will get you special symbols needed in foreign languages: C input output C (German letter ss) _c (Latin and Scandinavian ligature ac) JE (Latin and Scandinavian ligature AE) oe (French ligature oc) c For example, if you want to specify "jC^op's CEuvres" you can type C \AE sop's \OE uvres Notice that the spaces after the control sequences are necessary. Another way to separate them would be to type c "C\AE>sop's <\OE>uvres This looks a little nicer in the file, but it's harder to type. The following accents arc presently available (notice that spaces are not necessary after the control sequences of the first kind): c input output Vo - 6 (accent grave) \"o 6 (accent aigu, acute accent) \A o 6 (accent circonflcxe, circumflex or "hat" accent) \v o 6 (Slavic accent, inverted circumflex) \u o 6 (breve, short vowel) c \=o 6 (macron or bar, long vowel) \"o 6 (umlaut or double dot) \H o 6 (long Hungarian umlaut) \s o 6 (tilde or squiggle) \t oo 6b (tics two letters together) \Scan a a (Scandinavian a with circle) \Pol 1 1 (Polish crossed 1) \Ced c c (cedilla accent) The last three examples arc shown with letters other than "o" because they are somewhat special. The Scandinavian accent is shown over an "a" since "6" isn't C 117 C ( « a Scandinavian letter. Similarly, the Polish accent is specifically designedfor the letter "1", and cedilla accents arc usually associated with the letter "c". These control sequences can also be applied to capital letters. For example, r \"0 produces "6", \Pol L produces "L" and \Ced C produces "C". The input \Scand A produces "A", with the circle touching the "A"; this is the preferred symbol, traditional in Scandinavian books. If you want "A", use \hScand A to set the circle higher. There is only one little detail that won't take care of automatically. T&X C When the letters "i" and "j" arc accented, it is customary to use the undotted symbols "1" and "j". You can get these by typing \i and \j, respectively. For example, to obtain "minus" you would type m\=\i n\u us. Sach type style hag its own accents, and yon can even miv th*"- ■C\it \'E> \'E Et \bf \'E t \bf\'\rm E E CAUTION. Accents apply to only one letter, except for \t, which applies to a pair of letters (with no space between them). If you try to type \'{ab> you'll get an error message. In fact, you'll get an error message even if you try to type \'! Usually, TfJX will simply ignore superfluous pairs of braces. But extra brace:-, can cause problems in certain special situations, like this one: After an ac- cent, T|?X immediately looks for either a letter (or pair of letters) or a font change instrucUion, like \it, followed by a letter. So you also can't type \bf\'<\rm E> or <\bf\->\rm E. Another thing you can't type is something like \A\=x or \A<\=x>; in other words, you can't get an accent over an accent, as in the symbol i. (But you can do this in math formulas—sec Chapter2§ll.) Exercise . . C C 118 §4. Footnotes and further flourishes C We're tantalizingly close to a complete command of jt^t_'-T£X's ordinary text-setting capabilities. The most important remaining topic is one that you're probably already wondering about—footnote construction. It turns out that it's quite easy to get a footnote, but it's a little tricky to get two of them! The first footnote on page 1-2 was produced by the input C prints high \footnote *\\Like this . \endf ootnote to serve (It might be nicer to enter this in the file as prints high \f ootnote *\\Like this, \endf ootnote Q to serve . . . for the sake of clarity.) The control sequence \f ootnote processes two elements, the footnote indicator (*) and the footnote text (Like this); it automatically places the indicator both at the end of the previous word ("high"), and at the ( beginning of the footnote text v/hen it is printed at the bottom of the page. Since the indicator goes between \footnote and \\, while the footnote text goes between \\ and \endf ootnote, the control sequence \footnote always knows exactly which part of the input text is the indicator, and which is the footnote text—that i> why it was unnecessary to type / SIDETRIP. But there is one little detail that you will have to attend to yourself. Normally, fottnotc indicators go after punctuation. If, for some reason, you want to put the indicator right before some punctuation*, say a comma, you can't type punctuation c \footnote*\\Like this. \endfootnote, say a comma, . . . because you'll get a space before the comma! In this situation you'll have to use [he control sequence \unskip to get rid of the space that would normally be C "Like this. C C ■*, 119 skipped: punctuation \footnote*\\Like this . \endf ootnote\unskip say a comma, . . . For the second footnote on page 1-2 the author of this manual originally typed ( italicized\footnote*\\lt is surprising ... \endf ootnote in since he didn't know that it would come out on the same page. This gave two footnotes with the same indicator "*". Even worse, there was another horizontal line before the second footnote! So the input was changed to C italicized\sfootnote**\\lt is surprising. .. \endsf ootnote in using the control sequence \sfootnote, which is meant for all successive foot- notes on the same page. T£X simply won't do such things for you automatically; this is another situation where }>ou will have to use T£X interactively, making a minor change after examining the first output. It shouldn't arise very frequently, because extensive footnoting is regarded as very bad style in mathematical works. CAUTION. Long footnotes are likewise considered to be bad style, and they are also dangerous, sin-.e Tj}_ won't split up a footnote for you. If you ask for a footnote that is too long to fit on the current page, TjtX will cut the current page short and transfer the line containing the footnote indicator to the top of the next page, which will also bear the footnote itself. Extra space will be inserted between lines of the current page in order to make it come out to the right size. When you see how bad this looks, you will have to go back and split the footnote in two. Exercise. What do you do with the second half of the footnote? In other words, how do you get it to appear at thebottom of the next page, without any indicator? Should you intend to ignore our sage advice against extensive footnoting, you will probably want to use numbers as footnote indicators. They should be £&ta_L&^^ so you will need to look at Chapter 2§2. (If you elect to print all the footnotes together at the end of a section, \f ootnote shouldn't be used at all; just add the instructions for the superscript numbers in the right places in the text, and type all the footnotes at the end.) ( X c ,*■ 120 _ SIDETRIP. In addition to the asterisk * you can use any of the favorite literary symbols §, f, $ and as footnote indicators. Each of these symbols is named by a special control sequence, listed in Appendix S. Notice, however, that on most fonts the asterisk already appears in the position of a superscript, while these other symbols don't. If you want them as superscripts, see Chapter 2§2. The remainder of this section is a potpourri of minor points, listed roughly in order of increasing arcanencss. It's really one long sidctrip, and you might just skim through it, to get some idea what's there. But if you are determined to master all this material, the final Exercise will provide the ultimate test. It calls for the construction of a file that uses every little point that has been raised in this Chapter. C We've already pointed out that basic spacing controls like \hskips and \vskips should hardly ever be used with J.X!__f-TEX, since all the formatting is done for you. But occasionally you might want a little more control over AM>!f- T^X's spacing, and then you may have to resort to them. We'll take up horizontal spacing and vertical spacing separately. 1. Horizontal spacing (\hskip): If you type \hskip iin in the middle of a paragraph, the output will have one inch of blank space at that point. Units other than inches can be used, but we will not discuss them until Chapter 2, which is concerned with setting formulas. Mathematics formulas are almost the only places where you will ever want to request specific horizontal spacing, and even then you will probably use one of the special control sequences that T£X c has provided. for this task. So \hskips will be very rare in your files. CAUTION.Don't type Xhskip -Clin}! Thebraces arc not merely unnecessary— they'll actually confuse T£X completely. When T£X sees \hskip it immediately looks for a number, and then for a unit like in. This is another of those spefcial c situations, like accents, where extraneous braces will cause trouble. CAUTION. If you ask for an Xhskip lin, but there's not quite an inch of space left on the line, you will get an Overfull box,. SIDETRIP. There is one Xhskip that is useful when mathematical formulas appear next to each other in a "literary" context, so we will introduce it now, c even though we won't learn how to type math formulas until the next Chapter. A sentence like For all x, x2+ 1 > 0. is a little confusing when read quickly, because the symbols x and x 1 -\- 1, which c belong to different clauses, tend to merge into one long math symbol. Some 121 C c \< ■F authors will carefully avoid such constructions, writing for example, For all we have x 2 x, -f- 1 >0. r But many authors don't (and such devices do tend to make the text wordy). The control sequence Xxskip gives a small Xhskip that can help make things clearer. If you type For all $xs,Xxskip $ ( you'll get For all x, x 2 -f 1 >0. It doesn't matter whether or not you have space(s) before Xxskip—JLJk>'S-Tsi will automatically adjust for this. c SIDETRIP. There are other situations where \xski ps can be used to give a little extra professional gloss to the finished product. For example, in this manual an Xxskip i. left before and after parenthesized sentences. (Like this one.) Thus, the author typed sentences . Xxskip (Like this one.)\xskip Thus 2. Vertical spacing (\vskip): A \vskip will be useful if you want to leave some extra space between paragraphs. For example, you might want to leave 1.5 inches of space for a hand-drawn diagram. To do this, type . . . end of one paragraph, \par\vskip i.sin Start of next paragraph . . . CAUTION. Don't type \vskip {1.5 in}; IgX expects to see a number right after Xvskip. CAUTION. Notice that the Xvskip goes after the Xpar! T^X won't allow you to put a \vskip before the Xpar, or anywhere else within a paragraph. Until it sees a Xpar, l£X is constructing horizontal lines of text, and a request for a vertical space within one of these horizontal lines will be very unnerving. CAUTION, \vskips can cause the same problems as \footnotes. If you ask for a \vskip i.sin when the current page has less than 1.5 inches left, TfjX v/ill cut short the current page, just as it would for an overly long footnote. You can then try to shorten the space or put it somewhere else; as a last resort, try deleting some of the deathless prose in the preceeding paragraph. ( 122 C ( SIDETRIP. There's another way to get blank space in the output without having to worry about this problem. The input C ar\topinsert<\vskip I.sin} will end the paragraph, and at. the same time reserve 1.5 inches of space cither at the top pa.cc of the current fif there is room., or at the top of the next oafc. Even if the initial output isn't quite what you wanted, it'll vC X be ry easy to fix. If the blank space comes out on the next page, then there just wasn't room for it on the current page, so it's probably just where you want it. On the other hand, if the blank space ends up at the lop of the current page, then you at least know that there is enough room for it en the current page, and now you can change X \par\topinsert-C\vskip i.sin} to XparXvfikip i.sin. Now thai, we've covered spacing fairly thoroughly, we'll mention two other devices that you will find useful. C 3. Sometimes you might have to start a new line of input textright in the middle of a long word. You certainly don't want to hyphenate it, because TrrX will assume that your hyphen is part of the normal spelling of the word. In this situation, use the control sequence jy., which .tells TirX not to count the succeeding (carriage- return) as a space: \r I can't even <\it find} the word antidisestabl\ ! ishmentarianism in the dictionary! Here's another neat application: In sentences with dashes \! like this one there shouldn't be spaces before or after the dashes. 4- Wjjen^^^TrX sees the symbol %, it effectively c ignores it and everything £fe__J__-_L_____e_4___j^^ This allows you to insert remarks that you don't want to appear in the output: by Schwartz's Lemma. %Is this how you spell Schwartz? c € v 123 CAUTION. What actually happens is that JUVS-TpX interprets % as a (carriage- C£tuxn). This can produce problems if you have a whole line of comment, as in the following: . . . This is some text. JJ This is a very long % comment, that spills over onto another line. This is more text . . . This input textwill cause JJUf-TpX to sec two(carriage-return)s in a row fnamel C the two % signs); so TpX will start a new paragraph! (And if you do something like this while setting an equation, things will get very confusing, since you're not supposed to start new paragraphs in such situations.) To be on the safe side, always precede comments_h_y_-somg t.pxt: C This % This is a very, very long is % comment that has had to be split up some %onto three different lines text. % Now come some more subtle points. 5. The input This is <\it italics}: this is roman. produces "This is italics : this is roman." with the slanted "s" toppling over onto the unslanted ":" which comes immediately after it. The control sequence \/ will add just the right amount of extra space: This is -CXit italicsX/}: this is roman. CAUTION. Be sure to put the \/ right after the s, without any intervening space! You will want to use \/ whenever a slanted letter is followed immediately by a tall unslanted character, like ; ? ! ) j and also " (as the author ruefully found out 7 lines ago!). You will also want to use \/ when a slanted letter is followed immediately by a roman letter (this might happen, for example, if you only italicize the prefix of a word). . 124 { ( C. Sometimes you will need quotes within quotes, as in "They call this 'typesetting'" he sneered. It won't do to type \typesetting'<" '} he sneered because not enough space will be left after the single quote—you'll get '" which looks almost like three equally-spaced single quotes. On the other hand, "U" will leave too much space—and T^X might even start a new line at such a space! The control sequence Xaspace will solve this problem. Type "typesetting' \qspace"he sneered. You will also get the correct spacing in any of the legitimate combinations spac t> t s v t space" * ' " It doesn't matter how many spaces you leave ridit before Xqspace— AAVS-T\i?. will automatically adjust for this. % At this point we begin to pass from the sublime to the % ridiculous. 7. When T^X adds extra spacing to adjust the length of a line, it tends to put more space at the ends of sentences than between words, because this looks better. But periods also occur after initials, as in "D. E. Knuth". So T|?X doesn't put extra .pacing, after/ periods which follow upper case letters. Pretty clever, huh? Well, it doesn't take too long to think of situations where this isn't clever enough, (a) TftX can't be expected to know that the periods at the end of i.e. cf. etc. Proc. Amcr. Math. Soc. indicate abbreviations, rather than ends of sentences. The easiest solution to this c problem is to use the control sequence \q mentioned in §1. If you type i.e.Xu cf.\U etc.Xu Proc . \UAmer .UMath . \uSoc . \u tkc_Ll_-X-VdlUnseri_ordina inter-word spaces, rather than the somewhat larger spaces that occur after a period. C C 125 L (b) We hate to mention it, but sometimes periods after upper case letters are ends of sentences: Whose out there writ- ing all this crazy stuff? It is I. Supported in part by the NSF. Try some empty groups: . . . It is 10. . . .by the NSF-Q . SIDETRIP. We've already mentioned that you will need to use the control se- quence \unskip after \footnote. . . \endf ootnote when a footnote in- C dicator is placed right before some punctuation. A less critical problem arises if you want to put a footnote indicator on the last word of a sentence.* Since the period no longer occurs at the end of a word, T£X won't know that the sentence ends there! So it will leave only the usual interword spacing, instead of the somewhat larger space that normally goes after a period. If you really want to worry about this, you can use Xxskip (page ??): type of a sentence. \f oobnote*\\Af ter the period . \endfootnote\xskip Since the period . . . 8. Following normal printing conventions, T£X allows sentences with a dash— like this one—to break just after a dash. But it usually won't break a sentence —as this one is broken—by starting a line with a dash. Breaks before dashes are regarded as very bad style, but conceivably you might have to resort to one in order to avoid even worse breaks somewhere else. If you want to allow a dash to occur at the beginning of a line, just type an empty group right before it O TfX has nothing against breaks before an empty group, if that's the way the paragraph crumbles. *After the period. C 126 r » 9. We've purposely delayed explaining a point that may have been bothering you for quite some time. If you want an unindented paragraph, type Xnoindent C input £i&ht before the which bepjnsjt. For example, the unindented paragraph (b) in topic 7 was produced by typing after a period, \par\noindent (b) c Notice that we still have to finish the previous paragraph with a Xpar or a blank line. You really shouldn't ever need to use Xnoindent, because JUkS-Tffi. docs all the formatting for you. CAUTION To start this topic we really typed something like f of the game.\par\vskip . iin\noindent9. We've to get the extra space before the unindented paragraph. But this device should be used very, sparingly! Remember that you don't want to add instructions that will defeat X/IW-'iLX's journal formatting feature! If you arc setting a paper in the c preprint style, but you want all paragraphs to be set unindented and prececded by a certain amount of space, you shouldn't add a lot of \par\vskip .iin Xnoindents. The proper course of action is to use ordinary \pars or blank lines, but to make a change in the preprint format itself, as explained in Chapter 5! Then your input text can also be used by any journal to set the paper in its style. %0h well, we might as well reveal other control sequences % that shouldn't be needed. 10. You can get a centered line of text by typing \par\ctrline-C. . . } *-. Bc_surc_> put Xpar before Xctrline (a Xvskip can go before or after the Xctrl me). 11. Suppose that you've just finished a section, and you want the next section to begin at the top of the next page. Type C \par\vf illXeject right before the input for the next section. The \jpar ends the last paragraph of the present section, the Xvf ill fills the remainder of the page~ with vertical C and thcAej^ct^a^uMLy^njlUh^jiage. 127 < Sfiace, . Occasionally you might want to use \eject without the \par\vfill preceding it. For example, suppose that page 3 happened to get two footnotes on it. When you change the second \footnote to \sf ootnote, some vertical space will be deleted, since there is some extra vertical spacebefore a \f ootnote, but not before a \sf ootnote. This means that all the succcding pages may be changed slightly, which could be quite a problem if the spacing on these pages is a delicate issue. To avoid this, just type \eject after the last word that appears on page 3. Since you didn't end the paragraph with a Xpar, TeX will stretch the last line to the right margin. And since you didn't use \vf ill to fill up the remainder of the page with empty space, the extra space created by changing \footnote to Xsfootnote will be distributed between the lines, in nearly imperceptible increments. 128 ♦i §3. Final formatting. £ In §2 we spiffed up our file with control sequences like Xbeginpaper and Xendpaper. This section covers some of the other control sequences which are used in the "journal-independent" files that .-UU-T^X can set in various for- mats. Because so many aspects of a paper (like the bibliography, for example), arc journal-dependent, .AXII^-TeX has quite a few of these formatting control se- c quences, probably more than one would want to contend with at this delicate stage of our acquaintance. So in this section we will cover only the most important ones; the others are listed in Appendix F, and can be learned later. Mathematicians setting their own papers will probably prefer to leave the details of things like the bibliography to some one else, while technical typsists will eventually want to learn all the formatting control sequences. C The following control sequences arc used for processing material which is not 'art of the text pron.r, like the title and the author's name: ~~7 Xbeginpaper c Xtitle . . . \endtitle Xauthor . . . Xendauthor Xaddress . ... Xendaddress } (optional) Xacknow . . . Xendacknow C \d-te . . . \enddate Xabstract . . . Xendabstract (optional) c Xbegintext Xendpaper f They should be used in the order listed, with Xbeginpaper coming right after Xinput amstex and \input preprint and with Xendpaper coming at the very end. No particular order is required within the group of control sequences that appear in braces {}. We've already mentioned that Xtitle . . . Xendtitle gives a one-line title- C £o_-_o__yl_--Jin-L^lcJt only necessary to separate the individual lines b X 129 s nieanß of \\: Xtitle Our Very First Attempt to Make\\ The System Turn Out\\A PaperXendtitle The Xauthor of a paper can be two people, like "Flot Sam and Jet Sam", with a corresponding double Xaddress, like "Asea and Ashore", and even a double Xacknow, like "The first author was supported by W.A.T.E.R. and the second author acted under the direction of W.1.N.D." This is the way that the preprint format expects multiple-author papers to be handled. But many journals have special formats for multiple authors. Simply list the authors, their addresses, and their acknowledgements as Xauthor first author \\ second author XX . . . \endauthor and so forth. The control sequence Xabstract . . . \endabstract is used for text that might be set in a separate style, to serve as an abstract for the paper. If the journal normally prefaces abstracts with the word "Abstract.", "Summary.", etc., this will be printed automatically, so it shouldn't be typed. If the journal doesn't print abstracts, the text will simply be ignored. After Xbegintext comes the actual text, whose formatting also requires special control sequences. The most important of these is Xtheorem . . . \\ . . . \endtheorem which processes a statement and a label attached to it. For example, with the preprint format, the input Xtheorem Theorem (Folk-theoref .)\\ One plus one is two, and neither four nor three . Xendtheorem gets printed as TmiOßliM (FOLK-THEORCM). One plus one is two, and neither four nor three. Notice that the period after the label gets printed automatically (some formats might print a colon, or nothing at all). Of course, Xtheorem can also be used for a Lemma, Corollary, etc. The proof of a theorem (or lemma, corallary, etc.) should be processed by the control sequence Xproof . . . \\ . . . Xendproof For example, with the preprint format, the input Xproof Proof \\See the Collected Poems of A. E. Haussman . Xendproof gets printed as 130 c *i < PROOF: See the Collected Poems of A. E. Haussman. The colon, whatever, gets printed ic or automatically. Althoug!_hAl . Ax\ . . Xendproof looks completely analogous to Xtheorem . . . .XX Xendtheorem, there's actually a big difference in the way that _/L.__'-T£X treats them. The statement of .1 theorem is usually set in a special way (c.g.,in italic type), so -Olif-TcX needs the Xendtheorem to tell it where this special processing ends. Ifyou leave Xendtheorem out, IgX will * c search all the way to the end ofyour file in an attempt to find it. (Of course, your file might well have an Xendtheorem at the end of the next theorem—this will probably cause complete chaos!) So don't forget to put the Xendtheorem at the end of the theorem. On the other hand, proofs are usually set as ordinary text, except that extra space may be left at the end. If you forget the Xendproof at c the end ofa proof (which is easy when the proof is long), it won't be a catastrophe; at worst, the extra space at the end won't be supplied. This covers the main control sequences needed for formatting the text of a paper, but there are a couple of others that you might find useful at this stage. Frequently, a statement mentions several properties or conditions that are displayed, as in c THEOREM. Suppose that all the standard laws ofreasoning hold. Suppose, moreover, that we know that (i) All men are mortal. (ii) Socrates is a man. Then we can conclude that Socrates is mortal. c This shouldn't be set with Xpars, because the indentations have to vary so that the right parentheses will line up; moreover, different formats specify different indentations, as well as different type faces for the labels "(i)" and "(ii)". Instead type Xtheorem Theorem\\Suppose that all the standard lav/s V of reasoning hold. Suppose, moreover, that we know that Xconditions (i) __ All men are mortal,\\ (ii) __ Socrates is a man . \endconditions Then we can conclude that Socrates is mortal . Xendtheorem Notice that \\ separates the individual lines of the Xconditions, while the special symbol Sc separates each condition from its label; in the next Chapter we will discover many similar uses for &., to line things up correctly. At the end of a proof, right before Xendproof, you can type the control sequence Xqed and ~4._4U-TeX will automatically supply the end-of-proof shib- boleth specified by each format; this might be "Q.E.D.", a black box |, or perhaps nothing at all. C.