; TeX output 1997.01.23:0041so^KDtGGcmr17LdKGXQ cmr12AT[-E;gX`2gG cmmi12"for7tclassandpacqkagewriters#}CCopryrightN9hc!", cmsy10 R1995TheLDD"|{Ycmr8A_ٺT UE!X3ProjectoAllrighrtsreserved+-28NorvembSer19961č5Nff cmbx12Contents5"V cmbx101DIn9troQduction2 DK`y cmr101.1[W*ritingUUclassesandpackqagesforL5ffٓRcmr7A͉TU>'ExX2 b> cmmi10".pۍ.............2D1.2[Overviewk...............................2D1.3[F*urtherUUinformation .........................352DW ritingTclassesandpac9k\rages4D2.1[OldUUversionsMԍ..............................4D2.2[UsingUU`doGcstrip'and`doc'......................4D2.3[IsUUitaclassorapackqage?$......................4D2.4[CommandUUnames ...........................5D2.5[BoxUUcommandsandcolourU......................5D2.6[De ningUUtextandmathcharactersٍ.................6D2.7[GeneralUUstyle.............................653DTheTstructureofaclassorpac9k\rage[9D3.1[Identi cationT獍.............................9D3.2[UsingUUclassesandpackqagesT......................10D3.3[DeclaringUUoptions ...........................11D3.4[AUUminimalclass lez..........................12D3.5[Example:qaUUloGcalletterclass).....................13D3.6[Example:qaUUnewsletterclassč.....................1354DCommandsTforclassandpac9k\ragewritersq14D4.1[Identi cationT獍.............................15D4.2[LoadingUU les#(..............................16D4.3[OptionUUdeclaration1>..........................16D4.4[CommandsUUwithinoptioncoGde獍...................17D4.5[MovingUUoptionsaround........................17D4.6[DelayingUUcoGde.............................19D4.7[OptionUUproGcessing@..........................19D4.8[SafeUU lecommandsƕ..........................22D4.9[RepGortingUUerrors,etcɍ.........................22D4.10[De ningUUcommandsj"..........................23D4.11[MovingUUarguments?x..........................241*so55DMiscellaneousTcommands,etc24 D5.1[LayoutUUparameters?y..........................24D5.2[CaseUUchanging̍.............................25D5.3[TheUU`opGenany'optioninthe`book'classK..............25D5.4[BetterUUuser-de nedmathdisplayenvironments -..........2656DUpgradingTL*f$cmbx7AT<8E3sX2.09classesandpac9k\ragesfC26D6.1[T*ryUUit rst!T򍍑..............................26D6.2[T*roubleshoGoting?............................27D6.3[F*ontUUcommands............................27D6.4[ObsoleteUUcommands.........................28'č51MLIntros3duction5ThisjdoGcumentisanintroGductiontowritingclassesandpackqagesforL5ffA͉TU>'ExX,with5spGecialWattentiongiventoupgradingexistingL5ffA͉TU>'ExX2.09packqagestoL5ffA͉TU>'ExX2"(.5Thelattersub8jectisalsocoveredinanarticlebyJohannesBraamspublished5inUUTUGbGoat15.3.!65N cmbx121.1SWritingclassesandpack@agesforLAl#2@cmbx8A~/TESXa2!DF cmmib10"uT5L5ffA͉TU>'ExX߻isadoGcumentpreparationsystemthatenablesthedocumentwriterto5concentrate5onthecontentsoftheirtext,mwithoutbGotheringtoomuch5about5theoPformattingofit.F*orexample,uchaptersareindicatedby''ExX2.09andL5ffATU>'ExX2",isinthecom-5mandsusedtowritepackqagesandclasses.&]InL5ffA͉TU>'ExX2.09,therewasverylittle5suppGortforwriting.sty les,C{andsowritershadtoresorttousinglow-level5commands.5L5ffA͉TU>'ExX2"]provideshigh-levelcommandsforstructuringpackqages.9Itisalsomuch5easier9tobuildclassesandpackqagesontopofeachother,?forexamplewritinga5loGcal-technicalreportclasscetechr(fortheChemicalEngineeringdepartment)5basedUUonarticle.!651.2SOverviewuT5This\doGcumentcontainsanoverviewofhowtowriteclassesandpackqagesfor5L5ffA͉TU>'ExX.7Itk%doGesnot]introduceallofthecommandsnecessarytowritepackqages:5thesecanbGefoundineitherL雍Q)t}\cmti7ATKß'E-X:AF_Do}'cumentFPreparationSystemorThe5L雍QATKß'E-XBComp}'anion.TButitdoGesdescribethenewcommandsforstructuring5classesUUandpackqages.2#àso5SectionT2.7qcontains`7somegeneraladviceabGoutwritingclassesandpackqages. NItpdescribGesthedi erencebetweenpclassesandpackqages,wthecommandNnaming conventions,theuseofdocanddocstrip,howTU>'ExX'sprimitiveN leandbGoxcommandsinteractwithL5ffA͉TU>'ExX.ItalsocontainssomehintsNabGoutUUgeneralL5ffA͉TU>'ExXstyle.5SectionT3h(ԲdescribGesthestructureofclassesandpackqages.NThisincludesbuild-Ningclassesandpackqagesontopofotherclassesandpackqages,mdeclaringNoptionsUUanddeclaringcommands.qItalsocontainsexampleclasses.5SectionT4h(ԲlistsUUthenewclassandpackqagecommands.5SectionT6h(ԲgivesPdetailedadviceonhowtoupgradeexistingL5ffA͉TU>'ExX2.09classesNandUUpackqagestoL5ffA͉TU>'ExX2"(.!651.3SFurtherinformationuT5F*orGageneralintroGductiontoL5ffA͉TU>'ExX,includingthenewfeaturesofL5ffATU>'ExX2"(",you5shouldUUreadL雍QATKß'E-X:ADo}'cumentPreparationSystembyUULeslieLampGort[3].5AqmoredetaileddescriptionofthenewfeaturesofL5ffA͉TU>'ExX,andanoverviewof5moreNthan150packqages,ListobGefoundinTheyL雍QATKß'E-XComp}'anionKbyNMichel5GoGossens,UUF*rankMittelbachandAlexanderSamarin[1].5TheƝL5ffA͉TU>'ExXsystemisbasedonTU>'EX,"whichisdescribGedinTheTKß'E-Xb}'ook*by5DonaldUUE.Knuth[2].5ThereareanumbGerofdocumentation leswhichaccompanyeverycopyof5L5ffA͉TU>'ExX.AcopyofL雍QATKß'E-XNews3willcomeoutwitheachsix-monthlyreleaseof5L5ffA͉TU>'ExX,and~Risfoundinthe lesltnews*.tex.Theauthor'sguideL雍QATKß'E-X2",Pfor5AuthorsfdescribGesthenewL5ffA͉TU>'ExXdocumentfeatures;3-itisinusrguide.tex.5ThePguideL雍QATKß'E-X2"+DF;ont!Sele}'ctiondescribGestheL5ffA͉TU>'ExXfontselectionschemefor5class- andpackqage-writers;"itisinfntguide.tex.XCon guringL5ffA͉TU>'ExXiscovered5by{?theguideCon gur}'ationMoptionsforL雍QATKß'E-X2".nin{?cfgguide.texwhilstthe5philosophybGehindourpolicyonmodifyingL5ffA͉TU>'ExXisdescribedinMo}'difying5L雍QATKß'E-XinUUmodguide.tex.5W*eDaregraduallyturningthesourcecoGdeforL5ffA͉TU>'ExXintoaL5ffATU>'ExXdoGcument5L雍QATKß'E-X:8thew+pr}'ogram.g^This6doGcumentincludesanindexofL5ffA͉TU>'ExXcommandsand5canUUbGetypesetfromsource2e.tex.5F*orj_moreinformationabGoutTU>'ExXandL5ffA͉TU>'EX,]pleasecontactyourloGcalTU>'ExXUsers5Group,UUortheinternationalTU>'ExXUsersGroup.qHerearesomeusefuladdresses.N*o cmr9TuAEXUsersGroup,01850UnionStreet#1637,SanF:rancisco,CA94123, NUSANF:ax:T+14159828559*Email:p+ߤN cmtt9tug@tug.orgNUKTTUG,1EymoreClose,SellyOak,BirminghamB294LB,UKNF:ax:p+44T1214762159*Email:uktug-enquiries@tex.ac.uk39so52MLWfritingffclassesandpackages5This sectioncovers somegeneralpGointsconcernedwithwritingL5ffA͉TU>'ExXclasses 5andUUpackqages.!652.1SOldversionsuT5IfXyouareupgradinganexistingL5ffA͉TU>'ExX2.09style lethenwerecommendfreezing5the<2.09versionandnolongermaintainingit.|ExpGeriencewiththevqarious5dialects9ofL5ffA͉TU>'ExXwhichexistedintheearly1990'ssuggeststhatmaintaining5packqagesvPfordi erentversionsofL5ffA͉TU>'ExXisalmostimpGossible.ԷItwill,~ofcourse,5bGeWnecessaryforsomeorganisationstomaintainbothversionsinparallelfor5someXtimebutthisisnotessentialforthosepackqagesandclassessuppGortedby5individuals:theyqGshouldsuppGortonlythenewstandardL5ffA͉TU>'ExX2"(,xDnotobsolete5versionsUUofL5ffA͉TU>'ExX.52.2SUsing`do`cstrip'and`doc'uT5IfSyouaregoingtowritealargeclassorpackqageforL5ffA͉TU>'ExXthenyoushould5consider`usingthedocsoftware`whichcomeswithL5ffA͉TU>'ExX.L5ffATU>'EX`classesand5packqageswrittenusingthiscanbGeprocessedintwoways: (theycanbGerun5throughL5ffA͉TU>'ExX,+toproGducedocumentation;andtheycanbeprocessedwith5docstrip,UUtoproGducethe.clsor.sty le.5Thedocsoftwarecanautomaticallygenerateindexesofde nitions,Uindexes5ofcommanduse,Wandchange-loglists.Itisveryusefulformaintainingand5doGcumentingUUlargeTU>'ExXsources.5The6doGcumentedsourcesoftheL5ffA͉TU>'ExXkernelitself,'ExXonsource2e.tex.5F*orHmoreinformationondocanddocstrip,consultthe lesdocstrip.dtx,5doc.dtx,//and%ThehL雍QATKß'E-XComp}'anion.aF*orexamplesofitsuse,//loGokatthe.dtx5 les.!652.3SIsitaclassorapack@age?uT5The{ rstthingtodowhenyouwanttoputsomenewL5ffA͉TU>'ExXcommandsina le5is1todecidewhetheritshouldbGeado}'cument+classRorapackage.`\Theruleof5thumbUUis:NIfIthecommandscouldbGeusedwithanydocumentclass,thenmakeNthemUUapackqage;andifnot,thenmakethemaclass.5Therearetwoma8jortypGesofclass:thoselikearticle,reportorletter,5whichwarefree-standing;andthosewhichareextensionsorvqariationsofother4Jso5classes|forgexample,theprocdoGcumentclass,whichisbuiltonthearticle 5doGcumentUUclass.y5Thus,y,a companymighthavealoGcalownletclassforprintingletterswith5theirownheadednote-papGer.Suchaclasswouldbuildontopoftheexist-5ingletterclassbutitcannotbGeusedwithanyotherdocumentclass,sowe5haveUUownlet.clsratherthanownlet.sty.5TheBgraphicspackqage,}incontrast,}providescommandsforincludingimages5into^aL5ffA͉TU>'ExXdoGcument.ZSincethesecommandscanbGeusedwithanydoGcument5class,UUwehavegraphics.styratherthangraphics.cls.!=52.4SCommandnames썑5L5ffA͉TU>'ExXUUhasthreetypGesofcommand.5Thereˬaretheauthorcommands,Asuchas\section,\emphand\times:^umost5ofUUthesehaveUUshortnames,allinlowerUUcase.5Therearealsotheclassandpackqagewritercommands:Kmostofthesehavelong5mixed-caseUUnamessuchasthefollowing.)C,\InputIfFileExists s,\RequirePackage\PassOptionsToClass)5Finally*,thereJcaretheinternalcommandsusedintheL5ffA͉TU>'ExXimplementation,such5as5\@tempcnta,,\@ifnextcharand\@eha: mostofthesecommandscontain@5in":theirname,UswhichmeanstheycannotbGeusedindocuments,Usonlyinclass5andUUpackqage les.5Unfortunately*,forhistoricalreasonsthedistinctionbGetweenthesecommandsis5oftenblurred.F*orexample,\hboxisaninternalcommandwhichshouldonly5bGenusedintheL5ffA͉TU>'ExXkernel,u5whereas\m@neistheconstant1andcouldhave5bGeenUU\MinusOne.5However, (thisruleofthumbisstilluseful:Pifacommandhas@initsnamethen5itq'ExXlanguage|anditsbehaviourmaychange5incfuturereleases!'ExX2"5suppGortingUUthecommand.!=52.5SBoxcommandsandcolour썑5Even|ifyoudonotintendtousecolourinyourowndoGcuments,#bytakingnoteof5thepGointsinthissectionyoucanensurethatyourclassorpackqageiscompatible5withthecolorpackqage.ThismaybGene tpeopleusingyourclassorpackqage5whoUUhaveaccesstocolourprinters.5The/simplestway/toensure`coloursafety'istoalwaysuseL5ffA͉TU>'ExXbGoxcommands5ratherbthanTU>'ExXprimitives,#thatisuse\sboxratherthan\setbox,\mboxrather5than\hboxand\parboxortheminipageenvironmentratherthan\vbox.QThe5L5ffA͉TU>'ExX4bGoxcommandshavenewoptionswhichmeanthattheyarenowaspGow-5erfulUUastheTU>'ExXprimitives.5Xvso5AsCJanexampleofwhatcangowrong,Fconsiderthatin{\ttfamily?htextظi }the 5font isrestoredjustb}'eforeKthe },SwhereasinthesimilarloGokingconstruction5{\color{green}?htextظi }[βthecolourisrestoredjustaftero[the nal}.3Normally5thiswdistinctiondoGesnotmatteratall;butconsideraprimitiveTU>'ExXboxassign-5mentUUsuchas:C,\setbox0=\hbox{\color{green}- cmsy9h.j cmti9textilI}5Now]0thecolour-restoreoGccursafterthe}andsoisnotPstoredinthebox.Exactly5what bade ectsthiscanhave depGendsonhowcolourisimplemented:8itcan5range(fromgettingthewrongcoloursintherestofthedoGcument,$tocausing5errorsUUinthedvi-driverusedtoprintthedoGcument.E5Alsofofinterestisthecommand\normalcolor.Thisisnormallyjust\relax5(i.e.,'doGesnothing)butyoucanuseitratherlike\normalfonttosetregionsof5theUUpagesuchascaptionsorsectionheadingstothe`maindoGcumentcolour'.!52.6SDe ningtextandmathcharactersq5BecauseL5ffA͉TU>'ExX2"*ÆsuppGortsdi erentencodings,ide nitionsofcommandsforpro-5ducing^symbGols,accents,compGosite^glyphs,etc.mustbGede nedusingthecom-5mands+providedforthispurpGoseanddescribedinL雍QATKß'E-X2"+>F;ont'ExXUUprovidesthesecommands:/ow cmss9New description1995/12/01C,\LoadClass%̰\LoadClassWithOptions C,\RequirePackage,\RequirePackageWithOptions5forHusingclassesorpackqagesinsideotherclassesorpackqages.$W*erecommend5stronglythatyouusethem,ratherthantheprimitive\inputcommand,fora5numbGerUUofreasons.6fso5FilesUUloadedwith\input?h lename[i5fwillnotbGelistedinthe\listfileslist.d5IfIapackqageisalwaysloadedwith\RequirePackage...or\usepackagethen, 5evennifitsloadingisrequestedseveraltimes,'ExX2.09doGcumentstylescontain\input?article.sty.}The5approachwhichweusetosolvethisistoprovideminimal lesarticle.sty,5book.styUUandreport.sty,whichsimplyloadtheappropriateclass les.5F*orUUexample,article.stycontainsjustthefollowinglines:ލC,\NeedsTeXFormat{LaTeX2e} C,\@obsoletefile{article.cls}{article.sty}C,\LoadClass{article}ލ5Y*our"maywishtodothesameor,yUifyouthinkthatitissafetodoso,yUyoumay 5decideUUtojustremoveUUmyclass.sty.P52.7.2X#Mak9eTitrobustf5W*econsideritgoGodpractice,8whenwritingpackqagesandclasses,touseL5ffA͉TU>'ExX5commandsUUasmuchUUaspGossible.5Thus,͊insteadOofusing\def...werecommendusingoneof\newcommand,5\renewcommandqor\providecommand;\CheckCommandisalsouseful.H&Doingthis5makessitlesslikelythatyouwillinadvertentlyrede neacommand,{ givingun-5expGectedUUresults.5Whenoyoude neanenvironment,use\newenvironmentor\renewenvironment5insteadUU\def\foo{...}and\def\endfoo{...}.5Ifyouneedtosetorchangethevqalueofahdimenci-orhskipi#=ղregister,e7use5\setlength.7sso5T*o'ExXcommandssuchas\sbox,A\mboxand\parbox 5ratherUUthan\setbox,\hboxand\vbox._5Use(F\PackageError,\PackageWarningor\PackageInfo(ortheequivqalent5classUUcommands)ratherthan\@latexerr,\@warningor\wlog.5ItisstillpGossibletodeclareoptionsbyde ning\ds@hoptionci)Handcalling5\@options;but,werecommendthe\DeclareOptionand\ProcessOptions5commands~instead.CThesearemorepGowerful~anduselessmemory*.Sorather5thanUUusing:&ˍC,\def\ds@draft{\overfullrule5pt} C,\@options&ˍ5youUUshoulduse:C,\DeclareOption{draft}{\setlength{\overfullrule}{5pt}}C,\ProcessOptions\relax&ˍ5The2advqantageofthiskindofpracticeisthatyourcoGdeismorereadableand, 5moreimpGortant,thatitislesslikelytobreakwhenusedwithfutureversionsof5L5ffA͉TU>'ExX.捍52.7.3X#Mak9eTitpQortable5It>isalsosensibletomakeyour lesareaspGortableaspossible.j+T*oensurethis;5theyD@shouldcontainonlyvisible7-bittext;Iandthe lenamesshouldcontainat5most eightcharacters(plusthethreeletterextension).XAlso,ofcourse,itm9ust5nothavethesamenameasa leinthestandardL5ffA͉TU>'ExXdistribution,however5similarUUitscontentsUUmaybGetooneofthese les._5ItisalsousefulifloGcalclassesorpackqageshaveacommonpre x,forexample5theUniversityofNowhereclassesmightbGeginwithunw. Thishelpstoavoid5everyUUUniversityhavingitsownthesisclass,allcalledthesis.cls.5If"yourelyonsomefeaturesoftheL5ffA͉TU>'ExXkernel, `oronapackqage, `pleasespGecify5therelease-dateyouneed. F*orexample,F_thepackqageerrorcommandswere5introGducedUUintheJune1994releaseso,ifyouusethemthenyoushouldput:&ˍC,\NeedsTeXFormat{LaTeX2e}[1994/06/01]捍52.7.4X#UsefulThoQoks5SomepackqagesanddoGcumentstyleshadtorede nethecommand\document5or\enddocumenttoachievetheirgoal.yThisisnolongernecessary*.Youcan5nowiusethe`hoGoks'\AtBeginDocumentand\AtEndDocument(seeSection4.6).5Again,R6usingQnthesehoGoksmakesitlesslikelythatyourcoGdebreakswithfuture5versionsbofL5ffA͉TU>'ExX.LItalsomakesitmorelikelythatyourpackqagecanwork5togetherUUwithsomeoneelse's.5However,$notethatcoGdeinthe\AtBeginDocumenthookispartofthepream-New description1996/12/015ble.ThusgbtherearerestrictionsonwhatcanbGeputthere;iinparticular,no5typGesetttingUUcanbedone.8 ~ߠso53MLTheffstructureofaclassorpackage385L5ffA͉TU>'ExX2"^TclassesandpackqageshavemorestructurethanL5ffA͉TU>'ExX2.09style les 5did.qTheUUoutlineofaclassorpackqage leis:U5Iden9ti cation|TheWV lesaysthatitisaL5ffA͉TU>'ExX2",Vpackqageorclass,WandgivesaNshortUUdescriptionofitself.L5PreliminaryTdeclarations.Here\the ledeclaressomecommandsandcanalsoNloadother les.SUsuallythesecommandswillbGejustthoseneededfortheNcoGdeUUusedinthedeclaredoptions.5Optionsa^TheUU ledeclaresandproGcessesitsoptions.5MoreTdeclarationsThisEiswherethe ledoGesmostofitswork: declaringnewNvqariables,UUcommandsandfonts;andloadingother les.53.1SIdenti cationq5The rstthingaclassorpackqage ledoGesisidentifyitself.SPackqage lesdothis5asUUfollows: dC,\NeedsTeXFormat{LaTeX2e} C,\ProvidesPackage{hpackage i&}[hdate i]hotherNnotbGeused5intheidenti cationbannerofany leotherthanthoseinthestandardL5ffA͉TU>'ExX5distribution.9 so53.2SUsingclassesandpack@agesuT5TheO rstma8jordi erencebGetweenOL5ffA͉TU>'ExX2.09style lesandL5ffATU>'ExX2"+packqages 5and[classesisthatL5ffA͉TU>'ExX2"-`suppGortsmo}'dularity,]inthesenseofbuilding les5fromUUsmallbuilding-bloGcksratherthanusinglargesingle les.5AUUL5ffA͉TU>'ExXpackqageorclasscanloadapackqageasfollows:C,\RequirePackage[hoptionsi$]{hpackage i&}[hdate il]5F*orUUexample:C,\RequirePackage{ifthen}[1994/06/01]5Thisycommandhasthesamesyntaxastheauthorcommand\usepackage.(Ital- 5lowsCpackqagesorclassestousefeaturesprovidedbyotherpackqages.F*orexample,5byaloadingtheifthenpackqage,oapackqagewritercanusethe`if...then...else...'5commandsUUprovidedbythatpackqage.5AUUL5ffA͉TU>'ExXclasscanloadoneotherclassasfollows:C,\LoadClass[hoptionsi$]{hclass-name i3ʟ}[hdate il]5F*orUUexample:C,\LoadClass[twocolumn]{article}5Thislcommandhasthesamesyntaxastheauthorcommand\documentclass. 5ItallowsclassestobGebasedonthesyntaxandappGearanceofanotherclass.IF*or5example,L>byloadingthearticleclass,aclasswriteronlyhastochangethe5bitsUUofarticletheydon'tlike,ratherthanwritinganewclassfromscratch.5TheifollowingcommandscanbGeusedinthecommoncasethatyouwanttoNewTfeature 1995/12/015simply`Cloadaclassorpackqage lewithexactlythoseoptionsthatarebGeing5usedUUbythecurrentclass.C,\LoadClassWithOptions{hclass-name i3ʟ}[hdate il] C,\RequirePackageWithOptions{hpackage i&}[hdate il]5F*orUUexample:C,\LoadClassWithOptions{article} C,\RequirePackageWithOptions{graphics}[1995/12/01]10 so53.3SDeclaringoptions5The^otherma8jordi erencebGetween^L5ffA͉TU>'ExX2.09stylesandL5ffATU>'ExX2".Hpackqages 5and classesisinoptionhandling.`4Packqages andclassescannowdeclareoptions5andDthesecanbGespeci edbyauthors;;forexample,jthetwocolumnoptionis5declaredUUbythearticleclass.T5AnUUoptionisdeclaredasfollows:C,\DeclareOption{hoption9i!+}{hcode i}5F*orbexample,ethedvipsoption(slightlysimpli ed)tothegraphicspackqageis5implementedUUas:C,\DeclareOption{dvips}{\input{dvips.def}}5Thiswmeansthatwhenanauthorwrites\usepackage[dvips]{graphics},xthe5 ledvips.defisloaded.IAsanotherexample, thea4paperoptionisdeclared5inUUthearticleclasstosetthe\paperheightand\paperwidthlengths:C,\DeclareOption{a4paper}{% QY\setlength{\paperheight}{297mm}%QY\setlength{\paperwidth}{210mm}%C,}5Sometimesbauserwillrequestanoptionwhichtheclassorpackqagehasnot 5explicitly"declared.`BydefaultthiswillproGduceawarning(forclasses)orerror5(forUUpackqages);thisbGehaviourcanbGealteredasfollows:C,\DeclareOption*{hcode i}5F*orexample,tomakethepackqagefredproGduceawarningratherthananerror5forUUunknownoptions,youcouldspGecify:C,\DeclareOption*{% QY\PackageWarning{fred}{Unknownoption`\CurrentOption'}%C,}5Then,Y?if%Canauthorwrites\usepackage[foo]{fred},theywillgetawarning 5Package?fredWarning: Unknownoption`foo'.{Asanotherexample,Ƞthe5fontencvpackqagetriestoloada lehENCsi!Xenc.defwheneverthehENCsi$3option5isUUused.qThiscanbGedonebywriting:C,\DeclareOption*{% QY\input{\CurrentOptionenc.def}%C,}5It٦ispGossibletopassoptionsontoanotherpackqageorclass,cusingthecommand 5\PassOptionsToPackageor\PassOptionsToClass./TF*orexample,topassevery5unknownUUoptionontothearticleclass,youcanuse:11 ?soC,\DeclareOption*{% QY\PassOptionsToClass{\CurrentOption}{article}%C,}5IfyoudothisthenyoushouldmakesureyouloadtheclassatsomelaterpGoint, 5otherwiseUUtheoptionswillneverbGeprocessed!5Sofar,އwehaveexplainedonlyhowtodeclareoptions,އnothowtoexecutethem.5T*oUUproGcesstheoptionswithwhichthe lewascalled,youshoulduse:C,\ProcessOptions\relax5This+executesthehc}'ode[i"+foreachoptionthatwasbGothspeci edanddeclared5(seeUUSection4.7fordetailsofhowthisisdone).5F*orUUexample,ifthejanepackqage lecontains:C,\DeclareOption{foo}{\typeout{Sawfoo.}} C,\DeclareOption{baz}{\typeout{Sawbaz.}}C,\DeclareOption*{\typeout{What's\CurrentOption?}}C,\ProcessOptions\relax5andanauthorwrites\usepackage[foo,bar]{jane},thentheywillseethe 5messagesUUSaw?foo.qDzandWhat'sbar?!653.4SAminimalclass leuT5MostRoftheworkofaclassorpackqageisinde ningnewcommands,Sorchanging5theӰappGearanceofdocuments.Thisisdoneinthebodyofthepackqage,Gusing5commandsUUsuchas\newcommandor\setlength.5L5ffA͉TU>'ExX2"\zprovidesVseveralnewcommandstohelpclassandpackqagewriters;these5areUUdescribGedindetailinSection4.5ThereTqarethreethingsthateveryclass lemustGIcontain:qUtheseareade nition5of*\normalsizeandvqaluesfor\textwidthand\textheight.Soaminimal5doGcumentUUclass le^1Ȳlookslikethis:C,\NeedsTeXFormat{LaTeX2e} C,\ProvidesClass{minimal}[1995/10/30StandardLaTeXminimalclass]C,\renewcommand{\normalsize}{\fontsize{10pt}{12pt}\selectfont}C,\setlength{\textwidth}{6.5in}C,\setlength{\textheight}{8in}5However,GthisZclass lewillnotsuppGortfootnotes,Gmarginals, oats,etc.nor 5willitprovideanyofthe2-letterfontcommandssuchas\rm;&thusmostclasses5willUUcontainmorethanthisminimum!5ffffv J= "5-:Aacmr61LܿThisXclassisnoÎwinthestandarddistribution,as1Cscmtt8minimal.cls.12 Tso53.5SExample:alo`calletterclassuT5AOcompanyOmayhaveitsownletterclass,forsettinglettersinthecompany 5style. Thissectionshowsasimpleimplementationofsuchaclass,Falthougha5realUUclasswouldneedmorestructure.5TheUUclassbGeginsbyannouncingitselfasneplet.cls.C,\NeedsTeXFormat{LaTeX2e} C,\ProvidesClass{neplet}[1995/04/01NonExistentPressletterclass]5Then thisnextbitpassesanyoptionsontotheletterclass,Rwhichisloaded5withUUthea4paperoption.C,\DeclareOption*{\PassOptionsToClass{\CurrentOption}{letter}} C,\ProcessOptions\relaxC,\LoadClass[a4paper]{letter}5In>ordertousethecompanyletterhead,Citrede nesthefirstpagepagestyle: 5thisUUisthepagestylethatisusedonthe rstpageofletters.C,\renewcommand{\ps@firstpage}{%QY\renewcommand{\@oddhead}{hletterheadN'ExX,Wjusingavqariantofthearticle 5class.qTheUUclassbGeginsbyannouncingitselfassmplnews.cls.C,\NeedsTeXFormat{LaTeX2e}C,\ProvidesClass{smplnews}[1995/04/01TheSimpleNewsnewsletterclass]C,\newcommand{\headlinecolor}{\normalcolor}5It$passesmostspGeci edoptionsontothearticleclass:eapartfromthe 5onecolumnz&option,Zwhichisswitchedo ,Zandthegreenoption,whichsetsthe5headlineUUingreen.C,\DeclareOption{onecolumn}{\OptionNotUsed} C,\DeclareOption{green}{\renewcommand{\headlinecolor}{\color{green}}}C,\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}C,\ProcessOptions\relax13}so5ItUUthenloadstheclassarticlewiththeoptiontwocolumn.ꍑC,\LoadClass[twocolumn]{article}ꍑ5Since>thenewsletteristobGeprintedincolour,C1itnowloadsthecolorpackqage. 5TheclassdoGesnotspecifyadevicedriveroptionsincethisshouldbespeci ed5byUUtheuserofthesmplnewsclass.C,\RequirePackage{color}ꍑ5Theclassthenrede nes\maketitletoproGducethetitlein72ptHelveticabold5oblique,UUintheappropriatecolour.C,\renewcommand{\maketitle}{% QY\twocolumn[%_F\fontsize{72}{80}\fontfamily{phv}\fontseries{b}%_F\fontshape{sl}\selectfont\headlinecolor_F\@titleQY]%C,}ꍑ5ItUUrede nes\sectionandswitcheso sectionnumbGering.C,\renewcommand{\section}{%QY\@startsection_F{section}{1}{0pt}{-1.5explus-1exminus-.2ex}%_F{1explus.2ex}{\large\sffamily\slshape\headlinecolor}%C,}C,\setcounter{secnumdepth}{0}ꍑ5ItUUalsosetsthethreeessentialthings.C,\renewcommand{\normalsize}{\fontsize{9}{10}\selectfont}C,\setlength{\textwidth}{17.5cm}C,\setlength{\textheight}{25cm}ꍑ5InNbpractice,Oaclasswouldneedmorethanthis:nMitwouldprovidecommandsfor 5issue numbGers,Zauthorsofarticles,pagestylesandsoon;%butthisskeletongives5aUUstart.qTheltnewsclass leisnotmuchUUmorecomplexthanthisone.&獍54MLCommandsffforclassandpackagewriters5ThissectiondescribGesbrie yeachofthenewcommandsforclassandpackqage5writers.6T*o ndoutabGoutotheraspectsofthenewsystem,?youshouldalsoread5L雍QATKß'E-X: AvDo}'cument̄PreparationSystem,ATheL雍QATKß'E-XCompanionWBandL雍QATKß'E-X2"5forAuthors.14so54.1SIdenti cation5The rstgroupofcommandsdiscussedherearethoseusedtoidentifyyourclass 5orUUpackqage le.o@ff&1ͤLτ ffΟ1\NeedsTeXFormatT{hformat-name i;}[hrelease-date i6]͡ ff5ff&阍5ThisLcommandtellsTU>'ExXthatthis leshouldbGeprocessedusingaformatwith5namehformat-name[iEN. kY*oucanusetheoptionalargumenthr}'elease-date[iDto5furtherzgspGecifytheearliestreleasedateoftheformatthatisneeded.When5the{@releasedateoftheformatisolderthantheonespGeci edawarningwillbe5generated.WThestandardhformat-name[iFisLaTeX2e.Thedate,ifpresent,must5bGeUUintheformyyyy/mm/dd.^ˍ5Example:KƍC,\NeedsTeXFormat{LaTeX2e}[1994/06/01] `ffy1ͤLτ ffΟ1\ProvidesClassT{hclass-name i3ʟ}[hrelease-info'i56]? ff ͤLτ ffΟ1\ProvidesPackageT{hpackage-name i?}[hrelease-info'i56]͡ ff5ffy厎ō5This#declaresthatthecurrent lecontainsthede nitionsforthedoGcumentclass5hclass-name[ipeCorUUpackqagehp}'ackage-name[iH,W.5TheUUoptionalhr}'elease-infoi<ﺲ,ifused,mustcontain:`DNtheUUreleasedateofthisversionofthe le,intheformyyyy/mm/dd;^ʍDNoptionallyLfollowedbyaspaceandashortdescription,NZpGossiblyincludingNaUUversionnumbGer.5ThedabGovesyntaxshouldbGefollowedexactlysothatthisinformationcanbGe5used"by\LoadClassor\documentclass(forclasses)or\RequirePackageor5\usepackageUU(forpackqages)totestthatthereleaseisnottoGoold.^ˍ5Thec wholeofthishr}'elease-infoiB`informationisdisplayedc by\listfilesand5shouldUUthereforenotbGetoolong.5Example:KƍC,\ProvidesClass{article}[1994/06/01v1.0StandardLaTeXclass] C,\ProvidesPackage{ifthen}[1994/06/01v1.0StandardLaTeXpackage]o@ffi1ͤLτ ffΟ1\ProvidesFileT{h le-name i,D}[hrelease-info'i56]͡ ff5ffi阍5Thisfissimilartothetwofpreviouscommandsexceptthatherethefull lename,5including/theextension,%mustbGegiven.UItisusedfordeclaringany lesother5thanUUmainclassandpackqage les.5Example:KƍC,\ProvidesFile{T1enc.def}[1994/06/01v1.0StandardLaTeXfile]Kƍ5NotethatthephraseStandard?LaTeXm9ust,notbGeusedintheidenti cation5bannerUUofany leotherthanthoseinthestandardL5ffA͉TU>'ExXdistribution.15;so54.2SLoading lesX5ThisogroupofcommandscanbGeusedtocreateyourowndoGcumentclassorNewTfeature 1995/12/01 5packqageUUbybuildingonexistingclassesorpackqages."(ff! 1ͤLτ ffΟ1\RequirePackageT[hoptions-listi4o=]{hpackage-name i?}[hrelease-info'i56]͡ ff ͤLτ ffΟ1\RequirePackageWithOptionsT{hpackage-name i?}[hrelease-info'i56] ff5ff! ō5PackqagesUUandclassesshouldusethesecommandstoloadotherpackages.⼍5Theuseof\RequirePackageisthesameastheauthorcommand\usepackage.5Examples:C,\RequirePackage{ifthen}[1994/06/01] C,\RequirePackageWithOptions{graphics}[1995/12/01]"affI؟1ͤLτ ffΟ1\LoadClassT[hoptions-listi4o=]{hclass-name i3ʟ}[hrelease-info'i56]͡ ffͤLτ ffΟ1\LoadClassWithOptionsT{hclass-name i3ʟ}[hrelease-info'i56] ff5ffI؎5Theseucommandsareforuseonlyinclass les,'ExX2"+Tconstruct.5Example:16̠soC,\DeclareOption{twoside}{\@twosidetrue}o@ffxH(1ͤLτ ffΟ1\DeclareOption*T{hcode i}͡ ff5ffxH(阍5Thisdeclaresthehc}'ode[i"=tobGeexecutedforeveryoptionwhichisspGeci edfor, 5butotherwisenotexplicitlydeclaredby*,atheclassorpackqage;thiscoGdeiscalled5theUU`defaultoptioncoGde'anditcancontainanyvqalidL5ffA͉TU>'ExX2"+Tconstruct.5Ifaclass lecontainsno\DeclareOption*then,bydefault,allspGeci edbut5undeclaredlLoptionsforthatclasswillbGesilentlypassedtoallpackqages(aswill5theUUspGeci edanddeclaredoptionsforthatclass).5Ifapackqage lecontainsno\DeclareOption*then,hbydefault,heachspGeci ed5butUUundeclaredoptionforthatpackqagewillproGduceanerror.!654.4SCommandswithinoptionco`deuT5ThesextwocommandscanbGeusedonlywithinthehc}'ode[i%argumentofei-5ther\DeclareOptionor\DeclareOption*.cOthercommandscommonlyused5withinUUtheseargumentscanbGefoundinthenextfewsubsections.o@ffN&51ͤLτ ffΟ1\CurrentOption͡ ff5ffN&5阍5ThisUUexpandstothenameofthecurrentoption.@ffN&51ͤLτ ffΟ1\OptionNotUsed͡ ff5ffN&55ThisUUcausesthecurrentoptiontobGeaddedtothelistof`unusedoptions'.5Y*ouecannowincludehashmarks(#)withinthesehc}'ode[i#argumentswithoutNewTfeature 1995/06/01 5spGecialUUtreatment(formerly*,ithadbeennecessarytodoublethem).!654.5SMovingoptionsarounduT5These[twocommandsarealsoveryusefulwithinthehc}'ode[i&؋argumentof5\DeclareOptionUUor\DeclareOption*:"OEffRq1ͤLτ ffΟ1\PassOptionsToPackageT{hoptions-listi4o=}{hpackage-name i?}͡ ff ͤLτ ffΟ1\PassOptionsToClassT{hoptions-listi4o=}{hclass-name i3ʟ}? ff5ffRq5Thecommand\PassOptionsToPackagepassestheoptionsinhoptions-listظi?to5packqagehp}'ackage-name[iH .Thismeansthatitaddsthehoption-listظis,\LoadClassWithOptions{article}}5ThisUUshouldbGecomparedwiththeslightlydi erentconstruction>s,\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} >s,\ProcessOptions\relax>s,\LoadClass{article}}5As9usedabGove,2the9e ectsaremoreorlessthesame,butthe rstisalotless 5toUUtypGe;alsothe\LoadClassWithOptionsmethodrunsslightlyquicker.`5If,2however,the)Mclassdeclaresoptionsofitsownthenthetwoconstructionsare5di erent.qCompare,UUforexample:>s,\DeclareOption{landscape}{\@landscapetrue} >s,\ProcessOptions\relax>s,\LoadClassWithOptions{article}}5with:>s,\DeclareOption{landscape}{\@landscapetrue}>s,\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}>s,\ProcessOptions\relax>s,\LoadClass{article}}5Inthe rstexample,/the2m#R cmss10articleclasswillbGeloadedwithoptionlandscape 5preciselywhenthecurrentclassiscalledwiththisoption.B0Bycontrast,+inthe5secondexampleitwillneverbGecalledwithoptionlandscapeasinthatcase5article.ispassedoptionsonlybythedefaultoptionhandler,butthishandleris5notUUusedforlandscapebGecausethatoptionisexplicitlydeclared.18Jso54.6SDelayingco`de5These)5 rsttwo)5commandsarealsointendedprimarilyforusewithinthehc}'ode[i 5argumentUUof\DeclareOptionor\DeclareOption*."OEffxH(1ͤLτ ffΟ1\AtEndOfClassT{hcode i}? ff ͤLτ ffΟ1\AtEndOfPackageT{hcode i}͡ ff5ffxH(5Thesecommandsdeclarehc}'ode[i bthatissavedawayinternallyandthenexecuted5afterUUproGcessingthewholeofthecurrentclassorpackqage le.W5RepGeatedAuseofthesecommandsispermitted:IGthecodeintheargumentsis5storedUU(andlaterexecuted)intheorderoftheirdeclarations."aff}1ͤLτ ffΟ1\AtBeginDocumentT{hcode i}͡ ff ͤLτ ffΟ1\AtEndDocumentT{hcode i}? ff5ff}5Thesecommandsdeclarehc}'ode[i ˲tobGesavedinternallyandexecutedwhileL5ffA͉TU>'ExX5isUUexecuting\begin{document}or\end{document}.W5Thehc}'ode[i UspGeci edintheargumentto\AtBeginDocumentisexecutednearthe5endğofthe\begin{document}coGde,after,thefontselectiontableshavebGeenset5up./?It}isthereforeausefulplacetoputcoGdewhichneedstobeexecutedafter5everything=hasbGeenpreparedfortypGesettingandwhenthenormalfontforthe5doGcumentUUisthecurrentfont.5The\AtBeginDocumenthoGokshouldnotbeusedforcodethatdoesanytypGe-New description1995/12/015settingUUsincethetypGesetresultwouldbGeunpredictable.5TheҸhc}'ode[i$yspGeci edintheargumentto\AtEndDocumentisexecutedatthe5bGeginning|`ofthe\end{document}code,"b}'efore'ExX2.09hasbGeenmadeequivqalenttothisin5orderUUtoeasethetaskofupGdatingolddocumentstylestoL5ffA͉TU>'ExX2"+Tclass les.o@ff׈1ͤLτ ffΟ1\ExecuteOptionsT{hoptions-listi4o=}͡ ff5ff׈阍5F*oreachoptioninthehoptions-listظi<,'inorder,thiscommandsimplyexecutes5the command\ds@hoptionci&;(ifthiscommandisnotde ned,thenthatoptionis5silentlyUUignored).5It:canbGeusedtoprovidea`defaultoptionlist'justbefore\ProcessOptions.5F*or9example,suppGosethatinaclass leyouwanttosetupthedefaultdesign5toUUbGe:qtwo-sidedprinting;11ptfonts;intwocolumns.qThenitcouldspGecify:bC,\ExecuteOptions{11pt,twoside,twocolumn}21 so54.8SSafe lecommands 5These commandsdealwith leinput;theyensurethatthenon-existenceofa 5requestedUU lecanbGehandledinauser-friendlyway*.o@ff͙W1ͤLτ ffΟ1\IfFileExistsT{h le-name i,D}{htrue i O}{hfalse iѥ}͡ ff5ff͙W阍5IfUUthe leexiststhenthecoGdespeci edinhtrue[i isexecuted.35IfUUthe ledoGesnotexistthenthecodespeci edinhfalse[i"2isexecuted.5ThisUUcommanddoGesnotH-inputthe le.@ff9E1ͤLτ ffΟ1\InputIfFileExistsT{h le-name i,D}{htrue i O}{hfalse iѥ}͡ ff5ff9E阍5Thisinputsthe leh le-name[i8Ʋ:#\\protectcanbGeusedtostopacom-5mandfromexpanding;Y\MessageBreakcausesaline-break;and\spaceprints5aUUspace.5Note$thattheherr}'or-textظi9̲willhave$afullstopaddedtoit,sodonotputone5intoUUtheargument.5F*orUUexample:C,\newcommand{\foo}{FOO} C,\PackageError{ethel}{%QYYourhovercraftisfullofeels,\MessageBreakQYand\protect\foo\spaceis\fooC,}{%QYOhdear!Something'sgonewrong.\MessageBreakQY\space\spaceTrytyping\spaceQY\spacetoproceed,ignoring\protect\foo.C,}5proGducesUUthisdisplay:22soC,!PackageethelError:Yourhovercraftisfullofeels, C,(ethel)K`and\fooisFOO.C,Seetheethelpackagedocumentationforexplanation.5IfUUtheusertypGesh,thiswillbeshown:C,Ohdear!Something'sgonewrong.LTrytyping s,toproceed,ignoring\foo.8aff1ͤLτ ffΟ1\ClassWarningT{hclass-name i3ʟ}{hwarning-texti:;}7gá ffͤLτ ffΟ1\PackageWarningT{hpackage-name i?}{hwarning-texti:;}"&Q ffͤLτ ffΟ1\ClassWarningNoLineT{hclass-name i3ʟ}{hwarning-texti:;}? ffͤLτ ffΟ1\PackageWarningNoLineT{hpackage-name i?}{hwarning-texti:;}͡ ffͤLτ ffΟ1\ClassInfoT{hclass-name i3ʟ}{hinfo-texti)R}V9顄 ffͤLτ ffΟ1\PackageInfoT{hpackage-name i?}{hinfo-texti)R}@w ff5ffꎎ0ō5ThefourWarningcommandsaresimilartotheerrorcommands,FPexceptthat 5theyUUproGduceonlyawarningonthescreen,withnoerrorprompt.5The rsttwo,Warning versions,also showthelinenumbGerwherethewarning5oGccurred,UUwhilstthesecondtwo,UUWarningNoLineversions,donot.5The_ftwoInfocommandsaresimilarexceptthattheylogtheinformationonly5in?thetranscript le,includingthelinenumbGer.There?arenoNoLineversions5ofUUthesetwo.5Withinthehwarning-textظiHyŲandhinfo-textظi1:.\protectcanbGeusedtostopa5commandfromexpanding;Z\MessageBreakcausesaline-break;and\space5printsobaspace.%!Also,`theseshouldnotendwithafullstopasoneisautomatically5added.!654.10ZDe ningcommandsuT5L5ffA͉TU>'ExX2"^pprovides4someextramethoGdsof(re)de ningcommandsthatarein-5tendedUUforuseinclassandpackqage les.5Thee*-formsofthesecommandsshouldbGeusedtode necommandsthatareNewTfeature 1994/12/015not,}inuTU>'ExXterms,long.ThiscanbGeusefulforerror-trappingwithcommands5whoseUUargumentsarenotintendedtocontainwholeparagraphsoftext."(ff)91ͤLτ ffΟ1\DeclareRobustCommandT{hcmdpi`}[hnum9ib][hdefaulti"M]{hde nition9i-} c ff ͤLτ ffΟ1\DeclareRobustCommand*T{hcmdpi`}[hnum9ib][hdefaulti"M]{hde nition9i-}͡ ff5ff)9ō5Thisjcommandtakesthesameargumentsas\newcommandbutitdeclaresa5robustvcommand,evenifsomecoGdewithinthehde nitionci4&isfragile.'Y*oucanuse5thisfNcommandtode nenewrobustcommands,ortorede neexistingcommands5and&makethemrobust.A%logisputintothetranscript leifacommandis5rede ned.5F*orUUexample,if\seqisde nedasfollows:23"soC,\DeclareRobustCommand{\seq}[2][n]{% L\ifmmodeV#1_{1}\ldots#1_{#2}%L\elseV\PackageWarning{fred}{Youcan'tuse\protect\seq\spaceintext}%L\fiC,}5Then9thecommand\seqcanbGeusedinmovingarguments,+qeventhough 5\ifmmodeUUcannot,forexample:C,\section{Stuffaboutsequences$\seq{x}$}5NoteAmalsothatthereisnoneedtoputa\relaxbGeforethe\ifmmodeatthe5bGeginningdofthede nition;l]thisisbecausetheprotectiongivenbythis\relax5againstUUexpansionatthewrongtimewillbGeprovidedinternally*."(ffl1ͤLτ ffΟ1\CheckCommandT{hcmdpi`}[hnum9ib][hdefaulti"M]{hde nition9i-} c ff ͤLτ ffΟ1\CheckCommand*T{hcmdpi`}[hnum9ib][hdefaulti"M]{hde nition9i-}͡ ff5ffl5ThisFtakesthesameargumentsas\newcommandbut,Iratherthande nehcmdi=,5itjustchecksthatthecurrentde nitionofhcmdi&0²isexactlyasgivenby5hde nitioncifk.qAnUUerrorisraisedifthesede nitionsdi er.5ThislcommandisusefulforcheckinglthestateofthesystembGeforeyourpackqage5startsalteringthede nitionsofcommands..Itallowsyoutocheck,inparticular,5thatUUnootherpackqagehasrede nedthesamecommand.!654.11ZMovingargumentsuT5Then4settingofprotectwhilstproGcessing(i.e.moving)movingargumentshasNew description1994/12/015bGeenmreimplemented,2ashasthemethodofwritinginformationfromthe.aux le5toother lessuchasthe.toc le.;_DetailscanbGefoundinthe leltdefns.dtx.5W*eUUhopGethatthesechangeswillnota ectmanypackqages.'č55MLMiscellaneousffcommands,etc55.1SLayoutparameters"kffD 1ͤLτ ffΟ1\paperheight͡ ff ͤLτ ffΟ1\paperwidth c ff5ffD ō5TheseStwoparametersareusuallysetbytheclasstobGethesizeofthepaperbe-5ingv0used.'fThisshouldbGeactualpapersize,unlike\textwidthand\textheight5whichUUarethesizeofthemaintextbGodyUUwithinthemargins.240Nso55.2SCasechanging( ffqah1ͤLτ ffΟ1\MakeUppercaseT{htexti}͡ ff ͤLτ ffΟ1\MakeLowercaseT{htexti}͡ ff5ffqahō5TU>'ExXprovidestwoprimitives\uppercaseand\lowercaseforchangingthecaseNewTfeature 1995/06/01 5ofǚtext.ȕThesearesometimesusedindoGcumentclasses,$*forexampletoset5informationUUinrunningheadsinallcapitals._э5Unfortunately*,X}these$TU>'ExXprimitivesdonotchangethecaseofcharactersac-5cessedbycommandslike\aeor\aa.DT*oovercomethisproblem,L5ffA͉TU>'ExXprovides5twoUUnewcommands\MakeUppercaseand\MakeLowercasetodothis.5F*orUUexample:* =cw\uppercase{aBcD\ae\AA\ss\OE}ABCD;aA Pw\lowercase{aBcD\ae\AA\ss\OE}abGcd;aAc\MakeUppercase{aBcD\ae\AA\ss\OE}ABCD;aASS c\MakeLowercase{aBcD\ae\AA\ss\OE}abGcda5Thecommands\MakeUppercaseand\MakeLowercasethemselvesarerobust, 5butUUtheyhaveUUmovingarguments.5TheAcommandsusetheTU>'ExXprimitives\uppercaseand\lowercase,}andso5have;anumbGer;ofunexpected`features'.zInparticular,theychangethecaseof5everything(exceptcharactersinthenamesofcontrol-sequences)intheirtext5argument:qthisUUincludesmathematics,environmentnames,andlabGelnames.5F*orUUexample:\C,\MakeUppercase{$x+y$in\ref{foo}}\5proGducesUUX²+8Y9andthewarning:C,LaTeXWarning:Reference`FOO'onpage...undefinedon...5Inthelongrun,ҳwewouldliketouseall-capsfontsratherthananycommand 5like%\MakeUppercasebutthisisnotpGossibleatthemomentbGecausesuchfonts5doUUnotexist._э5InZorderthatuppGer/lower-casingZwillworkreasonablywell,andinordertoNew description1995/12/015provideRanycorrecthyphenation,QL5ffA͉TU>'ExX2"-0Mmust*use,QthroughoutadoGcument,5the|osame xedtableforchangingcase.Thetableusedisdesignedforthefont5encoGdingT1;JthisworkswellwiththestandardTU>'ExXfontsforallLatinalphabGets5butUUwillcauseproblemswhenusingotheralphabGets.!55.3SThe`op`enany'optioninthe`book'class%5ThewopenanyoptionallowschapterandsimilaropGeningstooccuronlefthandNew description1996/06/015pages.UPreviouslythisoptiona ectedonly\chapterand\backmatter.Itnow5alsoUUa ects\part,\frontmatterand\mainmatter.25:so55.4SBetteruser-de nedmathdisplayenvironmentso@ffo9O1ͤLτ ffΟ1\ignorespacesafterend͡ ff5ffo9O阍5SuppGose"thatyouwanttode neanenvironmentfordisplayingtextthatisNewTfeature 1996/12/01 5numbGeredUUasanequation.qAstraightforwardUUwaytodothisisasfollows:I>s,\newenvironment{texteqn} GX{\begin{equation}V\begin{minipage}{0.9\linewidth}}QY{\end{minipage}L\end{equation}}I5However,if youhavetriedthisthenyouwillprobablyhavenoticedthatitdoGes5notYworkpGerfectlywhenusedinthemiddleofaparagraphbecauseaninter-word5spaceUUappGearsatthebeginningofthe rstlineaftertheenvironment.5Thereisnowanextracommand(withaverylongname)avqailablethatyoucan5useUUtoavoidUUthisproblem;itshouldbGeinsertedasshownhere:I>s,\newenvironment{texteqn}GX{\begin{equation}V\begin{minipage}{0.9\linewidth}}QY{\end{minipage}L\end{equation}L\ignorespacesafterend}%56MLUpgradingffL++AnTL32EdX2.09classesandpackages5This-sectiondescribGesthechangesyoumayneedtomakewhenyouupgradean5existingL5ffA͉TU>'ExXstyletoapackqageorclassbutweshallstartinoptimisticmoGde.5Many existingstyle leswillrunwithL5ffA͉TU>'ExX2".iwithoutanymoGdi cationto5the leitself.!WheneverythingisrunningOK,pleaseputanoteinthenewly5created}packqageorclass letorecordthatitrunswiththenewstandardL5ffA͉TU>'ExX;5thenUUdistributeittoyourusers.&56.1STryit rst! 5The> rstthingyoushoulddoistotestyourstylein`compatibilitymoGde'.jOThe5only6 changeyouneedtomakeinordertodothisis,nSpGossibly*,to6 changethe5extensionofthe leto.cls:youshouldmakethischangeonlyifyour le5was{usedasamaindoGcumentstyle.Now,ŞwithoutanyothermoGdi cations,5rununL5ffA͉TU>'ExX2",>onunadoGcumentthatusesyour le.Thisassumesthatyouhavea5suitableB[collectionof lesthattestsallthefunctionalityprovidedbyyourstyle5 le.q(IfUUyouhaven't,nowisthetimetomakeone!)5Y*ounowneedtochangethetestdoGcument lessothattheyareL5ffA͉TU>'ExX2"5doGcuments:kseeHL雍QATKß'E-X2",! forAuthors#forHdetailsofhowtodothisandthentry5them! again.'Y*ouhave! nowtriedthetestdoGcumentsinbGothL5ffA͉TU>'ExX2"-native5moGdeUUandL5ffA͉TU>'ExX2.09compatibilitymode.26Gso56.2STroublesho`oting5IfUUyour ledoGesnotworkwithL5ffA͉TU>'ExX2"(,therearetwolikelyreasons.DNL5ffA͉TU>'ExX:gnowhasarobust,rwell-de neddesigner'sinterfaceforselectingfonts, NwhichUUisverydi erentfromtheL5ffA͉TU>'ExX2.09internals. 0DNY*ourystyle lemayhaveusedsomeL5ffA͉TU>'ExX2.09internalcommandswhichNhaveUUchanged,orwhichhavebGeenremoved.5Whenayouaredebuggingyour le,youwillprobablyneedmoreinformation5thanIkisnormallydisplayedIkbyL5ffA͉TU>'ExX2"*. NThisisachievedbyresettingthe5countererrorcontextlinesfromitsdefaultvqalueof1toamuchhigher5vqalue,UUe.g.999. 56.3SFontcommands5Some5fontandsizecommandsarenowde nedbythedoGcumentclassrather5than9+bytheL5ffA͉TU>'ExXkernel.hdIfyouareupgradingaL5ffA͉TU>'ExX2.09doGcumentstyleto5aclassthatdoGesnotloadoneofthestandardclasses,thenyouwillprobably5needUUtoaddde nitionsforthesecommands.o@ffG1ͤLτ ffΟ1\rmT\sf\tt\bf\it\sl\sc͡ ff5ffG阍5Noneƚoftheseshort-formfontselectioncommandsarede nedintheL5ffA͉TU>'ExX2"5kernel.qTheyUUarede nedbyallthestandardclass les. 05Ifyouwanttode netheminyourclass le,thereareseveralreasonableways5toUUdothis.5OneUUpGossiblede nitionis:C,\newcommand{\rm}{\rmfamily} C,...C,\newcommand{\sc}{\scshape}5This^wouldmakethefontcommandsorthogonal;cforexample{\bf\it?text} 5wouldWproGducebolditalic,Xqthus:v5F C cmbxti10text².y>ItwillalsomakethemproGduceanerror5ifUUusedinmathmoGde.5AnotherUUpGossiblede nitionis:C,\DeclareOldFontCommand{\rm}{\rmfamily}{\mathrm} C,...C,\DeclareOldFontCommand{\sc}{\scshape}{\mathsc}5Thiswillmake\rmactlike\rmfamilyintextmoGde(seeabove)anditwillmake 5\rmUUselectthe\mathrmmathalphabGetinmathmode.5ThusUU${\rm?math}=X+1$willproGduce`math9=X²+81'.5IfƗyoudonotwantfontselectiontobGeorthogonalthenyoucanfollowthe5standardUUclassesandde ne:27TsoC,\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm} C,...C,\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\mathsc}5Thismeans,Boforexample,that{\bf\it?text}willproGducemediumweight 5(ratherUUthanbGold)italic,thus:qtext."affD 1ͤLτ ffΟ1\normalsize c ffͤLτ ffΟ1\@normalsize͡ ff5ffD ō5Themcommand\@normalsizeisretainedforcompatibilitywithL5ffA͉TU>'ExX2.09pack-5ages5whichmayhaveuseditsvqalue;?butrede ningitinaclass lewillhaveno5e ectUUsinceitisalwaysUUresettohaveUUthesamemeaningas\normalsize.5This'ExXkerneltobGeanerrormessage."=}ff1ͤLτ ffΟ1\tinyT\footnotesize\small\large͡ ffͤLτ ffΟ1\LargeT\LARGE\huge\Huge+} ff5ffō5None^^oftheseother`standard'size-changingcommandsarede nedinthekernel:5eachyneedstobGede nedinaclass leifyouneedit.2Theyareallde nedby5theUUstandardclasses.5This*meansyoushoulduse\renewcommandfor\normalsizeand\newcommand5forUUtheothersize-changingcommands.!656.4SObsoletecommandsuT5Some packqageswillnotworkwithL5ffA͉TU>'ExX2"(`5,normallybGecausetheyreliedonan5internalL5ffA͉TU>'ExXcommandwhichwasneversuppGortedandhasnowchanged,or5bGeenUUremoved.5InmanycasestherewillnowbGearobust,high-levelmeansofachievingwhat5previously|requiredlow-level|commands.PleaseconsultSection4toseeifyou5canUUnowusetheL5ffA͉TU>'ExX2"+Tclassandpackqagewriterscommands.5Also,of|course,ifyourpackqageorclassrede nedanyofthekernelcom-5mands>(i.e.thosede nedinthe leslatex.tex,8slitex.tex,lfonts.tex,5sfonts.tex)thenyouwillneedtocheckitverycarefullyagainstthenewkernel5incasetheimplementationhaschangedorthecommandnolongerexistsinthe5L5ffA͉TU>'ExX2eUUkernel.5T*oGoLmanyoftheinternalcommandsofL5ffA͉TU>'ExX2.09havebGeenre-implemented5or^iremovedtobGeabletolistthemallhere.Y*oumustcheckanythatyouhave5usedUUorchanged.28`=so5W*eT/shall,however,listT/someofthemoreimpGortantcommandswhichareno 5longerUUsuppGorted.0&ffvٟ1ͤLτ ffΟ1\tenrmT\elvrm\twlrm...Ww ff ͤLτ ffΟ1\tenbfT\elvbf\twlbf...Ww ffͤLτ ffΟ1\tensfT\elvsf\twlsf...Ww ffE͟LτEff1L.L.L.v;sEff5ffvَ)2׍5Thea(approximately)seventyinternalcommandsofthisformarenolongerde-5 ned.QIf&yourclassorpackqageusesthemthenple}'ase3replacethemwithnew5fontUUcommandsdescribGedinL雍QATKß'E-X2",:F;ontSele}'ction.5F*orUUexample,thecommand\twlsfshouldbGereplacedby:C,\fontsize{12}{14}\normalfont\sffamily\selectfont5AnotherpGossibilityistousetherawfontspackqage,VdescribGedinL雍QATKß'E-X2"-i7for5Authors.5Also,remembGerFthatmanyofthefontspreloadedbyL5ffA͉TU>'ExX2.09arenolonger5preloaded.o@ffhu1ͤLτ ffΟ1\vptT\vipt\viipt...Ww ff5ffhu阍5TheseQDweretheinternalsize-selectingcommandsinL5ffA͉TU>'ExX2.09.pl(Theycanstill5bGe;usedinL5ffA͉TU>'ExX2.09compatibilitymode.)7Pleaseusethecommand\fontsize5instead:qseeUUL雍QATKß'E-X2",:F;ontSele}'ctionforUUdetails.5F*orUUexample,\vptshouldbGereplacedby:C,\fontsize{5}{6}\normalfont\selectfonto@ff m1ͤLτ ffΟ1\prm,T\pbf,\ppounds,\pLaTeX...Ww ff5ff m阍5L5ffA͉TU>'ExXkP2.09usedseveralcommandsbGeginningwith\pinordertoprovide`pro-5tected'commands.DSF*orexample,\LaTeXrwasde nedtobGe\protect\pLaTeX,5andb\pLaTeXGwasde nedtoproGducetheL5ffA͉TU>'ExXlogo.NvThismade\LaTeXrobust,5evenUUthough\pLaTeXwasnot.5ThesecommandshavenowbGeenreimplementedusing\DeclareRobustCommand5(describGedshinSection4.10).Ifyourpackqagerede nedoneofthe\p-commands5thenX1youmustremovetherede nitionanduse\DeclareRobustCommandtore-5de neUUthenon-\pcommand.'E@ff?s1ͤLτ ffΟ1\footheight͡ ff ͤLτ ffΟ1\@maxsep ffͤLτ ffΟ1\@dblmaxsep͡ ff5ff?sō5These]parametersarenotusedbyL5ffA͉TU>'ExX2",ֲsotheyhavebGeenremoved,_except5inUUL5ffA͉TU>'ExX2.09compatibilitymoGde.qClassesshouldnolongersetthem.29lso5References5[1]D;MichelGoGossens,ՇF*rankMittelbach,ՇandAlexanderSamarin.TheL雍QATKß'E-X D;Comp}'anion.nAddison-W*esley,UUReading,Massachusetts,UU1994.5[2]D;Donald]E.Knuth.TheTKß'E-Xb}'ook.Addison-W*esley,_Reading,Massachusetts,D;1986.nRevisedUUtocoverUUTU>'ExX3,1991.5[3]D;LeslieeLampGort.L雍QATKß'E-X:ADo}'cumentPreparationSystem.Addison-W*esley,D;Reading,UUMassachusetts,secondedition,1994.30yso5L++AnTL32EdXn 2(6DFff cmmib10"tRSummaryffsheet:32ups3datingoldstyles5SectionUUreferencesbGelowaretoL雍QATKß'E-X2",:forClassandPackageWriters.A81.NShould5itbGecomeaclassorapackqage?gISeeSection2.3forhowtoanswer NthisUUquestion.A82.NIf4itusesanotherstyle le,nthenyouwillneedtoobtainanupGdatedversionNof!,thisother le.LLoGokatSection2.7.1forinformationonhowtoloadNotherUUclassandpackqage les.A83.NT*ryUUit:qseeSection6.1.A84.NIt-Qworked?dpExcellent,5RbutthereareprobablystillsomethingsyoushouldNchangeinordertomakeyour leintoawell-structuredL5ffA͉TU>'ExX2"*[ lethatisNbGoth cmmi10K`y cmr10ٓRcmr7N