TypesettingMathematics—User’sGuide(SecondEdition) BrianW.KernighanandLorindaL.Cherry ABSTRACT Thisistheuser’sguideforasystemfortypesettingmathematics,usingthe phototypesettersontheUNIX◯randGCOSoperatingsystems. Mathematicalexpressionsaredescribedinalanguagedesignedtobeeasyto usebypeoplewhoknowneithermathematicsnortypesetting.Enoughofthelanguagetosetin-lineexpressionslikex−>π/2lim(tanx)sin2x=1ordisplayequationslike G(z)=elnG(z)=exp(k≥1ΣSkzkk)=k≥1ΠeSkzk/k =(1+S1z+S21z22!+...)(1+S2z22+S22z422.2!+...)... =m≥0Σ k1,k2,...,km≥0k1+2k2+...+mkm=mΣSk111k1k1!Sk222k2k2!...Skmmmkmkm! zm canbelearnedinanhourorso. ThelanguageinterfacesdirectlywiththephototypesettinglanguageTROFF, somathematicalexpressionscanbeembeddedintherunningtextofa manuscript,andtheentiredocumentproducedinoneprocess.Thisuser’sguide isanexampleofitsoutput. ThesamelanguagemaybeusedwiththeUNIXformatterNROFFtoset mathematicalexpressionsonDASIandGSIterminalsandModel37teletypes. 1.Introduction EQNisaprogramfortypesettingmathematicsontheGraphicsSystemsphototypesettersonUNIXandGCOS.TheEQNlanguage wasdesignedtobeeasytousebypeoplewho knowneithermathematicsnortypesetting. ThusEQNknowsrelativelylittleaboutmathematics.Inparticular,mathematicalsymbols like+,−,×,parentheses,andsoonhaveno specialmeanings.EQNisquitehappytoset garbage(butitwilllookgood). EQNworksasapreprocessorforthe typesetterformatter,TROFF[1],sothenormal modeofoperationistoprepareadocument withbothmathematicsandordinarytext interspersed,andletEQNsetthemathematics whileTROFFdoesthebodyofthetext. OnUNIX,EQNwillalsoproducemathematicsonDASIandGSIterminalsandon Model37teletypes.Theinputisidentical, butyouhavetousetheprogramsNEQNand NROFFinsteadofEQNandTROFF.Ofcourse, somethingswon’tlookasgoodbecauseterminalsdon’tprovidethevarietyofcharacters,sizesandfontsthatatypesetterdoes, buttheoutputisusuallyadequateforproofreading. TouseEQNonUNIX, −2− eqnfiles|troff GCOSuseisdiscussedinsection26. 2.DisplayedEquations TotellEQNwhereamathematical expressionbeginsandends,wemarkitwith linesbeginning.EQand.EN.Thusifyoutype thelines .EQ x=y+z .EN youroutputwilllooklike x=y+z The.EQand.ENarecopiedthrough untouched;theyarenototherwiseprocessed byEQN.Thismeansthatyouhavetotake careofthingslikecentering,numbering,and soonyourself.Themostcommonwayisto usetheTROFFandNROFFmacropackage package‘−ms’developedbyM.E.Lesk[3], whichallowsyoutocenter,indent,left-justify andnumberequations. Withthe‘−ms’package,equationsare centeredbydefault.Toleft-justifyanequa-tion,use.EQLinsteadof.EQ.Toindentit, use.EQI.Anyofthesecanbefollowedbyan arbitrary‘equationnumber’whichwillbe placedattherightmargin.Forexample,the input .EQI(3.1a) x=f(y/2)+y/2 .EN producestheoutput x=f(y/2)+y/2(3.1a) Thereisalsoashorthandnotationso in-lineexpressionslikeπ2icanbeentered without.EQand.EN.Wewilltalkaboutitin section19. 3.Inputspaces SpacesandnewlineswithinanexpressionarethrownawaybyEQN.(Normaltext isleftabsolutelyalone.)Thusbetween.EQ and.EN, x=y+z and x=y+z and x=y +z andsoonallproducethesameoutput x=y+z Youshouldusespacesandnewlinesfreelyto makeyourinputequationsreadableandeasy toedit.Inparticular,verylonglinesarea badidea,sincetheyareoftenhardtofixif youmakeamistake. 4.Outputspaces Toforceextraspacesintotheoutput, useatilde‘‘˜ ’’foreachspaceyouwant: x˜ =˜ y˜ +˜ z gives x=y+z Youcanalsouseacircumflex‘‘ˆ ’’,which givesaspacehalfthewidthofatilde.Itis mainlyusefulforfine-tuning.Tabsmayalso beusedtopositionpiecesofanexpression, butthetabstopsmustbesetbyTROFFcommands. 5.Symbols,SpecialNames,Greek EQNknowssomemathematicalsymbols, somemathematicalnames,andtheGreek alphabet.Forexample, x=2piintsin(omegat)dt produces x=2π∫sin(ωt)dt Herethespacesintheinputarenecessary totellEQNthatint,pi,sinandomegaare separateentitiesthatshouldgetspecialtreatment.Thesin,digit2,andparenthesesare setinromantypeinsteadofitalic;piand omegaaremadeGreek;andintbecomesthe integralsign. Whenindoubt,leavespacesaround separatepartsoftheinput.Averycommon erroristotypef(pi)withoutleavingspaces onbothsidesofthepi.Asaresult,EQNdoes notrecognizepiasaspecialword,andit appearsasf(pi)insteadoff(π).

-3-AcompletelistofEQNnamesappears insection23.Knowledgeableuserscanalso useTROFFfour-characternamesforanything EQNdoesn’tknowabout,like\(bsfortheBell Systemsign. 6.Spaces,Again TheonlywayEQNcandeducethat somesequenceoflettersmightbespecialisif thatsequenceisseparatedfromtheletterson eithersideofit.Thiscanbedonebysurroundingaspecialwordbyordinaryspaces (ortabsornewlines),aswedidintheprevioussection. Youcanalsomakespecialwordsstand outbysurroundingthemwithtildesorcircumflexes: x˜ =˜ 2˜ pi˜ int˜ sin˜ (˜ omega˜ t˜ )˜ dt ismuchthesameasthelastexample,except thatthetildesnotonlyseparatethemagic wordslikesin,omega,andsoon,butalso addextraspaces,onespacepertilde: x=2π∫sin(ωt)dt Specialwordscanalsobeseparatedby braces{}anddoublequotes"...",which havespecialmeaningsthatwewillseesoon. 7.SubscriptsandSuperscripts Subscriptsandsuperscriptsare obtainedwiththewordssubandsup. xsup2+ysubk gives x2+yk EQNtakescareofallthesizechangesandverticalmotionsneededtomaketheoutputlook right.Thewordssubandsupmustbesurroundedbyspaces;xsub2willgiveyouxsub2 insteadofx2.Furthermore,don’tforgetto leaveaspace(oratilde,etc.)tomarkthe endofasubscriptorsuperscript.Acommon erroristosaysomethinglike y=(xsup2)+1 whichcauses y=(x2)+1 insteadoftheintended y=(x2)+1 Subscriptedsubscriptsandsuperscriptedsuperscriptsalsowork: xsubisub1 is xi1 Asubscriptandsuperscriptonthesame thingareprintedoneabovetheotherifthe subscriptcomesfirst: xsubisup2 is x2i Otherthanthisspecialcase,suband supgrouptotheright,soxsupysubzmeans xyz,notxyz. 8.BracesforGrouping Normally,theendofasubscriptor superscriptismarkedsimplybyablank(or tabortilde,etc.)Whatifthesubscriptor superscriptissomethingthathastobetyped withblanksinit?Inthatcase,youcanuse thebraces{and}tomarkthebeginningand endofthesubscriptorsuperscript: esup{iomegat} is eiωt Rule:BracescanalwaysbeusedtoforceEQN totreatsomethingasaunit,orjusttomake yourintentperfectlyclear.Thus: xsub{isub1}sup2 is x2i1 withbraces,but xsubisub1sup2 is xi21 whichisratherdifferent. Bracescanoccurwithinbracesifnecessary:

−4− esup{ipisup{rho+1}} is eiπρ+1 Thegeneralruleisthatanywhereyoucould usesomesinglethinglikex,youcanusean arbitrarilycomplicatedthingifyouencloseit inbraces.EQNwilllookafterallthedetails ofpositioningitandmakingittherightsize. Inallcases,makesureyouhavethe rightnumberofbraces.Leavingoneoutor addinganextrawillcauseEQNtocomplain bitterly. Occasionallyyouwillhavetoprint braces.Todothis,enclosethemindouble quotes,like"{".Quotingisdiscussedin moredetailinsection14. 9.Fractions Tomakeafraction,usethewordover: a+bover2c=1 gives a+b2c=1 Thelineismadetherightlengthandpositionedautomatically.Bracescanbeusedto makeclearwhatgoesoverwhat: {alpha+beta}over{sin(x)} is α+βsin(x) Whathappenswhenthereisbothanover andasupinthesameexpression?Insuchan apparentlyambiguouscase,EQNdoesthesup beforetheover,so −bsup2overpi is−b2πinsteadof−b2πTheruleswhichdecide whichoperationisdonefirstincaseslikethis aresummarizedinsection23.Whenin doubt,however,usebracestomakeclear whatgoeswithwhat. 10.SquareRoots Todrawasquareroot,usesqrt: sqrta+b+1oversqrt{axsup2+bx+c} is √a+b+1√ax2+bx+c Warning—squarerootsoftallquantities looklousy,becausearoot-signbigenoughto coverthequantityistoodarkandheavy: sqrt{asup2overbsub2} is √a2b2 Bigsquarerootsaregenerallybetterwritten assomethingtothepower1/2: (a2/b2)12 whichis (asup2/bsub2)suphalf 11.Summation,Integral,Etc. Summations,integrals,andsimilarconstructionsareeasy: sumfromi=0to{i=inf}xsupi produces i=∞i=0Σxi Noticethatweusedbracestoindicatewhere theupperparti=∞beginsandends.No braceswerenecessaryforthelowerpart i=0,becauseitcontainednoblanks.The braceswillneverhurt,andifthefromandto partscontainanyblanks,youmustusebraces aroundthem. Thefromandtopartsareboth optional,butifbothareused,theyhaveto occurinthatorder. Otherusefulcharacterscanreplacethe suminourexample: intprodunioninter become,respectively, ∫Π∪∩ Sincethethingbeforethefromcanbeanything,evensomethinginbraces,from-tocan oftenbeusedinunexpectedways:

−5− limfrom{n−>inf}xsubn=0 is n−>∞limxn=0 12.SizeandFontChanges Bydefault,equationsaresetin10-point type(thesamesizeasthisguide),withstandardmathematicalconventionstodetermine whatcharactersareinromanandwhatin italic.AlthoughEQNmakesavaliant attempttouseestheticallypleasingsizesand fonts,itisnotperfect.Tochangesizesand fonts,usesizenandroman,italic,boldand fat.Likesubandsup,sizeandfontchanges affectonlythethingthatfollowsthem,and reverttothenormalsituationattheendof it.Thus boldxy is xy and size14boldx=y+ size14{alpha+beta} gives x=y+α+β Asalways,youcanusebracesifyouwantto affectsomethingmorecomplicatedthana singleletter.Forexample,youcanchange thesizeofanentireequationby size12{...} Legalsizeswhichmayfollowsizeare6, 7,8,9,10,11,12,14,16,18,20,22,24,28, 36.Youcanalsochangethesizebyagiven amount;forexample,youcansaysize+2to makethesizetwopointsbigger,orsize−3to makeitthreepointssmaller.Thishasthe advantagethatyoudon’thavetoknowwhat thecurrentsizeis. Ifyouareusingfontsotherthanroman, italicandbold,youcansayfontXwhereXis aonecharacterTROFFnameornumberfor thefont.SinceEQNistunedforroman,italic andbold,otherfontsmaynotgivequiteas goodanappearance. Thefatoperationtakesthecurrentfont andwidensitbyoverstriking:fatgradis∇∇ andfat{xsubi}isxixi. Ifanentiredocumentistobeinanonstandardsizeorfont,itisaseverenuisance tohavetowriteoutasizeandfontchange foreachequation.Accordingly,youcanseta ‘‘global’’sizeorfontwhichthereafteraffects allequations.Atthebeginningofanyequation,youmightsay,forinstance, .EQ gsize16 gfontR ... .EN tosetthesizeto16andthefonttoroman thereafter.InplaceofR,youcanuseanyof theTROFFfontnames.Thesizeaftergsize canbearelativechangewith+or−. Generally,gsizeandgfontwillappearat thebeginningofadocumentbuttheycan alsoappearthoughoutadocument:theglobal fontandsizecanbechangedasoftenas needed.Forexample,inafootnote‡youwill typicallywantthesizeofequationstomatch thesizeofthefootnotetext,whichistwo pointssmallerthanthemaintext.Don’tforgettoresettheglobalsizeattheendofthe footnote. 13.DiacriticalMarks Togetfunnymarksontopofletters, thereareseveralwords: xdot.x xdotdot..x xhatˆ x xtilde˜ x xvec→x xdyad←→x xbarx xunderx Thediacriticalmarkisplacedattheright height.Thebarandunderaremadethe rightlengthfortheentireconstruct,asin x+y+z;othermarksarecentered. 14.QuotedText Anyinputentirelywithinquotes("...") isnotsubjecttoanyofthefontchangesand spacingadjustmentsnormallydonebythe ‡Likethisone,inwhichwehaveafewrandom expressionslikexiandπ2.Thesizesforthese weresetbythecommandgsize−2.

-6-equationsetter.Thisprovidesawaytodo yourownspacingandadjustingifneeded: italic"sin(x)"+sin(x) is sin(x)+sin(x) Quotesarealsousedtogetbracesand otherEQNkeywordsprinted: "{sizealpha}" is {sizealpha} and roman"{sizealpha}" is {sizealpha} Theconstruction""isoftenusedasa place-holderwhengrammaticallyEQNneeds something,butyoudon’tactuallywantanythinginyouroutput.Forexample,tomake 2He,youcan’tjusttypesup2romanHe becauseasuphastobeasuperscripton something.Thusyoumustsay ""sup2romanHe Togetaliteralquoteuse‘‘\"’’.TROFF characterslike\(bscanappearunquoted,but morecomplicatedthingslikehorizontaland verticalmotionswith\hand\vshould alwaysbequoted.(Ifyou’veneverheardof \hand\v,ignorethissection.) 15.LiningUpEquations Sometimesit’snecessarytolineupa seriesofequationsatsomehorizontalposition,oftenatanequalssign.Thisisdone withtwooperationscalledmarkandlineup. Thewordmarkmayappearonceatany placeinanequation.Itremembersthehorizontalpositionwhereitappeared.Successive equationscancontainoneoccurrenceofthe wordlineup.Theplacewherelineupappears ismadetolineupwiththeplacemarkedby thepreviousmarkifatallpossible.Thus,for example,youcansay .EQI x+ymark=z .EN .EQI xlineup=1 .EN toproduce x+y=z x=1 Forreasonstoocomplicatedtotalkabout, whenyouuseEQNand‘−ms’,useeither.EQI or.EQL.markandlineupdon’tworkwith centeredequations.Alsobearinmindthat markdoesn’tlookahead; xmark=1 ... x+ylineup=z isn’tgoingtowork,becausethereisn’troom forthex+ypartafterthemarkremembers wherethexis. 16.BigBrackets,Etc. Togetbigbrackets[],braces{}, parentheses(),andbars||aroundthings, usetheleftandrightcommands: left{aoverb+1right} ˜ =˜ left(coverdright) +left[eright] is {ab+1}=(cd)+[e] Theresultingbracketsaremadebigenough tocoverwhatevertheyenclose.Othercharacterscanbeusedbesidesthese,buttheare notlikelytolookverygood.Oneexception isthefloorandceilingcharacters: leftfloorxoveryrightfloor <=leftceilingaoverbrightceiling produces ⌊xy⌋≤⌈ab⌉ Severalwarningsaboutbracketsarein order.First,bracesaretypicallybiggerthan bracketsandparentheses,becausetheyare madeupofthree,five,seven,etc.,pieces, whilebracketscanbemadeupoftwo,three, -7-etc.Second,bigleftandrightparentheses oftenlookpoor,becausethecharactersetis poorlydesigned. Therightpartmaybeomitted:a‘‘left something’’neednothaveacorresponding ‘‘rightsomething’’.Iftherightpartisomitted,putbracesaroundthethingyouwant theleftbrackettoencompass.Otherwise,the resultingbracketsmaybetoolarge. Ifyouwanttoomittheleftpart,things aremorecomplicated,becausetechnically youcan’thavearightwithoutacorrespondingleft.Insteadyouhavetosay left"".....right) forexample.Theleft""meansa‘‘leftnothing’’.Thissatisfiestheruleswithouthurting youroutput. 17.Piles Thereisageneralfacilityformaking verticalpilesofthings;itcomesinseveralflavors.Forexample: A˜ =˜ left[ pile{aabovebabovec} ˜˜ pile{xaboveyabovez} right] willmake A=[abcxyz] Theelementsofthepile(therecanbeas manyasyouwant)arecenteredoneabove another,attherightheightformostpurposes.Thekeywordaboveisusedtoseparate thepieces;bracesareusedaroundtheentire list.Theelementsofapilecanbeascomplicatedasneeded,evencontainingmorepiles. Threeotherformsofpileexist:lpile makesapilewiththeelementsleft-justified; rpilemakesaright-justifiedpile;andcpile makesacenteredpile,justlikepile.Theverticalspacingbetweenthepiecesissomewhat largerforl-,r-andcpilesthanitisforordi-narypiles. romansign(x)˜ =˜ left{ lpile{1above0above−1} ˜˜ lpile {if˜ x>0aboveif˜ x=0aboveif˜ x<0} makes sign(x)= 10−1ifx>0ifx=0ifx<0 Noticetheleftbracewithoutamatching rightone. 18.Matrices Itisalsopossibletomakematrices. Forexample,tomakeaneatarraylike xiyix2y2 youhavetotype matrix{ ccol{xsubiaboveysubi} ccol{xsup2aboveysup2} } Thisproducesamatrixwithtwocentered columns.Theelementsofthecolumnsare thenlistedjustasforapile,eachelement separatedbythewordabove.Youcanalso uselcolorrcoltoleftorrightadjustcolumns. Eachcolumncanbeseparatelyadjusted,and therecanbeasmanycolumnsasyoulike. Thereasonforusingamatrixinsteadof twoadjacentpiles,bytheway,isthatifthe elementsofthepilesdon’tallhavethesame height,theywon’tlineupproperly.Amatrix forcesthemtolineup,becauseitlooksatthe entirestructurebeforedecidingwhatspacing touse. Awordofwarningaboutmatrices— eachcolumnmusthavethesamenumberof elementsinit.Theworldwillendifyouget thiswrong. 19.ShorthandforIn-lineEquations Inamathematicaldocument,itisnecessarytofollowmathematicalconventionsnot justindisplayequations,butalsointhebody ofthetext,forexamplebymakingvariable nameslikexitalic.Althoughthiscouldbe donebysurroundingtheappropriateparts -8-with.EQand.EN,thecontinualrepetitionof .EQand.ENisanuisance.Furthermore,with ‘−ms’,.EQand.ENimplyadisplayedequation. EQNprovidesashorthandforshortinlineexpressions.Youcandefinetwocharacterstomarktheleftandrightendsofaninlineequation,andthentypeexpressionsright inthemiddleoftextlines.Tosetboththe leftandrightcharacterstodollarsigns,for example,addtothebeginningofyourdocumentthethreelines .EQ delim$$ .EN Havingdonethis,youcanthensaythings like Let$alphasubi$betheprimary variable,andlet$beta$bezero. Thenwecanshowthat$xsub1$ is$>=0$. Thisworksasyoumightexpect—spaces, newlines,andsoonaresignificantinthetext, butnotintheequationpartitself.Multiple equationscanoccurinasingleinputline. Enoughroomisleftbeforeandaftera linethatcontainsin-lineexpressionsthat somethinglikeni=1Σxidoesnotinterferewith thelinessurroundingit. Toturnoffthedelimiters, .EQ delimoff .EN Warning:don’tusebraces,tildes,circumflexes,ordoublequotesasdelimiters—chaos willresult. 20.Definitions EQNprovidesafacilitysoyoucangivea frequently-usedstringofcharactersaname, andthereafterjusttypethenameinsteadof thewholestring.Forexample,ifthe sequence xsubisub1+ysubisub1 appearsrepeatedlythroughoutapaper,you cansavere-typingiteachtimebydefiningit likethis: definexy′xsubisub1+ysubisub1′ Thismakesxyashorthandforwhatevercharactersoccurbetweenthesinglequotesinthe definition.Youcanuseanycharacterinstead ofquotetomarktheendsofthedefinition,so longasitdoesn’tappearinsidethedefinition. Nowyoucanusexylikethis: .EQ f(x)=xy... .EN andsoon.Eachoccurrenceofxywillexpand intowhatitwasdefinedas.Becarefulto leavespacesortheirequivalentaroundthe namewhenyouactuallyuseit,soEQNwillbe abletoidentifyitasspecial. Thereareseveralthingstowatchout for.First,althoughdefinitionscanusepreviousdefinitions,asin .EQ definexi′xsubi′ definexi1′xisub1′ .EN don’tdefinesomethingintermsofitself’A favoriteerroristosay defineX′romanX′ Thisisaguaranteeddisaster,sinceXisnow definedintermsofitself.Ifyousay defineX′roman"X"′ however,thequotesprotectthesecondX, andeverythingworksfine. EQNkeywordscanberedefined.You canmake/meanoverbysaying define/′over′ orredefineoveras/with defineover′/′ Ifyouneeddifferentthingstoprinton aterminalandonthetypesetter,itissometimesworthdefiningasymboldifferentlyin NEQNandEQN.Thiscanbedonewithndefineandtdefine.AdefinitionmadewithndefineonlytakeseffectifyouarerunningNEQN; ifyouusetdefine,thedefinitiononlyapplies forEQN.Namesdefinedwithplaindefine applytobothEQNandNEQN.

-9-21.LocalMotions AlthoughEQNtriestogetmostthings attherightplaceonthepaper,itisn’tperfect,andoccasionallyyouwillneedtotune theoutputtomakeitjustright.Smallextra horizontalspacescanbeobtainedwithtilde andcircumflex.Youcanalsosaybacknand fwdntomovesmallamountshorizontally.n ishowfartomovein1/100’sofanem(an emisaboutthewidthoftheletter‘m’.) Thusback50movesbackabouthalfthe widthofanm.Similarlyyoucanmove thingsupordownwithupnanddownn.As withsuborsup,thelocalmotionsaffectthe nextthingintheinput,andthiscanbe somethingarbitrarilycomplicatedifitis enclosedinbraces. 22.ALargeExample Hereisthecompletesourceforthe threedisplayequationsintheabstractofthis guide. .EQI G(z)˜ mark=˜ esup{ln˜ G(z)} ˜ =˜ expleft( sumfromk>=1{Ssubkzsupk}overkright) ˜ =˜ prodfromk>=1esup{Ssubkzsupk/k} .EN .EQI lineup=left(1+Ssub1z+ {Ssub1sup2zsup2}over2!+...right) left(1+{Ssub2zsup2}over2 +{Ssub2sup2zsup4}over{2sup2cdot2!} +...right)... .EN .EQI lineup=sumfromm>=0left( sumfrom pile{ksub1,ksub2,...,ksubm>=0 above ksub1+2ksub2+...+mksubm=m} {Ssub1sup{ksub1}}over{1supksub1ksub1!}˜ {Ssub2sup{ksub2}}over{2supksub2ksub2!}˜ ... {Ssubmsup{ksubm}}over{msupksubmksubm!} right)zsupm .EN 23.Keywords,Precedences,Etc. Ifyoudon’tusebraces,EQNwilldo operationsintheordershowninthislist. dyadvecunderbartildehatdotdotdot fwdbackdownup fatromanitalicboldsize subsupsqrtover fromto Theseoperationsgrouptotheleft: oversqrtleftright Allothersgrouptotheright. Digits,parentheses,brackets,punctuationmarks,andthesemathematicalwords areconvertedtoRomanfontwhenencountered: sincostansinhcoshtanharc maxminlimloglnexp ReImandiffordet Thesecharactersequencesarerecognizedand translatedasshown. >=≥ <=≤ ==≡ !=≠ +−± −>→ <−← <<<< >>>> inf∞ partial∂ half12 prime′ approx≃ nothing cdot. times× del∇ grad∇ ...... ,...,,..., sumΣ int∫ prodΠ union∪ inter∩ ToobtainGreekletters,simplyspell themoutinwhatevercaseyouwant:

-10-DELTAΔiotaι GAMMAΓkappaκ LAMBDAΛlambdaλ OMEGAΩmuμ PHIΦnuν PIΠomegaω PSIΨomicrono SIGMAΣphiϕ THETAΘpiπ UPSILONΥpsiψ XIΞrhoρ alphaαsigmaσ betaβtauτ chiχthetaθ deltaδupsilonυ epsilonϵxiξ etaηzetaζ gammaγ TheseareallthewordsknowntoEQN (exceptforcharacterswithnames),together withthesectionwheretheyarediscussed. above17,18lpile17 back21mark15 bar13matrix18 bold12ndefine20 ccol18over9 col18pile17 cpile17rcol18 define20right16 delim19roman12 dot13rpile17 dotdot13size12 down21sqrt10 dyad13sub7 fat12sup7 font12tdefine20 from11tilde13 fwd21to11 gfont12under13 gsize12up21 hat13vec13 italic12˜ ,ˆ 4,6 lcol18{}8 left16"..."8,14 lineup15 24.Troubleshooting Ifyoumakeamistakeinanequation, likeleavingoutabrace(verycommon)or havingonetoomany(verycommon)or havingasupwithnothingbeforeit(common),EQNwilltellyouwiththemessage syntaxerrorbetweenlinesxandy,filez wherexandyareapproximatelythelines betweenwhichthetroubleoccurred,andzis thenameofthefileinquestion.Theline numbersareapproximate—looknearbyas well.Therearealsoself-explanatorymes-sagesthatariseifyouleaveoutaquoteor trytorunEQNonanon-existentfile. Ifyouwanttocheckadocumentbefore actuallyprintingit(onUNIXonly), eqnfiles>/dev/null willthrowawaytheoutputbutprintthe messages. Ifyouusesomethinglikedollarsignsas delimiters,itiseasytoleaveoneout.This causesverystrangetroubles.Theprogram checkeq(onGCOS,use./checkeqinstead) checksformisplacedormissingdollarsigns andsimilartroubles. In-lineequationscanonlybesobig becauseofaninternalbufferinTROFF.If yougetamessage‘‘wordoverflow’’,youhave exceededthislimit.Ifyouprinttheequation asadisplayedequationthismessagewillusuallygoaway.Themessage‘‘lineoverflow’’ indicatesyouhaveexceededanevenbigger buffer.Theonlycureforthisistobreakthe equationintotwoseparateones. Onarelatedtopic,EQNdoesnotbreak equationsbyitself—youmustsplitlong equationsupacrossmultiplelinesbyyourself, markingeachbyaseparate.EQ....EN sequence.EQNdoeswarnaboutequations thataretoolongtofitononeline. 25.UseonUNIX Toprintadocumentthatcontains mathematicsontheUNIXtypesetter, eqnfiles|troff IfthereareanyTROFFoptions,theygoafter theTROFFpartofthecommand.Forexample, eqnfiles|troff−ms TorunthesamedocumentontheGCOStypesetter,use eqnfiles|troff−g(otheroptions)|gcat −11− AcompatibleversionofEQNcanbe usedondevicesliketeletypesandDASIand GSIterminalswhichhavehalf-lineforward andreversecapabilities.Toprintequations onaModel37teletype,forexample,use neqnfiles|nroff Thelanguageforequationsrecognizedby NEQNisidenticaltothatofEQN,althoughof coursetheoutputismorerestricted. TouseaGSIorDASIterminalasthe outputdevice, neqnfiles|nroff−Tx wherexistheterminaltypeyouareusing, suchas300or300S. EQNandNEQNcanbeusedwiththe TBLprogram[2]forsettingtablesthatcontain mathematics.UseTBLbefore[N]EQN,like this: tblfiles|eqn|troff tblfiles|neqn|nroff 26.Acknowledgments WearedeeplyindebtedtoJ.F. Ossanna,theauthorofTROFF,forhiswillingnesstoextendTROFFtomakeourtaskeasier, andforhiscontinuousassistanceduringthe developmentandevolutionofEQN.Weare alsogratefultoA.V.Ahoforadviceonlanguagedesign,toS.C.Johnsonforassistance withtheYACCcompiler-compiler,andtoall theEQNuserswhohavemadehelpfulsuggestionsandcriticisms. References [1]J.F.Ossanna,‘‘NROFF/TROFFUser’s Manual’’,BellLaboratoriesComputing ScienceTechnicalReport#54,1976. [2]M.E.Lesk,‘‘TypingDocumentson UNIX’’,BellLaboratories,1976. [3]M.E.Lesk,‘‘TBL—AProgramforSettingTables’’,BellLaboratoriesComputingScienceTechnicalReport#49,1976.