; TeX output 1998.01.17:2004y?. DtGGcmr17The7tGGcmss17dcolumnpacqkage!", cmsy10XQ cmr12DarvidCarlisle37 1996/09/23.!Kt : cmbx9Abstractэxo cmr9Thispac9k|ragede nesasystemforde ningcolumnsofentriesinanߤN cmtt9array korTtabularwhic9haretobAealignedona`decimalpoin9t'.aK`y cmr10ThisUUpackqagede nestakesasingleargumentspGecifyingthenumbGerofdecimalplaces,xKandtheR.texUU leshoulduse.,withbGeingusedintheoutput.R\newcolumntype{.}{D{.}{.}{-1}}a.qDzspGeci esUUacolumnofentriestobecentredonthe b> cmmi10:.R\newcolumntype{,}{D{,}{,}{2}}a,=spGeci es7takesacolumnofentrieswithatmosttwodecimalplacesaftera;.aTheUUfollowingtablebGegins\begin{tabular}{|d{-1}|d{2}|.|,|}RJffr @ -:q% cmsy6L|{Ycmr8ThisX lehasvÎersionnumbwhichhadanegativehde}'cimal*plac}'es!iLGargumentis Rwider]thanthesecondcolumn, sothatthedecimalpGointappearsinthemiddleofRtheUUcolumn.aAlsoknotethatthispackqagedealscorrectlywithentrieswithnodecimalpart,RnoUUintegerpart,andblankentries.aIfjyouhavetableheadings(insertedwith\multicolumn{1}{c}{..}toover-RrideqtheDKcolumntypGe)thenitmaybGethatneitheroftheaboveq`centred'or`rightRaligned'UUformsisquitewhatyouwant.RLτffŸ1headffahead Lτffkhead LτffRLτ ff111 5" cmmi9:2:? ff1,:2^rLτ ffD1:2Lτ ff RLτ ff1112121:2:? ff 11212,:2^rLτ ff11212:2Lτ ffRLτ ff1:4:? ff,:4^rLτ ff:4Lτ ff𖰤Lτff1wideTheadingff8SdwideTheadingLτffywideTheadingLτff𖰟Lτ ff11 w1:2@ ffaq1f:2sCLLτ ff81:2Lτ ff 𖰟Lτ ff w1:4@ fff:4sCLLτ ff:4Lτ ff7>aIn\bGothofthesetablesthe rstcolumnissetwithD{.}{.}{-1}toproduceRa2columncenteredonthe.,jKandthesecondcolumnissetwithD{.}{.}{1}toRproGduceUUarightalignedcolumn.aTheIcenteredcolumnproGducescolumnsthatarewiderthannecessaryto tinRthednumbGersunderaheadingasithastoensurethatthedecimalpointiscentred.RTherightalignedcolumntwodoGesnothavethisdrawback,#butunderawideRheadingUUacolumnofsmallrightaligned guresloGoksabitodd.aInversionv1.03athirdalternativeisintroGduced.]Thethirdhde}'cimal+plac}'es!iRargument\mayspGecifyb}'othۿthenumbGerofdigitstotheleftandtotherightoftheRdecimalplace.,Thethirdcolumninthe rsttablesabGoveissetwithD{.}{.}{5.1}RandXGinthesecondtable,YD{.}{.}{1.1},toXGspGecify` veplacestotheleftandoneRtotheright'and`oneplacetotheleftandonetotheright'respGectively*.(YouRmayJuse`,'Gorothertokens,Gnotnecessarily`.'%inthisargument.)%ThecolumnofR gures CisthenpGositionedsuchthatanumbGerwiththespeci ednumbers CofdigitsRisUUcentredinthecolumn.!čR#Nff cmbx121jLTheffMacrosUsٓRcmr71\! cmsy9h$ow cmss9pack9age#g iaFirstUUweloadarray.styifitnotalreadyloaded. Us2\\RequirePackage{array}aThebasicideasbGehindthesemacrosareexplainedinthedocumentationforRarray.sty.dHowever-theyusethreetrickswhichmaybGeusefulinothercontexts.akTheseparatorissurroundedinextra{?},5gsothatitissetwith\mathordkspacing,UUotherwise,forinstancea`,'wouldhaveextraspaceafterit.2 ʠy?akThenseparatorisnotgivenitsspGecialde nitionbymakingitactive,t-asthis kwouldSnotworkforanentrysuchas&?.5&,MasSthe rsttokenofanalignmentkentryisreadb}'eforeURthepreamblepart,incaseitisan\omit,inwhichcasektheJpreambleistobGeomitted.QInsteadweswitchthemathcoGdeto(hex)k8000,UUwhichmakesthetokenactasifitwereactive.akAlthoughm\mathcode`.="8000makes.Z$actasifitwereactive,itisstillnotkallowedrinconstructionssuchas\def.{},yeveninmath-moGde,ysowehavektoconstructanactiveversionoftheseparator, thisisdonebymakingitthekuppGercaseUUof~,andthenusingtheconstructk\uppercase{\def~}{hde nitionci1k}.kNotethatthehde nitionci9۲isnotuppGercased, Qsothede nitioncanrefertoktheUUstandard,non-activeuseoftheseparator.5`\DC@RSet.upuppGercasetablesasrequired,6handthengrabthe rstpartofthenumericalRargumentUUinto\count@.Us3\\def\DC@#1#2#3{% Us4f\uccode`\~=`#1\relaxUs5f\m@thUs6f\afterassignment\DC@x\count@#3\relax{#1}{#2}}0|\DC@xRIfY\count@isnegative,[centreYonthedecimalpGoint.aIfitispositiveeither#1will RbGe5emptyinwhichcasebadoutdecimalparttothenumbGerofdigitsspeci edRbyz\count@or(newfeatureinv1.03)itisnoneemptyinwhichcase\count@Rcontains thenumbGerofdigitstotheleftofthepoint,and#1containsajunktokenR(probablyt.)followedtbythenumbGerofdigitstotherightofthepGoint.IneitherRofUUtheselattercases,\DC@rightisused.Us7\\def\DC@x#1\relax#2#3{% Us8f\ifnum\z@>\count@Us9o\expandafter\DC@centreR10f\elseR11o\expandafter\DC@rightR12f\fiR13f{#2}{#3}{#1}}\DC@centreRIfUUcenteringonthedecimalpGoint,justneedtobGoxupthetwohalves.R14\\def\DC@centre#1#2#3{%R15f\let\DC@end\DC@endcentreR16f\uppercase{\def~}{$\egroup\setbox\tw@=\hbox\bgroup${#2}}%R17f\setbox\tw@=\hbox{${\phantom{{#2}}}$}%R18f\setbox\z@=\hbox\bgroup$\mathcode`#1="8000} \DC@endcentreRand)thenpadoutthesmallerofthetwo)bGoxessothereisthesameamountofstu ReitherUUsideofthepGoint.R19\\def\DC@endcentre{$\egroupR20o\ifdim\wd\z@>\wd\tw@R21y2\setbox\tw@=\hboxto\wd\z@{\unhbox\tw@\hfill}%R22o\else3{y?R23y2\setbox\z@=\hboxto\wd\tw@{\hfill\unhbox\z@}\fi R24o\box\z@\box\tw@}$\DC@rightRThisdealswithbGoththecaseswhereaspeci ednumberofdecimalplacesisgiven.R25\\def\DC@right#1#2#3{%R26f\ifx\relax#3\relaxRIf#3isempty*,ݹadd\hfilltorightalignthecolumn,ݹandJustset\DC@rltobGegin RaUUgroup,sonothingfancyisdonewiththewholenumbGerUUpart.R27o\hfillR28o\let\DC@rl\bgroupR29f\elseROtherwisemset\DC@rlsothatthewholenumbGermpartisputinabox\count@ Rtimes)aswideasadigit.c5InordertosharecoGdewiththeotherbranch,2]thenmoveR#3|(thenumbGer|ofdecimalplaces)into\count@throwingawaythe`.'=fromtheRuserUUsyntax.R30o\edef\DC@rl{to\the\count@\dimen@ii\bgroup\hss\hfill}% R31o\count@\@gobble#3\relaxR32f\fiR33f\let\DC@end\DC@endrightRBox2containsthedecimalpart,setto\dimen@whichiscalculatedbGelowtobGe R\count@UUtimesthewidthofadigit,plusthewithofthe`decimalpGoint'.R34f\uppercase{\def~}{$\egroup\setbox\tw@\hboxto\dimen@\bgroup${#2}}%R35jp\setbox\z@\hbox{$1$}\dimen@ii\wd\z@R36jp\dimen@\count@\dimen@iiR37jp\setbox\z@\hbox{${#2}$}\advance\dimen@\wd\z@R38jp\setbox\tw@\hboxto\dimen@{}%RBoxwA0containsthewholenumbGerpart,eitherjustatitsnaturalsizeforright Raligned5columns,orsetto(theoldvqalueof)\count@timesthewidthofadigit.R\DC@rlUUde nedabGoveUUdeterminesthetwoUUcases.R39jp\setbox\z@\hbox\DC@rl$\mathcode`#1="8000}b\DC@endrightRJustUU nisho thesecondbGox,andthenputoutbothboxes.R40\\def\DC@endright{$\hfil\egroup\box\z@\box\tw@}CDRTheuserinterface,,Ode netheDͼcolumntotakethreearguments. F*orspGecial RpurpGoses,youmayneedtodirectlyaccess\DC@ratherthantheDʲcolumn,egtoRgetUUabGoldversionyoucoulduseV\newcolumntype{E}[3]{>{\boldmath\DC@{#1}{#2}{#3}}c<{\DC@end}}R41\\newcolumntype{D}[3]{>{\DC@{#1}{#2}{#3}}c<{\DC@end}}R42\h=pack9age#g i4*n;y $ow cmss9#Nff cmbx12! cmsy9 5" cmmi9': cmti10 cmmi10K`y cmr10ٓRcmr74