; TeX output 1998.01.17:2004y?R DtGGcmr17A7tnewimplemenqtationofLdKGXQ cmr12AT[-E;gX'sGGcmss17tabularq:andarrayؗ enqvironment!", cmsy10WDFVrankMittelbacrhDarvidCarlisle2K cmsy8y&PrinrtedJanuary17,1998.!Kt : cmbx9Abstractэxo cmr9ThisarticledescribAesanextendedimplemen9tationoftheL5Aacmr6A TuAEX ow cmss9array { kand!tabula9r {environments.?ThespAecialmeritsofthisimplementationarekfurther];optionstoformatcolumnsandthefactthatfragileL5A TuAEX{commandskdon'tTha9vetobAe!ߤN cmtt9\protect'edanymorewithinthoseenvironments.xThemajorpartofthecoAdeforthispac9k|ragedatesbackto1988|sodoAesksomeTofitsdoAcumen9tation.!čR#Nff cmbx121jLIntros3ductionRK`y cmr10Thisnewimplementationofthe$m#R cmss10array#{andtabular#{environmentsispartofalarger Rpro8jectSYinwhichwearetryingtoimprovetheL5ffٓRcmr7A͉TU>'ExX-coGdeinsomeaspectsandtoRmakeUUL5ffA͉TU>'ExXeveneasiertohandle.aThereadershouldbGefamiliarwiththegeneralstructureoftheenvironmentsRmentionedabGove.UTF*urtherinformationcanbGefoundin[3]and[1].UTTheadditionalRoptionsgwhichcanbGeusedinthepreambleaswellasthosewhichnowhaveaRslightlyUUdi erentmeaningaredescribGedintable1.aAdditionally0weintroGduceanewparametercalled%{\bfseries}l.~Y*oudonothaveܒtobeginkeveryUUentryofthecolumnwith\bfseriesanymore.RX-ffr @ -:q% cmsy6L|{Ycmr8ThisX lehasvÎersionnumbfdecl.gfffd'ExX.B_%ffffffBH1ff!fdecl.g1fffd{\setlength{\parindent}{1cm}}p.akThe}>{and<{optionswereoriginallydevelopGedforthefollowingapplication:k>{$}c<{$}ƲgeneratesacolumninmathmoGdeinatabular#{environment.Ifkyou{musethistypGeofapreambleinanarray#{environment,yougetacolumnkinUULRmoGdebecausetheadditional$'scanceltheexisting$'s.akOne-canalsothinkofmorecomplexapplications.9AproblemwhichhasbGeenkmentionedPseveraltimesinTU>'ExXhaxcanbGesolvedwith>{\centerdots}ck<{\endcenterdots}.DT*oͩcenterdecimalsattheirdecimalpGointsyou(only?)khaveUUtode nethefollowingmacros:2Zk{\catcode`\.\active\gdef.{\egroup\setbox2\hbox\bgroup}} k\def\centerdots{\catcode`\.\active\setbox0\hbox\bgroup}k\def\endcenterdots{\egroup\ifvoid2\setbox2\hbox{0}\fiy,\ifdim\wd0>\wd2\setbox2\hboxto\wd0{\unhbox2\hfill}\else\setbox0\hboxto\wd2{\hfill\unhbox0}\fiy,\catcode`\.12\box0.\box2}2 y?kW*arning:fThe=coGdeisbad,Bitdoesn'tworkwithmorethanonedotinacell kandsdoGesn'tworkwhenthetabularisusedintheargumentofsomeotherkcommand.cA+Qmuch+[bGetterversionisprovidedinthedcolumn.stybyDavidkCarlisle.akUsing1c!{\hspace{1cm}}cyougetspacebGetweentwocolumnswhichisen-klargedbyonecentimeter,_whilec@{\hspace{1cm}}cgivesyouexactlyonekcentimeterUUspacebGetweentwocolumns.6R&N cmbx121.1pDe ningnewcolumnsp`eci ersuTRWhilstUUitishandytobGeabletotype\newcolumntypek>{h'': cmti10some3+de}'clarations!iUgW}{c}<{hsome3+mor}'e6 de}'clarations!inT}Rifyouhaveaone-o columninatable,itisratherinconvenientifyouoftenuseRcolumnsofthisform.6Thenewversionallowsyoutode neanewcolumnspGeci er,Rsayx,whichwillexpandtotheprimitivescolumnspGeci ers.^1ǤThuswemayde nek\newcolumntype{x}{>{hsome3+de}'clarations!iUgW}{c}<{hsome3+mor}'e6 de}'clarations!inT}}ROnecanthenusethexcolumnspGeci erinthepreambleargumentsofallarrayRorUUtabularenvironmentsUUinwhichyouwantcolumnsofthisform.aIt^iscommontoneedmath-moGdeandLR-modecolumnsinthesamealignment.RIfUUwede ne:k\newcolumntype{C}{>{$}c<{$}}k\newcolumntype{L}{>{$}l<{$}}k\newcolumntype{R}{>{$}r<{$}}RThen͚wecanuseC{togetcentredLR-moGdeinanarray,orcentredmath-moGdeRinUUatabular.aThe CexamplegivenabGovefor`centreddecimalpGoints'couldbGeassignedtoadRspGeci erUUwiththefollowingcommand.k\newcolumntype{d}{>{\centerdots}c<{\endcenterdots}}aTheabGovesolutionalwayscentresthedotinthecolumn.ThisdoGesnotlookRtoGoigoodifthecolumnconsistsoflargenumbGers,ebuttoonlyafewdecimalplaces.RAnUUalternativede nitionofadcolumnisk\newcolumntype{d}[1]{>{\rightdots{#1}}r<{\endrightdots}}RwhereUUtheappropriatemacrosinthiscaseare:^2`,\def\coldot{.}%Orifyouprefer,\def\coldot{\cdot} `,{\catcode`\.=\activeR&effr J= "5-:1LThiscommandwÎasnamednnewcolumninthenewarray.sty.Atthemomentnnewcolumnis stillXsupp "5-:2LTheXpacÎkagedcolumn.stycontainsmorerobustmacrosbasedontheseideas.3#y?i\gdef.{$\egroup\setbox2=\hboxto\dimen0\bgroup$\coldot}} `,\def\rightdots#1{%i\setbox0=\hbox{$1$}\dimen0=#1\wd0i\setbox0=\hbox{$\coldot$}\advance\dimen0\wd0i\setbox2=\hboxto\dimen0{}%i\setbox0=\hbox\bgroup\mathcode`\.="8000$}`,\def\endrightdots{$\hfil\egroup\box0\box2}RNotethat\newcolumntypetakesthesameoptionalargumentas\newcommand RwhichddeclaresthenumbGerofargumentsofthecolumnspGeci erbeingde ned.RNowwecanspGecifyd{2}inourpreambleforacolumnof gurestoatmosttwoRdecimalUUplaces.aAsratherؕdi erentuseofthe\newcolumntypesystemtakesadvqantageoftheRfactthatthereplacementtextinthe\newcolumntypecommandmayrefertoRmorethanonecolumn. J%SuppGosethatadocumentcontainsalotoftabularRenvironmentsthatrequirethesamepreamble, AbutyouwishtoexpGerimentwithRdi erent<+preambles.idLampGort'soriginalde nitionallowedyoutodothefollowingR(althoughUUitwasprobablyamis-useofthesystem).k\newcommand{\X}{clr}k\begin{tabular}{\X}UU...Rarray.stystakesgreatcare("V cmbx10nottoexpandthepreamble,andsotheabGovedoGesnotRworkUUwiththenewscheme.qWiththenewversionthisfunctionalityisreturned:k\newcolumntype{X}{clr}k\begin{tabular}{X}UU...aTheD'replacementtextina\newcolumntypecommandmayrefertoanyoftheRprimitivesofarray.styseetable1onpage2,.)ortoanynewlettersde nedinRotherUU\newcolumntypecommands.aA,listofallthecurrentlyactive\newcolumntypede nitionsissenttothey\showcolsRterminalUUandlog leifthe\showcolscommandisgiven.6R1.2pSp`ecialv@ariationsof*Ɍ cmbsy10n)߆T cmtt12hlineuTRTheqfamilyof8tabularenvironmentsqallowsverticalpGositioningwithrespecttotheRbaselineGofthetextinwhichtheenvironmentappGears..mBydefaulttheenvironmentRappGearscentered,C"butthiscanbechangedtoalignwiththe rstorlastlineinRtheVenvironmentbysupplyingatorbvqaluetotheoptionalpGositionargument.RHowever,thisdoGesnotworkwhenthe rstorlastelementintheenvironmentisaR\hline-command|inthatcasetheenvironment-isalignedatthehorizontalrule.aHereUUisanexample:4'y?bT*ables UVwithUUno UVhline UVcommands UVused@]versus/cbtablesUUff: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.w4aUsingۉ\firsthlineand\lasthlinewillcuretheproblem,andthetableswill\firsthline $\lasthline RalignpropGerlyaslongastheir rstorlastlinedoesnotcontainextremelylargeRob8jects.ڍbT*ables UVwithUUno UVline UVcommands UVused@]versus3btablesUUff: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.RTheCimplementationofthesetwocommandscontainsanextradimension,>which \extratabsurroundRis&called\extratabsurround,[JtoaddsomeadditionalspaceatthetopandtheRbGottomUUofsuchanenvironment.qThisisusefulifsuchtablesarenested. ~R2jLFinalffCommentsR2.1pHandlingofrulesuTRTherearetwopGossibleapproachestothehandlingofhorizontalandverticalrulesRinUUtables:ٍ^81.krulesUUcanbGeplacedintotheavqailablespacewithoutenlargingthetable,oral^82.krulesUUcanbGeplacedbetweenUUcolumnsorrowstherebyenlargingthetable.ڍRarray.styimplementsthesecondpGossibilitywhilethedefaultimplementationinRtheWL5ffA͉TU>'ExXkernelimplementsthe rstconcept.dBothconceptshavetheirmerritsRbutUUonehastobGeawareUUoftheindividualimplications.akWithUstandardL5ffA͉TU>'ExXaddingrulestoatablewillnota ectthewidthorkheightBQofthetable(unlessdoublerulesareused),Fe.g.,changingBQapreamblekfromPhllltol|l|ldoGesnota ectthedocumentotherthanaddingrulestoktheDtable.l?Incontrast,Hwitharray.styatablethatjust tthe\textwidthkmightUUnowproGduceanoverfullbGox.52y?akWithstandardL5ffA͉TU>'ExXmoGdifyingthewidthofrulescouldresultinuglylook- kingtablesbGecausewithoutadjustingthe\tabcolsep,etc.thespacebetweenkruleandcolumncouldgettoGosmall(ortoolarge).MInfactevenoverprintingkoftextispGossible./Incontrast,}witharray.stymodifyinganysuchlengthkusuallyFworkswellastheactualvisualwhitespace(from\tabcolsep,Ietc.)kdoGesUUnotdependonthewidthoftherules.akWithmstandardL5ffA͉TU>'ExXbGoxedtabularsactuallyhavestrangecornersbGecausekthehorizontalrulesendinthemiddleoftheverticalones.6ThisloGoksverykunpleasantmhwhenalarge\arrayrulewidthischosen.InthatcaseasimplektableUUlikek\setlength{\arrayrulewidth}{5pt} k\begin{tabular}{|l|}ts.\hline s,A\\\hlinek\end{tabular}kwillUUproGducesomethinglikeqǍcfd fdA 8insteadUUof UVfd fdA ӊR2.2pComparisonswitholderversionsofarray.styuTRTherearesomedi erencesinthewayversion2.1treatsincorrectinput,9evenif Rthesource ledoGesnotappeartouseanyoftheextrafeaturesofthenewversion.akApreambleoftheform{wx*{0}{abc}yz}wastreatedbyversionspriortok2.1UUas{wx}.qV*ersion2.1treatsitas{wxyz}akAn7incorrectpGositionalargumentsuchas[Q]6wastreatedas[c]bykarray.sty,UUbutisnowtreatedas[t].akAbpreamblecsuchas{cc*{2}}withanerrorina-formwillgeneratedi erentkerrorsڃinthenewversion.HInbGothcasestheerrormessageisnotparticularlykhelpfulUUtothecasualuser.akRepGeatedaconstructionsgeneratedanerrorinearlierversions,+butareknowߦallowedinthispackqage.>{hde}'cs1[i "}>{hde}'cs2[i}istreatedthesameask>{hde}'cs2[i "hde}'cs1[i@D2}.akTheX.\extracolsepcommanddoGesnotworkwiththeoldversionsofkarray.sty,wsee@5thecommentsinarray.bug.hWithversion2.1\extracolsepkmayagainbGeusedin@-expressionsasinstandardL5ffA͉TU>'ExX,kandalsoin!-kexpressionsUU(butseethenotebGelow).6>ݠy?R2.3pBugsandFeaturesuTakErrormessagesgeneratedwhenparsingthecolumnspGeci cationrefertothe kpreambleargumentafterithasbGeenre-writtenbythe\newcolumntypeksystem,notQtothepreambleenteredbytheuser.PThisseemsinevitablewithkanyUUsystembasedonpre-proGcessingandsoisclassedasafeature.JakThetreatmentofmultipledeclarationsmayseemstrangeatk rst.EarlierBimplementationstreated>{hde}'cs1[i "}>{hde}'cs2[i}Bthesameask>{hde}'cs1[i "hde}'cs2[i@D2}.`HoweverthisdidnotgivetheusertheoppGortunityofkoverridingYJthesettingsofa\newcolumntypede nedusingthesedeclarations.kF*orexample,suppGoseinanarrayenvironmentweuseaCcolumnde nedkasҼabGove.TheCҜspGeci esacentredtextcolumn,however>{\bfseries}C,kwhich6re-writesto>{\bfseries}>{$}c<{$}wouldnotspGecifyaboldcol-kumnIasmightbGeexpected,asthepreamblewouldessentiallyexpandtok\hfil$\bfseries$#$?$\hfilAqandsothecolumnentrywouldnotbGeinthekscopGeDofthe\bfseries![ThepresentversionswitchestheorderofrepGeatedkdeclarations,ɃandsotheabGoveexamplenowproducesapreambleoftheformk\hfil$$\bfseries#$$\hfil,andthedollarscanceleachotheroutwithoutklimitingUUthescopGeofthe\bfseries.akTheKuseof\extracolsephasbGeensub8jecttothefollowingtworestrictions.kTheremmustbGeatmostone\extracolsepcommandper@,sor!expressionkand6thecommandmustbGedirectlyenteredintothe@expression,onotaspartkofoamacrode nition. Thus\newcommand{\ef}{\extracolsep{\fill}}k...@{\ef}ddoGesnotworkwiththispackqage.Howeveryoucanusesome-kthingUUlike\newcolumntype{e}{@{\extracolsep{\fill}}instead.akAs&enotedbytheL5ffA͉TU>'ExXbGook,/forðepurpGoseof\multicolumneachcolumnkwith&theexceptionofthe rstoneconsistsoftheentryandthefollowingkinter-columnױmaterial.Thismeansthatinatabularwiththepreamblek|l|l|l|l|inputsuchas\multicolumn{2}{|c|}inanythingotherthanktheUU rstcolumnisincorrect.kInQthestandardarray/tabularimplementationthiserrorisnotsonoticeablekasfthatversioncontainsnegativespacingsothateach|takesupnohorizon-ktalTspace.LButsinceinthispackqagetheverticallinestakeuptheirnaturalkwidthUUoneseestwoUUlinesiftwoUUarespGeci ed.)mR3jLTheffdos3cumentationdriver leRThe rstbitofcoGdecontainsthedocumentationdriver leforTU>'ExX,i.e.,the leRthatVwillproGducethedocumentationyouarecurrentlyreading.ItwillbGeextractedRfromUUthis lebythedocstripprogram. Us1\ cmsy9hdriveroi Us2\\NeedsTeXFormat{LaTeX2e}[1995/12/01]Us3\\documentclass{ltxdoc}7J7y?Us4 Us5\\AtBeginDocument{\DeleteShortVerb{\|}} s,%undothedefaultisnotusedUs6Us7adD\usepackage{array}Us8Us9adD%AllowlargetableatbottomR10adD\renewcommand{\bottomfraction}{0.7}R11R12\\EnableCrossrefsR13adD%\DisableCrossrefs,%Say\DisableCrossrefsifindexisreadyR14R15\\RecordChangesU %GatherupdateinformationR16R17\\CodelineIndexU %IndexcodebylinenumberR18R19adD%\OnlyDescriptionX%commentoutforimplementationdetailsR20adD%\OldMakeindex!%useifyourMakeIndexispre-v2.9R21\\begin{document}R22jp\DocInput{array.dtx}R23\\end{document}R24\h5" cmmi9=driveroi yэR4jLTheffconstructionofthepreambleRItisobviousthatthoseenvironmentswillconsistmainlyofan\halign,bGecause RTU>'ExXq[typGesetstablesusingthisprimitive.ThatiswhywewillnowtakealoGokatRthe]algorithmwhichdeterminesapreamblefora\halignstartingwithagivenRuserUUpreambleusingtheoptionsmentionedabGove.aThecurrentversionisde nedatthetopofthe leloGokingsomethinglikethis OR25\hpack9age#g i R26\%\NeedsTeXFormat{LaTeX2e}[1994/05/13]R27\%\ProvidesPackage{array}[\filedate\spaceversion\fileversion]OaThemostinterestingmacrosofthisimplementationarewithoutdoubtthose RwhichsarerespGonsiblefortheconstructionofthepreambleforthe\halign.RTheYunderlyingalgorithmwasdevelopGedby}d-- cmcsc10LamporUTt(resp.Knuth,ZseetexhaxRV87#??),UUandithasbGeenextendedandimproved.aTheuserpreamblewillbGereadtokenbytoken.+AtokenisasinglecharacterlikeRcorabloGckenclosedin{...}.F*orexamplethepreambleof\begin{tabular}R{lc||c@{\hspace{1cm}}}UUconsistsofthetokenl,c,|,|,@and\hspace{1cm}.aThecurrentlyusedtokenandtheone,usedbGefore,areneededtodecideonhowRthepconstructionofthepreamblehastobGecontinued.IntheexamplementionedRabGove1thelcausesthepreambletobeginwith\hskip\tabcolsep.[F*urthermoreR#?\hfilkwouldbGeappendedtode nea ushleftcolumn.Thenexttokenisac.RBecauseitwasprecededbyanlitgeneratesanewcolumn.yJThisisdonewithR\hskip?\tabcolsep&\hskip\tabcolsep.J The`columnwhichistobGecenteredRwillbGeappendedwith\hfil?#\hfil.GThetoken|wouldthenaddaspaceofR\hskip?\tabcolsep|andaverticallinebGecausethelasttokenswasac.dbythetoken|.j!W*ewillnotdiscussourexamplefurtherbutrathertakeRaUUloGokatthegeneralcaseofconstructingpreambles.aThedexampleshowsthatthedesiredpreambleforthe\haligncanbGecon-Rstructed݇assoGonastheactionofallcombinationsofthepreambletokensareRspGeci ed.t0Therexare18suchtokenssowehave1918O=342xcombinationsifRweycountthebGeginningofthepreambleasaspGecialtoken. F*ortunately,thereRare manycombinationswhichgeneratethesamespaces,:sowecande netokenRclasses. YW*e0willidentifyatokenwithinaclasswithanumbGer,gsowecaninsertRthe=Rformatting(forexampleofacolumn).iT*able2listsalltokenclassesandtheirRcorrespGondingUUnumbers.`ntoken(\@chclassY \@chnumǍwY1c9090wY1l9091wY1r9092l7p-arg9093l7t-arg9094l7b-arg9095wY1|9190l7!-arg9191l7<-arg92۹|l7>-arg93۹|xJcff~>xtoken4\@chclassp \@chnumǍ+StartI4}h|+@-argI5}h| %!I6}h| %@I7}h| %I9}h| %pGi103 %tGi104 %bGi105<*ÈT*ableUU2:qClassesofpreambletokensT$\@chclass'3P\@chnum \@lastchclassRThe>classandthenumbGer>ofthecurrenttokenaresavedinthecountregistersR\@chclassx9and\@chnum,whiletheclassoftheprevioustokenisstoredintheRcountkCregister\@lastchclass.Allofthementionedregistersarealreadyallo-RcatedKinlatex.tex,MwhichisthereasonwhythefollowingthreelinesofcoGdeareRcommentedPout.pOLaterthroughoutthetextIPwillnotmentionitagainexplicitelyRwheneverUUIusea%sign.qThesepartsarealreadyde nedinlatex.tex. IҍR28\%\newcount\@chclass R29\%\newcount\@chnumR30\%\newcount\@lastchclasswf\@addtopreambleRW*ewillsavethealreadyconstructedpreambleforthe\halignintheglobalmacro R\@preamble.qThisUUwillthenbGeenlargedwiththecommand\@addtopreamble.R31\\def\@addtopreamble#1{\xdef\@preamble{\@preamble#1}}aWR4.1pThecharacterclassofa/kAH cmssbx10tok"enuT\@testpachRWith thehelpof\@lastchclasswecannowde neamacrowhichdeterminestheRclassFandthenumbGerFofagivenpreambletokenandassignsthemtotheregistersR\@chclassUUand\@chnum.9 dy?R32\\def\@testpach{\@chclassRFirstTwedealwiththecasesinwhichthetoken(#1)istheargumentof !,U@,<Tor R>.qW*eUUcanseethisfromthevqalueof\@lastchclass: R33adD\ifnum\@lastchclass=6\@ne\@chnum\@ne\else R34f\ifnum\@lastchclass=75\elseR35jp\ifnum\@lastchclass=8\tw@\elseR36o\ifnum\@lastchclass=9\thr@@ROtherwise]wewillassumethatthetokenbGelongstotheclass0andassignthe RcorrespGondingUUnumberUUto\@chnumifourassumptioniscorrect. R37jp\else\z@RIfɊthelasttokenwasap,morab,\@chnumalreadyhastherightvqalue.fThisisRtheUUreasonforthesomewhatcuriouschoiceofthetokennumbGersinclass10. R38jp\ifnum\@lastchclass=10\elseROtherwise/wewillcheckif\@nextchariseitherac,6loranr.eSomeapplicationsRchange=thecatcoGdesofcertaincharacterslike\@"inamstex.sty.iAsaresulttheRtestsbGelowwouldfailsincetheyassumenon-activecharactertokens.ThereforeRwe evqaluate\@nextcharoncetherebyturningthe rsttokenofitsreplacementRtextintoachar.ZGAtthispGointherethisshouldhavebGeentheonlycharpresentinR\@nextcharUUwhichputintoviaa\def. R39jp\edef\@nextchar{\expandafter\string\@nextchar}% R40jp\@chnumR41jp\if\@nextcharc\z@\elseR42o\if\@nextcharl\@ne\elseR43tJ\if\@nextcharr\tw@\elseRIfaitisadi erenttoken,dweknowthattheclasswasnot0.W*eassignthevqalue0 Rtoe\@chnumbGecausethisvqalueisneededforthe|{token.NowewemustchecktheRremainingclasses..Notethatthevqalueof\@chnumisinsigni canthereformostRclasses. R44jp\z@\@chclass R45jp\if\@nextchar|\@ne\elseR46o\if\@nextchar!6\elseR47tJ\if\@nextchar@7\elseR48y2\if\@nextchar<8\elseR49}\if\@nextchar>9\elseRTheUUremainingpGermittedtokensarep,mandb(class10). R50f10R51f\@chnumR52f\if\@nextcharm\thr@@\elseR53jp\if\@nextcharp4\elseR54o\if\@nextcharb5\elseRNowVRtheonlyremainingpGossibilityisaforbiddentoken,VsowechoGoseclass0and RnumbGerk0andgiveanerrormessage.Thenwe nishthemacrobyclosingallR\if's. R55jp\z@\@chclass\z@\@preamerr\z@\fi\fi\fi\fi R56jp\fi\fi s,\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}10 qy?R4.2pMultiplecolumns({form)uT$\@xexpast $\the@toks \the@tokszRNowFwediscussthemacrothatdeletesallformsoftypGe*{N}{String}}froma RusernpreambleandreplacesthemwithNrܲcopiesofString.Nested{expressionsRaregdealtwithcorrectly*,lthatmeans{expressionsarenotsubstitutediftheyareRinUUexplicitbraces,asin@{*}.aThismacroiscalledvia\@xexpasthpr}'eamble[i.z*0x\@@.NThe{expression*0xRisbGeingusedtoterminatetherecursion,Iasweshallseelater,and\@@servesasRanqargumentdelimiter. \@xexpasthasfourarguments. The rstoneisthepartRof>theuserpreamblebGeforethe rst{expressionwhilethesecondandthirdonesRarel]theargumentsofthe rst{expression(thatisNandStringNڲinthenotationRmentionedUUabGove).qThefourthargumentistherestofthepreamble.R57\\def\@xexpast#1*#2#3#4\@@{%RThenumbGerofcopiesofStringZ(#2)thataretobeproducedwillbesavedinaRcountUUregister.R58jp\@tempcnta#2RW*esavethepartofthepreamblewhichdoGesnotcontaina{form(#1)inaRPlainTU>'ExXUUtokenregister.qW*ealsosaveString7Ҳ(#3)usingaL5ffA͉TU>'ExXtokenregister.R59jp\toks@={#1}\@temptokena={#3}%RNow,VwehavetousealittletricktoproGduceNϬcopiesofString.W*ecouldtryR\def\@tempa{#1} andthenN*times\edef\@tempa{\@tempa#3}. kThiswouldRhavetheundesirede ectthatallmacroswithin#1and#3wouldbGeexpanded,Ralthough,forsexample,constructionslike@{..}arenotsuppGosedtobechanged.RThatUUiswhywe\lettwocontrolsequencestobGeequivqalentto\relax.R60jp\let\the@toksz\relax\let\the@toks\relaxRThenʽweensurethat\@tempacontains{\the@toksz\the@toks...\the@toks}R(theUUmacro\the@toksexactlyNtimes)assubstitutiontext.R61jp\def\@tempa{\the@toksz}% R62jp\ifnum\@tempcnta>0\@whilenum\@tempcnta>0\doR63tJ{\edef\@tempa{\@tempa\the@toks}\advance\@tempcnta\m@ne}%RIfN;cwasgreaterthanzeroweprepareforanothercallof\@xexpast.9yOtherwise Rwe]Oassumewehavereachedtheendoftheuserpreamble,MbGecausewehadap-RpGended"*0x\@@whenwe rstcalled\@xexpast.EInotherwords:/iftheuserinsertsR*{0}{..}UUinhispreamble,L5ffA͉TU>'ExXignorestherestofit.R64}\let\@tempb\@xexpast\else R65}\let\@tempb\@xexnoop\fiRNowwewillmakesurethatthepartoftheuserpreamble,hwhichwasalreadydealtRwith,UUwillbGesavedUUagainin\@tempa.R66jp\def\the@toksz{\the\toks@}\def\the@toks{\the\@temptokena}% R67jp\edef\@tempa{\@tempa}%RW*ehavenowevqaluatedthe rst{expression,andtheuserpreambleuptothisRpGointwissavedin\@tempa..W*ewillputthecontentsof\@tempaandtherestofRtheeuserpreambletogetherandworkontheresultwith\@tempb.Thismacro11 ~y?ReithercorrespGondsto\@xexpast,sothatthenext{expressionishandled,orto RtheUUmacro\@xexnoop,whichonlyendstherecursionbydeletingitsargument.R68jp\expandafter\@tempb\@tempa#4\@@}$\@xexnoopRSoݡthe rstbigproblemissolved. NowݡitiseasytospGecify\@xexnoop.ItsRargumentUUisdelimitedby\@@anditsimplyexpandstonothing.R69\% s,\def\@xexnoop#1\@@{}!čR5jLTheffinsertionofdeclarations(2߆Tff cmtt12>,<,!,@)RThepreamblewillbGeenlargedwiththehelpof\xdef,buttheargumentsof>,R<,A!and@arenotsuppGosedtobeexpandedduringtheconstruction(wewantRanimplementationthatdoGesn'tneeda\protect).Sowehaveto ndawaytoRinhibitUUtheexpansionofthosearguments.aW*ewillsolvethisproblemwithtokenregisters.S7W*eneedoneregisterforeveryR!ӓand@,"whileweneedtwoforevery c,"l,r,m,pӓorb.ThislimitsthenumbGerRofcolumnsofatablebGecausethereareonly256tokenregisters.ՆButthen,whoRneedsUUtableswithmorethan100columns?aOnecouldalso ndasolutionwhichonlyneedstwoorthreetokenregistersbyRproGceedingssimilarlyasinthemacro\@xexpast(seepage11).3TheadvqantageofRourapproachisthefactthatweavoidsomeoftheproblemsthatarisewiththeRotherUUmethoGd^3|s.aSo}howdoweproGceed?>Letusassumethatwehad!{foo}intheRuserƢpreambleandsaywesavedfoointokenregister5.ŮThenwecallR\@addtopreamble{\the@toks5}where\the@toksisde nedinawaythatitdoGesRnothexpand(forexampleitcouldbGeequivqalentto\relax).EveryfollowingcallRofF\@addtopreambleleavesF\the@toks5unchangedin\@preamble.EDIfthecon-Rstruction^ofthepreambleiscompletedwechangethede nitionof\the@tokstoR\the\toksandexpand\@preambleforthelasttime.DuringthisproGcessallRpartsoftheform\the@tokshNumb}'eri.SwillbGesubstitutedbythecontentsoftheRrespGectiveUUtokenregisters.aAswecanseefromthisinformaldiscussiontheconstructionofthepreambleRhastotakeplacewithinagroup,sothatthetokenregistersweusewillbGefreedRlateron.\F*orthatreasonwekeepallassignmentsto\@preambleglobal;+thereforeRthe(replacementtextofthismacrowillremainthesameafterweleavethegroup.'3P\count@RW*efurtherneedacountregistertoremembGerwhichtokenregisteristobGeusedRnext.اThiswwillbGeinitializedwith1ifwewanttobGeginwiththetokenregisterR0.JW*e߇usethePlainTU>'ExXscratchregister\count@bGecauseeverythingtakesplaceRloGcally*.>Allwehavetodoisinsert\the@toks\the\count@intothepream-Rble.$\the@toksɲwillremainunchangedand\the\count@expandsintothesavedRnumbGer.Rffffr J= "5-:3LMaÎyb'ExXexpands\the\toks2 rstinor-Rderto ndoutifthedigit1isfollowedbyotherdigits.R\E.g.a5savedinthetokenRregisterT2wouldleadTU>'ExXtoinsertthecontentsof\qtokenregister15insteadof1RlaterUUon.aTheexampleabGovereferredtoanolderversionof\save@declwhichinsertedaR\relexinsidethetokenregister.7ThisisnowmovedtotheplaceswheretheactualRtokenregistersareinserted(loGokfor\the@toks)becausetheoldversionwouldRstillGmake@expressionstomovingargumentssinceafterexpandingthesecondRregisterowhileloGokingfortheendofthenumberothecontentsoofthetokenregisterRisaddedsothatlateronthewholeregisterwillbGeexpanded.WThisseriousbugRwas7foundafternearlytwoyearsinternationaluseofthispackqagebyJohannesRBraams.aHoweJdoGesthesituationlooklike,GifwewanttoaddanothercolumntotheRpreamble,gi.e.ifwehavefoundac,gl,r,p,mʲorbintheuserpreamble?i%InthisRcasewehavetheproblemofthetokenregisterfrom>{..}and<{..}havingtoRbGeinsertedatthismomentbecauseformatinginstructionslike\hfilhavetobGeRset aroundthem.`UOntheotherhanditisnotknownyet,+wifany<{..}instructionRwillUUappGearintheuserpreambleatall.aW*e[|solvethisproblembyaddingtwotokenregistersatatime.=Thisexplains,RwhyUUwehavefreedthetokenregistersin\prepnext@tok. 6\insert@column'3P\@sharpRW*eUUnowde nethemacro\insert@columnwhichwilldothisworkforus.R73\\def\insert@column{%RHere,wen}assumethatthecountregister\@tempcntahassavedthevqalue\count@'R1.R74jp\the@toks\the\@tempcntaRNext#followsthe#signwhichspGeci estheplacewherethetextofthecolumnshallRbGeinserted.ZT*oavoiderrorsduringtheexpansionsin\@addtopreamblewehideRthisasigninthecommand\@sharpwhichistempGorarilyoccupiedwith\relaxRduringthebuild-upofthepreamble.RT*oremoveunwantedspacesbGeforeandafterRtheUUcolumntext,wesetan\ignorespacesinfrontanda\unskipafterwards.R75jp\ignorespaces\@sharp\unskip13 y?RThenthesecondtokenregisterfollowswhosenumbGershouldbesavedin\count@. RW*eKmakesurethattherewillbGenofurtherexpansionafterreadingthenumbGer,Rby8 nishingwith\relax. pThecaseabGoveisnotcriticalsinceitisendedbyR\ignorespaces.R76jp\the@toks\the\count@\relax}6R5.1pTheseparationofcolumnsuT"y\@addampRIng8thepreamblea&hastobGeinsertedbetweeng8anytwocolumns;p)bGeforethe rstRcolumn@thereshouldnotbGea&.TAstheuserpreamblemaystartwitha|wehaveRtoremembGersomehowifwehavealreadyinserteda#(i.e.acolumn).AThisisdoneRwith?thebGoolean?vqariable\if@firstampthatwetestin\@addamp,themacrothatRinsertsUUthe&.R77\%X\newif\@iffirstamp R78\%X\def\@addamp{\if@firstamp\@firstampfalseR79\%PR\else\@addtopreamble&\fi}+\@acol \@acolampacol "y\col@sepRW*e)willnowde nesomeabbreviationsfortheextensions,appGearingmostoften Rinthepreamblebuild-up.Here\col@sepisadimenregisterwhichissetequiv-Ralent#to\arraycolsepinanarray#{environment,otherwiseitissetequivqalenttoR\tabcolsep.R80\\newdimen\col@sep R81\\def\@acol{\@addtopreamble{\hskip\col@sep}}R82\%X\def\@acolampacol{\@acol\@addamp\@acol}6R5.2pThemacron@mkpreamuT$\@mkpream $\the@toksRNowvwecande nethemacrowhichbuildsupthepreambleforthe\halign.B}First RweYinitialize\@preamble,\@lastchclassandthebGooleanYvqariable\if@firstamp.R83\\def\@mkpream#1{\gdef\@preamble{}\@lastchclass4\@firstamptrueRDuringRthebuild-upofthepreamblewecannotdirectlyusethe#sign;*thiswouldRlead#toanerrormessageinthenext\@addtopreamblecall.s1Instead,weusetheRcommand6\@sharpatplaceswherelatera#willbGe.Thiscommandisat rstRgiventhemeaning\relax;ZthereforeitwillnotbGeexpandedwhenthepreambleRisUVextended.qInthemacro\@array,VshortlybGeforethe\haligniscarriedout,R\@sharpUUisgivenits nalmeaning.aInasimilarway*,>owedealwiththecommands\@startpboxand\@endpbox,Ralthoughlthereasonisdi erenthere:thesemacrosexpandinmanyetokenswhichRwouldUUdelaythebuild-upofthepreamble.R84jp\let\@sharp\relax\let\@startpbox\relax\let\@endpbox\relaxRNowuweremovepGossible-formsintheuserpreamblewiththecommandR\@xexpast.qAswealreadyknow,thiscommandsavesitsresultinthemacroR\@tempa.R85jp\@xexpast#1*0x\@@14y?RAfterwards1weinitializeallregistersandmacros,8thatweneedforthebuild-upof RtheNpreamble.6Sincewewanttostartwiththetokenregister0, \count@hastoRcontainUUthevqalue1.R86jp\count@\m@ne R87jp\let\the@toks\relaxRThenUUwecallup\prepnext@tokinordertopreparethetokenregister0foruse.R88jp\prepnext@tokRT*oevqaluatetheuserpreamble(withoutstars)savedin\@tempaweusetheL5ffA͉TU>'ExX{ RmacroU\@tfor.RThestrangeappGearingconstructionwith\expandafterisbasedRonthefactthatwehavetoputthereplacementtextof\@tempaandnotthemacroR\@tempaUUtothisL5ffA͉TU>'ExX{macro.R89jp\expandafter\@tfor\expandafter\@nextchar R90o\expandafter:\expandafter=\@tempa\doRThebGodyofthisloop(thegroupafterthe\do)isexecutedforonetokenatatime,Rwhereasthecurrenttokenissavedin\@nextchar.@At rstweevqaluatethecurrentRtokenPwiththealreadyde nedmacro\@testpach,i.e.weassignto\@chclasstheRcharacterUUclassandto\@chnumthecharacternumbGerofthistoken.R91jp{\@testpachRThen%webranchoutdepGendingonthevqalueof\@chclassintodi erentmacrosRthatUUextendthepreamblerespGectively*.R92jp\ifcase\@chclass\@classz\or\@classi\or\@classii R93tJ\or\save@decl\or\or\@classv\or\@classviR94tJ\or\@classvii\or\@classviii s,\or\@classixR95tJ\or\@classx\fiRTwocasesdeserveourspGecialattention:{=Sincethecurrenttokencannothave Rthecharacterclass4(start)wehaveskippGedthispossibility*.`IfthecharacterRclassis3,Jonlythecontentof\@nextcharhastobGesavedintothecurrenttokenRregister;stherefore|wecallup\save@decldirectlyandsaveamacroname.AfterRtheJpreamblehasbGeenextendedweassignthevqalueof\@chclasstothecounterR\@lastchclassltoassurethatthisinformationwillbGeavqailableduringthenextRrunUUoftheloGop.R96jp\@lastchclass\@chclass}%RAftertheloGophasbeen nishedspacemuststillbeaddedtothecreatedpreamble,RdepGending<{..}theremustalwaysfollowac,sl,r,p,mRorUUb.qW*erepGortanerrorandignorethedeclarationgivenby{..}.N101jp\@preamerr\thr@@\or޸RIfr?\@lastchclassis4theuserpreamblehasbGeenempty*.ȅTor?continue,yzweinsertRaUU#inthepreamble.N102jp\@preamerr\tw@\@addtopreamble\@sharp\or޸RClass5isallowedagain.AInthiscase(theuserpreambleendswith@{..})weneedRnotUUdoanything.N103jp\or޸RAnyƸothercasemeansthattheargumentsto@,#!,<,>,p,mƸorbhavebGeenRforgotten.qSoUUwerepGortanerrorandignorethelasttoken.N104jp\else s,\@preamerr\@ne\fi޸RNow9thatthebuild-upofthepreambleisalmost nishedwecaninserttheto-Rkenߒregistersandthereforerede ne\the@toks.~Theactualinsertion,!though,isRpGerformedUUlater.N105jp\def\the@toks{\the\toks}} R6jLTheffmacros3Ɍ ff cmbsy10n@classzton@classxRThe`preambleisextendedbythemacros\@classzto\@classxwhicharecalledRby\@mkpreamdepGendingon\@lastchclass(i.e.# thecharacterclassofthelastRtoken).o"y\@classxRFirstQwede ne\@classxbGecauseofitsimportantr^ole.p[Whenitiscalledwe ndRthatUUthecurrenttokenisp,morb.qThatmeansthatanewcolumnhastostart.N106\\def\@classx{%޸RDepGendingUUonthevqalueof\@lastchclassdi erentactionsmusttakeplace:N107f\ifcase\@lastchclassRIf`thelastcharacterclasswas0weseparatethecolumnsby\hskip\col@sep RfollowedUUby&andanother\hskip\col@sep.N108f\@acolampacol\orRIfthelastclasswasclass1|thatmeansthataverticallinewasdrawn,| RbGefore>thislinea\hskip\col@sepwasinserted.jIThereforetherehastobeonlyaR&Q^followedby\hskip\col@sep.puButthis&maybGeinsertedonlyifthisisnottheR rstUUcolumn.qThisproGcessiscontrolledby\if@firstampinthemacro\addamp.N109f\@addamp\@acol\or޸RClassUU2istreatedlikeclass0bGecause<{...}canonlyfollowafterclass0.N110f\@acolampacol\or16´y?RClass6%3requiresnoactionsbGecauseallthingsnecessaryhave6%beendonebythe RpreambleUUtoken>. N111f\orRClasso4meansthatweareatthebGeginningofthepreamble.kThereforewestartRthe6preamblewith\hskip\col@sepandthencall\@firstampfalse.gThismakesRsureUUthatalater\@addampinsertsthecharacter&intothepreamble.N112f\@acol\@firstampfalse\orRF*orclass5tokensonlythecharacter&isinsertedasacolumnseparator.4ThereforeRweUUcall\@addamp.N113f\@addampROther|casesareimpGossible.`F*oranexample\@lastchclassMow=6|asitmightRappGear]inapreambleoftheform...!p...|pwouldhavebGeentakenasanRargumentUUofr!by\@testpach.N114f\fi}"y\@classzRIfRthecharacterclassofthelasttokenis0wehavec,SGl,rRòoranargumentofm,SGbRorp.Inthe rstthreecasesthepreamblemustbGeextendedthesamewayasifRwe6hadclass10.(lTheremainingtwocasesdonotrequireanyactionbGecausetheRspaceneededwasgeneratedbythelasttoken(i.e.m,borp).7NSince\@lastchclassRhas8thevqalue10atthispGointnothinghappenswhen\@classxiscalled.|oSotheRmacroUU\@chlasszmaystartlikethis:N115\\def\@classz{\@classxRAccordingtothede nitionof\insert@columnwemuststorethenumbGeroftheRtokena.registerinwhichapreceding>{..}mighthavestoreditsargumentintoR\@tempcnta.N116jp\@tempcnta\count@RT*oUUhave\count@*X=\@tmpcnta4?ݲ+81wepreparethenexttokenregister.N117jp\prepnext@tokRNowthepreamblemustbGeextendedwiththecolumnwhoseformatcanbedeter- RminatedUUby\@chnum.N118jp\@addtopreamble{\ifcase\@chnumRIf‚\@chnumhasthevqalue0acenteredcolumnhastobGegenerated.MSowebGegin RwithUUstretchablespace.N119y2\hfilRThe-command\d@llarbeginfollowsexpandinginto\begingroup(inthetab- Rular#{environment)=orinto$.yDoingthis(providedanappropriatesettingRof\d@llarbegin)weachievethatthecontentsofthecolumnsofanarray#{RenvironmentaresetinmathmoGdewhilethoseofatabular#{environmentaresetinRLRUUmoGde.N120y2\d@llarbeginRNowweinsertthecontentsofthetwotokenregistersandthesymbGolfortheRcolumnUUentry(i.e.#ormoreprecise\@sharp)using\insert@column.N121y2\insert@column17]y?RW*evendthiscasewith\d@llarendand\hfilwhere\d@llarendagainiseither R$UUor\endgroup. 瞍N122y2\d@llarend\hfil\or瞍RThe~templatesforlandr(i.e.\@chnum1or2)aregeneratedthesameway*.LSinceRoneDx\hfilismissingthetextismovedDxtotherelevqantside.The\kern\z@isneededRinHcaseofanemptycolumnentry*.LOtherwisethe\unskipin\insert@columnRremovesuthe\hfil. ҝChangedto\hskip1spsothatitinteractsbGetterwithR\@bsphack.N123y2\hskip1sp\d@llarbegin\insert@column\d@llarend\hfil\or N124y2\hfil\hskip1sp\d@llarbegin\insert@column\d@llarend\or瞍RThedtemplatesforp,gmandbmainlyconsistofabGox.Incaseof+1mitisgeneratedRby\vcenter.pThiscommandisallowedonlyinmathmoGde.pThereforewestartRwithUUa$.N125jp$\vcenter瞍RThe partofthetemplateswhichisthesameinallthreecases(p,{mandb)isbuiltRbyTthemacros\@startpboxand\@endpbox. T\@startpboxhasanargument:Rthewidthofthecolumnwhichisstoredinthecurrenttoken(i.e.\@nextchar).RBetweenUUthesetwoUUmacroswe ndthewellknown\insert@column.N126jp\@startpbox{\@nextchar}\insert@column\@endpbox$\or瞍RTheWtemplatesforpandbaregeneratedinthesamewayWthoughwedonotneedRtheUU$charactersbGecauseweuse\vtopor\vbox.N127jp\vtop\@startpbox{\@nextchar}\insert@column\@endpbox\or N128jp\vbox\@startpbox{\@nextchar}\insert@column\@endpbox瞍ROthervqaluesfor\@chnumareimpGossible.ThereforeweendtheargumentstoR\@addtopreamble28and\ifcase.fBeforewecometotheendof\@classzwehaveRtoUUpreparethenexttokenregister.N129f\fi}\prepnext@tok}ۍ$\@classixRIncaseofclass9(>{token)we rstcheckifthecharacterclassofthelasttokenRwas3.RInthiscasewehaveauserpreambleoftheform..>{...}>{...}..whichRisjnotallowed.8W*ejonlygiveanerrormessageandcontinue.8SothedeclarationsRde nedUUbythe rst>{...}areignored.N130\\def\@classix{\ifnum\@lastchclass=\thr@@ N131}\@preamerr\thr@@\fi瞍RF*urthermore,+twecallup\@class10bGecauseafterwardsalwaysanewcolumnisRstartedUUbyxc,l,r,p,morb.N132}\@classx}ۍL\@classviiiRIf#2thecurrenttokenisa\z@ N134y2\@preamerr4\@chclass6\@classvi\fi}18ڐy?L\@arrayruleRThereWisonlyoneincompatibilitywiththeoriginalde nition:v}thede nitionof R\@arrayrule.Intheoriginalalinewithoutwidth^4 kiscreatedbymultiplein-Rsertions!of\hskip?.5\arrayrulewidth.)W*eonlyinsertaverticallineintotheRpreamble.nThiscisdonetopreventproblemswithTU>'ExX'smainmemorywhengen-ReratingUUtableswithmanyverticallinesinthem(espGeciallyinthecaseofr oats).N135\\def\@arrayrule{\@addtopreamble\vline}\@classviiRAs$aconsequenceitfollowsthatincaseofclass7(@token)thepreambleneedRnotHtobGeextended.9Intheoriginalde nition\@lastchclassKx=W1istreatedbyRinsertingZ\hskip?.5\arrayrulewidth.1W*eonlycheckZifthelasttokenwasofclassR3UUwhichisforbidden.N136\\def\@classvii{\ifnum\@lastchclass=\thr@@RIfthisistrueweoutputanerrormessageandignorethedeclarationsstoredbyRtheUUlast>{...},bGecausetheseareoverwrittenUUbytheargumentofr@.N137jp\@preamerr\thr@@\fi}$\@classviRIfOthecurrenttokenisaregular!andthelastclasswas0or2weextendtheRpreamblewith\hskip\col@sep.SIfthelasttokenwasofclass1(forinstance|)Rwe%extendwith\hskip?\doublerulesepbGecausetheconstruction!{...}hastoRbGeUUtreatedlike|.N138\\def\@classvi{\ifcase\@lastchclass N139y2\@acol\orN140y2\@addtopreamble{\hskip\doublerulesep}\orN141y2\@acol\orRNow\@preamerr...shouldfollowbGecauseauserpreambleoftheform..>{..}!. Risnotallowed.ZT*osavememorywecall\@classviiinsteadwhichalsodoGeswhatRweUUwant.N142y2\@classviiRIf-\@lastchclassis4or5nothinghastobGedone.VClass6to10arenotpossible.RSoUUwe nishthemacro.N143y2\fi}$\@classii\@classiiiRIn.thecaseofcharacterclasses2and3(i.e.theargumentof)weonlyhaveRtostorethecurrenttoken(\@nextchar)intothecorrespGonding\tokenregistersinceRtheWpreparationandinsertionoftheseregistersaredonebythemacro\@classz.RThisIisequivqalenttocalling\save@declinthecaseofclass3.mT*osavecommandRidenti ersUUwedothiscallupinthemacro\@mkpream.aClass2exhibitsamorecomplicatedsituation:8thetokenregistershavealreadyRbGeenRinsertedby\@classz.JSothevqalueof\count@istoohighbyone.JThereforeRweUUdecrease\count@by1.N144\\def\@classii{\advance\count@\m@neR&effr J= "5-:4LSoXthespaceb{...}.20y?N154jp\everypar{% N155y2\vrule\@height\ht\@arstrutbox\@width\z@N156y2\everypar{}}%N157jp}$\@endpboxRIfthereareanydeclarationsde nedby>{...}and<{...}theynowfollowin Rthesmacro\@classz|thecontentssofthecolumninbGetween.SosthemacroR\@endpboxIJmustinsertthespGecialstrutmentionedearlierandthenclosethegroupRopGenedUUby\@startpbox.N158\\def\@endpbox{\@finalstrut\@arstrutbox\egroup\hfil}!čR7jLBuildingffandcallingnhalign'3P\@arrayRAfterwehavediscussedthemacrosneededfortheevqaluationoftheuserpreambleRweCcande nethemacro\@arraywhichusesthesemacrostocreatea\halign.RIthastwoarguments.6%The rstoneisapGositionargumentwhichcanbGet,'borRc;UUthesecondonedescribGesthewantedUUpreamble,e.g.ithastheform|c|c|c|.N159\\def\@array[#1]#2{%RFirstwede neastrutwhosesizebasicallycorrespGondstoanormalstrutmulti-Rpliedbythefactor\arraystretch.[ThisstrutistheninsertedintoeveryrowandRenforcesbaminimaldistancebGetweenbtworows.Nevertheless,whenusinghori-Rzontallines,klargeletters(likeaccentedcapitalletters)stillcollidewithsuchlines.RThereforeat rstweaddtotheheightofanormalstrutthevqalueoftheparameterR\extrarowheight.N160f\@tempdima\ht\strutbox N161f\advance\@tempdimaby\extrarowheightN162f\setbox\@arstrutbox\hbox{\vruleN163L\@height\arraystretch\@tempdimaN164L\@depth\arraystretch\dp\strutboxN165L\@width\z@}%RThenwweopGenagroup,\inwhichtheuserpreambleisevqaluatedbythemacro R\@mkpream.TAsweknowthismusthappGenlocally*.TThismacrocreatesapreambleRforUUa\halignandsavesUUitsresultgloballyinthecontrolsequence\@preamble.N166f\begingroup N167f\@mkpream{#2}%RW*eWagainrede ne\@preamblesothatacallupof\@preamblenowstartstheR\halign.vThusalsotheargumentsof>,Չ<,@and!,ՉsavedinthetokenregistersRarebinsertedintothepreamble.The\tabskipatthebGeginningandendoftheRpreambleissetto0pt(inthebGeginningbytheuseof\ialign)..NAlsothecommandR\@arstrut(isbuildin,1whichinsertsthe\@arstrutbox,de nedabGove.UcOf(course,RthelopGeningbraceafter\ialignhastobeimplicitasitwillbeclosedin\endarrayRorUUanothermacro.N168f\xdef\@preamble{\ialign\@halignto N169:\bgroup\@arstrut\@preambleN170׃\tabskip\z@\cr}%21y?RWhatgbwehavenotexplainedyetisthemacro\@haligntothatwasjustused. RDepGending{onitsreplacementtextthe\halignbecomesa\haligntohdimenci&۲.RNowweclosethegroupagain.Thus\@startpboxand\@endpboxaswellasallRtokenUUregistersgettheirformermeaningback.N171f\endgroupRT*osuppGortthedelarray.stypackqageweincludeahoGokintothispartofthecoGdeRwhichUUisano-opinthemainpackqage.N172f\@arrayleftRNowwedecidedepGendingonthepositionargumentinwhichbGoxthe\halignisRtoUUbGeput.q(\vcentermaybeusedbecauseweareinmathmode.)N173f\if#1t\vtop\else\if#1b\vbox\else\vcenter\fi\fiRNowCanotherimplicitopGeningbraceappears;P;thende nitionswhichshallstayRloGcalfollow.Whileconstructingthe\@preamblein\@mkpreamthe#signmustRbGeKhiddeninthemacro\@sharpwhichis\letto\relaxatthatmoment(seeRde nitionUUof\@mkpreamonpage14).qAllthesenowgettheiractualmeaning.N174f\bgroup N175f\let\@sharp##\let\protect\relaxRWiththeabGovede nedstrutswe xdownthedistancebGetweenrowsbysettingR\lineskip`and\baselineskipto0pt.8 Sincetherehave`tobGeset$'saroundeveryRcolumn}inthearray#{environment}theparameter\mathsurroundshouldalsobGesetRtos30pt.aThispreventss3additionalspacebGetweens3therows.ThePlainTU>'ExX{macroR\m@thUUdoGesthis.N176f\lineskip\z@ N177f\baselineskip\z@N178f\m@thRBeside,iwe2dhavetoassignaspGecialmeaning(whichwestillhavetospGecify)to Rthe`lineseparator\\.W*ealsohave`torede nethecommand\parinsuchawayRthatemptylinesin\haligncannotdoanydamage.oW*esucceedindoingsobyRchoGosing-gsomethingthatwilldisappearwhenexpanding.dxAfterthatweonlyhaveRtoUUcallup\@preambletostartthewantedUU\halign.N179f\let\\\@arraycr\let\tabularnewline\\\let\par\@empty\@preamble}f\extrarowheightRThedimenparameterusedabGovealsoneedstobeallocated.AsadefaultvqalueRweUUuse0pt,toensurecompatibilitywithstandardL5ffA͉TU>'ExX.N180\\newdimen\extrarowheight N181\\extrarowheight=0pt$\@arstrutRNowtheinsertionof\@arstrutboxthrough\@arstutiseasysinceweknowex-RactlyUUinwhichmoGdeTU>'ExXiswhileworkingonthe\halignpreamble.N182\\def\@arstrut{\unhcopy\@arstrutbox}22:y?̍R8jLThefflineseparatornn$\@arraycrRInxthemacro\@arraythelineseparator\\is\lettothecommand\@arraycr. RItsede nitionstartswithaspGecialbracewhichIezhavedirectlycopiedfromtheRoriginalde nition.EItisnecessary*,bGecausethe\futurletin\@ifnextcharmightRexpandA%afollowing&tokeninaconstructionlike\\?&.k ThiswouldotherwiseendRthealignmenttemplateatawrongtime.QOntheotherhandwehavetobGecarefulRtoavoidproGducingarealgroup,i.e.{},bGecausethecommandwillalsobeusedRforYthearrayenvironment,i.e.inmathmoGde.~Inthatcaseanextra{}wouldRproGduceIanordatomwhichcouldmessupthespacing.F*orthisreasonweuseaRcombinationthatdoGesnotreallyproduceagroupatallbutmodi esthemasterRcounterasothata&willnotbGeconsideredbelongingtothecurrent\halignwhileRweUUareloGokingfora*or[.qF*orfurtherinformationsee[2,AppendixD].N183\\def\@arraycr{\relax\iffalse{\fi\ifnum0=`}\fiRThen0wetestwhethertheuserisusingthestarformandignoreapGossiblestar(IRalsoUUdisagreewiththisproGcedure,becauseastardoesnotmakeanysensehere).N184f\@ifstar\@xarraycr\@xarraycr}\@xarraycrRInUUthecommand\@xarraycrwetestifanoptionalargumentexists.N185\\def\@xarraycr{\@ifnextchar[%RIf5itdoGes,;webranchoutintothemacro\@argarraycrifnotweclosethespGecialRbraceUU(mentionedabGove)andendtherowofthe\halignwitha\cr.N186f\@argarraycr{\ifnum0=`{}\fi\cr}}b\@argarraycrRIfadditionalspaceisrequestedbytheuserthiscaseistreatedinthemacroR\@argarraycr.gFirst6weclosethespGecialbraceandthenwetestiftheadditionalRspaceUUispGositive.N187\\def\@argarraycr[#1]{\ifnum0=`{}\fi\ifdim#1>\z@RIfZthisisthecasewecreateaninvisibleverticalrulewithdepth\dp\@arstutbox+Rhwante}'dspace[i~ղ.AThus;weachievethatallverticallinesspGeci edintheuserpream-RbleUUbya|arenowgenerallydrawn.qThentherowendswitha\cr.aIfmthespaceisnegativeweendtherowatoncewitha\crandmovebackupRwithUUa\vskip.aWhiletestingthesemacrosIfoundoutthatthe\endtemplatecreatedby\crRand&issomethinglikean\outerprimitiveandthereforeitshouldnotappGearinRincomplete\ifstatements.ThusthefollowingsolutionwaschosenwhichhidesRtheUU\crinothermacroswhenTU>'ExXisskippingconditionaltext.N188f\expandafter\@xargarraycr\else N189f\expandafter\@yargarraycr\fi{#1}} \@xargarraycr \@yargarraycrRTheUUfollowingmacroswerealreadyexplainedabGove.N190\\def\@xargarraycr#1{\unskip N191f\@tempdima#1\advance\@tempdima\dp\@arstrutboxN192f\vrule\@depth\@tempdima\@width\z@\cr}N193\\def\@yargarraycr#1{\cr\noalign{\vskip#1}}23y?R9jLSpanningffseveralcolumnsb\multicolumnRIfAseveralcolumnsshouldbGeheldtogetherwithaspecialformatthecommand R\multicolumn;mustbGeused.7xIthasthreearguments:thenumbGerofcolumnstoRbGeUUcovered;theformatfortheresultcolumnandtheactualcolumnentry*.N194\\def\multicolumn#1#2#3{%RFirstswecombinethegivennumbGerofcolumnsintoasingleone;thenwestartaRnewUUbloGcksothatthefollowingde nitioniskeptloGcal.N195jp\multispan{#1}\begingroupRSinceZa\multicolumnshouldonlydescribGetheformatofaresultcolumn,weRrede ner@\@addampinsuchawaythatonegetsanerrormessageifoneusesmoreRthanENonec,Hl,r,p,mENorbinthesecondargument.loOneshouldconsiderthatthisRde nitionmisloGcaltothebuild-upofthepreamble;anarray#{ortabular#{environmentRinC;thethirdargumentofthe\multicolumnisthereforeworkedthroughcorrectlyRasUUwell.N196jp\def\@addamp{\if@firstamp\@firstampfalse\else N197D\@preamerr5\fi}%RThenLweevqaluatethesecondargumentwiththehelpof\@mkpream.nNowwestillRhave0toinsertthecontents0ofthetokenregisterintothe\@preamble,8i.e.wehaveRtoUUsay\xdef\@preamble{\@preamble}.qThisisachievedshorterbywriting:N198jp\@mkpream{#2}\@addtopreamble\@emptyRAfterD%the\@preambleiscreatedweforgetallloGcalde nitionsandoccupationsofRtheUUtokenregisters.N199jp\endgroupRInBthespGecialsituationof\multicolumn\@preambleisnotneededaspreambleRfora\halignbutitisdirectlyinsertedintoourtable.Thusinsteadof\sharpRthereUUhastobGethecolumnentry(#3)wantedbytheuser.N200jp\def\@sharp{#3}%RNowwecanpassthe\@preambletoTU>'ExX.;F*orsafetywestartwithan\@arstrut.RThislshouldusuallybGeinthetemplateforthe rstcolumnhoweverlwedonotknowRifthistemplatewasoverwrittenbyour\multicolumn./W*ealsoadda\nullattheRright\@tempdtokenignored\ory*%3N233o<\@tempdchangedto!{..}\orLh%4N234oOnlyonecolumn-spec.allowed.\fi}\@ehc}K`%5!čR12rfdDe ningffyourowncolumnsps3eci ers=5\newcolumnRInmnewarray.stythemacroforspGecifyingnewcolumnswasnamed\newcolumn. RWhenBthefunctionalitywasaddedtoarray.stythecommandwasrenamedR\newcolumntype.^InitiallybGothnamesweresupported,"butnow(InversionsofRthisUUpackqagedistributedforL5ffA͉TU>'ExX2 b> cmmi10"()theoldnameisnotde ned.N235\hncolsiRfffr J= "5-:5LThe7co'ExXmayRbGeEused.0Thistrickwasstolenfromarray.sty2.0h.0NotethatweneedtouseRthe{ipGossiblyactivetoken,#1,in{iseveralplaces,asthatisthetokenthatactuallyRappGearsUUinthepreambleargument.N237f\edef\NC@char{\string#1}%RFirst wecheckwhetherthereisalreadyade nitionforthiscolumn. FUnlikeR\newcommandRwegiveawarningratherthananerrorifitisde ned.i|IfitisaRnewUUcolumn,add\NC@dohc}'olumnci."5tothelist\NC@list.N238f\@ifundefined{NC@find@\NC@char}% N239o {\@tfor\next:=<>clrmbp@!|\do{\if\noexpand\next\NC@charN240wf\PackageWarning{array}%N241W?{Redefiningprimitivecolumn\NC@char}\fi}%N242tJ\NC@list\expandafter{\the\NC@list\NC@do#1}}%N243o {\PackageWarning{array}{Column\NC@char\spaceisalreadydefined}}%RNowXwede neamacrowithanargumentdelimitedbythenewcolumnspGeci er, RthisUUisusedto ndoGccurencesofthisspeci erintheuserpreamble.N244f\@namedef{NC@find@\NC@char}##1#1{\NC@{##1}}%RIfUUanoptionalargumentwasnotgiven,giveadefaultargumentof0.N245f\@ifnextchar[{\newcol@{\NC@char}}{\newcol@{\NC@char}[0]}}"y\newcol@RW*egcannowde nethemacrowhichdoGestherewriting,\@reargdeftakesthesame Rargumentsas\newcommand,JbutdoGesnotcheckthatthecommandisnew.F*oraRcolumn,say`D'withoneargument,de neacommand\NC@rewrite@DwithoneRargument,cwhich-recursivelycalls\NC@findontheuserpreambleafterreplacingRthe} rsttokenorgroupwiththereplacementtextspGeci edinthe\newcolumntypeRcommand.\NC@findqVwill ndthenextoGccurrenceof`D'qOasitwillbe\letequalRtoUU\NC@find@Dby\NC@do.N246\\def\newcol@#1[#2]#3{\expandafter\@reargdef N247tJ\csnameNC@rewrite@#1\endcsname[#2]{\NC@find#3}}5`\NC@RHavingfoundanoGccurenceofthenewcolumn,jsavethepreamblebGeforetheRcolumngin\@temptokena,k|thencheckgtoseeifweareattheendofthepreamble.R(AddummyeoGccurrenceofthecolumnspeci erwillbeplacedattheendoftheRpreambleUUby\NC@do.N248\\def\NC@#1{% N249f\@temptokena\expandafter{\the\@temptokena#1}\futurelet\next\NC@ifend}$\NC@ifendRW*ecantellthatweareattheendas\NC@dowillplacea\relaxafterthedummyRcolumn.N250\\def\NC@ifend{%27NQy?RIfpweareattheend,7donothing. w(ThewholepreamblewillnowbGein R\@temptokena.) N9N251f\ifx\next\relaxN9ROtherwisesetthe ag\if@tempswa,andrewritethecolumn.\expandafterin-RtroGducedUU1nV2.01N252o \else\@tempswatrue\expandafter\NC@rewrite\fi}꫍+\NC@doRIftheuserhasspGeci ed`C'and`L'asnewcolumns,$thelistofrewrites(intheRtokenregister\NC@list)willloGoklike\NC@do?*\NC@doCl\NC@doL.SoweneedRtode ne\NC@doasaoneargumentmacrowhichinitialisestherewritingoftheRspGeci edUUcolumn.qLetusassumethat`C'istheargument.N253\\def\NC@do#1{%N9RFirstwelet\NC@rewriteand\NC@findbGe\NC@rewrite@CƲand\NC@find@Cre-RspGectively*.N254f\expandafter\let\expandafter\NC@rewrite N255o \csnameNC@rewrite@\string#1\endcsnameN256f\expandafter\let\expandafter\NC@findN257o \csnameNC@find@\string#1\endcsnameN9RClearݽthetokenregister\@temptokenaafterputtingthepresentcontentsofthe RregisterEinfrontofthetoken\NC@find.\Attheendweplacethetokens`C\relax'RwhichUU\NC@ifendwillusetodetecttheendoftheuserpreamble.N258f\expandafter\@temptokena\expandafter{\expandafter}% N259wf\expandafter\NC@find\the\@temptokena#1\relax}꫍$\showcolsRThismacroisusefulfordebugging\newcolumntypespGeci cations,Sitistheequiv-Ralent>oftheprimitive\showcommandformacrode nitions.jOAllweneedtodoisRloGcallyrede ne\NC@dototakeitsargument(say`C')ȟandthen\showthe(slightlyRmoGdi ed)tde nitionof\NC@rewrite@C.Actuallyasthethelistalwayststartso Rwith\NC@do?*andwedonotwanttoprintthede nitionofthe-form, de neR\NC@dotothrowawaythe rstiteminthelist,andthenrede neitseftoprinttheRrestUUofthede nitions.N260\\def\showcols{{\def\NC@do##1{\let\NC@do\NC@show}\the\NC@list}}꫍"y\NC@showRIfUUthecolumn`C'isde nedasabGove,UUthen\show\NC@rewrite@CwouldoutputR\long?macro:->\NC@find>{$}c<{$}.W*e%fwanttostripthelong?macro:->Randġthe\NC@find.ASo rstweuse\meaningandthenapplythemacro\NC@stripRtoUUthetokenssoproGducedandthen\typeouttherequiredstring.N261\\def\NC@show#1{% N262f\typeout{Column#1\expandafter\expandafter\expandafter\NC@stripN263f\expandafter\meaning\csnameNC@rewrite@#1\endcsname\@@}}꫍$\NC@stripRDelimitYtheargumentsto\NC@stripwith`:',`->',aYspace,and\@@topullout RtheUUrequiredpartsoftheoutputfrom\meaning.N264\\def\NC@strip#1:#2->#3#4\@@{#2->#4}"y\NC@listRAlloGcateUUthetokenregisterusedfortherewritelist.N265\\newtoks\NC@list28[wy?R12.1wThe{formuTRW*eviewthe-formasaslightgeneralisationofthesystemdescribGedinthepre- RviousUUsubsection.qTheideaistode neacolumnbyacommandoftheform:V\newcolumntype{*}[2]{% dX\count@=#1\ifnum\count@>0s\advance\count@by-1#2*{\count@}{#2}\fi} \NC@rewrite@*RThisdoGesnotworkhoweveras\newcolumntypetakesgreatcarenottoexpandRanything7Iinthepreamble,oandsothe\ifisneverexpanded.\newcolumntypeRsetsUUupvqariousotherpartsoftherewritecorrectlythoughsowecande ne:N266\\newcolumntype{*}[2]{}RNowDwemustcorrectthede nitionof\NC@rewrite@*.lFThefollowingisprobablyRmoreecientthanadirecttranslationoftheideasketchedabGove,\z@N271f\advance\count@\m@neN272f\@temptokena\expandafter{\the\@temptokena#2}%N273f\repeatR\NC@doUUwillensurethat\NC@findis\letequalto\NC@find@*.N274f\NC@find}6R12.2wMo`di cationstointernalmacrosofarray.styuT$\@xexpast $\@xexnoopRThese&macrosareusedtoexpand-formsinarray.sty.b\letthemto\relaxto RsaveUUspace.N275\\let\@xexpast\relax N276\\let\@xexnoop\relax\save@declRW*eRdonotassumethatthetokenregisterisfree,weaddthenewdeclarationstotheRfront3oftheregister.8Thisistoallowuserpreamblesoftheform,m>{foo}>{bar}...RUsers5arenotencouragedtoentersuchexpressionsdirectly*,buttheymayresultRfromUUtherewritingof\newcolumntype's.N277\\def\save@decl{\toks\count@=\expandafter\expandafter\expandafter N278L{\expandafter\@nextchar\the\toks\count@}}29hy?$\@mkpreamRThemainmoGdi cationto\@mkpreamistoreplacethecallto\@xexpast(which RexpandedUU-forms)byaloGopwhichexpandsall\newcolumntypespGeci ers.N279\\def\@mkpream#1{\gdef\@preamble{}\@lastchclass4\@firstamptrue N280js\let\@sharp\relax\let\@startpbox\relax\let\@endpbox\relaxRNowE)weremovepGossible-formsanduser-de nedcolumnspeci ersintheuserRpreamblebyrepGeatedlyexecutingthelist\NC@listuntilthere-writeshaveRnomoree ect. TheexpandedpreamblewillthenbGeinthetokenregisterR\@temptokena.qActuallyUUweneedtoknowatthispGointthatthisisnot\toks0.N281js\@temptokena{#1}\@tempswatrue N282js\@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}%RAfterwards1weinitializeallregistersandmacros,8thatweneedforthebuild-upofRtheUUpreamble.N283js\count@\m@ne N284js\let\the@toks\relaxN285js\prepnext@tokRHavingyexpandedalltokensde nedusing\newcolumntype(including*),weevqal- Ruate/theremainingtokens,6which/aresaved/in\@temptokena.eW*eusetheL5ffA͉TU>'ExX{RmacroUU\@tfortoinspGecteachtokeninturn.N286js\expandafter\@tfor\expandafter\@nextchar N287o \expandafter:\expandafter=\the\@temptokena\doR\@testpatchUUdoGesnottakeanargumentsincearray.sty2.0h.N288js{\@testpachN289js\ifcase\@chclass\@classz\or\@classi\or\@classiiN290tJ\or\save@decl\or\or\@classv\or\@classviN291tJ\or\@classvii\or\@classviiiRInUUnewarray.styclass9isequivqalenttoclass10.N292tJ\or\@classxN293tJ\or\@classx\fiN294js\@lastchclass\@chclass}%N295js\ifcase\@lastchclassN296js\@acol\orN297js\orN298js\@acol\orN299js\@preamerr\thr@@\orN300js\@preamerr\tw@\@addtopreamble\@sharp\orN301js\orN302js\else s.\@preamerr\@ne\fiN303js\def\the@toks{\the\toks}}$\@classixRarray.sty߲doGesnotallowrepeated>declarationsforthesamecolumn.eThisis Rallowedinnewarray.styasdoGcumentedintheintroGduction.'RemovingthetestRforEwthiscasemakesclass9equivqalenttoclass10,Handsothismacroisredundant.RItUUis\letto\relaxtosaveUUspace.N304\\let\@classix\relax30rڠy?L\@classviiiRInnewarray.styexplicitlyallowclass2,GasrepGeated\z@\ifnum\@lastchclass=\tw@\else N306y8\@preamerr4\@chclass6\@classvi\fi\fi}"y\@classvRClass`5is@-expressions(andisalsocalledbyclass1)ThismacrowasincorrectinRV*ersionN1.oNowwedonotexpandthe@-expression,P6butinsteadexplicitlyreplaceRan@\extracolsepcommandbyanassignmentto\tabskipbyamethoGdsimilarRtoythe\newcolumntypesystemdescribGedabove.P\d@llarbeginy\d@llarendwereRintroGducedUUinV2.01tomatcharray.sty2.0h.N307\\def\@classv{\save@decl N308js\expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@@N309js\@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}%N310js\prepnext@tok}'3P\NC@ecsRRewriteithe rstoGccurrenceof\extracolsep{1in}to\tabskip1in\relax.4As Ra5sidee ectdiscardanytokensafterasecond\extracolsep,<0thereisnopGointinRtheguserenteringtwoofthesecommandsanyway*,0sothisisnotreallyarestriction.N311\\def\NC@ecs#1\extracolsep#2#3\extracolsep#4\@@@{\def\@tempa{#2}% N312f\ifx\@tempa\@empty\else\toks\count@={#1\tabskip#2\relax#3}\fi}N313\h=ncolsi6R12.3wSupp`ortforthedelarray.styuTRTheldelarray.stypackqageextendsthearraysyntaxbysuppGortingthenotation Rof|delimiters.=T*othisendweextendthearrayparsingmechanismtoincludeaRhoGokfwhichcanbeusedbythis(oranother)packqagetodosomeadditionalparsing.\@tabarrayRThis׳macrotestsforanoptionalbracket׳andthencallsup\@@arrayorR\@@array[c]UU(asdefault).N314\hpack9age#g i N315\\def\@tabarray{\@ifnextchar[{\@@array}{\@@array[c]}}"y\@@arrayRThis0macrotestscouldthentestanoptionaldelimiterbGeforetheleftbraceoftheRmainTpreambleargument.thisrowwecalculate\backup@lengthtobGetheheightplusdepthofaRstandard,Kline.Inadditionwehavetoaddthewidthofthe\hline,bsomethingRthatUUwasforgottenintheoriginalde nition.N325o \global\backup@length\ht\@arstrutbox N326o \global\advance\backup@length\dp\@arstrutboxN327o \global\advance\backup@length\arrayrulewidthRFinally%wedowanttomaketheheightofthis rstlinebGeabitlargerthanusual, Rforthisweplacethestandardarraystrutintoitbutraisedby\extratabsurroundN328tJ\raise\extratabsurround\copy\@arstrutboxRHaving5doneallthisweendthelineandbackupbythevqalueof\backup@length RandJthen nallyplaceour\hline.n8ThisshouldplacethelineexactlyattherightRplace0XbutkeepthereferencepGointofthewholetabularatthebaselineofthe rstRrow.N329o }\\[-\backup@length]\hline N330\}U\lasthlineRF*orv\lasthlinethesituationisevenworseandIPgotitcompletelywronginitially*.aThe?probleminthiscaseisthatiftheoptionalargument[b]isusedwedoRwant5thereferencepGointofthetabularbeatthebaselineofthelastrowbutattheRsametimedowantthethedepthofthislastlineincreasedby\extratabsurroundRwithoutUUchangingtheplacement\hline.aW*eUUstartbyplacingtherulefollowedbyaninvisiblerow.N331\\newcommand{\lasthline}{\hline\multicolumn1c{%RW*e&nowcalculate\backup@lengthtobGetheheightanddepthoftwolinesplusRtheUUwidthoftherule.N332o \global\backup@length2\ht\@arstrutbox N333o \global\advance\backup@length2\dp\@arstrutboxN334o \global\advance\backup@length\arrayrulewidth32!y?RThisUUwillbringusbacktothebaselineofthesecondlastrow:N335o }\\[-\backup@length]%RThus+ifwenowaddanotherinvisiblerowthereferencepGointofthatrowwillbGe RatǓthebaselineofthelastrow(andwillbGethereferenceforthewholetabular).RSinceUUthisrowisinvisiblewecanenlargeitsdepthbythedesiredamount.N336o \multicolumn1c{% N337}\lower\extratabsurround\copy\@arstrutboxN338}}%N339\}6R12.5wGettingthespacingaroundrulesrightuTRBeside'nalargerfunctionalityJarray.styhasoneimpGortantdi erencetothestan- Rdardvtabularandarrayenvironments:5horizontalvandverticalrulesmakeatableRlargerborwider,fXe.g.,\doublerulesepbreallydenotesthespacebGetweenbtworulesRandUUisn'tmeasuredfromthemiddleoftherules."y\@xhlineRF*orDverticalrulesthisisimplementedbythede nitionsabGove,forhorizontalrulesRweUUhavetotakeoutthebackspace.N340\\CheckCommand*\@xhline{\ifx\reserved@a\hline N341\vskip\doublerulesepN342\vskip-\arrayrulewidthN343Y\fiN344y8\ifnum0=`{\fi}}N345\\renewcommand*\@xhline{\ifx\reserved@a\hlineN346\vskip\doublerulesepN347Y\fiN348y8\ifnum0=`{\fi}}N349\h=pack9age#g i!čRIndexRNumbGerswritteninitalicrefertothepagewherethecorrespondingentryisde- RscribGed,Dthe onesunderlinedtothecodelineofthede nition,DtheresttothecodeRlinesUUwheretheentryisused.^0vmJSymCbKols R\@@57,۵68,69,85,263,264R\@@@L}.΍}.}.}.}.}.}.}.}. 308,T311R\@@array}.΍}.}.}.}. 315,T316Tfe R\@@endpbox@0}.΍}.}.}.}.}.}.225R\@acolP}.΍}.}.}.}.}.80fe ?$,T98, p100,109,112,p139,'%141,296,298 R\@acolampacol- }.΍}.}.}.}.p}.΍}.}.}.}. )N80 )Nfe ?iJ,T108,110^0˪\@addamp}.΍}.}.}.}.}.}.}.}. 77fe ?,J82,109,113,196 *˪\@addtopreamblez}.΍}.}..T31.Tfe ?nP,T79,81,102,骬118,135,140,骬147,'%198,300,309˪\@ampacoll}.΍}.}.}.}.}.}.}.221˪\@argarraycrYҍ}.΍}. 186,T187Tfe ˪\@argtabularcrB}.΍}.}.}.226˪\@arrayƈ}.΍}.}.J159Jfe D,T209,316^0EUX\@arrayacol}.΍}.}.}.}.}.}.224 4:EUX\@arrayclassivB}.΍}.}.}.222EUX\@arrayclassz- }.΍}.}.}.}.222EUX\@arraycrl}.΍}.}.}. 179,T183Tfe EUX\@arrayleft}.΍}.}. 172,T318EUX\@arrayparboxrestore cUX}.΍}.}.}.}.}.}.}.}.}.}. J153EUX\@arrayrightYҍ}.΍}.}.}.}.}.317Пfe EUX\@arrayrule}.΍}.}. 135 fe ,T150EUX\@arstrutl}.J169,T182Tfe N,T20133"y?R\@arstrutboxYҍ}.΍}. B155, p158,162,182,p191,325,326,p328,'%332,333,337 UR\@chclassl}.΍}.}.28fe ?$,T32,p44,v55,92,96,p134,'%289,294,306R\@chnumƈ}.΍}.}.}.}.}.}. r28 rfe ?n,p33,40,51,118,150R\@classi}.΍}. iH92,T149Tfe N,T289R\@classiil}. iH92,T144Tfe N,T289R\@classiii@0}.΍}.}.}.}.}.}.144Пfe R\@classixl}. iH94,T130Tfe N,T304Tfe R\@classv}.΍}.}.}.}.}. r93,p146pfe },'%151,290,307fe R\@classvil}.΍}. 93,T134,p138pfe },'%149,290,306R\@classvii@0}.΍}.}.}.}.}.}.p}. r94,T136Tfe N,T142,291R\@classviii}.΍}.}.}.}.}.}.p}. r94,T133Tfe N,T291,305fe R\@classx}.΍}.}. 95,T106Tfe N,p115,'%132,292,293R\@classz}.΍}. iH92,T115Tfe N,T289R\@emptyƈ}.΍}.}.}.}.}. B179,p198,'%312,318,319R\@endpboxl}.΍}.}.}.}. r84,p126{128,31583fe ,3280R\@expast}.΍}.}.}.}.}.}.}.}.221R\@finalstrutYҍ}.΍}.}.}.}.}.158R\@firstampfalsez}.΍}.}.p}.΍}.}.}.}. )N78,T112,196R\@firstamptrueB}. $83,T279R\@halignto@0}.΍}.}. B168,p204pfe },'%207,210,212R\@iffirstampYҍ}.΍}.}.}.}.}. 77R\@lastchclass- }.΍}. r28 rfe ?n,p33{36,38,83,p96,a797,107,130,p133,136,138,p279,'%294,295,305R\@mkpreaml}.΍}.}.}.}.}.}.}.p}. r83 rfe ?n,T167,198,279fe R\@namedefl}.΍}.}.}. 244,T267R\@nextchar39,T41{43,p45{49,G252{54,p72, 89,126{128,p229,'%278,286,308˪\@preamble@0}.΍}.31,T83, 骬168,169,179,骬201,'%218,279,317 ˪\@preamerr@0}.΍}.}.}.}.}.}.骬}.΍}. =55,T101,102,骬104,131,134,骬137,197,227fe ,骬299,'%300,302,306˪\@reargdef@0}.΍}.}.}.}.}.}.246˪\@sharpƈ}. 73 fe ?,T84,102,骬175,'%200,280,300˪\@startpbox}.΍}.}.}. r84,骬126{128,31523fe ,3280˪\@tabacoll}.΍}.}.}.}.}.}.}.224˪\@tabarray@0}.΍}.}.}.}.}.}.骬}. 5t208,T209Tfe N,T217,314fe ˪\@tabclassivYҍ}.΍}.}.}.}.}.223˪\@tabclassz}.΍}.}.}.}.}.}.223˪\@tabularl}.J210,T212,213fe ˪\@tabularcr}.΍}.}.}.}.}.}.225˪\@tempswafalseB}.΍}.}.}.282˪\@tempswatrue- }. 252,T281˪\@temptokenaYҍ}.΍}.}.}.}.}.59,,66,249,258,骬259,'%272,281,287˪\@testpach@0}. |x32 |xfe ?t,T91,288˪\@tforP}.΍}.}.}. iH89,T239,286˪\@whileswl}.΍}.}.}.}.}.}.}.282˪\@xargarraycr- }. 188,T190Tfe ˪\@xarraycr@0}.΍}.}. 184,T185Tfe ˪\@xexnoopl}.΍}. |x65,T69Tfe ? UP,T275Tfe ˪\@xexpastl}.΍}. |x57 |xfe ?t,T85,275fe ˪\@xhline}.΍}.}.}.}.}.}.}.}.340Пfe ˪\@xtabularcrYҍ}.΍}.}.}.}.}.226˪\@yargarraycr- }. 189,T190Tfe >E{eA˪\arrayP}.΍}.}.}.}.}.}.}.}.}.}.206Пfe ˪\arraycolsepYҍ}.΍}.}.}.}.}.206˪\arrayrulewidthz}.΍}.}.骬}.΍}.}.}. 327,T334,342˪\arraystretch- }. 163,T164˪\AtBeginDocument}.΍}.}. 5>ENB˪\backup@lengthB}.΍}.}.}.骬}.΍}.}.}. 4322 4fe .,T325{骬327,3329,332{335˪\beginP}.΍}.}.}.}.}.}.}.}.}.}. 21˪\bottomfractionz}.΍}.}. 10yR(C EUX\CheckCommand- }.΍}.}.}.}.340EUX\CodelineIndexB}.΍}.}.}. 17EUX\col@sep}.΍}. iH80 iHfe ?D,T206,215EUX\copy }.΍}.}.}.}.}.}.}. 328,T337EUX\count@ƈ}.΍}. L70,T70Tfe ? UP,T71,cUX72,76,86,116,cUX144,147,268,cUX270,271,277,cUX278,'%283,309,312y>DEUX\d@llarbeginYҍ}.΍}. B120,cUX123,124,147,cUX204cUXfe q5R,'%207,215,309EUX\d@llarend@0}.΍}.}.}.}.}.}.cUX}. 1122{124,T147,cUX204cUXfe q5R,'%207,216,309EUX\DeleteShortVerb}.΍}.}. 5EUX\DisableCrossrefsyꍑ}. 13EUX\DocInputl}.΍}.}.}.}.}.}.}. 22EUX\documentclassB}.΍}.}.}.}. 3EUX\doublerulesepB}.΍}.}.}.cUX}.΍}.}.}. 140,T341,346yEEUX\EnableCrossrefs}.΍}. 12EUX\endL}.΍}.}.}.}.}.}.}.}.}.}.}.}. 23EUX\endarrayl}.J218Jfe D,T219,317fe EUX\endgroupl}.΍}.}.}.}.}.}.}.cUX}. 5t171,T199,205,216EUX\endtabular}.΍}.}.}.}.}.}.219Пfe EUX\endtabular*Yҍ}.΍}.}.}.}.}.219Пfe EUX\everyparl}.΍}.}.}. 154,T156EUX\extracolsepYҍ}.΍}. 308,T311EUX\extrarowheightz}.΍}.}.cUX}.΍}.}.}.}.}. #8j cmti91,T161,180fe EUX\extratabsurroundyꍑ}.cUX}.΍}. ϸ5,T320Tfe N,T328,337yFEUX\firsthline}.΍}.}.}.}. j5,T323Tfe EUX\futurelet@0}.΍}.}.}.}.}.}.249xgGEUX\global0325{327,T332{334yHEUX\hline 329,T331,340,345{(IEUX\ialignƈ}.΍}.}.}.}.}.}.}.}.}.16834#y?R\if@firstampYҍ}.΍}.}. $78,T196 R\if@tempswa}.΍}.}.}.}.}.}.282R\iffalse}.΍}.}.}.}.}.}.}.}.183R\insert@columnB}.΍}.}.}.p}.΍}.}.}.}. 73 fe ?^,T121,p123,3124,126{128LR\lasthline@0}.΍}.}.}.}. j5,T331Tfe R\long }.΍}.}.}.}.}.}.}.}.}.}.}.267R\loop }.΍}.}.}.}.}.}.}.}.}.}.}.269R\lowerP}.΍}.}.}.}.}.}.}.}.}.}.337BMR\m@th }.΍}.}.}.}.}.}.}.}.}.}.}.178R\meaning}.΍}.}.}.}.}.}.}.}.263R\multicolumnYҍ}.΍}.}.}.}.}.p}. 5t194 5tfe n,T324,331,336uNR\NC@L}.΍}.}.}.}.}.}.}.}. 244,T248Tfe R\NC@char}.΍}.}.}.}. 237{p239,3241,243{245R\NC@doP}.΍}.}.}.J242,T253Tfe N,T260R\NC@ecsƈ}.΍}.}.}.}.}. 308,T311Tfe R\NC@find}.΍}.}.}.}.}.}.}.}.p}. 5t247,T256,259,274R\NC@ifendl}.΍}.}.}. 249,T250Tfe R\NC@list}.΍}.}.}.}.}.}.}.}.p}. 5t242,T260,265fe N,282˪\NC@rewrite}.΍}.}. 252,T254 %퍒˪\NC@rewrite@*- }.΍}.}.}.}.266Пfe ˪\NC@show}.΍}.}.}.}. 260,T261Tfe ˪\NC@stripl}.΍}.}.}. 262,T264Tfe ˪\NeedsTeXFormatz}.΍}.2,T26˪\newcol@}.΍}.}.}.}. 245,T246Tfe ˪\newcolumn@0}.΍}.}.}.}.}.}.235Пfe ˪\newcolumntypeB}.΍}.}.}. 骬}.΍}.}.}.}.}. #3,T236Tfe N,T266˪\newcommand}.΍}.}. 323,T331˪\newifP}.΍}.}.}.}.}.}.}.}.}.}. 77˪\newlength@0}.΍}.}. 320,T322˪\newtoks}.΍}.}.}.}.}.}.}.}.265˪\next }.΍}.}.}.}.J239,T249,251˪\noexpandl}.΍}.}.}.}.}.}.}.239˪\null }.΍}.}.}.}.}.}.}.}.}.}.}.202qǍO˪\OldMakeindex- }.΍}.}.}.}. 20˪\OnlyDescription}.΍}. 19,P˪\PackageError- }.΍}.}.}.}.228˪\PackageWarningc240,T243˪\parL}.΍}.}.}.}.}.}.}.}.}.}.}.}.179˪\prepnext@tok- }.΍}.}.}.}. 70Οfe ?Z,,88,117,129,骬145,'%148,285,310 %퍒˪\protect}.΍}.}.}.}.}.}.}.}.175EUX\ProvidesPackage}.΍}. 27Iy--R nEUX\raiseP}.΍}.}.}.}.}.}.}.}.}.}.328EUX\RecordChangesB}.΍}.}.}. 15EUX\renewcommand- }.΍}. $10,T345EUX\repeatƈ}.΍}.}.}.}.}.}.}.}.}.273EUX\reserved@a}.΍}.}. 340,T345z5[SEUX\save@decl72fe ? ,j93,145, cUX146,'%277'%fe ,'%290,307EUX\setlength@0}.΍}.}.}.}.}.}.321EUX\showcolsl}.΍}.}.}.}.}. j4,T260Tfe EUX\string X39,T237,255,257yvlTEUX\tabcolsep@0}.΍}.}.}.}.}.}.215EUX\tabular}.΍}.}.}.}.}.}.}.}.210Пfe EUX\tabular*l}.΍}.}.}.}.}.}.}.210Пfe EUX\tabularnewlinez}.΍}.}.179EUX\the@toksl}.΍}.}.}.}.}.}.}. cUX}. #57 #fe ?c,T74,76,83fe ? UP,cUX147,'%284,303,309 nEUX\the@toksz@0}.΍}.}.}.}.}.}. 57 Οfe ?yUEUX\usepackage}.΍}.}.}.}.}.}.}. 7!čRReferencesR[1]a;M.WGoossens,7F.Mittelbach andA.WSamarin.TheL5ffA͉TU>'ExXCompanion. a;Addison-W*esley,UUReading,Massachusetts,UU1994.R[2]a;D.E.Knuth.TheTU>'ExXbGook(Computers&TypesettingV*olumeA).Addison-a;W*esley,UUReading,Massachusetts,UU1986.R[3]a;L.|LamporUTt.pL5ffA͉TU>'ExX|ADoGcumentPreparationSystem.Addison-W*esley,a;Reading,UUMassachusetts,1986.35`;y #8j cmti97 cmmi10K`y cmr10ٓRcmr7=