; TeX output 1997.01.23:0048soI DtGGcmr17A7tnewimplemenqtationofLdKGXQ cmr12AT[-E;gX'sGGcmss17tabularq:andarrayϗ enqvironment!", cmsy10WDFVrankMittelbacrhDarvidCarlisle2K cmsy8y&PrinrtedJanuary23,1997.!Kt : cmbx9Abstractэoo cmr9ThisarticledescribAesanextendedimplemen9tationoftheL5Aacmr6A TuAEX ow cmss9array { band!tabula9r {environments.?ThespAecialmeritsofthisimplementationarebfurther];optionstoformatcolumnsandthefactthatfragileL5A TuAEX{commandsbdon'tTha9vetobAe!ߤN cmtt9\protect'edanymorewithinthoseenvironments.oThemajorpartofthecoAdeforthispac9k|ragedatesbackto1988|sodoAesbsomeTofitsdoAcumen9tation.!čI#Nff cmbx121aLIntros3ductionIK`y cmr10Thisnewimplementationofthe$m#R cmss10array#{andtabular#{environmentsispartofalarger Ipro8jectSYinwhichwearetryingtoimprovetheL5ffٓRcmr7A͉TU>'ExX-coGdeinsomeaspectsandtoImakeUUL5ffA͉TU>'ExXeveneasiertohandle.XThereadershouldbGefamiliarwiththegeneralstructureoftheenvironmentsImentionedabGove.UTF*urtherinformationcanbGefoundin[3]and[1].UTTheadditionalIoptionsgwhichcanbGeusedinthepreambleaswellasthosewhichnowhaveaIslightlyUUdi erentmeaningaredescribGedintable1.XAdditionally0weintroGduceanewparametercalled%{\bfseries}l.~Y*oudonothaveܒtobeginbeveryUUentryofthecolumnwith\bfseriesanymore.XbInʉcolumnswhichhavebGeengeneratedwithp,morb,thedefaultvqalueofb\parindentUUis0pt.qThiscanbGechangedwithb>{\setlength{\parindent}{1cm}}p.IJffr @ -:q% cmsy6L|{Ycmr8ThisX lehasvÎersionnumbfdecl.gfffd'ExX.B_%ffffffBH1ff!fdecl.g1fffd{and<{optionswereoriginallydevelopGedforthefollowingapplication: b>{$}c<{$}ƲgeneratesacolumninmathmoGdeinatabular#{environment.Ifbyou{musethistypGeofapreambleinanarray#{environment,yougetacolumnbinUULRmoGdebecausetheadditional$'scanceltheexisting$'s.0XbOne-canalsothinkofmorecomplexapplications.9AproblemwhichhasbGeenbmentionedPseveraltimesinTU>'ExXhaxcanbGesolvedwith>{\centerdots}cb<{\endcenterdots}.DT*oͩcenterdecimalsattheirdecimalpGointsyou(only?)bhaveUUtode nethefollowingmacros:b{\catcode`\.\active\gdef.{\egroup\setbox2\hbox\bgroup}} b\def\centerdots{\catcode`\.\active\setbox0\hbox\bgroup}b\def\endcenterdots{\egroup\ifvoid2\setbox2\hbox{0}\fip,\ifdim\wd0>\wd2\setbox2\hboxto\wd0{\unhbox2\hfill}\elsey\setbox0\hboxto\wd2{\hfill\unhbox0}\fip,\catcode`\.12\box0.\box2}bW*arning:fThe=coGdeisbad,Bitdoesn'tworkwithmorethanonedotinacell bandsdoGesn'tworkwhenthetabularisusedintheargumentofsomeotherbcommand.cA+Qmuch+[bGetterversionisprovidedinthedcolumn.stybyDavidbCarlisle.XbUsing1c!{\hspace{1cm}}cyougetspacebGetweentwocolumnswhichisen-blargedbyonecentimeter,_whilec@{\hspace{1cm}}cgivesyouexactlyone2 sobcentimeterUUspacebGetweentwocolumns.I&N cmbx121.1gDe ningnewcolumnsp`eci ersuTIWhilstUUitishandytobGeabletotype\newcolumntype4b>{h'': cmti10some3+de}'clarations!iUgW}{c}<{hsome3+mor}'e6 de}'clarations!inT}Iifyouhaveaone-o columninatable,itisratherinconvenientifyouoftenuse Icolumnsofthisform.6Thenewversionallowsyoutode neanewcolumnspGeci er,Isayx,whichwillexpandtotheprimitivescolumnspGeci ers.^1ǤThuswemayde ne4b\newcolumntype{x}{>{hsome3+de}'clarations!iUgW}{c}<{hsome3+mor}'e6 de}'clarations!inT}}IOnecanthenusethexcolumnspGeci erinthepreambleargumentsofallarray IorUUtabularenvironmentsUUinwhichyouwantcolumnsofthisform.XIt^iscommontoneedmath-moGdeandLR-modecolumnsinthesamealignment.IIfUUwede ne:4b\newcolumntype{C}{>{$}c<{$}}b\newcolumntype{L}{>{$}l<{$}}b\newcolumntype{R}{>{$}r<{$}}IThen͚wecanuseC{togetcentredLR-moGdeinanarray,orcentredmath-moGdeIinUUatabular.XThe CexamplegivenabGovefor`centreddecimalpGoints'couldbGeassignedtoadIspGeci erUUwiththefollowingcommand.b\newcolumntype{d}{>{\centerdots}c<{\endcenterdots}}XTheabGovesolutionalwayscentresthedotinthecolumn.ThisdoGesnotlookItoGoigoodifthecolumnconsistsoflargenumbGers,ebuttoonlyafewdecimalplaces.IAnUUalternativede nitionofadcolumnisb\newcolumntype{d}[1]{>{\rightdots{#1}}r<{\endrightdots}}IwhereUUtheappropriatemacrosinthiscaseare:^24W,\def\coldot{.}%Orifyouprefer,\def\coldot{\cdot} W,{\catcode`\.=\active`\gdef.{$\egroup\setbox2=\hboxto\dimen0\bgroup$\coldot}}W,\def\rightdots#1{%`\setbox0=\hbox{$1$}\dimen0=#1\wd0`\setbox0=\hbox{$\coldot$}\advance\dimen0\wd0`\setbox2=\hboxto\dimen0{}%`\setbox0=\hbox\bgroup\mathcode`\.="8000$}W,\def\endrightdots{$\hfil\egroup\box0\box2}INotethat\newcolumntypetakesthesameoptionalargumentas\newcommand IwhichddeclaresthenumbGerofargumentsofthecolumnspGeci erbeingde ned.INowwecanspGecifyd{2}inourpreambleforacolumnof gurestoatmosttwoIdecimalUUplaces.IBljffr J= "5-:1LThiscommandwÎasnamednnewcolumninthenewarray.sty.Atthemomentnnewcolumnis stillXsupp "5-:2LTheXpacÎkagedcolumn.stycontainsmorerobustmacrosbasedontheseideas.3!soXAsratherؕdi erentuseofthe\newcolumntypesystemtakesadvqantageofthe Ifactthatthereplacementtextinthe\newcolumntypecommandmayrefertoImorethanonecolumn. J%SuppGosethatadocumentcontainsalotoftabularIenvironmentsthatrequirethesamepreamble, AbutyouwishtoexpGerimentwithIdi erent<+preambles.idLampGort'soriginalde nitionallowedyoutodothefollowingI(althoughUUitwasprobablyamis-useofthesystem).b\newcommand{\X}{clr}b\begin{tabular}{\X}UU...Iarray.stystakesgreatcare("V cmbx10nottoexpandthepreamble,andsotheabGovedoGesnotIworkUUwiththenewscheme.qWiththenewversionthisfunctionalityisreturned:b\newcolumntype{X}{clr}b\begin{tabular}{X}UU...XTheD'replacementtextina\newcolumntypecommandmayrefertoanyoftheIprimitivesofarray.styseetable1onpage2,.)ortoanynewlettersde nedinIotherUU\newcolumntypecommands.XA,listofallthecurrentlyactive\newcolumntypede nitionsissenttothey\showcolsIterminalUUandlog leifthe\showcolscommandisgiven.6I1.2gSp`ecialv@ariationsof*Ɍ cmbsy10n)߆T cmtt12hlineuTITheqfamilyof8tabularenvironmentsqallowsverticalpGositioningwithrespecttotheIbaselineGofthetextinwhichtheenvironmentappGears..mBydefaulttheenvironmentIappGearscentered,C"butthiscanbechangedtoalignwiththe rstorlastlineinItheVenvironmentbysupplyingatorbvqaluetotheoptionalpGositionargument.IHowever,thisdoGesnotworkwhenthe rstorlastelementintheenvironmentisaI\hline-command|inthatcasetheenvironment-isalignedatthehorizontalrule.XHereUUisanexample:YT*ables UVwithUUno UVhline UVcommands UVused@]versus/cYtablesUUff:fd fffdwithsome ff fffdhline= ff fffdcommands ffff:A)used.#Tables #\begin{tabular}[t]{l}ݐwithno\\hline\\commands\\used#\end{tabular}versustables#\begin{tabular}[t]{|l|}ݐ\hline&withsome\\hline\\commands\\ݐ\hline#\end{tabular}used.xqƍXUsingۉ\firsthlineand\lasthlinewillcuretheproblem,andthetableswill \firsthline$\lasthlineIalignpropGerlyaslongastheir rstorlastlinedoesnotcontainextremelylargeIob8jects.4*}soYT*ables UVwithUUno UVline UVcommands UVused@]versus3YtablesUUff:fd fffdwithsome ff  fffdline$w ff fffdcommands ffff:󙚎A)used.#Tables #\begin{tabular}[t]{l}&withno\\line\\commands\\used#\end{tabular}versustables#\begin{tabular}[t]{|l|}ݐ\firsthline&withsome\\line,\\commands\\ݐ\lasthline#\end{tabular}used.xqƍITheCimplementationofthesetwocommandscontainsanextradimension,>which \extratabsurround Iis&called\extratabsurround,[JtoaddsomeadditionalspaceatthetopandtheIbGottomUUofsuchanenvironment.qThisisusefulifsuchtablesarenested.!čI2aLFinalffCommentsI2.1gHandlingofrulesuTITherearetwopGossibleapproachestothehandlingofhorizontalandverticalrulesIinUUtables:U81.brulesUUcanbGeplacedintotheavqailablespacewithoutenlargingthetable,orU82.brulesUUcanbGeplacedbetweenUUcolumnsorrowstherebyenlargingthetable.Iarray.styimplementsthesecondpGossibilitywhilethedefaultimplementationin ItheWL5ffA͉TU>'ExXkernelimplementsthe rstconcept.dBothconceptshavetheirmerritsIbutUUonehastobGeawareUUoftheindividualimplications.XbWithUstandardL5ffA͉TU>'ExXaddingrulestoatablewillnota ectthewidthorbheightBQofthetable(unlessdoublerulesareused),Fe.g.,changingBQapreamblebfromPhllltol|l|ldoGesnota ectthedocumentotherthanaddingrulestobtheDtable.l?Incontrast,Hwitharray.styatablethatjust tthe\textwidthbmightUUnowproGduceanoverfullbGox.XbWithstandardL5ffA͉TU>'ExXmoGdifyingthewidthofrulescouldresultinuglylook-bingtablesbGecausewithoutadjustingthe\tabcolsep,etc.thespacebetweenbruleandcolumncouldgettoGosmall(ortoolarge).MInfactevenoverprintingboftextispGossible./Incontrast,}witharray.stymodifyinganysuchlengthbusuallyFworkswellastheactualvisualwhitespace(from\tabcolsep,Ietc.)bdoGesUUnotdependonthewidthoftherules.XbWithmstandardL5ffA͉TU>'ExXbGoxedtabularsactuallyhavestrangecornersbGecausebthehorizontalrulesendinthemiddleoftheverticalones.6ThisloGoksverybunpleasantmhwhenalarge\arrayrulewidthischosen.InthatcaseasimplebtableUUlikeb\setlength{\arrayrulewidth}{5pt} b\begin{tabular}{|l|}ks.\hline s,A\\\hlineb\end{tabular}56NsobwillUUproGducesomethinglike/Hcfd fdA 8insteadUUof UVfd fdA I2.2gComparisonswitholderversionsofarray.styuTITherearesomedi erencesinthewayversion2.1treatsincorrectinput,9evenif Ithesource ledoGesnotappeartouseanyoftheextrafeaturesofthenewversion.͍XbApreambleoftheform{wx*{0}{abc}yz}wastreatedbyversionspriortob2.1UUas{wx}.qV*ersion2.1treatsitas{wxyz}fXbAn7incorrectpGositionalargumentsuchas[Q]6wastreatedas[c]bybarray.sty,UUbutisnowtreatedas[t].XbAbpreamblecsuchas{cc*{2}}withanerrorina-formwillgeneratedi erentberrorsڃinthenewversion.HInbGothcasestheerrormessageisnotparticularlybhelpfulUUtothecasualuser.XbRepGeatedaconstructionsgeneratedanerrorinearlierversions,+butarebnowߦallowedinthispackqage.>{hde}'cs1[i "}>{hde}'cs2[i}istreatedthesameasb>{hde}'cs2[i "hde}'cs1[i@D2}.XbTheX.\extracolsepcommanddoGesnotworkwiththeoldversionsofbarray.sty,wsee@5thecommentsinarray.bug.hWithversion2.1\extracolsepbmayagainbGeusedin@-expressionsasinstandardL5ffA͉TU>'ExX,kandalsoin!-bexpressionsUU(butseethenotebGelow).I2.3gBugsandFeaturesuTXbErrormessagesgeneratedwhenparsingthecolumnspGeci cationrefertothebpreambleargumentafterithasbGeenre-writtenbythe\newcolumntypebsystem,notQtothepreambleenteredbytheuser.PThisseemsinevitablewithbanyUUsystembasedonpre-proGcessingandsoisclassedasafeature.XbThetreatmentofmultipledeclarationsmayseemstrangeatb rst.EarlierBimplementationstreated>{hde}'cs1[i "}>{hde}'cs2[i}Bthesameasb>{hde}'cs1[i "hde}'cs2[i@D2}.`HoweverthisdidnotgivetheusertheoppGortunityofboverridingYJthesettingsofa\newcolumntypede nedusingthesedeclarations.bF*orexample,suppGoseinanarrayenvironmentweuseaCcolumnde nedbasҼabGove.TheCҜspGeci esacentredtextcolumn,however>{\bfseries}C,bwhich6re-writesto>{\bfseries}>{$}c<{$}wouldnotspGecifyaboldcol-bumnIasmightbGeexpected,asthepreamblewouldessentiallyexpandtob\hfil$\bf$#$?$\hfilandsothecolumnentrywouldnotbGeinthescopebofthe\bfseries!0#ThepresentversionswitchestheorderofrepGeateddec-blarations,5andsotheabGoveexamplenowproducesapreambleoftheformb\hfil$$\bfseries#$$\hfil,andthedollarscanceleachotheroutwithoutblimitingUUthescopGeofthe\bfseries.XbTheKuseof\extracolsephasbGeensub8jecttothefollowingtworestrictions.bTheremmustbGeatmostone\extracolsepcommandper@,sor!expressionband6thecommandmustbGedirectlyenteredintothe@expression,onotaspart6C sobofoamacrode nition. Thus\newcommand{\ef}{\extracolsep{\fill}} b...@{\ef}ddoGesnotworkwiththispackqage.Howeveryoucanusesome-bthingUUlike\newcolumntype{e}{@{\extracolsep{\fill}}instead.shXbAs&enotedbytheL5ffA͉TU>'ExXbGook,/forðepurpGoseof\multicolumneachcolumnbwith&theexceptionofthe rstoneconsistsoftheentryandthefollowingbinter-columnױmaterial.Thismeansthatinatabularwiththepreambleb|l|l|l|l|inputsuchas\multicolumn{2}{|c|}inanythingotherthanbtheUU rstcolumnisincorrect.bInQthestandardarray/tabularimplementationthiserrorisnotsonoticeablebasfthatversioncontainsnegativespacingsothateach|takesupnohorizon-btalTspace.LButsinceinthispackqagetheverticallinestakeuptheirnaturalbwidthUUoneseestwoUUlinesiftwoUUarespGeci ed.)uI3aLTheffdos3cumentationdriver leIThe rstbitofcoGdecontainsthedocumentationdriver leforTU>'ExX,i.e.,the leIthatVwillproGducethedocumentationyouarecurrentlyreading.ItwillbGeextractedIfromUUthis lebythedocstripprogram. Ls1S cmsy9hdriveroi Ls2S\NeedsTeXFormat{LaTeX2e}[1995/12/01]Ls3S\documentclass{ltxdoc}Ls4Ls5S\AtBeginDocument{\DeleteShortVerb{\|}} s,%undothedefaultisnotusedLs6Ls7XdD\usepackage{array}Ls8Ls9XdD%AllowlargetableatbottomI10XdD\renewcommand{\bottomfraction}{0.7}I11I12S\EnableCrossrefsI13XdD%\DisableCrossrefs,%Say\DisableCrossrefsifindexisreadyI14I15S\RecordChangesU %GatherupdateinformationI16I17S\CodelineIndexU %IndexcodebylinenumberI18I19XdD%\OnlyDescriptionX%commentoutforimplementationdetailsI20XdD%\OldMakeindex!%useifyourMakeIndexispre-v2.9I21S\begin{document}I22ap\DocInput{array.dtx}I23S\end{document}I24Sh5" cmmi9=driveroi 'ExXq[typGesetstablesusingthisprimitive.ThatiswhywewillnowtakealoGokatIthe]algorithmwhichdeterminesapreamblefora\halignstartingwithagivenIuserUUpreambleusingtheoptionsmentionedabGove.7RsoXThecurrentversionisde nedatthetopofthe leloGokingsomethinglikethisI25Shpack9age#g i I26S%\NeedsTeXFormat{LaTeX2e}[1994/05/13]I27S%\ProvidesPackage{array}[\filedate\spaceversion\fileversion]XThemostinterestingmacrosofthisimplementationarewithoutdoubtthose IwhichsarerespGonsiblefortheconstructionofthepreambleforthe\halign.ITheYunderlyingalgorithmwasdevelopGedby}d-- cmcsc10LamporUTt(resp.Knuth,ZseetexhaxIV87#??),UUandithasbGeenextendedandimproved.XTheuserpreamblewillbGereadtokenbytoken.+AtokenisasinglecharacterlikeIcorabloGckenclosedin{...}.F*orexamplethepreambleof\begin{tabular}I{lc||c@{\hspace{1cm}}}UUconsistsofthetokenl,c,|,|,@and\hspace{1cm}.XThecurrentlyusedtokenandtheone,usedbGefore,areneededtodecideonhowIthepconstructionofthepreamblehastobGecontinued.IntheexamplementionedIabGove1thelcausesthepreambletobeginwith\hskip\tabcolsep.[F*urthermoreI#?\hfilkwouldbGeappendedtode nea ushleftcolumn.Thenexttokenisac.IBecauseitwasprecededbyanlitgeneratesanewcolumn.yJThisisdonewithI\hskip?\tabcolsep&\hskip\tabcolsep.J The`columnwhichistobGecenteredIwillbGeappendedwith\hfil?#\hfil.GThetoken|wouldthenaddaspaceofI\hskip?\tabcolsep|andaverticallinebGecausethelasttokenswasac.dbythetoken|.j!W*ewillnotdiscussourexamplefurtherbutrathertakeIaUUloGokatthegeneralcaseofconstructingpreambles.XThedexampleshowsthatthedesiredpreambleforthe\haligncanbGecon-Istructed݇assoGonastheactionofallcombinationsofthepreambletokensareIspGeci ed.t0Therexare18suchtokenssowehave1918O=342xcombinationsifIweycountthebGeginningofthepreambleasaspGecialtoken. F*ortunately,thereIare manycombinationswhichgeneratethesamespaces,:sowecande netokenIclasses. YW*e0willidentifyatokenwithinaclasswithanumbGer,gsowecaninsertIthe=Rformatting(forexampleofacolumn).iT*able2listsalltokenclassesandtheirIcorrespGondingUUnumbers.`etoken(\@chclassY \@chnumǍnY1c9090nY1l9091nY1r9092c7p-arg9093c7t-arg9094c7b-arg9095nY1|9190c7!-arg9191c7<-arg92ҹ|c7>-arg93ҹ|xJcff~>xtoken4\@chclassp \@chnumǍ+StartI4}h|+@-argI5}h| %!I6}h| %@I7}h| %I9}h| %pGi103 %tGi104 %bGi105<*ÈT*ableUU2:qClassesofpreambletokens9$\@chclass3P\@chnum\@lastchclassIThe>classandthenumbGer>ofthecurrenttokenaresavedinthecountregistersI\@chclassx9and\@chnum,whiletheclassoftheprevioustokenisstoredinthe8 ]soIcountkCregister\@lastchclass.Allofthementionedregistersarealreadyallo- IcatedKinlatex.tex,MwhichisthereasonwhythefollowingthreelinesofcoGdeareIcommentedPout.pOLaterthroughoutthetextIPwillnotmentionitagainexplicitelyIwheneverUUIusea%sign.qThesepartsarealreadyde nedinlatex.tex. ȍI28S%\newcount\@chclass I29S%\newcount\@chnumI30S%\newcount\@lastchclassXf\@addtopreambleIW*ewillsavethealreadyconstructedpreambleforthe\halignintheglobalmacro I\@preamble.qThisUUwillthenbGeenlargedwiththecommand\@addtopreamble.I31S\def\@addtopreamble#1{\xdef\@preamble{\@preamble#1}}*I4.1gThecharacterclassofa/kAH cmssbx10tok"enuT\@testpachIWith thehelpof\@lastchclasswecannowde neamacrowhichdeterminestheIclassFandthenumbGerFofagivenpreambletokenandassignsthemtotheregistersI\@chclassUUand\@chnum.I32S\def\@testpach{\@chclassȍIFirstTwedealwiththecasesinwhichthetoken(#1)istheargumentof !,U@,<TorI>.qW*eUUcanseethisfromthevqalueof\@lastchclass:I33XdD\ifnum\@lastchclass=6\@ne\@chnum\@ne\else I34]\ifnum\@lastchclass=75\elseI35ap\ifnum\@lastchclass=8\tw@\elseI36f\ifnum\@lastchclass=9\thr@@ȍIOtherwise]wewillassumethatthetokenbGelongstotheclass0andassignthe IcorrespGondingUUnumberUUto\@chnumifourassumptioniscorrect.I37ap\else\z@IIfɊthelasttokenwasap,morab,\@chnumalreadyhastherightvqalue.fThisis ItheUUreasonforthesomewhatcuriouschoiceofthetokennumbGersinclass10.I38ap\ifnum\@lastchclass=10\elseIOtherwise/wewillcheckif\@nextchariseitherac,6loranr.eSomeapplications Ichange=thecatcoGdesofcertaincharacterslike\@"inamstex.sty.iAsaresulttheItestsbGelowwouldfailsincetheyassumenon-activecharactertokens.ThereforeIwe evqaluate\@nextcharoncetherebyturningthe rsttokenofitsreplacementItextintoachar.ZGAtthispGointherethisshouldhavebGeentheonlycharpresentinI\@nextcharUUwhichputintoviaa\def.I39ap\edef\@nextchar{\expandafter\string\@nextchar}% I40ap\@chnumI41ap\if\@nextcharc\z@\elseI42f\if\@nextcharl\@ne\elseI43kJ\if\@nextcharr\tw@\elseȍIIfaitisadi erenttoken,dweknowthattheclasswasnot0.W*eassignthevqalue0 Itoe\@chnumbGecausethisvqalueisneededforthe|{token.NowewemustchecktheIremainingclasses..Notethatthevqalueof\@chnumisinsigni canthereformostIclasses.I44ap\z@\@chclass I45ap\if\@nextchar|\@ne\elseI46f\if\@nextchar!6\elseI47kJ\if\@nextchar@7\else9 msoI48p2\if\@nextchar<8\else I49t\if\@nextchar>9\elseiITheUUremainingpGermittedtokensarep,mandb(class10). iI50]10I51]\@chnumI52]\if\@nextcharm\thr@@\elseI53ap\if\@nextcharp4\elseI54f\if\@nextcharb5\elseINowVRtheonlyremainingpGossibilityisaforbiddentoken,VsowechoGoseclass0and InumbGerk0andgiveanerrormessage.Thenwe nishthemacrobyclosingallI\if's. iI55ap\z@\@chclass\z@\@preamerr\z@\fi\fi\fi\fi I56ap\fi\fi s,\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}mI4.2gMultiplecolumns({form)uT$\@xexpast$\the@toks\the@tokszINowFwediscussthemacrothatdeletesallformsoftypGe*{N}{String}}fromaIusernpreambleandreplacesthemwithNrܲcopiesofString.Nested{expressionsIaregdealtwithcorrectly*,lthatmeans{expressionsarenotsubstitutediftheyareIinUUexplicitbraces,asin@{*}.XThismacroiscalledvia\@xexpasthpr}'eamble[i.z*0x\@@.NThe{expression*0xIisbGeingusedtoterminatetherecursion,Iasweshallseelater,and\@@servesasIanqargumentdelimiter. \@xexpasthasfourarguments. The rstoneisthepartIof>theuserpreamblebGeforethe rst{expressionwhilethesecondandthirdonesIarel]theargumentsofthe rst{expression(thatisNandStringNڲinthenotationImentionedUUabGove).qThefourthargumentistherestofthepreamble.I57S\def\@xexpast#1*#2#3#4\@@{%iIThenumbGerofcopiesofStringZ(#2)thataretobeproducedwillbesavedinaIcountUUregister.I58ap\@tempcnta#2iIW*esavethepartofthepreamblewhichdoGesnotcontaina{form(#1)inaIPlainTU>'ExXUUtokenregister.qW*ealsosaveString7Ҳ(#3)usingaL5ffA͉TU>'ExXtokenregister.I59ap\toks@={#1}\@temptokena={#3}%iINow,VwehavetousealittletricktoproGduceNϬcopiesofString.W*ecouldtryI\def\@tempa{#1} andthenN*times\edef\@tempa{\@tempa#3}. kThiswouldIhavetheundesirede ectthatallmacroswithin#1and#3wouldbGeexpanded,Ialthough,forsexample,constructionslike@{..}arenotsuppGosedtobechanged.IThatUUiswhywe\lettwocontrolsequencestobGeequivqalentto\relax.I60ap\let\the@toksz\relax\let\the@toks\relaxiIThenʽweensurethat\@tempacontains{\the@toksz\the@toks...\the@toks}I(theUUmacro\the@toksexactlyNtimes)assubstitutiontext.I61ap\def\@tempa{\the@toksz}% I62ap\ifnum\@tempcnta>0\@whilenum\@tempcnta>0\doI63kJ{\edef\@tempa{\@tempa\the@toks}\advance\@tempcnta\m@ne}%iIIfN;cwasgreaterthanzeroweprepareforanothercallof\@xexpast.9yOtherwise Iwe]Oassumewehavereachedtheendoftheuserpreamble,MbGecausewehadap-IpGended"*0x\@@whenwe rstcalled\@xexpast.EInotherwords:/iftheuserinsertsI*{0}{..}UUinhispreamble,L5ffA͉TU>'ExXignorestherestofit.10 zsoI64t\let\@tempb\@xexpast\else I65t\let\@tempb\@xexnoop\fiINowwewillmakesurethatthepartoftheuserpreamble,hwhichwasalreadydealt Iwith,UUwillbGesavedUUagainin\@tempa.I66ap\def\the@toksz{\the\toks@}\def\the@toks{\the\@temptokena}%I67ap\edef\@tempa{\@tempa}%IW*ehavenowevqaluatedthe rst{expression,andtheuserpreambleuptothis IpGointwissavedin\@tempa..W*ewillputthecontentsof\@tempaandtherestofItheeuserpreambletogetherandworkontheresultwith\@tempb.ThismacroIeithercorrespGondsto\@xexpast,sothatthenext{expressionishandled,ortoItheUUmacro\@xexnoop,whichonlyendstherecursionbydeletingitsargument.I68ap\expandafter\@tempb\@tempa#4\@@}$\@xexnoopISoݡthe rstbigproblemissolved. NowݡitiseasytospGecify\@xexnoop.ItsIargumentUUisdelimitedby\@@anditsimplyexpandstonothing.I69S% s,\def\@xexnoop#1\@@{}!čI5aLTheffinsertionofdeclarations(2߆Tff cmtt12>,<,!,@)IThepreamblewillbGeenlargedwiththehelpof\xdef,buttheargumentsof>,I<,A!and@arenotsuppGosedtobeexpandedduringtheconstruction(wewantIanimplementationthatdoGesn'tneeda\protect).Sowehaveto ndawaytoIinhibitUUtheexpansionofthosearguments.XW*ewillsolvethisproblemwithtokenregisters.S7W*eneedoneregisterforeveryI!ӓand@,"whileweneedtwoforevery c,"l,r,m,pӓorb.ThislimitsthenumbGerIofcolumnsofatablebGecausethereareonly256tokenregisters.ՆButthen,whoIneedsUUtableswithmorethan100columns?XOnecouldalso ndasolutionwhichonlyneedstwoorthreetokenregistersbyIproGceedingssimilarlyasinthemacro\@xexpast(seepage10).3TheadvqantageofIourapproachisthefactthatweavoidsomeoftheproblemsthatarisewiththeIotherUUmethoGd^3|s.XSo}howdoweproGceed?>Letusassumethatwehad!{foo}intheIuserƢpreambleandsaywesavedfoointokenregister5.ŮThenwecallI\@addtopreamble{\the@toks5}where\the@toksisde nedinawaythatitdoGesInothexpand(forexampleitcouldbGeequivqalentto\relax).EveryfollowingcallIofF\@addtopreambleleavesF\the@toks5unchangedin\@preamble.EDIfthecon-Istruction^ofthepreambleiscompletedwechangethede nitionof\the@tokstoI\the\toksandexpand\@preambleforthelasttime.DuringthisproGcessallIpartsoftheform\the@tokshNumb}'eri.SwillbGesubstitutedbythecontentsoftheIrespGectiveUUtokenregisters.XAswecanseefromthisinformaldiscussiontheconstructionofthepreambleIhastotakeplacewithinagroup,sothatthetokenregistersweusewillbGefreedIlateron.\F*orthatreasonwekeepallassignmentsto\@preambleglobal;+thereforeIthe(replacementtextofthismacrowillremainthesameafterweleavethegroup.3P\count@IW*efurtherneedacountregistertoremembGerwhichtokenregisteristobGeusedInext.اThiswwillbGeinitializedwith1ifwewanttobGeginwiththetokenregisterIX-ffr J= "5-:3LMaÎyb'ExXscratchregister\count@bGecauseeverythingtakesplace IloGcally*.>Allwehavetodoisinsert\the@toks\the\count@intothepream-Ible.$\the@toksɲwillremainunchangedand\the\count@expandsintothesavedInumbGer.\prepnext@tokIThemacro\prepnext@tokisinchargeofpreparingthenexttokenregister.!F*orIthatUUpurpGoseweincrease\count@by1:I70S\def\prepnext@tok{\advance\count@\@neIThenUUweloGcallydeleteanycontentsthetokenregistermighthave.I71ap\toks\count@{}}\save@declIDuringtheconstructionofthepreamblethecurrenttokenisalwayssavedinthe Imacrot\@nextchar(seethede nitionof\@mkpreamonpage13). $ThemacroI\save@declUUsavesitintothenextfreetokenregister,i.e.in\toks\count@.I72S\def\save@decl{\toks\count@\expandafter{\@nextchar}}ITheT'ExXexpands\the\toks2 rstinor-Iderto ndoutifthedigit1isfollowedbyotherdigits.R\E.g.a5savedinthetokenIregisterT2wouldleadTU>'ExXtoinsertthecontentsof\qtokenregister15insteadof1IlaterUUon.XTheexampleabGovereferredtoanolderversionof\save@declwhichinsertedaI\relexinsidethetokenregister.7ThisisnowmovedtotheplaceswheretheactualItokenregistersareinserted(loGokfor\the@toks)becausetheoldversionwouldIstillGmake@expressionstomovingargumentssinceafterexpandingthesecondIregisterowhileloGokingfortheendofthenumberothecontentsoofthetokenregisterIisaddedsothatlateronthewholeregisterwillbGeexpanded.WThisseriousbugIwas7foundafternearlytwoyearsinternationaluseofthispackqagebyJohannesIBraams.XHoweJdoGesthesituationlooklike,GifwewanttoaddanothercolumntotheIpreamble,i.e.ifwehavefoundac,l,r,p,morbintheuserpreamble?eInthisIcasewehavetheproblemofthetokenregisterfrom>{..}and<{..}havingtoIbGeinsertedatthismomentbecauseformatinginstructionslike\hfilhavetobGeIset aroundthem.`UOntheotherhanditisnotknownyet,+wifany<{..}instructionIwillUUappGearintheuserpreambleatall.XW*e[|solvethisproblembyaddingtwotokenregistersatatime.=Thisexplains,IwhyUUwehavefreedthetokenregistersin\prepnext@tok. 6\insert@column3P\@sharpIW*eUUnowde nethemacro\insert@columnwhichwilldothisworkforus.I73S\def\insert@column{%IHere,wen}assumethatthecountregister\@tempcntahassavedthevqalue\count@'I1.I74ap\the@toks\the\@tempcntaINext#followsthe#signwhichspGeci estheplacewherethetextofthecolumnshallIbGeinserted.ZT*oavoiderrorsduringtheexpansionsin\@addtopreamblewehideIthisasigninthecommand\@sharpwhichistempGorarilyoccupiedwith\relaxIduringthebuild-upofthepreamble.RT*oremoveunwantedspacesbGeforeandafterItheUUcolumntext,wesetan\ignorespacesinfrontanda\unskipafterwards.I75ap\ignorespaces\@sharp\unskip12 TsoIThenthesecondtokenregisterfollowswhosenumbGershouldbesavedin\count@. IW*eKmakesurethattherewillbGenofurtherexpansionafterreadingthenumbGer,Iby8 nishingwith\relax. pThecaseabGoveisnotcriticalsinceitisendedbyI\ignorespaces.I76ap\the@toks\the\count@\relax}6I5.1gTheseparationofcolumnsuTy\@addampIIng8thepreamblea&hastobGeinsertedbetweeng8anytwocolumns;p)bGeforethe rstIcolumn@thereshouldnotbGea&.TAstheuserpreamblemaystartwitha|wehaveItoremembGersomehowifwehavealreadyinserteda#(i.e.acolumn).AThisisdoneIwith?thebGoolean?vqariable\if@firstampthatwetestin\@addamp,themacrothatIinsertsUUthe&.I77S%X\newif\@iffirstamp I78S%X\def\@addamp{\if@firstamp\@firstampfalseI79S%PR\else\@addtopreamble&\fi}"\@acol \@acolampacol y\col@sepIW*e)willnowde nesomeabbreviationsfortheextensions,appGearingmostoften Iinthepreamblebuild-up.Here\col@sepisadimenregisterwhichissetequiv-Ialent#to\arraycolsepinanarray#{environment,otherwiseitissetequivqalenttoI\tabcolsep.I80S\newdimen\col@sep I81S\def\@acol{\@addtopreamble{\hskip\col@sep}}I82S%X\def\@acolampacol{\@acol\@addamp\@acol}6I5.2gThemacron@mkpreamuT$\@mkpream $\the@toksINowvwecande nethemacrowhichbuildsupthepreambleforthe\halign.B}First IweYinitialize\@preamble,\@lastchclassandthebGooleanYvqariable\if@firstamp.I83S\def\@mkpream#1{\gdef\@preamble{}\@lastchclass4\@firstamptrueIDuringRthebuild-upofthepreamblewecannotdirectlyusethe#sign;*thiswouldIlead#toanerrormessageinthenext\@addtopreamblecall.s1Instead,weusetheIcommand6\@sharpatplaceswherelatera#willbGe.Thiscommandisat rstIgiventhemeaning\relax;ZthereforeitwillnotbGeexpandedwhenthepreambleIisUVextended.qInthemacro\@array,VshortlybGeforethe\haligniscarriedout,I\@sharpUUisgivenits nalmeaning.XInasimilarway*,>owedealwiththecommands\@startpboxand\@endpbox,Ialthoughlthereasonisdi erenthere:thesemacrosexpandinmanyetokenswhichIwouldUUdelaythebuild-upofthepreamble.I84ap\let\@sharp\relax\let\@startpbox\relax\let\@endpbox\relaxINowuweremovepGossible-formsintheuserpreamblewiththecommandI\@xexpast.qAswealreadyknow,thiscommandsavesitsresultinthemacroI\@tempa.I85ap\@xexpast#1*0x\@@IAfterwards1weinitializeallregistersandmacros,8thatweneedforthebuild-upofItheNpreamble.6Sincewewanttostartwiththetokenregister0, \count@hastoIcontainUUthevqalue1.I86ap\count@\m@ne I87ap\let\the@toks\relax13/soIThenUUwecallup\prepnext@tokinordertopreparethetokenregister0foruse.I88ap\prepnext@tokIT*oevqaluatetheuserpreamble(withoutstars)savedin\@tempaweusetheL5ffA͉TU>'ExX{ ImacroU\@tfor.RThestrangeappGearingconstructionwith\expandafterisbasedIonthefactthatwehavetoputthereplacementtextof\@tempaandnotthemacroI\@tempaUUtothisL5ffA͉TU>'ExX{macro.I89ap\expandafter\@tfor\expandafter\@nextchar I90f\expandafter:\expandafter=\@tempa\doIThebGodyofthisloop(thegroupafterthe\do)isexecutedforonetokenatatime,Iwhereasthecurrenttokenissavedin\@nextchar.@At rstweevqaluatethecurrentItokenPwiththealreadyde nedmacro\@testpach,i.e.weassignto\@chclasstheIcharacterUUclassandto\@chnumthecharacternumbGerofthistoken.I91ap{\@testpachIThen%webranchoutdepGendingonthevqalueof\@chclassintodi erentmacrosIthatUUextendthepreamblerespGectively*.I92ap\ifcase\@chclass\@classz\or\@classi\or\@classii I93kJ\or\save@decl\or\or\@classv\or\@classviI94kJ\or\@classvii\or\@classviii s,\or\@classixI95kJ\or\@classx\fiITwocasesdeserveourspGecialattention:{=Sincethecurrenttokencannothave Ithecharacterclass4(start)wehaveskippGedthispossibility*.`IfthecharacterIclassis3,Jonlythecontentof\@nextcharhastobGesavedintothecurrenttokenIregister;stherefore|wecallup\save@decldirectlyandsaveamacroname.AfterItheJpreamblehasbGeenextendedweassignthevqalueof\@chclasstothecounterI\@lastchclassltoassurethatthisinformationwillbGeavqailableduringthenextIrunUUoftheloGop.I96ap\@lastchclass\@chclass}%IAftertheloGophasbeen nishedspacemuststillbeaddedtothecreatedpreamble,IdepGending<{..}theremustalwaysfollowac,sl,r,p,mIorUUb.qW*erepGortanerrorandignorethedeclarationgivenby{..}.E101ap\@preamerr\thr@@\orIIfr?\@lastchclassis4theuserpreamblehasbGeenempty*.ȅTor?continue,yzweinsertIaUU#inthepreamble.E102ap\@preamerr\tw@\@addtopreamble\@sharp\or14'soIClass5isallowedagain.AInthiscase(theuserpreambleendswith@{..})weneed InotUUdoanything. 鍍E103ap\or鍑IAnyƸothercasemeansthattheargumentsto@,#!,<,>,p,mƸorbhavebGeenIforgotten.qSoUUwerepGortanerrorandignorethelasttoken.E104ap\else s,\@preamerr\@ne\fi鍑INow9thatthebuild-upofthepreambleisalmost nishedwecaninserttheto-Ikenߒregistersandthereforerede ne\the@toks.~Theactualinsertion,!though,isIpGerformedUUlater.E105ap\def\the@toks{\the\toks}} I6aLTheffmacros3Ɍ ff cmbsy10n@classzton@classxIThe`preambleisextendedbythemacros\@classzto\@classxwhicharecalledIby\@mkpreamdepGendingon\@lastchclass(i.e.# thecharacterclassofthelastItoken).[эy\@classxIFirstQwede ne\@classxbGecauseofitsimportantr^ole.p[Whenitiscalledwe ndIthatUUthecurrenttokenisp,morb.qThatmeansthatanewcolumnhastostart.E106S\def\@classx{%鍑IDepGendingUUonthevqalueof\@lastchclassdi erentactionsmusttakeplace:E107]\ifcase\@lastchclassIIf`thelastcharacterclasswas0weseparatethecolumnsby\hskip\col@sep IfollowedUUby&andanother\hskip\col@sep.E108]\@acolampacol\orIIfthelastclasswasclass1|thatmeansthataverticallinewasdrawn,| IbGefore>thislinea\hskip\col@sepwasinserted.jIThereforetherehastobeonlyaI&Q^followedby\hskip\col@sep.puButthis&maybGeinsertedonlyifthisisnottheI rstUUcolumn.qThisproGcessiscontrolledby\if@firstampinthemacro\addamp.E109]\@addamp\@acol\or鍑IClassUU2istreatedlikeclass0bGecause<{...}canonlyfollowafterclass0.E110]\@acolampacol\orIClass6%3requiresnoactionsbGecauseallthingsnecessaryhave6%beendonebythe IpreambleUUtoken>.E111]\orIClasso4meansthatweareatthebGeginningofthepreamble.kThereforewestart Ithe6preamblewith\hskip\col@sepandthencall\@firstampfalse.gThismakesIsureUUthatalater\@addampinsertsthecharacter&intothepreamble.E112]\@acol\@firstampfalse\or鍑IF*orclass5tokensonlythecharacter&isinsertedasacolumnseparator.4ThereforeIweUUcall\@addamp.E113]\@addamp鍑IOther|casesareimpGossible.`F*oranexample\@lastchclassMow=6|asitmightIappGear]inapreambleoftheform...!p...|pwouldhavebGeentakenasanIargumentUUofr!by\@testpach.E114]\fi}154soy\@classzIIfRthecharacterclassofthelasttokenis0wehavec,SGl,rRòoranargumentofm,SGb Iorp.Inthe rstthreecasesthepreamblemustbGeextendedthesamewayasifIwe6hadclass10.(lTheremainingtwocasesdonotrequireanyactionbGecausetheIspaceneededwasgeneratedbythelasttoken(i.e.m,borp).7NSince\@lastchclassIhas8thevqalue10atthispGointnothinghappenswhen\@classxiscalled.|oSotheImacroUU\@chlasszmaystartlikethis: I%E115S\def\@classz{\@classxI%IAccordingtothede nitionof\insert@columnwemuststorethenumbGeroftheItokena.registerinwhichapreceding>{..}mighthavestoreditsargumentintoI\@tempcnta.E116ap\@tempcnta\count@I%IT*oUUhave\count@*X=\@tmpcnta4?ݲ+81wepreparethenexttokenregister.E117ap\prepnext@tokINowthepreamblemustbGeextendedwiththecolumnwhoseformatcanbedeter- IminatedUUby\@chnum.E118ap\@addtopreamble{\ifcase\@chnumIIf‚\@chnumhasthevqalue0acenteredcolumnhastobGegenerated.MSowebGegin IwithUUstretchablespace.E119p2\hfilIThe-command\d@llarbeginfollowsexpandinginto\begingroup(inthetab- Iular#{environment)=orinto$.yDoingthis(providedanappropriatesettingIof\d@llarbegin)weachievethatthecontentsofthecolumnsofanarray#{IenvironmentaresetinmathmoGdewhilethoseofatabular#{environmentaresetinILRUUmoGde.E120p2\d@llarbeginI%INowweinsertthecontentsofthetwotokenregistersandthesymbGolfortheIcolumnUUentry(i.e.#ormoreprecise\@sharp)using\insert@column.E121p2\insert@columnI%IW*evendthiscasewith\d@llarendand\hfilwhere\d@llarendagainiseitherI$UUor\endgroup.E122p2\d@llarend\hfil\orI%IThe~templatesforlandr(i.e.\@chnum1or2)aregeneratedthesameway*.LSinceIoneDx\hfilismissingthetextismovedDxtotherelevqantside.The\kern\z@isneededIinHcaseofanemptycolumnentry*.LOtherwisethe\unskipin\insert@columnIremovesuthe\hfil. ҝChangedto\hskip1spsothatitinteractsbGetterwithI\@bsphack.E123p2\hskip1sp\d@llarbegin\insert@column\d@llarend\hfil\or E124p2\hfil\hskip1sp\d@llarbegin\insert@column\d@llarend\orI%IThedtemplatesforp,gmandbmainlyconsistofabGox.Incaseof+1mitisgeneratedIby\vcenter.pThiscommandisallowedonlyinmathmoGde.pThereforewestartIwithUUa$.E125ap$\vcenterI%IThe partofthetemplateswhichisthesameinallthreecases(p,{mandb)isbuiltIbyTthemacros\@startpboxand\@endpbox. T\@startpboxhasanargument:Ithewidthofthecolumnwhichisstoredinthecurrenttoken(i.e.\@nextchar).IBetweenUUthesetwoUUmacroswe ndthewellknown\insert@column.E126ap\@startpbox{\@nextchar}\insert@column\@endpbox$\or16ѶsoITheWtemplatesforpandbaregeneratedinthesamewayWthoughwedonotneed ItheUU$charactersbGecauseweuse\vtopor\vbox. E127ap\vtop\@startpbox{\@nextchar}\insert@column\@endpbox\or E128ap\vbox\@startpbox{\@nextchar}\insert@column\@endpboxIOthervqaluesfor\@chnumareimpGossible.ThereforeweendtheargumentstoI\@addtopreamble28and\ifcase.fBeforewecometotheendof\@classzwehaveItoUUpreparethenexttokenregister.E129]\fi}\prepnext@tok}Y$\@classixIIncaseofclass9(>{token)we rstcheckifthecharacterclassofthelasttokenIwas3.RInthiscasewehaveauserpreambleoftheform..>{...}>{...}..whichIisjnotallowed.8W*ejonlygiveanerrormessageandcontinue.8SothedeclarationsIde nedUUbythe rst>{...}areignored.E130S\def\@classix{\ifnum\@lastchclass=\thr@@ E131t\@preamerr\thr@@\fiIF*urthermore,+twecallup\@class10bGecauseafterwardsalwaysanewcolumnisIstartedUUbyxc,l,r,p,morb.E132t\@classx}Y L\@classviiiIIf#2thecurrenttokenisa\z@ E134p2\@preamerr4\@chclass6\@classvi\fi}Y L\@arrayruleIThereWisonlyoneincompatibilitywiththeoriginalde nition:v}thede nitionofI\@arrayrule.Intheoriginalalinewithoutwidth^4 kiscreatedbymultiplein-Isertions!of\hskip?.5\arrayrulewidth.)W*eonlyinsertaverticallineintotheIpreamble.nThiscisdonetopreventproblemswithTU>'ExX'smainmemorywhengen-IeratingUUtableswithmanyverticallinesinthem(espGeciallyinthecaseofr oats).E135S\def\@arrayrule{\@addtopreamble\vline}Y\@classviiIAs$aconsequenceitfollowsthatincaseofclass7(@token)thepreambleneedInotHtobGeextended.9Intheoriginalde nition\@lastchclassKx=W1istreatedbyIinsertingZ\hskip?.5\arrayrulewidth.1W*eonlycheckZifthelasttokenwasofclassI3UUwhichisforbidden.E136S\def\@classvii{\ifnum\@lastchclass=\thr@@IIfthisistrueweoutputanerrormessageandignorethedeclarationsstoredbyItheUUlast>{...},bGecausetheseareoverwrittenUUbytheargumentofr@.E137ap\@preamerr\thr@@\fi}Y$\@classviIIfOthecurrenttokenisaregular!andthelastclasswas0or2weextendtheIpreamblewith\hskip\col@sep.SIfthelasttokenwasofclass1(forinstance|)Iwe%extendwith\hskip?\doublerulesepbGecausetheconstruction!{...}hastoIbGeUUtreatedlike|.E138S\def\@classvi{\ifcase\@lastchclass E139p2\@acol\orIffr J= "5-:4LSoXthespaceb{..}!. Iisnotallowed.ZT*osavememorywecall\@classviiinsteadwhichalsodoGeswhatIweUUwant. ffE142p2\@classviiIIf-\@lastchclassis4or5nothinghastobGedone.VClass6to10arenotpossible.ISoUUwe nishthemacro. ffE143p2\fi}33$\@classii\@classiiiIIn.thecaseofcharacterclasses2and3(i.e.theargumentof)weonlyhaveItostorethecurrenttoken(\@nextchar)intothecorrespGonding\tokenregistersinceItheWpreparationandinsertionoftheseregistersaredonebythemacro\@classz.IThisIisequivqalenttocalling\save@declinthecaseofclass3.mT*osavecommandIidenti ersUUwedothiscallupinthemacro\@mkpream.XClass2exhibitsamorecomplicatedsituation:8thetokenregistershavealreadyIbGeenRinsertedby\@classz.JSothevqalueof\count@istoohighbyone.JThereforeIweUUdecrease\count@by1.E144S\def\@classii{\advance\count@\m@neffINext#westorethecurrenttokenintothecorrecttokenregisterbycallingI\save@declfandthenincreasethevqalueof\count@again.IAtthispGointwecanIsavememoryoncemore(atthecostoftime)ifweusethemacro\prepnext@tok.E145ap\save@decl\prepnext@tok}33y\@classvIIfthecurrenttokenisofclass5thenitisanargumentofa@token.EItmustbGeIstoredUUintoatokenregister.E146S\def\@classv{\save@declffIW*eqextendthepreamblewithacommandwhichinsertsthistokenregisterintotheIpreamblewhenitsconstructionis nished.ZTheuserexpGectsthatthisargumentIis)workedoutinmathmoGdeifitwasusedinanarray#{environment.cThereforeweIsurroundUUitwith\d@llar...'s.E147ap\@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}%ffIFinallyUUwemustpreparethenexttokenregister.E148ap\prepnext@tok}33y\@classiIIn|thecaseofclass0wewereabletogeneratethenecessaryspacebGetweencolumnsIbyWusingthemacro\@classx.\rAnalogouslythemacro\@classvicanbGeusedforIclassUU1.E149S\def\@classi{\@classviffIDepGendingUUon\@chnumaverticallineE150ap\ifcase\@chnum\@arrayrule\orIor6 (incaseof!{...})thecurrenttoken|storedin\@nextchar|hastobGe IinsertedUUintothepreamble.qThiscorrespGondstocalling\@classv.E151p2\@classv\fi}33 L\@startpboxIIn\@classzthemacro\@startpboxisused.iEThewidthoftheparbGoxԲispassedIasanargument.\vcenter,\vtopor\vboxarealreadyinthepreamble.SoweIstartUUwiththebracesforthewantedUUbGox.E152S\def\@startpbox#1{\bgroup18soIThe)argumentisthewidthofthebGox.ThisinformationhastobGeassignedto I\hsize.qThenUUweassaindefaultvqaluestoseveralparametersusedinaparbGox. E153]\hsize#1\@arrayparboxrestoreIOurNmainproblemistoobtainthesamedistancebGetweenNsucceedinglinesoftheIparbGox.D W*ekhavetoremembGerthatthedistancebetweentwoparbGoxesshouldbGeIde nedby\@arstrut.ThatmeansthatitcanbGegreaterthanthedistanceinaIparbGox.R1Thereforeitisnotenoughtoseta\@arstrutatthebeginningandattheIend{oftheparbGox.p9This{woulddimensionthedistancebGetween rstandsecondIlineAandthedistancebGetweenAthetwoAlastlinesoftheparboxAwrongly*.VTopreventIthiswesetaninvisibleruleofheight\@arstrutboxatthebGeginningoftheparbGox.IThishasnoe ectonthedepthofthe rstline.9:AttheendoftheparbGoxwesetIanalogouslyZanotherinvisiblerulewhichonlya ectsthedepthofthelastline.ItIisnecessarytowaitinsertingthisstrutuntiltheparagraphactuallystartstoallowIforUUthingslike\parindentchangesvia>{...}.E154ap\everypar{% E155p2\vrule\@height\ht\@arstrutbox\@width\z@E156p2\everypar{}}%E157ap}΍$\@endpboxIIfthereareanydeclarationsde nedby>{...}and<{...}theynowfollowin Ithesmacro\@classz|thecontentssofthecolumninbGetween.SosthemacroI\@endpboxIJmustinsertthespGecialstrutmentionedearlierandthenclosethegroupIopGenedUUby\@startpbox.E158S\def\@endpbox{\@finalstrut\@arstrutbox\egroup\hfil} ͯI7aLBuildingffandcallingnhalign3P\@arrayIAfterwehavediscussedthemacrosneededfortheevqaluationoftheuserpreambleIweCcande nethemacro\@arraywhichusesthesemacrostocreatea\halign.IIthastwoarguments.6%The rstoneisapGositionargumentwhichcanbGet,'borIc;UUthesecondonedescribGesthewantedUUpreamble,e.g.ithastheform|c|c|c|.E159S\def\@array[#1]#2{%IFirstwede neastrutwhosesizebasicallycorrespGondstoanormalstrutmulti-Ipliedbythefactor\arraystretch.[ThisstrutistheninsertedintoeveryrowandIenforcesbaminimaldistancebGetweenbtworows.Nevertheless,whenusinghori-Izontallines,klargeletters(likeaccentedcapitalletters)stillcollidewithsuchlines.IThereforeat rstweaddtotheheightofanormalstrutthevqalueoftheparameterI\extrarowheight.E160]\@tempdima\ht\strutbox E161]\advance\@tempdimaby\extrarowheightE162]\setbox\@arstrutbox\hbox{\vruleE163L\@height\arraystretch\@tempdimaE164L\@depth\arraystretch\dp\strutboxE165L\@width\z@}%IThenwweopGenagroup,\inwhichtheuserpreambleisevqaluatedbythemacro I\@mkpream.TAsweknowthismusthappGenlocally*.TThismacrocreatesapreambleIforUUa\halignandsavesUUitsresultgloballyinthecontrolsequence\@preamble.E166]\begingroup E167]\@mkpream{#2}%19WsoIW*eWagainrede ne\@preamblesothatacallupof\@preamblenowstartsthe I\halign.vThusalsotheargumentsof>,Չ<,@and!,ՉsavedinthetokenregistersIarebinsertedintothepreamble.The\tabskipatthebGeginningandendoftheIpreambleissetto0pt(inthebGeginningbytheuseof\ialign)..NAlsothecommandI\@arstrut(isbuildin,1whichinsertsthe\@arstrutbox,de nedabGove.UcOf(course,IthelopGeningbraceafter\ialignhastobeimplicitasitwillbeclosedin\endarrayIorUUanothermacro.E168]\xdef\@preamble{\ialign\@halignto E169:\bgroup\@arstrut\@preambleE170΃\tabskip\z@\cr}%IWhatgbwehavenotexplainedyetisthemacro\@haligntothatwasjustused. IDepGending{onitsreplacementtextthe\halignbecomesa\haligntohdimenci&۲.INowweclosethegroupagain.Thus\@startpboxand\@endpboxaswellasallItokenUUregistersgettheirformermeaningback.E171]\endgroupIT*osuppGortthedelarray.stypackqageweincludeahoGokintothispartofthecoGdeIwhichUUisano-opinthemainpackqage.E172]\@arrayleftINowwedecidedepGendingonthepositionargumentinwhichbGoxthe\halignisItoUUbGeput.q(\vcentermaybeusedbecauseweareinmathmode.)E173]\if#1t\vtop\else\if#1b\vbox\else\vcenter\fi\fiINowCanotherimplicitopGeningbraceappears;P;thende nitionswhichshallstayIloGcalfollow.Whileconstructingthe\@preamblein\@mkpreamthe#signmustIbGeKhiddeninthemacro\@sharpwhichis\letto\relaxatthatmoment(seeIde nitionUUof\@mkpreamonpage13).qAllthesenowgettheiractualmeaning.E174]\bgroup E175]\let\@sharp##\let\protect\relaxIWiththeabGovede nedstrutswe xdownthedistancebGetweenrowsbysettingI\lineskip`and\baselineskipto0pt.8 Sincetherehave`tobGeset$'saroundeveryIcolumn}inthearray#{environment}theparameter\mathsurroundshouldalsobGesetItos30pt.aThispreventss3additionalspacebGetweens3therows.ThePlainTU>'ExX{macroI\m@thUUdoGesthis.E176]\lineskip\z@ E177]\baselineskip\z@E178]\m@thIBeside,iwe2dhavetoassignaspGecialmeaning(whichwestillhavetospGecify)to Ithe`lineseparator\\.W*ealsohave`torede nethecommand\parinsuchawayIthatemptylinesin\haligncannotdoanydamage.oW*esucceedindoingsobyIchoGosing-gsomethingthatwilldisappearwhenexpanding.dxAfterthatweonlyhaveItoUUcallup\@preambletostartthewantedUU\halign.E179]\let\\\@arraycr\let\tabularnewline\\\let\par\@empty\@preamble}f\extrarowheightIThedimenparameterusedabGovealsoneedstobeallocated.AsadefaultvqalueIweUUuse0pt,toensurecompatibilitywithstandardL5ffA͉TU>'ExX.E180S\newdimen\extrarowheight E181S\extrarowheight=0pt20 cso$\@arstrutINowtheinsertionof\@arstrutboxthrough\@arstutiseasysinceweknowex- IactlyUUinwhichmoGdeTU>'ExXiswhileworkingonthe\halignpreamble. 捍E182S\def\@arstrut{\unhcopy\@arstrutbox} I8aLThefflineseparatornn$\@arraycrIInxthemacro\@arraythelineseparator\\is\lettothecommand\@arraycr.IItsede nitionstartswithaspGecialbracewhichIezhavedirectlycopiedfromtheIoriginalde nition.EItisnecessary*,bGecausethe\futurletin\@ifnextcharmightIexpandA%afollowing&tokeninaconstructionlike\\?&.k ThiswouldotherwiseendIthealignmenttemplateatawrongtime.QOntheotherhandwehavetobGecarefulItoavoidproGducingarealgroup,0i.e.{},bGecausethecommandwillalsobeusedIforYthearrayenvironment,i.e.inmathmoGde.~Inthatcaseanextra{}wouldIproGduceIanordatomwhichcouldmessupthespacing.F*orthisreasonweuseaIcombinationͩthatdoGesnotrealyproduceagroupatallbutmodi esthemasterIcounterasothata&willnotbGeconsideredbelongingtothecurrent\halingwhileIweUUareloGokingfora*or[.qF*orfurtherinformationsee[2,AppendixD].E183S\def\@arraycr{\relax\iffalse{\fi\ifnum0=`}\fi捑IThen0wetestwhethertheuserisusingthestarformandignoreapGossiblestar(IIalsoUUdisagreewiththisproGcedure,becauseastardoesnotmakeanysensehere).E184]\@ifstar\@xarraycr\@xarraycr}\@xarraycrIInUUthecommand\@xarraycrwetestifanoptionalargumentexists.E185S\def\@xarraycr{\@ifnextchar[%捑IIf5itdoGes,;webranchoutintothemacro\@argarraycrifnotweclosethespGecialIbraceUU(mentionedabGove)andendtherowofthe\halignwitha\cr.E186]\@argarraycr{\ifnum0=`{}\fi\cr}}b\@argarraycrIIfadditionalspaceisrequestedbytheuserthiscaseistreatedinthemacroI\@argarraycr.gFirst6weclosethespGecialbraceandthenwetestiftheadditionalIspaceUUispGositive.E187S\def\@argarraycr[#1]{\ifnum0=`{}\fi\ifdim#1>\z@捑IIfZthisisthecasewecreateaninvisibleverticalrulewithdepth\dp\@arstutbox+Ihwante}'dspace[i~ղ.AThus;weachievethatallverticallinesspGeci edintheuserpream-IbleUUbya|arenowgenerallydrawn.qThentherowendswitha\cr.XIfmthespaceisnegativeweendtherowatoncewitha\crandmovebackupIwithUUa\vskip.XWhiletestingthesemacrosIfoundoutthatthe\endtemplatecreatedby\crIand&issomethinglikean\outerprimitiveandthereforeitshouldnotappGearinIincomplete\ifstatements.ThusthefollowingsolutionwaschosenwhichhidesItheUU\crinothermacroswhenTU>'ExXisskippingconditionaltext.E188]\expandafter\@xargarraycr\else E189]\expandafter\@yargarraycr\fi{#1}}\@xargarraycr\@yargarraycrITheUUfollowingmacroswerealreadyexplainedabGove.E190S\def\@xargarraycr#1{\unskip E191]\@tempdima#1\advance\@tempdima\dp\@arstrutboxE192]\vrule\@depth\@tempdima\@width\z@\cr}E193S\def\@yargarraycr#1{\cr\noalign{\vskip#1}}21 soI9aLSpanningffseveralcolumnsb\multicolumnIIfAseveralcolumnsshouldbGeheldtogetherwithaspecialformatthecommand I\multicolumn;mustbGeused.7xIthasthreearguments:thenumbGerofcolumnstoIbGeUUcovered;theformatfortheresultcolumnandtheactualcolumnentry*.E194S\def\multicolumn#1#2#3{%IFirstswecombinethegivennumbGerofcolumnsintoasingleone;thenwestartaInewUUbloGcksothatthefollowingde nitioniskeptloGcal.E195ap\multispan{#1}\begingroupISinceZa\multicolumnshouldonlydescribGetheformatofaresultcolumn,weIrede ner@\@addampinsuchawaythatonegetsanerrormessageifoneusesmoreIthanENonec,Hl,r,p,mENorbinthesecondargument.loOneshouldconsiderthatthisIde nitionmisloGcaltothebuild-upofthepreamble;anarray#{ortabular#{environmentIinC;thethirdargumentofthe\multicolumnisthereforeworkedthroughcorrectlyIasUUwell.E196ap\def\@addamp{\if@firstamp\@firstampfalse\else E197D\@preamerr5\fi}%IThenLweevqaluatethesecondargumentwiththehelpof\@mkpream.nNowwestillIhave0toinsertthecontents0ofthetokenregisterintothe\@preamble,8i.e.wehaveItoUUsay\xdef\@preamble{\@preamble}.qThisisachievedshorterbywriting:E198ap\@mkpream{#2}\@addtopreamble\@emptyIAfterD%the\@preambleiscreatedweforgetallloGcalde nitionsandoccupationsofItheUUtokenregisters.E199ap\endgroupIInBthespGecialsituationof\multicolumn\@preambleisnotneededaspreambleIfora\halignbutitisdirectlyinsertedintoourtable.Thusinsteadof\sharpIthereUUhastobGethecolumnentry(#3)wantedbytheuser.E200ap\def\@sharp{#3}%INowwecanpassthe\@preambletoTU>'ExX.;F*orsafetywestartwithan\@arstrut.IThislshouldusuallybGeinthetemplateforthe rstcolumnhoweverlwedonotknowIifthistemplatewasoverwrittenbyour\multicolumn./W*ealsoadda\nullattheIright\@tempdtokenignored\ory*%3E233f<\@tempdchangedto!{..}\orLh%4E234fOnlyonecolumn-spec.allowed.\fi}\@ehc}K`%5!čI12ifdDe ningffyourowncolumnsps3eci ers=5\newcolumnIInmnewarray.stythemacroforspGecifyingnewcolumnswasnamed\newcolumn.IWhenBthefunctionalitywasaddedtoarray.stythecommandwasrenamedI\newcolumntype.^InitiallybGothnamesweresupported,"butnow(InversionsofIthisUUpackqagedistributedforL5ffA͉TU>'ExX2 b> cmmi10"()theoldnameisnotde ned.E235Shncolsi 6\newcolumntypeIAs%describGedabove,the%\newcolumntypemacrogivesusersthechancetode neIletters,UUtobGeusedinthesamewayUUastheprimitivecolumnspeci ers,`c'`p'etc.E236S7'ExXmayIbGeEused.0Thistrickwasstolenfromarray.sty2.0h.0NotethatweneedtouseIthe{ipGossiblyactivetoken,#1,in{iseveralplaces,asthatisthetokenthatactuallyIappGearsUUinthepreambleargument.E237]\edef\NC@char{\string#1}%IFirst wecheckwhetherthereisalreadyade nitionforthiscolumn. FUnlikeI\newcommandRwegiveawarningratherthananerrorifitisde ned.i|IfitisaInewUUcolumn,add\NC@dohc}'olumnci."5tothelist\NC@list.E238]\@ifundefined{NC@find@\NC@char}% E239f {\@tfor\next:=<>clrmbp@!|\do{\if\noexpand\next\NC@charE240ywf\PackageWarning{array}%Iffffr J= "5-:5LThe7cooftheprimitive\showcommandformacrode nitions.jOAllweneedtodoisIloGcallyrede ne\NC@dototakeitsargument(say`C')ȟandthen\showthe(slightlyImoGdi ed)tde nitionof\NC@rewrite@C.Actuallyasthethelistalwayststartso Iwith\NC@do?*andwedonotwanttoprintthede nitionofthe-form, de neI\NC@dotothrowawaythe rstiteminthelist,andthenrede neitseftoprinttheIrestUUofthede nitions.E260S\def\showcols{{\def\NC@do##1{\let\NC@do\NC@show}\the\NC@list}}y\NC@showIIfUUthecolumn`C'isde nedasabGove,UUthen\show\NC@rewrite@CwouldoutputI\long?macro:->\NC@find>{$}c<{$}.W*e%fwanttostripthelong?macro:->Iandġthe\NC@find.ASo rstweuse\meaningandthenapplythemacro\NC@stripItoUUthetokenssoproGducedandthen\typeouttherequiredstring.E261S\def\NC@show#1{% E262]\typeout{Column#1\expandafter\expandafter\expandafter\NC@stripE263]\expandafter\meaning\csnameNC@rewrite@#1\endcsname\@@}}$\NC@stripIDelimitYtheargumentsto\NC@stripwith`:',`->',aYspace,and\@@topullout ItheUUrequiredpartsoftheoutputfrom\meaning.E264S\def\NC@strip#1:#2->#3#4\@@{#2->#4}y\NC@listIAlloGcateUUthetokenregisterusedfortherewritelist.E265S\newtoks\NC@list6I12.1nThe{formuTIW*eviewthe-formasaslightgeneralisationofthesystemdescribGedinthepre- IviousUUsubsection.qTheideaistode neacolumnbyacommandoftheform:M\newcolumntype{*}[2]{% [X\count@=#1\ifnum\count@>0j\advance\count@by-1#2*{\count@}{#2}\fi}\NC@rewrite@*IThisdoGesnotworkhoweveras\newcolumntypetakesgreatcarenottoexpandIanything7Iinthepreamble,oandsothe\ifisneverexpanded.\newcolumntypeIsetsUUupvqariousotherpartsoftherewritecorrectlythoughsowecande ne:E266S\newcolumntype{*}[2]{}INowDwemustcorrectthede nitionof\NC@rewrite@*.lFThefollowingisprobablyImoreecientthanadirecttranslationoftheideasketchedabGove,\z@E271]\advance\count@\m@neE272]\@temptokena\expandafter{\the\@temptokena#2}%E273]\repeatI\NC@doUUwillensurethat\NC@findis\letequalto\NC@find@*. GǍE274]\NC@find}_I12.2nMo`di cationstointernalmacrosofarray.styuT$\@xexpast $\@xexnoopIThese&macrosareusedtoexpand-formsinarray.sty.b\letthemto\relaxto IsaveUUspace.E275S\let\@xexpast\relax E276S\let\@xexnoop\relaxU\save@declIW*eRdonotassumethatthetokenregisterisfree,weaddthenewdeclarationstotheIfront3oftheregister.8Thisistoallowuserpreamblesoftheform,m>{foo}>{bar}...IUsers5arenotencouragedtoentersuchexpressionsdirectly*,buttheymayresultIfromUUtherewritingof\newcolumntype's.E277S\def\save@decl{\toks\count@=\expandafter\expandafter\expandafter E278L{\expandafter\@nextchar\the\toks\count@}}U$\@mkpreamIThemainmoGdi cationto\@mkpreamistoreplacethecallto\@xexpast(whichIexpandedUU-forms)byaloGopwhichexpandsall\newcolumntypespGeci ers.E279S\def\@mkpream#1{\gdef\@preamble{}\@lastchclass4\@firstamptrue E280as\let\@sharp\relax\let\@startpbox\relax\let\@endpbox\relaxGǍINowE)weremovepGossible-formsanduser-de nedcolumnspeci ersintheuserIpreamblebyrepGeatedlyexecutingthelist\NC@listuntilthere-writeshaveInomoree ect. TheexpandedpreamblewillthenbGeinthetokenregisterI\@temptokena.qActuallyUUweneedtoknowatthispGointthatthisisnot\toks0.E281as\@temptokena{#1}\@tempswatrue E282as\@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}%GǍIAfterwards1weinitializeallregistersandmacros,8thatweneedforthebuild-upofItheUUpreamble.E283as\count@\m@ne E284as\let\the@toks\relaxE285as\prepnext@tokGǍIHavingyexpandedalltokensde nedusing\newcolumntype(including*),weevqal-Iuate/theremainingtokens,6which/aresaved/in\@temptokena.eW*eusetheL5ffA͉TU>'ExX{ImacroUU\@tfortoinspGecteachtokeninturn. GǍE286as\expandafter\@tfor\expandafter\@nextcharE287f \expandafter:\expandafter=\the\@temptokena\doGǍI\@testpatchUUdoGesnottakeanargumentsincearray.sty2.0h.E288as{\@testpachE289as\ifcase\@chclass\@classz\or\@classi\or\@classiiE290kJ\or\save@decl\or\or\@classv\or\@classviE291kJ\or\@classvii\or\@classviii27lҠsoIInUUnewarray.styclass9isequivqalenttoclass10. וE292kJ\or\@classx E293kJ\or\@classx\fiE294as\@lastchclass\@chclass}%E295as\ifcase\@lastchclassE296as\@acol\orE297as\orE298as\@acol\orE299as\@preamerr\thr@@\orE300as\@preamerr\tw@\@addtopreamble\@sharp\orE301as\orE302as\else s.\@preamerr\@ne\fiE303as\def\the@toks{\the\toks}}$\@classixIarray.sty߲doGesnotallowrepeated>declarationsforthesamecolumn.eThisis Iallowedinnewarray.styasdoGcumentedintheintroGduction.'RemovingthetestIforEwthiscasemakesclass9equivqalenttoclass10,Handsothismacroisredundant.IItUUis\letto\relaxtosaveUUspace.E304S\let\@classix\relax L\@classviiiIInnewarray.styexplicitlyallowclass2,GasrepGeated\z@\ifnum\@lastchclass=\tw@\else E306p8\@preamerr4\@chclass6\@classvi\fi\fi}y\@classvIClass`5is@-expressions(andisalsocalledbyclass1)ThismacrowasincorrectinIV*ersionN1.oNowwedonotexpandthe@-expression,P6butinsteadexplicitlyreplaceIan@\extracolsepcommandbyanassignmentto\tabskipbyamethoGdsimilarItoythe\newcolumntypesystemdescribGedabove.P\d@llarbeginy\d@llarendwereIintroGducedUUinV2.01tomatcharray.sty2.0h.E307S\def\@classv{\save@decl E308as\expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@@E309as\@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}%E310as\prepnext@tok}3P\NC@ecsIRewriteithe rstoGccurrenceof\extracolsep{1in}to\tabskip1in\relax.4As Ia5sidee ectdiscardanytokensafterasecond\extracolsep,<0thereisnopGointinItheguserenteringtwoofthesecommandsanyway*,0sothisisnotreallyarestriction.E311S\def\NC@ecs#1\extracolsep#2#3\extracolsep#4\@@@{\def\@tempa{#2}% E312]\ifx\@tempa\@empty\else\toks\count@={#1\tabskip#2\relax#3}\fi}E313Sh=ncolsiiI12.3nSupp`ortforthedelarray.styuTITheldelarray.stypackqageextendsthearraysyntaxbysuppGortingthenotation Iof|delimiters.=T*othisendweextendthearrayparsingmechanismtoincludeaIhoGokfwhichcanbeusedbythis(oranother)packqagetodosomeadditionalparsing.\@tabarrayIThis׳macrotestsforanoptionalbracket׳andthencallsup\@@arrayorI\@@array[c]UU(asdefault).E314Shpack9age#g i E315S\def\@tabarray{\@ifnextchar[{\@@array}{\@@array[c]}}28ysoy\@@arrayIThis0macrotestscouldthentestanoptionaldelimiterbGeforetheleftbraceofthe ImainTpreambleargument.thisrowwecalculate\backup@lengthtobGetheheightplusdepthofaIstandard,Kline.Inadditionwehavetoaddthewidthofthe\hline,bsomethingIthatUUwasforgottenintheoriginalde nition.E325f \global\backup@length\ht\@arstrutbox E326f \global\advance\backup@length\dp\@arstrutboxE327f \global\advance\backup@length\arrayrulewidth+IFinally%wedowanttomaketheheightofthis rstlinebGeabitlargerthanusual, Iforthisweplacethestandardarraystrutintoitbutraisedby\extratabsurroundE328kJ\raise\extratabsurround\copy\@arstrutboxIHaving5doneallthisweendthelineandbackupbythevqalueof\backup@length IandJthen nallyplaceour\hline.n8ThisshouldplacethelineexactlyattherightIplace0XbutkeepthereferencepGointofthewholetabularatthebaselineofthe rstIrow.E329f }\\[-\backup@length]\hline E330S}ց\lasthlineIF*orv\lasthlinethesituationisevenworseandIPgotitcompletelywronginitially*.XThe?probleminthiscaseisthatiftheoptionalargument[b]isusedwedoIwant5thereferencepGointofthetabularbeatthebaselineofthelastrowbutattheIsametimedowantthethedepthofthislastlineincreasedby\extratabsurroundIwithoutUUchangingtheplacement\hline.29=soXW*eUUstartbyplacingtherulefollowedbyaninvisiblerow.E331S\newcommand{\lasthline}{\hline\multicolumn1c{%IW*e&nowcalculate\backup@lengthtobGetheheightanddepthoftwolinesplus ItheUUwidthoftherule.E332f \global\backup@length2\ht\@arstrutbox E333f \global\advance\backup@length2\dp\@arstrutboxE334f \global\advance\backup@length\arrayrulewidthIThisUUwillbringusbacktothebaselineofthesecondlastrow:E335f }\\[-\backup@length]%IThus+ifwenowaddanotherinvisiblerowthereferencepGointofthatrowwillbGe IatǓthebaselineofthelastrow(andwillbGethereferenceforthewholetabular).ISinceUUthisrowisinvisiblewecanenlargeitsdepthbythedesiredamount.E336f \multicolumn1c{% E337t\lower\extratabsurround\copy\@arstrutboxE338t}%E339S}E340Sh=pack9age#g i6I12.5nGettingthespacingaroundrulesrightuTIBeside'nalargerfunctionalityJarray.styhasoneimpGortantdi erencetothestan- Idardvtabularandarrayenvironments:5horizontalvandverticalrulesmakeatableIlargerborwider,fXe.g.,\doublerulesepbreallydenotesthespacebGetweenbtworulesIandUUisn'tmeasuredfromthemiddleoftherules.y\@xhlineIF*orDverticalrulesthisisimplementedbythede nitionsabGove,forhorizontalrulesIweUUhavetotakeoutthebackspace.E341S\CheckCommand*\@xhline{\ifx\reserved@a\hline E342x\vskip\doublerulesepE343x\vskip-\arrayrulewidthE344L\fiE345p2\ifnum0=`{\fi}}E346S\renewcommand*\@xhline{\ifx\reserved@a\hlineE347x\vskip\doublerulesepE348L\fiE349p2\ifnum0=`{\fi}}!čIIndexINumbGerswritteninitalicrefertothepagewherethecorrespondingentryisde- IscribGed,Dthe onesunderlinedtothecodelineofthede nition,DtheresttothecodeIlinesUUwheretheentryisused.X^0mmJSymCbKols(tI\@@57,۵68,69,85,263,264I\@@@L}.΍}.}.}.}.}.}.}.}. 308,T311I\@@array}.΍}.}.}.}. 315,T316Tfe I\@@endpbox@0}.΍}.}.}.}.}.}.225^0ª\@acolP}.΍}.}.}.}.}.80fe ?$,T98, બ100,109,112,બ139,'%141,296,298Ѝª\@acolampacol- }.΍}.}.}.}.બ}.΍}.}.}.}. )N80 )Nfe ?iJ,T108,110^0DAgainplik9eoriginalL5A TuAEXgandTzforcen9tered`parbAox.Fߍ}.΍}.}. 91Iv1.2aXGeneral:Completelynewimple-gmen9tation.}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91Iv1.2bXGeneral:]|doAesnolongergener-gateSaspaceatstartorendofthe0ūpream9ble. qOtherwise``hlineis toAoTlong."}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91 ÍEnlarged. `@arstrutbAo9xby1ptd(T:est-Impl)withdimen`@strutheigh9t.0}.΍}.}.}.}.}.}.}.}.}.}.}.}. 91v1.2cGeneral:sWEnlarged`@arstrutbAo9xby`extraro9wheight.Thusyoumaya9voidhlargec9haracterstoover-prin9tTa`hline.ȁ}.΍}.}.}.}.}.}.}.}.}.}.}.}. 91In9troAduced`m@thin`@arraytoallo9wfnon-zerov|raluesof`math-surround.}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91New ndimenparameter`ex-traro9wheightT(default:p0pt).7Í}.΍}.}. 91v1.2dGeneral:6zCompletedthedoAcumen-tation.}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 9132!soIv1.2e XGeneral:[Bug xed: AZatstart gof*pream9bleresultedinaner-gror#since`@mkpreamgeneratedg`@arstrutT&...pasapream9ble.uL}. 91Iv1.2fXGeneral:T`@testpac9hdoAcumented.Z&}. yz1Iv1.3aXGeneral:{dAgainanewimplemen9ta-gtion,with2}anewconcept(cf.gtheTdoAcumen9tation).Z}.΍}.}.}.}.}.}.}. 91Iv1.3bXGeneral:`@declexpandsno9wintog`@empt9y:,,i.e.itdisappAearsgwhen;thepream9bleisgenerated,gexceptHwhentheuserspAeci esAgorTB.M}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91Iv1.4aXGeneral:T:estimplemen9tationofguseoftok9enregistersinordergtoTdowithout`protect.`l}.΍}.}.}.}.}. 91Iv1.4bXGeneral:CChangederroneousclassgn9umbAers:r?5@<->66->77->g5CorrespAondingc9hangesinthegmacros.ݍ}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91Iv1.4cXGeneral:{ Ev9erythingexceptp,znowgw9orksTwithtokenregisters.伍}.΍}.}. 91Iv1.9aXGeneral:)2)`protectisnolongergnecessary:.pBut1|stillthemacrog`@expastԔneedstopbAemodi-g ed.s`m9ulticolumns^stilldoAesnotgw9ork.׍}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91bLast(soIPhopAe)majorc9hange:g1)OptionsB,Ano9wcalled>,<.gThese9optionsno9wpAointtothegcolumnTtheymoAdify:.荑}.΍}.}.}.}.}.}.}. 91Iv1.9bXGeneral: ~insertedmissing` gin `@testpac9h.O_CorrectedgL5A TuAEXbugTin`@tfor.Ѿ}.΍}.}.}.}.}.}.}.}. 91Iv1.9cXGeneral:1)`def`the@toks`the...gremainingonlyin`@mkpream.g2)&Remo9ved`@classiiiandre-gplacedTb9y`save@decl.捑}.΍}.}.}.}.}.}. 91b3) `insert@columncon9tainsonlyg`@tempAcn9tayand`count@coun-gters.)4):<`@@startpbAo9xandg`@@endpbAo9x2nowtotallyobso-glete.<$}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91Re-in9troAducedG`@endpbox.j`mul- ticolumnno9wworksV:ersionn9umbAerwstill1.9sincethedoc-umen9tationTisstillnot nished. 1 ׍v1.9dGeneral:a Replaced`n9umbAera by`the wherethe`toksregisters'con-ten9tsTareused.W}.΍}.}.}.}.}.}.}.}.}.}.}. 91 ׍v1.9eGeneral: ZRe-in9troAduced`@xar- garra9ycr ;and`@yargarraycr,since`endtemplateseemstobAe`outer.R}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91 ׍v1.9fGeneral:Smallc9hanges nallycar- riedout:1)`par=`@empt9y:.mJ2)..ifn9um0=`... 9[!tM`bgroupandanaloguouslyT`egroup.;}.΍}.}.}.}.}.}. 91 ׍v1.9gGeneral:Insertedagain ..ifn9um0=`..,c.f.AppAendix5DofTtheTuAEXbAook.k}.΍}.}.}.}.}.}.}.}.}.}. 91 ׍v1.9hGeneral:zNolongernecessaryto readTinthe let9wice.4$}.΍}.}.}.}.}.}.}. 91v1.9iGeneral:ECorrectedt9ypAoingermanv9ersion.}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91v1.9jGeneral:tIna`r'columnanextra`k9ern`z@Tisneeded.c}.΍}.}.}.}.}.}.}.}. 91Otherwisethe`h lontheleftsidewillbAeremo9vedbythe`unskipin`insert@columniftheen9tryisempt9y:.QR}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91v1.9kGeneral:`bAeginMacroc9hangedto`bAeginmacroTindocumen9tation. 31CorrectedjFt9ypAoingermanver-sion.}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91v2.0a\@testpach:Jpoptionrenamedtom(middle).e}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 99toptionrenamedtoptobAecom-patibleTtotheoriginal.]e}.΍}.}.}.}.}.}. 99General:gAn@thetoksc9hangedtonthe@toks.ʍ}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91Filerenamedfromarra9ye.stytoarra9y:.sty.<}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91sourcepc9hangedtore ectnewdoAc.st9yTconventions.Ѝ}.΍}.}.}.}.}.}.}. 91toptionrenamedtoptobAecom-patibleTtotheoriginal.]e}.΍}.}.}.}.}.}. 9133"soIv2.0b XGeneral:A#Alllinesshortenedto72orgless.E}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91bThree forgottenendmacrogadded.}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91Iv2.0cX\@classv:\relaxaddedtoa9voidgproblemT`the`toks0`the`toks1.}. &P18X\@sharp:3Q\relaxaddedtoa9voidgproblem8\the\toks0\the\toks1.g}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. &P13X\save@decl:?G\relaxremo9ved?GandgaddedTelsewhere.:R}.΍}.}.}.}.}.}.}.}.}. &P12Iv2.0dX\@tabular:v`d@llarloAcaltopream-gble.͍}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. &P23X\array:T`d@llarloAcaltopream9ble. d23Iv2.0eX\@sharp:Added around\@sharpgforTnewftsel}.΍}.}.}.}.}.}.}.}.}.}.}.}. &P12Iv2.0fX\@testpach: /Argumen9tremovedgsinceTimplicitlykno9wnʍ}.΍}.}.}.}.}.}. 99bEnsure]totestac9harwhichisnotgactiv9e}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 99X\the@toks:L\@testpachno9wwith-goutTargፑ}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. &P14Iv2.0gX\d@llarend:^`d@llarbAeginde nedgonTtoplev9el.-}.΍}.}.}.}.}.}.}.}.}.}.}.}.}. &P22Iv2.0hX\@sharp:Remo9ved1againinfavourgof\d@llarbegin6}.΍}.}.}.}.}.}.}.}.}. &P12Iv2.1aX\@array:THoAokfordelarra9yadded 20bW:rongTspAecisno9wequivto[t]20XGeneral:TNew9columnstu addedJ524Iv2.1bX\newcolumntype:MacrorenamedgfromT`new9columnM*}.΍}.}.}.}.}.}.}.}. &P24Iv2.1cX\@startpbox:<Use`ev9erypartoin-gsertTstrut}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}. &P19Iv2.2aXGeneral:TUpgradetoL5A TuAEXc.2")(E}.΍}.}.}. yz1\newcolumn:,No9wmade`newcol- umnTanerrorH}.΍}.}.}.}.}.}.}.}.}.}.}. &P24Remo9vedT`newcolumn <}.΍}.}.}.}.}.}. fJ24v2.2bGeneral:vRemo9vedinteractivepromptyS}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 97v2.2cGeneral:bremo9vedcheckfor\@tforbugL"}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 91v2.2d\@endpbox:8UseL5A TuAEXc.2"$\@finalstrut}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. &P19v2.2e\multicolumn:TAdded\null9"}.΍}.}. fJ22v2.3aGeneral:AddedcoAdefor\firsthlineTandfriendsZ}.΍}.}.}.}. 91v2.3c\@argarraycr:=$Av9oidaddinganordatomTinmath}.΍}.}.}.}.}.}.}.}.}.}.}. &P21Use\expandafter'sincondi-tional}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. &P21\@arraycr:UAv9oidaddinganordatomTinmath}.΍}.}.}.}.}.}.}.}.}.}.}. &P21\@xarraycr:Av9oidaddinganordatomTinmath}.΍}.}.}.}.}.}.}.}.}.}.}. &P21General:T(DPC)minordoAcc9hanges \1v2.3d\@xhline:Ʊ xspacebAet9weenƱdoublerulesTpr/1945獑}.΍}.}.}.}.}.}.}.}.}.}.}. &P30v2.3f\@classz: k(DPC) jExtra\kernk9eeps$tabAcolsepinemptylcolumnsTin9ternal/2122u}.΍}.}.}.}.}. &P16v2.3g\@endpbox:*Add\hfilfortoAols/2120Ӎ}.΍}.}.}.}.}.}.}.}.}.}.}.}.}. &P19v2.3h\firsthline:>Completereimple-men9tation}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}. &P29\lasthline: Completereimplemen-tation}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. &P29v2.3i\@classz:ChangebAoth\kern\z@toT\hskip1spforlatex/2160U|}.΍}. &P16!čIReferencesI[1]X;M.WGoossens,7F.Mittelbach andA.WSamarin.TheL5ffA͉TU>'ExXCompanion. X;Addison-W*esley,UUReading,Massachusetts,UU1994.I[2]X;D.E.Knuth.TheTU>'ExXbGook(Computers&TypesettingV*olumeA).Addison-X;W*esley,UUReading,Massachusetts,UU1986.34#soI[3]X;L.|LamporUTt.pL5ffA͉TU>'ExX|ADoGcumentPreparationSystem.Addison-W*esley, X;Reading,UUMassachusetts,1986.35B; #8j cmti97 cmmi10K`y cmr10ٓRcmr7T