<<

BibTEX yesterday, today, and tomorrow

Oren Patashnik San Diego, CA

Abstract This paper looks back at the last 20 years of BibTEX, and also looks ahead, if not to the next 20 years, then at least to BibTEX 1.0.

Introduction For example in a file mybib.bib (database file names end with .bib) you might have an entry like: BibTEX is the bibliography program designed origi- nally to accompany ’s LATEX; it now @BOOK{knuth:, works with other incarnations of TEX, too. BibTEX author = "Donald E. Knuth", removes the tedium, and adds some flexibility, in title = "The {\TeX}book", producing a reference list.1 When BibTEX creates publisher = "Addison-Wesley", your reference list, it’s BibTEX, not you, minding year = "1984", the minutiae like ensuring that your reference-list } entries are in the correct order, that every comma The @BOOK tells BibTEX the entry type. (The bibli- is in place, and that the information is formatted ography style will instruct BibTEX on how to format consistently across entries. Furthermore, a single, a BOOK entry type.) The knuth:tex is the database simple, change of bibliography-style name lets you key, which is a sequence of characters to be used as convert your reference list from style A, which might the symbolic name for this entry. And the rest of order the entries alphabetically, and spell out jour- the entry comprises four hfieldi = hfield-valuei pairs nal names in full, and list all authors as first-name appropriate for a BOOK entry type. In general you then last-name, to a completely different style B, will have many such entries in a database file; you which might order the entries according to their or- might also have multiple database files. der of mention in the text, and abbreviate journal And in your (LA)TEX source file you might have names, and invert just the first author’s first and a like last names. ... in the \TeX{}book~\cite{knuth:tex} ... This paper is an updated version of a paper [7] The \cite command’s argument knuth:tex, called from the 1994 TUG meeting in Santa Barbara. It a cite key, must match the corresponding database gives: a history of BibTEX to the present; the gen- key. (LA)TEX might typeset this \cite command as eral goals for BibTEX 1.0, which will be the frozen . . . in the T Xbook [41] . . . version of BibTEX (just as TEX 3 is the frozen ver- E sion of TEX); some specific new features for achiev- or ing those goals; and the plan for releases of BibTEX . . . in the TEXbook41 ... leading up to BibTEX 1.0. Before all that, however, or primarily for those who are unfamiliar with BibTEX, comes a section that explains its rudiments. . . . in the TEXbook (Knuth, 1984) . . . depending on the citation style. LATEX’s default ci- Using BIBTEX tation style uses a number in brackets, and for that citation style, together with an appropriate bibliog- To use BibT X, you’ll have your bibliographic in- E raphy style, the corresponding reference-list entry formation in a bibliography database, and, to make might look like: use of that information, a few (LA)TEX2 commands 41. Donald E. Knuth. The T Xbook. Addison- sprinkled throughout your (LA)TEX source file. E Wesley, 1984. 1 Throughout this paper, the term ‘reference list’ is used Besides the \cite commands, your (LA)TEX source generally to to what might also be called a ‘bibliography’ file will also have two BibTEX-related commands: or a ‘list of sources’ or anything similar. 2 The term ‘(LA)TEX’ is used to mean either LATEX or plain \bibliography{mybib} (or other variations of) TEX. \bibliographystyle{plain}

TUGboat, Volume 24 (2003), No. 1 — Proceedings of the 2003 Annual Meeting 25 Oren Patashnik

.aux .bst .bib The \bibliography command does two things: It tells (LA)T X to put the reference list at that spot in @ E @ your document, and it tells BibTEX which file(s) to @R ? © use for the bibliographic database, here just the sin- BibTEX gle file mybib.bib. The \bibliographystyle com- ¡ A ¡ A mand tells (LA)TEX nothing, but tells BibTEX which ¡ AU bibliography style to use, here the standard style .bbl .blg plain; bibliography style file names end with .bst, thus the relevant file is plain.bst in this case. Figure 1: BibTEX’s input and output files. So with your database file(s) and your (LA)TEX source file structured appropriately, your \bibliographystyle{plain} are formatted according to the citation style, and \bye your reference list is formatted according to the bib- liography style. To run mypaper2 through TEX and BibTEX: To actually produce the typeset document, you tex mypaper2 run (LA)TEX, BibTEX, (LA)TEX, (LA)TEX. The first bibtex mypaper2 tex mypaper2 (LA)TEX run writes, to an .aux file, information for tex mypaper2 use by BibTEX — which bibliography style to use, which database file(s) to use, and which database The file btxmac.tex, which mypaper2.tex \inputs, entries to include. The BibTEX run reads all that contains the macros that make BibTEX work with information from the .aux file, reads the specified plain TEX. Those macros are a standard part of database (.bib) file(s), formats the reference list ac- most TEX distributions, but if they’re not a part of cording to the instructions in the bibliography style yours, you’ll have to go fetch a copy. (.bst) file, and writes its output onto a .bbl file. That’s a brief introduction to BibTEX. The fol- The next (LA)TEX run reads the .bbl file and incor- lowing sources provide further details. Leslie Lam- porates the reference list into the document. The port’s LATEX manual [4] explains how to use BibTEX final (LA)TEX run fixes the references into the refer- with LATEX. In particular, section B.1 describes the ence list. Figure 1 shows the files that BibTEX uses. .bib-file format in detail. The file btxmac.tex [1] The .blg file is BibTEX’s log file, in which BibTEX documents its own use, with or without Karl Berry’s records any warning or error messages. eplain.tex package (for which the btxmac macros To try using BibTEX with LATEX, put the six- were originally written). The “BibTEXing” docu- line BOOK entry shown on the previous page into a ment [5], which is distributed along with BibTEX file called mybib.bib, and then, into a file called itself, contains further hints for BibTEX users. The mypaper1.tex, put these six lines of LATEX: “Designing BibTEX Styles” document [6], also dis- \documentclass{article} tributed with BibTEX, explains the postfix stack- \begin{document} based language used to write BibTEX bibliography The \TeX{}book~\cite{knuth:tex} is good. styles (.bst) files. The LATEX Companion (2nd edi- \bibliography{mybib} tion) [2], by Michel Goossens, Frank Mittelbach, \bibliographystyle{plain} et al., and Guide to LATEX [3], by Helmut Kopka and \end{document} Patrick W. Daly, summarize much of the informa- Exactly how you run LATEX and BibTEX is system tion in the sources above, and describe some of the dependent; on my system I issue four commands: tools available for helping with BibTEX. BibTEX’s standard bibliography styles, like , are based mypaper1 plain bibtex mypaper1 on Mary-Claire van Leunen’s A Handbook for Schol- latex mypaper1 ars [9]. That book is worthwhile reading for anyone latex mypaper1 wanting to design a bibliography style from scratch. To try using BibTEX with plain TEX, create the file History mybib.bib as above, and then put into a file called mypaper2.tex these seven lines of plain TEX: Leslie Lamport patterned LATEX after a document \input btxmac production system called Scribe [8], written by Brian The \TeX{}book~\cite{knuth:tex} is good. Reid in the late 1970s at Carnegie-Mellon Univer- \medskip sity. One of Scribe’s basic tenets was that, to the \leftline{\bf References} extent possible with a computer program, writers \bibliography{mybib} should be allowed to concentrate on content rather

26 TUGboat, Volume 24 (2003), No. 1 — Proceedings of the 2003 Annual Meeting BibTEX yesterday, today, and tomorrow than on formatting details. Or, as Reid so amusingly But back to 1983. Over the course of the next put it:3 year and a half I implemented Lamport’s basic de- Not everyone should be a typesetter. sign, with a few enhancements. The first working version of BibT X (0.41) trudged forth in the sum- I think of LAT X as a fairly successful Scribification E E mer of 1984. Lamport wrote, and Howard Trickey of T X—LAT X is almost as easy to use as Scribe E E modified, a bibliography style based on Mary-Claire yet almost as powerful as T X. E van Leunen’s suggestions in her Handbook for Schol- In any case, Scribe had become popular in cer- ars [9]. Trickey’s modified version was to become tain academic circles, and Lamport decided that, to btxbst.doc, the template for BibTEX’s four stan- make it easy for Scribe users to convert to LATEX, he dard styles plain, abbrv, alpha, and unsrt. (By would adopt Scribe’s bibliography scheme in LAT X. E the way, these are called “standard” styles not be- But T X macros alone were insufficient in practice E cause they are supposed to be some sort of stan- to do all the things, like alphabetizing, that a bib- dard, but because they are in the standard release liography processor needs to do; he decided instead of T X.) to have a separate bibliography program. That pro- Bib E The first public release of T X, in March gram would manipulate the bibliographic informa- Bib E 1985, was version 0.98, for LAT X version 2.08. Sev- tion in Scribe-like database files according to the E eral upgrades, including one for LAT X 2.09, followed instructions programmed in a special-purpose style E later that year. Version 0.99, which added many language. The postfix stack-based language he had new features, was released in January 1988; two mi- in mind was to be powerful enough to program many nor upgrades followed the next month, but T X different bibliography styles. Bib E itself has remained unchanged since then. The stan- My own work on BibT X started in February E dard styles have been unchanged since March 1988. 1983. Just for the fun of it, I went back and dug up In 1990 Karl Berry wrote some macros, for use the original email: in his eplain.tex package, that made BibTEX us- 15-Feb-83 0908 able with plain (and other versions of) TEX. He To: OP@SU-AI, tex82@SRI-CSL and I modified the macros and released them as Oren, btxmac.tex in August 1990, usable with or with- Leslie Lamport is working on a new out the eplain package. Several upgrades followed, macro package for TeX82, and needs the last in March 1995. someone to write a support program The current versions are: 0.99c for BibTEX it- or two. We are volunteering you. His self; 0.99b for btxbst.doc (the standard styles’ tem- address is TEX82@SRI-CSL. Why don’t plate file — but version 0.99a for each of the four you get in contact with him, and see standard styles); and 0.99k for btxmac.tex. whether his requirements are within That’s for the software I’ve worked on. There the scope of what you’re willing to do. has, in addition, been work that others have done This was described as a “three-week project”, and to support BibTEX, especially in the last decade: the first time I gave this talk, at Santa Barbara • software for the handling of database ( ) in 1994, I compared the “three-week project” to .bib files (my personal database-handling preference the “three-hour tour” of the 1960’s American televi- is the text editor ’s T X mode, but I sion series Gilligan’s Island, in which an afternoon’s Bib E don’t recommend that others join the Emacs harbor cruise became a shipwreck adventure lasting religion just for that); years. (Many of us at that TUG conference really did go on a three-hour harbor cruise.) • the amassing of many database files for public This year’s meeting was on the Big Island of consumption, minimizing the amount of work it Hawaii, though, and it struck me that there’s an takes to create new entries (Nelson Beebe has even better metaphor for my work on BibTEX than been particularly prolific in that regard); the Gilligan’s Island adventure: I started working on BibTEX, it turns out, within days of when the • software for generating new bibliography styles current eruptive phase of Kilauea began, in early automatically, without having to know details 1983. And a volcano aptly describes my work on of the somewhat arcane .bst bibliography-style BibTEX — a burst of activity, followed by a dormant language (Patrick Daly’s custom-bib/makebst stretch. (2004 will be more active than dormant.) package has gotten widespread use — more on this later). 3 — to a Bell Labs Computer Science Colloquium audi- ence that included some troff true believers That brings us up to date.

TUGboat, Volume 24 (2003), No. 1 — Proceedings of the 2003 Annual Meeting 27 Oren Patashnik

Goals bibliography-style customization

BibTEX has been very stable for some time now. ? Software stability is nice; it helps others build tools .aux .bst .bib that augment the software. As suggested above, @ many tools have grown up around BibTEX. The @ A @R ? © popularity of (L )TEX, however, has taken BibTEX BibT X into places not anticipated, necessitating changes. E ¡ A Here are some general goals for BibTEX 1.0: ¡ ¡ AAU • Easier nonstandard styles: The most frequent .bbl .blg requests I see are for new bibliography styles. Creating a new bibliography style generally en- Figure 2: BibTEX 1.0 input and output files. tails programming in the .bst language, which, for most users, is not an easy task. Patrick Daly’s custom-bib/makebst package has made done with the custom-bib/makebst package. it reasonably easy for ordinary user to create So he and I have decided to collaborate for new bibliography styles; for BibTEX 1.0 the sit- BibTEX 1.0 on a system that will include the uation will improve even more. options of his current code, along with some • More international: BibTEX has spread to the things planned for the Bibsty program. This non-English-speaking world. BibTEX 1.0 will system will have, among other options, an eas- address associated issues. ily changed symbolic name for each string that • More fields of study: The original BibTEX users a bibliography style outputs to the .bbl file were from the technical world of mathematics directly (such as ‘editor’ or ‘volume’), making and computer science. The BibTEX 1.0 stan- it easier to, for example, convert bibliography dard styles will do more to accommodate those styles from one language to another. Figure 2 in other fields, like the humanities. shows how the new style customization system • Enhanced sharing capabilities: There now ex- will fit into the scheme. ist huge -file bibliographic databases, some .bib • Eight-bit input: Most current BibTEX imple- available to users world wide. T X 1.0 will Bib E mentations can handle 8-bit input; BibTEX 1.0 make the sharing of those databases easier. will guarantee, at a minimum, to support the • Better documentation: The BibTEX 1.0 docu- character-set conventions of TEX 3. In addi- mentation will be more extensive. tion, BibTEX 1.0 may be able to accommodate • FroZEN: For even better stability, BibTEX 1.0 . will be frozen. As with T X 3.0, it will be up- E • Multiple bibliographies within a single docu- graded for bug fixes only. ment: Many large documents contain several Some of the features planned for implementing those bibliographies — one bibliography per chapter goals appear in the next section. for a book, or one per paper for a conference New features proceedings. Several solutions have arisen for handling such situations, but BibTEX 1.0 will Over the years I have accumulated a list of new fea- support multiple bibliographies directly. tures and probable changes for BibTEX 1.0 and its standard styles. The list below is certainly not ex- • Enhanced sorting: The current BibTEX does haustive, but it contains the most important items. well with English, but doesn’t gracefully han- Each one listed has a high probability of existing in dle certain unusual sorting conventions of other languages, like Hungarian; BibT X 1.0 will have BibTEX 1.0. E more powerful sorting capabilities for handling • Software for generating customized bibliogra- them. phy style (.bst) files: In Santa Barbara I had claimed that there would be a Bibsty program • Reference-list back pointers: BibTEX 1.0 will to do that, similar in spirit to the processing provide a direct mechanism for indicating in a that creates the four standard styles from the reference-list entry where in the text that entry current template file btxbst.doc, but with lots was cited. This is a useful feature that I sus- more options. That Bibsty program, however, pect will become widespread now that our new would partly duplicate what Patrick Daly has technology makes it painless.

28 TUGboat, Volume 24 (2003), No. 1 — Proceedings of the 2003 Annual Meeting BibTEX yesterday, today, and tomorrow

• An @ALIAS command: Suppose you have an en- • Name handling: BibTEX 1.0 will have enhanced try in a database file that uses a different data- (but upward compatible) name processing, for base key, say knuth:tex, from the cite key you example for complicated Spanish surnames, and prefer, say texbook; this might happen, for ex- for inverted-order Asian names. ample, if that entry is in a shared database file. • Standard-style changes: There will be lots of With BibT X 1.0 you will be able to keep the E additions to the BibT X 1.0 standard styles, cite key and database key as is, as long as you E allowing many more options. put a command like • New fields: The standard styles will also include @ALIAS{texbook = knuth:tex} a bunch of fields that are not now a part of somewhere in your database. the standard styles, including day, isbn, issn, keywords, eprint, translator, and url. • A @MODIFY command: With BibTEX 1.0 you will be able to create a slightly altered version of • New entry types: There will also be a few new an entry. For example, you might want to add entry types, including @PERIODICAL and per- a note field to an entry in a public database file haps @PATENT. without having to repeat in your own personal database file all the information in that entry: • .bst-language changes: There will be a few mi- nor (but compatible) changes to the .bst lan- @MODIFY{laws-of-the-game, guage. note = "Law~8 discusses restarts", } • btxmac.tex update: These macros will be up- dated so that the user interfaces to BibTEX 1.0 The @MODIFY command’s database key should from LATEX and plain TEX are as similar as pos- match the one from the public database. sible. • Distinguishing among identical database keys: • Documentation: The “BibTEXing” and “De- If you are using two different database files that signing BibTEX Styles” documents [5, 6] cur- happen to use the same database key for differ- rently distributed with BibTEX are neither as ent entries, you will be able to specify which widely known nor as complete as they could be. entry you want by using a citation of the form For BibTEX 1.0, the main documentation will \cite{filename::database-key} be in a book, and will be much more thorough. Among other things, it will include a .bib-file • A .bib-file extraction mode: BibTEX 1.0 will grammar, so that those who are writing tools have a mode that will let you extract just the to manipulate the database files can make their information you need into a small .bib file. For software more robust. example if you are submitting a paper to a jour- nal that wants a .bib file in addition to a .tex Planned releases file, but the bibliographic database you are us- ing for the paper is huge, you can use the ex- 2004 will see the release of an updated version of traction mode to put just the entries you need the btxmac.tex macros. Probably toward the end for the paper into a separate .bib file that you of the year will come a bug-fix version of BibTEX can then send to the journal. 0.99. (There are just a handful of actual bugs to BibTEX itself, the most annoying being its mishan- • A \bibtexoptions (LA)TEX command: Com- dling of URLs, which didn’t even exist when the cur- munication from (LA)TEX to BibTEX 1.0 will rent T X was released.) improve with this command. Bib E There will be several beta releases of BibTEX • Extensions to the \cite command: Many ci- and its standard styles, leading up to 1.0; eventually tation styles aren’t handled very gracefully by one of those beta releases will be declared to be 1.0 (LA)TEX’s current \cite command. BibTEX 1.0 and frozen. and (LA)T X will more directly support more E Until BibTEX 1.0 is finished, I will skim the flexible \cite commands. comp.text.tex newsgroup for BibTEX-related post- • Also appeared as: Sometimes a work appears ings, so it suffices to post there anything you think in two different forms, for example as a journal I should see. In general that’s a good place to post article and then later in the author’s collected questions about BibTEX — usually someone posts works. BibTEX 1.0 will have a mechanism to a useful reply. (Occasionally I’ll reply by private handle this. email.)

TUGboat, Volume 24 (2003), No. 1 — Proceedings of the 2003 Annual Meeting 29 Oren Patashnik

References [6] Oren Patashnik. Designing BibTEX styles. Doc- umentation for BibT X style designers, con- [1] Karl Berry and Oren Patashnik. btxmac.tex. E tained in the file btxhak.tex, 8 February 1988. Macros to make BibTEX work with plain TEX; current version 0.99k, 13 November 1995. [7] Oren Patashnik. BibTEX 1.0. TUGboat, 15:269– 273, 1994. [2] Michel Goossens and Frank Mittelbach, with Jo- hannes Braams, David Carlisle, and Chris Row- [8] Unilogic, Ltd., Pittsburgh. Scribe Document Production System User Manual, fourth edition, ley. The LATEX Companion. Addison-Wesley, 2nd edition, 2004. April 1984. Chapter 12 and appendices E8 through E10 deal with bibliographies. [3] Helmut Kopka and Patrick W. Daly. Guide to [9] Mary-Claire van Leunen. A Handbook for Schol- LATEX. Addison-Wesley, fourth edition, 2003. ars. Oxford University Press, revised edition, [4] Leslie Lamport. LAT X: A Document Prepara- E 1992. tion System. Addison-Wesley, second edition, 1994. [5] Oren Patashnik. BibTEXing. General documen- tation for BibTEX users, contained in the file btxdoc.tex, 8 February 1988.

30 TUGboat, Volume 24 (2003), No. 1 — Proceedings of the 2003 Annual Meeting