; TeX output 1996.03.05:1600soybNDtGGcmr17An7tImproqvedEnvironmentforFloats!", cmsy10rXQ cmr12AnselmLingnau,߆T cmtt12lingnau@tm.informatik.uni-frankfurt.de&37 1995/03/29.!Kt : cmbx9Abstractэoo cmr9Thisst9yleoptionimprovestheinterfaceforde ning oatingobjectssuch basD guresandtablesinL5Aacmr6A TuAEX.7Itaddsthenotionofa` oatst9yle'thatbgo9verns{zappAearanceof oats.NNewkindsof oatsma9ybede nedusingba/!ߤN cmtt9\newfloatcommandanalogousto\newtheorem.Thisst9yleoptionalsobincorpAoratesthefunctionalit9yofDavidCarlisle'sstyleoption"ow cmss9here,-givingb oatingen9vironmentsa[H]ɤoptionwhichmeans`PUTɤITHERE'(asop-bpAosed1tothestandard[h]optionwhic9hmeans`Y:oumayputithereifyoublik9e').!čI$Nff cmbx121aLIntros3ductionIK`y cmr10AmongthefeaturesofL5ffٓRcmr7A͉TU>'ExXare` oating' guresandtablesthatdriftfromwhere Ithey&appGearintheinputtextto,%say*,the&topofapage.f9Thecontentsandfor-Imatting1of oatsisprettymuchuptotheuser,(exceptthatthereisa%'ExXuser.XInCthisstyleoption,GICpresentaninterfaceto oatingob8jectsthatattemptstoI xSsomeoftheseshortcomings.<Firstofall,ԇI*introGducethenotionofa` oatstyle'.IA oatstylegovernstheappGearanceofaclassof oatslikeapagestylegovernstheIappGearanceMpofapage(L5ffA͉TU>'ExXhaspagestylesplain,Oemptyandheadings,amongIothers).qThisUUstyleoptionprovidessomeexemplary oatstyles:I&"V cmbx10plainfThisisthe oatstylethatL5ffA͉TU>'ExXnormallyappliestoits oats,i.e.,nothingbinparticular.%Theonlydi erenceisthatthecaptioncomesout'': cmti10b}'elowFthebbGodyUUofthe oat,regardlessofwhereitisgiveninthetext.IbQo9xedk/TheubGodyofthe oatisprintedinsideabox.H}ThecaptiongoesbelowthatbbGox.IruledgThis oatstyleispatternedonthetablestyleof(p0J cmsl10ConcreteMathematics.bThencaptionisprintedatthetopofthe oat,tsurroundedbyrules;{TanotherbruleUU nisheso the oat.1*so:&IoϧcǍProgramJ1.1The rstprogram.dThishasn'tgotanythingtodowiththestyle butUUisincludedasanexample.qNotetheruled oatstyle.X-ffc#includeintmain(intargc,char**argv) {%̰inti;%̰for(i=0;i'ExX.!čI2aLTheffUserInterface|NewFloatsIThe;mostimpGortantcommandin oatisthe\newfloatcommand.PAsmentionedy\newfloatIabGove,itTispatternedon\newtheorem.The\newfloatcommandtakesthreeIrequiredUUandoneoptionalargument;itisoftheformS\newfloat{ !", cmsy10htyp}'e[i%}{hplac}'ementظi3=}{hextظiI}[hwithinci#`]Ihtyp}'e[ie:isthe`typGe'ofthenewclassof oats,likeprogramoralgorithm.@Afterthe Iappropriate\newfloat,commandslike\begin{program}or\end{algorithm*}IwillbGeavqailable.5hplac}'ementظi:givesthedefaultplacementparametersforthisclassIofS oats.WTheplacementparametersarethesameasinstandardL5ffA͉TU>'ExX,i.e.,t,Ib,wFpp|andhfor`top',`bGottom',`page'and`here',respGectively*.'ExXwritesItheȀcaptionstoanauxiliary leforthelistof gures(orwhatever),Jit'llusetheIjob)namefollowed)byhextظiasa lename.MFinally*,2theoptionalargumenthwithinciIdetermineswhether oatsofthisclasswillbGenumberedwithinsomesectionalunitIofw?thedoGcument.ׄF*orexample,ifhwithinci& =chapter,the oatswillbGenumberedIwithinchapters.(InstandardL5ffA͉TU>'ExX,thishappGenswith guresandtablesintheIrepGortandbookdocumentstyles.)IRAsanexample,L$Ew3%ffi͠fufuffLƍ̍. b> cmmi10n͟ ff@E^u cmex10<$Gn 卑Hw0MS^aSǟ^<$h;n 卑i01n՟^ I^<$in 卒 2jW^˟^<$#?n 卒3#ٟ^ÀM^<$n 卒]4[^9ϟ^<$Cn 卒5ݟ^Q^<$ Oŵn 卒 6P_^%ӟ^<$- Gn 卒-73 ^( nff̪fdM0M ff[1 M1M ff[1@1M2M ff[1@2aP_1M3M ff[1@3aP_3 1M4M ff[1@4aP_6 4c1M5M ff[1@5^^1010c5|1M6M ff[1@6^^1520Cb15|66g1M7M ff[1@7^^2135Cb35216g71ifuffffffi͎ǍtjT ableT1:qDzPascal'sUUtriangle.Thisisare-styledL5ffA͉TU>'ExXtable.rhUUb\floatstyle{ruled} b\newfloat{Program}{tbp}{lop}[section]b...loadsUUo'stu ...b\begin{Program}b\begin{verbatim}b...programUUtext...b\end{verbatim}b\caption{...captionUU...}b\end{Program}*IExampleV2.1:Thisisanothersilly oatingExample. 4ExceptthatthisoneIdoGesn'tBactually oatbecauseitusesthe[H]+optionalparametertoappearHere.I(Gotcha.)XThe\floatstylecommandsetsadefault oatstyle.This oatstylewillbGe \floatstyle Iusedforallthe oatsthataresubsequentlyde nedusing\newfloat,|untilanotherI\floatstyleAcommandappGears.The\floatstylecommandtakesoneargument,Ithe,nameofa oatstyle.dF*orinstance,4J\floatstyle{ruled}.SpGecifyingastringIthatUUdoGesnotnameavqalid oatstyleisanerror.XThe \floatnamecommandletsyoude nethe o}'atname{thatL5ffA͉TU>'ExXuses$\floatnameIin&0thecaptionofa oat,fi.e.,`Figure'&0fora gureandsoon. WF*orexample,I\floatname{program}{Program}.ThewY\newfloatcommandsetsthe oatnameItoUUitsargumenthtyp}'e[i ϲifnoothernamehasbGeenspeci edbefore.XThe8\floatplacementcommandresetsthedefaultplacementspGeci erofa 6\floatplacementIclassUUof oats.qE.g.,\floatplacement{figure}{tp}.XTheű\restylefloatcommandisnecessarytochangestylesforthestandardb\restylefloatI oattypGesfigureandtable.Sincethesearen'tusuallyde nedvia\newfloat,ItheyDdon'thaveDastyleassoGciatedwiththem.l.Thusyouhavetosay*,Gforexample,S\floatstyle{ruled}S\restylefloat{table}Itohavetablescomeoutruled.TDThecommandalsoletsyouchangestylefor oatsIthatDyoude nevia\newfloat,althoughthisis,typGographicallyspeaking,notaIgoGodUUidea.qSeetable1foranexample.XThe#\listofcommandproGducesalistofallthe oatsofagivenclass.pIts\listofIsyntaxUUis3 soS\listof{htyp}'e[i%}{htitle[ieN}Ihtyp}'e[ifNis)the oattypGegiveninthe\newfloatcommand.Bhtitle[i#isusedforthe ItitleE4ofthelistaswellastheheadingsifthecurrentpagestyleincludesthem.IOtherwise,Tthe\listofcommandisanalogoustothebuilt-inL5ffA͉TU>'ExXcommandsI\listoffiguresUUand\listoftables.!čI3aLTheffUserInterface|*߆Tff cmtt12[H]PlacementSps3eci erIMany^FpGeople ndL5ffA͉TU>'ExX's oatplacementspGeci erstoorestrictive.A^CCommonlyIUtteredComplaint(CUC)callsforawaytoplacea oatexactlyatthespGotwhereIit״oGccursintheinput le,Li.e.,to״notʌhaveit oatatall.Itseemsthatthe[h]IspGeci er shoulddothat,butinfactitonlysuggeststoL5ffA͉TU>'ExXsomethingalongtheIlinesof\putthe oathereifit'sOKwithyou".bAsitturnsout,$cL5ffA͉TU>'ExXhardlyIeverfeelsinclinedtoactuallydothat.;ThissituationcanbGeimprovedbyjudiciousImanipulationUUof oatstyleparameters.XThe|nsamee ectcanbGeachieved|nbychangingtheactualmethoGdofplacingI oats.David?Carlisle'shereoptionintroGducesanew oatplacementspGeci er,Inamelylb[H],Hwhich,KUwhenaddedtoa oat,tellsL5ffA͉TU>'ExXto\putitHERE,pGeriod".IIfthereisn'tenoughspaceleftonthepage,|the oatiscarriedovertothenextIpagetogetherwithwhateverfollows, ,eventhoughtheremightstillbGeroomleftIfor someofthat. Thisstyleoptionprovidesthe[H] spGeci erfornewlyde nedIclassesxof oatsaswellastheprede nedfiguresandtables,therebysupGersedingIhere.dDavidosuggeststhatthehereoptionbGewithdrawnfromthearchivesindueIcourse.XThe[H]spGeci ermaysimplybeaddedtothe oatasanoptionalargument,IlikeJ&alltheotherspGeci ers.P9Itmaynot'ExXedtheIdoGcumentationNjustnowitturnedoutthattherewasapagebreakthatfellexactlyIbGetweenQthe\Sonow"lineandthe oat.KThiswouldn'tProveAnything.KBother.)ISoUUnowwehavethefollowing oatplacementspGeci ers:SEffi͟BBffd t?T*opUUofthepage b?BottomUUofthepage p?PageUUof oats h?Here,UUifpGossible H?Here,UUde nitelyiBffffffi͎4)soI4aLImplementationI+N cmbx124.1gBasicsuTLs1S cmsy9hpack9age#g iXIncL5ffA͉TU>'ExX,gt oatsareassigned`typGenumbGers'thatarepowerscof2.ESincethere Iareonlytwoclassesof oats,theirtypGenumbGersarehardwiredintothedoGcumentIstyles.PW*eneedtobGesomewhatmore exible,>yandthusweinitializeacounterItoholdthenexttypGenumbGertobeassigned.ThiscounterwillbeincrementedIappropriatelyUUlater.Ls2S\newcounter{float@type} Ls3S\@ifundefined{c@figure}%Ls4]{\setcounter{float@type}{1}}%Ls5]{\setcounter{float@type}{4}}IT*oUUwarmup,we'llloGokatsomeofthesimplercommands rst. L\floatstyleIThev\floatstylecommandputsitsargumentintothe\float@stylemacroas ItheTTnameofthenew oatstyle.qqButiftheargumentdoGesn'tdenotea oatstyle,Ianerrormessageisoutputinstead:Each oatstylehstyle[i#HhasacorrespGondingIcommand\fs@hstyle[i *thatcontainstheappropriatedeclarations.IfthecontrolIsequenceg\fs@har}'g}i{(whichgoGeswiththeargumenthar}'g}iㆲto\floatstyle)isun-Ide ned,i.e.,equalsV\relaxunder\ifx,thenthe oatstylehar}'g}iisunknown,andIweUUcall\float@error{har}'g}i>}fortheerrormessage.Ls6S%\def\floatstyle#1{\expandafter\ifx\csnamefs@#1\endcsname\relax Ls7S% s,\float@error{#1}\else\def\float@style{#1}\fi}Ls8S\newcommand\floatstyle[1]{\@ifundefined{fs@#1}%Ls9]{\float@error{#1}}%I10]{\def\float@style{#1}}}b\float@errorIHere's"theerrormessage.b\@ehaisthehelpmessagethatsays`Y*ourcommand IwasUUignored.'I11S\newcommand\float@error[1]{\PackageError{float}{%I12]Unknownfloatstyle`#1'I13S}{\@eha}}XThenexttwocommandsareevensimpler.L5ffA͉TU>'ExXsaysthat\fps@h o}'atظi-con- ItainsX thedefaultplacementspGeci erfortheclassof oatsh o}'atظiK.z(\fname@h o}'atظiIexpandstothenamethatappGearsinh o}'atظi"7captions,se.g.,`Figure'.(ThisisourIownUUde nition.)I14S\newcommand\floatname[2]{\@namedef{fname@#1}{#2}} I15S\newcommand\floatplacement[2]{\@namedef{fps@#1}{#2}}\restylefloatITheY\restylefloatcommandsetsupeverythingsothatsubsequentcommandsIlikeK\begin{h o}'atظi+}usetheappropriate oatstyle.LItde nes\fst@h o}'atظi AvtoIexpand.toacommandthatsetsupthecurrentlyselected oatstyle(\fs@hstyle[i).IThenitde nesthecommands\begin{h o}'atظi+},\end{h o}'atظi},\begin{h o}'atظi*}IandUU\end{h o}'atظi+*}.I16S\newcommand\restylefloat[1]{\expandafter\edef\csname I17]fst@#1\endcsname{\expandafter\noexpand\csnameI18ffs@\float@style\endcsname}%I19ap\@namedef{#1}{\bgroup\@nameuse{fst@#1}\@float{#1}}%57soI20ap\@namedef{#1*}{\bgroup\@nameuse{fst@#1}\@dblfloat{#1}}% I21ap\expandafter\let\csnameend#1\endcsname\float@endI22ap\expandafter\let\csnameend#1*\endcsname\float@dblend}$\newfloatINowSwecanexplainhowtode neanewclassof oats.lRecallthatthethree Irequired^^argumentsto\newfloatarehtyp}'e[iF,`hplac}'ementظi:;andhextظi,`respGectively*.IFirstUUwesavethelattertwo.I23S\newcommand\newfloat[3]{\@namedef{ext@#1}{#3} I24]\floatplacement{#1}{#2}%IThenIwe gureoutadefaultvqalueforthe`captionname'ofthisclassof oats.IIfXthe\fname@htyp}'e[i@5isn'talreadyde ned,Xwetentativelyusehtyp}'e[i Easthename.IThisW6isconvenientW6ifhtyp}'e[i"is,say*,Program,sinceW6no\floatnamecommandisInecessaryUUatall.I25]\@ifundefined{fname@#1}{\floatname{#1}{#1}}{}IThenwesetupthetypGenumbGerforL5ffA͉TU>'ExXin\ftype@htyp}'e[i%.WXAfterwardswehaveItosetthefloat@typetothenextgreaterpGoweroftwo,JsothatitisreadyforIthernext\newfloat.ɔF*ortunately,ywerjusthavetodoubleitbyadding.ɔW*edon'tIbGotherncheckingforover owsinceitisprettyunlikelythatsomebGodywillde neI25di erentclassesof oats.jMFinally*,'wecall\restylefloattode nethestyleIandUUcommandsforthisclassof oats.I26]\expandafter\edef\csnameftype@#1\endcsname{\value{float@type}}% I27]\addtocounter{float@type}{\value{float@type}}I28]\restylefloat{#1}%INowCallthat'sleftistoassemblethe\fnum@htyp}'e[ihmacrothatL5ffA͉TU>'ExXwantstouse Iinitscaptions.Basicallyitisjust`captionname'u+`countervqalue',disguisedsoIthatUUthecommandnames'vappGearinthede nitioninsteadoftheirexpansions.I29]\expandafter\edef\csnamefnum@#1\endcsname% I30f{\expandafter\noexpand\csnamefname@#1\endcsname{}I31t\expandafter\noexpand\csnamethe#1\endcsname}IFinally*,fwechavetotakecareoftheoptionalargument,fhwithinci'.2.Iftheoptional Iargumentispresent,%wepasscontrolto\@xnewfloat.!Otherwise,%wejustde neItheUUcounterforthisclassof oats.qBydefault,thenumbGerscomeout\arabic.I32]\@ifnextchar[{\@xnewfloat{#1}}% I33f{\@ifundefined{c@#1}{\newcounter{#1}\@namedef{the#1}{\arabic{#1}}}%I34p2{}}} L\@xnewfloatIHere(wedealwiththeoptionalargumentto\newfloat.bW*ehavetocreateanew IcounteraspGer\newcounter{htyp}'e[i%}andaddthatcountertothelistofcoun-Iters;tobGeresetwhenevercounterhwithinci+rissteppGed.%BThestandardcommandI\newcounter{htyp}'e[i%}[hwithinci#`]takescareofthat.However,Mwecan'tde netheIhtyp}'e[igecounter@ifit'salreadyde ned.WhilethiscaseissimplyignoredwhenIhwithinciois:notpresent,@ we:issueawarningheresincewhatcomesoutisprobablyInotUUwhattheuserexpGects.I35S\def\@xnewfloat#1[#2]{\@ifundefined{c@#1}{\newcounter{#1}[#2]% I36f\expandafter\edef\csnamethe#1\endcsname{%I37p2\expandafter\noexpand\csnameI38yw^the#2\endcsname.\noexpand\arabic{#1}}}%I39f{\PackageWarning{float}{Can'tredefinecountervariablefor#1.}}}6FDsoI4.2gAdaptingLAl#02@cmbx8A~/TESXinternalsuTIW*e havetoadaptsomeofL5ffA͉TU>'ExX'sinternalmacrostoourneeds.PThereareseveral IthingsH1thathaveH1tobGechangedaroundinordertoprovidethefunctionalityofIDavidVRCarlisle'shere.tThefollowingisthusliftedfromhere,withchangesandIwithUUDavid'spGermission:օ$\@HxfloatIW*e savetheoriginalversionof\@xfloat.(Thismacroiscalledfrom\@float,IwhichVVweusedabGovetode netheenvironmentcommandsforanewclassof oats.) ,I40S\let\@Hxfloat\@xfloaty\@xfloatITheInewversionof\@xfloatloGoksfora[H],argument.LIfitispresent\@HHfloatIisUUcalled,otherwisetheoriginalmacro(renamedto\@Hxfloat)iscalled. ,I41S\def\@xfloat#1[{\@ifnextchar{H}{\@HHfloat{#1}[}{\@Hxfloat{#1}[}}ILaterUUonwe'llneedabGoxtosavea[H] oat.I42S\newsavebox\float@box I43S\newif\if@flstyle$\@HHfloatIFirst]gobblethe[H].NotethatH6shouldnotbGeusedinconjunctionwiththeother Iplacement. options,5norasthevqalueofthedefaultplacement,5assetin\fps@typ}'e.I44S\def\@HHfloat#1[H]{%,ILoGcallyUUrede netheendoftheenvironment.I45]\expandafter\let\csnameend#1\endcsname\float@endHIW*e̮don'tgeta\@currboxifwedon'tactuallyusethe oatmechanism.D:Therefore IweUUfakeoneusingthe\float@boxde nedabGove.I46]\let\@currbox\float@boxINow6wesavethecurrent oatclassnameforuseinconstructingthe\caption. IThe7captionbGox(de nedbelow)isinitialisedtoanemptybGoxtoavoidtroubleIwith oatsnothavingacaption.: ThenwestartthebGoxthat'llholdthe oatitself.I\parindentUUissettozeroforcompatibilitywiththestandard[h]option. ,I47]\def\@captype{#1}\setbox\@floatcapt=\vbox{}% I48]\expandafter\ifx\csnamefst@#1\endcsname\relaxI49f\@flstylefalse\else\@flstyletrue\fiI50]\setbox\@currbox\color@vbox\normalcolorI51f\vbox\bgroup\hsize\columnwidth\@parboxrestoreI52p2\reset@font\normalsize\@setnobreak\@setminipageIThe nal\ignorespacesisneededtogobbleanyspacesornewlinesafterthe[H] Itokens. ,I53]\ignorespaces}օ 6\float@makeboxIBasically*,wexmustarrangefor`stylecommands'tobGeexecutedatcertainpointsIduringthegenerationofthe oat.*L5ffA͉TU>'ExXputsa oatintoaverticalbGox\@currboxIwhich(]ittakeso alistofemptybGoxesforinsertions.bWhenthe\float@makeboxImacroϱiscalled,k\@currboxcontainsthecomplete oat,minusthecaption|we'llIsee[laterthatweuseourown\captioncommandtoputthecaptionintoa\vboxIof?itsown.jThisistheonlywaywecancontrolthepGositionofthecaptionbytheI oatWwstyle,XregardlessofwherethecaptionappGearsinthe oat'sinputtextitself.ISo=qthe`stylecommands'are\@fs@pre,B8whichisinsertedattheverybGeginningofIthe oat,\@fs@mid,whichcomesbGetweenthe oatandthecaption(orthecaption7VsoIandjthe oat,ifcaptionsareputatthetop),and\@fs@post,which nisheso the I oat.YThe captionmayappGearatthetoporatthebottomofthe oat,nasde nedIby\@fs@iftopcapt.HTherefore,bGeforewehandthe oattoL5ffA͉TU>'ExXforpGositioning,IitUUistakenapartandreassembledusingthestylecommands.I54S\newcommand\float@makebox{% I55]\vbox{\hsize\columnwidth\@parboxrestoreI56f\@fs@pre\@fs@iftopcaptI57p2\ifvbox\@floatcapt\unvbox\@floatcapt\par\@fs@mid\fiI58p2\unvbox\@currboxI59f\else\unvbox\@currboxI60p2\ifvbox\@floatcapt\par\@fs@mid\unvbox\@floatcapt\fiI61f\fi\par\@fs@post\vskip\z@}}\float@endITheinternalmacro\end@floatappGearshereunderthenameof\float@end.2>The Imain0thingwhichischangedisthatwecall\float@makeboxtoreconstructtheI oatUUaccordingtothe oatstyle.I62S\newcommand\float@end{\global\@minipagefalse\outer@nobreak I63]\egroup\color@endboxI64]\global\setbox\@currbox\float@makeboxINowUUL5ffA͉TU>'ExXtakesoveragain.I65ap\ifnum\@floatpenalty<\z@\@largefloatcheckI66f\@cons\@currlist\@currboxI67kJ\ifnum\@floatpenalty<-\@MiiI68yw^\penalty-\@Miv\@tempdima\prevdepthI69yw^\vbox{}\prevdepth\@tempdima\penalty\@floatpenaltyI70p2\else\vadjust{\penalty-\@MivI71yw^\vbox{}\penalty\@floatpenalty}\@EsphackI72kJ\fi\fi\egroup}I(The| nal\egroupisnotpresentintheoriginalde nition;Vweneeditto nish Io uthe\bgroupthatprecedesthe\@nameuseinthe\begin{h o}'atظi+}commands.IThisUUistokeepthestylecommandsloGcal.) L\float@endHIThehL\float@endHhGcommandis,m again,derivedhLfromhere.It'lldealcorrectlywithIaWnon- oating oat,insertingthepropGeramountsofwhitespaceaboveWandbelow.I73S\newcommand\float@endH{\par\vskip\z@skip I74f\global\@minipagefalse\outer@nobreakI75]\egroup\color@endbox\vskip\intextsepI76]\if@flstyle\float@makebox\egroup\else\box\@currbox\fiI77]\vskip\intextsep\relax}\float@dblendIThe\float@dblendmacroisanalmost-verbatimcopyof\end@dblfloatbutfor IthedIlastpart,hfrom\fi\egroupon.The\egroupis,ofcourse,necessarybGecauseIofthe\bgroupattheverybGeginningofthe oat.<3Andwehavetocall\float@endIinsteadUUof\end@float,naturally*.I78S\newcommand\float@dblend{\if@twocolumn I79]\par\vskip\z@\egroup\outer@nobreak\color@endboxI80]\ifnum\@floatpenalty<\z@\@largefloatcheckI81f\@cons\@dbldeferlist\@currbox\fiI82f\ifnum\@floatpenalty=-\@Mii\@Esphack\fi\egroup\else\float@end\fi}8 ensoI4.3gCaptionsandlistsof oatsuTINowforthecaptionroutines.>W*euseabGox,r\@floatcapt,toholdthecaption IwhileUUthe oatisassembled.I83S\newsavebox\@floatcapty\captionIThis istheonlyL5ffA͉TU>'ExXmacrothatthisdoGcumentstylesupGersedes.^YOur\captionIcommandcheckswhetherthereisacustomstylede nedforthecurrent oatI(whosetypGecanbefoundin\@captype).HIfso,othecaptionroutinesfrom oatareIused,otherwiseݵwecallthevqanillaL5ffA͉TU>'ExXroutines. The\@flcaptconditionalisIused[jtotellthe oat-assemblyroutinesthatthereactuallyis-acaption.W*eneedIthisUUtopropGerlyhandlefiguresandtablesthathaveUUbeenrestyled.I84S\renewcommand\caption{\refstepcounter\@captype I85]\expandafter\ifx\csnamefst@\@captype\endcsname\relaxI86p2\let\@tempf\@captionI87f\else\let\@tempf\float@caption\fi\@dblarg{\@tempf\@captype}} 6\float@captionIThej\float@captionmacrotakescareofenteringthecaptionintotheappropriate Ilisting.gDIt)alsocontrolsthetypGesettingofthecaptionitself,althoughastyle-IdepGendentmacro\@fs@captiscalledtohandlethespeci cs.WNotethatbecauseIthelcaptionissavedlinabGoxinsteadofbeingoutputtothe oatrightaway*,rOyouIcannotsimplyputalegendafterthecaptionpropGer;ithastofollowthe\captionIcommandUUinanoptionalargument.XFirstofall,awecall\addcontentslinetoupGdatethelistof oatsofthisIclass.;Notethat\float@captionis\longtoallowforparagraphbreaksinitsIarguments.I88S\long\def\float@caption#1[#2]#3{\addcontentsline{\@nameuse{ext@#1}}{#1}% I89ap{\protect\numberline{\@nameuse{the#1}}{\ignorespaces#2}}INowwecollectthecaptionpropGer.N8ThecaptionnameandnumbGeraretakenfromI\fnum@h o}'atظi+,UUwhereh o}'atظi"Mղistheclassof oatwe'recurrentlyhandling.I90]\global\setbox\@floatcapt\vbox\bgroup\@parboxrestore I91f\normalsize\@fs@capt{\@nameuse{fnum@#1}}{\ignorespaces#3}%IFinally'wecheckforthepresenceoftheoptionalargument.N Ifthereisone,wecallI\float@cconUUtopickitup;otherwise,the\egroup nisheso thebGox.I92f\@ifnextchar[{\float@ccon}{\egroup}} L\float@cconITheg\float@cconmacroexpandstotheoptionalargumentofa\captioncom-Imand,Hfollowedby\par\egroup.PNotethatthisprecludesusing\verb&Co.inIthe:optionalargument;theinterestedreaderisurgedto xthisproblemasanIexercise.I93S\long\def\float@ccon[#1]{#1\par\egroup}3P\listofIThe\listofcommandreadsthedesiredlistof oatsfromtheappropriateaux-Iiliaryzv le.)The leisthenrestarted.CurrentlythelistappGearsatthechapterorIthe,sectionlevel,!depGendingonwhetherchaptersaresuppGortedinthedocumentIstyleatall.ziFirstofall,.Cwecheckwhetherthe oatstylethat'ssuppGosedtobeIlistedUUisactuallyde ned.qIfnot,weoutputa\float@error.I94S\newcommand\listof[2]{% I95]\@ifundefined{ext@#1}{\float@error{#1}}{%9 rsoIAll'swelluntilnow. W*edeterminewhetherthelistisgoingtobGeachapterora Isection,andwede nethe\l@h o}'atظi commandthatL5ffA͉TU>'ExXneedsforformattingIthelist.-Afterthat,wecall\@starttocwiththecorrect leextensiontodotheIactualUUwork. ލI96f\@ifundefined{chapter}{\def\@tempa{\section*}}% I97p2{\def\@tempa{\chapter*}}%I98f\@tempa{#2\@mkboth{\uppercase{#2}}{\uppercase{#2}}}%I99f\@namedef{l@#1}{\@dottedtocline{1}{1.5em}{2.3em}}%E100f\@starttoc{\@nameuse{ext@#1}}}}!I5aLTheffFloatStylesIFinally*,xwe de nethethreestandard oatstylesthatwereoutlinedintheIntro- Iduction.Every/ oatstylehstyle[i$QcorrespGondstoacommand\fs@hstyle[i "whichIcontainsUUthede nitionsofthestylecommands,namely+e>dq\@fs@preӜYtopUUofthe oatq\@fs@midӜYbGetweenUU oatandcaption\t\@fs@postӜYbGottomUUofthe oat\t\@fs@captӜYformattingUUroutineforcaptionw\@fs@cfontӜYfontUUforcaptionname&numbGer-\floatc@plainIThe_\floatc@plainmacroformatsacaptiontheway_L5ffA͉TU>'ExXdoGesit:ifthecaptionIisfairlyshort,7itiscentered,otherwiseitisformattedasaparagraph.hTheonlyIdi erenceisthatthepGortioncontainingthecaptionnameandnumbGerusestheI\@fs@captfont.E101S\newcommand\floatc@plain[2]{\setbox\@tempboxa\hbox{{\@fs@cfont#1:}#2}% E102]\ifdim\wd\@tempboxa>\hsize{\@fs@cfont#1:}#2\parE103f\else\hboxto\hsize{\hfil\box\@tempboxa\hfil}\fi}$\fs@plainITheAplain oatstyleissimilartowhatL5ffA͉TU>'ExXdoGesofitsownaccord;Z8theonly Idi erenceisthatthecaptionisguaranteedtocomeoutatthebGottomofthe oat.E104S\newcommand\fs@plain{\def\@fs@cfont{\rmfamily}\let\@fs@capt\floatc@plainE105]\def\@fs@pre{}\def\@fs@post{}\def\@fs@mid{\vspace{10pt}\relax}%E106]\let\@fs@iftopcapt\iffalse}\floatc@ruledIThe2\floatc@ruledcommandisevensimplerthanthe\floatc@plainmacro. ITheUUcaptionissimplyprinted`asis'.E107S\newcommand\floatc@ruled[2]{{\@fs@cfont#1}#2\par}$\fs@ruledIIn-theruled oatstyle,5thecaptionappGearsatthetopofthe oat,precededand IfollowedUUbyhorizontalrules.qAnotherrulefollowesthewholeofthe oat.E108S\newcommand\fs@ruled{\def\@fs@cfont{\bfseries}\let\@fs@capt\floatc@ruled E109]\def\@fs@pre{\hruleheight.8ptdepth0pt\kern2pt}%E110]\def\@fs@post{\kern2pt\hrule\relax}%E111]\def\@fs@mid{\kern2pt\hrule\kern2pt}%E112]\let\@fs@iftopcapt\iftrue}$\fs@boxedITheboxed oatstyleputsthe oatintoabGox(whichisslightlylargerthanthe IusualUU\textwidth).qThecaptionappGearsbelowthebox.E113S\newcommand\fs@boxed{\def\@fs@cfont{\bfseries}\let\@fs@capt\floatc@plain10 soE114]\def\@fs@pre{\setbox\@currbox\vbox{\hbadness10000 E115f\moveleft3.4pt\vbox{\advance\hsizeby6.8ptE116p2\hrule\hboxto\hsize{\vrule\kern3ptE117yw^\vbox{\kern3pt\box\@currbox\kern3pt}\kern3pt\vrule}\hrule}}}%E118]\def\@fs@mid{\kern2pt}%E119]\def\@fs@post{}\let\@fs@iftopcapt\iffalse}XBeforeUUwe nish,wesetthe oatstyletoplain.E120S\floatstyle{plain}IOthero oatstylescanbGeaddedwithoutmuchado./Iftherearemanymore oat Istyles,DitshouldbGeworthwhiletoinventaschemesimilartothatusedinF*rankIMittelbach'stheoremoptioninordertoconservespace,3/i.e.,putthe oatstylesIintopindividual lesthatcanbGeloadedondemand.IowouldliketohearfromIpGeopleUUwhode neinteresting oatstyles.!čIIndexIThe(italicnumbGers(denotethepageswherethecorrespondingentryisdescribed,InumbGers1)underlinedpointtothede nition,8eallothersindicatetheplaceswhereitIisUUused.mmJSymCbKols I\@HHfloatl}.΍}.}.}.}.}. T41,T44Tfe ?I\@Hxfloatl}.΍}.}.}.}.}. T40 Tfe ?P,T41I\@captionl}.΍}.}.}.}.}.}.}. 86I\@captype/&47,T84,85,87I\@currboxl}.΍}.}.}.}. r46,g50,v58,59,64,g66,76,81,114,117I\@floatcapt}.΍}.}.}.}.}.}.g}. V47,T57,60,83,90I\@flstylefalseB}.΍}.}.}. 49I\@flstyletrue- }.΍}.}.}.}. 49I\@fs@captl}.΍}.}.}.}.}.}.}.g}. r91,T104,108,113I\@fs@cfont q101,T102,g104,'%107,108,113I\@fs@iftopcaptB}.΍}.}.}.g}. r56,T106,112,119I\@fs@mid}.΍}.}.}.}.}.}.}.}.i=57,J60,105,111,118I\@fs@postl}.΍}.}.}.}.}.}.}.g}. r61,T105,110,119I\@fs@pre@56,*105,109,114I\@largefloatcheck065,T80I\@minipagefalsez}. T62,T74ª\@setminipage- }.΍}.}.}.}. 52 =ª\@setnobreakYҍ}.΍}.}.}.}.}. 52ª\@tempfƈ}.΍}.}.}.}.}.}.}. T86,T87ª\@xfloat}.΍}.}.}.}.}.}. T40,T41Tfe ?ª\@xnewfloat}.΍}.}.}.}. T32,T35Tfe ?|Cª\caption}.΍}.}.}.}.}.}.}.}. 84 Οfe ?ª\color@endbox /63,T75,79ª\color@vbox}.΍}.}.}.}.}.}. 50'NFª\float@box@0}.΍}.}.}.}. T42,T46ª\float@captionB}.΍}. T87,T88Tfe ?ª\float@ccon}.΍}.}.}.}. T92,T93Tfe ?ª\float@dblend- }.΍}.}. T22,T78Tfe ?ª\float@end@0}.΍}. 21,T62Tfe ? UP,T82ª\float@endH}.΍}.}.}.}. T45,T73Tfe ?ª\float@error B`7,T9,11fe ? UP,95ª\float@makeboxvN54vNfe ?J,T64,76ª\float@styleYҍ}.΍}. 7,T10,18ª\floatc@plain- }.΍}.}.}.}. બ}.΍}.}.}. 101 fe ,T104,113ª\floatc@ruled- }. 107 fe ,T108ª\floatname@0}.΍}.}. 1j cmti93,T14,25 cmmi10K`y cmr10ٓRcmr7u cmex10]