Refer—ABibliographySystem BillTuthill ComputingServices UniversityofCalifornia Berkeley,CA94720 ABSTRACT Referisabibliographysystemthatsupportsdataentry,indexing,retrieval,sorting,runoff,convenientcitations,andfootnoteorendnotenumbering.Thisdocument assumesyouknowhowtousesomeUnixeditor,andthatyouarefamiliarwiththe nroff/trofftextformatters. Thereferprogramisapreprocessorfornroff/troff,likeeqnandtbl,exceptthat itisusedforliteraturecitations,ratherthanforequationsandtables.Givenincomplete butsufficientlyprecisecitations,referfindsreferencesinabibliographicdatabase.The completereferencesareformattedasfootnotes,numbered,andplacedeitheratthebottomofthepage,orattheendofachapter. Anumberofancillaryprogramsmakerefereasiertouse.Theaddbibprogramis forcreatingandextendingthebibliographicdatabase;sortbibsortsthebibliographyby authoranddate,orotherselectedcriteria;androffbibrunsofftheentiredatabase,formattingitnotasfootnotes,butasabibliographyorannotatedbibliography. Onceafullbibliographyhasbeencreated,accesstimecanbeimprovedbymaking anindextothereferenceswithindxbib.Then,thelookbibprogramcanbeusedto quicklyretrieveindividualcitationsorgroupsofcitations.Creatingthisinvertedindex willspeeduprefer,andlookbibwillallowyoutoverifythatacitationissufficiently precisetodeliverjustonereference. 9April1993 Refer—ABibliographySystem BillTuthill ComputingServices UniversityofCalifornia Berkeley,CA94720 Introduction Takentogether,thereferprogramsconstituteadatabasesystemforusewithvariable-lengthinfor-mation.Todistinguishvarioustypesofbibliographicmaterial,thesystemuseslabelscomposedofupper caseletters,precededbyapercentsignandfollowedbyaspace.Forexample,onedocumentmightbe giventhisentry: %AJoelKies %TDocumentFormattingonUnixUsingthe-msMacros %IComputingServices %CBerkeley %D1980 Eachlineiscalledafield,andlinesgroupedtogetherarecalledarecord;recordsareseparatedfromeach otherbyablankline.Bibliographicinformationfollowsthelabels,containingdatatobeusedbythe refersystem.Theorderoffieldsisnotimportant,exceptthatauthorsshouldbeenteredinthesame orderastheyarelistedonthedocument.Fieldscanbeaslongasnecessary,andmayevenbecontinued onthefollowingline(s). Thelabelsaremeaningfultonroff/troffmacros,and,withafewexceptions,thereferprogram itselfdoesnotpayattentiontothem.Thisimpliesthatyoucanchangethelabelcodes,ifyoualsochange themacrosusedbynroff/troff.Themacropackagetakescareofdetailslikeproperordering,underliningthebooktitleorjournalname,andquotingthearticle’stitle.Herearethelabelsusedbyrefer,with anindicationofwhattheyrepresent: %HHeadercommentary,printedbeforereference %AAuthor’sname %QCorporateorforeignauthor(unreversed) %TTitleofarticleorbook %SSeriestitle %JJournalcontainingarticle %BBookcontainingarticle %RReport,paper,orthesis(forunpublishedmaterial) %VVolume %NNumberwithinvolume %EEditorofbookcontainingarticle %PPagenumber(s) %IIssuer(publisher) %CCitywherepublished %DDateofpublication %OOthercommentary,printedatendofreference %KKeywordsusedtolocatereference %LLabelusedby−koptionofrefer %XAbstract(usedbyroffbib,notbyrefer) Onlyrelevantfieldsshouldbesupplied.Exceptfor%A,eachfieldshouldbegivenonlyonce;inthecase -2-ofmultipleauthors,theseniorauthorshouldcomefirst.The%Qisfororganizationalauthors,orauthors withJapaneseorArabicnames,inwhichcasestheorderofnamesshouldbepreserved.Booksshouldbe labeledwiththe%T,notwiththe%B,whichisreservedforbookscontainingarticles.The%Jand%B fieldsshouldneverappeartogether,althoughiftheydo,the%Jwilloverridethe%B.Ifthereisno author,justaneditor,itisbesttotypetheeditorinthe%Afield,asinthisexample: %ABertrandBronson,ed. The%Efieldisusedfortheeditorofabook(%B)containinganarticle,whichhasitsownauthor.For unpublishedmaterialsuchastheses,usethe%Rfield;thetitleinthe%Tfieldwillbequoted,butthe contentsofthe%Rfieldwillnotbeunderlined.Unlikeotherfields,%H,%O,and%Xshouldcontain theirownpunctuation.Hereisamodestexample: %AMikeE.Lesk %TSomeApplicationsofInvertedIndexesontheUnixSystem %BUnixProgrammer’sManual %IBellLaboratories %CMurrayHill,NJ %D1978 %V2a %Krefermkeyinvhunt %XDifficulttoreadpaperthatdwellsonindexingstrategies, givinglittlepracticaladviceaboutusing\fBrefer\fP. Notethattheauthor’snameisgiveninnormalorder,withoutinvertingthesurname;inversionisdone automatically,exceptwhen%Qisusedinsteadof%A.Weuse%Xratherthan%Oforthecommentary becausewedonotwantthecommentprintedallthetime.The%Oand%Hfieldsareprintedbyboth referandroffbib;the%Xfieldisprintedonlybyroffbib,asadetachedannotationparagraph. DataEntrywithAddbib Theaddbibprogramisforcreatingandextendingbibliographicdatabases.Youmustgiveitthe filenameofyourbibliography: %addbibdatabase Everytimeyouenteraddbib,itasksifyouwantinstructions.Togetthem,typey;toskipthem,type RETURN.Addbibpromptsforvariousfields,readsfromthekeyboard,andwritesrecordscontainingthe refercodestothedatabase.Afterfinishingafieldentry,youshouldenditbytypingRETURN.Ifafield istoolongtofitonaline,typeabackslash(\)attheendoftheline,andyouwillbeabletocontinueon thefollowingline.Note:thebackslashworksinthiscapacityonlyinsideaddbib. Afieldwillnotbewrittentothedatabaseifnothingisenteredintoit.Typingaminussignasthe firstcharacterofanyfieldwillcauseaddbibtobackuponefieldatatime.Backingupisthebestwayto addmultipleauthors,anditreallyhelpsifyouforgettoaddsomethingimportant.Fieldsnotcontained inthepromptingskeletonmaybeenteredbytypingabackslashasthelastcharacterbeforeRETURN.The followinglinewillbesentverbatimtothedatabaseandaddbibwillresumewiththenextfield.Thisis identicaltotheprocedurefordealingwithlongfields,butwithnewfields,don’tforgetthe%key-letter. Finally,youwillbeaskedforanabstract(orannotation),whichwillbepreservedasthe%Xfield. Typeinasmanylinesasyouneed,andendwithacontrol-D(holddowntheCTRLbutton,thenpressthe ‘‘d’’key).Thispromptingforanabstractcanbesuppressedwiththe−acommandlineoption. Afteronebibliographicrecordhasbeencompleted,addbibwillaskifyouwanttocontinue.Ifyou do,typeRETURN;toquit,typeqorn(quitorno).Itisalsopossibletouseoneofthesystemeditorsto correctmistakesmadewhileenteringdata.Afterthe‘‘Continue?’’prompt,typeanyofthefollowing: edit,ex,vi,ored—youwillbeplacedinsidethecorrespondingeditor,andreturnedtoaddbibafterwards,fromwhereyoucaneitherquitoraddmoredata.

-3-Ifthepromptsnormallysuppliedbyaddbibarenotenough,areinthewrongorder,oraretoo numerous,youcanredefinetheskeletonbyconstructingapromptfile.Createsomefile,tobenamedafter the−pcommandlineoption.Placethepromptsyouwantontheleftside,followedbyasingleTAB(control-I),thentherefercodethatistoappearinthebibliographicdatabase.Addbibwillsendtheleft sidetothescreen,andtherightside,alongwithdataentered,tothedatabase. PrintingtheBibliography Sortbibisforsortingthebibliographybyauthor(%A)anddate(%D),orbydatainotherfields. Itisquiteusefulforproducingbibliographiesandannotatedbibliographies,whichareseldomenteredin strictalphabeticalorder.Ittakesasargumentsthenamesofupto16bibliographyfiles,andsendsthe sortedrecordstostandardoutput(theterminalscreen),whichmayberedirectedthroughapipeorintoa file. The−sKEYSflagtosortbibwillsortbyfieldswhosekey-lettersareintheKEYSstring,rather thanmerelybyauthoranddate.Key-lettersinKEYSmaybefollowedbya‘+’toindicatethatallsuch fieldsaretobeused.Thedefaultistosortbyseniorauthoranddate(printingtheseniorauthorlast namefirst),but−sA+Dwillsortbyallauthorsandthendate,and−sATDwillsortonseniorauthor, thentitle,andthendate. Roffbibisforrunningoffthe(probablysorted)bibliography.Itcanhandleannotatedbibliographies—annotationsareenteredinthe%X(abstract)field.Roffbibisashellscriptthatcallsrefer−B andnroff−mbib.Itusesthemacrodefinitionsthatresidein/usr/lib/tmac/tmac.bib,whichyoucan redefineifyouknownroffandtroff.Notethatreferwillprintthe%Hand%Ocommentaries,butwill ignoreabstractsinthe%Xfield;roffbibwillprintbothfields,unlessannotationsaresuppressedwiththe −xoption. Thefollowingcommandsequencewilllineprinttheentirebibliography,organizedalphabeticallyby authoranddate: %sortbibdatabase|roffbib|lpr Thisisagoodwaytoproofreadthebibliography,ortoproduceastand-alonebibliographyattheendofa paper.Incidentally,roffbibacceptsallflagsusedwithnroff.Forexample: %sortbibdatabase|roffbib−Tdtc−s1 willmakeaccentmarksworkonaDTCdaisy-wheelprinter,andstopatthebottomofeverypagefor changingpaper.The−nand−oflagsmayalsobequiteuseful,tostartpagenumberingataselected point,ortoproduceonlyspecificpages. Roffbibunderstandsfourcommand-linenumberregisters,whicharesomethinglikethetwo-letter numberregistersin−ms.The−rN1argumentwillnumberreferencesbeginningatone(1);useanother numbertostartsomewherebesidesone.The−rV2flagwilldouble-spacetheentirebibliography,while −rV1willdouble-spacethereferences,butsingle-spacetheannotationparagraphs.Finally,specifying −rL6ichangesthelinelengthfrom6.5inchesto6inches,andsaying−rO1isetsthepageoffsettoone inch,insteadofzero.(That’sacapitalOafter−r,notazero.) CitingPaperswithRefer Thereferprogramnormallycopiesinputtooutput,exceptwhenitencountersanitemoftheform: .[ partialcitation .] Thepartialcitationmaybejustanauthor’snameandadate,orperhapsatitleandakeyword,ormaybe justadocumentnumber.Referlooksupthecitationinthebibliographicdatabase,andtransformsit intoafull,properlyformattedreference.Ifthepartialcitationdoesnotcorrectlyidentifyasinglework (eitherfindingnothing,ormorethanonereference),adiagnosticmessageisgiven.Ifnothingisfound,it -4-willsay‘‘Nosuchpaper.’’Ifmorethanonereferenceisfound,itwillsay‘‘Toomanyhits.’’Otherdiag-nosticmessagescanbequitecryptic;ifyouareindoubt,usechecknrtoverifythatallyour.[’shave matching.]’s. Wheneverythinggoeswell,thereferencewillbebroughtinfromthedatabase,numbered,and placedatthebottomofthepage.Thiscitation,1forexample,wasproducedby: Thiscitation, .[ leskinvertedindexes .] forexample,wasproducedby The.[and.]markers,inessence,replacethe.FSand.FEofthe−msmacros,andalsoprovideanumberingmechanism.Footnotenumberswillbebracketedonthethelineprinter,butsuperscriptedondaisywheelterminalsandintroff.Inthereferenceitself,articleswillbequoted,andbooksandjournalswill beunderlinedinnroff,anditalicizedintroff. Sometimesyouneedtociteaspecificpagenumberalongwithmoregeneralbibliographicmaterial. Youmayhave,forinstance,asingledocumentthatyourefertoseveraltimes,eachtimegivingadifferent pagecitation.Thisishowyoucouldget‘‘p.10’’inthereference: .[ kiesdocumentformatting %P10 .] Thefirstline,apartialcitation,willfindthereferenceinyourbibliography.Thesecondlinewillinsert thepagenumberintothefinalcitation.Rangesofpagesmaybespecifiedas‘‘%P56-78’’. Whenthetimecomestorunoffapaper,youwillneedtohavetwofiles:thebibliographicdatabase, andthepapertoformat.Useacommandlinesomethinglikeoneofthese: %refer−pdatabasepaper|nroff−ms %refer−pdatabasepaper|tbl|nroff−ms %refer−pdatabasepaper|tbl|neqn|nroff−ms Ifotherpreprocessorsareused,refershouldprecedetbl,whichmustinturnprecedeeqnorneqn.The −poptionspecifiesa‘‘private’’database,whichmostbibliographiesare. Refer’sCommand-lineOptions Manypeopleliketoplacereferencesattheendofachapter,ratherthanatthebottomofthepage. The−eoptionwillaccumulatereferencesuntilamacrosequenceoftheform .[ $LIST$ .] isencountered(oruntiltheendoffile).Referwillthenwriteoutallreferencescollecteduptothat point,collapsingidenticalreferences.Warning:thereisalimit(currently200)onthenumberofreferences thatcanbeaccumulatedatonetime. Itisalsopossibletosortreferencesthatappearattheendoftext.The−sKEYSflagwillsortreferencesbyfieldswhosekey-lettersareintheKEYSstring,andpermutereferencenumbersinthetext accordingly.Itisunnecessarytouse−ewithit,since−simplies−e.Key-lettersinKEYSmaybefol-lowedbya‘+’toindicatethatallsuchfieldsaretobeused.Thedefaultistosortbyseniorauthorand date,but−sA+Dwillsortonallauthorsandthendate,and−sA+Twillsortbyauthorsandthentitle. 1MikeE.Lesk,‘‘SomeApplicationsofInvertedIndexesontheUnixSystem,’’UnixProgrammer’sManual,2a,Bell Laboratories,MurrayHill,NJ(1978).

-5-RefercanalsomakecitationsinwhatisknownastheSocialorNaturalSciencesformat.Insteadof numberingreferences,the−l(letterell)flagmakeslabelsfromtheseniorauthor’slastnameandtheyear ofpublication.Forexample,areferencetothepaperonInvertedIndexescitedabovemightappearas [Lesk1978a].Itispossibletocontrolthenumberofcharactersinthelastname,andthenumberofdigits inthedate.Forinstance,thecommandlineargument−l6,2mightproduceareferencesuchas [Kernig78c]. Somebibliographystandardsshunbothfootnotenumbersandlabelscomposedofauthoranddate, requiringsomekeywordtoidentifythereference.The−kflagindicatesthat,insteadofnumberingreferences,keylabelsspecifiedonthe%Llineshouldbeusedtomarkreferences. The−nflagmeanstonotsearchthedefaultreferencefile,locatedin/usr/dict/papers/Rv7man. Usingthisflagmaymakerefermarginallyfaster.The−anflagwillreversethefirstnauthornames, printingJones,J.A.insteadofJ.A.Jones.Often−a1isenough;thiswillreversethenamesofonlythe seniorauthor.Insomeversionsofreferthereisalsothe−fflagtosetthefootnotenumbertosomepredeterminedvalue;forexample,−f23wouldstartnumberingwithfootnote23. MakinganIndex Onceyourdatabaseislargeandrelativelystable,itisagoodideatomakeanindextoit,sothat referencescanbefoundquicklyandefficiently.Theindxbibprogrammakesaninvertedindextothebibliographicdatabase(thisprogramiscalledpubindexintheBellLabsmanual).Aninvertedindexcould becomparedtothethumbcutsofadictionary—insteadofgoingallthewaythroughyourbibliography, programscanmovetotheexactlocationwhereacitationisfound. Indxbibitselftakesawhiletorun,andyouwillneedsufficientdiskspacetostoretheindexes.But onceithasbeenrun,accesstimewillimprovedramatically.Furthermore,largedatabasesofseveralmillioncharacterscanbeindexedwithnoproblem.Theprogramisexceedinglysimpletouse: %indxbibdatabase Beawarethatchangingyourdatabasewillrequirethatyourunindxbiboveragain.Ifyoudon’t,you mayfailtofindareferencethatreallyisinthedatabase. Onceyouhavebuiltaninvertedindex,youcanuselookbibtofindreferencesinthedatabase. Lookbibcannotbeuseduntilyouhaverunindxbib.Wheneditingapaper,lookbibisveryusefulto makesurethatacitationcanbefoundasspecified.Ittakesoneargument,thenameofthebibliography, andthenreadspartialcitationsfromtheterminal,returningreferencesthatmatch,ornothingifnone match.Itspromptisthegreater-thansign. %lookbibdatabase >leskinvertedindexes %AMikeE.Lesk %TSomeApplicationsofInvertedIndexesontheUnixSystem %JUnixProgrammer’sManual %IBellLaboratories %CMurrayHill,NJ %D1978 %V2a %XDifficulttoreadpaperthatdwellsonindexingstrategies, givinglittlepracticaladviceaboutusing\fBrefer\fP. > Ifmorethanonereferencecomesback,youwillhavetogiveamoreprecisecitationforrefer.Experimentuntilyoufindsomethingthatworks;rememberthatitisharmlesstooverspecify.Togetoutofthe lookbibprogram,typeacontrol-Daloneonaline;lookbibthenexitswithan‘‘EOT’’message. Lookbibcanalsobeusedtoextractgroupsofrelatedcitations.Forexample,tofindallthepapers byBrianKernighanfoundinthesystemdatabase,andsendtheoutputtoafile,type:

-6- %lookbib/usr/dict/papers/Ind>kern.refs >kernighan >EOT %catkern.refs Yourfile,‘‘kern.refs’’,willbefullofreferences.Asimilarprocedurecanbeusedtopulloutallpapersof somedate,allpapersfromagivenjournal,allpaperscontainingacertaingroupofkeywords,etc. ReferBugsandSomeSolutions Thereferprogramwillmessupifthereareblanksattheendoflines,especiallythe%Aauthor line.Addbibcarefullyremovestrailingblanks,buttheymaycreepinagainduringediting.Useaneditorcommand—g/∗$/s///—toremovetrailingblanksfromyourbibliography. Havingbibliographicfieldspassedthroughasstringdefinitionsimpliesthatinterpolatedstrings (suchasaccentmarks)musthavetwobackslashes,sotheycanpassthroughcopymodeintact.For instance,theword‘‘te´ le´ phone’’wouldhavetoberepresented: te\\∗´ le\\∗´ phone inordertocomeoutcorrectly.Inthe%Xfield,bycontrast,youwillhavetousesinglebackslashes instead.Thisisbecausethe%Xfieldisnotpassedthroughasastring,butasthebodyofaparagraph macro. Anotherproblemarisesfromauthorswithforeignnames.Whenanamelike‘‘Vale´ ryGiscard d’Estaing’’isturnedaroundbythe−aoptionofrefer,itwillappearas‘‘d’Estaing,Vale´ ryGiscard,’’ ratherthanas‘‘Giscardd’Estaing,Vale´ ry.’’Topreventthis,enternamesasfollows: %AVale\\∗´ ryGiscard\0d’Estaing %AAlexanderCsoma\0de\0Ko\\∗:ro\\∗:s (ThesecondisthenameofafamousHungarianlinguist.)Thebackslash-zeroisannroff/troffrequest meaningtoinsertadigit-widthspace.Itwillprotectagainstfaultynamereversal,andalsoagainstmis-sorting. Footnotenumbersareplacedattheendofthelinebeforethe.[macro.Thislineshouldbealineof text,notamacro.Asanexample,ifthelinebeforethe.[isa.Rmacro,thenthe.Rwilleatthefootnote number.(The.Risan−msrequestmeaningchangetoRomanfont.)Incaseswherethefontneeds changing,itisnecessarytodothefollowing: \fIetal.\fR .[ awkahokernighanweinberger .] NowthereferencewillbetoAhoetal.2The\fIchangestoitalics,andthe\fRchangesbacktoRoman font.Boththeserequestsarenroff/troffrequests,notpartof−ms.Ifandwhenafootnotenumberis addedafterthissequence,itwillindeedappearintheoutput. InternalDetailsofRefer Youhavealreadyreadeverythingyouneedtoknowinordertousethereferbibliographysystem. Theremainingsectionsareprovidedonlyforextrainformation,andincaseyouneedtochangetheway referworks. Theoutputofreferisastreamofstringdefinitions,oneforeachfieldinareference.Tocreate stringnames,percentsignsaresimplychangedtoanopenbracket,andan[Fstringisadded,containing thefootnotenumber.The%X,%Yand%Zfieldsareignored;however,theannobibprogramchanges 2AlfredV.Aho,BrianW.Kernighan,andPeterJ.Weinberger,‘‘Awk—APatternScanningandProcessingLanguage,’’UnixProgrammer’sManual,2a,BellLaboratories,MurrayHill,NJ(1978).

-7-the%Xtoan.AP(annotationparagraph)macro.Thecitationusedaboveyieldsthisintermediateout-put: .ds[F1 .]- .ds[AMikeE.Lesk .ds[TSomeApplicationsofInvertedIndexesontheUnixSystem .ds[JUnixProgrammer’sManual .ds[IBellLaboratories .ds[CMurrayHill,NJ .ds[D1978 .ds[V2a .nr[T0 .nr[A0 .nr[O0 .][1journal-article Thesestringdefinitionsaresenttonroff,whichcanusethe−msmacrosdefinedin/usr/lib/mx/tmac.xref totakecareofformattingthingsproperly.Theinitializingmacro.]−precedesthestringdefinitions,and thelabeledmacro.][follows.Thesearechangedfromtheinput.[and.]sothatrunningafiletwice throughreferisharmless. The.][macro,usedtoprintthereference,isgivenatype-numberargument,whichisanumeric labelindicatingthetypeofreferenceinvolved.Hereisalistofthevariouskindsofreferences: FieldValueKindofReference %J1JournalArticle %B3ArticleinBook %R%G4Report,GovernmentReport %I2Book %M5BellLabsMemorandum(undefined) none0Other Theorderlistedaboveisindicativeoftheprecedenceofthevariousfields.Inotherwords,areference thathasboththe%Jand%Bfieldswillbeclassifiedasajournalarticle.Ifnoneofthefieldslistedispresent,thenthereferencewillbeclassifiedas‘‘other.’’ Thefootnotenumberisflaggedinthetextwiththefollowingsequence,wherenumberisthefootnote number: \*([.number\*(.] The\*([.and\*(.]standforbracketingorsuperscripting.Innroffwithlow-resolutiondevicessuchasthe lprandacrt,footnotenumberswillbebracketed.Introff,orondaisy-wheelprinters,footnotenumbers willbesuperscripted.Punctuationnormallycomesbeforethereferencenumber;thiscanbechangedby usingthe−P(postpunctuation)optionofrefer. Insomecases,itisnecessarytooverridecertainfieldsinareference.Forinstance,eachtimeawork iscited,youmaywanttospecifydifferentpagenumbers,andyoumaywanttochangecertainfields.This citationwillfindtheLeskreference,butwilladdspecificpagenumberstotheoutput,eventhoughno pagenumbersappearedintheoriginalreference.

-8- .[ leskinvertedindexes %P7-13 %IComputingServices %OUNX12.2.2. .] The%Ilinewillalsooverrideanypreviouspublisherinformation,andthe%Olinewillappendsomecommentary.Thereferprogramsimplyaddsthenew%P,%I,and%Ostringstotheoutput,andlater stringsdefinitionscancelearlierones. Itisalsopossibletoinsertanentirecitationthatdoesnotappearinthebibliographicdatabase. Thisreference,forexample,couldbeaddedasfollows: .[ %ABrianKernighan %TATroffTutorial %IBellLaboratories %D1978 .] Thiswillcauserefertointerpretthefieldsexactlyasgiven,withoutsearchingthebibliographicdatabase. Thispracticeisnotrecommended,however,becauseit’sbettertoaddnewreferencestothedatabase,so theycanbeusedagainlater. Ifyouwanttochangethewayfootnotenumbersareprinted,signalscanbegivenonthe.[and.] lines.Forexample,tosay‘‘Seereference(2),’’thecitationshouldappearas: Seereference .[( partialcitation .]), Notethatblanksaresignificantonthesesignallines.Ifapermanentchangeinthefootnoteformatis desired,it’sbesttoredefinethe[.and.]strings. ChangingtheReferMacros Thissectionisprovidedforthosewhowishtorewriteormodifytherefermacros.Thisisnecessary inordertomakeoutputcorrespondtospecificjournalrequirements,ordepartmentalstandards.First thereisanexplanationofhownewmacroscanbesubstitutedfortheoldones.Thenseveralalterations aregivenasexamples.Finally,thereisanannotatedcopyoftherefermacrosusedbyroffbib. Therefermacrosfornroff/troffsuppliedbythe−msmacropackageresidein /usr/lib/mx/tmac.xref;theyarereferencemacros,forproducingfootnotesorendnotes.Therefermacros usedbyroffbib,ontheotherhand,residein/usr/lib/tmac/tmac.bib;theyareforproducingastandalonebibliography. Tochangethemacrosusedbyroffbib,youwillneedtogetyourownversionofthisshellscriptinto thedirectorywhereyouareworking.Thesetwocommandswillgetyouacopyofroffbibandthemacros ituses:† %cp/usr/lib/tmac/tmac.bibbibmac Youcanproceedtochangebibmacasmuchasyoulike.Thenwhenyouuseroffbib,youshouldspecify yourownversionofthemacros,whichwillbesubstitutedforthenormalones %roffbib−mbibmacfilename wherefilenameisthenameofyourbibliographyfile.Makesurethere’saspacebetween−mandbibmac.

-9-Ifyouwanttomodifytherefermacrosforusewithnroffandthe−msmacros,youwillneedtoget acopyof‘‘tmac.xref’’: %cp/usr/lib/ms/s.refrefmac Thesemacrosaremuchlike‘‘bibmac’’,excepttheyhave.FSand.FErequests,tobeusedinconjunction withthe−msmacros,ratherthanindependentlydefined.XPand.APrequests.Nowyoucanputthis lineatthetopofthepapertobeformatted: .sorefmac Yournewrefermacroswilloverridethedefinitionspreviouslyreadinbythe−mspackage.Thismethod worksonlyif‘‘refmac’’isintheworkingdirectory. Supposeyoudidn’tlikethewaydatesareprinted,andwantedthemtobeparenthesized,withno commabefore.Therearefiveidenticallinesyouwillhavetochange.Thefirstlinebelowistheoldway, whilethesecondisthenewway: .if!"\\*([D"",\\*([D\c .if!"\\*([D""\&(\\*([D)\c Inthefirstline,thereisacommaandaspace,butnoparentheses.The‘‘\c’’attheendofeachlineindicatestonroffthatitshouldcontinue,leavingnoextraspaceintheoutput.The‘‘\&’’inthesecondline isthedo-nothingcharacter;whenfollowedbyaspace,aspaceissenttotheoutput. IfyouneedtoformatareferenceinthestylefavoredbytheModernLanguageAssociationor ChicagoUniversityPress,intheform(city:publisher,date),thenyouwillhavetochangethemiddleof thebookmacro[2asfollows: \&(\c .if!"\\*([C""\\*([C: \\*([I\c .if!"\\*([D"",\\*([D\c )\c Thiswouldprint(Berkeley:ComputingServices,1982)ifallthreestringswerepresent.Thefirstline printsaspaceandaparenthesis;thesecondprintsthecity(andacolon)ifpresent;thethirdalwaysprints thepublisher(booksmusthaveapublisher,orelsethey’reclassifiedasother);thefourthlineprintsa commaandthedateifpresent;andthefifthlineclosestheparentheses.Youwouldneedtomakesimilar changestotheothermacrosaswell. Acknowledgements MikeLeskofBellLaboratorieswrotetheoriginalrefersoftware,includingtheindexingprograms. AlStangenbergeroftheForestryDepartmentwrotethefirstversionofaddbib,thencalledbibin.Greg ShenautoftheLinguisticsDepartmentwrotetheoriginalversionsofsortbibandroffbib.Allthesecontributionsaregreatlyappreciated.

-i-TableofContents Introduction............................1 DataEntrywithAddbib.......................2 PrintingtheBibliography.......................3 CitingPaperswithRefer.......................3 Refer’sCommand-lineOptions.....................4 MakinganIndex..........................5 ReferBugsandSomeSolutions.....................6 InternalDetailsofRefer........................6 ChangingtheReferMacros.......................8 Acknowledgements.........................9 CommentedReferMacros.......................10