; TeX output 1997.01.23:0050F[DtGGcmr17An7tenqvironmentformulticolumnoutput!", cmsy10y^XQ cmr12FVrankMittelbacrhkEmail:8seetopofthesource le% &PrinrtedJanuary23,1997.աKt : cmbx9Abstractэ&o cmr9ThisbarticledescribAestheuseandtheimplemen9tationoftheow cmss9multicolsenvironment.Thisenvironment allo9wsP@switchingbAetweenoneandmulticolumnformatonthesamepage.ڿF:oAotnotesarehandledcorrectly(for5themostpart),bbutwillbAeplacedatthebottomofthepageandnotundereac9hcolumn.L5Aacmr6A TuAEX's oatmec9hanism,Showever,isG'partlydisabledinthecurren9timplementation.Atthemomentonlypage-wide oatsT(i.e.,star-forms)canbAeusedwithinthescopeoftheen9vironment.!č Nff cmbx12Prefacefftoversion1.5\ K`y cmr10This7newreleasecontainstwo ma8jorochanges: _!m#R cmss10multicolswillnowpWsuppGortupto10columnsandtwomoretuningpGossibilitieshaveXbGeenaddedtothebalanc-ingDroutine.?Thebalancingrou-tineDBnowchecksthebadnessof͟DŽQff9theresultingcolumnsandrejects solutionsthatarelargerthanacertainUUtreshold.AtthesametimemulticolsͲhasWbGeenupgradedtorununderL5ffٓRcmr7A͉TU>'ExX2 b> cmmi10". w.I0apGologiseBforthestateoftheQff9coGdeOdocumentationbutthework onL5ffA͉TU>'ExX2",XkeptmetoGobusytodoapropGerjob.Thiswillhope-fullybGecorrectedinthenearfu-ture.#1LIntros3duction~ SwitchingbGetweentwocolumn andonecolumnlayoutispGos-sibleMinL5ffA͉TU>'ExX,JbuteveryuseofW" "5-:1LܿIxstartedywiththealgorithmgivÎenintheTAEMXb'ExXcommands,exceptthat oatsandmarginparsarenotIallowedinthecurrentimple-mentation^2|s. zz As΂its rstaction,ythemulticolsenvironment\mmeasuresthecur-rentnpagetodeterminewhetherthereisenoughroGomforsomepGortion }ofmulticolumnout-put. Thisniscontrolledbythehdimenci&Vݲvqariable7}\premulticolswhichcanbGechangedbytheuserwithordinaryL5ffA͉TU>'ExXcom-mands.mIfthespaceislessthan\premulticols,zaٌnewpageisstarted.öOtherwise,LaO\vskipof\multicolsepUUisadded.^3 Whentheendofthemul-ticols -environmentisencoun-tered,5ananalogousmechanismisemployed,^ butnowwetestwhetherOthereisaspacelargerthan\postmulticolsavqailable.Againweadd\multicolseporstartUUanewpage. Itisoftenconvenienttospreadsome7textover7allcolumns,pjustbGefore}themulticolumnoutput,withoutanypagebreakinbGe-tween.T*oqachievethisthemulti-colsa²environmenthasanoptionalsecondRargumentwhichcanbGeusediforthispurpGose.F*orexam-ple,othe6textyouarenowreadingwasUUstartedwith zz&ߤN cmtt9\begin{multicols}{3} ,[\section{TheUser=lInterface}]...omIf suchtextisunusually͟H:fflongq(orshort)thevqalueof \premulticols'mightneedad-justingVtopreventVabadpagebreak. NW*evthereforeprovideathirdQargumentwhichcanbGeusedtooverwritethedefaultvqalue1of\premulticolsjustforthis{oGccasion. :Soifyouwanttocombinesomelongersinglecolumn textwithamulticolsen-vironmentUUyoucouldwrite9 c\begin{multicols}{3} l[\section{Index}%&QThisindexcontains...] l[6cm]?...9βSeparationofcolumnswith verticalДrulesisachievedby/dsettingtheparameter\columnsepruleUatosomepGosi-tivevqalue.InthisarticleavalueofUU.4ptwasused.Sincemnarrowcolumnstendto 5needadjustmentsinin-terline spacingwealsopro-videahskipi&\#parametercalled\multicolbaselineskipy whichisaddedtothe\baselineskipͲparameterinsidethemulticolsen-vironment. Please%usethispa-rameter*withcareorleave*italone;ittisintendedonlyforpackqageH ledesignerssinceevensmallchangesmightproGduceto-tally3unexpGectedchangestoyourdoGcument.d'N cmbx122.1'BalancingsColumnsuTͲBesides thepreviouslymentionedparameters,JsomeH8othersarepro-videdtoin uencethelayoutoftheUUcolumnsgenerated.ParagraphingsinTU>'ExXiscon-trolledmbyseveralparameters.One~ofthemostimpGortantiscalled\tolerance:thiscontrolsthenallowed`loGoseness'(i.e.theH:ffamountofblankspacebGetween words).Its defaultvqalueis200(theL5ffA͉TU>'ExX\fussy)whichistoGosmallIfornarrowcolumns.Ontheotherhandthe\sloppydeclara-tion(whichsets\toleranceto10000~A=1)\istoGolarge,allow-ingUUreallybadspacing.^4qβW*eSthereforeusea\multicoltolerance0parameterforZthe\tolerancevqalueinsidetheBmulticolsenvironment. ~Itsdefault 5vqalueis9999whichislessthanin nitybut`bad'enough obformostparagraphsinRamulticolumnenvironment.ChangingitsvqalueshouldbGedoneoutsidethemulticolsenvi-ronment. vSince\toleranceisset{Sto\multicoltoleranceattheӊbGeginningofeverymulticolsͲenvironment }onecanloGcallyoverwritethisdefaultbyas-signing z\tolerance = hdesir}'edvalue[i#i.There alsoexistsa\multicolpretoleranceܯpa-rameter Вholdingthevqaluefor U`\pretolerancewithinamulticolsxenvironment.gBothparametersLmareusuallyusedonlybyUUpackqagedesigners.Generation eLofmulticolumnoutputtcanbGedividedintotwoparts. Inthe rstpartwearecollectingmaterialforapage,shippingBitout,~Ncollectingmate-rialURforthenextpage,USandsoon.Asasecondstep,ObalancingwillbGedonewhentheendofthemul-ticolsJenvironmentisreached.jInthe rststepTU>'ExXmightconsidermorematerialwhilst ndingthe nalcolumnsthanitactuallyusewhenshippingoutthepage.ThismightcauseaproblemifaHfoGotnoteisencounteredinthepartboftheinputconsidered,f?butnot4used,onthecurrentpage.VInfff2x J= "5-:2LܿThisXisdictatedbÎylackoftime. TJoimplement oatsonehastoreimplementthewholeL#A TAEMXoutputroutine. > "5-:3LܿActuallytheaddedspacemaÎyb'ExXbyusinga\pagebreakcommandinthe naldoGcument.AnotherK]waytoin uencethebGe-haviorofTU>'ExXinthisrespGectisgivenbythecountervqariable`collectmore'.gIfQyouusethe\setcounterdeclarationtosetthiscountertohnumb}'eri.,"TU>'ExXwillXEconsiderhnumb}'eri1more(orless)xlinesbGeforemakingits -naldecision. wSoavqalueof1may6solveallyourproblemsatthecostofslightlylessoptimalcolumns. In'thesecondstep(balanc-ing~columns)wehaveotherbGellsand[whistles. Firstofallyoucan say\raggedcolumnsifyoudon't-wantthebGottomlinestobGealigned.Thedefaultis\flushcolumns,soOTU>'ExXwillnor-mally.trytomakebGoththetopandbGottombaselinesofallcolumnsUUalign. Additionally =youcansetanother Lcounter, ^the`unbal-ance'5counter,mtosomepGositivehnumb}'eri(.`This!willmakeallbutthe eright-mostcolumnhnumb}'eriof/lineslongerthantheywouldnormally6havebGeen. M`Lines'inthisŭcontextrefertonormaltextlines1(i.e.one\baselineskipapart); thus,$if.eyourcolumnscontaindisplays,pforexample,youcmayneedahigherhnumb}'eritoshiftsomethingfromonecol-ͩ'];ffōumnUUintoanother. 0Unlike`collectmore,'the`unbal- ance'{Acounterisresettozeroattheendoftheenvironmentsoitonly0Xappliestoonemulticolsen-vironment.ThectwomethoGdsmaybGecom-bined)butIsuggestusingthesefeatures4onlywhen netuningimpGortantUUpublications.TwomoregeneraltuningpGos-sibilitiesRwereaddedwithver-sion1.5. M9TU>'ExXallowstomea-sure2thebadnessofacolumninterms ofanintegervqalue,/where0meansoptimalandanyhighervqaluemeansacertainamountofP?extrawhitespace. b10000isconsidered4tobGein nitelybad(TU>'ExX'ExXwillacceptallsolutionshexceptthosebGeingover-full.kBy6settingthecountertoasmallervqalueyoucanforcethealgorithmڦtosearchforsolutionsthat{?donothave{?columnswithalotUUofwhitespace.However,ifthesettingistoGolow,X\the$algorithmmaynot ndany acceptablesolutionatallandwillX*then nallychoGosetheex-tremes/solutionofplacingalltextintoUUthe rstcolumn.Often,whensocolunmsarebal-anced,ito~isimpGossibleto ndasolutionathatdistributesthetextevenlyJ&overallcolumns.P:IfthatisUSthecasethelastcolumnusu-allyhaslesstextthantheoth-];ffōers. wIntheearlierreleasesthis textnwasstretchedtoproGduceacolumnGwiththesameheightasall$others,.esometimesresultinginreallyUUuglyloGokingcolumns. rInthenewreleasethisstretch-ing-isonlydoneifthebadnessof6the nalcolumnisnotlargerthanthevqalueofthecounter -nalcolumnbadness. iThedefaultsettingUis9999,nthuspreventingthe5QstretchingforallcolumnsthatzTU>ExXwouldconsiderin- nitelybad.lInthatcasethe -nalN6columnisallowedN6torunshortwhichgivesamuchbGetterresult.^2.2'Floatsinsidea)R6 cmss12mul-'ticolsenvironmentJͲWithinthemulticolsenvironmentthe:usualstar oatcommandsareavqailablebuttheirfunctionissomewhatdi erentasinthetwo-columnsmoGdeofstandardL5ffA͉TU>ExX.Stared} oats,e.g.,figure*,de-noteipagewide oatsthatarehandled_Finasimilarfashionasnormal oatsoutsidethemulti-colsVenvironment.4However,theywill6nevershowuponthepagewhere~theyareencountered.3InotherUwords,onecanin uencetheir%QplacementbyspGecifyingacombination{oft,Cb,and/or{pͲintheiroptionalargument,d^buthBֲdoGesn'tworkbecausethe rstpGossibleSplaceisthetopofthenextDpage.lMOneshouldalsonote,thatthismeansthattheirplace-mentQbGehaviorisdeterminedbythe?vqaluesof\topfraction,zetc.ratherUUthenby\dbl....^2.3'WarningsJͲUnder#certaincircumstancestheuse/ofthemulticolsenvironmentmayϢresultininsomewarningsfrom(TU>ExXorL5ffA͉TU>EX. Hereisaff2x J= "5-:5LܿThe5reasonb "5-:6LܿThisXmessagewillb'ExXwasn'tableto nda\ogoGodwaytobreakthepara-graph.Underfull;denotesaloGoselineIbutaslongthebadnessvqal-uesݟisbGelow10000theresultisprobablyUUacceptable.EҍUnderfull?\vbox... while\output?isactiveIfacolumncontainsancharac-terfwithanunusualdepth,forexamplea`(',inthebGottomlinethenthismessagemayshowup.Itlusuallyhasnosigni canceaslongiyasthevqalueisnotmorethanUUafewpGoints.EҍLaTeX?Warning: Imovedsome?linestothenextpageAsmentionedabGove,']multicolssometimesscrewsupthefoGot-note!-numbGering.OAsapre-caution,cwheneverthereisafoGotnoteonapagethatwheremulticolshadtoleaveare-mainderforthefollowingpagethiswarningappGears. Check͟DŽffv9 thefoGotnotenumberingonthis page. Ifpitturnsoutthatit isHwrongyouhavetomanually breakXthepageusing\newpage ͲorUU\pagebreak[..].bFloats?andmarginparsnot allowed?inside`multicols' environment!1 ͲThis>messageappGearsifyoutry to*usethe\marginparcom- mandoranunstaredversionof theڧ gureortableenvironment. SuchUU oatswilldisappGear!R2.4'TracingtheoutputͲT*onunderstandthereasoningbGe-hindthedecisionsTU>'ExXmakeswhenERproGcessingamulticolsenvi-ronment,atracingmechanismisprovided.wIfyousetthecounter`multicols'2toapGositivehnumb}'eriͲyouthenwillgetsometracingin-formation-~ontheterminalandintheUUtranscript le:I͸h+F C cmbxti10numbi>erri9@=1*"V cmbx10.Qp=TU>'ExX willnow tellyou, Lwheneveritenters orleavesamulticolsenviron- ment,gthed8numbGerofcolumnsit is4workingonanditsdecision abGoutȅstartinganewpagebe- foreUUoraftertheenvironment.ffv9͸hnumbi>erri9@=2.Qp=Inthiscase you4alsogetinformationfrom the wbalancingroutine:Nthe heightsGtriedfortheleftand right-most~dcolumns, Ȧinforma- tion abGoutshrinkingifthe \raggedcolumns5gdeclarationis inforceandthevqalueofthe `unbalance'UUcounterifpGositive.͸hnumbi>erri9@=3.Qp=Setting ͸hnumb}'eri:߲to6thisvqaluewillad- ditionallytracethemarkhan- dlingealgorithm. Itwillshow whatmarksarefound,what marksareconsidered,4etc. T*o fullyБunderstandthisinforma- tionyouwillprobablyhaveto read3carefullytroughtheimple- mentation.͸hnumbi>erri9@4.Qp=Setting ͸hnumb}'eri;p߲tosuchahighvqalue will Fadditionallyplacean \hruleFGintoyouroutput,„sep- aratingthepartoftextwhich hadUPalreadybGeenconsidered onthepreviouspagefromthe rest.ClearlyZthissettingshould not:bGeHusedforthe nalout- put.Itwillalsoactivqateeven moredebuggingcoGdeformark handling.!č3LPrefacesfftoolderversions3.1Prefacetoversion1.4!Xߍ Beside xingsomebugsas mentionedinthemulticol.bug lethis3newreleaseenhancesthemulticolsjenvironmentbyallow-ing\mforbalancinginarbitrarycontexts.Z6Itisnow,.forexample,pGossible5tobalancetextwithinamulticolsoraminipageasshowninwu2whereamulticolsenviron-mentmwithinaquoteenvironmentwas2used.f8ItisnowevenpGossibletoUUnestmulticolsenvironments.! The_onlyrestrictiontosuchinner 8multicolsenvironments͟DŽffW(nested,zorsuwithinTU>'ExX'sinternal vertical ]moGde)isthatsuchvqari-antswillproGduceaboxwiththebalancedmaterialinit,1sothattheycannotbGebrokenacrosspagesUUorcolumns.Additionally,Irewrotetheal-gorithmcforbalancingsothatitwillnowproGduceslightlybGetterresults.IupGdated"thesourcedocumen-tationbutliketoapGologizeinad-vqance4forsome`leftover'4partsthat|lslippGedthroughtherevision.ffWAnotetopGeoplewholike tomimprovethebalancingalgo-rithmofmulticols:Thebalanc-ing]routineinnowplacedintoa)'ExX3,de neafasteralgorithmfor nd-4IF:Ǎ9oThew%macro\balance@columnsthatcontains thevcoGdeforbalancinggatheredmaterialisamacrowithoutparameters.zItassumesthatthematerialforbalancingisstoredinthebGox\mult@box{Ewhichisa\vbox.Italso\knows"abGoutcallparameterssetupbythemulticolsenvironment,Glike\col@number,etc. yItcanalsoassumethat\@colroomisthestillavqail-ableUUspaceonthecurrentpage.Whenit nishesitmustreturntheindivid-ual}columnsinbGoxessuitableforfurtherpro-cessingV\with\page@sofar.tThismeansthatthe?leftcolumnshouldbGestoredinboxreg-͟DŽffm9ister\mult@gfirstbox,thenextinregister \mult@firstboxA+2,FE...,onlythelastoneasb(anexceptioninregister\mult@grightbox.F*urthermoreithastosetuptwothemacros\kept@firstmarkG/and\kept@botmarktoholdthevqaluesforthe rstandbGottommarkasfoundRintheindividualcolumns.TherearesomedhelpGerfunctionsde nedinsectionwhichmay#abGeusedforthis.a Gettingthemarksright\by5hand"isnon-trivialanditmaypayo to rsttakealoGokatthedocumentationandimplementationof\balance@columnsbGelowbGeforeUUtryinganew.&v.JT*ableUU1:qInterfacedescriptionfor\balance@columns4ingžtherightcolumnheight,etc. IfsomebGodythinkshe/shehasanenhancement"IwouldbGepleased͟DŽ!ff9toEQlearnabGoutit.Butpleaseobey thecopyrightnoticeanddon'tchangeUUmulticol.dtxdirectly!!ff63.2Prefacetoversion1.2p Afteri;thearticleabGoutthemul- ticolsZenvironmentwaspublishedinTUGbGoaty10#3,_Igotnumer-ousrequestsforthesemacros.However,rIalsojgotachangedversionofmystyle le,. togetherwithaletteraskingmeifIwouldincludeVthechangestogetbGetterparagraphinghresultsinthecaseof &narrowlines. :Themaindif-ferences'tomyoriginalstyleop-tionwereadditionalparameters(like\multicoladjdemeritstobGe3usedfor\adjdemerits,ketc.)whichGwouldin uencethelinebreakingUUalgorithm. Butactuallyresettingsuchpa-rametersptozeroorevenworsetoaLnegativevqaluewon'tgivebGet-terclinebreaksinsidethemulticolsenvironment. vTU>'ExXsclinebreak-inggalgorithmwillonlyloGokatthosezpGossiblelinebreakswhichcanbGereachedwithoutabadnesshigher,thanthecurrentvqalueof\tolerance9(or\pretoleranceinWthe rstpass)..Ifthisisn'tpGos-sible,then,asalastresort,TU>'ExXwill}proGduceoverfull}boxes.Allthosec(andonlythose)pGossible͟fffbreakgpGointswillbeconsidered andd nallythesequencewhichre-sultsjinthefewestdemeritswillbGecchosen. lThismeansthatavqaluewof1000for\adjdemeritsͲinstructsTU>'ExXtoprefervisiblyin-compatiblemlinesinsteadofpro-ducingUUbGetterlinebreaks.However,withTU>'ExX3.0itispGossible&ctogetdecentlinebreakseven]insmallcolumnsbysetting\emergencystretchPtoanappro-priatelvqalue. Iimplementedaversionnwhichiscapableofrun-ning&bGothintheoldandthenewTU>'ExX(actuallyitwillsimplyig-noreI"thenewfeatureifitisnotavqailable).Thecalculationof\emergencystretchݲisprobablyincorrect.pIRmadeRafewtestsbutofecourseonehashaveemuchmoreexpGeriencewiththenewpossi-bilitiesctoachievecthemaximumquality*.V*ersiond1.1ahadanice`fea-ture':qtheURpGenaltyforusingthe5Qforbidden oatswastheirultimateՑremovqalfromL5ffA͉TU>'ExXs\@freelistŲsothatafterafew\marginparsinsidethemulti-fffcolscenvironment oatswheredis- abled'forever.(ThankstoChrisRowleyoforpGointingthisout.)IremovedthismisbGehaviourandatthesametimedecidedtoal-low}$atleast oatsspanningallcolumns,`e.g.,generated^bythefigure*environment.wY*oucansee*thenewfunctionalityinta-ble>2whichwasinsertedatthisverypGoint.kHoweversinglecol-umny oatsarestillforbiddenandIdon'tthinkIwillhavetimetotackleDthisprobleminthenearfu-ture. !AsSanadviceforallwhowantZtotry:waitforTU>'ExX3.0.ItJhasafewfeatureswhichwillmakelifemucheasierinmulti-columnsurroundings.eNeverthe-less.weareworkinghereattheedgepofTU>'ExXscapabilities,reallypGerfect,nsolutionswouldneedadi erentcapproachthanitwasdoneUUinTU>'ExXspagebuilder.The:MtextbGelowisnearlyun-changed,3IQonlymaddeddoGcumen-tationatplaceswherenewcoGdewasUUadded.5aIFǍ9\setemergencystretch:(ThisisahoAokforpeople whoblik9etoplayaround.uItissuppAosedtosetthe\emergencystretchn cmsy9h,j cmti9dimen9i'(registernpro9videdinthe%newTuAEX3.0.NThe rstargumen9tisthenum-bAerS'ofcolumnsandthesecondoneisthecurren9t\hsize."A9tthemomentthedefaultde nitionis͟Dff@4pt 95 #1,mi.e.) the\hsizeisn'tusedatall.WBut ma9ybAeTtherearebetterform9ulae. \set@floatcmds:ThisisthehoAokfortheexpertswhoxdlik9etoimplementafull oatmechanismforthe[multicolsen9vironment.The[@inthenameshouldTsignalthatthismigh9tnotbAeeasy:.T*able<2:2Thenewcommandsofmulticol.styversion1.2.GBothcommandsmightbGeremovedifgoGod'ExX,9i.e.,theq lethatwillproGducethedoGcumentation#youarecurrentlyreading.aNItwillbGeextracted"fromthis lebythedocstripprogram.Sincef"thisisthe rstcoGdeinthis leonecanproducetheD(doGcumentationsimplybyrunningL5ffA͉TU>'ExXonthe.dtxUU le. <s1 hdriveroi s2 \documentclass[draft]{ltxdoc}W*ewusethebalancingshowoptionwhenloadingmulticols_sothatfulltracingisproGduced.ThishastobGe=donebeforethedocpackqageisloaded,BsincedocotherwiseUUrequiresmulticolswithoutanyoptions.s3 \usepackage{multicol} s4 \usepackage{doc}Firstfdwesetupthepagelayoutsuitableforthisar-ticle.s5 \setlength{\textwidth}{39pc} s6 \setlength{\textheight}{54pc}s7 \setlength{\parindent}{1em}s8 \setlength{\parskip}{0ptplus1pt}s9 \setlength{\oddsidemargin}{0pc}10 \setlength{\marginparwidth}{0pc}11 \setlength{\topmargin}{-2.5pc}12 \setlength{\headsep}{20pt}13 \setlength{\columnsep}{1.5pc}W*eUUwantarulebGetweencolumns.14 \setlength\columnseprule{.4pt}W*e00alsowant00toensurethatanewmulticolsenvi-͟@]@ffronment ndsenoughspaceatthebGottomofthepage. 0Mͱ15w{\setlength\premulticols{6\baselineskip}jCͲWhenDbalancingcolumnswedisregardsolutionsthatareVtoGobad.7Also,ifthelastcolumnistoobadwetypGesetUUitwithoutstretch.ͱ16w{\setcounter{columnbadness}{7000} ͱ17w{\setcounter{finalcolumnbadness}{7000}jCͲTheindexissuppGosedtocomeoutinfourcolumns.iAndUUwedon'tshowmacronamesinthemargin.ͱ18w{\setcounter{IndexColumns}{4} ͱ19w{\let\DescribeMacro\SpecialUsageIndexͱ20w{\let\DescribeEnv\SpecialEnvIndexͱ21w{\renewcommand\PrintMacroName[1]{}ͱ22w{\CodelineIndexͱ23w{%\DisableCrossrefs3r%Partialindexͱ24w{\RecordChangesF%ChangelogjCͲLineUUnumbGersareverysmallforthisarticle.ͱ25w{\renewcommand{\theCodelineNo}ͱ26{\scriptsize\rm\arabic{CodelineNo}}ͱ27w{\settowidth\MacroIndent{\scriptsize\rm00\}ͱ2829w{\begin{document}ͱ30\typeoutͱ31!={****************************************ͱ321^^J*ExpectsomeUnder-andoverfullboxes.ͱ331^^J****************************************}ͱ34!=\DocInput{multicol.dtx}ͱ35w{\end{document}ͱ36w{h5" cmmi9=driveroi4.2Identi cationandoptionpro`cessing0** W*et#startbyidentifyingthepackqage. 1SinceitmakesuseoffeaturesonlyavqailableinL5ffA͉TU>'ExX2",ydwe͟@$^ffꢍensurethatthisformatisavqailable.&(NowthisisdoneUUearlierinthe le.) ^ͱ37w{hpack9age#g i6yF38 %\NeedsTeXFormat{LaTeX2e} 39 %\ProvidesPackage{multicol}[..../../..40 %Xv...multicolumformatting] NextUUwedeclareoptionssuppGortedbymulticols.41 \DeclareOption{twocolumn}42p{\PackageWarning{multicol}{Maynotwork43HLwithatwocolumnlayout}}T*racingAisdoneusingacounter.XHoweverAitisalso pGossibletoinvokethetracingusingtheoptionsde-claredUUbGelow. 44 \newcount\c@tracingmulticols͟ffͱ45w{\DeclareOption{errorshow} ͱ46&]{\c@tracingmulticols\z@}ͱ47w{\DeclareOption{infoshow}ͱ48&]{\c@tracingmulticols\@ne}ͱ49w{\DeclareOption{balancingshow}ͱ50&]{\c@tracingmulticols\tw@}ͱ51w{\DeclareOption{markshow}ͱ52&]{\c@tracingmulticols\thr@@}ͱ53w{\DeclareOption{debugshow}ͱ54&]{\c@tracingmulticols5\relax}ͱ55w{\ProcessOptions64.3StartingandEndingthemulticolsEnvironmentʍ+SAs+mentionedbGefore,3themulticolsenvironmenthas onemandatoryargument(thenumbGerofcolumns)andtuptotwotoptionalones.%W*estartbyreadingthe1numbGerofcolumnsintothe\col@numberregis-ter.:56 \def\multicols#1{\col@number#1\relax;Iftheuserforgottheargument,TU>'ExXwillcomplainabGoutRamissingnumberRatthispoint.1Theerrorrecoverymechanismwillthenusezero,whichisn'ta$goGodchoiceinthiscase.4Soweshouldnowtestwhether|everythingisokqay*.DTheminimumistwocolumnsUUatthemoment.57\ifnum\col@number<\tw@ 58"J\PackageWarning{multicol}%59'2{Using`\number\col@number'60+columnsdoesn'tseemagoodidea.^^J61+Ithereforeusetwocolumnsinstead}%62"J\col@number\tw@\fi;Atthemomentwecan'thavemorethan ve columns5otherwisesomealloGcatedboxregisterwillbGeoverwritten.ThisisonlyatemprestrictionandwillUUbGeremoved.63\ifnum\col@number>10 64"J\PackageError{multicol}%65'2{Toomanycolumns}%66'2{Currentimplementationdoesn't67+supportmorethan10columns.%68+\MessageBreak69+Ithereforeuse10columnsinstead}%70"J\col@number10\fi;NowUUwecansafelyloGokfortheoptionalarguments.71\@ifnextchar[\mult@cols{\mult@cols[]}}kThe\mult@colsmacrograbsthe rstoptionalar- gumentUU(ifany)andloGoksforthesecondone.72 \def\mult@cols[#1]{\@ifnextchar[%ThisargumentshouldbGeahdimenci,denotingthe minimumfreespaceneededonthecurrentpageto͟vff)Sstart theenvironment.4If theuserdidn'tsupplyone, weUUuse\premulticolsasadefault.$Aͱ73{\mult@@cols{#1}}% ͱ74{\mult@@cols{#1}[\premulticols]}}A덑ͲAfterremovingallargumentsfromtheinputweareableUUtostartwith\mult@@cols.ͱ75w{\def\mult@@cols#1[#2]{%$AͲFirst1thingwedoistodecidewhetherornotthisisanunbGoundedmulticolsenvironment,i.e.lonethatmay splitacrosspages,oronethathastobGetypGesetintoabGox.JIfweareinTU>'ExX's\inner"moGde(e.g.,insidexabGoxalready)thenwehaveabGoxedversionofʰmulticolsthereforewesetthe@boxedmulticolsͲswitchytotrue.E~ThemulticolsshouldstartinverticalmoGde.\mIfwearenotalreadytherewenowforceitwith \parsinceotherwisethetestfor\inner"moGdewouldn'tUUshowifweareinabGox.ͱ76\par ͱ77\ifinner\@boxedmulticolstrue$AͲOtherwisewecheck\doublecol@number.xThiscounterVViszerooutsideamulticolsenvironmentbutpGositivedAinside(thishappensalittlelateron).Inthe msecondcaseweneedtoproGcessthecurrentmul-ticolsaalsoin\bGoxedmode"andsochangetheswitchaccordingly*.ͱ78\else ͱ79&]\ifnum\doublecol@number>\z@ͱ804\@boxedmulticolstrueͱ81&]\fiͱ82\fi$AͲThenUUweloGoktoseeifstatisticsarerequested:ͱ83\mult@info\z@ͱ84/{Startingenvironmentwithͱ854\the\col@number\spacecolumns%$AͲInUUbGoxedmodeweaddsomemoreinfo.ͱ869D+\if@boxedmulticols\MessageBreakͱ87Gp(boxedmode)\fiͱ88/}%7DFO]Thenwemeasurethecurrentpagetoseewhethera usefulpGortionofthemulticolumnenvironmentcanbGeUUtypeset.qThisroutinemightstartanewpage.6189p\enough@room{#2}%61Nowweoutputthe rstargumentandproGducever-ticalspaceabGovethecolumns.?(Notethatthisargu-mentcorrespGondstothe rstoptionalargumentofthe6multicolsenvironment.)'ExXisnotinvokingtheoutput routine.JvZ100w{\def\enough@room#1{%JuͲMeasuring5Smakesonlysensewhenwearenotin\bGoxedmode"sotheroutinedoesnothingiftheswitchUUistrue.Z101!=\if@boxedmulticols\else Z102!=\parJuͲT*o_emptythecontributionlistthe rstreleasecon-tainedEapGenaltyzerobutthishadtheresultthat\addvspace[couldn'tdetectprecedingglue.vSothiswasĿchangedto\addpenalty.ButthisturnedouttobGenotenoughas\addpenaltywillnotaddapGenaltySwhen@nobreakistrue.Thereforeweforcethis/switchloGcallytofalse.EAsaresulttheremaybGe{abreakbetween{precedingtextandthestartofamulticolsenvironment,Jbutthisseemsacceptablesincethereistheoptionalargumentforexactlythisreason.Z103!=\bgroup\@nobreakfalse\addpenalty\z@\egroup Z104!=\page@free\pagegoalZ105!=\advance\page@free-\pagetotalJuͲT*olbGeabletooutputthevqalueweneedtoassignit toZNaregister rstsinceitmightbGearegister(de-fault)inwhichcaseweneedtouse\theoritmightbGeaplainvqalueinwhichcase\thewouldbGewrong.Z106+i\@tempskipa#1\relaxJuͲNowN5wetestwhethertracinginformationisrequired:Z107!=\mult@info\z@ Z1084{Currentpage:\MessageBreakZ1099D+height=%Z1109D+\the\pagegoal:used\the\pagetotalZ1119D+\space->free=\the\page@freeZ1129D+\MessageBreakZ1139D+needed\the\@tempskipaZ114U\space(for#1)}%JuͲOurlastactionistoforceapagebreakifthereisn't enoughUUroGomleft.Z115!=\ifdim\page@free<#1\newpage\fiZ116\fi}aͲWhen[preparingformulticolumnoutputseveral thingsUUmustbGedone.Z117w{\def\prepare@multicols{%JuͲW*estartsavingthecurrent\@totalleftmarginͲandthenresettingthe\parshapeincaseweareinsideRsomelistenvironment. TheRcorrectinden-tationforthemulticolsenvironmentinsuchacasewillױbGeproducedbymovingtheresulttotherightby\multicol@leftmarginlateron.IfwewouldJff2x J= "5-:7LܿSeeXthedo'ExXsometimes~callstheoutputroutinefor oatmanage-ment.^8SThereforeweusethesecondbGestsolutionbyinitializingڸitwith\firstmark.HInfact,>forourpur-pGosethisdoesn'tmatterasweuse\kept@topmarkͲonly=toinitialize\firstmarkand\botmarkofafol-lowing'ExXmaintainsthefreeroGomonthepage(i.e. nthepageheightwithoutthespaceforalreadycontributedP oats)intheregister\@colroom.aW*emustsubtracttheheightof\partial@pagetoputtheUUactualfreeroGomintothisvqariable.)썍Z160&]\advance\@colroom-\ht\partial@pageͲThen-wehavetocalulatethe\vsizevqaluetouseduringccolumnassembly*.\set@mult@vsizetakesffff2x J= "5-:8LܿDuringXsucÎhacallthe\botmarkgetsgloballycopiedto\topmarkbytheTAEMXprogram.9 zFO]an?argumentwhichallowstomakethesettingloGcal (\relax)corglobal(\global).xThelattervqariantisused^insidetheoutputroutinebGelow.{At^thispointhere|rwehavetomakealoGcalchangeto\vsizebGe-causenwewanttogettheoriginalvqaluefor\vsizerestoredincasethismulticolsenvironmentendsontheUUsamepagewhereithasstarted.F161\set@mult@vsize\relaxFNowweswitchtoanew\outputroutinewhichwillbGeusedtoputthegatheredcolumnmaterialto-gether.162\output{\multi@column@out}%FFinally|wehandlethefoGotnoteinsertions.CW*ehavetoumultiplythemagni cationfactorandtheextraskipbythenumbGerofcolumnssinceeachfoGotnotereducesL-thespaceforeverycolumn(remembGerthatwehavepagewidefoGotnotes).\If,#ontheotherhand,foGotnotesaretypesetattheveryendofthedocu-ment,2 our)7schemestillworkssince\count\footinsisWzerothen,:soitwillnotchange.xT*oallowevenfurthert&customizationthesettingofthe\footinsparametersUUisdoneinaseparatemacro.163\init@mult@footinsFF*orthesamereason(pagewidefoGotnotes), thehdimenci)9˲registerkcontrollingthemaximumspaceusedforfoGotnotesisn'tchanged.UHavingdonethis,weRmustreinsertallthefoGotnoteswhicharealreadypresentH(i.e.thoseencounteredwhenthematerialsavedXin\partial@pagewas rstproGcessed).yThiswill;reducethefreespace(i.e.\pagetotal)bytheappropriatefamountsincewehavechangedthemag-ni cationUUfactor,etc.abGove.164\reinsert@footnotesFAll,'ExXtoproGduce`good'paragraphswithinnar-rowUUcolumns.166\vbadness\@Mi\hbadness5000 167\tolerance\multicoltoleranceFSinceLnearlyalwaysLthe rstpasswillfailweignoreittcompletelytellingTU>'ExXtohyphenatedirectly*.t$Inͩ'Tvyfffact,wenowuseanotherregistertokeepthevqalue forExXweset\emergencystretch_Zto\col@numberA q84pt.How-ever[%thisisonlyaguesssoatthemomentthisisdonepinamacro\setemergencystretchwhichgetsthecurrent\hsizeandthenumbGerofcolumnsasarguments.ThereforehIusersareableto gureouttheirUUownformula. "Z169\setemergencystretch\col@number\hsize"ͲAnotherrhoGoktoallowpeopleaddingtheirownextensionsQwithoutmakinganewpackqageis\set@floatcmdsEwhichhandlesanyrede nitionsofL5ffA͉TU>ExXsinternal oatcommandstoworkwiththemulticolsenvironment. (DAtthemomentitisonlyusedUUtorede ne\@dblfloatand\end@dblfloat. "Z170\set@floatcmds"ͲAdditionally*, C]we z*advqance\baselineskipby\multicolbaselineskiptoallowcorrectionsfornarrowUUcolumns.Z171\advance\baselineskip\multicolbaselineskip"ͲThe.\hsizeofthecolumnsisgivenbytheformula:N<$4\linewidthE8(\col@number;1)\columnsep4wfe1\ (֍M8\col@number΍ͲTheformulaabGovehaschangedfromreleasetorelease. W*e$nowstartwiththecurrentvqalueof\linewidthuزsothatthecolumnwidthispropGerlycalculatedwhenweareinsideaminipageoralistor4someotherenvironment.This4willbGeachievedwith:Z172\hsize\linewidth\advance\hsize\columnsep Z173\advance\hsize-\col@number\columnsepZ174\divide\hsize\col@number"ͲW*e6alsoset\linewidthto\hsizebutleave \columnwidth9Ҳunchanged.hThisisinconsistent,?Sbut\columnwidthGisusedonlyby oats(whicharen'tallowed]intheircurrentimplementation)andbythe\footnotemacro.SincewewantpagewidefoGot-notes^9 Sthissimpletricksavesusfromrewritingthe\footnoteUUmacros.Beforekwechange\linewidthtothenewvqaluewerecorditsoldvqalueinsomeregistercalled\full@width.ThisvqalueisusedlateronwhenwepackqageUUallcolumnstogether.ff2x J= "5-:9LܿI'm notsurethatIreallywÎant pagewidefothatrequiredi erentamountofspaceswhenUUtypGesettingfootnotes. 178 \def\init@mult@footins{% 179\multiply\count\footins\col@number180\multiply\skip\footins\col@number181 }Sincewehavetoset\col@umbercolumnsonone page, eachwithaheightof\@colroom, wehavetoassign"]\vsize'=\col@number@=\@colroom6#Ѳin"]or-derwtocollectenoughmaterialbGeforeenteringthe\output}(routineagain. ?Infactwehavetoaddanother(\col@number=ϲ1)(\baselineskipH1\topskip))UUifyouthinkabGoutit. 182 \def\set@mult@vsize#1{% 183\vsize\@colroom184\@tempdima\baselineskip185\advance\@tempdima-\topskip186\advance\vsize\@tempdima187\vsize\col@number\vsize188\advance\vsize-\@tempdima ButthismightnotbGeenoughsinceweuse\vsplit lateratoextractthecolumnsfromthegatheredma-terial.&Thereforerweaddsome`extralines,'~thenum-bGereRdependingonthevqalueofthe`multicols'counter.TheFS nalvqalueisassignedgloballyif#1is\globalbGecausewewanttousethismacrolaterinsidetheoutputUUroutinetoGo.189#1\advance\vsize 1900w^\c@collectmore\baselineskip}HereVisthedimenregisterweneedforsavingawaytheUUoutervqalueof\@totalleftmargin.191 \newdimen\multicol@leftmarginWhentheendofthemulticolsenvironmentissensedwe_havetobalancethegatheredmaterial.DepGend-ing6onwhetherornotweareinsideabGoxedmulticoldi erentthingsmusthappGen.But rstweendthecurrentUUparagraphwitha\parcommand.192 \def\endmulticols{\par 193\if@boxedmulticols InҽbGoxedmodewehavetoclosethebGoxinwhichwehaveUUgatheredallmaterialforthecolumns.194\egroup͟]]ff0ͲNowMwecall\balance@columnstheroutinethat balancesUUmaterialstoredinthebGox\mult@box.RZ195&]\balance@columnsRͲAfterbalancingtheresulthastobGereturnedbythecommand\page@sofar.#ButbGeforewedothiswereinsertUUanymarksfoundinbGox\mult@box.Z196&]\return@nonemptymark{first}% Z197cq\kept@firstmarkZ198&]\return@nonemptymark{bot}%Z199h\kept@botmarkZ200&]\page@sofarZ201&]\global\let\kept@firstmarkZ202ZWE\l@kept@firstmarkZ203&]\global\let\kept@botmarkZ204L*\l@kept@botmarkZ205w{hma9rktrace+iZ206&]\mult@info\tw@Z207/{Restorekeptmarksto\MessageBreakZ2084first:\meaning\kept@firstmarkZ2094\MessageBreakbot\space\space:Z210v\meaning\kept@botmark}%Z211w{h=ma9rktrace+iͲThisUU nishesthecoGdeforthe\boxed"case.Z212\elseRͲIfmweareinanunrestrictedmulticolsenvironment weendthecurrentparagraphwith\parbutthisisn't0sucientsinceTU>'ExXsp}'ageffbuilderwillnotto-tallyemptythecontributionlist.^10/Thereforewemustalsoaddanexplicit\penalty.Nowthecon-tribution listwillbGeemptiedand,iifitsmaterialdoGesn'trall tontothecurrentpagethentheoutputroutine+willbGecalledbeforewechangeit. &AtthispGoint[weneedtouse\penaltynot\addpenaltytoensureathata)therecentcontributionsareemptiedandAb)thattheverylastitemonthemainverticallistjisavqalidbreakpGointsothatTU>'ExXbreaksthepageUUincaseitisoverfull.Z213!=\penalty\z@RͲNow3it'ssafetochangetheoutputroutineinordertoUUbalancethecolumns.Z214&]\output{\balance@columns@out}\ejectRͲIfthemulticolsenvironmentbGodywascompletelyemptyorifamulti-pagemulticolsjustendsatapageRbGoundarywehavetheunusualcasethatthe\ejectwillhavenoe ect(sincethemainverticallist+isempty)|thus+nooutputroutineiscalledatall.|lAsXaresultthematerialprecedingthemulticolsffff2x J=w-:10LܿThisɸoncecausedapuzzlingbugwheresomeofthematerialwÎasbalancedtwice, resultinginsomeoverprints.@Thereason wÎasthe\ejectwhichwasplacedattheendofthecontributionlist.Thenthepage҉ff$(builderwascalled(anexplicit\penaltywill?emptÎythecontributionlist),butthelinewiththe\ejectdidn't tontothecurrentpage.ItwasthenreconsideredaftertheXoutputroutinehadended,causingasecondbreakafteroneline.11 Fy (stored(in\partial@pagewillgetlostifwedon't takeUUofthisbyhand. )`215\ifvbox\partial@page 21650\unvbox\partial@page\fi)`AftertheoutputroutinehasactedwerestoreweresetUUthekeptmarkstotheirinitialvqalue.217"J\global\let\kept@firstmark\@empty 218"J\global\let\kept@botmark\@empty219 hma9rktrace+i220"J\mult@info\tw@221+{Makekeptmarksempty}%222 h=ma9rktrace+i223\fi)`TheoutputroutineabGovewilltakecareofthe \vsize/andreinsertthebalancedcolumns,7etc.MButitcan'treinsertthe\footnotesbGecausewe rsthave_torestorethe\footinsparametersinceweare6returningtoonecolumnmoGde. 'ExXcountersareal-waysUUchangedthisway*.^11229\global\c@unbalance\z@)`W*eFalsotakealoGokattheamountoffreespaceonthe6Kcurrentpagetoseeifit'stimeforapagebreak.Theverticalspaceaddedthereafterwillvqanishif\enough@roomUUstartsanewpage.͟DŽff9Z230\enough@room\postmulticols Z231\addvspace\multicolsepKLͲIfpstatisticsarerequiredwe nallyrepGortthatwe haveUU nishedeverything.KKZ232\mult@info\z@Z233+i{EndingenvironmentZ234P\if@boxedmulticolsZ235_\space(boxedmode)\fiZ236U}}Z[ͲLet_usendthissectionbyalloGcatingalltheregistersusedUUsofar.KKZ237w{\newcount\c@unbalanceZ238w{\newcount\c@collectmoreKLͲInthenewL5ffA͉TU>'ExXrelease\col@numberisalreadyal-loGcatedUUbythekernel,sowedon'talloGcateitagain.KKZ239w{%\newcount\col@numberZ240w{\newcount\doublecol@numberZ241w{\newcount\multicoltoleranceZ242w{\newcount\multicolpretoleranceZ243w{\newdimen\full@widthZ244w{\newdimen\page@freeZ245w{\newdimen\premulticolsZ246w{\newdimen\postmulticolsZ247w{\newskip\multicolsepZ248w{\newskip\multicolbaselineskipZ249w{\newbox\partial@pageZ250w{\newbox\last@lineKLͲAndUUherearetheirdefaultvqalues:Z251w{\c@unbalance,=0Z252w{\c@collectmore=0KLͲT*o[kallowcheckingwhethersomemacroisused within nthemulticolsenvironment nthecounter\col@number<getsadefaultof1outsidethetheen-vironment.Z253w{\col@number=1 Z254w{\multicoltolerance=9999Z255w{\multicolpretolerance=-1Z256w{\premulticols=50ptZ257w{\postmulticols=20ptZ258w{\multicolsep=12ptplus4ptminus3ptZ259w{\multicolbaselineskip=0pt4.4TheoutputroutinesZʍ W*e3 rststartwithsomesimplemacros.aWhen typGesetting¨thepagewesavethecolumnseitherinthe&"bGoxregisters0,ZU2,4,...(locally)&"or1,ZU3,5,...(globally).ThisPis2- cmcsc10PlainTU>'ExXpGolicytoavoidPanover owUUofthesaveUUstack.͟O ffuThereforewede nea\process@colsmacrotohelp usinusingtheseregistersintheoutputroutinesbGelow. ʦIthastwoarguments:\the rstoneisanumbGer;pVthesecondoneistheprocessinginforma-tion.L\ItloGopsstartingwith\count@=#1(\count@isajscratchregisterde nedinPlainTU>'ExX),ɯproGcesses ff2x J=w-:11LܿActuallyJ,XwÎearestillinagroupstartedbythe\beginmacro,so\globalmustb2790w^\the\full@width\space=\the\hsize2800w^\spacex\the\col@number)%281"J}%t At?thispGointweshouldalwaysbGeinverticalmoGde.282 \ifvmode\else\errmessage{MulticolError}\fiNow #weputallcolumnstogetherinan \hbox ߲ofwidth\full@width(shiftingitby͟qO]ff\multicol@leftmargin`totherightsothatitwill bGe6placedcorrectlyifwearewithinalistenviron-ment)HZ283!=\moveright\multicol@leftmargin Z284&]\hboxto\full@width{%HͲandUUseparatingthecolumnswitharuleifdesired.Z285+i\process@cols\mult@gfirstbox{\box\count@Z2864\hss\vrule\@width\columnseprule\hss}%HͲAs6youwillhavenoticed,pwestartedwithbGoxregis- terL^\mult@gfirstbox(i.e.theleftcolumn).nSothistimeaf\count@loGopedafthrough2,dj4,... (plusaftheap-propriateo set).8FinallyweaddbGox0andclosethe\hbox.HZ287+i\box\mult@rightboxͲThe)depthofthecolumnsdepGendontherelastlines.T*oensurethatwewillalwaysgetasimilarloGokasfarGastherulesareconcernedweforcethedepthatleastUUthedepthofa\strut.HZ288w{%\strut Z289/\rlap{\phantomp}%Z290w{}%Z291w{}UͲBefore:wetacklethebiggeroutputroutineswe de ne^6justonemoremacrowhichwillhelpusto ndourwaythroughthemysterieslater.\reinsert@footnotesOpwilldowhatitsnamein-dicates:dit)reinsertsthefoGotnotespresentin\footinboxsothattheywillbGereprocessedbyTU>'ExX'sUUp}'ageffbuilder. lInsteadofactuallyreinsertingthefoGotnotesweinsertCanemptyfoGotnote.PThiswilltriggerinsertionmechanism"aswellandsincetheoldfoGotnotesaretheir5bGoxandweareonafreshpage\skipfootinsͲshouldUUbGecorrectlytakenintoaccount.Z292w{\def\reinsert@footnotes{\ifvoid\footins\else Z293=\insert\footins{}\fi}UͲNow9wecan'tpGostponethedicultiesanylonger.The,\multi@column@outroutinewillbGecalledintwousituations. X'Eitherthepageisfull(i.e.wehaveQAcollectedenoughmaterialtogeneratealltherequiredcolumns)ora oatormarginpar(ora\clearpageƲissensed.Inthelattercasethe\outputpenalty*pislessthan10000,3otherwisethepGenaltyowhichtriggeredtheoutputroutineishigher.ThereforeOit'seasytodistinguishbGothcases:wesim-plyUUtestthisregister.Z294w{\def\multi@column@out{% Z295!=\ifnum\outputpenalty<-\@Mfff2x J=w-:12LܿYJouwillseethereasonforthisnÎumb }%xxThenUUthelastcolumnfollows.314p\setbox\mult@rightbox315+\vsplit\@cclvto\dimen@316p\set@keptmarks317p\ifshr@nking318'2\setbox\mult@rightbox\vboxto\dimen@3199{\unvbox\mult@rightbox\vfill}%320p\fixxHavingthisdonewehopGethatbox255isemptied. IfUUnot,wereinsertitscontents.321p\ifvoid\@cclv\else322+\unvbox\@cclv323+\penalty\outputpenalty͟ffͲIn:uthiscaseafoGotnotethathappenstofallinto the0leftoverbitwillbGetypGesetonthewrongpage.Therefore7Mwewarntheuserifthecurrentpagecon-tainsVfoGotnotes.tTheolderversionsofmulticolspro-ducedRthiswarningregardlessofwhetherornotfoGot-notes\%wherepresent,]resultinginmanyunnecessarywarnings.d Z3244\ifvoid\footins\else Z325=\PackageWarning{multicol}%Z326BW{ImovedsomelinestoZ327Gpthenextpage.\MessageBreakZ328GpFootnotesonpageZ329Gp\thepage\spacemightbewrong}%Z3304\fid ͲIfthe`tracingmulticols'counteris4orhigherwealso addUUarule.Z3314\ifnum\c@tracingmulticols>\thr@@Z332q3\hrule\allowbreak\fiZ333!=\fid ͲT*o6getacorrectmarksforthecurrentpage we`haveto(loGcallyrede ne\firstmarkand\botmark.>If\kept@firstmarkisnon-emptythen\kept@botmarkmustbGenon-emptytoGosowecanuseN7theirvqalues. \lOtherwiseweusethevalueof\kept@topmark=whichwas rstinitializedwhenwegatheredAthe\partical@pageandlateronwasup-datedUUtothe\botmarkfortheprecedingpage㍍Z334!=\ifx\@empty\kept@firstmark Z335/\let\firstmark\kept@topmarkZ336/\let\botmark\kept@topmarkZ337!=\elseZ338/\let\firstmark\kept@firstmarkZ339/\let\botmark\kept@botmarkZ340!=\fi㍑ͲW*e~alsoinitalize\topmarkwith\kept@topmark. ThiswillmakethismarkokqayforallmiddlepagesofUUthemulticolsenvironment.Z341!=\let\topmark\kept@topmark Z342w{hma9rktrace+iZ343!=\mult@info\tw@Z3449D+{Usekepttopmark:\MessageBreakZ345BW\meaning\kept@topmarkZ346=\MessageBreakZ347=Usekeptfirstmark:\MessageBreakZ348BW\meaning\kept@firstmarkZ3499D+\MessageBreakZ350=Usekeptbotmark:\MessageBreakZ351BW\meaning\kept@botmarkZ3529D+\MessageBreakZ353=Producefirstmark:\MessageBreakZ354BW\meaning\firstmarkZ3559D+\MessageBreakZ3569D+Producebotmark:\MessageBreakZ357BW\meaning\botmark14),F]035850\@gobbletwo}% 359 h=ma9rktrace+iWithhIalittlemoree ortwecouldhavedonebGet- ter..IfOwehad, forexample,recordedtheshrinkqageofthematerialin\partial@pageitwouldbGenowpGossiblextotryhighervqaluesfor\dimen@(i.e.thecolumn[jheight)toovercometheproblemwiththenonemptyޑbGox255. zButthiswouldmakethecoGdeevenmorecomplexsoI?skippGeditinthecurrentimplementation. D Now weuseL5ffA͉TU>'ExX'sstandardoutputmecha-nism.^13 ꭲAdmittedlyUUthisisafunnywaytodoit.ٞ360p\setbox\@cclv\vbox{\unvbox\partial@page361r\page@sofar}%ٞThemacro\@makecoladdsall oatsassignedforthecurrentpagetothispage.P\@outputpageshipsoutotheresultingbGox.Notethatitisjustpossiblethatjsuch oatsarepresentevenifwedonotallowanyUUinsideamulticolsenvironment.362p\@makecol\@outputpageAfter?3thepageisshippGedoutwehavetopre-parexthekeptmarksforthefollowingpage.\kept@firstmark@and\kept@botmarkreinitilizedbysettingthemto\@empty.KThevqalueof\botmarkisUUthenassignedto\kept@topmark.363"J\global\let\kept@topmark\botmark 364"J\global\let\kept@firstmark\@empty365"J\global\let\kept@botmark\@empty366 hma9rktrace+i367"J\mult@info\tw@3680w^{(Re)Inittopmark:\MessageBreak36950\meaning\kept@topmark37050\@gobbletwo}%371 h=ma9rktrace+iNowwereset\@colroomto\@colhtwhichis L5ffA͉TU>'ExX'sUUsavedvqalueof\textheight.372p\global\@colroom\@colhtThen'weproGcessdeferred oatswaitingfortheir chanceUUtobGeplacedonthenextpage.373p\process@deferreds 374p\@whilesw\if@fcolmade\fi{\@outputpage375'2\global\@colroom\@colht376'2\process@deferreds}%Iftheuserisinterestedinstatisticsweinformhim abGoutUUtheamountofspacereservedfor oats.377p\mult@info\@ne378"J{Colroom:\MessageBreak379'2\the\@colht\space380Lafterfloatspaceremoved381L=\the\@colroom\@gobble}%͟p]ff0ͲHavingdoneallthiswemustpreparetotacklethe nextpage. Thereforeweassignanewvqalueto\vsize.!New,r-bGecause9b\partial@pageisnowemptyands\@colroommightbGereducedbythespacere-servedUUfor oats.i󍍑Z382&]\set@mult@vsize\globaliͲTheSN\footinsskipregisterwillbGeadjustedwhentheUUoutputgroupisclosed.Z383\fi}ͲThismacroisusedtosubstracttheamountofspaceoGccupied5byfootnotesforthecurrentspacefromthespace9avqailableforthecurrentcolumn.tThespacecurrentcolumnisstoredin\dimen@.SeeabGovetotheUUdescriptionofthedefaultaction.Z384w{\def\leave@mult@footins{% Z385!=\advance\dimen@-\skip\footinsZ386!=\advance\dimen@-\ht\footinsZ387w{}ͲW*ecleftouttwocmacros:\process@deferredsand \speci@ls.Z388w{\def\speci@ls{%Z3891\ifnum\outputpenalty<-\@MiiͲIf'weencountera oatoramarginparinthecur- rentimplementationwesimplywarntheuserthatthis isnotallowed.Then wereinsertthepageanditsUUfoGotnotes.Z390!=\PackageWarning{multicol}% Z391Gp{FloatsandmarginparsnotZ392L*allowedinside`multicols'Z393L*environment!Z394Gp\@gobble}%Z395!=\unvbox\@cclv\reinsert@footnotesiͲAdditionallyweemptythe\@currlisttoavoid latererrormessageswhentheL5ffA͉TU>'ExXoutputroutineisagaininforce. But rstwehavetoplacethebGoxesظbackontothe\@freelist.H>(\@eltsdefaultis\relaxUUsothisispGossiblewith\xdef.)Z396!=\xdef\@freelist{\@freelist\@currlist}% Z397!=\gdef\@currlist{}%iͲIfLthepGenaltyis10001itwillcomefroma\clearpageMandwewillexecute\@doclearpagetogetUUridofanydeferred oats.Z3981\else\@doclearpage\fi Z399w{}\process@deferredsisasimpli edversionofL5ffA͉TU>'ExX's[\@startpage. W*e rstcallthemacro\@floatplacementtosavethecurrentuserparame-tersininternalregisters.:Thenwestartanewgroupffff2x J=w-:13LܿThisnwillpro'ExXassem- bles8materialinabGox,)the rstlineisn'tprecededby!interlineglue,&i.e. ׽thereisnoparameterlike\boxtopskipDinTU>'ExX.l,Thismeansthatthebaselineofythe rstlineinourbGoxisatsomeunpredictablepGointdependingontheheightofthelargestcharac-ter7inthisline.lButofcoursewewantallcolumnsto4#alignpropGerlyatthebaselinesoftheir rstlines.F*orthisreasonwehaveopGened\mult@boxwitha\penaltyl-10000. Thiswillnowallowustosplito :xfrom\mult@boxatinybit(infactnothingsincetheK rstpGossiblebreak-pointisthe rstiteminthebGox).$Theresultisthat\splittopskipisinsertedatthetopof\mult@boxwhichisexactlywhatwelikeUUtoachieve.8䍍438p\setbox\@tempboxa\vsplit\mult@boxto\z@8䍲Next!wetryto ndasuitablestartingpGointforthecalculationofthecolumnheight.mzItshouldbGelessthantheheight nallychosen,butlargeenoughto?reachthis nalvqalueinonlyafewiterations.Theformulawhichisnowimplementedwilltrytostart withthenearestvqaluewhichisamultipleof\baselineskip.yThe:icoGdingisslightlytrickyinTU>'ExXandUUtherearepGerhapsbetterwaysUU...439p\@tempdima\ht\mult@box 440p\advance\@tempdima\dp\mult@box441p\divide\@tempdima\col@number8䍲ThecoGdeabovesets\@tempdimatothelengthof acolumnifwesimplydividethewholebGoxintoequal(pieces.T*ogettothenextlower(multipleof\baselineskipቲweconvertthisdimentoanum-bGer#(thenumber#ofscaledpoints)thendividethisby@\baselineskip(alsoinscaledpGoints)andthenmultiplythisresultwith\baselineskipassigningthehresultto\dimen@.iThismakes\dimen@to\@tempdimena.442p\count@\@tempdima 443p\divide\count@\baselineskip444p\dimen@\count@\baselineskip8䍲Nextstepistocorrectourresultbytaking intoJaccountthedi erencebGetween\topskipand\baselineskip.+W*e=startbyadding\topskip;;ifthis6makestheresulttoGolargethenwehavetosub-stractUUone\baselineskip.445p\advance\dimen@\topskip 446p\ifdim\dimen@>\@tempdima447"J\advance\dimen@-\baselineskip448p\fi8䍲At}theuser'srequestwestartwithahighervqalue(or lower,0 but&thisusuallyonlyincreasesthenumbGer&oftries).449p\advance\dimen@\c@unbalance\baselineskip͟@@ffͲW*eUUtypGeoutstatisticsifwewereaskedtodoso. ffZ450!=\mult@info\@ne Z451/{Balancecolumns\on@line:Z4529D+\ifnum\c@unbalance=\z@\elseZ4534(offbalance=\number\c@unbalance)\fiZ454/\@gobbletwo}%ffͲButUUwedon'tallownonsensevqaluesforastart.Z455!=\ifnum\dimen@<\topskipZ456+i\mult@info\@neZ4574{StartvalueZ458BW\the\dimen@ s,\space->Z459BW\the\topskip\space(corrected)}%Z460+i\dimen@\topskipZ461!=\fiffͲNowwetryto ndthe nalcolumnheight.,0W*estart bysetting\vbadnesstoin nity(i.e.10000)tosup-pressLounderfullbGoxreportswhilewearetryingto ndSanacceptablesolution.W*edonotneedtodoitsinagroupsinceattheendoftheoutputroutineeverythingWuwillbGerestored.x&Thesettingofthe nalcolumnsVwillnearlyalwaysVproGduceunderfullboxeswithbadness10000sothereisnopGointinwarningtheUUuserabGoutit.Z462!=\vbadness\@MffͲW*eOalsoallowforoverfullbGoxeswhilewetryingtosplitUUthecolumns.Z463!=\vfuzz\col@number\baselineskipffͲThe vqariable\last@trywillholdthedimensionusedintheprevioustrialsplitting. W*einitializeitUUwithanegativevqalue.Z464!=\last@try-\p@ Z465!=\loopffͲInordernottoclutterupTU>'ExX'svqaluablemainmemoryɯwiththingsthatarenolongerneeded,weempty allgloballyusedbGoxregisters.`RThisisneces-saryaifwereturntothispGointafteranunsuccessfultrial.!W*ecuse\process@colsforthispurpGose,}start-ing'ExX'sP1\loop...\repeatmechanismcannotbGeUUnestedonthesamelevelofgrouping.Z466&]{\process@cols\mult@grightbox Z467Gp{\global\setbox\count@Z468m=\box\voidb@x}}%ffͲTheVcontentsofbGox\mult@boxarenowcopiedglob- ally HtobGox\mult@grightbox. (Thiswillbetheright-mostUUcolumn,asweshallseelater.)Z469&]\global\setbox\mult@grightbox Z470Gp\copy\mult@boxffͲW*evstartwiththeassumptionthatthetrialwillbGesuccessful.-IfweendupwithasolutiutionthatistoGoUUbadwesettoo@badtofalse.Z471w{hbadness"i17gF]0472p\global\too@badfalse 473 h=badness"i}UsingY\vsplitweextracttheothercolumnsfrom bGox[register\mult@grightbox.?ThisleavesbGoxreg-isters\mult@boxuntouchedssothatwecanstartoveragainUUifthistrialwasunsuccessful.}474p{\process@cols\mult@firstbox{%47550\global\setbox\count@47650\vsplit\mult@grightboxto\dimen@}After leverysplitwecheckthebadnessoftheresult-ingcolumn,ZnormallytheamountofextrawhiteintheUUcolumn.}477 hbadness"i47850\ifnum\c@tracingmulticols>\@ne479> \@tempcnta\count@480> \advance\@tempcnta-\mult@grightbox481> \divide\@tempcnta\tw@482> \message{^^JColumn483L\number\@tempcnta\space484Qxbadness:\the\badness\space}%48550\fi}If,othisbadnessislargerthetheallowed,ocolumn-badnesswerejectthissolutionbysettingtoo@badtoUUtrue.}48650\ifnum\badness>\c@columnbadness487> \ifnum\c@tracingmulticols>\@ne488HL\message{toobad489_:(>\the\c@columnbadness)}%490> \fi491> \global\too@badtrue49250\fi493 h=badness"i494|}}%}ThereThismeansthatZwemayendupwithaverylargedepthinbGox\mult@grightboxPwhichwouldmaketheresultofthe%testingincorrect.8SowechangethevqaluebyunbGoxingUUtheboxintoitself.}495p\boxmaxdepth\maxdepth496p\global\setbox\mult@grightbox497'2\vbox{\unvbox\mult@grightbox}%}W*ealsosaveacopy\mult@firstboxatit\natural"sizeUUforlateruse.}498p\setbox\mult@nat@firstbox499'2\vbox{\unvcopy\mult@firstbox}%}AfterX\process@colshasdoneitsjobwehavethefollowingUUsituation:͟DŽp$ffƍz)bGoxUU\mult@rightboxq UXeallUUmaterial ${bGoxUU\mult@gfirstboxq UXe rstUUcolumnB:bGoxUU\mult@gfirstbox8+2q UXesecondUUcolumnԍTW.TW.TW....${bGoxUU\mult@grightboxq UXelastUUcolumn0rW*e͐repGorttheheightofthe rstcolumn,inbrackets theUUnaturalsizeisgiven.\ҍZ500&]\ifnum\c@tracingmulticols>\@ne Z5014\message{^^JFirstcolumnZ502Gp=\the\dimen@\spaceZ503Gp(\the\ht\mult@nat@firstbox)}\fi\ҍͲIfb\raggedcolumnsisinforcewealsoshrinkthe rstcolumnUUtoitsnaturalheight.\ҍZ504&]\ifshr@nkingZ505/\global\setbox\mult@firstboxZ506P\copy\mult@nat@firstboxZ507&]\fi\ҍͲThenIwegiveinformationabGoutthelastcolumn.^14Z508&]\ifnum\c@tracingmulticols>\@neZ509/\message{<>lastcolumn=Z510ZWE\the\ht\mult@grightbox^^J}%\ҍͲSomeV5tracingcoGdethatwedon'tcompileintothe proGductionGversionunlessaskedfor.mHItwillproGducehuge7listingsofthebGoxesinvolvedinbalancingintheUUtranscript le.Z511w{hdebugҜi Z512/\ifnum\c@tracingmulticols>4Z513={\showoutputZ514BW\batchmodeZ515BW\process@cols\@neZ516Gp{\showbox\count@}}%Z517BW\errorstopmodeZ518/\fiZ519w{h=debugҜiZ520+i\fi\ҍͲW*echeckwhetherourtrialwassuccessful.VThetest usedisverysimple:wemerelycomparethe rstandthe lastcolumn. iThustheintermediatecolumnsmayebGelongerthanthe rstif\raggedcolumnsͲis6used. kIftheright-mostcolumnislongerthanthe rstthenwestartoverwithalargervqaluefor\dimen@.Z521&]\ifdim\ht\mult@grightbox>\dimen@\ҍͲIftheheightofthelastbGoxistoGolargewemarkthistrialUUasunsuccessful.Z522w{hbadness"i Z523/\too@badtrueZ524&]\elseffff2x J=w-:14LܿWithxTAEMXvÎersion3.141itisnowp\@ne5290w^\message{Finalbadness:530Z\the\badness}%531'2\fi^W*eythencomparethisbadnesswiththeallowedybad- nessyyforthe nalcolumn.3IfitdoGesnotexceedthisvqalueHweusethebGox,otherwisewerebGoxitoncemoreUUandaddsomeglueatthebGottom.532'2\ifnum\badness>\c@finalcolumnbadness 5330w^\global\setbox\mult@grightbox53450\vboxto\dimen@535L{\unvbox\mult@grightbox\vfill}%53650\ifnum\c@tracingmulticols>\@ne537> \message{settingnatural538L(>\the\c@finalcolumnbadness)}%53950\fi540'2\fi541\fir7542\ifdim\ht\mult@nat@firstbox<\dimen@543'2\ifdim\ht\mult@nat@firstbox>\last@try5440w^\too@badtrue5450w^\dimen@\ht\mult@nat@firstbox5460w^\last@try\dimen@5470w^\advance\dimen@-\p@548'2\fi549\fir7FinallyYtheswitchtoo@badistested.PIfitwasmade trueeitherearlieronorduetoarightmostcolumn͟DŽff:9bGeingtoolargewetryagainwithaslightlylarger vqalueUUfor\dimen@.Z550&]\iftoo@bad Z551w{h=badness"iZ552/\advance\dimen@\p@Z553&]\repeatͲNowwesavetheactualheightofbGoxregister3(i.e.theleftcolumn)inthehdimenci-register\dimen@Ͳsince{otherwisethisinformationwillbGelostwhenproGcessingUUthecodebelow.^15Z554!=\dimen@\ht\mult@firstboxͲIfthedeterminedheightforthecolumnsturnsoutto:bGelargerthantheavqailablespace(whichis\@colroom)&wesqeezethecolumnsintothespaceassuminguPthattheywillhaveuPenoughshrinkqabilitytoUUallowthis.^16Z555!=\ifdim\dimen@>\@colroom Z556/\dimen@\@colroomZ557!=\fiͲThen%wemovethecontentsoftheoGdd-numberedbGoxregisterstotheeven-numbGeredones,?shrinkingthemifrequested._KW*ehavetouse\vboxnot\vtopͲ(as00itwasdoneinthe rstversions)sinceotherwisethe}resultingbGoxeswillhavenoheight(TU>'ExXbGookͲpage81).Thiswouldmeanthatextra\topskipͲisaddedwhenthebGoxesarereturnedtothepage-builderUUvia\page@sofar.Z558!=\process@cols\mult@rightboxZ5594{\@tempcnta\count@Z5609D+\advance\@tempcnta\@neZ5619D+\setbox\count@\vboxto\dimen@Z562Gp{% Z563L*\vskip\z@Z564U\@plus-\multicolundershootZ565U\@minus-\multicolovershootZ566L*\unvbox\@tempcntaZ567L*\ifshr@nking\vfill\fi}}%Z568w{}ō4.5Theb`oxallocationsyߍ Earlyreleasesofthesemacrosusedthe rstbGox registers0,2,4,...{wforglobalbGoxesand1,3,5,...forĺthecorrespGondinglocalboxes.(Y*oumightstill ndsometracesofthissetupinthedoGcumentation,sigh.)zHThisproGducedaproblematthemomentwehadF5morethan5columnsbGecausethenociallyallo-catedbGoxeswereoverwrittenbythealgorithm.F\ThenewUUreleasenowusesprivqatebGoxregisters!569 \newbox\mult@rightbox͟p!ffߍZ570w{\newbox\mult@grightbox Z571w{\newbox\mult@gfirstboxZ572w{\newbox\mult@firstboxZ573w{\newbox\@tempa\newbox\@tempaZ574w{\newbox\@tempa\newbox\@tempaZ575w{\newbox\@tempa\newbox\@tempaZ576w{\newbox\@tempa\newbox\@tempaZ577w{\newbox\@tempa\newbox\@tempaZ578w{\newbox\@tempa\newbox\@tempaZ579w{\newbox\@tempa\newbox\@tempaff2x J=w-:15LܿTheXvalueof\dimen@maÎydi erfromtheheightofbw-:16LܿThismighÎtb'ExX3.0\emergencystretchisun- de nedsointhiscasewesimplyadditasanunusedhdimenci&tregister. m583 \@ifundefined{emergencystretch} 584"J{\newdimen\emergencystretch}{}mMy $testsshowed $thatthefollowingfor-mula cworkedprettywell.Neverthelessthe\setemergencystretchžmacroalsogets\hsizeassecondargumenttoenabletheusertotrydi erentformulae.585 \def\setemergencystretch#1#2{% 586p\emergencystretch4pt587p\multiply\emergencystretch#1}I%EvencifthisshouldbGeusedasahookweusea@in theUUnamesinceitismoreforexpGerts.588 \def\set@floatcmds{%589dD\let\@dblfloat\@dbflt590dD\def\end@dblfloat{\par591p\vskip\z@592p\egroup͟ffZ593!=\color@endbox Z594!=\@largefloatcheckZ595!=\outer@nobreakͲThiseischeap(deferingthe oatsuntilafterthecur- rentpage)butanyothersolutionwouldgodeepintoL5ffA͉TU>'ExXsoutputroutineandIjdon'tliketoworkonituntil*I*knowwhichpartsoftheoutputroutinehavetoUUbGereimplementedanywayforL5ffA͉TU>'ExX3.Z596!=\ifnum\@floatpenalty<\z@ͲW*eRhavetoaddthe oattothe\@deferlistbGe-causeD weassumethatoutsidethemulticolsenviron-ment weareinonecolumnmoGde.Thisisnoten-tierlycorrect,Ilalreadyusedthemulticolsenviron-mentIinsideofL5ffA͉TU>'ExXs\twocolumndeclarationbutitUUwilldoformostapplications.Z597+i\@cons\@deferlist\@currbox Z598!=\fiZ599!=\ifnum\@floatpenalty=-\@MiiZ600+i\@EsphackZ601!=\fi}}ލ5.1Maintainingthemarkregisterse This'sectioncontainstheroutinesthatsetthe marks{sothattheywillbGehandledcorrectly*.TheyhaveUUbGeenintroducedwithversion1.4.First$VthingwedoistoreservethreemacronamestoholdthereplacementtextforTU>'ExX'sprimitives\firstmark,jw\botmark3 and\topmark. W*einitial-izenthe rsttwontobGeemptyand\kept@topmarktocontainRitwoemptypairofbraces.pThisisnecessarysince\kept@topmarkissuppGosedtocontainthelastmarkBfromaprecedingpageandinL5ffA͉TU>'ExXany\real"markmustcontaintwopartsrepresentingleftandrightUUmarkinformation. ʃ602 \def\kept@topmark{{}{}} 603 \let\kept@firstmark\@empty604 \let\kept@botmark\@empty_SometimesSwewanttoreturnthevqalueofa \kept"N8markintoa\marknoGdeonthemainverticalWlist.xThisisdonebythefunction\return@nonemptymark. >As'thenamesuggestsitonlyactsifthereplacementtextofthekeptmarkisnon-empty*.>Thisisdonetoavoidaddinganemptymarkwhennomarkwasactuallypresent. 8'Ifwe͟*ffwouldFOneverthelessaddsuchamarkitwouldbGere- gardedUUasavqalid\firstmarklateron.6Z605w{\def\return@nonemptymark#1#2{% Z606\ifx#2\@emptyZ607\else6ͲF*orDdebuggingpurpGoseswetakealoGokatthevqalueof]thekeptmarkthatweareabGouttoreturn.ThiscoGdeUUwillgetstrippedoutforproduction.6Z608w{hma9rktrace+iZ609&]\mult@info\tw@Z610/{Returned#1mark:\MessageBreakZ6114\meaning#2}%Z612w{%Y\nobreakZ613w{%X\fiZ614w{h=ma9rktrace+i6ͲSincethecontentsofthemarkmaybGearbitraryL5ffA͉TU>'ExX|coGdewebettermakesurethatitdoesn'tgetexpandedanyfurther(SomeexpansionhavebGeendonealreadyduringtheexecutionof\markrightor\markboth.dvW*e:thereforeusetheusualmechanismofUUatoksregistertoprohibitexpansion.^176Z615&]\toks@\expandafter{#2}%ff2x J=w-:17LܿDue4tothecurrenÎtde nitionof\markrightusw.itwouldn'thelptode nethe\protectcommandtoprohibitexpansion asXanÎy\protecthasalreadyvanishedduetoearlierexpansions209F616\mark{\the\toks@}%ٚW*e/don'twant/anybreakpGointbGetweensuchare- turnedmarkandthefollowingmaterial(whichisusuallyUUjustthebGoxwherethemarkcamefrom). ٚ617\nobreak 618\fi}͍IfYwehavesomematerialinabGoxregisterwemaywant;togetthe rstandthelastmarkoutofthisbGox.\This:canbedonewith\get@keptmarkswhichtakest#oneargument:cthebGoxregisternumbGeroritsnickUUnamede nedby\newbox.619 \def\get@keptmarks#1{%ٚF*ordebuggingpurpGoseswetakealoGokatthecur-rent6dimensionsofthebGoxsinceinearlierversionsofUUthecoGdeImadesomemistakesinthisarea.620 hdebugҜi 621'2\typeout{Markbox#1before:622Qxht\the\ht#1,dp\the\dp#1}%623 h=debugҜiٚNow4weopGenanewgroupanlocallycopytheboxto itself.vAsΏaresultanyopGeration,i.e.\vsplit,willonlyz,havealoGcale ect.KWithoutthistrickthebGoxcontentSwouldgetlostuptothelevelwherethelastassignmentUUtothebGoxregisterwasdone.624\begingroup 625p\vbadness\@M626p\setbox#1\copy#1%ٚNow]9wesplitthebGoxtothemaximalpGossibledi- mension.jThis8shouldsplito thefullcontents8oftheNbGoxsothate ectivelyeverythingissplito .RAsa\result\splitfirstmarkand\splitbotmarkwillcontainZthe rstandlastmarkinthebGoxrespGec-tively*.627p\setbox#1\vsplit#1to\maxdimenٚTherefore$wecannowsetthekeptmarkswhichisa5globalopGerationandafterwardsclosethegroup.ThisUUwillrestoretheoriginalbGoxcontents.628p\set@keptmarks 629dD\endgroupٚF*ordebuggingwetakeagainaloGokattheboxdi-mensionUUwhichshouldn'thavechanged.630 hdebugҜi 631\typeout{Markbox#1\spaceafter:632HLht\the\ht#1,dp\the\dp#1}%633 h=debugҜi634 }͍The.=macro\set@keptmarksisrespGonsibleforset- ting\kept@firstmarkand\kept@botmark,bycheckingxthecurrentvqaluesfor\splitfirstmarkandUU\splitbotmark.635 \def\set@keptmarks{%͟ffͲIfn\kept@firstmarkisemptyweassumethatit isn'tYset.ThisisstrictlyspGeakingnotcorrectasweloGosetheabilitytohavemarksthatareexplic-itly!empty*,butforstandardL5ffA͉TU>'ExXapplicationitissucient.Ifv itisnon-emptywedon'tchangethevqalue|withinRtheoutputroutinesitwillthenbGere-storedUUto\@empty.Z636!=\ifx\kept@firstmark\@emptyͲW*e1nowputthecontentsof\splitfirstmarkinto\kept@firstmark. <~In=thecasethattherewasn'tany$markatall\kept@firstmarkwillnotchangebyUUthatopGeration.Z637+i\expandafter\gdef\expandafter Z6389D+\kept@firstmarkZ6399D+\expandafter{\splitfirstmark}%ͲWhendebuggingweshowtheassignmentbutonly whenUUsomethingactuallyhappGened.Z640w{hma9rktrace+iZ641+i\ifx\kept@firstmark\@empty\elseZ6424\mult@info\tw@Z643={Setkeptfirstmark:\MessageBreakZ644BW\meaning\kept@firstmark%Z645BW\@gobbletwo}%Z646+i\fiZ647w{h=ma9rktrace+iZ648!=\fiͲW*eValwaystrytosetthebGottommarktothe \splitbotmark (butofcourseonlywhentherehasbGeenEa\splitbotmarkatall.٘Again,+Aweassumethat+anempty\splitbotmarkmeansthatthesplito UUbGoxpartdidn'tcontainanymarksatall.Z649!=\expandafter\def\expandafter\@tempa Z650/\expandafter{\splitbotmark}%Z651!=\ifx\@tempa\@empty\elseZ652/\global\let\kept@botmark\@tempaZ653w{hma9rktrace+iZ654/\mult@info\tw@Z6559D+{Setkeptbotmark:\MessageBreakZ656=\meaning\kept@botmark%Z657=\@gobbletwo}%Z658w{h=ma9rktrace+iZ659!=\fi}%ͲThez\prep@keptmarksfunctionisusedtoinitialize theTTkeptmarksfromthecontentsof\partial@page,i.e.}$thebGoxthatholdseverythingfromthetopofthecurrentEpagepriortostartingthemulticolsenviron-ment. However,Vsuch"abGoxisonlyavqailableifweareUUnotproGducingaboxedmulticols.Z660w{\def\prep@keptmarks{% Z661!=\if@boxedmulticols\elseZ662+i\get@keptmarks\partial@pageZ663!=\fi}21ƠF664 \def\remove@discardable@items{% 665 hdebugҜi666p\edef\@tempa{s=\the\lastskip,667VDp=\the\lastpenalty,668VDk=\the\lastkern}%669p\typeout\@tempa670 h=debugҜi6710w^\unskip\unpenalty\unkern672 hdebugҜi673p\edef\@tempa{s=\the\lastskip,674VDp=\the\lastpenalty,675VDk=\the\lastkern}%676p\typeout\@tempa677 h=debugҜi6780w^\unskip\unpenalty\unkern679 hdebugҜi680p\edef\@tempa{s=\the\lastskip,681VDp=\the\lastpenalty,682VDk=\the\lastkern}%683p\typeout\@tempa684 h=debugҜi6850w^\unskip\unpenalty\unkern686 hdebugҜi687p\edef\@tempa{s=\the\lastskip,688VDp=\the\lastpenalty,689VDk=\the\lastkern}%690p\typeout\@tempa691 h=debugҜi6920w^\unskip\unpenalty\unkern͟PffZ693w{}#Z694w{hbadness"i Z695w{\newif\iftoo@bad:Z696w{\newcount\c@columnbadnessZ697w{\c@columnbadness=10000Z698w{\newcount\c@finalcolumnbadnessZ699w{\c@finalcolumnbadness=9999Z700Z701w{\newdimen\last@tryZ702Z703w{\newdimen\multicolovershootZ704w{\multicolovershoot=2ptZ705w{\newdimen\multicolundershootZ706w{\multicolundershoot=2ptZ707w{\newbox\mult@nat@firstboxZ708w{h=badness"i.ԍͲAUUhelpGerforproducinginfomessagesZ709w{\def\mult@info#1#2{%Z710\ifnum\c@tracingmulticols>#1%Z711!=\GenericWarningZ7124{(multicol)\@spaces\@spaces}%Z7134{Packagemulticol:#2}%Z714\fiZ715w{}Z716Z717w{h=pack9age#g i \IndexNumbGers=writteninitalicrefertothepagewherethecorrespondingentryisdescribed,Btheonesunderlined toUUthecoGdelineofthede nition,theresttothecodelineswheretheentryisused. /MB M5\balance@columns426fe \balance@columns@out8 }.΍}.}.}.}.}.}.}.}.}. 415 ȟfe 矍/{C\c@collectmoreB}.΍}. 236 Ÿfe \c@columnbadness696fe \c@finalcolumnbadness8}.΍}.}.}.}.}.}.}.}.}. 696 ȟfe \c@unbalanceYҍ}.΍}.}.}. 237 Ÿfe \col@number}.΍}.}.}.}. 236 Ÿfe \columnsepruleB}.΍}.}.}.w2矍/D\doublecol@number M236 Mfe 0ApE\emergencystretch M583 Mfe \endmulticols- }.΍}.}. 192 Ÿfe \enough@roomYҍ}.΍}.}.}. 100 Ÿfe pL͟Lτ)ff]׍94F \flushcolumns- }.΍}.}. 410 Ÿfe ifshr@nking}.΍}.}.}.}. 410 Ÿfe DE8]G\get@keptmarksB}.΍}. 619 Ÿfe :I\if@boxedmulticols 3x97 3xfe ?\init@mult@footinsz178zfe 8bSK\kept@botmark- }.΍}.}. 602 Ÿfe \kept@firstmarkz}. 602 Ÿfe \kept@topmark- }.΍}.}. 602 Ÿfe 9YL\leave@mult@footins8&͍}.΍}.}.}.}.}.}.}.}.}. 384 ȟfe 7M\mult@@cols}.΍}.}.}.}.}. 75 fe ?\mult@cols@0}.΍}.}.}.}.}. 72 fe ?y)ff]׍\mult@firstboxB}.΍}. 569 Ÿfe \mult@gfirstboxz}. 569 Ÿfe \mult@grightboxz}. 569 Ÿfe \mult@info@0}.΍}.}.}.}. 709 Ÿfe \mult@rightboxB}.΍}. 569 Ÿfe \multi@column@out M294 Mfe \multicol@leftmargin8@&͍}.΍}.}.}.}.}.}.}.}.}. 191 ȟfe \multicolbaselineskip8@&͍}.΍}.}.}.}.}.}.}. fb2,T236Tfe \multicolpretolerance8@&͍}.΍}.}.}.}.}.}.}. fb2,T236Tfe \multicols@0}.΍}.}.}.}.}. 56 fe ?\multicolsepYҍ}.΍}. \2,T236Tfe \multicoltolerance&͍}.΍}.}.}.}.}.}.}. fb2,T236Tfe 8P\page@free@0}.΍}.}.}.}. 236 Ÿfe \page@sofar}.΍}.}.}.}. 269 Ÿfe \partial@page- }.΍}.}. 236 Ÿfe \postmulticols 2,T236Tfe )ff]׍\premulticols- }. \2,T236Tfe \prep@keptmarksz}. 660 Ÿfe \prepare@multicolsz117zfe \process@cols- }.΍}.}. 260 Ÿfe \process@deferredsz400zfe *8MR\raggedcolumnsB}.΍}. 410 Ÿfe \reinsert@footnotes8&͍}.΍}.}.}.}.}.}.}.}.}. 292 ȟfe \remove@discardable@items8&͍}.΍}.}.}.}.}.}.}.}.}. 664 ȟfe \return@nonemptymark8@&͍}.΍}.}.}.}.}.}.}.}.}. 605 ȟfe 9{S\set@floatcmdsB}.΍}. 588 Ÿfe \set@keptmarksB}.΍}. 635 Ÿfe \set@mult@vsizez}. 182 Ÿfe \setemergencystretch8@&͍}.΍}.}.}.}.}.}.}.}.}. 583 ȟfe \speci@lsl}.΍}.}.}.}.}. 388 Ÿfe 22 FChangeffHistory~1.5? \balance@columns:Allo9wcolumnstocomeoutaTbitlongorshort}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 16DoTsplittingtozerohere }.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}. f>17InitializeT`last@try؍}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. f>17Sho9wTnaturalsizeɍ}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. f>18\endmulticols:uVSplittingo zerobAo9xmovedto`balance@columnsu}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 11\leave@mult@footins:TMacroadded`}.΍}.}.}.}.}.}.}. f>15\mult@@cols:TP9enaltymovedtolaterpAoint}.΍}.}.}. yn8\multi@column@out:TUse`lea9ve@mult@foAotins(}. f>14\prepare@multicols:TUse`init@m9ult@foAotins9}. f>10Lv1.0c\enough@room:iP9enalty0addedtoemptythecon9tributionTlist.}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. B8v1.0dGeneral:TAlllinesshortenedto72orless.퍑}.΍}.}.}.}. yn1v1.0eGeneral:|HRede nitionofdescriptionen9v.QMtouse`descriptionmargin'=5ptTindoAcumen9tation.1\prepare@multicols:Lv`text9widthchangedto`linewidth.KQ}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 10SettingTof`column9width'removed.i}.΍}.}.}.}.}.}. f>10Sothis lewillw9orkwiththe`twoAcolumn'command.SP}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 10v1.0fGeneral:Changed`z@to`0ptinrede nitionofdescription.d}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. B1v1.1aGeneral:T`m9ulticolssepchangedto`multicolsep.G}. yn1\flushcolumns:*` ushedcolumnsrenamedto` ushcolumns.}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 16v1.2a\balance@columns:gGrouparoundmainloAopre-mo9ved.ƨ}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 17\prepare@multicols:`pretolerance-1bAecauseitnearlyTnev9ersucceeds.}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}. 10`set@ oatcmdsTadded.}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. f>10`setemergencystretc9hTadded. }.΍}.}.}.}.}.}.}.}.}.}.}. f>10`vbadnessT10001no9w.}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. f>10\set@floatcmds:TMacroadded.o}.΍}.}.}.}.}.}.}.}.}.}. f>20\setemergencystretch:TMacroadded..}.΍}.}.}.}.}. f>20\speci@ls:TFloatbAo9xesfreed.)t}.΍}.}.}.}.}.}.}.}.}.}.}.}. f>15v1.3a\balance@columns:TChanged`vtopto`vbAo9x."⍑}.΍}. f>19v1.3b\endmulticols:TDo`pAenalt9ywith`addpenalt9y,}. f>11\enough@room:TDo`pAenalt9ywith`addpenalt9yYr}.΍}.}. yn8\multicols:TMinim9umoftwocolumnsG}.΍}.}.}.}.}.}. yn7v1.3c\balance@columns:M`global`adv|rancelefto9verfromToldercoAdeW}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 18LimitTcolumnheigh9tto`@colroAom&A}.΍}.}.}.}.}.}. f>19\endmulticols:TChec9kclosingenv.MB}.΍}.}.}.}.}.}.}.}. f>12\multi@column@out:T`un9bAoxingavoided._J}.΍}.}.}.}. f>14͟Lτhffg!Chec9kDiffoAotnotesareactuallypresentbAefore &issuingTaw9arning.ܢ}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 14 ؋!UnnecessaryTcoAderemo9ved}.΍}.}.}.}.}.}.}.}.}.}.}.}. f>15\prepare@multicols:G`n9ullinsertedandremoved&inToutput_d}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. B9\reinsert@footnotes:T`un9bAoxingavoided.}.΍}.}. f>13v1.3d\c@unbalance:T`col@n9umbAersettoone/}.΍}.}.}.}.}. f>12v1.4aGeneral::AddedsuppAortform9ulticolininner&moAde}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. B1\balance@columns:ChangedtopropAer`end-&linec9harTin`messageɍ}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 18\mult@@cols:TF:orgottenbracesadded&}.΍}.}.}.}.}.}.}. yn8\multi@column@out:d`bAotmarksetto`splitbot-&mark꺍}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 14\prepare@multicols:TChec9kingfortextlosses.܆}. yn9!ConditionalTcoAdeforbo9xedmodeadded.ɍ}.΍}.}.}. yn9!k9eptTmarksinitiated܍}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. yn9v1.4d\balance@columns:wNewalgorithmforstart&heigh9t_}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 17v1.4e\endmulticols:3Butignore`@nobreakin`ad-&dpAenalt9y@}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 11\enough@room:$Butignore`@nobreakin`ad-&dpAenalt9y@}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. B8\mult@@cols:TT9ypAesetoptionalarginsidegroup (8\prepare@multicols:TUsing}.΍}.}.}.}.}.}.}.}.}.}.}.}.}. f>10v1.4f\balance@columns:`on@lineaddedtotracing&info [}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 17\mult@@cols:T`on@lineaddedtotracinginfo}.΍}.}. yn7!`parTaddedtoallo9wforcorrectinnertest}.΍}.}.}. yn7v1.4g\mult@@cols:`globalw9asprobablywrongbutat&leastTunnecessary%}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. B8\multi@column@out:8Onlyc9hange`kept@topmark&ifT`k9ept@bAotmarknon-emptyv}.΍}.}.}.}.}.}.}.}.}. 15v1.4hGeneral:Addedmarktracingwith&tracingm9ulticols2K}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. B1\kept@topmark:TInittodoublebracepair#}.΍}.}.}. f>20v1.4i\multi@column@out:Set`k9ept@topmarkto`bAot-&mark꺍}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 15\prepare@multicols: `k9ept@topmarkinitial-&ized.]}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. B9v1.4j\setemergencystretch:RSettingof`emergencys-&tretc9hTontopremoved.YQ}.΍}.}.}.}.}.}.}.}.}.}.}.}.}. 20v1.4k\multicols:TMaxim9umof5columns(temp)m}.΍}.}. yn723%Fv1.4l \mult@@cols:x`@totalleftmarginno9win`pre-pare@m9ulticols }.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. B8\page@sofar:ause`m9ulticol@leftmargininsteadofT`@totalleftmargin}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 13\prepare@multicols:Tsa9ved`@totalleftmargin?}.΍}. yn9v1.4m\endmulticols:\Chec9k`partial@pagebAeingemp-tiedDZ}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 12v1.4n\return@nonemptymark:TMak9emarksrobustdU}.΍}. f>20v1.4o\prepare@multicols:T`topskiploAcallyzeroed.w}.΍}. yn9v1.4p\multi@column@out:TUsedi eren9t`vsizesetting5B15\prepare@multicols:vCoAdemo9vedvto`set@m9ult@vsizeҍ}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 10UseTdi eren9t`vsizesetting/l}.΍}.}.}.}.}.}.}.}.}.}.}.}. f>10\set@mult@vsize:TMacroadded.}.΍}.}.}.}.}.}.}.}.}. f>11v1.5a\balance@columns:TNewbAo9xmechanismm}.΍}.}.}.}. f>17\multi@column@out:TNewbAo9xmechanism}.΍}.}.}. f>14\multicols:TAllo9w10columnsagainv}.΍}.}.}.}.}.}.}. yn7\page@sofar:TNewbAo9xmechanismF#}.΍}.}.}.}.}.}.}.}. f>13\prepare@multicols:8_Addo setto`doublecol-n9umbAer?鍑}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. B9v1.5b\balance@columns:TNewbadnessmec9hanism}.΍}. f>17͟Lτ5LffԳ1v1.5c \balance@columns@out:addedpAenalt9yatoutput &routineTexits}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 16\endmulticols:TAgainuse`pAenalt9yF}.΍}.}.}.}.}.}.}.}. f>11\multi@column@out:TSuppAort`clearpageS}.΍}.}.}.}. f>13\speci@ls:TSuppAort`clearpageFˍ}.΍}.}.}.}.}.}.}.}.}.}.}. f>15v1.5d\multi@column@out:Treinit`topmark}.΍}.}.}.}.}.}.}. f>14v1.5e\enough@room:tAssignargtoskipregistertobAe&ableTtooutputv|ralue!}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. B8v1.5g\set@floatcmds:UpAdatedsince oatsha9ve&c9hanged7}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 20v1.5h\balance@columns:TGetk9eptmarks rst}.΍}.}.}.}. f>16\page@sofar:TChec9kforvoidbAoxes}.΍}.}.}.}.}.}.}.}. f>13v1.5i\page@sofar:TButdon'tremo9veToriginalcoAde.TM}. f>13v1.5j\set@floatcmds:UpAdatedsince oatsha9ve&c9hangedTagain}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. 20v1.5lGeneral:rT:ryhardtoexplainunresolv9edrefer-&encethathappAensif\OnlyDescriptionis&used(Í}.΍}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}.}. B6\set@floatcmds:TAdded\largefloatcheck^}.΍}. f>20249; 2- cmcsc10,j cmti9+F C cmbxti10*"V cmbx10)R6 cmss12(#fcmti8'N cmbx12&ߤN cmtt9%Cscmtt8$': cmti10#p0J cmsl10" cmmi10K`y cmr10ٓRcmr71G