; TeX output 1997.03.28:1741soDtGGcmr17The7tGGcmss17abbqrevspackageuXQ ff cmr12abbreviation/macros(F4rankenstein'sbriefs)?XQ cmr12MattSwift߆T cmtt12ذEVVersion:8v1.0 *DoScumenrtationrevision:81996/03/21$!Kt : cmbx9Abstractэoo cmr9ThisN-pac9k|ragefacilitatesthede nitionofq[ cmsl9abbreviationmacros(whichex- bpand[totextandinsertthepropAerfollo9wingspacedependingoncon9text.bTheseS1macroscanbAeabbreviationsinasecondsensealso,expandingtoboneVsthingthe rsttimetheyareusedandanotherthingonsubsequen9tin-bv9oAcations.This<"facilitatestheautomaticspelling-outofabbreviationsorbacron9yms#attheir rstuse.ETheinitialandsubsequentexpansionsofanbabbreviationmacroarea9v|railableatanytimeviaexplicitcommands.zAb-bbreviationmacrosaregroupAedin9tocategories;iltherearehooksapplicablebto eac9hcategory:.CategoriescanbAeresetsothatsubsequentabbreviationbmacrosTinthatcategorybAeha9veTasifusedforthe rsttimeagain.oAgenericfacilit9yisalsoprovidedforsuxeslike1900ٖ- cmcsc10b.c.and6:00p.m.,bwhic9hTcorrectlyhandlesfollowingpAeriods.#8INff cmbx12PartffII Nq cmbx12DiscussionꨍI1aLGeneralIK`y cmr10AnĀabbreviationmacro"maybGeexplicitlyrequestedbyaddingasuxtotheabbreviationmacro.IThecommands\hc}'ommandi25shortand\hc}'ommandilongarealsode nedwhen-IeverUUanabbreviationmacro\hc}'ommandi5Risde ned.XAllabbreviationmacrosareassignedcategories,'identi edbyastring.iF*ourIcategoriesUUarede nedbythepackqage,anditiseasytoaddmore.!čI2aLUsageIExamplesUUofhowtode neabbreviationmacros:1*soW,\newbook\worst{WorstwardHo} W,\newbook\fall{AllThatFall}W,\newbook\nacht{NachtundTr\"aume}W,\newbook\csp{CollectedShorterPlays\emph{(}CSP\emph{)}}[CSP]W,\newname\joyce{JamesJoyce}[Joyce]W,\newname\nixon{RichardMilhousNixon}[Nixon]W,\newname\ww{Wordsworth}W,\newname\beckett{SamuelBeckett}[Beckett]W,\newwork\godot{WaitingforGodot}[Godot]W,\newbook\prelude{ThePrelude}W,\newtextmacro\ART{AmericanRepetroryTheater(ART)}[ART] XExamplesUUofhowtousethemacros,andhowtheyaretypGeset:I% The?manuscriptsof\ww's\preludeXdiffer.?... BeforehebeganX\prelude,?\wwwrote.... I&R6 cmss12LOOKSLIKE:X-I9ffi̟㎍ff9ThezmanuscriptsofJW*ordsworth'sThe[Pr}'eludeCղdi er.6...BeforezhebGeganThePr}'elude,UUW*ordsworthwrote.q...iffffffi̎#II% \nixon?wasthe37stAmericanXPresident.?... ManyAmericansXlike?myuncleNormvotedfor\nixonXenthusiastically?inboth1968andX1972.ILOOKSLIKE:X-I9ffi̟㎍ff9Richard{MilhousNixonwasthe37stAmericanPresident....Many{AmericanslikeUUmyuncleNormvotedforNixonenthusiasticallyinbGoth1968and1972.iffffffi̎#II% \beckett?gainedinternationalXnoteriety?withtheplay\godotinXthe?early1950s. \beckettwroteX\godot,?hesaid,asadiversionfromXthe?novelshewasthenwriting. IXhave?seenthisplayatthe\ARTinXCambridge,?Massachusetts. The\ARTXis?oftendisappointing,butIlikedXtheir?productionof\godot.ILOOKSLIKE:&X-I9ffi̟>㎍>ff9SamuelBeckettgainedinternationalnoterietywiththeplayWaitingFCforGo}'dotȲinthe8early1950s.sqBeckett8wroteGo}'dot,hesaid,asadiversionfromthenovelshewasthenwriting.?IhaveseenthisplayattheAmericanRepGetroryTheater(AR*T)inCambridge,̃Massachusetts.TheAR*TisoftendisappGointing,̃butIlikedtheirproGductionUUofGo}'dot.i>ffffffi̎+-X\newtextmacro{h\c}'ommandi7Z}{hinitiali"B}[hsubse}'quentظi6xt]de nesanabbrevia-b\newtextmacro2 soItionUUmacroh\c}'ommandi>ofcategoryx%m#R cmss10Generic. X\newname{h\c}'ommandi7Z}{hinitiali"B}[hsubse}'quentظi6xt]de nesanabbreviation3P\newnameImacroUUh\c}'ommandi>ofUUcategoryxName.X\newbook{h\c}'ommandi7Z}{hinitiali"B}[hsubse}'quentظi6xt]de nesanabbreviation3P\newbookImacroUUh\c}'ommandi>ofUUcategoryBo}'ok.X\newworkc{h\c}'ommandi7Z}{hbiblio}'graphykey}iMGV}{hinitiali"B}[hsubse}'quentظi6xt]de nes3P\newworkIanf>abbreviationmacroh\c}'ommandi<'rofcategoryWork."W*orkscanbGedistinguishedIfromUbGooksbybeinglistedinaseparatebibliography*,Ye.g.,ofprimaryworksIreferred tobyshorttitlesinthemaintext.Thede ningcommandthereforeIrequiresaB'- cmcsc10iDb32TU>ExX6keyasanargument.VjThe rstuseoftheworkservesasaIcitationUUtothatbibliography*,andallusesoftheworkgenerateanindexentry*.X(M cmbxsl10W arning:)U cmssi10Worksaarenotyetfullyimplemented.zPresentlytheyarethesameIasUUBoGoks.!čI3aLDateffMarksITheseUUvqariantsofabbreviationmacroscorrectlyhandlefollowingpGeriods./>\PM/>\AM/>\BC$/>\ADI% ?She?leftforworkbefore6\AM,butc?did?notarriveuntil12\PM. Thec?interval?5\BC--5\ADisoneyearc?shorter?thantheintervalc?95\AD--105\AD. ILOOKSLIKE:X-I9ffi̟㎍ff9She`%leftforworkbGefore6*- cmcsc10a.m.,butdidnotarriveuntil12p.m.7Theintervqal5b.c.{5a.d.qisUUoneyearshorterthantheintervqal95a.d.{105a.d.iffffffi̎+iI4aLProgrammers'ffinterfaceI\ResetAbbrevsi{hc}'ategorylistظi$ \TMHook0t\TMResetIegories.tThelistiscomma-separated,'ExX2eanddeclarethepackqage.I19S\NeedsTeXFormat{LaTeX2e}I20S\ProvidesPackage{abbrevs}[\PPOptArg]!čI6aLRequirementsI21S\NeedsTeXFormat{LaTeX2e}[1995/12/01]I22S\RequirePackage{moredefs}4&soI7aLBasicsILet'sGbGeginwiththetrickypartofinsertingspacebasedoncontext.Thestrat- Iegyis:W rst,ifthefollowingcharacterisnotin\nocorrandthecurrentfontisInot0slanted,gginsertanitaliccorrectionwith\sw@slant;8second,ifthefollowingIcharacterUUisnotin\nospacelist,insertaspace.XAgain,UUinpseudoGcode:MLETT=thenexttoken MIF(slantedfontiscurrentANDTNOTIN\nocorrlist)W,\sw@slantMFIMIFTNOTIN\nospacelistW,\spaceMFI b\nospacelistIPuttheseintheorderoftheirfrequency*.Anythingin\nocorrlistshouldalsoIbGeUUinhere,mostlikely*.I23S\newcommand\nospacelist{% I24],.':;?-~!)]\bgroup\egroupI25S}f\maybe@ic@space \maybe@ic@space@I\maybe@ic@spacehchecksthenextcharacterandinsertsanitaliccorrectionand IspaceUUasappropriate.I26S\newcommand\maybe@ic@space{%I27]\futurelet\@let@token\maybe@ic@space@I28S}IW*eUU rstcallthekernel's\maybe@ic@,thenourown\maybe@space@.I29S\newcommand\maybe@ic@space@{%I30]\maybe@ic@I31]\maybe@space@I32S}b\maybe@space \maybe@space@I\maybe@spacewUand\maybe@space@areverysimilartothekernel'sanalogs I\maybe@icand\maybe@ic@,&buttheycheck\nospacelistinsteadof\nocorr.I\t@st@icUUsets\@tempswafalseif\@let@tokenisin\nospacelist.I33S\newcommand\maybe@space{% I34]\futurelet\@let@token\maybe@space@I35S}I36S\newcommand\maybe@space@{%I37]\@tempswatrueI38]\expandafter,\@tforI39f\expandafter\reserved@aI40f\expandafter:%I41f\expandafter=%I42\nospacelistI43\do\t@st@icI44]\if@tempswaI45f\spaceI46]\fiI47S}5/soI8aLCategories\ResetAbbrevs 6\TMNewCategory L\TMResetAll \TMHookAllIEach1timeanabbreviationofcategoryURC1isde ned,8sometokensareaddedtothe IcontentsUUof\TMResethCsibղ.I48S\ReserveCS\TMResetAll I49S\ReserveCS\TMHookAllI50I51S\newcommand\TMNewCategory[1]{%args: s,categoryI52]\expandafter\ReserveCS\csnameTMReset#1\endcsnameI53]\expandafter\ReserveCS\csnameTMFont#1\endcsnameI54]\expandafter\ReserveCS\csnameTMHook#1\endcsnameI55]\expandafter\g@addto@macroI56f\expandafter\TMResetAll\csnameTMReset#1\endcsnameI57S}I58S\newcommand\ResetAbbrevs[1]{%args:category-listI59]\@for\sc@t@a:=#1\do{%I60f\@ifundefined{TMReset\sc@t@a}{%I61yw^\MonsterWarning{abbrevs}{Theabbreviationcategory\sc@t@a\spaceI62isnotdefined!}%I63p2}{%ELSEI64p2\@nameuse{TMReset\sc@t@a}%I65f}%I66]}%I67S}!čI9aLSuxes\TMLongSuffix 6\TMShortSuffixIWhenatextmacroiscreated,Jtwoadditionalcommandswiththesesuxesare IalsoUUcreated.qF*orexample,\foo,foolong,andfooshort.I68S\newcommand\TMLongSuffix{%I69]long%I70S}I71S\newcommand\TMShortSuffix{%I72]short%I73S}!čI10ifdPlainffabbreviationsIThecheckingthat\sw@slantdoGesforskipsandpenaltiesonthelistisgoingtobe IsupGer uousUfortheapplicationsIBimagine.LButwetradethatforamore exibleImacro.XW*e3don'tcheck3for\nocorroranemptybGody;maybe3weshouldwhenit'sI rstvde ned;WbutIvranintoreallyhairyexpansiontroublestryingtodothatandIuseUU\DeclareRobustCommand.qFIX.t\TMNewAbbrevPlainIThingssareeasywhentheabbreviationdoGesn'tswitchbetweensinitialandsubse-IquentUUexpansions.I74S\newcommand\TMNewAbbrevPlain[3]{%args:\csnamecategorybody I75]\@ifdefinable#1{%I76f\DeclareRobustCommand#1{%I77p2\@bsphack68soI78p2\@nameuse{TMHook#2}% I79p2\@esphackI80p2\ifmmodeI81yw^\def\sc@t@a{%I82\nfss@text{\@nameuse{TMFont#2}#3}%I83yw^}%I84p2\elseI85yw^\def\sc@t@a{%I86\leavevmodeI87\begingroupIW*eǝcanskipthecheckǝforemptinessandcontainingjustaspace,sincethosewon't IoGccurewithabbreviationmacrosexceptbyaccident,jIethink.W*eproGceedstraightItoUUacheckUUfor\nocorrs. I88]\tm@check@nocorr#3\nocorr\@nil I89]\@nameuse{TMFont#2}%I90]\tm@check@leftI91]#3%I92]\tm@check@rightI93\endgroupI94yw^}%I95p2\fiI96p2\sc@t@aI97f}%I98]}%I99S} \tm@check@nocorrIThiscorrespGondstothekernel's\check@nocorr@._W*esimplysubstitute\maybe@ Iic@space and\maybe@spaceinwherenecessary*.We alsouse\tm@check@leftIandUU\tm@check@rightinsteadof\check@icland\check@icr.E100S\NewName{tm@check@nocorr}{#1#2\nocorr#3\@nil}{% E101]\let\tm@check@left\maybe@icE102]\def\tm@check@right{\aftergroup\maybe@ic@space}%E103]\def\reserved@a{\nocorr}%E104]\def\reserved@b{#1}%E105]\def\reserved@c{#3}%E106]\ifx\reserved@a\reserved@bE107f\ifx\reserved@c\@emptyE108p2\let\check@icl\@emptyE109f\elseE110p2\let\check@icl\@emptyE111p2\def\check@icr{\aftergroup\maybe@space}%E112f\fiE113]\elseE114f\ifx\reserved@c\@empty\elseE115p2\def\tm@check@right{\aftergroup\maybe@space}%E116f\fiE117]\fiE118S} I11ifdControlffbs3ooleans \ifTMInhibitSwitching ҙ\TMInhibitSwitchingtrue Z\TMInhibitSwitchingfalse f\ifTMAlwaysLong t\TMAlwaysLongtrue 9\TMAlwaysLongfalseIControlUUbGooleans.7CsoE119S\newboolean{TMInhibitSwitching}%initiallyfalse E120S\newboolean{TMAlwaysLong}!%initiallyfalse!čI12ifdSwitchingffabbreviations4 Ʋ\TMNewAbbrevSwitcherIHereRFisthemainabbreviationmacrode ner.hItworksbyde ningtwomacros Ione'fortheinitialtextandoneforthesubsequenttext,\2andsettingupathirdIuserWcommandtochoGosebetweenWthetwoWasappropriate.Rr(The rsttwoWaremadeIavqailablestotheuserbyexplicitcallaswell.)Thefunctionusedtode netheItwo{macrosispassedasthe rstargumenttothisfunction.Suppliedde nersIareH5\TMNewAbbrevPlain(IH1willwrite\NewAbbrevWorkand\NewAbbrevDotcloseIsoGon͞FIX).Thesecondargumentisthecategory|eachde nertakesatleastthreeIarguments:0 avcommandname,?acategory*,andthecontent.+ThevthirdargumentIisEtheusermacronametobGecreated,Iandthefourthand fthargumentsaretheIinitialUUandsubsequentexpansiontexts.XThe?e rstpartsetsthreetokenvqariablestothethreecommandsequencesthatIthismacroisgoingtode ne|theuser,Kinitial,andsubsequentcommands.|TheIuserxcommandchecksxitsassoGciatedbooleanvqariabletoseewhetherithasbeenIcalledUUbGefore.qIfso,itcallsthe\subsequent"macro;ifnot,the\initial"macro.E121S\newcommand\TMNewAbbrevSwitcher[5]{%args:makercategorycsnameinitialsubseq.E122]\expandafter#1\csname#3\TMLongSuffix\endcsname{#2}{#4}E123]\expandafter#1\csname#3\TMShortSuffix\endcsname{#2}{#5}E124]\newboolean{@#3@mentioned}E125]\expandafter\g@addto@macro\csnameTMReset#2\endcsname{%E126f\global\csname@#3@mentionedfalse\endcsnameE127]}IW*e've-createdtheinitialandsubsequentmacros,andthebGoolean.TdNow-wede neItheUUusermacro.qThisde nitionistricky*.InpseudoGcode,UUitloGokslikethis:Mif#3definablethenW,#3:={if(#3-mentionedANDNOTTMAlwaysLong)thenl#3-short|relselifNOTTMInhibitSwitchingthen#3-mentioned:=(global)truel#3-long|rfi}MfiPI'mnotsurethisisanymorereadablethanaseaof#\expandafter\noexpands.E128]\expandafter\@ifdefinable\csname#3\endcsname{%E129S%K`is##1below:E130f\EExpand\csname#3\endcsname\In{%E131S%Y"####1:E132f\EExpand\csnameif@#3@mentioned\endcsname\In{%E133S%Y"########1:E134f\EExpand\csname#3\TMShortSuffix\endcsname\In{%E135S%Y"################1:E136f\EExpand\csname@#3@mentionedtrue\endcsname\In{%E137S%Y"################################1:8 LisoE138f\EExpand\csname#3\TMLongSuffix\endcsname\In{% E139S%\gdef\{%E140p2\gdef##1{% s,mustbeNOSPACEbefore`{'!E141yw^\@tempswafalseE142S%!\if@mentionedE143yw^####1%E144\ifTMAlwaysLong\elseE145]\@tempswatrueE146\fiE147yw^\fiE148yw^\if@tempswaE149S%*F\def\sc@t@a{\short}%E150\def\sc@t@a{########1}%E151yw^\elseE152\ifTMInhibitSwitching\elseE153S%3r\global\@@mentionedtrueE154]\global################1%E155\fiE156S%*F\def\sc@t@a{\long}%E157\def\sc@t@a{################################1}%E158yw^\fiE159yw^\sc@t@aE160p2}%,close\gdefE161f}}}}}%close\EExpand...\In'sE162]}%!close\@ifdefinableE163S}XW arning:The+ cmmi10x=y[ٟ^2-mathIsubse}'quentH-x=y[ٟ^2-mathIsubse}'quentH-$realdollarIsubse}'quentH-$realdollarIsubse}'quentH-#numbGersignIsubse}'quentH-#numbGersign13 ; + cmmi10K`y cmr10ٓRcmr7>