cc746sy6513.pdf - Stacks are the Stanford

115
Stanford University Libraries Dept. o. Special Collections Col) DOg^ g Title _ box _^_ fT^x n**

Transcript of cc746sy6513.pdf - Stacks are the Stanford

Stanford University LibrariesDept. o. Special Collections

Col) DOg^g Title — _box _^_ fT^x n**

O.A v tiro

Gourmet Guideto TypesettingTechnical Textby Computer

WITH NUMEROUS EXPLICITILLUSTRATIONS

MICHAEL SPIVAK, Ph.D.

THE JOY OF Tj^C

by

Michael Spivak

c

c

c

c

Copyright. (C) I'JSO by tlic American

M;U!irm..tU\.l

Society

This is version —3 of the _A_4__r-T£X manual. _X_^ls_f-T[s( is meant to be usedby 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 incompletepreliminary version, for l£X hackers, from whom suggestions for improvementsarc 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 ofreasons and excuses for this (mainly lack or time), but things will look betterlater on; at the moment only the bare-bones output routine from Appendix Bof the T]^< manual has been used, so there aren't even running heads to tell youwhat Chapter and section you are in.

Some of the nifty macros mentioned here don't actually exist yet, but theyshould be operating soon (at certain points it will be clear that some are stilloug;/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 beendesigned (on metafont) yet, so SIDETRIP and CAUTION appear instead; alsothe sidclrip:; haven't been set in smaller type, although they eventually will be.

The ellipses . . . appear at several places. Sometimes this material hasn't beenwritten 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 doabout th.se points. Chapter 4 is quite incomplete—we just wanted to assurepeople 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 andmany kinds of commutative diagrams. There will also be a way of setting simpletables, the kinds that might actually appear in a math paper. A macro packageto handle ___■ 1 1 the various sorts of tables, like ibl in troff, is clearly possible—it'sjust a question of getting some one to do it (it's not clear whether such a macropackage should be part of this manual).

Finally, only a few Exercises have been included. Basically, there just wasn'ttime 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, complaintsabout the exposition, bugs, suggestions for nicer syntax in the macros, new macrosthat 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/oPublish or Perish, Inc., 2000 Center Street, Suite 1404, Berkeley, CA 94704. Orthey can be sent via computer to palais

Q

mit-mc.

Introduction. WHAT 1&X CAN DO (and _.mnot do)

The title of this book is a little deceptive. It might give you wrong ideasabout 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 itrhymes 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 ofEnglish words like technology. This name emphasizes two basic features of '_£X:'il is a romputcr system for typesetting technical text, especially text containingn lot uf mathematics; and il is a system for producing beautiful text, comparableto the w-.. k of the finest printers. One other feature of the system needs to beemphasized: TfJ< allows you to do all of this easily . In fact, this is a manual forsomeone who knows nothing about computers (written by someone who knowsnothing about computers).

Actually, that last statement isn't quite true: the one thing we assume isthat ycu ah .;..dy know how to use a computer terminal to create a file (in prac-tice, this

.nc.'n:,

knowing how to use an "editor", so lha* you can easily corrector change a" file). Nothing about typesetting itself is assumed, although a fewprinters' terms will be introduced along the way. You can remain blissfully ig-norant of the complicated rules that typesetters have developed for the propersetting of mathematics formulas —TfcX knows them all. Nor is any knowledgecf mathematics required. But you will still need to have a general idea of whatprinted mathematics ought to look like. Mathematicians and experienced tech-nical typists -who already know this—will find that 7&X allows them to specifymathematics formulas with less effort than before, yet with greater control overthe finished product. Novice technical typists have a dual task: learning whatmathematicians want, and learning how to get Tp/C to produce it. This manualwill tell you all about the second, and give you as much help as possible with thefirst.

In order to get some idea just how TjJ< works, we will examine a recent paperfrom a w.ll-known journal that was typeset by IfcX.

0-1

(.

«.

(

<

(

(

BULLETIN (New Series) OF THEASININE MATHEMATICAL SOCIETYVolume 23, Number 6, November 2001co 2001 Asinine Mathematical Society0002-990 1/01/0000-0503/502.00

WHAT EVERY YOUNG MATHEMATICIAN SHOULD KNOWK. ELVIN

ABSTRACT. We evaluate an interesting definite integral.

The purpose of this paper is to call attention to a result of which many mathematicians seem to be ignorant.

THEOREM. The value off^^e-^dx is

PROOF: We have

Remark. A mathematician ismakes four is to you.

one to whom that is as obvious as that twice two

INSTITUTE FOll HAUGHTY ATTITUDESflcrrivrd by the editors April

I,

2001Hc-.r_irch supported in pari by ihr* National

Snobbishnrss

FoundationMathematical Mubjrct cttts#ifirut ion( IU.)0). Primary '20A00Keywords:

Obvious.

/oo c~x dx = >/*.-oo

{I>'^-{IX'-'^lXy-^)/"°° f°° _

2_

2= / cx c v dxdy by FubiniJ—oo J—oo

/oo

/-oo

/ *-&+*) dydx-oo J—oo

r'2 * r _r2= / / c rdrdO using polar coordinates

rlit\ _r - r=°o"

-f[_]"= 7T .

t. A mathematician is one to whom that is as obvious as that twi

c

C

c

c

C

C5

C

The author first wrote this paper by hand, and then, being a lazy fellowhimself, gave it to a technical typist to produce a computer file. Parts of this fileare shown below, in a style of type which will always be used to indicate inputtyped on a terminal, as opposed to the output I^X will produce, or the contentsof this manual itself; don't worry if your keyboard lacks some of these symbols—T£X has a way of getting around this.

XbeginpaperXtitle What Every Young Mathematician Should Know\endtitleXauthor K. Elvin Xendauthor

XbegintextThe purpose of this paper is to call attention to a resultof 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=XsqrtXpi . ss\endtheoremXproof ProofXX We have$$\al ignXleftC \intJ.{-\infty>T\infty eT<-xT2}\ , dx \right)T2

__=\left( \ir.t4-<-\infty>T\infty eT{-xT2>\, dx \right)MeftC \int-K-\infty>?\infty eT-C-yT2>\, dy \right) \\

_.=\intJ.-C-\infty>T\infty \intJ-C-\infty>T\infty

Even a cursory examination of this file gives some idea how T^X is used.For example, all of the English words that appear in the article are embeddedsomewhere 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 ofcryptic combinations,' called control sequences , which begin with \. Some con-trol sequences, like Xtitle, Xtheorem and \al ign, tell TgX how to process theinput 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 thepaper in a style suitable for preprints, on a printer that quickly and cheaplyproduces output suitable for proofreading, though a little blurry:

eT-OxT2>eT-C-yT2>\ , dx\, dy

c

c

What Every Young Mathematician Should Know

K. ELVIN

Institute for Haughty AttitudesApril 1, 2001

The purpose of this paper is to call attention to a result of which manymathematicians seem to be ignorant.

THEOREM. The value of f a)e~'i dx is

PROOF: We have

2c r rdrdO using polar coordinates

Remark. A mathematician is one to whom that is as obvious as thattwice two makes four is to you.

Hesearrh supported in pari t>y the National Snubliisliiir,*... FoiimlaLiuu.

/oo c~ lS dx = \fz.-oo

(/->SX/_>S(E -^),oo

,00

= / / c xc y dxdy by FubiniJ—cc J—00

/oo /«oo

/ e-^A-v^dydx-oo J—oo

'0/"oo

/ c~r\dr dOJo

—y- dO

i

C

C

c

\rv

V

C

c7

c

c

Once satisfied with the reactions to his preprint, the author submitted thepaper 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 typesetthe paper in the journal's style, this time on a high-resolution printing devicethat produces camera copy suitable for printing.* Had the journal rejected thepaper, 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.

As you can sec, T^X appears to be awfully knowledgeable! To understandhow it attained to such worldly sophistication, three levels of T&X ought lo bedistinguished.

(1) Stripped-down T^X, without any frills, is a system for manipulating letters andother symbols, combining them to form horizontal lines (automatically adjustingthe spacing so that lines of text al) come out the same length), combining thelines lo form paragraphs or displayed formulas (automatically adjusting themto the right heights), forming the paragraphs into pages, etc. There are controlsequences like \hskip .sin, which is a "horizontal" blank space half an inchwide, and \vskip 3in, which isa "vertical" blank space 3 inches high extendingacross the page, and so forth. There arc also a lot of control sequences for settingmathematics formulas, since that is one of TsC's basic aims. For example, \sqrtinstructs T£X to properly place the "square-root" sign y/~ around the symbolswhich follow (automatically adjusting the height and width of the y/~~ sign).

You can tell TfcX the information about many "fonts", each of which specifiesthe exact chape of a large number of letters and symbols of a certain size andstyle, together with certain other infoimation that typesetters traditionally liketo worry about (like the fact that the T' and "i" in "find" are joined togetherinto the "ligature" fi). Once you have specified some fonts, you can create a paperby choosing a font, inserting a certain \vskip from the top of the page, thena certain \hskip to indent the paragraph, then some text, etc., etc. (Actu'_rily,T£X makes things a little easier than that! TfiX can be told at the outset thatall paragraphs will begin with an Xhskip .sin, and a special control sequenceindicates when a new paragraph is beginning.)(2) Like any reasonable system, T£X allows you to define new control sequencesin terms of old ones. For example, the control sequence \align, which tells Tsihow to align the equal signs in a long displayed equation, was defined in terms of 6or 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-runphoto-typesetting processes, camera copy was produced by setting metal type, printing onecopy, and then destroying the type!

f

C

c

(

i

(

8

(

C

saves a lot of time. Since Xalign will be needed so often, it would be silly toask each user to redefine it. So I^X also comes in a deluxe model, equipped witha whole bunch of new control sequences, defined once and for all.

(3) Setting mathematics papers involves a lot of other formatting besides theproper display of formulas. For example, the words "Theorem" and "Proofare often set in a different type-style, they might be indented or they might beset flush, there might be an extra line of space between the statement of thetheorem and the previous paragraph, etc., etc. What a drag it would be to specifyall these requirements every time a theorem has to be stated! The solution tothis problem calls for the construction of control sequences like Xtheorem thatcontain all this information. But most 1&X users won't want to worry aboutthings like this—there's too much to learn and it's too hard to do correctly! Infact, most T^X users won't even want to worry about what type style and typesize they should use, especially since these things will depend on which journalthe paper eventually appears in. This problem is handled by having a "journalindependent" format, which was used, for example, in the file on page 3. Thecontrol sequences Xbeginpaper, \title and Xtheorem appearing in this filedo not have unique definitions. Instead, different definitions for these controlsequences appear in separate files that specify a preprint style or a specific journalstyle. The appropriate file is added to the beginning of the main file when weteli T^X to print the paper.

This third level clearly represents a much more specialized system, whichwe will distinguished by the name J.J\VJ-Toi; it is a particularly easy systemto 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.easeof operation arc the primary considerations. _4.Jt.f-TEX users will hardly everneed the lower-level control sequences, like Xhskips and \vskips; in fact, thesecontrol sequences should be avoided, because they may interfere with _-__4l,_f-

TeX's automatic journal-formatting processes (appropriate warnings will be issuedwhenever the workings of such control sequences arc divulged).

Despite its specialized nature, JJiVJ-TQi will do almost anything that amathematician will ever need. Moreover, __Ul_r-T£j( comes equipped with oneother feature thai greatly increases its versatility: there is an easy way of makingchanges in the preprint format, so as to produce a format of one's own. Thus, asingle file can be used by JJkf-Tty for printing in any journal style, as well asin the author's own personal format.

_

c

c

C

c

r

C

9

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 formalname only when we want to mention a feature of the system which, is peculiarto _X_4l.lf-I}.;X. The main body of the text concentrates on the most importantconstruction,, in typesetting, while side-trips into more esoteric matter arc set inseparate paragraphs that begin with the road-sign

0Studying .bis manual will probably be much more pleasant if these sidctripsarc skipped the first time through—so they have been printed in small type todiscourage you from reading them. On the other hand, whenever you sec thesign

you should Stop, Look and Listen! Approach with caution, or you may be moweddown by an unexpected train of thought.

In Chapter 1 we will !": :rn how to produce a file for TeX containing ordinarytext, and we .Hi also heve the opportunity to run TEX, to see what the outputlooks like. Chapter 2 concentrates on mathematics formulas. Chapter 3 is alsoconcerned with running TEX, but in greater detail than in Chapter 1. Finally,Chapter A tackles more difficult typesetting problems, like matrices. These fourChapters contain almost everything you need to know (and quite a few thingsyou may want to skip).

The last Chapter is a little different: it tells you how to go about makingmodifications in the standard preprint style, so as to get a style of jour owndesign. You can even use this for .citing most parts of a book, but you willprobably need a more comprehensive format, designed by a TEXpcrt, to take careof things like beginnngs of chapters.

Now that we've finally gotten to books, it is appropriate to mention a fewof TEX's limitations (these apply both to TeX and to _/__-.-._.-T£X).(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 numberingof theorems and equations.(3) TEX will not split long footnotes into parts and distribute them over thesucceeding pages.

c

c

v..

(

10

C

c

There is no inherent limitation to TfiX that prevents it from incorporatingthese subsidiary features; they justdidn't seem worth bothering about in the firstversion. Most of them aren't very important for setting mathematics papers, butthey do become important for setting books, and help is on the way. There willsoon be programs for setting the table of contents (which actually isn't very hardby hand), and for preparing an index (which is hard). The indexing program willstill depend on the author's selecting the entries that should appear—decidingwhat should go in an index is too important to be left to a dumb machine—butT£X will do all the cross-indexing, alphabetizing, etc. An automatic numberingsystem for theorems and formulas would be extremely useful (especially whenthe 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 theseequations!). Probably some one, out of sheer frustration, will produce such aprogram soon—one real problem is that different authors have different ideasabout how numbering should be done.

THERE ARE, IN ADDITION, LOTS OF OTHER THINGS THAT T&Xwon't do. For example, there is no easy way to have TeX automatically set thefirst line of each paragraph in upper-case letters,

orto have

it set the printautomatically in a

specified special shape,as some poetry by

Dylan Thomasappears,

oh!

Etc., etc., etc. Aren't you glad that mathematicians don't care about such things!

c

C

c

c

c

c

C

k"11

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 throughoutthe text, to clarify certain points, or just to provide practice. In most cases, theanswers can simply be written on paper and checked with Appendix A, but therearc also a few more extensive Exercises that call for the creation of computerfiles. These files will be used as the input for TeX, so that you will get a chanceto sec some TeX output.

Before we begin, it's a good idea to take a look at the keyboard of yourterminal, because we want to note which symbols are sure to be available (mostterminals also have their own choice of additional special keys). The followingsymbols should all appear; any exceptions will be discussed below.

First we have the upper- and lower-case letters, and the numerals:

ABCDEFGHI JKL.MNOPQRSTUVW XYZabedefghi jklmnopqrstuvwxyz0123456789

You're probably already aware of the fact that the numeral i has to be distin-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 aslash 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 beclose to the other numerals. (Printing devices also have differing conventionsabout slashing the letter 0 and the numeral zero, which might conflict with theconventions on your terminal. Sigh.)

Next we have the symbols

f i

' [apostrophe or single right quote ) - (single left quote )() 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

{

c

X

12

.

C

instead of parentheses]; on most fonfs the asterisk prints high* to serve as anindicator for footnotes. On your keyboard and screen, the quote marks * and *might appear as "genuine" quotes, ' and '. Don't feel deprived if you have lessaesthetically pleasing symbols—TeX will set them the right way. All terminalsalso have a double quote mark " (or "), but it hasn't been listed in this groupbecause TEX has its own method for producing double quote marks. We shouldalso mention that in addition to the hyphen - many terminals have a longhorizontal line that appears on the screen as _ (underscore or underline). Wewill never use this symbol (not even to produce a sentence like this one).

Next come the few standardkeyboard characters that will be used in math-ematics formulas:

-t-

The symbol I may appear broken, as ] , but TEX will always set it solid. T&Xhas control sequences to name all other mathematical symbols, including lettersfrom foreign alphabets. Of course, English letters and numerals are also used inmathematics 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 theminus sign in formulas, like x — y. However, Tj^X will use different spacing rulesin 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 includesthe following:

Each of these symbols has a special usage in _A_s/V_._--'_eX; for example, as wementioned 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 andcents)—how can the dollar sign $ be intruded into the text? The answer is to usethe 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!

< > I

\ (bactelash ) < > $ & # % " (or ") O

C

C

c

c

:c

c

c

13

C

space bar produces a s3'inbol that appears blank on the screen. We will use thesymbol

vwhenever it is necessary to emphasize that the blank space has been entered

We should also explicitly mention the (carriage-return) key, which moves thecursor down to the beginning of the next line. Prcs..i:ig (carriage-return) twice insuccession produces a blank line on the screen.

Exceptions. If you have a peculiar terminal, one or two of these keys might notappear. Actually, as far as the internal workings of the machine is concerned,there is usually some combination of keys that will produce each symbol—butit might be something weird, like simultaneously pressing the control key andthe. space bar. (To find out things like this you will probably have to contactthe people who sold you the terminal and scream.) J.J{J-I}^\ also provides youwith control sequences for all these special symbols, in case you happen lo be thevictim of such a clumsy arrangement. For example, typing \lq has the nameeffect, as far as X-.U-TeX is concerned, as typing the left quote X A completelist of these control sequences for missing keys is given in Appendix X (you'llprobably never need to look at it).

More Serious Problems. The general operating system on which you arc workinghas probably already assigned special meanings to certain symbols, and this isparticularly likely with the symbols that Tj.]a treats specially. The wizards foryour system will tell you what to do about this.

(

c

C

14

(

(

C

§1. Ordinary text.

To set ordinary text you basically just type in what you want to come out,and let TEX worry about all the details. For example, suppose that you enter thefollowing in your file:

This is the first paragraph ofa 2,000 page documentthat has beon set by The System. The lines areautomatically justified, i.e., they areall set to the same length.

To do this. The Systeminserts extra space between words,and/or hyphenates ones that aretoo long. ( But it can't correct errors.)

Now let's get down to the nitty-gritty: howdid The System know that it was supposedto begin a new paragraph here? Come, come,you really should be able to figure thatout 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 beenset by The System. The lines are automatically justified, i.e., theyan; all sel to the same length. To do this, The System inserts extraspace between words, and/or hyphenates ones thai are 100 long. ( Butit can't correct errors.)

Now let's get down to the nitty-gritty: how did The System knowthat 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 automaticallyarranges them in paragraphs, with all lines made equally long. Similarly, extraspaces between words have no particular significance for TEX, which treats themas single spaces. The (carriage-return) at the end of a line also tells TeX to inserta space, and TEX then ignores any extra spaces that occur at the beginning ofthe next line. Although typists arc usually taught to leave two spaces after thepunctuation marks :, ? and !, such niceties arc irrelevant to TEX, which usesits own judgement for the spacing after punctuation. But if you leave no spaceat all, then TeX also leaves no space, so that you can get expressions like "2,000"

c

C

c

c

c.

ic

,c

X

15

C

x

and "i.e.," in the output. On the other hand, the space between ( and But wasa mistake, that caused an unwanted space in the output. TeX essentially set "("as a one-letter word; it might even have ended up setting "(" at the end of oneline and the word "But" at the beginning of the next line!

By now you've probably solved the paragraphing mystery. TeX ends aparagraph when it encounters a completely blank line (and it Btarts a newparagraph as soon as it sees the next letter). More precisely, TeX ends a paragraphwhen it encounters two (carriage-return)s in succession; this produces a blankline 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 toend up with such lines when you use a text editor to delete all the visible portionsof 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. Youcan also leave as many blank lines in a row as you like, because TeX will ignore"paragraphs" that are only zero lines long.

Blank lines are not the only way to indicate the end of a paragraph. TeX willalso end a paragraph when if encounters the control sequence Xpar, which hasexactly the same significance in its mind as two (carriagc-return)s in succession.Suppose, for example, that we append our file as follows:

out for yourself! Xpar Nowwe are in the third paragraph. For\sl.oo you can have a copy of thisdocument.

Our output will then be appended as follows:

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.

In this final paragraph we introduced the control sequence \$ in order tocontrast 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 mathematical formula was beginning, and it would havesearched vainly for another $ sign to tell it where the formula ended!

r

c

r

(

16

C

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, forexample, neither \sa nor \par3 can be a control sequence.

Control sequences of the first kind arc especially convenient to use, becausethere 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 alsoOK to type \s|_li.oo (if you prefer keeping your control sequences segregated),but the output will still be "$1.00": TeX always ignores any additional spacesafter control sequences.

So what do you do if you specifically want the output "$ 1.00", with a spacebetween "$" and "1"? One possibility is to type

\s\Ul . oousing the control sequence \u (that is, X followed by a blank space). Here \l_j isthe name for a blank space of output text; it is a control sequence of the firstkind, just like \s.Exercise. What would you type to obtain the output "$ 1.00", with two spacesbetween "$" and "1"?

SIDETRIP. The control sequence \u specifics the amount of space that goesbetween words in ordinary text; it is actually a variable amount of space, sinceTeX has to stretch or shrink spaces when it adjusts the lengths of lines. On theother hand, the control sequence \. specifics a blank .pace which is exactlythe width of any numeral 0, 1, . . . , 9 (each numeral is surrounded by a certainamount of non-variable space so that they all have the same total width). Thiscan sometimes be useful for setting displays like

$ 1.36512.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 wewere trying to use a control sequence named XparNow. Of course, you can always

»

c

c

c:

C

C

17

C

c

leave more than one space after Xpar—extra spaces will simply be ignored. Acontrol sequence of the second kind is also ended automatically by any non-Ititer . If we had appended our file to read

out for yourself!\par\si .oois the price of this document.\pari buckwill get you a copy.

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.

1 buck will get you a copy.

Exercise

Now that we've settled the matter of control sequences, we can turn ourattention once again to literary matters. First cf all, single quote marks areproduced in the obvious way: the input ' produces ' and the input * producesX To produce double-quote marks, you simply type two single-quote marks ofthe appropriate kind immediately in succession. The input

Oh,

so that's how the letter *A' is produced!

produces"Oh, so that's how the letter 'A' is produced!"

Dashes are also important literary devices—as in sentences like this one. Adash is not the same as a hyphen or a minus sign. In fact, carefully printedmathematics 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 usedfor 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 arethe kinds of dashes to which the author of this manual has apparently becomeaddicted. 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 ( ).

*

(.

18

Notice that there arc usually no spaces on cither side of hyphens or dashes; don'tput any into the input file unless you really want them to appear! As we havealready indicated, a hyphen will automatically be turned into a minus sign whenit is used between the $ signs which indicate mathematics formulas (in which caseyou won't have to worry about spaces, bcause TeX's own mathematics spacingconventions will take over).

We mustn't omit mention of another literary device, the "ellipses" or threedots (. . .) 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 thecontrol 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 notonly gives the right spacing between the periods, it also takes care of the spacingon cither side of them. It doesn'tmatter whether or not you leave spaces betweenHmm and \dots; any spaces you leave are disregarded by \dots. (Of course, thespaces after \dots are certainly irrelevant, since they follow a control sequence).Exercise . . .

The most important literary devices are undoubtedly boldface print anditalic 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 somethingwith boldly \bf asserting \rm it.

produces the outputDon't confuse emphasizing something with boldly asserting it.

If the format you are using doesn't have slanted text, _..Xr_.f-TEX will substituteitalic text instead. And if X/M-TeX happens to be setting text in a differenttype-size (as in a footnote), it will automatically choose the proper size type forthe italic, bold, or slanted font. Despite these amenities, you might resent havingto 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 ofitalicized words instead of justone! Fortunately, there's a way of switching fontsthat's much better for most purposes. Use the input

Don't confuse {Ait emphasizing} somethingwith boldly {\bf asserting} it.

X?

%

C

c

x.

c

C

C

19

C

v

The braces < and > are always used to "group" things in TeX input. They areused extensively for setting mathematics, but they also serve very nicely hereto let TeX know that <\it emphasi7.e> and -C\bf asserting} arc separategroups within the ordinary roman type.

Grouping is also useful in many other situations. For example, we indicatedbefore that

\s\Lii.ooproduces the output "$ 1.00". Another possibility is to type

with the braces isolating the control sequence \s. In this sit>- .lion, the blankspace is taken seriously, because the rule for ignoring blank spaces after controlsequences is applied only within the group -C. . .} that contains this control se-quence. (So if you type <\$U>Ul . 00, the first blank space will be ignored, butthe 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

\sOui ■ oousing an empty group; the <} combination is a group of no characters, so itproduces no output, but it still isolates \$ and ends TEX's mission to search outand destroy extra blank spaces. The empty group <} may seem like a cheaptrick, but it has loto of neat uses, and is sometimes almost indispensible.Exercise. What can you type if you want the output to contain two hyphens ina row? (You can't type — , but there arc many possible solutions.)

Finally, what about the most primitive method of emphasizing text, bymeans of underlined words? Basically, you shouldn't use it—that's why italictype was invented! Underlining is really meant for mathematics formulas, whereletters or short expressions might be underlined, as in the formula x + A(z). Aswe shall see later, it is also possible lo underline individual words, but TeX willnot lake a whole bunch of text, underline each word, and then arrange them inparagraphs. (Moreover, the letters g, j, p, q and y cause problems.) If you reallywant underlined text, you should use a "underlined font", in which each letteralready has an underline as part of it.

Well, this has turned out to be a pretty long section, partly because literaryfolk have invented so many devices, and partly because TeX has so many devicesto deal with them. Why not take a rest and come back some other time to workthe following Exercise? It calls for the creation of a computer file, which we willuse in the next section to get some TeX output.

<\s>ui . oo

J

C

.

110

<

§2. A first run.

Although we've only covered the rudiments of TEXspcak, it's time to take alittle break, lie back, and let the computer do some work. You produced a fileat the end of the last section; we'll ask .>._>.-. if-T^X to process it and see whathappens.

This section is necessarilly a little imprecise because the details involved inrunning A/t_lf-TEX depend on the particular operating system you are using. Tobe specific, we'll describe a run in the TOPS 20 system, and indicate the placeswhere changes might have to be made for other systems—you've probably beenprovided with a supplementary page explaining justwhich changes are necessary.

First of all, the file which you constructed is not yet in a suitable state tobe submitted to Xy.l>_f-TEX- To prepare it properly, first add the lines

Xinput amstexXinput preprintXbeginpaperXbegintext

(in this order) at the beginning. The line Xinput amstex tells TeX to read inthe file that contains all or _/DH>_f-TjEX's special features, and the line Xinputpreprint tells TEX to read in the file that describes the standard "preprint"format. Between Xbeginpaper and Xbegintext we can put things like thetitle, author, etc. Jus;, for the fun of it, let's insert

Xtitle Our Very First Attempt to Make The SystemTurn Out a PaperXendtitle

between Xbeginpaper and Xbegintext. The control sequence \endtitleserves 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 lastline (so that the cursor moves down to the next line). If you forget it, then TEXwill never actually finish reading the last line of your file, and you'll be stuck inTEX 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

«

(

c

i

C

C111

X

later on). Now that the file paper.tex has been created, you can leave theeditor. Once again you are in communication with the operating system, whichhas 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 runTeX. 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 sometimesplaces such heavy demands on the computer's capabilities that your system mightrequire TeX jobs lo be done in batch mode. For the moment, however, let'sassume that you can sit at the terminal and have T)^_ talk to you.] After it hasbeen invoked by the proper incantation, including the (carriage-return) at theend of the line, TeX will prompt you with an asterisk (*). Type

This tell. TEX to read in your file. Notice that we type Xinput paper to processthe file named p3per.tex (with other operating systems this arrangement maybe different). As soon as you press (carriage-return), TeX will start to read yourfile, and when it sees the first line, Xinput amstex, it will dutifully read inthe appropriate file of AJU'S-Tj^'s special features. TeX will print a not veryscrutiblc message to indicate that it has read the file, and then on the next lineit will ask you a question:

Qtex

*\input paperamstex

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-getoutput? 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. Insuch a case, TEX will become confused, issue an "error message", and wait forfurther instructions. So it's often a good idea lo first let TeX coldly appraiseyour file without asking for output. Chapter 3 discusses error messages in greaterdetail- -for the present we will simply assume that the file paper, tex containsno errors (check it carefully against the answer in Appendix A, and for heaven'ssake, 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 doneso, and then continue to talk to you. Soon (if your system isn't too overloaded)

Xinput paper

r

c

c

(

(

V

(112

C

(

your screen will look like this:Otex*\input paper. . . amstexDo you want output? (y or n, follow answer by return) y. . . preprint ...Overfull boxOverfull box[i]Execution completed.

The [1] tells you that _4._4._f- TeX has processed enough of your file to makeone page, which has been numbered "1"; no other numbers appeared, since theoutput for the whole file will fit on one page. Once TfiX finished processing thispage it gave you an Execution completed message, and returned you to theoperating system, with its prompt ©. Assuming that paper.tex was error-free,no other messages should have appeared on the screen. But what about thoseOverf ul 1 box messages? These are "information messages", rather than "errormessages", telling you that something is too big to be set properly. You haven'tactually made an error—you've simply asked TeX to typeset something thatwon't fit where it's supposed to go. For example, \title . . . \endtitlespecifics a one-line title (we'll learn later how to produce multi-line titles); thefirst 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 thetitle, and to" discover why in the world one of the other lines was too long, thusgenerating the second Overfull box message.

Now how do you actually get the output? When TeX flashed its Executioncompleted message, it had just constructed, and placed in your directory, anew file called paper, dvi. This is a "device-independent" file that can be used,with suitable supplementary programs, to run a Versatec, Varian, Alphatype, orany of several similar printers. If your operating system is particularly gracious,it may have automatically sent paper, dvi off to be printed; a message willprobably appear on your screen telling you when your job is completed. But inmost cases you will have to tell the system to print your paper. For example, onthe TOPS 20 system, to run your file on a Versatec you type

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

t

©

c

c

c

c

C

c

C

113

C

c

Versatec, and print out the numbers of the pages as they are completed

Q

vspool paper[1]

Now it's just a matter of waitingfor the printer to be free, so thatyour paperwill actually be printed. There's probably some way for you to find out how manypages are before you in the qucu^for the printer, and the system may flash you amessage when your page is actually printed. We'll want to examine the printedpaper 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 hasnow served its purpose, and you probably want to delete il. But don't deletepaper . tex—we'll want to make some changes in it.

[If your system doesn't allow you to call upon TeX from the terminal, youshould submit a job control file to batch mode in the usual manner. Note thatthe y should be part of this file. Pick up the paper the next day, or wheneverpossible.]

Once we have the printed output in hand, we can immediately sec the reasonfor the first Overfull box message—the title extends beyond the margins. Ifthe title had extended right off the paper the output would probably be prettygarbled, since most printing devices wrap the extra pieces around to the othermargin (some printing devices just give up, and leave the line blank). Even thoughthis overfull box isn't an "error", it certainly wants some fixing. One possibilityis to display the title on several lines, as explained in §5; for example, we mightdecide to break it as follows:

Our Very First Attempt to MakeThe System Turn Out

A Paper

Clearly TeX can't be expected to do this formatting automatically—it requiresan aesthetic decision (including capitalizing the word "A"). Our problem can alsobe solved immediately in another way—by choosing a more sensible title! So let'sgo back to the file paper.tex and change the title to "Our First Attempt".

The second overfull box is less conspicuous—il is the line ending with theword "Asterisk*" extending just a little beyond the margin. TeX didn't try tohyphenate "Asterisk*", even though it did hyphenate the word "asterisk" in theprevious paragraph, because it never fools around with a "word" that containsupper-case letters or non-letters, like asterisks. Consequently, il was stuck witha line that it couldn't shrink down to the proper length, because the inter-word

\

C

114

(

spaces would have become too small; moreover, it couldn't move the final wordto 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 manualto fabricate.)

Note also that better line breaks might have been possible if the word"*********" had been hyphenated on the previous line. TEX will sometimesmiss such opportunities because it doesn't search through the dictionary to findall legitimate hyphenations— this consumes too much time and memory butrelies instead on some special rules which almost always work. In rare cases, likethe present one, minor repairs will be necessary. Again, one possibility is to dosome rewriting; in fact, careful authors will often resort to rewriting to makesomething appear better in print. It is also possible to give TeX a little help withits hyphenation. For example, in paper.tex you can replace ********** andAsterisk* by

*****X-***** and As\-terisk*The control sequence \- indicates a "discretionary hyphen", a place where aword may be hyphenated if necessary.

After inserting the discretionary hyphens into paper.tex, try printing itonce again. This will provide a good review of all the steps that are involved inrunning J.JH>'J-T&. You will want to examine the output carefully to see howit was affected by the changes. Afterwards you can read the following consolingremarks.

In practice, missed hyphenations are quite rare, so you will seldom have touse TEX in this "in tractive" manner. Moreover, when proofreading the outputfrom TeX, the amount of work needed to discover any hyphenation errors* isnegligible compared to the amount ofwork proofreading already involves. Finally,_-.Jl.f-TEX keeps its own dictionary of troublesome words that commonly occur inmathematical works, but which aren't covered by its hyphenationrules; from tfmeto 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" wasjust a euphemism for "trial and error" . In the forsccablc future, however, TeX willhave an additional feature making this word far more meaningful. As you typethe input, TeX will display the output on the screen as it xvill actually appear onthe printed page! So errors and overfull boxes will become known the momentthey 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. Youcan easily (ix this hy typing the word with discretionary hyphens in the right places, since TeXwon't add any hyphens to a word with discretionaryhyphens. You can evenput a discretionaryitynhen at the end of the word if

you

want to he sure that it, isn't hyphenated at all.

115

this Utopian prospect before us, let us return to some of the humdrum details oftypesetting.

41

r

r

C

.

(

116

V.

(

§3. Special symbols and diacritical marks.Recall that the symbols

&

have special uses in X^-TeX, so some finagling is required to make them appearin the output. We know that \$ stands for the dollar sign $. Most of the otherspecial symbols are produced similarly:

Die input produces the output\< {\> }\$ $\$

The undirected double quote mark " hasn't been added to this list for thesimple reason that it really isn't a symbol at all—on most fonts it just doesn'tappear, since printed books use directional quotes-"and ". (The undirected quote" docs appear on the font used for setting the input portions of this manual, butthat's another story!) If X/M-TEX ever gets it into its head to add " as a specialsymbol, it can be named by some control sequence like Xquote (the obviouscandidate.\" 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 coupleof 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 largesquiggle ~ that is used mainly in mathematical formulas, like A ~J3—it too hasa special control sequence to name it, listed in Appendix S. The more commonliterary use for the tilde is as an accent or diacritical mark over letters in certainforeign words, like "canon". In fact, a whole slew of special symbols and diacriticalmarks 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 restof this section—after all, you can always type the usual sloppy approximation tonon-English words and names, watch your foreign colleagues fume, and trust thejournal editors to worry about details. But remember that accents are also usedfor mathematical symbols, like x, so you can't ignore it completely! (Accents inmathematics formulas arc treated in more detail in Chaptcr2§ll.)

\<> $ * %

,4

,#

%,0

c

»- »

C

c

C

c

c

c

C117

C

(

The following control sequences will getyou special symbols needed in foreignlanguages:

input outputC (German letter ss)_c (Latin and Scandinavian ligature ac)JE (Latin and Scandinavian ligature AE)oe (French ligature oc)<E (French ligature OE)0 (Scandinavian slashed o)0 (Scandinavian slashed O)

For example, if you want to specify "jC^op's CEuvres" you can type

\AE sop's \OE uvres

Notice that the spaces after the control sequences are necessary. Another way toseparate them would be to type

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):

input outputVo - 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)\=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)1 (Polish crossed 1)\Ced c c (cedilla accent)

The last three examples arc shown with letters other than "o" because they aresomewhat special. The Scandinavian accent is shown over an "a" since "6" isn't

"C\AE>sop's <\OE>uvres

«

r

C

C

118

C

a Scandinavian letter. Similarly, the Polish accent is specifically designedfor theletter "1", and cedilla accents arc usually associated with the letter "c".

These control sequences can also be applied to capital letters. For example,\"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 preferredsymbol, traditional in Scandinavian books. If you want "A", use \hScand A toset the circle higher.

There is only one little detail that T&X won't take care of automatically.When the letters "i" and "j" arc accented, it is customary to use the undottedsymbols "1" and "j". You can get these by typing \i and \j, respectively. Forexample, to obtain "minus" you would type m\=\i n\u us.

Sach type style hag its own accents, and yon can even miv th*"-

\bf\'\rm E E

CAUTION. Accents apply to only one letter, except for \t, which applies to apair of letters (with no space between them). If you try to type \'{ab> you'llget an error message. In fact, you'll get an error message even if you try to type\'<a>! Usually, TfJX will simply ignore superfluous pairs of braces. But extrabrace:-, 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 changeinstrucUion, like \it, followed by a letter. So you also can't type \bf\'<\rmE> or <\bf\->\rm E.

Another thing you can't type is something like \A\=x or \A<\=x>; in otherwords, you can't get an accent over an accent, as in the symbol i. (But you cando this in math formulas—sec Chapter2§ll.)Exercise . .

■C\it \'E> \'E Et\bf \'E t

■*,

C

C

Q

(

c

/

c

C

119

C

C

§4. Footnotes and further flourishesWe'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'reprobably already wondering about—footnote construction. It turns out that it'squite 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

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 ootnoteto serve . . .

for the sake of clarity.) The control sequence\f ootnote processes two elements,the footnote indicator (*) and the footnote text (Like this); it automaticallyplaces the indicator both at the end of the previous word ("high"), and at thebeginning 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 textgoes between \\ and \endf ootnote, the control sequence \footnote alwaysknows exactly which part of the input text is the indicator, and which is thefootnote text—that i> why it was unnecessary to type <Like this.}. AJi\>"i-l£X uses constructions of this sort for most control sequences that process a lotof input.

It doesn't matter whether or not you leave space(s) before typing\f ootnote.The control sequence \footnote automaticallyplaces the indicator right nextt_-jLLLe_jDr_^oJ_J_^^__£Jcr_li_Ao£jiQ±_a_.

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 wantto put the indicator right before some punctuation*, say a comma, you can'ttype

punctuation

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

"Like this.

\footnote*\\Like this. \endfootnote,say a comma, . . .

,*■

(

C

(

120

X

c

skipped:

punctuation\footnote*\\Like this . \endf ootnote\unskipsay a comma, . . .

For the second footnote on page 1-2 the author of this manual originallytyped

italicized\footnote*\\lt is surprising ... \endf ootnote in

since he didn't know that it would come out on the same page. This gave twofootnotes with the same indicator "*". Even worse, there was another horizontalline before the second footnote! So the input was changed to

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 aminor change after examining the first output. It shouldn'tarise 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 arealso dangerous, sin-.e Tj}_ won't split up a footnote for you. If you ask for afootnote that is too long to fit on the current page, TjtX will cut the current pageshort and transfer the line containing the footnote indicator to the top of thenext page, which will also bear the footnote itself. Extra space will be insertedbetween 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 footnotein 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 thenext 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 printall the footnotes together at the end of a section, \f ootnote shouldn't be usedat all; just add the instructions for the superscript numbers in the right placesin the text, and type all the footnotes at the end.)

_

C

\<

c

c

c

c121

C

c

SIDETRIP. In addition to the asterisk * you can use any of the favorite literarysymbols §, f, $ and as footnote indicators. Each of these symbols is named bya special control sequence, listed in Appendix S. Notice, however, that on mostfonts the asterisk already appears in the position of a superscript, while theseother 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 roughlyin order of increasing arcanencss. It's really one long sidctrip, and you might justskim through it, to get some idea what's there. But if you are determined tomaster all this material, the final Exercise will provide the ultimate test. It callsfor the construction of a file that uses every little point that has been raised inthis Chapter.

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 isdone 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 horizontalspacing and vertical spacing separately.

1. Horizontal spacing (\hskip): If you type \hskip iin in the middle of aparagraph, the output will have one inch of blank space at that point. Unitsother than inches can be used, but we will not discuss them until Chapter 2,which is concerned with setting formulas. Mathematics formulas are almost theonly places where you will ever want to request specific horizontal spacing, andeven then you will probably use one of the special control sequences that T£Xhas 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 immediatelylooks for a number, and then for a unit like in. This is another of those spefcialsituations, like accents, where extraneous braces will cause trouble.CAUTION. If you ask for an Xhskip lin, but there's not quite an inch of spaceleft on the line, you will get an Overfull box,.

SIDETRIP. There is one Xhskip that is useful when mathematical formulasappear next to each other in a "literary" context, so we will introduce it now,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, whichbelong to different clauses, tend to merge into one long math symbol. Some

■F

r

(

c

(122

C

(

authors will carefully avoid such constructions, writing for example,

For all x, we have x 2-f- 1 >0.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 thingsclearer. If you type

For all $xs,Xxskip $

you'll getFor all x, x 2-f 1 >0.

It doesn't matter whether or not you have space(s) before Xxskip—JLJk>'S-Tsiwill automatically adjust for this.

SIDETRIP. There are other situations where \xski ps can be used to give a littleextra professional gloss to the finished product. For example, in this manual anXxskip 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 someextra space between paragraphs. For example, you might want to leave 1.5 inchesof space for a hand-drawn diagram. To do this, type

. . . end of one paragraph, \par\vskip i.sin Startof next paragraph . . .

CAUTION. Don't type \vskip {1.5 in}; IgX expects to see a number rightafter Xvskip.

CAUTION. Notice that the Xvskip goes after the Xpar! T^X won't allow youto put a \vskip before the Xpar, or anywhere else within a paragraph. Untilit sees a Xpar, l£X is constructing horizontal lines of text, and a request for avertical space within one of these horizontal lines will be very unnerving.CAUTION, \vskips can cause the same problems as \footnotes. If you askfor a \vskip i.sin when the current page has less than 1.5 inches left, TfjXv/ill cut short the current page, just as it would for an overly long footnote. Youcan then try to shorten the space or put it somewhere else; as a last resort, trydeleting some of the deathless prose in the preceeding paragraph.

C

X

X

C

\r

c

c

123

v

SIDETRIP. There's another way to get blank space in the output without havingto worry about this problem. The input

ar\topinsert<\vskip I.sin}

will end the paragraph, and at. the same time reserve 1.5 inches of space citherat the top of the current pa.cc 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 be vCry easy to fix. Ifthe blank space comes out on the next page, then there just wasn't room for iton the current page, so it's probably justwhere you want it. On the other hand,if the blank space ends up at the lop of the current page, then you at least knowthat there is enough room for it en the current page, and now you can change

\par\topinsert-C\vskip i.sin}

to XparXvfikip i.sin.

Now thai, we've covered spacing fairly thoroughly, we'll mention two otherdevices that you will find useful.3. Sometimes you might have to start a new line of input text right in the middleof a long word. You certainly don't want to hyphenate it, because TrrX will assumethat your hyphen is part of the normal spelling of the word. In this situation, usethe control sequence jy., which .tells TirX not to count the succeeding (carriage-return) as a space:

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 bespaces before or after the dashes.

4- Wjjen^^^TrX sees the symbol %, it effectively ignores it and everything£fe__J__-_L_____e_4___j^^ This allows you to insert remarks that youdon't want to appear in the output:

by Schwartz's Lemma. %Is this how you spell Schwartz?

C

C

.124

{

(

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 inthe 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 fnamelnew paragraph! (And if you do something

like this while setting an equation, things will get very confusing, since you'renot supposed to start new paragraphs in such situations.) To be on the safe side,always precede comments_h_y_-somg t.pxt:

This % This is a very, very longis % comment that has had to be split upsome %onto three different linestext.

% 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 immediatelyafter 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 interveningspace!

You will want to use \/ whenever a slanted letter is followed immediatelyby a tall unslanted character, like ; ? ! ) j and also " (as the author ruefullyfound out 7 lines ago!). You will also want to use \/ when a slanted letter isfollowed immediately by a roman letter (this might happen, for example, if youonly italicize the prefix of a word).

the two % signs); so TpX will start a new paragraph!

c

C

125

C

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 '" whichlooks 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 combinationsspac 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 morespace at the ends of sentences than between words, because this looks better. Butperiods 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 thisproblem is to use the control sequence \q mentioned in §1. If you type

i.e.Xu cf.\U etc.Xu Proc . \UAmer .UMath . \uSoc . \utkc_Ll_-X-VdlUnseri_ordina inter-word spaces, rather than the somewhat largerspaces that occur after a period.

L

C

126

C

(b) We hate to mention it, but sometimes periods after upper case letters areends of sentences:

Whose out there writ-ing all this crazy stuff?It is I. Supported in partby 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-dicator is placed right before some punctuation. A less critical problem arises ifyou want to put a footnote indicator on the last word of a sentence.* Since theperiod no longer occurs at the end of a word, T£X won't know that the sentenceends there! So it will leave only the usual interword spacing, instead of thesomewhat larger space that normally goes after a period. If you really want toworry about this, you can use Xxskip (page ??): type

of a sentence.\f oobnote*\\Af ter the period . \endfootnote\xskipSince 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 areregarded as very bad style, but conceivably you might have to resort to one inorder to avoid even worse breaks somewhere else. If you want to allow a dash tooccur 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 theparagraph crumbles.

*After the period.

r

»

C

c

f

c

*-.

C

C

127

<

9. We've purposely delayed explaining a point that may have been botheringyou for quite some time. If you want an unindented paragraph, type Xnoindent£i&ht before the input which bepjnsjt. For example, the unindented paragraph(b) in topic 7 was produced by typing

Notice that we still have to finish the previous paragraph with a Xpar or a blankline. You really shouldn't ever need to use Xnoindent, because JUkS-Tffi. docsall the formatting for you.

CAUTION To start this topic we really typed something like

to get the extra space before the unindented paragraph. But this device should beused very, sparingly! Remember that you don't want to add instructions that willdefeat X/IW-'iLX's journal formatting feature! If you arc setting a paper in thepreprint style, but you want all paragraphs to be set unindented and prececdedby a certain amount of space, you shouldn't add a lot of \par\vskip .iinXnoindents. 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 theXctrl me).11. Suppose that you've just finished a section, and you want the next sectionto begin at the top of the next page. Type

\par\vf illXeject

right before the input for the next section. The \jpar ends the last paragraphof the present section, the Xvf ill fills the remainder of the page with vertical

Sfiace,

and thcAej^ct^a^uMLy^njlUh^jiage. ~

after a period, \par\noindent (b)

of the game.\par\vskip . iin\noindent9. We've

.

128

Occasionally you might want to use \eject without the \par\vfillpreceding it. For example, suppose that page 3 happened to get two footnoteson it. When you change the second \footnote to \sf ootnote, some verticalspace 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 bechanged slightly, which could be quite a problem if the spacing on these pagesis a delicate issue. To avoid this, just type \eject after the last word thatappears on page 3. Since you didn't end the paragraph with a Xpar, TeX willstretch the last line to the right margin. And since you didn't use \vf ill tofill up the remainder of the page with empty space, the extra space created bychanging \footnote to Xsfootnote will be distributed between the lines, innearly imperceptible increments.

i

£

c

C

c

C

c

f

C

129

X

§3. Final formatting.

In §2 we spiffed up our file with control sequences like Xbeginpaper andXendpaper. This section covers some of the other control sequences which areused 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-quences, probably more than one would want to contend with at this delicate stageofour 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. Mathematicianssetting their own papers will probably prefer to leave the details of things likethe bibliography to some one else, while technical typsists will eventually wantto learn all the formatting control sequences.

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

Xtitle . . . \endtitleXauthor . . . XendauthorXaddress . ... Xendaddress } (optional)Xacknow . . . Xendacknow\d-te . . . \enddate

Xabstract . . . Xendabstract (optional)Xbegintext

Xendpaper

They should be used in the order listed, with Xbeginpaper coming right afterXinput amstex and \input preprint and with Xendpaper coming at thevery end. No particular order is required within the group of control sequencesthat appear in braces {}.

We've already mentioned that Xtitle . . . Xendtitle gives a one-linetitle- £o_-_o__yl_--Jin-L^lcJt only necessary to separate the individual lines b

s

130

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 adouble Xacknow, like "The first author was supported by W.A.T.E.R. and thesecond author acted under the direction of W.1.N.D." This is the way that thepreprint format expects multiple-author papers to be handled. But many journalshave special formats for multiple authors. Simply list the authors, their addresses,and their acknowledgements as

Xauthor first author \\ second author XX . . . \endauthorand so forth.

The control sequence Xabstract . . . \endabstract is used for textthat might be set in a separate style, to serve as an abstract for the paper. Ifthe journalnormally prefaces abstracts with the word "Abstract.", "Summary.",etc., this will be printed automatically, so it shouldn't be typed. If the journaldoesn't print abstracts, the text will simply be ignored.

After Xbegintext comes the actual text, whose formatting also requiresspecial control sequences. The most important of these is

Xtheorem . . . \\ . . . \endtheoremwhich processes a statement and a label attached to it. For example, with thepreprint format, the input

Xtheorem Theorem (Folk-theoref .)\\One plus one is two, andneither four nor three . Xendtheorem

gets printed asTmiOßliM (FOLK-THEORCM). One plus one is two, and neither four nor three.

Notice that the period after the label gets printed automatically (some formatsmight print a colon, or nothing at all). Of course, Xtheorem can also be usedfor a Lemma, Corollary, etc.

The proof of a theorem (or lemma, corallary, etc.) should be processed bythe control sequence

Xproof . . . \\ . . . XendproofFor example, with the preprint format, the input

Xproof Proof \\See the Collected Poemsof A. E. Haussman . Xendproof

gets printed as

c *i

<

ic

c

c

c

c

V

C.

*

131

PROOF: See the Collected Poems of A. E. Haussman.The colon, or whatever, gets printed automatically.

in the way that _/L.__'-T£X treats them. The statement of .1 theorem is usuallyset in a special way (c.g.,in italic type), so -Olif-TcX needs the Xendtheorem totell it where this special processing ends. Ifyou leave Xendtheorem out, IgX willsearch all the way to the end ofyour file in an attempt to find it. (Of course, yourfile might well have an Xendtheorem at the end of the next theorem—this willprobably cause complete chaos!) So don't forget to put the Xendtheorem at theend 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 atthe 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 apaper, but there are a couple of others that you might find useful at this stage.

Frequently, a statement mentions several properties or conditions that aredisplayed, as in

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.This shouldn't be set with Xpars, because the indentations have to vary

so that the right parentheses will line up; moreover, different formats specifydifferent indentations, as well as different type faces for the labels "(i)" and "(ii)".Instead type

Xtheorem Theorem\\Suppose that all the standard lav/sof 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 . XendtheoremNotice that \\ separates the individual lines of the Xconditions, while thespecial symbol Sc separates each condition from its label; in the next Chapter wewill discover many similar uses for &., to line things up correctly.

At the end of a proof, right before Xendproof, you can type the controlsequence 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 perhapsnothing at all.

Althoug!Xtheorem .

_hAl .. . .XXAx\ . . Xendproof looks completely analogous to

Xendtheorem, there's actually a big difference

t

C

c

Chapter 2. T£X's Brand of Mathematics

Thereal fun r.iul challenge of technical typesettingcomes from thehorrendousformulas with which mathematicians routinely deal. Insider.* know, of course,that the complexity of these formulas is somewhat misleading. Big formulas aremade up of smaller formulas, and smaller formulas are made up of yet smallerformulas, and .... Unlike Swift's hcirarchy of back-biting ilc-»s, this process doesnot go on ad infinitum —all formulas can be built up in a few steps from relativelysimple ones. So it's clear where the art of technical typesetting has to begin.

<X

c§] . The shnpl;..sl formulas. To le]! 7yx: that the n?:.t pari cf the present par-giaphis part of a mathcin.itical formula, simply enclose it within $.;;igns- this causes'TpX to enter "mathematics mode" and to pro_oss that input t.:.t specially. Forexample, you can o.rt tin; formula y — 3{x — 1.5)/(—2\x\ +j) to appear in theoutput by typingc

. . . got tin. formula $y= 3 ( x -1 . 5) /( - 2 I x l-t-1) $ toapp^p.r in th': output by typing ...Tlii.s simple example illustrates several important points.

(0 Letters are . :tomai icaHy italicized in I'-.rmulas, but numerals and punctua-tion symbols (like parentheses) are set in roman typ; .. Notice, by the way, thateven a single symbol can be a "formula": if you type $x$ in the input, you willget .." in Uie output.

(1>) The hyphen becomes a minus sign and (he slash become;; a slanted fractionC J 'nc - n, lirI ir- xy^'bo! U\ stands for ihc "absolute value of 1". but it's not necessary

to k.-ic-A what (hi . means; the only important thing is that TtX will typeset |even if your kin- board has j instead of I .)

(3) Most important of all, T^X completely ignores all spaces within $ signs.When setting a formula, T|y< relics on its own spacing rules, which probably

(X involve more details than you would want to keep track of. For example, in theformula y = 3(x — i.5)/(--2|i| -j- I) the — sign is a "binary relation", wiiichfunctions as a verb, and the -j- sign and the first — sign are "binary operators",wiiich function like conjunctions, while the second — sign functions like an ad-jective. Standard printing conventions use spacing which reflects these differentroles: thus, there is a little more space around.the — sign than there is aroundthe -f sign or the first — sign, while there is no space at all after the second —sign.

2-1

*

(

(

c22

(

CAUTION. Although spaces and single (carriage-rcturn)s don't count in mathmode, you can't have a blank line, or a Xpar in math mode—the whole conceptof paragraphing doesn't make sense within a formula.CAUTION. If yon leave out the $ sign which ends a formula, and nonchalantlycontinue with input text, I^X will naturally assume that you want to processeverything up until the next $ sign as one gigantic formula

Most likely you'll get an Overfull box. Of course, before Ts. ever finds thenext

$

sign, it might encounter something which isn't allowed in math mode, likea Xpar, for example. In this case you'll end up with an error mc.sage. But inany case, you will probably get IftX (and yourself) thoroughly confused—a lot ofyour input will come out as garbage, if it comes out at all.

In parsing, you might notice that the spacing in the above output is differentfrom that used for ordinary italic text. Compare

typing on line A (the product oft, y, p, j, n and g)with

typing (the italicized word).

Although TcX ignores spaces within $ signs, they should not be regarded asuseless, since they can make the input text a lot easier to read—for example,individual parts of long complicated formulas can be separated by several spaces.Initially, force of habit may lead you to use spaces even m short formulas, like

so as to approximate the spacing that will eventually appear in print. However,you'll soon come to realize that the spaces do nothing but slow down the typing,and you'll probably graduate to something like $y__3 (x-1) / (-2 I x I +1) $, reserv-ing spares for more complicated situations. In this manual we'll use spacing in ahaphazard way, just to emphasize that it's an unnecessary good.

Exercise. What's wrong with typing the following?

Exercise. Explain how to type the following sentence.

Deleting an element from an n-tuplc leaves an (n — l)-tuplc.

y = 3(x— 1,5)/(—2\x\ -)- l)toappearinlheoutpu.tbytyping. .

$y = 3(x - i.5)/(-2|x| -

1)$

If the formulas y=x-l$ is true

t

X

£

c

c

C

C

C

X

Don't be taken in by T^X's finesse in setting mathematics formulas. Eventhough TjjX is usually smart enough to choose correct spacing, if docan't really"understand" formulas (any more than a human typesetter docs). Technicaltypists should regard this as good news, for it means that they don't have tounderstand the formula either! For example, it's not important to know why theparentheses arc there—so long as they get typed in. Mathematicians actually useparentheses in many different ways, but again it is not necessary to understandthese different uses. If you type $y-f ( x)s you will get the formula y = f(x),in which the parentheses have a special mathematical use. Similarly, if you type$y=f [ x] $ and $z=f (x ,y) $ you will get the formulas y -- /[_.) and z = /(.?, y).

The brackets and comma in t.heso formula illustrate once again that punctua-tion marks in formulas arc set in roman type. Notice also that a comma in aformula is followed by a smaller space than a comma in ordinary text (T£X docsthis because commas in formulas usually separate parts of a single mathematicalentity). For this reason, actual punctuation commas should always be left out sidethe $ signs. For example, always type

rather than

SIDETRIP. Colons and semi-colons are also foliov/fd by a smaller space in for-mulas. No space at all b left after periods in formulas, so that you can get decimalnumbers, like 3.11159.

Malhcmaticiansarc usually pretty careful about putting the necessary paren-theses in their manuscript. But they sometimes get lazy, and stop countingparentheses in a formula like the following:

Even if the parentheses don't match up, a catastrophe won't ensue—T]^X isn'tvery discriminating on this score, and will be quite happy to typeset the formula

even though it is mathematically unacceptable. This is fortunate, because Tiy<mustn't object to a formula like [x,x + I], which doesn't look like it should bemathematically acceptable, but which actually is, because the parenthesis andbracket have special meanings.

For all $a$ and $b$ we have $a<bs , $a=bs, or $a>bs.

For all $a$ and $b$ wo have $a<b, a.=bs, or $a>b.s

J +2(3 + 4(5 + 6(7 + __)))

I + 2(3 + 4(5 -|- 6(7 + x))

2-3

»

C

(

(

(

(

Braces, as well as parentheses and brackets, are often used with specialmeanings, as in the formula

To set this formula you have to remember that printed braces must be specifiedby the conftrol sequences\< and \>, since actual braces serve the special functionof grouping things. Thus, you should type

Brackets and braces may also be used just like parentheses, in order to makethe pairings clearer, as in the formula

Such constructions are becoming a little old-fashioned, since [ ] and { } frequentlyhave special meanings, but they occur often enough in many branches of math-ematics.

Exercise. What output would be produced by the following input?

In connection with this exercise, notice that the input

with one < and no matching >, will cause T)rX to throw a fit. Printed parenthesesbrackets and braces (specified by \< and \>) don't have to be balanced in for-mulas. But actual braces in the input arc instructions to Tr^X—they must' btbalanced.When IcX ,s setting formulas within text, it may have to break them betweenlines. Broken formulas arc always a headache, so T^X avoids breaks when itcan, and tries to choose reasonable breaks when necessary. Preference is givento breaks after binary relations, and second preference to breaks after binaryoperators. For example, if the formula specified by

must be broken, the break will occur after the = sign if possible, or after the +sign or - sign, as a last resort. A break definitely won't occur after a comma

* + W + (*) + [*] + {x}

x +|x|+ (x)+ [ x]+\-Cx\>

l + 2{3+4[5 + 6(7 + x)]}

$l+2<3+4 [5+6(7+x*) ] >$

$l+2<3+4[5+6 (7+x) ] \>s

$f (x,y) =(x+y) (x-y)s

2-4

f

c

c

C

c

c

r

C

(.

25

C

(which is another reason why punctuation commas should be left ouside the $signs). Anything in braces is treated as an unbreakable unit, so you can avoid abreak after the + or — by typing

Remember, however, that by doing this you may be forcing I~EX to give you anOverfull box message. Actually, it really isn't necessary to bother worryingabout such things until you encounter one of those rare instances where a badbreak occurs. (And then the best solution may involve a little rewriting.)SIDETRIP. If you type $(x+y)\*(x-y)s,Ts{ will treat the \* somewhat likea discretionary hypyhen \-, except that \* means multiplication: a line breakwill be allowed at that place, if necessary, but I^X will insert a X, rather thana hyphen.

One of the simplest things to do with a long formula in to display it, insteadof trying to set it within the text. Even short formulas may be displayed, to givethem prominence. The art of displaying formulas is actually an important aspectof mathematical style, so TljX will never make a decision to display a formulaon its own—you have to tell Ts( to do this by enclosing the input in $$ signsinstead of $ signs. For example, the input

produces the output

Notice that everything between the $$ signs got set as a one- line formula—multi-line formulas don't get explained until §8. Notice also that although thecomma was typed outside the $ signs, the period was typed inside the $$ signs-otherwise the period would have appeared at the beginning of the next line, rightbefore "Consequently" !CAUTION. We broke the first line of this input in a weird place as a reminderthat in math mode I^X ignores all spaces, including the ones created by 'carriage-return^. But remember that you mustn't have a blank line in math mode—thisincludes formulas between $$ signs as well as ones between $ signs.

$f Cx,y)=<(x+y)(x-y)>s

. . . If $f(x)=x+ls, then we will have $$f ( [x+l3 / [x+2] )=\< [x+i] / [x+2] \>+l

=(x+i)/(x+3) .ss Consequently

. . . If f(x) —x+ 1, then we will have

f{\x + Ij/[x + 2]) = {\x + ]]/[x + 2]}'+ 1 = (x + l)/(x + 3).Consequently, . . .

'. '

r

C

26

(

SIDETRIP. If a proof ends with a display and you use the control sequence Xqed(page??), it should also occur inside the $$ signs.SIDETRIP. You can put math formulas with the text of a \f ootnote, by using$ signs, but for technical reasons you can't put $$ . . .$$ within a\footnote.(In order to process a \f ootnote, IftX goes into an altered state of consciousnessfrom which it is not prepared to take off into the astral plane demanded by $$signs.) If you really must have a displayed formula in a \f ootnote, see §11.

Conversely, as good taste alone would dictate, you can't have a \footnoteinside a formula, whether displayed or not.

So far we've only dealtwith formulas involving letters, numerals and punctua-tion, togetherwith the symbols =, +, — , <, >, |. But mathematiciansroutinelyemploy dozens of other symbols, like 00, <, V, £, etc. Each of these symbolshas a control sequence to name it. For example, the symbol G, which indicatesmembership in a set, is named by \in. So you can get the formula x G A bytyping x\in A (notice that the space after \in is needed!). Similarly, the symbol00, which stands for "infinity" (more or less), is named by Xinfty (the shortername \inf happens to be used for something else, which we'll learn about in §8).The names for all special symbols are listed in Appendix S—they can be learnedas needed.CAUTION. All of these special symbols should be used only in math mode(between $ signs or $$ signs)—T^X will complain if your input file has \in orXinfty outside of n.ath mode. Also, some keyboards have special keys like 00,but you should not use them, even in math mode—there's no reason to expectthem to give you the right thing. You really shouldn't even use the keys labelled=, +, <, > and | outside of math mode, since the spacing won't be right. As amatter of fact, outside of math mode the key labelled I won't even give you |(try it and sec!).

Mathematicians have supplemented their arsenal of specially concocted sym-bols with a horde of letters stolen from other alphabets; control sequences forthese special symbols arc also listed in Appendix S. For example, $\alphas,$\betas and $\gammas produce the Greek letters a, (3 and 7, while $\Gammasproduces T, which is an upper case gamma. Notice that $\epsilonsproducesthe Greek letter c, which is quite different from the membership symbol £. Justto make matters a little worse, c has the variant form _? , which is producedby $\varepsi lons. Three other Greek letters also have variant forms: whilethe input $(\phi , Xtheta, \omega)s yields the formula (<£, _>,u>), the input$$(\varphi, Xvartheta, \varcmega)ss yields the displayed formula

(<p, -d, w)

v

- .

c

X

(

c

C

(

(

C27

C

CAUTION. TJjX has no regard for the glories of the Greek tcnguc—as far asit is concerned, Greek letters are just additional weird symbols, and they areallowed only in math mode. In a pinch you can get the output rex by typing$\tau\epsilon\chis, but if you're actually setting Greek text, you will beusing a different version of TftX, designed for a keyboard with Greek letters on it,and you shouldn't even be reading this manual, which is undoubtedly all Englishto you.

SIDETRIP. Although 6 is rapidly gaining acceptance as the standard symbol formembership in a set, some mathematicians prefer c or £ . If this is required, don'ttype $.\\epsilon As, because you'll get xtA, with the wrong spacing. Insteaduse Xepsilonin or \varepsilonin.SIDETRIP. Upper case Greek letters actually come in two styles,

andr AOAniiErvvn

(all the other upper case letters arc 'dentical with upper case roman or italicletters, at least so far as mathematical typesetting is concerned). The choice ofstyle is made by the journal format; the preprint format uses the "italic" style,unless it is changed as explained in Chapter 5.

In addition to Greek letters, X/iW-T^X will also set upper-case script letters"A,lt>, .. -6 and the lonely lower-case produced by $\Ascrs, $\B>_crs, ...,\Zscrs and $\lscrs. Like Greek Setters, these control sequences can be usedonly in math mode.

X/il.xTi^< lias several other special fonts, like gothic (German), that are usedin math formulas; Appendix S also lists these fonts, together with the controlsequences that identify them. To indicate a letter in one of these fonts yousimply type the identifying control sequence right before the letter (but you'vegot to be in math mode). For example, $\goth g$ produces a , while $\gothG$ and $\goth

S$

produce v£ and G> (which only people like Q^tiht, andGtk'tUtr r.an distinguish). You can get Xgoth to apply to a group of letters

by enclosing it in braces, and you can even have the symbols +, -, =, <, >, | and/ in the group :

Notice that Xgoth doesn't work in the same way as the control sequences\rm, \bf, \it and \sl, which arc meant for ordinary text, and aren't even

rAeAEiiEY**n

Xgoth aa+ \goth-Cb+|c |-d>+e £<_ + b +|<-| — 4 +c

- -

(

28

(

(

allowed in math mode. The control sequence Xgoth applies only to the nextletter, or group—succedingsymbols are set as usual. Notice also that the hyphencomes out as a minus sign, which is what you'll usually want. A special controlfrequence is available if for some reason you need the hyphen from the gothicfont.

Bold face letters in math mode are treated as a special font, even though theymay be the same as the bold face letters used in ordinary text. To get boldfaceletters in math mode, use the control sequence \bold:

Notice that \bold works like Xgoth, and not like \bf.There is one Cher feature of technical typesetting that ought to be mentioned

in this section. Sometimes formulas can be made to look a little prettier by usingslightly bigger parentheses ( and ) (named by Xbiglp and Xbigrp, respectively).For example, \big parentheses arc used in the formula

(x-/(y))(x + /(y))And \bii£ parentheses should also be used in formulas like

0(l/n)Here O is an upper-case "oh", not a zero (helpful hint: a formula should usuallyhave O instead of 0 when it comes right before a left parenthesis).Exercise. What input produces the above formulas?

Unfo/tunatcly, there are few hard and fast rules for choosing \biglpsand \bi crrps, and mathematicians will seldom indicate them explicitly in theirmanuscripts (though they may appreciate them in the output). In fact, evenjournals may be negligent about using larger size parentheses (maybe X/M-Ti^.will change that).

J-Jh'S-Tty actually has three sizes of large parentheses that you can specify:( Xbiglp and \bigrp)

i Xbigglp and Xbiggrp j

( \kiggglp and Xbiggrp jMoreover, there are corresponding brackets (Xbiglbracket, Xbigrbracket,etc.), braces (\biglbrace, Xbigrbrace, etc.), vertical lines (\biglv, \bigrv,etc.) and double vertical lines (\biglvv, \bigrw, etc.). But you will almostnever need to use any of them. As we shall see in §C, you can usually ask T£Xto select the right size for you.

. $\bold xy+zs xy + «

1)

C

r

V

r

c

29

C

§2. The 2nd level of complexity.Technical typesetting wouldn't be such a big deal if spacing were the only

concern. But mathematics formulas also convey a lot of information throughthe positioning of text—as superscripts and subscripts, for example. Since youcan't use positioning on the terminal -the input just goes in line by line—all thisinformation has to be conveyed in some other way.

Superscripts and subscripts are indicated by the control sequences \sp and\sb:

The input produces the output$x\sp2s x 2$x\sp a$ xa

$x\sp\alphas x°$:< \sb2s x 2$2\sp x$ 2*

If your keyboard has T and J- you can use them instead of \sp and \sb:$xT2$ x 2$xX2$ x-2

Actually, T is one of the standard keys that will be. on nearly every keyboard.This key wasn't mentioned in Chapter J because it often appears disguised, as

(arrow-head or "carat"); it can often be found on the top half of the 6 key.Whether it appears as Tor ", it will work just the same. The key X is not standard,and will be missing from many keyboards,* but to save space in this manual wewill usually use T and X instead of Xsp and \sb.CAUTION. Use the T and X keys only if they actually produce symbols on thescreen. Some terminals have keys labelled T and J which do not enter text, butmerely move the cursor up and down.

The instructions T and X apply only to the next single character, so there isno ambiguity in the following:

*lr.von don'l have a hoy labelled X

you

can goI. Hie elTerl or X by using "control A", providedthai there's a oonvonienl

wn.y

for you to..outer "control A" inlo your lilo.

$xT2yT2$ x 2y2

$x\sp2y\sp2s x 2y2

$x T 2y T2s x2lj2

$xX2yX2$ x 2y2

$X2FX3S .2F:i

$<>T2FX3S 2F3

t

(

(

210

(

(

Notice that you can have a superscript or subscript following nothing, as in thelast two examples.

If you want a whole expression superscripted or subscripted, just enclose itin braces:

Exercise. Explain how to get a footnote 1 with a numerical indicator, or afootnote^ 2 ) with a more complicated arrangement.

When a sub or superscript applies to a whole expression, mathematicianswill u__ parentheses (or brackets or braces) to indicate this:

Actually, mathematicians and experienced technical typists may be somewhatsupri.sed that these simple inputs worked—how did TjjX know, for example, that3 was supposed to 'c an exponent to the whole expression (x +1) or (x2 )? Theanswer is very simple: r_£X didn't know—it just followed instructionsvery literallyand set the 3 as an exponent to the right parenthesis! On the other hand, here'swhat happens when you enclose things in braces:

(z + 1) ! (same as before)(x 2)3

Although this might seem better from a logical point of view, expressions like(x-)' 1 arc standard fare in most printed mathematics.

'Like lliis one.2. Like (.his one!

$z=xT {2y>s$xX<y+z>=v/$$2T<32>s

z =x 2«

Xy+Z = W

232

$xX<lo>s

x{3i/>$xT{\-C3y\»s

$(x+i)T3s$(xT2)T3S

$[xT2]T3$

(* + I)3

{x 2y»$\<xT2\>T<3y>s

${(x+l)}T3s

$<(xT2)>T3$

${[xT2]}T3s

l*¥$< \<xT2\> >T{3y>s$<«(xT2)>T3)>T4$

. >

X

c

IC

211

Exercise, ir you did decide to use these higher superscripts, how might the lastexample be improved?

You will need braces stacked in the other direction for sub or superscriptsthat arc themselves sub or superscripts:

Notice that superscripts arc sat in smaller type, while superscripts to superscriptsare set in yet smaller type (in most formats); T^- doesn't decrease the type sizeany further after this, because such tiny symbol;; would be too hard to read. Bythe way, if you set a big tower of superscripts, like 22""'' within text, T_jJ( willautomatically leave enough space around the line containing it.Exercise. V/hat output would be produced by the following inputs?

As this exercise is meant to show, there is a big difference between xT<yTz>and <xTy>Tz; while the first produces x""', the second simply produces x!,: , whichcould just as well be specified by xT-Cyz>. Tvj>. will not accept the ambiguousinput xtyTs (some computer typesetting systems treat this as xT{yTz}, whileothers treat it as <xty}Tz). On the other hand, you can have simultaneoussubscripts and superscripts, specified in cither order:

You can also get staggered sub and superscripts, by the artful use or braces,even resorting at times to the empty group <>:

$2T{2Tx}s 22*2T{(2Tx)>s 2V">$2T{2T{2Tx}}s 22'12T<(a+b)T2>s 2(

Q

+fc)2

$xX<yX2>s XyjxX{yT2>s v

$<2T2>Txs $-CxXy}X2s

$xT2X3S$xX3T2S

$xT-C3l4ls>X<92>+\pisxX{yTaXb>T<zXcTd>s

A4

X~r,.fib

$<ATa>Xbs or $ATaOXbs$<xXi>T2s or $xXi<>T2s$RXi-C>Tj<>X{kl>s

A\Xi 2

n tJu

c

X

(

(

(

The non-staggered form is generally considered more elegant, and formulas likeA"b often appear in printed works only because they are easier to set on a linotypemachine. But in some cases the staggering serves mathematical purposes. Manymathematicians prefer i; 2 when the 2 docs not function as an "index", but in-dicates the square of x,-. And the example J.,J- ./ is not a weird product of theauthor's imagination; rather, it is a weird product of "tensor analysis", a branchof mathematics waggishly defined as the study of sub and superscripts, whereexact positioning is important.

There are two sub and superscripts which require a little separate discus-sion. The control sequence Xprime stands for the character /, which is used forsuperscripts:

$yXlT\prime + yT<\pritne\primo\primtjXX2s %jx + y'2"And the control sequence Xast stands for a centered asterisk * (Xast is allowedonly in math mode, and the symbol it produces is quite different from the symbol* that you obtain when you press the key labelled *). It is frequently used forboth superscripts and subscripts:

SIDETRIP. We said that Tj^K sets sub and superscripts in a smaller size. Actually,that's not quite true! Tj^C will automatically select a smaller size for italic, Greekand script letters, and almost all special math symbols that you normally en-counter, including the Hebrew letter 1. (\aleph). But the smaller size won't beselected for the other special fonts, like Xgoth and \bold. To get the right size,you have to use the control sequence Xsizes, which specifically instructs T£Xto use the size for superscripts (you can even use \sizes when you're not in asuperscript):

Notice that braces surround the whole, \sizes construction in the first example.If the braces weren't there, T£X would think that you wanted 2T\sises followedby Xgoth g + \bold X, which doesn't mean anything at all, since \sizesisn't a symbol.

The control sequence \sizes will also be necessary for a whole bunch ofrarely used symbols, but there's really no need to worry about which symbolsthese arc. They will be used as sub and superscripts so rarely that you can justmake changes if they ever appear the wrong size in the first output.

On very rare occassions, you might need the control sequence \sizess,which specifies the size used for supcrscripts-to-superscripts (actually, for mostspecial fonts this is the same as the size used for superscripts).

$fT\ast(x)\hat

fX\ast(\mu)s f{x) f)Mf-i)

$2T-C\sizes<\goth g + \bold X» 2j+ x

(\sizes-Cx>+ y)T2$ (_" + y]1

2-12

4

«SIDETRIP. In an expression like x?)2Al3 the sub and superscripts will line upprecisely, because all numerals in a font have exactly the same width. But othersymbols won't line up so well, as in the extreme example

$RT-Ciii}X{mmm}s Dilimram

If this becomes bothersome, you can specify the sub and superscripts a pair at atime:

(

(

(.

(

(

§3. Defining new control sequences.

Although we've only begun to delve into the complexity of mathematicalformulas, T^X's capacity for creating new control sequences can already beaprcciated. If you're typing a manuscript in which the symbol R^k

i appearsfifty times, it's going to become quite a bore to type RXi-C>T{jk>OXl at eachoccurrence. For such situations you can create your own control sequences toserve as abbreviations, by typing*

\def me new control sequence -.input that this control sequence stands for}

Suppose, for example, that you want to use Xsymbol as an abbreviation for theinput that produces the symbol Rpk

i. You can type

and thenceforth T]^. will know that \cymbol stands for RXi {>T<jkK>Xl:

TpX does have, one idiosyncracy about control sequences: it distinguishesbetween upper and lower case for the fir tit letter of a control sequence, but notfor any others. Thus, \Cymbol would be a different control sequence, requiring aseparate definition, 'but if you typed XsYmbol you'd get exactly the same resultas if you typed \symbol.

Of course, a name like Xsymbol or \Symbol isn't a very good choicewhen several different symbols need abbreviations. For the control sequencethat abbreviates the input for RXi you might choose instead the name \R(mathematicians would probably pick something like \curv sinceRXt is a formof the curvature tensor). The particular choice of names is a purely personaldecision, but you'll probably want ones that are both brief and easy to remember.

The names of most. AjVo^-Tj^. control sequences were chosen more for theirmnemonic value than for their brevity. If your manuscript has only an occasionalGreek letter, you'll probably find it convenient to type Xchi for x n "d \xifor £ (assuming that you customarily call these letters by their proper names,rather than "cross" and "mainspring", or something like that). But when Greek

*Ho;hlois familiar with T^X (l lie basic svslem, as opposed in (he specialized . -1. H-J-Tj-J. ver-sion), know thai TjrX usually uses a slighh dilTerenl way of crealing new control .sequences.This

way

will also work in .(. H.l-Tj^.. but il. won'l give you certain safely features that we'llmention later.

2-14

Xdef ina\symbol<RXiOT<jk>OXl>

SgT-CmXsymbol gl<jk>ss 9ilßi Jkigjk

* a

c

!(.

c

C

c

C

c

215

C

(.

letters arc liberally sprinkled throughout a manuscript it can become wearisometo type long names like \alpha and Xepsilon, so you'll probably prefer yourown special symbols. For example, you might want \ag, \bg and \cg for a, /?and -,; and for F, the upper case form of 7, you might want \Cg (but not \cG!—that's exactly the same as \cg). Just type

and T£X will know that henceforth Xcg stands for Xgamma, which yields 7 inmath mode, while \Cg stands for \Garnma, which in math mode yields T (or F,depending on the format).Exercise. Why would il be a bad idea to define \ag as follows?

If you're going to use certain control sequences ("like Xccr and XcC. overmsUmiJiSMELJLhcy car] be put iiLa_Far4y^tjU_ig. When you create a file fora_ii_aayM_rip_^contents of the definition file into the beginningof paper . tsx. In addition to thecontrol sequences which will be part of your persona! working vocabulary, you'llusually want some new ones for each particular manuscript. It'll probably createless confusion if you first examine the manuscript to determine which new controlsequences will be. needed, and then list all of them at, or near, the beginning ofthe file —that way you'll know where to look if you forget any.

By the way, control sequences don't have to be used only for input that willoccur in math mode. For example, if the name "E. Cartan" occurs frequently,it might be convenient to define

Xdef ine\Cartan-C\'E. Cartan}

And, of course, a special control sequence was used to produce the logo "TVX"in this manual.

When you arc defining control sequences, a few precautions should be ob-served:CAUTION. As you can see from the above examples, the definition of a control.£-^Li.ilu_ce.j^ But don't make crazy definitionsthat define a control sequence in terms of itself, like

This would cause Tj^Xto replace an occurrence of the control sequence Xregressbyinfinite \ regress; then it would replace \regress again, to get infiniteinfinite Xregress; then it would replace Xregress again ... . Eventuallytiring of this nonsense, il would issue a pathetic complaint.

Xdef ineXcg-CXgamma} Xdef ine\Cg-C\Gamma}

Xdef ine\ag<3\alphas}

Xdef ine\regress-Cinfmite Xregress}

» »

i

(

C

.

{

CAUTION, In Chapter 1 we introduced the control sequence \f ootnote, whichcan be use. Tor example, as follows:

\footnote*\\ Footnote text, \endfootnote

Now if you think that \f ootnote is too long a name, you might define

and from then on you could get a footnote by typing

But don't try to monkey with the control sequences XX and \endf ootnote! Forexample, if you define

Xdef ine\ef n\\endfootnote}

and then type

it just won't work—you'll get an error message. The control sequence\f ootnotealways expects to see the exact sequence of symbols \\ and \endf ootnotefur-ther on (in this particular context, \\ and \endf ootnotearen't really function-ing as control sequences, but arc part of the "syntax" for \f ootnote). Laterin tins chapter v/e'ii encounter numerous control sequences of this sort, whichare used in conjunction with subsidiary control sequences. The same restrictionalways applies: don't tryr to do anything about the subsidiary ones.

SIDETRIP. A TLXperl could tell you how to change the \endf ootnote, -but\f ootnotcs are such rare beasts that it's probably not worth the trouble.

In all this discussion we've omitted one important point: just where do youdo your Xdef ines? Well, you can do them just about anywhere. You can type\define\. . . { . . . }in the middle of a paragraph, right between twowords. Or between the last word of a paragraph and the control sequence Xpar,or a blank line. Or right after a Xpar. Or right before an equation, or even inthe middle of an equation! When Tj^X sees a \define it simply takes note of thedefinition, and presses onwards.

There arc only two things that you have to be awareof. First of all, a controlsequence should always be defined before it is used- -if T^X encounters a controlsequence which has not yet been defined, it will issue an error message and stop.

Xdef in e\i-n{\footnote}

\fn*\\ Footnote text, \endfootnote

\fn*\\ Footnote text .\efn

2-16

* "

c

c

!c

c

c

C

rV

'(.217

X

c

(This also applies, of course, to a misspelled control sequence, so be extra carefulwhen you type control sequences.)Secondly, a control sequence that occurs between

$

signs or SS si m..r n.. ... fm-.gotten once the formula lias been processed—a Xdef me might be put between$ signs if it is just being used to help set a particularly complicated formula& \defme braces <. . .} is also fcrgotten once this rroup h..s Wnprocessed. Of course, you'd probably never think of saying \dofine withinbraces, butyou might end up doing this inadvertently ifyou use one ofthe controlsequences that docs a lot of fancy things for you. For example, if you have aXdef me inside a \footnote, this control sequences actually ends up puttingyour Xdef me inside braces, where it will promptly be forgotten. So don't buryXdefinestoo deeply.

There's one other thing that might be worrying you. What if you definea control sequence that's already been defined? If you do this, TeX will giveprecedence to the new definition, but only for the part of the input that comesafter this new definition. So if you've been using the definition\define\R_rUi-OT-CjkKHl}

and the symbol RX, disappears entirely after page 3, while the symbol RJklbegins to occur will, distressing regularity, you can now type

Xdef ine\rUßXi-QTj-C}X{kl}}

exercising care with your right braces, and henceforth the input \R will producethe new symbol R^m-You can even make definitions that overide X^-T^'s definitions of its owncontrol sequences. For example, suppose that want to have formulae like x _ Arather than x£A. You probably won't want to have to keep typing \epsi lanin(page*?). Instead you can redefine \in "

Xdef ineXin-CXepsilonin}

Wli£lLXC__Lm_Llj^^ will take precedence, since it will occur after"JAIXXXX* definition, which is made when Tj;X reads the line \input amstexin your file. So you can now get x c A by typing x\in A.Of course, there arc some dangers. For example, you might decide to define

Xdef ine\A{AXi -QT-CJ k}{}Xl}

unaware of the fact that \A already has a meaning (given in Chapter i§3, whichyou've skipped). With this new definition, everything will work just fine,' unless

« p

i-

218

i

you happen to across the symbol x in the manuscript. When you consult ChapterI§3, you'll find that this should be typed as \A x. But if you were to type

$\A x$

in this situation, you'd end up with

A ij ix\\So let's hope that you remember that you've already defined \A (that, at anyrate, is a lot easier than trying to remember all of Xy.l.'-TirX's control sequences,especially the rarely used ones).

Assuming that you do recognize the problem, what can you do about it?Well, you could go back to your definition of \A and change \A to something else.Of course, you'd have to make the same change at all the places where you'vealready used XA. This really isn't much of a problem with a text editor, but there'sa. trickier way out that is much easier. First decide on some alternative namefor Xyll-f-TjjX's control sequence \A. A safe choice would be \ncwA, since noneor _.._/..) if-TjjjX's control sequences begin with \new. (A briefer safe choice wouldbe XzA, since the Greek letter \zeta is the only JLJW-'[)&. control sequencebeginning with \z.) Then put the definition Xdef ine\newA-C\A} right beforeyour definition, so that your file has

Xdef ine\newA-C\A}\dofine\A<AXK)T-CjkH}Xl}

The first line gives \newA the meaning of JL.A\>'S-TrsCs control sequence \A. Thenthe next line gives \A your meaning. So everything's hunky-dory: you can nowget AX) by typing XA and you can get x by typing XnewA x.

TLX has many control sequences which arc not mentioned anywhere in thismanual, but which are used in the definitions of control sequences that do getmentioned. If one of these unmentioned control sequences ever got redefined, theresult would be complete chaos, because some of the control sequences which youuse would now have a completely different meaning! So .AJWi'S-T]^. won't let youredefine them— if you do try to redefine them, _4._-.b_f- I]^. will give you an errormessage.* There isn't much you can do at that point, except go back and replacethe offending symbol by something else, everywhere that it occurs. At the endof this section there is a (long!) list of all these forbidden control sequences, just

*This safely feature won't he present if you make .your delinitions in the basic T^X manner.

«w

219

in case you want to save yourself the trouble of finding out too late that fomecontrol sequence can't be redefined. There's no need to look al it very carefully.Most of the control sequences on this list have names thai you'd probably neverthink of using anyway; you might ju.t check through it and make a small list ofnames that you might conccivablyhave used.

Dy the way, all the examples in this section showed control sequences ofthe second kind (\ followed by letter..). Almost all the control r.cquenccs of thefirst kind already have a special meaning, so you shouldn't redefine them (.UW-T£j>( won't give you an error message about these, since you've just been givena warning). The control sequences \O. \l \9 don't have special meanings.however, and they arc good on-the-spot control sequences to use for oppressionsthat need abbreviation in just one or two formulas.CAUTION. A final admonition. If yen try to do something fancy with yourcontrol sequence, you'll probably botch it. For example, the author of this manualoriginally thnoughl that it would be neat for _-Ut,_"-T£.X to define

Xdef ine\f;troke<T\prime}

so that you could get / by typing £fXstrokeS, instead of $fT\primes. Butthis doesn't work, because (he input $f\ctroke\strokcs would be translatedinto the input $fT\p.-imeT\prime3, which isn't allowed. As a general rule, usecontrol _'.-qu ences for specific complex symbols, rather than for "operations".

SIDETP.iP. Exercise. The following definition cleverly avoids the problem:

Xdef ineXstroke-COTXprime}

But it still doesn't work. Why not?

SIDETRIP. Exercise. Yon intend to tel! people that there are lots cf things theyshould not do, so you'd like to have a control sequenceKnot that gives the word"not" in boldface. Explain what's wrong with the definition Xdef ine\not<\bfnot} ?.ni\ give a good definition.

SIDETRIP. You probably shouldn't read this. ("A little learning is a dan-gerous thing ... ") In the Introduction we said that the underscore key _ willnever be used. This could be passed of] as a white lie, ifwc hadn't been so damnedemphatic about it! Actually, .AXillf-T^X treats an underscore exactly like a letter.So you can use underscores in the names of control sequences of the first kindlike

\symbol_one \sy;tjmol_two

r #»

(

f

(

t

220

c

t

As a matter of fact.XAMgC uses _ in the names of many of its own controlsequences, ones which never appear in this manual, but are used in the defin tionof control sequences hat do appear. All of these special AMT& control ser^nir 7" 7fSt ,CUCr - l0WHatCVCr y°U d°' lf y" Use »nde«o*m the name of a control sequence, don't put it al the beginning!

.. 1--X-

_»"" "

C

C

C

c

C

c

c221

C

§4. Control sequences with ngruments.Although we've said a lot about control sequences, so far we've only produced

rather simple-minded ones. In practice, you'll probably require control sequencesthat arc more flexible. For example, if the symbol RJ\ occurs frequently in amanuscript, it's a good bet that the same symbol will also occur with I replacedby other letters, like _V\ R t

Jkj, RX\„ /_,j"V You don't need to make specialcontrol sequences Tor each such symbol. Instead you can define a control sequence\R "with one argument" —this means that $\R 1$ will produce, ff ,■">*, and $\R\alphas will produce R, jk.„ etc. To do this you tvnc

This tells TtfX that \R 1 should be translated as RXi-QT{jkK}Xl, while theinput XRXalpha should be translated as RXiOl"CjkH}X\alpha; whatever_______umc»t". appears after \R gets substituted for #1 in the definition.

If, your argument involves more than one symbol or control sequence., iti______Ui_L_l____Mc_^^aruuni-iit. Compare the following:

Exercise. What cutpu. would be produced by $\R-ClT\ast}sand$\R lT\asts?What would happen if you typed $\R lX\asts?Exercise. If your manuscript has oodles of boldface letters in math formulas, it'sgoing to b" very unpleasant tocontinually type Xbold x, \bold y, etc. Explainhow to define a control sequence \1 so that \lx gives a boldface x, \iy gives aboldface y, etc. Why is \l a better choice than something like \b? ° '

Exercise. Also explain how to define a control sequence \2 so that \2x gives aboldface

\

in the proper size for a superscript.

CAUTION. The same control sequence can't be used both as an ordinary controlLemtcjtcc and as a control sequence with one argument. For example, if you firstdefine

and later define

__-_3-JXe____.^ henceforth \R will be understood to bea control sequence with one argument.

\define\R#l<RXi-C}T<.jk}OX#l}

\R I+i RXi + 1\R -o+i} RXr+i

\define\R<RXi{}T<jk}<}Xl}

\define\R#l-CRXi<}T<jk}<}\X#l}

(

(.

.

(

C

CAUTION. When you make a definition like

Xdefine \R ■CRXiO'KjkHHl}

any spaces after Xdef me and \Rarc irrelevant (they're ignored, since they followcontrol sequences). But you have to be very careful when you define a controlsequence with one argument, like

Do not leave a space, or a .carriage-return),between $1 and -Ci!—this could leadto incredible confusion.SIDETRIP. Namely, if you were to define

-.v .iii a space after #1, then TjJ. would think that you actually expected a space■'■a follow the argument. So, for example, if you gave Tjy. the input

it would conclude that the argument has to be 1-+-!=, and ycu would end up with

In order to introduce control sequences with arguments, we used the ratherunrealistic premise that only the last letter in the symbol R.X'i happens to vary.In practice, a manuscript with the symbol fiX i will probably have lots of othersubstitution:, for the indices, like TVJ'/, RXn, etc. So you will really vvantja^controjsequence with four arguments. To produce this you define

This new control sequence works as follows:

$\R ij'kls RXIRXkr? i'lRj h'

$\R iXalpha lks$\R j{iT\prime}l{kT\prime}s

Control sequences with several arguments require even more precautions thancontrol sequences with one argument.

\define\R #l-CRXi<}T-Cjk}<}X#l}

Xdefine \R #1 -CRXi<}T<jk}-C}X#l}

$\R I+l= 3$

iWi=3, rather than RXi +1 = 3

\define\R#l#2#3#4<RX#l<}T-C#2#3}<}X#4}

2-22

* r

C

C

r

C

223

CAUTION. In the above definition, the symbols *i g4 that follow \R mustc__JDC_ijLXM£yX-_^t__order, and you" can only ''go up to jta, (O n the otherhand' the °- dcr of appearance within the definition itself doesn't matter. Forexample, if you prefer naming all subscripts before all superscripts you candefine \define\R#l#2#3#4<R X#l {}T{#3#4}{}XJ2} so that $\R iljkswill produce /_,J /.)CAUTION. When typing the part of the definition consisting of the symbols

#_.f_.#s#4{

be very careful: Do not leave a space, or a .cariia<_c-rcturn. between any of these_sy_ia_LQjs! ! ~

CAUTION. Not only that, you must also fetLjam__.K>r.. to leave a ..pare »r a_ca£n_L£e-return) between the arguments when you use the control sccmcnceif Theinput $\R iXalpha lks was OK, because the space followed a control sequence,which TfiX ignores (except to note whore the control sequence end;;) but youmustn't type something like \R i jUkl. If you do, Tj*C will think that the spacei_L;tl.ie_jJjJi_L___4luJiic___i!

$\R ij kls _VU _-/

Despite these cautionary remarks, you don't have to worry about extraspaces when you use the special JAU-l).^ control sequencesthat we'll be learningabout. They've all been carefully jimmied so that the basic rule still holds: inmath mode spaces don't count.SIDETRIP. Perhaps you'd like to know how to make your own control sequencesfoolproof. Here's one way. Choose some symbol that you don't expect ever toappear in an argument—a good choice would be

*,

since any asterisks in piathformulas will be specified by Xast. Then define

\define\R #I*£2*#3*#4*{ }

With this definition you would type

This is a little more cumbersome in such a simple case, but it has two big advantages.

(1) Although you must still be careful not to have any spaces in the sequence

#I*#2*#3*#4*{

$\R i*j*k*l*s to get RXi

* *

(

(

224

i

when you define \R, you can afford to be very cavalier about spaces when youuse \R. The input

$\R i *j*k* I*swon't confuse T& at all, because it knows that the first argument doesn't enduntil it sees the first

*;

it will conclude that the first argument is iLU—and theextra spaces won't count when the definition of \R gets expanded out.

(2) For the same reason, you can dispense with extra braces: if Tj_s. sees theinput

$\R i* jT\prime *k*lX2*

it knows that the first argument is i, the second is UjTXprimcLl, the third is k,and the fourth is IX2.

C

C

(

c

(

c

c.

225

C

§5. Our problems mount.

In a formula with superscripts and subscripts, the symbols still go in "fromleft to right". But many formulas involve more critical dislocations, with onesubformula placed on top of the other. T£X has several control sequences tospecify such formulas.

The most important of these control sequences produces fractions. For ex-ample, the displayed fraction

was produced by typing $$n+l\frac n+3ss. Notice that it was unnecessary toenclose n+l and n+3 in braces. The control sequences\f rac applies to everythingin the formula, and you have to use braces to restrict its ran^c:

Notice that fractions are automatically positioned correctly with respect to'-+,=, etc.Exercise 5-1. What (weird) output would be produced by the following input?

CAUTION. Notice the braces in the example

$${n\f

rac 2}+ <n\frac 2}ss.They arc essential; TpX will issue an error message if you try to use two \fracswithin the same group.

CAUTION. Because of this, you have to be a little careful when you define controlsequences involving \f rac. For example, suppose that the fraction - occurs so

_b

n+ 1n+ 3

x + y2

~k + f$$x+yT2\frac k+lss

.+£+_$$x-fCyT2\frac k}+ Iss

___ y2

+ 1$$x+<yT2\frac k+l}ss

X+yETT$$x+yT-_2\frac k+i}ss ______k + 1

$$x=<yT2\frac k+l}ss

n n2 + 2

$$-Cn\frac 2}+ -Cn\frac 2}ss

$$x=(yT2\frac k+l)ss

C

c

C

226

.

t

C

often in a manuscript that you decide to define a control sequence \f to nameit. If you make the definition

\define\f<n \frac 2}

71 71and you want to specify the expression - + — , you'll have to type-w _b

$$-C\f}-<\f}ss

If you leave out the braces, Tg< will translate \f-»\f into n\frac2+n\f rac2and issue an error message.

SIDETRIP. There's a clever, and useful, way out of this predicament: define

\def\f{{n\frac 2}}

Notice the extra pair of braces! Thic definition makes \f mean Cn\f rac 2}, soit's perfectly all right to type \f "+" \f .

You can use \f rac within text, as well as in displayed equations. For ex-ample, $l\frac2s produces thefraction -J,-. But fractions like $x-t-y\frac z$ areusually not set within text, since you get ~^, with letters that arc rather smalland hard to read. If you want, you can get to appear in the text in the samesize that it would appear if displayed: to do this, just type

$\sized<x+y\f

raca}s. Notice that extra space is automatically placed around the line containingthis fraction.

There's another operation \atop, which is like \frac, except that it justputs one thing on top of the other, without the fraction line:

n$$n\atcp kss k

Although this particular output isn't too common by itself, it often occurs incombination with other symbols, as in

n] fn\

The second of thesesymbols is the standard notation for a "binomial coefficient",which tells how many ways there are to choose k things out of n things. Inthe next section we'll learn how to put the proper size brackets and parentheses

C

C:

C.

<.

c

227

X

around n\atop k, but binomial coefficients are so common that there is also aspecial control sequence \choose to produce them:

As far as grouping is concerned, \atop and \choose work just like \frac:

Similarly, $n\choose k$ produces ("), while $\sized-Cn\choose k}s producesthe symbol I jin the text.

When yon have \fracs within other \f racs (or \atops or Nchoorses), thetype size gets smaller, just as with sub and superscripts:

$$<n\choose l.}\frac 2ss2

$,n\choose{k\frac 2}ss |"jAs you can see, this doesn't always look so good. The last formula would lookbetter as

( n )\k/2j$$n\choose k/2ss

or

(iO$$n\choose{l\frac2}ss

And flic third might look better as

2which you can get by typing

$$\sized{n\choose k}\frac 2ss

$$n\choose kss ("j

$$n+l\atop kT2ss n ~t" XA;2

$$n+-Ci\choose k}T2ss n+ ( j

$$n\frac-C2+.n\frcc2}}ss ___—

2+f9 +n

$$«n\frac2}+ n}\frac 2}ss —A*

«<t/^\

r-U^.^.e-s,

I. *_\ *■

—_

- I**

(I)

(

228

C

SIDETRIP. Besides \sized, we've already mentioned \sizes and \sizess. Inaddition, there's \sizet to specify the size used in text. For example,

the inane example$\sized{\sizess{n}\choose-(\sizes{n}T\sizet<2}}}s ?!

producesthe inane example I \ )?!

which does at least illustrate all uses. All of these control sequences will be usefulon occasion.

SIDETRIP. SIDETRIP. For fractions within fractions, you might want to makeuse of \thickf rac, which produces a fraction with a thick line:

But use this sparingly; it seldom appears in modern mathematical printing.

SIDETRIP. SIDETRIP. When you use \frac, \atop, etc., the numerator anddenominator are centered over each other. To move cither one to the left or right,use\lft< } or \rt< }. For example .. .

n J2+n$$\sized<n\frac2}+n\thickfrac 2ss2

c

(S

c

'C

iC

c

c

c

229

C

c

§G. Variable size symbolsYou've probably already noticed that \frac is a pretty clever little control

sequence, for it chooser a fraction line whose length depends on tfie numeratorand denominator. !)$. has many other control sequences that select symbolswhose size depends on the context. For example, you can \underline or\overl me a formula:

$$\underline 4ss 4

You can also \arrow orw(un dorr.now) a formula, and you can even getbackwards and double arrows:

Úoy/-Cx-t-y} x + t/More interesting choices are made when you take the \sqrt cf a formula

V2

The output from

\sqrt-Ci +\sqrt-Cl+\s3qrt-C.t+\sqrt-Ci+x}} }}}}}$$

shows the full variety of available square-roof signs:

$$\underline{\underline-_4+x}}ss A-\-x

$$\xT{\underline

n+m}ss x-+m

$$\overline{\ove>rline-_xT3}+xT<xT3}}s x3+ x*3

\arrow-Cx-ty} x + y\usrrow<y-<-y} x + y\barro-.v{x+y} x~ -j- y

ºow_x-i-y} x + y\darrow-_x-. y} 5 -f- y

$\sqrt 2$$\sqrt<x+2}s z + 2$\sqrt<l - xT2}s vT-x'-'$$\sqrt<a\f i-ac bXss X-

V b

$$\sqrt<l-Asqrt-Cl-t-\sqrt<l+

1 + + + + + yjl+'y/i+i

230

*

The four smallest square-root signs arc made up of distinct characters, togetherwith ovcrlines of the appropriate length, but the three largest signs are all essen-tially the same, except Tor a vertical segment I that gets repeated as often asnecessary to reach the desired size.SIDETRIP. Cube roots and similar things are left to the fine points in §11.

Large parentheses are constructed in a manner similar to large square-rootsigns: once T£K gets beyond \biggg parentheses, it combines standard tops andbottoms with a repcatable extension:

There is one important difference between parentheses and square roots, however:TrX( will not choose the appropriate size parentheses unless you formally requestthem. To get a formula enclosed in parentheses of the right size, type

\left( formula \right )

Similarly, you can get variable size brackets by typing

\left [ formula \right]

For example:

CAUTION. Notice that the \f rac in the first example did not apply to the 1+or to the T3, and that the T3 applied to the entire formula enclosed by \left(and \right). In other words, \left( and \right) grouped tilings , just likethe braces < and }. In the second example, \left[ and \right] also acted likebraces—compare Exercise 5-1.

Actually, it's the \left and \right alone that perform the grouping func-tion. You can put any "delimiter" you want after \left and \right—they

pcatable extension:

(((I*-\biggglp \bigggrp -»I

$$1-Aleft( l\'fracl -xT2\right) T3ss l+ ( —-— j2

$$x=\left[yT2\atop k+l\right]ss x= VA; + 1

c

C

c

C

231

C

X

don't have to be the left and right members of a matching pair. For example,you can type

SIDETRIP. If you type \left] a, b\right [ you will get ]a,b[ with ordinarysize ] ami [. But you will also be. assured of getting the right spacing in contextswhere TfcX might be Tooled by tin: fact that a right bracket is actually functioningas a le.'l delimiter. For example, XxXin] a , b [$' happens to come out an x _■]_, £>[,but _Tx\in\lof t] a, b\righb [$ comes out correctly spaced, as x £ ]a,b[.SIDETRIP. The control sequences \(, \), \[ and \] don't have any specialmeanings in _/Lu.?-TeX. You mi^ht find it convenient to define \( to mean\left. (, etc.

Variable si'/.c braces are also available—remember to type \< and \}:

$$li-\left\Cl\fracl-xT2\right\}T3ss l+ ( 1I,l— xl JAnd you can get. a variable size

vertical line |double vertical line j|

left floor bracket [right floor bracket Jleft ceiling bracket [

right ceiling bracket ]

withwith \ |

with \1 floor

with \rfloorwith \lceilwith \rceil

(When the control sequences on the right are used without \left and \rightthey produce the smallest size symbols.) For example,

__ ___Ma \a\

Notice that the braces were necessary after the equal sign, though not before.

$$x+y\in\left(-Ca\frac b},_c\frac d}\right]ss x-|- y£ ( __, 5-1or even (yukk)

$$x+y\in\left]{a\frac b>. <c\f rac d}\right[ss x+ y £ °,-J6 d

$$\left\| x\frac a\right\|=< \|x\|\frac|a|}ss

('

C

c

c

In addition, you can get a variable size

left angle bracket ( with \lr.ngleright angle bracket ) with \rangle

But this symbol is not constructed with rcpcatable extensions and is availablein only four sizes:

If your formula happens to be enormous, T|_X will simply settle for its largestpair. By the way, 1^ allows you to type \left< as well as \lef t\langle,even though < isn't the same as ( .SIDETRIP. On the previous page we used \left and \right together with

I" I/2 1\atop to get the symbol ... Another possibility is to type

$$yT2\comb[] k+lss

Tl.is is not only shorter, it often results in a little better spacing between the topand the bottom. You can n place [ and ] by any two delimiters you want. Forexample, \choo_e is precisely the same as \comb().

In addition to constructions like (s, -rj ], where the delimiters are of differenttypes, there are also situations where one of the dclim'tcrs is blank— just notthere—as in

A period gives a blank delimiter, so this formula could be typed as

where". . ." specifics the text

We'll learn how to produce this in Chapter A (don't try to do it with \atop—you'll never get. things lined up right).You will also want to use a blank delimiter along with one other delimiter,

the last that we will mention. This is a variable size /, specified by cither \lef t/

<><>(>()

Ixl =/ X ' x >°|X| \-x, x< 0

$$!x|=\left\{.

. . \right.ss

x, x> 0—x, x < 0

2-32

c

(

C

C

233

X

or Xright/. For example,

Notice that it is important for the \lef t/ or \right/ to encl«4_ the large partof the formula, since the size of the delimiters is based on what goes between\lef t and Xright. You should probably alio be aware of the fact that / is justlike ( and ) —it comes in only four sizes.SIDETRIP. A third use for blank delimiters is for formulas thai have threedelimiters in them, like

i-rHTo handle this particular example, it's important to tackle the big part first

produce

{_±iand

{-¥ a<b\(Actually, thespacing in this example innWe'll take this point up again in §11.)

t quite what a connoisseur would expect.

SiDETRIP. Sometimes blank delimiters show up in print for non-mathemaficalreasons (a parenthetical statement might end with a displayed equation, like

-0If you're a mathematician you should avoid this construction. If you're a technicaltypist, try pretending that you don't know how to set it!

$$\left.ct-l\frac u\right/xT2ss _-_-_-__. /x2

$$xT2\left/c+l\frac d\right.ss x 7 /-"iii

$$\lcft\{a-<-b\frac2\right|ssand

$$\left.\left.\-Ca+b\fr-ac2\right|a<b\right\}

*

r

234

(

(

§7. Large operators.There is another family of variable size symbols, called large operators ,

which work a little differently than delimiters. The two most important of thesearc the signs

and /which mathematicians use to indicate "summation" and "integration"—all youhave to rcmc abcr is that \sum stands for Yl> an^ \int for /. These controlsequences are listed in Appendix S, together with a few others, like U and F]and / and ©. The symbols £ and Yl are j»st upper case Greek sigma and pi,respectively, but they are set in a different type size, and possibly in a differenttype style.

As you can already see from the previous paragraph, \sum produces a largersymbol in displays than in text. For example,

stands for $\sum $$$\sum xXnss

stands forxn

Usually ]T. occurs with "limits", i.e., with formulas that appear above and belowif, as in

TO

Xn

Now comes the. good news—to specify these limits, you simply type them in likesub and superscripts:

m

Xnn—1

If you specify the limits for a formula set within text, like

$\sumX{n=l}Tm

xXns,the limits will automatically be set as sub and superscripts, so that they won'ttake up too much space: X^Li x„. The same thing happens if \sum appears ina sub or superscript:

HI

W~~

u=^l

$$\sumX-Cn=l}tmxXnss

$$\left(A\frac

B\right)T<\sum TmX{n=i}xXn}ss

X

c.

235

SIDETRIP. The input $$2T-C\sumTmX-Cn=l}xXn}ss will give

In this particular case, a smaller £ would look better, so you could use \Sigmainstead of \sum.

Integrations arc slightly different from summations, in that the limits get setto the right even in displayed formulas

Notice, that the —oo is not directly below the +00 in cither style; the precisepositioning is determined by the font that the / sign comes from. Actually, somejournal formats set limits above and below / signs in displays, and some set limitsto the right of £ signs in displays—X.ilff-Tj^. will make these decisions for youautomatically. The preprint format u..cs the first set of conventions, unless youchange it, as explained in Chapter 5.

Although TgX fakes care of all these features automatically, there are stilltome details that you ought to know about.SIDETRIP. / signs often occur in pairs, as //. Cut you can't simply type$$\int\intss, because you'i! get too much space between the symbols. So use\twoint:

\int\int / /\twoint / /

There's also \threeint and Vfourint, as well as

\mul tint / "" " /

These symbols often occur with a single lower limit. When the format calls forlimits above and below / signs, this lower limit is centered under the symbol.For example, $$\twointXMss will give

depending on the format.

2^n=,I »

the symbol $\intX{-\infty}T-t>\infty}s the symbol /+*/+oo-oo

// - 11,M

*

(

(

(.

(

SIDETRIP. If you specify $\sized-C\sum4.{n-_i>tw xXn}s within text, youTO

will get 22 xn, and if you specify $\sized-_\int T<+\infty}X<-\inf ty}}sn=l

+00you will get J^ for J J with lots of extra space around the line. But you

m 00

can't get £ xn or / in text without consulting a IgCpert.n=J ___

SIDETRIP. Sometimes several rows of limits must be stacked under a largeoperator, as in the displayed formulaw E p^x)

You can get this with \atop, but you have to be a little careful. If you type

you'll get

(**)

with o<i<„,-and _<,<,. in \sizess, since <o<i<m\atop o<j<n} is in \sizesSo to get (.) you have to type

$$\suini<\sizes<o<i<m}\atop\sises<o<j<n}}P(i , j)ssFormula (**) may actually look better to you, but standard printing con-

ventions call for (*). One reason is that the limits frequently involve sub orsuperscripts, as in the formula

P(i\,i2,i.i)

If ix <h<U were in \sizess it would look like <.,<.,, with the subscripts nosmaller than the i.SIDETRIP Another problem comes when you try to use \sqrt or \left andXright around a displayed £ or [7, etc.. . .

Eo<i<mo<i<n

£$\sumX-CO<i<m\atop o<j<n}P(i , j)$$

12 mx)o<j<n

i i</.<hjj-f.^-l-.j—„

2-36

fe

C

c

C

c

c

237

C

§8. Spacing and roman letters.Although Te-X can usually figure out the correct spacing in formulas, it some-

times needs a little coaching. That's why the previous section didn't display anyformulas like

b

f(x)dza

even though there were several displayed formulas involving the sum sign £\ Theproblem here is the space between /(_.) and dx—careM typesettersalways supplyit, but Tp}{ would get too confused trying to do that automatically. Althoughthis space is important, it's quite a bit less than the space you would get with\l_J. So at this point it would be nice to know a little about the way that T&Xmeasures things.

"Points" and "picas" are printers' traditional basic units, so T&X understandspoints and picas. T£X also understands inches and certain metric units. Eachunit of measure is given a two-letter abbreviation:

pt pointPc pica (one pica equals 12 points)in inch, (one inch equals 72.27 points)cm centimeter (one inch equals 2.5400 centimeters)

Typical "dimensions" are3 inipt+ 29 pc-0.01 inOem

Notice that a space, between the number and the unit is optional. Also optional isthe space between the number and a + or — sign (latter on we'll sec some reasonswhy you might want negative dimensions!); moreover, a + sign is redundant,but allowed. There's one other thing that it is very important to notice: to geta dimension of one point you must specify lpt, not simply pt; and if for somereason you have to specify something whose dimension is zero, you must specifyOpt or Oem or Osomcthing--0 alone is not a dimension.

You don't have to remember all these units, of course. You will probablyvanI to use inches or centimeters if you ever use \vskip to leave space for aiiclurc, as explained on p. ?? But for most typesetting purposes, the unit you

really need is one that we haven't mentioned yet, the

em

/

(

C

238

i,

(

An cm is a unit that depends on the particular font being used—in 10-point typean em is usually lOpts, in 8-point type it is usually Bpts, etc.* The advantageof using ems should be obvious: any spacing you specify will automatically beadjusted to correspond to the type size eventually u_-«d for setting the paper.Notice again, that you ?ra/_i type iem, not just em, to specify a dimension.

Printers have a special name for a horizontal space whose dimension is iem—it is called a "quad" (originally a "quad" was a square piece of blank type).Quads have become standard spaces for typesetting mathematics, so TfrX uses\quad to stand for this amount of space. Thus, \quad means essentially** thesame thing as Xhskip lem. 'IfcX also has the control sequence Xqquad, which isequivalent to \quad\quad. The space Xqquad is usually just the right amountfor a display containing a main formula with a side condition, like

This may b„ specified by the input

(in winch all typed spaces arc ignored).A XquaJ is a rather big chunk ofspace, more than the space between words in

a sentence, so T^X has much finer units for use within an equation. For example,printers usually surround = signs with a "thick space", which is of a quad.'T£X uses \; to stand for a thick space, but you will almost never need to useX; explicit!)', because rI):;X puts the thick space in automatically. TrX uses \, tostand for the printer's "thin space", which is 1 of a quad. This is the space youwill want for formulas involving integrals:

.>

$$XintXaTb f(x)\,dxss f[x) dxa

And in general, you will want a thin space before dx or dy or ./whatever incalculus formulas like the following:

♦Thename em mines Tor the Tart thai an cm-dash is usually lem wide (;ilihouj-|, a rout designeris free lo i- 1loose (he sizes Ibv the. em, the ein-ilash, ami an upper case "M" at will)."-"There is a distinction between \quad and Xhskip 1 em. because em always refers tothe particular foul beiim used in the main bod.v or the lext. while \quad in math mode refersto (he Tout hei.m set at (he lime; for example, (he size or \quad in a superscript dependsonthe particular font being used for (he superscript.

Fn = F„__i +Fn_

2, n > 1.

$$FXn- FX {n- I}+ F X<n-2} , Xqquad n>l .

dx\,dy=r\,dr\,d\theta dxdy ~ rdrdO

f

C

c

(

C

c

c

239

C

*v_

But don't use \, for "derivatives", involving one ..something over another, likedy

dy/dx or — . There arc a few other occasions when you will need to play withTeX's spacing, but they arc so special that they have been included with the finepoints in §11.

Spaces arc not the only things that you will want to insert into formulas.Sometimes you will want ordinary type, as in the formula

You can't type y=f(x+constant), because you'll get

y — f{x +constant)

And if you try to type. y_=f (x*-C\rm constant}) you won't get. anything atall—the instruction Xrm just isn't allowed in math mode. But you can obtainroman letters, or anything else that you would get outside of math mode, byusing Use control sequence \nomath:

Notice that the proper spacing occurs automatically around the + sign— -T^Xtreat,I

;

"constant" just like an ordinary math symbol x.11-.re is a somewhat more complicated example. To gel the display:

for every n > 1

you can type

Notice the space between <\it every"} and }; it was needed to get the spacebetween every and n > 1 in the output. A safer possibility would be to type

which has a math formula within the ordinary (\nomath) type.

Exercise. How would you get the symbol 2X to appear in a formula? (Be carefulabout braces!)Exercise. How did the author get "underlined words on page 1-9? How wouldyou get the output "underlined words?

y = f[x + constant)

y=f (x+\nom3th-Cconstant})

Vn — 7?„_i + F„__2

$$FXn-FX<n-l}+FX-Cn-2}\qquad\nomath-Cfor -C\it every} }n>l . $$

\nomath<for <\it every}

$n>is}

*

C

C

240

C

c

Roman letters have another, very special function in mathematics. Commonmathematical operators like "sin", "cos" and "log" are always set in roman type(these symbols arc abbreviations for "sine", "cosine" and "logarithm", respec-tively). It would be a nuisance to type \nomath<sin} every time you wanted"sin" to appear in a formula. And it would be more than a mere nuisance to tryto specify the proper spacing in the formulas sin2x and sin(2x). So J.JI2-T&.has control sequences like \sin, \cos and Xlog that do all this for you. Forexample,

gives

Here arc a few other operators that _X_.'s'b_f-l£X knows about:input output (abbreviation for)Xmax max maximumXmin mm minimumXsup sup supremumXinf inf infimum

\limean l.i.m. limit in th -. meanXliminf lim inf limit inferiorXlimsup lim sup limit superiorXlimunder lim limit inferiorXlimover lim limit superiorXlimuarrow lim projective limitXlimubarrow lim injectivc limit

Some of these control sequences are treated like "large operators" with limits,just like _FJ. For example,

$$\sin2\theta=2\sin\theta\cos\thetass sin 20 = 2sinocos_.$n\log n\log\log n$ n log n log log n

On the other hand,Xsin (x-»-y)=\sin x\cos y+\cos x\sin y

cin(x + y) = sin x cos y + cos xsin y

\lim lim limit

ke _FJ. For example,$$\maxX{l<n<m}\logX2PXnss max \og 2 Pn

1 <)i<m

sin x$$\limX{x\goestoO}<\sin x\frac x}=lss lim = 1_■—0 x

$$2T<\,\maxX<l<n<ni}xXn}ss 2 max !<„<„,

x„

1 +

c

c

c241

C

The last example should serve as a reminder that krgc operators have theirlimits set as subscripts and superscripts in exponents. Il also shows you that thetype size gets smaller, as it should, in exponents. None of these features would besupplied by \nomath<max}, so \nomath is certainly not the thing to use if youwant to create a new operator of your own. For this purpose AJVS-T^ suppliesyou with the two control sequences

\opname and \Opname

For example, \opname{hog} will produce an operator hog which is treated justlike log:

$$\opname<hog}X2xss hog2 x$$\def ine\hog{\opname{hog}}2T<\hog x}ss 2,10ex

And \Opname<Max} will provide an operator Max which is treated just like max(including the "limit" feature of large operators):

Within the braces {. . . } following \opname or \Opnamo you can put letters,punctuation marks and spaces; a space, will automatically be changed to a thinspace, as in "lim inf. You can also apply \underl me, \overl me, etc., to an\opname or \Opname.

You shouldn't have to use \opname or \Opname very often, because J.JVS-T^X knows about quite a few operators, which arc listed below. Unfortunately,you really have to know about all these operators too, because mathematiciansusually won't indicate in their manuscripots that these operators should be setin roman type. In fact, they may not even be aware of this convention, thoughthe output will strike them as somehow wrong if it isn't followed.

(The list will include such things as \Sin, to be used in the construction\SinT<-l}x to get Sin_I x.)

Xdef ine\..ax{Opnamc{Max}}s?s\MaxX{o<i<n}xXiss Max x,-

-o<i<n

$s-2T<\,\MaxX<o<i<n}XXi}ss

" 2 Maxo<'<"x'

-» V

242

V

§f). Aligned and numbered equations.

We can now specify almost all combinations of symbols that arise in math-ematical equations, and we can get displayed equations with double dollar signs$$. But mathematical works often contain various combinations of equations indisplays, and this requires special treatment.

First of all, mathematicians frequently like to give their equations a number,or some other kind of tag. Some journals place these tags to the left of theequation:

(3-1)

while others put them on the right:

(3-1)

To produce the above equations with a tag, just type

AAVS-I\J}\ will automatically choose the appropriate placement for the tag. Thepreprint format normally places tags on the left, but you can opt for tags on theright when you make changes in the format, as explained in Chapter 5.

Notice that tags are processed as ordinary text, rather than as formulas inmath mode, so that — gives you an en-dash, rather than two minus signs. Ifyou need a tag processed as math text, just use $ signs. For example, \tag$AT\primeswill give the tag A' and \tag AsXls will give the tag Aj.

In addition to deciding which side the tag goes on, \tag also makes a lotof other, more subtle judgements, which arc part of the classical typesettingtradition. For example, the equation itself is centered, unless this would place ittoo close to the tag, in which case \tag tries to compress the equation somewhat,and possibly move it over to (.he side. Finally, if this ploy fails, \tag puts thetag on a separate line. Left-hand tags go on the line before the formula:

(3-1)a very long formula .

while right-hand tags go on the line after the formula:

. . . a very long formula(3-1)

x = y

x = y

$$x=y\tag(3— I)ss

1 *-

C

X

C

C

rv

C

C

243

C

V

Of course, you don't have to remember any of this—-_-L4l_r-T£X docs it all foryou.

Another common combination is a display containing several equations, inwhich certain symbols arc aligned. For example, in the display

the = signs arc aligned, and the three equations arc centered as a unit. Toproduce this display, type

$$\align x & = y = z\\xT2 &. = yT2 \\xT3 & - yT3 \cndalignss

The

_.

si;rns serve the special function of telling T].X which symbols arc to bealigned; they should immediately precede these symbols. Notice that \\ separatesthe various lines, while \endalign indicates the end of the whole alignment(and takes the place of the \\ after the last line).

Of course, it's not necessary to type the input exactly as shown, with the&. signs lined up. All those blank spaces, including the ones created by single(carriage.-rcturn)s, don't count in math mode; they just make the input looksomething like the intended output (so they can be helpful at first, though you'llsoon tire of typing them).

SIDETRIP. You can insert extra space, of a certain dimension between lines ofan \align by putting

\xspace (dimen) \\between them, where (dimen) is the dimension, like 6pt or lem. Don't use \quadhere, since it is not a dimension, but a horizontal space having the dimensionlem.

One of the surprising things you can do with \align is to allow some of theformulas involved to be blankl For example, you can get the display

x—y = zx2 -=y2

x3 = y3

(a + b){a +b) = a2+ 2, a6+ 62,(a + b){a - 6) = (a + 6) - (a + 6)6

= a2+ ab —ab— b 1

= a 2-62.

. >

c

C

(.244

C

(

which contains one short equation and one long broken equation, with the input

By the way, this example illustrates an important rule about breaking equationsin displays: although equations within text arc broken after equal signs and otherbinary relations, long displayed equations should always be broken before binaryrelations.

You can also use \align to obtain the broken equation

t n TThis equation illustrates another important rule for breaks within displays: al-though equations within text are broken after binary operations, this equations is-broken before, a binary opcralio.i, namely the + sign which has been singled outby a double arrow f|. The single arrow., f have been used to indicate the paren-theses that surround the subformula in which this + sign resides. The placementof the + sign illustrates another important rule for breaks within displays: the+ sign lies somewhat to the right of the corresponding left parenthesis, usuallyat least I wo quads to the right. So to get this broken equation, type

SIDETRIP..Remember that you can get extra space between the lines by using\xspaco . . . \\. Sometimes you might want some extra space for the sake ofclarity —a couple of points will usually do. And the following example shows acase where you will want negative space. If you type

you'll get

which seems to have a lot of extra space between the lines, because the first linehas the . under the £ sign. So you should put something like

Xxspace -Bpt \\between the two lines

$$\align (a+b) (a+b) __ =aT2+2ab+bT2, \\(a+b) (a-b) & =(a+b) a-(a+b) b\\

&. =aT2+ab-ab-bT2\\ii =aT2-bT2.\endalignss

Z = {X + Y)[A -| B+ C +D+£ +F+ G + # + /f +L + Af + /V)

$$\align Z-(Xh-Y) & (A-> B+C-»D+E+F\\1 Xqquad -t-G-<-H-<-K+L-»-M+N) \endal ignss

$$\align Z=\sumXi (XXi+YXi) _. (AXi+BXi+CXi+DXi+EXi+FXi\\&. Xqquad -t-GXi +HXi+KXii-L.Xi-. MXi+NXi)\endal ignss

Z = J2(X' + Y A ' +B'+C>+D'+Ei + fti

+ d + Hi + Xi + Li + Mi + Ni)

+

'■'3

c

C

_-

SIDETRIP. You might have a little trouble with a formula like

where there is a big right parenthesis on the second line to match the big leftparenthesis en the first line. For the first line you could use the construction

But a similar construction won't work on the second line—a Xright) will stillj>ive you an ordinary size ). The simplest way out is to use Xbigglp and Xbiggrp,which wil! probably be the right size.SIDETRIP. SIDETRIP. In a complicated case you can use the control sequence.Xphantom-C. . .}, which produces an invisible symbol of the same height asthe'formula that appears in the braces {. . .}. For example, the second lineof ih_ above equation could be specified by

In the previous paragraphs we relied on two generally accepted rules forbreaking displayed equations:

(1) Break a disnlayed equation before binary relations and operations.(2) When an equation is broken before a binary operation, the next lineshould start at least two quads to the right of the beginning of the smallestsubformula containing it.

More elaborate sets of rules can be compiled, but they vary from printer to printer,and in any case are never really adequate. T£JX doesn't even attempt to breaklong displayed formulas, because this is an art—the author of a mathematicalmanuscript should really determine all breaks, since they depend on subtle factorsof mathematica! exposition. (Since it's often difficult for the author to foreseethe need for breaks, the judgement of the experienced technical typi;:l can alsobe invaluable.)

There's just one other printing convention for broken equations that youshould know about. The following display shows a special form often used for anequation requiring two lines:

Z = {X+Y)(£+C+D+ E+F

+ g+h +k.+ l~\-m-\-n\

\left(-CA\frac B>+ C -.D+E+FXright.

..Xqquad \left. \phantom{A\frac B} + G-t-H-»-K-i-L+M-i-N\ri£ht)

A+B+C+D+E+F+G+H + l + J + X + L + M + N=P+Q+R+S+T+U+V

2-45

(

+

r

(

.

f

246

X

c

The first line begins near the left margin, and the second line ends near theright margin, the exact distance being determined by the formal. This form isgenerally preferred for a broken equation with a long left-hand side. The abovedisplay was specified by

$$\twol me A+B+C+D+E+F-I-G+H+l-t-J+K-i-L+M+rAX=P+Q+R-tS+T+U+V\endtwol mess

SIDETRIP. If you want extra space of a certain dimension between the two linesuse '

$$\tv;oline5Pace . . . \\(dimcn)\\ . . . \endtv/ol inespacess

where (dimen) is the dimension, like 2pt or iein. (And once again, don't useXquad, which is not a dimension, but a horizontal space having a dimension oflem.)

f V

c

c

c

c

/-

c

C247

i

§10. More about equations in display.

In the previous section we saw that Xalign can be used to produce brokenequations as well as aligned ones. Actually, \al ign is even more versatile thanthis, because the the result of an \al ign is a unit; it may be regarded as a singleformula, or as one gigantic mathematical symbol. So, for example, you can getthe display

simply by typing

and you can get

(with the two pieces centered vertically with respect to each other) by typing

$3\left\-C\al ign . . . Xendal ign\right .\qquad\lcft\-_\align. . . Xendal ignXright . $$

Incidentally, this is a good example of a situation where a couple of on-the-spot control frequences can keep you from going bananas. It would probably bea good idea to handle the input somewhat as follows:

CAUTION. The neat feature of Xalign as a unit docs have a disadvantage,similar to the problem with \f ootnote and Xvskip. If you ask for an Xalignthat is too long to be squeezed onto the current page, T]rX will cut short thecurrent page (inserting additional line spaces to bring it to the proper length),and the \al ign will appear at the lop of the next page. Some rewriting may benecessary; a long \al ign might have to be split in two.

ra = bla2 = 62

$$\leit\<Xalign aft=b\\aTH:V:bT2\ondal ignXright . ss

/ , \ c = d

$$\def\l<\align. . . Xendalign}Xdef\2<\al ign . . . .Xendalign}\left\-C Xl Xright. \qquad\lef t\< \2 Xright. ss

_ >

248

(

(

Since an Xalign is a new formula, you can \tag it, just like any otherformula. The input

will produce the display

.-/ m

(or the same display with the tag on the left). Notice that the tag is centeredwith respect to the aligned set of equations. This is fine when you want to puta tag on a whole set of aligned equations, but there arc two situations wheresomething else is called for.

First of all, you might have a display like

(1)

(2)

involving several aligned equations, some with individual tags. For this you willneed \aligntag. To get the above display, type

The second situation involves a long broken equation, like m+

Although it's a type of \al ign, any tag it bears is customarily not centered, butis placed cither at the beginning of the first line:

(1)

$$\align a__=b\\ c__=d\\ e&rrf\\g____h\endal ign \tag(l)ss

a = bc _= d

g = h

o=6 = ca2=62

a3=63

$$\alitintag a & =b=c \tag (I)\\aT2__ =bT2\\aT3__ =cT3 \tag (2) \endal igntagss

a = b

— d

a= 6

= c= d

.

C

c

L.

249

C

4.

or at the end of the last line:

(1)To tell \aligntag that you arc putting a tag on a long equation, use \ltaginstead of \tag on the first line of the equation, and put \endltag on the lastline. For example, to get a display which will appear either as

(1)(2)

or as

(1)

(2)you should type

CAUTION. An \al igntag isn't as versatile as an \al ign; you can't slick an\al igntag inside other constructions, because an \al igntag is already as wideas the whole page (although it may have a lot of blank space on one side or theother).SIDETRIP. Just as with an \align, you can insert extra space of a certaindimension between lines of an \al igntag by putting

\xspace (dimen) \\between them.

a = b= c-__d

a=6 = cd = c

= 0

a _= 6 = c<_ = c

= /

$$\al igntaga &. =b=c \tag (I)\\d & =c \ltag(2)\\

ii =f\\ii =g \endltag\endaligntagss

'}

C

250

C

SIDETRIP. You can also insert an extra line of text . . . between lines of anXalignbag by putting

between them. The extra line will start at the left margin of the page. Forexample, you can produce the display

(1)

and hence, since a2 =62 by (1)(2)

by typing

\xline and hence, since $aT2=bT2s by (I)\\aT2c = bT2 d . \tag (2) \endal igntagss

Even if none of your equations have tags, you should still use \al igntag ifyou need a construction like this. (If you use \xl me . . .\\ in an \al ign,the text will start at the left-hand side of the \al ign, instead of at the left-handside of th_ page.)

SIDETRIP. There's actually one other situation where you don't want thingscentered after an Xalign. If a proof ends with an Xaligned set of equations,and you use the control sequence Xqed (page??), you shouldn't type it after theXendal ign, but instead make it part of the last line of the \al ign.

There's still one more possibility that we have to talk about. Sometimesyou will need a display consisting of a bunch of equations which arc individuallycentered, instead of being aligned:

One possibility is to type

The control sequence \closeup deletes the extra space which would normallyappear after one displayed equation and before the next one. Another possibility

\xline . . .\\

a = 6c = d

a2c = b2d.

$$\al igntag a __ = b\tag (I)\\c ii = d\\

a=6+ cd = c

/+<.=/-

$$a=b+css \closeup $$d=ess \closeup $$f+g=hss

.

c

C

c

c

ic

251

is to use the control sequence \bunch, which is just like \align, except thatyou don't need any & signs, since nothing's being aligned:

A \bunch is a unit, just like an \al ign, so it can also be given a \tag. But if youwant a bunch of centered equations with individual tags, you'll need \bunchtag,which is just like \al igntag, except that once again no

_.

signs arc needed.By artfully combining these control sequences you will be able to specify all theimpressive displays in the following exercise.

$$\bunch a=b+c\\d=e\\f-»-g=h\endbunchss

4

f

r

252

C.

C

§11. Fine points of mathematical typing.

This section contains, not to put too fine a point on it, lots of little thingsthat didn't seem to fit nicely anywhere in the previous sections. Since there arc agood many topics to be covered, sometime., in irritating detail, it's probably bestto glance idly through this section, just to sec what maneuvers are available, andthen refer back to it as needed.

1- Dots We've already introduced the control sequence \dots to produce theproper spacing between the three dots in sentences like "Hmm ... I wonder why?"Three dots arc al:.o used in mathematics formulas, but the best mathematicaltypesetting traditions recognize numerous subtle distinctions. For example, inthe formulas

low dots arc used in the first, while centered dots are used in the second andcentered dots witout extra spaces between them arc used in the third. J.Jih'J-Tj^ihas icveia! different control sequenceswhich will enable you to produce formulasthat even a master printer would be proud of.

al) Use \cdots (three centered dots) between binary relations and operators

AXl\cap\cdots\cap AXns A\C\--- C\An

Notice that a space before \cdots is irrelevant (since we're in math mode);notice also that the spaces between the dots arc automatically deleted insuperscripts. The dots which appear in \cdots arc the same as the multi-plication dot, specified by \cdot, that is used in formulas like x

"

y; this dotdepend? on the particular font being used, and is often larger than a period.

a2) Use \cdotss (three centered dots followed by a thin space) when the threedots are followed by punctuation. For example, the input

produces the output

the infinite sum y\ + y2 + " "

(xj,...,Xn) Xj-j \-Xn 2^+-+*»

$xssbl= \cdots=xXn=os "x,= " ■ " = xn = 0:.Xl-.\cdots->-xXns x\ + \- xn

$$2T-C\,xXi-.\cdots-+-xXnXss 2;r '+' +I"

the infinite sum $yXI-i-yXI-. \cdotsss

X

C

c

253

X

(

A3) Also use \cdotss when the dots separate integral signs:i i

\intXoTl\cdotss\intXoTlo 0

Although __t^H._.-I)jX gives you \ldots for three low dots, most of the time you'llwant to use one of two related control sequences:bl) Use \ldotss (three low dots followed by a thin space) before commas:

$CxXi,\ldotss,xXn)s (xi,...,xv )The dots of \ldotss are ordinary periods—only the spacing is adjusted. Youhave to be in math mode to use \i dotes, but it is still useful for producingthe "literary" throe dots when they are followed by a comma. For example,the input

the components $xXls, $\ldotsss, $xXnsof $(xXl,\ldotss, xXn)s

produces the output

the components xj( , X„of (X],...,!,,)Notice that the first two commas, typedoutside of math mode, are followedby larger spaces (and, if necessary, T^X could break a line a.rtcr one of them).

b2) In "muhiplicalivc" contexts, like X|X2 . . .x„, where the three dots don't haveany other symbols around them , use \idotsm (three low dots prccecdedand followed by thin spaces):

xXlxX2\ldotsm xXns x\X2 ...xn

Cl-x) (l-xT2)\ldotsm(l-xTk)s (1 — x)(l - x 2

)

. ,. (1 - xk).Exception: For the formula x'x2 . . . x", type $xTlxT2\ldotss xTns be-cause x'x2. . .xn already has "hole" at the baseline after x 2.

Here is an example that uses three kinds of three dots: To get the formulal i

/(*j, , x,,) dx\ . . . dxno t)

you would type

$$\intXOTl\cdotss\intXOTif CxXl,\ldotss,xXn)\,dxXl\ldotsm dxXnss

C

254

c

c

b3) Finally, when an expression involving three low dots comes at the end of asentence, you'll want to use \ldotss\, (that's three low dots followed bytwo thin spaces):the sequence 0, 1,0, 1 , $\ldotss\, $. the sequence 0,1,0,1,.

2. Vertical Lines.The symbols

I*l 11*11 (*) [x] {x} [x] [xjall occur in mathematics. Oddly enough, it is the simplest ones, |xj and ||x||,which can cause problems. For example, compare the following

$|-x.M+x|s \~x\ = |+x|Only the last of these equations is true, but it is the one which is incorrectlyspaced! The first three get spaced correctly because TjjK knows that "[", "{"and "[" normally function as left parentheses, while "]", "}" and "J" normallyfunction as right parentheses; this allows it to conclude that the — and + signsshould snuggle up to the x, because they aren't indicating subtractions or addi-tions. But since | functions like a left parenthesis in some places and like a rightparenthesis in others, TgX hasn't been told to treat | in any special way; it's justanother symbol like x. This works fine if you type $ I x I $ to get |x|, but you willhave troubles in cases like the one illustrated above. Fortunately, you can tellTr^< when | functions as a left parenthesis by using \left | :

Naturally, you also get the right size vertical lines automatically this way. Forexample, the input

a a6 6

Similarly, you should use \left\| and \right\| instead of \ I in such cases:

$[-x]_-[+x]s [—*] = [+*]$\<"X\}=\<X}s {__-} -- {_(_-;}$\lfloor -x\rfloor-\lf loor+x\rf loors [— x| = [+ij

$\left|-x\right|=\left|-Hx\right|s |—x| = |+x|

$$\left|-<a\frac bX\right |=\left | a\frac b\right|ssproduces

$\left\|-x\right\|=\left\|+x\right\|s ||—x|| = ||+x||

..

c

:C

C

r

jc

V.

It-

c

255

Sometimes | is used in quite a different way, to indicate the relation ofdivisibility: a \ b ("a divides 6"). If you type $a|bs you'll get the unpleasantlysquashed formula a\b, so you should use the special control sequence \relv fora vertical line used as a relation:

a\b$a\relv b$

A third use for | is in formula 1, like {x | x > s}, which is read "the set ofall x such that x > 5". The control sequence \rolv gives the right spacing forthe | in this construction, but you will also need special spacing for the braces,which is supplied by \leftset and \rightr. et:

$$\leftset x\relv x>_s\rightsetss {x|x > 5 }

Some mathematicians prefer the formula {x : x > s}. The control sequence\relcolon will give the right spacing for the colon.

SIDETRIP. Formulas like

were treated on page ??, except that we didn't worry about the spacing. Thecontrol sequences \leftset and \rightset actually give variable size braces,so they are the things to use here instead of \left\{and \right\}. To get theproper spacing around the vertical line, use the control sequences \leftrelvand \rightrelv instead of \lef 1 1 and \righb I :

$3\leftset x\leftrelv_x\frac x+l}<2\rightset\right . ss$$\left . \leftset p\frac q \rightrelv p+q<2\rightsetss

3. Accents in math mode.

Mathematicians often accent letters to give them special meanings:

x x x x x x

Other literary accents hardly ever appear, but there are some additional accentsthat arc used in math mode. For example,

$\b x$ x

{*\tXi <2} and {,| p + ,<2}

(

256

.

(

This small arrow accent is indicated by \b because x is often used instead of aboldface x.

In math mode you can accent an already accented letter, to get a doubleaccent:

X

In fact, you can accent any formula at all. But this usually isn't very useful, sincethe accent just gets centered over the formula:

$\b-Cx+y}s x+ y

Of course, in this case you would probably use \arrow:

$\arro-.v-Cx+y}s x + y

Notice that the. a.rrow head is somewhat larger on \arrovv —in general, \b looksbetter over single letters. To indicate that a small arrow is supposed to apply toa whole formula, you may want to set it as follows:

[* + vfThe control sequence \supb gives the accent ' set as a superscript. There's alsoa \suparrow, with the large arrow-head, just in case you want it.

The other accents need special discussion also.

(i) You may wish to use \cverline rather than \= even for single letters:

X

$\overline

x$

x

You will probably want to \overline a whole formula, but the accent " canalso be superscripted, like \b:

(The control sequence giving

"

as a superscript is called \supequal , since "\sup="isn't the name of a control sequence.)

$\A<\=x}s

$(x+y) \supbs

$\= x$

$\overl ine{x+y}s x+ y$(x+y)\supequals (x + y)~

f

c

c

C

C

r

V

257

C

(ii) There arc four kinds of dot accents in math mode:$\dot x$ x$\twodot x$ x$\threedot x$ x$\fourdot x$ x

These dots may not be the same size as the ones in V'x, so don't use \" in mathmode. For formulas, there are \supdot, \suptwodot, etc.

(iii) The squiggle \c doesn't look so hot if it's applied to an upper-case letter(this doesn't happen in literary contexts), so you should use \bigs instead:

$\s M$ M$\bigs U$ M preferred

There is a \sups for use with formulas:

$(x-t-y)\supss (*+_/)"But mathematicians usually prefer to have long squiggles set over long formulas:

$\longc-Cf (x)}s fix)

(iv) There's a \bigA to get a bigger \A accent over an upper-case letter$\bigA M$ M

and there's also a \supA. The accent \A shouldn't be confused with the "carat"which indicates that a term should be ommitted from a formula:$s+\cdots+\carat w+\cdots+zs 6 _|_..._j_ u,_f_ z$$xXl+\cdots+\longcarat<xXi}+\cdotc+xXnss Xy-\ + x, -\ 1- x„

(Traditional typesetters build special symbols out of straight lines for long carats,but they often use the \A accent for the smallest size. This should be avoided.)

$(x+y) \suptv.'odots (x + y)'

$\longgs<x+y}s x + y

$\longggs<x+y+z} x+ y + z

$\longgcarat<x+y}s x + y

$\longggcarat<x+y+z}s x+ y+ z

(

.

(v) The accents \v and \u arc seldom used. There are also \supv and \supu.4. Ovcrscripts and underscripts.

In addition to accents, other symbols are sometimes set over or under a letter,instead of as a superscript or subscript.

_s-._/1-.-.-TeX allows you to produce these formulas by typing$$y=\twodots xOT2+\oset \sizess{(b)}\to x<}T3ss$$\uset \sizess<X}\to A<}TiXj = BTiXjss$$\uset \sizess{X}\to{\oset s\to A}ss$$\uset \alpha\bcta \to <\bold M}ss

The ovcrscript or undcrscripot is set in \sizes, but \sizess often looks better.Notice that the empty groups were needed to get the sub and superscripts at theright height. Compare

You can also get horizontal braces over or under a formula, and AJ.h^-T^.will automatically make them the proper length:

k limesIn the last example, we used \opname-(times} rather than \nomath<times}to get \sizes.5. More about spacing.6. nt!l roots.7. Footnotes.

y=x2 + x 3 A) =Bi A MxJ J x a/3

3

$$\oset\sizens-{(s)}\toxT3 x

$$\obrace<x+y+z}ss$$e<x+y+z}ss

x+y+ zx+y+ z

$$\uset\sizet<>o}\to

<e-Cx+y+z}}ss x+y + z

$$\uset k\u\opname-(times}\to<e<x+\cdots+x}}ss X + --- + X

2-58

c

X

/"

»■%_.

C

31

Chapter 3. T^'s Erroneous Zones.

In Chapter 1 we learned how to run Xs4l>_. -TeX, but a few details still needto be explained. For example, you might want to sec how a paper will look insome journal's format. To do this, you simply replace the line

\input preprint

in your file by a similar line that tells l£X to read the description of the journal's format. For example, to get the format of the Bulletin of the AmericanMathematical Society , put in the line

\input bams

Appendix J gives the names of the appropriate files for all journalswhose formathas been incorporated into i^W-T]^ at the present time.

Even if you use the preprint format, you may want to make various changes,as will be explained in Chapter 5. All of these changes can be placed in a filechanges . tex, and then you simply add the line

\input changes

right after the line\input preprint

There are also a few options that can be exercised when you print a paper.Your system probably has a way of modifying the verser command so that youprint only certain pages, say pages 3-8. This can be useful if you make changesin a portion of a large paper, and only want to see how the new part looks. Oneproblem with this procedure is that you may have to guess at the appropriatepages. Another possibility is to go right into your file and insert the lines

\outputoff at the beginning of the file\outputon at the beginning of the section you want\outputoff at the end of the section you want

Then when you tex your file, the dvi file will contain the part you want. (Thedvi file won't construct pieces of a page, so if the section you want begins some-where in the middle of page 2, you'll get the top part of page 2 also; and if it

C

(

(

32

(

(

ends somewhere on page 4, you'll get the remainder of page A.) Actually, youreally don't have to put \outputoff at the beginning of the file: When _4._4k.f-TeX asks you

Do you want output? (y or n, follow answer by return)

typing y is the same as putting \outputon at the beginning of the file, andtyping n is the same as putting \outputof f there.

Congratulations, you now know everything there is to know about running_4._41.-. -T£X! There's justone problem—it probably won't work. When you try torun -sOli:. -TeX you'll undoubtedly get some error message, which will cause leXto stop. (Remember that even an innocent misspelling can be a serious error, ifit involves a control sequence, and of course by now we know enough to make alot more hideous errors.)

We've been mentioning "error messages" all along, but we've put off serious,consideration of errors until now, because it's undoubtedly the most unpleasantaspect of using TeX (or any other computer system). TeX does it's damndest todiagnose your errors for you, but it can't really know what's in your mind—all itcan do is tell you what seems to be wrong with what's in your file. As we shall see,sometimes TeX won't detect an error at all (but you'll see it in the output), andsometimes TeX gives a completely faulty diagnosis of your error, because yourconcept and TEX's concept of what you arc doing are totally disparate. There'sonly one thing you can be sure of: if TeX says there's an error, then there is anerror (but it might be a real bitch to find).

Experience is the best teacher in matters of this sort, and you'll probablyget a valuable education as soon as you start using JLJi$-Ts<. seriously. The aimof this Chapter is to familiarize you with the most common sorts of errors, andgive you some hints on how to detect them, so that you don't go out intoJ,hereal world totally unprepared.

The remainder of this Chapter hasn't been written yet. All we have is the list oferror messages:

„>

m

c

(

c

C

C

33

C

THE ERrOrS OF IfeXjAmbiguous; you need another "_ and

You seem to be using \frac or \atop more than once in the same group.iAll mixed up, can't continue.Something has gone wrong with your use of a construction involving the symbol&, like \align or Xconditions or \array (Chapter 4).iArguroent of (control sequence, can *t begin withYou're using a control sequence with one or more arguments, and for some reasonyou began one of the arguments with } (maybe it was supposed to be < ).!Blank space should follow file name.You've probably goofed right at the start. Maybe you did something like putting\input preprint right after \input amstex (on the same line, instead of onseparate lines). Start over.! Display math should end with $$.While processing a displayed equation, TeX got to a single $ sign (one whichwasn't buried in some other construction like \nomath-ffor $x>os}). Maybeyou just typed $ instead of $$ by mistake. If not, you'reprobably in deep trouble.LDouble subscript .You applied X twice to the same thing.S_JDgu.b.ljg_Sujge rscr i pt .—

: '■

-

;■» "

--—i—-

■■ ■ in*,..

You applied T twice to the same thing.J Extra (something,).There arc several messages telling you that your input text contains somethingextra. For example, if your input contains $x}+ys, TeX will say that you havean extra }. If you get the message Extra al ignment tab, you have probablyforgotten the \\ thaat separates the lines in an \align or Xconditions orsomething like that. Or in an \array (Chapter 4) you may have fewer \c, \1and \rs than the number of columns you're trying to set.j. First use of font must define it.

You probably typed \: somewhere by mistake (this is a control sequence, nevermentioned in this manual, which is used at the most fundamental level of leXdesign). If you type \: and you don't get this message, then something else weirdwill happen—you'll probably find that the output has suddenly changed to some

<- *1

r

c

34

V

completely difTerent font; strange symbols may appear in profusion. Beware!Don't ever type \:L-Aha.Ugr_-_iJL__m^^You've used \al ign or \array (Chapter 4) orsomething similar, but not between$$ signs.

! Illegal font codeYou've probably typed \; by mistake (see ! First use of font ... above).1 Illegal parameter number in definition of .controlscq.You did something like Xdefine\R#i{x+#2}.

! Illegal unit of measure (pt insertedYou have a dimension like 3qt which TeX doesn't understand (maybe you typedit incorrectly, or just forgot the unit). If you press (carriage-return), TeX willinterpret it as 3pt (and make the qt part of your input text!).

' Input page ended while scanning def of (controlse*You probably forgot a } somewhere in the definition of the control sequence.J LnPMJ_-J_a^This message has been preceeded by a Runaway argument? message, showingthe beginning of some argument to a control sequence that apparently neverended. Maybe you started with a < but never put in the }. Or perhaps youfollowed the suggestion on page ?? and defined \def ine\R#l*#2*<. . .}, andthen forgot about the *s when you used \R.I_lfealA must follow an expl i c it c haractLer .You used the control sequence \/ (page'??), but not rigH after a letter (maybeyou left a space before it).L Lookup failed on fi 1 c (filename).You told TeX to \input a file, but it couldn't find it. Maybe you spelled itwrong. Maybe you've forgotten what you called your file?J Missing (something) inserted .This message is a little misleading: TeX hasn't inserted anything directly intoyour file, but jnlo a copy of your file that it has made for processingj>ujj^oses.If you press (carriage-return), TeX will pretend that the (somcthing)is there .This message can arise in lots of ways, and it can name a variety of things thatTEX sometimes thinks arc missing (TeX may be wrong—it's just guessing). Youmight be told that a missing < has been inserted if you forgot to put braces in aconstruction that needs them, like \topinsert (page??) or \ctrline (page??).If TeX says that a $ is missing it may be because you have a \par or blank linein the middle of a formula—whenever TeX gets to a Xpar inside a math formula,it assumes that you meant to end the formula before the Xpar.

r- *

(

C

(

(

c

C, 35

[Only one * allowed per tab.You've probably forgotten to put an & between the \c or \1 or \r for one columnof an Xarrayand the one for the next column. (This message is a little mysteriousin _s4._>lk-f-TeX, since \array doesn't even use #, but don't worry about it.)j__gnl_L_^ijigXe._ch___rac^ be accented in horizontal mode .You tried to do something like \'{ab}, and you weren't in math mode (whereit is allowed).1 -_aj_aroeters must be numbered consecutively

When you define a control sequence with arguments, you must list #1, #2, ... inthat order (page ??).Runaway argument?See ! Input page ended whi le ... above.! TEK. capacity exceeded, sorry ...You've asked T£X to do something it's not big enough to handle—there will bea second part of the message giving some ide| what. If it says memsize = ?you've asked it to store too-many things in its memory. Maybe you made toomany definitions (you're only allowed to make ???). Maybe you just made oneof those crazy definitions we warned you about (page ??). If it says savesize=_?, you've probably put a < somewhere and never closed it up with a }. Oryou may have tried to make a gigantic \array (Chapter 4) that's bigger than apage. If it says anything else, you'd better call in the experts.!_-_lJie.rg_.'s no \halign or \val ign_g£ihjg_on .'Your input contains an &.which doesn't seem to be part of an \al ign or Xarrayor something like that. You might have simply typed &. instead of \& to get a& in the output. Or you might not have matching -Cs and }s somewhere in your\al ign or whatever.j This can't happen .

Something really unexpected has caused TeX to come to a screeching halt. Callin the marines!j Too many } 'sJust what it says.|_ Undefined control sequence .You're using a control sequence that TeX hasn't (yet) heard about. Maybe youforgot to define the control sequence before you used it. Maybe you just spelledit wrong.

You've used \left or Xright followed by something not mentioned in Chapter2§6.

MJnknown delimiter.

*.

"■""■.

(

36

t

! Use of (controlseq) doesn 't match its definition,You've probably made a definition like Xdefine\R#l* #2*{. . .} and thentyped \R x*y*. Your definition tells TeX that there should be a space after thefirst

*,

but your use of the the control sequence doesn't conform to this.! Warning: Long input line has been broken.Yourinput contains a very long sequence of characters between (carriage-rcturn)s.TgX arbitrarily broke it after 150 characters.! Whoa

you

have tiYou probably forgot to put \input amstex at the beginning of your file.! You can only define a control sequence .You typed Xdefinition and then the next thing wasn't a control sequence(maybe you just left out the \).! You can't do that in (mode. .This is the biggy, which we've already discussed.! You can't redefine this control sequencej.rj^____^„S__.You've tried to define one of the control sequences which X/V-J-TeX won't let youredefine, because it is used in the definition of yet other control sequences. Theshorter message !__J__yL_-_-3_a___-_-jr^ indi-cates that you have discovered one of the control sequences which even TeX won'tlet you redefine, because it is used at crucial points of TeX processing.

,>

C

(

C

.

c

1041

iC

v

Chapter 4. Hardcore Typesetting: Sophisticated Positions

We can now typeset incredibly complicated formulas, and all sorts of displaysinvolving aligned formulas. But we still can't get a "matrix" , the parenthesizedarray that appears in the equation

1 .1 X11 .11 ,

in .my

{x— 1for x > 0for x < 0 .

Of course, we know how to get the parentheses and the left brace (and the rightnothing). But we've never tried to set the arrays inside them. Now we're readyto do it, using the control sequence \array.

Notice that the various columns of the array

are set in different ways: the elements of the first column are centered within thecolumn (this is the usual way of setting formulas in an array), while the numbersin the second column are set flush right, and the decimal numbers in the thirdcolumn are set flush left. The choice for each column is the first thing we have todecide upon whenever we use Xarray. We also have to decide how much spacewe want between the columns. For example, the above array has a quad of spaceafter the first two columns (a standard choice). Now we can get this array asfollows:

$$\array\c\quad & \r\quad &\l\\

x &. 1 ii .I\\

\endarrayss

*

( xA= \ x+ y

\x + y + z

or a construction like

X 1 .1x+ y 11 .11

x + y+z 111 .111

x+y k 11 ii .11\\x+y+z&lll-k.lll

(

■V

<

(

42

This is nearly self-explanatory. The first line (everything up to the first \\)specifies the arrangement of the columns and the spacing:

\c\quad indicates a column with centered elements followed by a quad ofspace;

\r\quad indicates a column with elements set flush right, followed by a quadof space;

\1 indicates a column with elements set flush left.The &. signs separate the specifications for each column, and the \\ ends thespecifications.

After the specifications we simply list all the elements, row by row, separatingindividual elements in a row by __, and separating the variousrows by \\. Finally,we end the \array with \endarray (which takes the place of the \\ at the endof the last row).

Of course, you don't have to type the \array like this, with each row ona separate line. You can use any arrangement you find convenient, since spacesand (single) (carriage-return)s don't count in math mode.CAUTION. You must specify \c or \r or \1 for each column. If you have thecolumn of double-digit numbers

2122232425

then \c, \r and \1 will all give the same arrangement, since all numerals havethe same width. Nevertheless, you have to pick one!CAUTION. The control sequences \c, \r and \1 are subsidiary to \array,and like \endarray, they can't be replaced. In other words, even if you m^kethe definition \def ine\center<\c}, you can't use \center instead of \c inXarray.

SIDETRIP. On the other hand, if you've already defined \c or \r or \l, youdon't have to go back and change it to something else. -X_-.1_.-TEXwill temporarilyignore your definition while it is setting the \array.

Using theabove \array input we can now get the first formula in this chapterby typing

\endarray\right) \, , ssThe thin space between the matrix and the comma had to be inserted by hand,but the = sign and the comma automatically come out at just the right height.

$$A =\left( \array

.1.

c

C

\r

C

v.

X

X

43

x

Exercise 1. How would you get the second formula (be careful about the period!).CAUTION. As you should realize when working this Exercise, you will need\nomath if you want non-mathematical things to appear in an \array. Youprobably set one of the elements as \nomath-Cfor $x>os}, with a pair of $signs buried inside the \nomath. But be sure not to type the first element as$x+ls: X,.W-TeX is already processing things in math mode in an \array, anda naked $ sign will lead to complete havoc.

To vary the space between columns of an \array, just change \quad tosome other amount of horizontal space, like \qquad or \quad\qquad or \, ormore generally \hskip (dimen), where (dimen) is some dimension, like 6pt or.6em. If you don't specify any space after a column, it will be set right next tothe succeeding column.

On the other hand, the usual space between rows is . 3em. To get extra spaceof a certain dimension between two rows, simply put

\xspace (dimen) \\between them, where (dimen) is the dimension. (Don't use \quad here, sinceit's not a dimension, but a horizontal space having the dimension lem.)

This is the whole secret of setting \arrays—all the rest is commentary.1. If you have a complicated formula as one of the entries, it will come out as ifit were being set in text:

But you can always use \sized to get it set as a display

N

l

6 c2. If the entries of an \array involve any sort of stacking, then within each rowthe entries will be vertically centered with respect to each other:

$$\array \c \quad ii \c\\ Na k \sumXiTN xXn\\ a £_ xn

b it c\endarrayss b c

$$\array\c\quad__\c\\a_Asized-C\sumXlTNxXn}\\b__c\endarrayss ° l_,xn

$$\array\c\quad__\c\\ % _j_x+y__\sized{A\frac b}\\ S\sized<C\frac D}__u+v\endarrayss _ u+v

c.

c

C

C

(44

c

c

SIDETRIP. The \array

will actually come out asAx + y B

z v+ vwithout enough space between the lines! The reason for this is rather technical(basically, the lines containing x +y and v + v do have an extra . 3em of spacebetween them, and the — just manages to fit into this space, so TeX doesn't addyet another . 3em of space). On the rare occassions when something like thisoccurs in the first output, just add the extra space by hand; in this case, \xpace. 3em\\ should go between the lines.3. Many terminals have a key labelled tad that moves the cursor over about 10spaces. This is useful if you want your input

to be linedup in columnsso that youget an arrayon the screen

XXto^-TeX usually treats a tab exactly like a space, but inside an Xarray thetabkey has exactly the same meaning as the _. sign. So you can type tab insteadof L and get your input for an \array actually to look like an array:

$$\arr-ay\c\quad (TAD) \r\quad (TAB) \l\\ % jX (TAB) 1 (TAB) .I\\ HllX+y (TAB) 11 (TAB) .il\\ X_t" y n -li

Notice that you still put \\ after each row, and, of course, the columns of yourinput will all appear flush left (unless you add some spaces by hand). Also, youwon't want to use tad this way unless all entries can be typed within the amountof space that tab skips. Even if the entries are all short, the specifications mightbe too long, but there's nothing to prevent you from using __ there:

X (TAB) 1 (TAB) .I\\

$$\array\c\quad__\c\\x+yi\sized<A\frac b}\\\z_.u+v\endarrayss

X+y+Z (TAB) 111 (TAB) . ili\\ x + y+z 111 .111\endarrayss

$$\array\c\hskip 2.3in & \r\hskip 2.3in __ \l\\

* > >

C

C

45

4. As far as T}2_ is concerned, an \array is justanother (gigantic) mathematicalsymbol. So, for example, you can get the aligned equation

by typing$$\align\left(\array\c\quad\c\\a__b\\c<S.d\endarrayXright) \cdot\left (\array\c\quad\c\\o<S_i\\l_.o\endarray\right)

Notice that the &'s for each array are neatly quarantined by the Xarray\endarrays, so TeX won't confuse, them with the &s that arc used in \align. . . \endal ign. (These <s_'s serve essentially the same function as the &'s inan Xarray—in fact, an Xalign is really a special sort of \array.)5. Carrying the reasoning of the previous paragraph to its logical conclusion, youcan even put \arrays in an Xarray! For example, you can get the followingarray of matrices

CD CDGO CD

by typing$$\array\c\qquad&\c\\\lef t (<\array\c\quad__\c\\l_.o\\o«4.l\endarray}\right)

&\left« . . . }\right)\\\xspace 2em\\\left({ . . . }\right) ii \left« . . . }\right)\endarrayss

Notice that it wasn't necessary to put \sized around the \arrays that appearas elements: once an array has been made, it is of a fixed size, that doesn'tchange whether it appears in text or in a display.

Oh yes, you can also put an Xarray of \arrays inside an Xarray, etc.

fa 6WO l\__fa-Q + b-l al + 6 0\\c d)'\l o)~\c-0 + d-l c-l + d-o)

-C 3

__--\ left(Xarray\c\quad_. \c\\ . . . \endarray\right)-_=\left(\array\c\quad__\c\\b__a\\d__c\endarray\right)\endal ignss

A t

46

CAUTION. Notice that the inner \arrays in the above example were put inbraces. If the braces were omitted, TeX would become confused, because it wouldthink that the first Xarray goes with the first Xendarray, rather than the lastone. (Typing

■CXleft (Xarray . . . \endarray\right)}

would work also.) In practice, of course, you'll probably type something like

Notice that we still put \1 in braces (otherwise T^C would get confused as soonas it substituted \ left (Xarray . . . \endarray\right) for \l).

SIDETRIP. In the above example we could have defined

with an extra pair ofbraces, and then we wouldn't need braces around \1 (comparepage ??).6. When you're typing a matrix, you have to concentrate so hard on the \arraypart that it's easy to forget the \left( and \right). So there's the handycontrol sequence \matrix . . . \endmatrix, which is just like \array, ex-cept that the parentheses get put in automatically. There's also \bmatrix ifyou want a matrix surrounded by brackets °* , and \vmatrix if you want it

surrounded by vertical lines r' .7. You might very well get tired of typing the specifications for arrays over andover again. If you make definitions like

\def ine\twof ormat-(\c\quad_k\c\\}\def ine\threeformat{\c\quad__\c\quad__\c\\}

$$\def ine\l<\ left (\array\c\quad__\c\\l_-o\\o..l\endarray\right) }\define\2< . . . }\define\3< . . . }\define\4< . . . }Xarray\c\qquad__\c\\■C\i}_-<\2}\\<\3}&<\4}\endarrayss

\def ine\l<<\lef t (\array . . . \endarray}}

»» < ... *

C

C

c

c47

X

c

you'll be able to type

$$\array\threeformata__b__c\\ o 6 c

defd&e&f\endarray

(Notice that the \\ was put into the definitions of \twoformat and\threeformatso that it didn't have to be -3'pcd in the \array.) You can evenmake definitions like

\def ine\twoarrayC\array\c\quad_.\c\\}Xdef ine\threearrawy-C\array\c\quad<S.\c\quadc\\}

and then simply type

$$\twoarraya&b\\ a b

c dc&d\endarrayss

Notice th.at you still type \endarray, not

8. The "generic" matrix\endtwoarrayI

(an 012021 022

\O-mi O-rn.2

really involves an array with four rows and columns, in which some of the entriesare \ldots (. . .) and some are \vdots (:) and one entry is empty. Such a matrixlooks better when the space between columns is less than a quad. You might use\U, or better yet, the "thick space" \; that we mentioned on page ??

$$\matrix\c\\;&\c\;__\c\;_fe\c\\aX<ll}.laX<l2}-_\ldots&aX<ln}\\aX<2l}_.aX-C22}__\ldots_.aX<2n}\\\vdots_Avdots& -AvdotsWaX<mi}&aX{m2}_-\ldots__aX{mn}\endmatrixss

Exercise. Define a control sequence with one argument, \generic, so that\generic a gives this matrix, \generic b gives the same matrix with_>'s instead of o's, etc. What will \generic<(a+b)} give? How about\generic-(a+b}?