Anda di halaman 1dari 13

36

TUGboat, Volume 30 (2009), No. 1 Multiple citations can be added by separating with a comma the bibliographic keys inside the same \cite command; for example
\cite{Goossens1995,Kopka1995}

Bibliographies
A Managing bibliographies with L TEX Lapo F. Mori

gives
(Goossens et al., 1995; Kopka and Daly, 1995)

Abstract The bibliography is a fundamental part of most scientic publications. This article presents and analyzes A the main tools that L TEX oers to create, manage, and customize both the references in the text and the list of references at the end of the document. 1 Introduction

Bibliographic entries that are not cited in the text can be added to the bibliography with the \nocite{key} command. The \nocite{*} command adds all entries to the bibliography. Automatic creation with BibTEX A BibTEX is a separate program from L TEX that allows creating a bibliography from an external database (.bib le). These databases can be conveniently A shared by dierent L TEX documents. BibTEX, which will be described in the following paragraphs, has many advantages over the thebibliography environment; in particular, automatic formatting and ordering of the bibliographic entries. 2.2.1 How BibTEX works BibTEX requires: 1. one or more bibliographic databases .bib; 2. a bibliographic style .bst; 3. that the .tex le contains: commands that specify what style .bst and database .bib to use, and citations in the text with the \cite and similar commands, as in:
\documentclass{...} ... \begin{document} See \citet{Kopka1995}. .. \bibliographystyle{plainnat} \bibliography{database} \end{document}

2.2

Bibliographic references are an important, sometimes fundamental, part of academic documents. In the past, preparation of a bibliography was dicult and tedious mainly because the entries were numbered A and ordered by hand. L TEX, which was developed with this kind of document in mind, provides many tools to automatically manage the bibliography and make the authors work easier. How to create a A bibliography with L TEX is described in section 2, starting from the basics and arriving at advanced customization. Bibliographic styles for both the list of references and in-text-citations are analyzed in section 3. The last two sections (4 and 5) analyze two of the most powerful packages available: natbib A and BibL TEX. 2
A Bibliography with L TEX

There are two main ways to compose a bibliography A with L TEX: automatically with the BibTEX program that uses external bibliographic databases (section 2.2), or manually with the thebibliography environment that allows to include all the bibliographic information in the source .tex le (section 2.3). Regardless from the strategy chosen, citations can be added to the text with the same commands, as shown in section 2.1. 2.1 References in the text

4. that the document is compiled in the following order (lets assume that the principal le is called document.tex):
latex document bibtex document latex document latex document
A The rst time L TEX runs, the \bibliographystyle command writes the name of the style .bst to be used into the .aux le, each \cite command writes a note into the .aux le, and the \bibliography command writes into the .aux le the name of the A .bib database(s) to be used. At this stage L TEX does not substitute the \cite in the text: the .dvi

Citations can be added to the text with the command \cite{key} (and its variants), where key corresponds to the citekey eld in the .bib le (if using BibTEX, section 2.2) or the key of \bibitem (if using the thebibliography environment, section 2.3). When compiling the source, \cite{key} is linked to the respective \bibitem and substituted by the appropriate reference (numbered, author-year, or footnote depending on the style chosen). Lapo F. Mori

TUGboat, Volume 30 (2009), No. 1


tex log
A L TEX 2

37
bst

sty aux

bib BibTEX bbl

blg

Rules for using BibTEX The syntax of BibTEX entries is very intuitive. The following paragraphs will discuss the most common rules, all the details can be found in Patashnik (1998). Capital letters. The BibTEX styles control capital and lower case letters, especially for the titles. This behavior is very convenient because it ensures a uniform format for the entries but could cause problems in some specic situations such as acronyms, chemical formul, etc. In these cases the user needs to enclose in braces the letters whose capitalizations should not be changed by BibTEX, as in the following example for CO:
title = {{CO} pollution},

2.2.3

pdf

dvi

A Figure 1: Data ow between L TEX and BibTEX to create a .pdf or a .dvi ( ) from the data les .tex and .bib ( ) and the style les .sty and .bst ( ).

shows question marks for every \cite and the .log le reports warnings for unknown references. BibTEX will then read the .aux le, the bibliographic style .bst and .bib database(s) specied. For every \cite entry, it will read the information contained in the .bib les and format it according to the style .bst. At the end it will order the entries according to the style .bst and will write the result into the .bbl le. The .bbl contains the bibliographic entries organized in a thebibliography environment; the entries follow the format specied by the .bst style and have the information contained in the .bib database. This le will be read every time that the source .tex le is compiled. A When running L TEX again, it will produce a warning due to the fact that the references are not dened yet and will substitute the \bibliography command with the content of the .bbl le. It will also write a note into the .aux le for every \bibitem. A At the next run, L TEX will nd the denition for every \cite in the .aux le and all the citations in the text will be resolved. The .blg le is a log le created by BibTEX, similar to the .log le for A L TEX. This ow, represented in Fig. 1, has to be repeated if the citations in the text, the .bib database or the .bst style are modied. 2.2.2 Structure of a bibliography database

The .bst style can be used to automatically change the capitalization behavior for titles (e.g. title style or sentence style) instead of manually enclosing all the titles in braces. Commands. Since BibTEX modies the capitalA ization depending on the .bst style, some L TEX commands inside titles may not work. For example, if the sentence style is in use and one of the titles contains the command \LaTeX, this will be converted to \latex and will give the following error:
! Undefined control sequence.

This also can be avoided by enclosing such commands in braces: {\LaTeX}. Accents and special characters. A similar problem arises with the commands for accents and special characters such as (\"{o}), (\c{c}), (\~{n}), etc. Again, enclosing the command in braces solves the issue:
title = {Writing the curriculum vit{\ae}},

The .bib les are databases that store the information for each bibliographic entry. Here is an example:
@BOOK{Kopka1995, title = {A Guide to {\LaTeX} -- Document Preparation for Beginners and Advanced Users }, publisher = {Addison-Wesley}, year = {1995}, author = {H. Kopka and P. W. Daly}, }

Name lists. When more than one name is present in the author or editor elds, they have to be separated by and (a space before and after):
author = {Author1 and Author2},

Each name has four parts: Name, von, Surname, Jr. The surname is mandatory, all other parts are optional. BibTEX accepts two dierent syntaxes for names: Name von Surname: for example Pico della Mirandola has to be written as Pico della Mirandola. von Surname, Jr, Name: for example Pico della Mirandola II has to be written as della Mirandola, II, Pico.
A Managing bibliographies with L TEX

Each type of entry (BOOK, ARTICLE, PROCEEDINGS, etc.) oers many elds in addition to those shown in the example (title, publisher, year, author). Further details can be found in Patashnik (1998).

38 The second form is more general because the rst one cannot be used when the Jr eld is present or when the surname contains more than one word and the von part is not present. The .bst style takes care of abbreviating (or not) names. If the author wants to use abbreviated names, the .bib database can also have abbreviated names. For example:
author = {Mori, L. F.},

TUGboat, Volume 30 (2009), No. 1 2.2.4 Creating and managing bibliography databases

If the list of authors or editors is too long, it can be ended by and others that will then be formatted by the style as et al.
author = {Conte, G. B. and Pianezzolla, E. and Chiesa, P. and Rossi, G. and others},

URL. The standard BibTEX styles do not provide a eld for web addresses. A solution with these styles is to use the howpublished eld:
@MISC{..., ..., howpublished = {\url{http://...}}, }

As should be clear from the example in section 2.2, the .bib le syntax is so intuitive that these les can be easily written with any text editor. Several programs, however, are dedicated to the creation and management of .bib databases, such as BibTeXMng3 (shareware for Windows), BibDesk4 (opensource for Mac OS X), KBibTeX5 (open-source for Linux), Pybliographer6 (open-source for Linux), bibliographer7 (freeware for Linux), Bibwiki8 (Internet based), cb2Bib9 (freeware for Windows and Linux), Zotero10 (open-source multi-platform plugin for Firefox), and JabRef 11 (multi-platform open-source). The last three programs are particularly interesting and will be discussed in the next paragraphs. cb2Bib. cb2bib (which stands for clipboard to BibTEX) is a program for extracting bibliographic information from unformatted sources such as .pdf les, web sites, and email. cb2bib reads the content of the clipboard and process it according to predened patterns.12 If no predened format pattern is found, cb2bib can still be used for manual data extraction. Zotero. Zotero is an open-source multi-platform (Windows, Linux, and Mac OS X) Firefox13 plugin that allows to gather, manage, and analyze bibliographic references. Being an extension of a web browser, Zotero is particularly useful for extracting bibliographic data from the Internet. The reference database can be exported as a .pdf le,14 a text le, a BibTEX database, and several other formats.
http://www.latexsoft.com/bibtexmng.htm http://bibdesk.sourceforge.net/ 5 http://www.unix-ag.uni-kl.de/~fischer/kbibtex/ 6 http://www.pybliographer.org/Welcome/ 7 http://bibliographer.homelinux.net/ 8 http://wolfgang.plaschg.net/bibwiki/ 9 http://www.molspaces.com/d_cb2bib-overview.php 10 http://www.zotero.org/ 11 http://jabref.sourceforge.net/ 12 cb2bib implements patterns to extract data from the following formats: PNAS Table of Contents Alert (http: //www.pnas.org/), ISI Web of Knowledge Table of Contents Alert (http://isiknowledge.com/), Wiley InterScience Journal Abstracts (http://www.interscience.wiley.com/), American Chemical Society Publications (http://pubs.acs. org/), ScienceDirect (http://www.sciencedirect.com/), Digital Bibliography & Library Project (http://dblp.uni-trier. de/), Nature from First Paragraph (http://www.nature.com/ nature/), IOP Electronic Journals (http://www.iop.org/ EJ/), JSTOR (http://www.jstor.org/), ISI Reference Format (http://scientific.thomson.com/isi/), RIS Reference Format. 13 http://www.mozilla.com/firefox/ 14 The list in the .pdf le is formatted according to predened styles that can be selected by the user.
4 3

A better solution is to use styles that provide the url eld, such as plainnat and abbrevnat that come with the natbib package (section 4) or those that come with the babelbib package (section 2.7.3). Moreover, the url eld is also provided by the custom styles created with makebst (section 3.2.2). In all these cases, the syntax is:
@ARTICLE{..., ..., url = {http://...}, }

Problems might arise when a web site address is long and close to the write margin. When the A document is compiled with pdfL TEX, the driver can break the links over several lines. On the other hand, when the document is compiled with the dvips driver A (L TEX .dvi PostScript .pdf), the breakurl1 package must be loaded to support breaking links into several parts while retaining the hyperlink. Months. BibTEX provides macros to automatically manage the month name specied with the month eld; these macros automatically manage the full form (March) and abbreviated form (Mar.) and the language (Marzo) depending on the .bst style in use. In order to take advantage of these macros, the month has to be written in the abbreviated English form.2
1 The breakurl package was written by Vilar Camara Neto and the last version was released in 2009. 2 The abbreviated English form consists in the rst three letters of the month: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec.

Lapo F. Mori

TUGboat, Volume 30 (2009), No. 1 Zotero can be used together with WYSIWYG15 software such as Microsoft Word16 and OpenOce.17 Zotero can also perform advanced searches in its libraries and import entries from several formats. A unique feature of Zotero is the ability to create online libraries that can be used from dierent computers over the Internet. JabRef. JabRef is an open-source multi-platform (Windows, Linux, and Mac OS X) software written in Java for creating and managing bibliographic databases in the BibTEX format. Entries can be created by editor panels whose elds depend on the type of entry (book, article, proceedings, etc.); these panels can also be customized by adding or removing elds. JabRef can be used to search articles on Medline18 and Citeseer19 and to import bibliographic entries from several formats such as BibTEXML, CSA, Refer/Endnote, ISI Web of Science, SilverPlatter, Medline/Pubmed (XML), Scinder, OVID, INSPEC, Biblioscape, Sixpack, JSTOR and RIS. JabRef oers advanced search and management based on keywords. Databases can be printed or exported in HTML, Refer/Endnote, Docbook, BibTEXML, MODS, RTF, and OpenOce. JabRef can automatically create the BibTEX keys (for example by taking the rst authors surname and the publication year) and insert the citations into several text editors such as LyX, Kile, and WinEdt. JabRef can associate a .pdf le to every entry and open it with external software. It can also associate a url or a DOI;20 in both cases, JabRef can open a web browser on the corresponding page. Bibliography resources on the Internet. Several web sites, both of journals and of bibliographic databases, can be used to export entries directly in the BibTEX format. Some of the journals are ACM,21 Science,22 PNAS,23 and The Journal of Chemical Physics.24 Some of the databases are Lead2Amazon25 (a web site that uses Amazon.com, .ca, .co.uk, .de, .fr, .co.jp to automatically generate BibTEX entries),
Acronym for What You See Is What You Get. 16 http://office.microsoft.com/ 17 http://www.openoffice.org/ 18 http://www.ncbi.nlm.nih.gov/sites/entrez 19 http://citeseer.ist.psu.edu/ 20 DOI is the acronym for Digital Object Identier and represents the future for references to electronic publications. Unlike an url, a DOI is associated with an object (scientic article) and not to the place where it is stored (web site). This guarantees a longer longevity of the link. More information can be found at http://www.doi.org/. 21 http://portal.acm.org/ 22 http://www.sciencemag.org/ 23 http://www.pnas.org/ 24 http://jcp.aip.org/ 25 http://keijisaito.info/lead2amazon/e/
15

39 Google Scholar26 (Google search engine dedicated to scientic publications; select BibTEX in Scholar Preferences), BibSonomy27 (web site to share links to publications), CiteSeer28 (search engine and digital library for scientic articles), CiteULike29 (web site to share links to publications), The Collection of Computer Science Bibliographies30 (computer science bibliographic database with more than two million entries), HubMed31 (alternative interface to PubMed32 that can export entries in BibTEX format), TEXMed33 (another alternative interface to PubMed that can export entries in BibTEX). 2.3 Manual composition: thebibliography

The thebibliography environment must be placed in the source document where the author wants the list of references to appear, typically just before \end{document}.
\documentclass{...} \begin{document} ... \begin{thebibliography}{argument} ... \end{thebibliography} \end{document}

The argument of thebibliography denes the maximum length of the labels. If the labels are automatA ically generated by L TEX, usually the argument is chosen as 9, if the list contains less than ten entries, 99, if less than one hundred, etc. When using customized labels (e.g.: [Mori 06]) the argument must be the widest label. The thebibliography environment works in a very similar way to the itemize environment. Each entry of the list begins with the \bibitem command and its argument, that works as reference identier (similarly to \label), followed by the information about the entry (e.g. author, title, editor, year of publication), with explicit formatting and punctuation. The following example
\begin{thebibliography}{9} \bibitem{Kopka1995} \textsc{Kopka}, H. and \textsc{ Daly}, P.~W. (1995). \emph{A Guide to {\LaTeX }---Document Preparation for Beginners and Advanced Users}. Addison-Wesley. \end{thebibliography}

produces Fig. 2.
26 27 28 29 30 31 32 33

http://scholar.google.com/ http://www.bibsonomy.org/ http://citeseer.ist.psu.edu/ http://www.citeulike.org/ http://liinwww.ira.uka.de/bibliography/ http://www.hubmed.org/ http://pubmed.gov/ http://www.sbg.bio.ic.ac.uk/~mueller/TeXMed/

A Managing bibliographies with L TEX

40

TUGboat, Volume 30 (2009), No. 1


A [1] Kopka, H. and Daly, P. W. (2003). A Guide to L TEXDocument Preparation for Beginners and Advanced Users, Fourth Edition. Addison-Wesley.

Figure 2: List of references obtained with a manual thebibliography environment.

From BibTEX to thebibliography Some journals require an explicit thebibliography. Even in these cases it is possible to manage the bibliography with an external .bib database and BibTEX. As a matter of fact, BibTEX just extracts the useful information from the .bib database, formats it according to the .bst style, and write the output with the thebibliography syntax into the .bbl le. Hence, at the end of the work, it is possible to copy the content of the .bbl le into the .tex le. From thebibliography to BibTEX There is no automatic method to convert the content of a thebibliography environment into BibTEX format. Often it may be convenient to import entries from online databases. Otherwise cb2Bib can be used to try to import the content of a thebibliography environment. For both methods refer to section 2.2.4. 2.6 What method to use 2.5

2.4

\renewcommand\bibname{Useful references}

2.7.2

Multiple bibliographies

BibTEX makes the bibliography management automatic but also has some disadvantages: it increases the complexity of the TEX environment (adding one or more external programs); although it is exible, BibTEX does not allow completely free composition of bibliography entries. However, the advantages are greater than these disadvantages: it automates tedious operations, especially ordering the bibliography entries; it automates bibliography formatting; several programs are available for creating and managing BibTEX databases. 2.7 2.7.1 Specialties Renaming the references section

The name of the bibliography section depends on the class and language selected. The report and book classes use the variable \bibname to specify the name; the babel package denes this variable as Bibliography in English, Bibliograa in Italian, and so on. The article class uses the variable \refname, which becomes References in English, Riferimenti bibliograci in Italian, and so on. The \renewcommand command can be used to change the names that are assigned by default to the bibliography, as in the following example: Lapo F. Mori

The chapterbib34 package can be used to create separate bibliographies for each le added to the main document with the \include command, and not only for each chapter as suggested by its name. The package is very easy to use since the dierent bibliographies are created automatically by the \include commands and do not require special commands for the references in the text. The bibunits35 package can be used to create separate bibliographies for dierent parts of the document such as chapters, sections, etc. In addition, a global bibliography can be added at the end of the document. This package does not require ad hoc commands for the citations in the text, only the \bibliographyunit{unit} command in the preamble (where unit corresponds to the document structure to be used for the bibliographies, such as chapter, section, etc.). The multibib36 package can be used to create multiple bibliographies; unlike the bibunits and chapterbib packages, the bibliographies can be placed anywhere in the document, not only at the end of certain parts. Each bibliography can have a dierent .bst style and .bib database. This package, however, requires special commands for the citations in the text: for each bibliography a dierent type of cite command has to be used. The multibbl37 package works similarly to multibib but does not allow the creation of a general bibliography at the end of the document. The bibtopic and splitbib give results similar to multibib and multibbl but follow a dierent strategy: instead of using special commands for the citations in the text, they require a distinction between the entries of each bibliography. The bibtopic38 package requires that each bibliography has a dierent
34 The chapterbib package was written by Donald Arseneau and the last version was released in 2008. 35 The bibunits package was written by Thorsten Hansen and the last version was released in 2004. 36 The multibib package was written by Thorsten Hansen and the last version was released in 2004. 37 The multibbl package was written by Apostolos Syropoulos and the last version was released in 2004. 38 The bibtopic package was written by Pierre Basso and Stefan Ulrich and the last version was released in 2006.

TUGboat, Volume 30 (2009), No. 1 .bib database. This is particularly convenient when working with database management software such as JabRef that makes very easy to create several small databases from a global one. The splitbib39 package, on the contrary, requires that the dierent categories and the respective entries are dened in the preamble. 2.7.3 Multilingual bibliographies 3.1.1 Numbered

41

The babelbib40 package, together with babel, can be used to create multilingual bibliographies in which: each entry is in a specic language, or all the entries are in the same language.41 The second case (all the entries are in the same foreign language) can also be handled by creating a style .bst with makebst, as described in section 3.2.2. For the rst case (entries in dierent languages), babelbib is very convenient: the language eld can be used to specify the language for each entry as in the following example:
@BOOK{Lucchesi1989, title = {La cucina di Lucchesia e Versilia}, publisher = {Franco Muzzio Editore}, year = {1989}, author = {E. Lucchesi}, language = {italian}, }

Numbered references usually appear in square brackets and use arabic numerals (e.g.: [1]). The main advantage of this type of references is that they can be used both for direct references (e.g.: see [1] as a reference for the theory) and for indirect ones (e.g.: this has already been shown [1]). Another advantage is that these references can appear close to parentheses in sentences such as (further details can be found in [1].). In general, this form of the A reference in the text, as output by \cite in L TEX, is independent from the type of sentence in which it appears and this has made this style quite popular. 3.1.2 Author-year

Bibliography styles the style of the bibliographic entries (usually at the end of the document), the style of the references in the text.

Bibliographic style can have two meanings:

The three main styles for the references in the text (numbered, author-year, footnote) are discussed in section 3.1. Even though the style for the references in the text inuences the style of the bibliography A entries, L TEX separates these two aspects: the style of the bibliography can be controlled with the .bst le, as discussed in section 3.2. 3.1 References in the text

When an article is cited for referring to a theorem or a theory, it is not necessary that the reader knows who wrote it and when. The interested reader can get this information from the reference list at the end of the document. For this reason, the numbered reference style is the most popular for sciences. In the humanities, however, referring to one author rather than another or to one historic period rather than another has signicance in and of itself, and it is important that the reader gets this information directly from the text. For this reason, in the humanities the so-called author-year style is preferred. This style summarizes all the relevant information in the reference; usually it reports the rst authors surname and the year of publication, e.g. (Mori et al., 2006). Since parentheses have already a meaning, this style may lead to misunderstandings. For example it is possible to say . . . this has already be proven (Mori, 2006), but not (Mori, 2006) proved that . . . . For these reasons, the author-year styles provide many variants for the references to solve grammatical or aesthetic problems. Some examples are: This has already been proven (Mori, 2006). Further details can be found in Mori (2006). (see [Mori, 2006]) The author can choose among these variants by using dierent commands instead of the usual \cite. Packages The most popular packages for authoryear citations are harvard, achicago, and natbib. They oer more or less the same features, natbib being the most versatile, but their commands follow dierent logics. The harvard42 commands are based on the logical function of the reference in the sentence. For
42 The harvard package was written by Peter Williams and Thorsten Schnier and the last version was released in 1996.

There are three main style families for the references in the text: numbered, author-year, and footnote. Each discipline has its own standards that depend on how the bibliography is used (Garcia, 2007).
The splitbib package was written by Nicolas Markey and the last version was released in 2007. 40 The babelbib package was written by Harald Harders and the last version was released in 2006. 41 At present the package only supports Afrikaans, Danish, Dutch, English, Esperanto, Finnish, French, German, Italian, Norwegian, Portuguese, Spanish, and Swedish.
39

A Managing bibliographies with L TEX

42 example \citenoun has to be used when the reference is a noun. With achicago43 the names depend on the form of the reference. For example \citeA can be used to have references that contain only the author name (A stands for author). natbib44 is based on the same logic of harvard and is the most exible package for managing author-year citations. It will be discussed in section 4. 3.1.3 Footnotes

TUGboat, Volume 30 (2009), No. 1 The inlinebib48 package can be used for footnote references but is not recommended since it is rather old, does not oer many options, and can be used only with the indexing.bst style. 3.1.4 Hybrid approaches

Some disciplines, mostly in the humanities, use footnote references. This style is especially common in journals that do not have a reference list at the end of each article. Packages. The footbib package denes the command \footcite which formats all references as superscript numbers in square brackets (e.g. [1] ). The information of each entry is at the bottom of the page and their number does not follow that of the footnotes. The \footcite command does not interfere with \cite, it is possible to add a list of references at the end of the document. The opcit46 package creates entries that are true footnotes and follow their number (e.g. 1 ). The package considers which references have already been cited in order to avoid repetitions by automatically using conventional forms such as Idem and op. cit.. Besides the manual, the interested reader should also read Garcia (2007). The jurabib47 package, originally written for German law documents, oers many tools to manage footnote references. Similarly to opcit, it formats the bibliographic references as regular footnotes. The natbib package provides the super option that, similarly to footbib, creates references that do not follow the number of footnotes and are not enclosed in brackets (e.g. 1 ). The list of the references appears at the end of the document and not at the bottom of the pages. Although natbib oers fewer options for footnote references than the other packages, it uses the same syntax for footnote, author-year, and numbered styles. This allows switching from one style to another by merely changing the package options in the preamble, without changing the references in the text of the document.
43 The achicago package was written by Matt Swift and the last version was released in 2001. 44 The natbib package was written by Patrick Daly and the last version was released in 2009. 45 The footbib package was written by Eric Domenjoud and the last version was released in 2004. 46 The opcit package was written by Federico Garcia and the last version was released in 2007. 47 The jurabib package was written by Jens Berger and the last version was released in 2004.

Between author-year and numbered The style alpha.bst is halfway between the author-year style, such as (Mori, 2006), and the numbered style, such as [1]. It produces references such as [Mor06]. Since this style is not as concise as the numbered and not as informative as the author-year, it is not recommended. It is supported by natbib. Between author-year and footnote Some humanities journals report the bibliographic entries directly in the text. The bibentry49 package can be used for this purpose. It requires only a few modications to the .bst style, hence, it can be used almost with every style. The inlinebib package, created for footnote references, can also be used for in-text-references although it is not recommended, as noted above. The jurabib package, also created for footnote references, can be used for in-text-references with a small number of styles (jurabib.bst, jhuman.bst, and two styles of the Chicago family). 3.2 3.2.1 Style of the reference list Existing styles

45

Almost every journal and publisher have their own rules for formatting the bibliography (use of boldface or italic for the issue or volume number, use of parentheses and of punctuation, etc.). Many journals provide the BibTEX style, hence TEX distributions usually come with a lot of bibliographic styles; the Comprehensive TEX Archive Network (CTAN)50 provides even more styles. BibTEX comes with four styles (plain, unsrt, abbrv and alpha) that were created by the author of the program, Oren Patashnik. These styles, however, do not support the author-year approach (section 3.1.2). Ken Turners web site51 provides examples of the most popular .bst styles. Another excellent review of the available styles is available on the Reed College web site.52
48 The inlinebib package was written by Ren Seindal and the last version was released in 1995. 49 The bibentry package was written by Patrick Daly, also the author of natbib, and the last version was released in 2000. 50 http://www.ctan.org/ 51 http://www.cs.stir.ac.uk/~kjt/software/latex/ showbst.html 52 http://web.reed.edu/cis/help/LaTeX/bibtexstyles. html

Lapo F. Mori

TUGboat, Volume 30 (2009), No. 1 The best way to test a .bst style is by using the xampl.bib database that comes with the BibTEX documentation. If for example we want to test the example.bst style, we can use the following:
\documentclass{article} \begin{document} \bibliographystyle{example} \nocite{*} \bibliography{xampl} \end{document}

43 on the language in use (bbl.editor becomes curatore in Italian, editor in English, Redakteur in German, redacteur in French, etc.). merlin.mbs supports only the options English and babel; the denitions for all the other languages are provided by separated .mbs les (e.g. italian.mbs). The language must be chosen at very beginning: when asked Enter the name of the MASTER le select merlin.mbs, when asked Name of language denition le select the .mbs le corresponding to the desired language. If the .mbs le is not available for the desired language,55 the user can select babel that, instead of substituting the variables with their translation, substitutes them with commands (in this case \bbleditor{}) whose denition must be written in the babelbst.tex le. Except from the language, some of the customizations oered by merlin.mbs are: author-year or numbered citations; criteria for ordering the entries: citation order, year ordered and then by authors, reverse year ordered and then by authors, etc.; format for author names: full with surname last, initials and surname, surname and initials, etc.; the number of names to report before substituting them with et al.; formatting for the author names; position of the date; format for volume, issue, and page number; punctuation. At the end, the procedure creates a .dbj le A that has to be compiled with L TEX in order to obtain the corresponding .bst style. If you want to modify a style created with this procedure, it is very convenient to open the .dbj le and modify it, instead of answering again to the interactive questions. Further details on makebst can be found in Daly (2007a,b). 4 The natbib package

3.2.2

Customizing the style with makebst

There are two main reasons to create custom .bst styles: 1. none of the available .bst styles satisfy the author (or publisher), 2. the document is written in a language dierent from English.53 Writing a .bst style may prove to be dicult since BibTEX uses a rather non-intuitive programming language. Luckily, Patrick Daly, who is also the author of natbib and coauthor of the excellent book about A L TEX (Kopka and Daly, 2003), wrote a program called makebst that can be used to create interactively a customized .bst style for BibTEX (and fully compatible with natbib). The program is usually distributed as the custom-bib package. The generic style merlin.mbs is the heart of the program: it contains alternative code for all aspects of a bibliographic style and is analyzed in detail in Daly (2007b). This le has to be compiled by the docstrip54 program in order to produce the respective .bst style. Since the number of options is very high (about one hundred), the program provides a graphic interface by means of the makebst.tex le. The rst step consists in compiling makebst.tex with either A TEX or L TEX: at this point the user has to answer interactively to the questions that appear on the screen. At the very beginning the user has to select an .mbs le, and, depending on the choice, a docstrip batch le is created. This batch le can be used to create a bibliographic style with the characteristics of the .mbs le: the options that the user can select interactively depend on the chosen .mbs le. merlin.mbs is a third generation bibliographic style that has replaced genbst.mbs (released in November 1993) and its multilingual version babel.mbs. Unlike its predecessors, in merlin.mbs all the words such as editor are represented by variables (in this case bbl.editor) that assume dierent values depending
Almost all the available styles are in English. docstrip, written by Frank Mittelbach, is a standard part A of L TEX distributions.
54 53

The natbib package is highly recommended for bibliography customization. The most common options will be described in the following paragraphs and the other details can be found in Daly (2009). 4.1 Compatible styles

natbib only works with styles that support its options; the three that come with the package (plainnat.bst, abbrvnat.bst, and unsrtnat.bst) can replace the corresponding BibTEX standard styles (plain.bst, abbrv.bst, and unsrt.bst) with the advantage that
55 At the moment .mbs les are available for Catalan, Danish, Dutch, Esperanto, Finnish, French, German, Italian, Norwegian, Polish, Portuguese, Slovene, and Spanish.

A Managing bibliographies with L TEX

44

TUGboat, Volume 30 (2009), No. 1


Table 1: List of the commands for references in the text and their eect with an author-year style (option authoryear).
Reference in the text \citet{mori06} \cite{mori06} \citet[chap.~2]{mori06} References with parentheses \citep{mori06} \citep[chap.~2]{mori06} \citep[see][]{mori06} \citep[see][chap.~2]{mori06} References with complete author list \citet*{mori06} \citep*{mori06} Multiple references \citet{mori06,rossi07} \citep{mori06,rossi07} \citep{mori06,mori07} \citep{mori06a,mori06b} References without parentheses \citealt{mori06} \citealt*{mori06} \citealp{mori06} \citealp*{mori06} \citealp{mori06,rossi07} \citealp[p.~32]{mori06} Mori et al. (2006) Mori et al. (2006) Mori et al. (2006, chap. 2) (Mori et al., (Mori et al., (see Mori et (see Mori et 2006) 2006, chap. 2) al., 2006) al., 2006, chap. 2)

Mori, Lee, and Krishnan (2006) (Mori, Lee, and Krishnan, 2006) Mori et al. (2006); Rossi et al. (2007) (Mori et al., 2006; Rossi et al. 2007) (Mori et al., 2006, 2007) (Mori et al., 2006a,b) Mori et al. 2006 Mori, Lee e Krishnan 2006 Mori et al., 2006 Mori, Lee e Krishnan, 2006 Mori et al., 2006; Rossi et al., 2007 Mori et al., 2006, p. 32

Table 2: List of the commands for references in the text and their eect with a numbered style (option numbered).
References in the text \citet{mori06} \citet[chap.~2]{mori06} References with parentheses \citep{mori06} \cite{mori06} \citep[chap.~2]{mori06} \citep[see][]{mori06} \citep[see][chap.~2]{mori06} Multiple references \citep{mori06a,mori06b} Mori et al. [11] Mori et al. [11, chap. 2] [11] [11] [11, chap. 2] [see 11] [see 11, chap. 2] [11, 18]

they can be used for both numbered (the only option available for the three original styles) and authoryear references. Several other styles that support natbib are available on the Internet. This format is also supported by makebst (section 3.2.2). 4.2 Commands for in-text references

natbib provides two main commands that substitute the regular \cite for the citations: \citet for the citations in the text and \citep for the citations in parentheses. Both of them have a starred version (\citet* and \citep*) that produce the complete list of authors rather than the abbreviated one. All commands have two optional arguments to add text before and after the reference. Like \cite, these commands can be used for multiple citations. The Lapo F. Mori

package also provides commands that remove the parentheses from the citations: \citealt instead of \citet and \citealp instead of \citep. Examples of these commands are shown in Tab. 1 for the authoryear style (option authoryear) and in Tab. 2 for the numbered style (option number). The standard \cite command can still be used with natbib and it is interpreted as \citet for authoryear bibliographies (option authoryear) and as \citep for numbered bibliographies (option number).

4.3 4.3.1

Package options Type of parentheses

References can be enclosed in dierent types of brackets by using the following options:

TUGboat, Volume 30 (2009), No. 1 round (default): round brackets as in see Mori (2006) or see (2); square: square brackets as in see Mori [2006] or see [2]; curly: curly brackets as in see Mori {2006} or see {2}. The \bibpunct command can also be used to select the bracket type (Daly, 2007b). 4.3.2 Punctuation 4.3.6 Reducing the space between the references

45

The bibliography is composed as a list (very similar to itemize, enumerate, and description) and the space between the items can be controlled with the \itemsep parameter (UK TUG, 2009):
\let\oldbibliography\thebibliography \renewcommand{\thebibliography}[1]{% \oldbibliography{#1}% \setlength{\itemsep}{0pt}% }

The punctuation used to separate multiple references can be selected with the following options: colon (default): the colon as in (Mori et al., 2006; Rossi et al., 2007) or Mori et al. (2006); Rossi et al. (2007); comma: the comma as in (Mori et al., 2006, Rossi et al., 2007) or Mori et al. (2006), Rossi et al. (2007); \bibpunct can also modify the punctuation (Daly, 2007b). 4.3.3 Bibliography style

The natbib package oers an even better solution by providing the \bibsep parameter that can be used as in the following example:
\setlength{\bibsep}{0pt}

4.3.7

Style of the numbers in the bibliography

A By default, L TEX formats the entry numbers in the following way: A [1] Garcia, F. (2007). L TEX and the dierent bibliography styles. TUGboat, 28(2). [2] Goossens, M., Mittelbach, F. and A Samarin, A. (1995). The LTEX Companion. Addison-Wesley.

The bibliographic style can be set by invoking the respective option when loading natbib: authoryear (default) loads the author-year style, numbers the numbered style, and super the footnote style. The selected .bst style must support the reference type chosen. 4.3.4 Ordering and compressing multiple references

This behavior can be customized with commands such as (UK TUG, 2009):
\makeatletter \renewcommand*{\@biblabel}[1]{\hfill#1.} \makeatother

Multiple references such as \cite{a,b,c,d} by default produce bad results such as [2,6,4,3]. Ordering the references by hand (i.e. \cite{b,c,d,a}) would give [2,3,4,6] but such manual operations are undesirable. natbib, when used with the numbers option, provides the sort&compress option that automatically orders and compresses multiple references. For example \cite{a,b,c,d} would produce [24,6]. 4.3.5 References from the bibliography to the text

or, if using natbib,


\renewcommand{\bibnumfmt}[1]{#1.}

Both of them give:


A 1. Garcia, F. (2007). L TEX and the dierent bibliography styles. TUGboat, 28(2). 2. Goossens, M., Mittelbach, F. e Samarin, A A. (1995). The LTEX Companion. AddisonWesley.

In the bibliography of a long document, it can be useful to provide the page on which each reference appears. Both the backref and the citeref packages can be used for this purpose, although the former is more modern and can work together with hyperref; namely, it can create hyperlinks when used together with hypernat. Neither of the two packages can compress the page list (5, 6, 7 cannot be automatically converted into 57) but they do not repeat a page number if the same reference appears several times in it.

A BibL TEX

A The BibL TEX package oers a general solution for customizing bibliographic entries and references. Besides oering features similar to those of the packages analyzed so far, it can be used to modify a biblioA graphic style by using only L TEX commands. This package, written by Philipp Lehman, is still under development and, although (at the authors

A Managing bibliographies with L TEX

46
A request) it is not included in many L TEX distribuA tions, it is available on CTAN.56 BibL TEX requires -TEX, the etoolbox package, also under development, and the packages keyval, ifthen, and calc. In addition, babel and csquote, while not required, are recommended in order to use the full potential of A A BibL TEX. A detailed analysis of BibL TEX would require a separate article; the following sections only describe its main characteristics. Further details can be found in the package documentation (Lehmann, 2009).

TUGboat, Volume 30 (2009), No. 1


{\mkbibemph{#1\isdot}} \DeclareFieldFormat{journaltitle}% {\mkbibquote{#1}}

To modify the author-year style in order to use it again with other documents, a user can write the following in the myauthoryear.bbx le:
\RequireBibliographyStyle{authoryear} \DeclareFieldFormat[article]{title}% {\mkbibemph{#1\isdot}} \DeclareFieldFormat{journaltitle}% {\mkbibquote{#1}} \endinput

5.1

A BibL TEX styles

The main limitation of BibTEX is that, in order to have full control of the bibliographic style, the user has to learn a new language that is completely dierA ent from that of (L )TEX. The custom-bib package, as explained in section 3.2.2, is very helpful but is not always enough to obtain the desired result. A With BibL TEX the bibliographic references and A citations can be fully controlled with L TEX commands. The style is contained, not in a .bst le, but in a .bbx (bibliographic style) or .cbx (citation style) le. The .bbl le that is created when compiling does not contain a thebibliography environment, but rather a series of macros that contain the bibliographic data. The style can be specied by declaring a package option:
\usepackage[style=numeric]{biblatex}

and specify myauthoryear as the value for bibstyle. 5.2


A BibL TEX commands for references

A BibL TEX, besides the standard \cite and \nocite commands, provides citation commands for dierent contexts: \parencite encloses the reference in round brackets; \footcite inserts the reference in a footnote; \textcite for when the citation is part of a sentence; \supercite (only for numbered styles) for superscript citations, and \fullcite insert the full bibliographic entry. Finally, \autocite automatically invokes the suitable command of these depending on the context. Examples of these commands are reported in Tab. 3 and 4. Commands to cite parts of the entry are also available: \citeauthor, \citetitle, \citeyear, and \citeurl.

5.3

A BibL TEX commands for bibliographies

or:
\usepackage[bibstyle=authortitle,% citestyle=verbose-trad1]{biblatex}

In the rst case the value numeric is assigned both to bibstyle and to citestyle. The package comes with some styles. The bibliographic styles cover the four traditional categories: numeric, alphabetic, authoryear, and authortitle. A citation style can be associated with each of them to control the references in text (numbered, authoryear, footnote). The verbose style uses the complete citation the rst time and an abbreviated form, such as idem, ibidem, op. cit, and loc. cit subsequently. The user can modify the standard styles inside the document or create new ones. For example, to make the article titles in italic and the journal name enclosed in quotation marks, the following commands can be given in the preamble:
\DeclareFieldFormat[article]{title}% http://www.ctan.org/tex-archive/macros/latex/ exptl/biblatex/
56

A The bibliographic list of references in BibL TEX is inserted dierently than with BibTEX. As discussed earlier, the bibliography style is specied as an option to the package instead of with \bibliographystyle. The \bibliography command only species which databases to use, and does not create any list. The entry list can be generated with \printbibliography, which accepts an optional argument. This argument can be used to lter the entries: by special elds (type or keyword), via the denition of categories in the preamble (using \DeclareBibliographyCategory), then assigning each entry to one of these categories (using \addtocategory), depending on the position of the citation inside the document, by using the refsection or refsegment options.57 This allows easily dividing the bibliography by chapters or topics by using \printbibliography several times with dierent lters. When making multiple
57 The sections can also be dened manually enclosing portions of the document between \begin{refsection} and \end{refsection}.

Lapo F. Mori

TUGboat, Volume 30 (2009), No. 1


A Table 3: List of the BibL TEX commands for the references in the text and their eect in the compact author-year style (option authoryear-comp).

47

References in the text \textcite{mori06} \textcite[chap.~4]{mori06} References with parentheses \autocite{mori06} \parencite{mori06} \parencite[chap.~4]{mori06} \parencite[see][]{mori06} \parencite[see][chap.~4]{mori06} Multiple references \cite{mori06,rossi07} \textcite{mori06,rossi07} \parencite{mori06,rossi07} \cite{mori06,mori08} \cite{mori06a,mori06b} References without parentheses \cite{mori06} \cite[chap.~4]{mori06}

Mori et al. (2006) Mori et al. (2006, chap. 4) (Mori et al. 2006) (Mori et al. 2006) (Mori et al. 2006, chap. 4) (see Mori et al. 2006) (see Mori et al. 2006, chap. 4) Mori et al. 2008; Rossi et al. 2007 Mori et al. (2008); Rossi et al. (2007) (Mori et al. 2008; Rossi et al. 2007) Mori et al. 2006, 2008 Mori et al. 2006a,b Mori et al. 2006 Mori et al. 2006, chap. 4

A Table 4: List of the BibL TEX commands for the references in the text and their eect in the numbered style (option numeric-comp).

References in the text \textcite{mori06} \textcite[chap.~4]{mori06} References with parentheses \cite{mori06} \parencite{mori06} \autocite{mori06} \cite[chap.~4]{mori06} \cite[see][]{mori06} \cite[see][chap.~4]{mori06} Multiple references \cite{mori06,mori08}

Mori et al. [6] Mori et al. [6, chap. 4] [6] [6] [6] [6, chap. 4] see [6] see [6, chap. 4] [3, 6]

bibliographies, a complete entry list can still be generated with the \bibbysection, \bibbysegment or \bibbycategory commands.

Assuming that our bibliographic database is called database.bib, the following code can be used A to create an index with BibL TEX:
\documentclass{...}

5.4

Commands for indexing

\usepackage[indexing]{biblatex} \bibliography{database} \usepackage{makeidx} \makeindex \begin{document} As reported by \textcite{Kopka1995}... \clearpage As discussed by \citeauthor{Goossens1995} in... \clearpage \nocite{*} \printbibliography \printindex \end{document}

Automatic indexing of bibliographic entries is a very A interesting feature of BibL TEX. An index and an author index are very useful for any kind of book A and thesis. BibL TEX can automatically add the authors cited in the text into an author index (or another type of index) by using the indexing option. A BibL TEX uses external packages to create indexes: makeidx for basics operations and index for advanced features such as multiple indexes. This section will show an example of automatic indexing; further details can be found in Lehmann (2009, in particular section 3.1.2 and the templates that come with the package documentation).

A Managing bibliographies with L TEX

48 If our document is called document.tex, we need to compile it in this order:


latex document bibtex document latex document makeindex document latex document

TUGboat, Volume 30 (2009), No. 1 References Daly, P.W. Customizing Bibliographic Style Files, 2007a. http://mirror.ctan.org/macros/ latex/contrib/custom-bib/makebst.pdf. Daly, P.W. A Master Bibliographic Style File for numerical, author-year, multilingual applications, 2007b. http://mirror.ctan.org/macros/ latex/contrib/custom-bib/merlin.pdf. Daly, P.W. Natural Sciences Citations and References (Author-Year and Numerical Schemes), 2009. http://mirror.ctan.org/ macros/latex/contrib/natbib. A Garcia, Federico. L TEX and the dierent bibliography styles. TUGboat 28(2), 2007. http://tug.org/TUGboat/Articles/tb28-2/ tb89garcia.pdf. A Kopka, H., and P. Daly. A Guide to LTEX Document Preparation for Beginners and Advanced Users. Addison-Wesley, fourth edition, 2003. Lehmann, Philipp. The biblatex package. 2009. http://mirror.ctan.org/macros/latex/ exptl/biblatex/doc/biblatex.pdf. Patashnik, Oren. BibTEXing, 1998. http: //mirror.ctan.org/biblio/bibtex/contrib/ doc/btxdoc.pdf. UK TUG. The UK TUG FAQ, 2009. http: //www.tex.ac.uk/faq.
Lapo F. Mori Dipartimento di Ingegneria Meccanica, Nucleare e della Produzione Universit di Pisa Pisa, Italy lapo dot mori (at) ing dot unipi dot it

This produces a document with a bibliography followed by an index with the name of all the cited authors. 5.5 Multilingual bibliographies

A BibL TEX also includes some of babelbibs features. When the babel option is used with one of the values hyphen or other, the package checks the hyphenation eld for each bibliography entry. If a language is A specied through this eld, BibL TEX uses the appropriate hyphenation rules and the translation for words such as editor, volume, etc. The translations used are stored in .lbx les that come with the package.

Acknowledgments

I would like to thank Massimiliano Dominici for writA ing section 5 about BibL TEX and Gustavo Cevolani A for writing section 5.4 about indexes with BibL TEX. I also would like to thank Valeria Angeli, Claudio Beccari, Caterina Mori, and Gianluca Pignalberi for their suggestions during both the writing and the reviewing process of this article.

Lapo F. Mori

Anda mungkin juga menyukai