[next] [tail] [up]

7.1 Bibliographies and indexes 

7.1.1 BibTeX 

When writing an article, book or report you often refer to other literature. At the end of the document you usually include a bibliography. With LaTeX and the program BibTeX this becomes easy.

Using one or more bibliographic databases that contain references to all books, articles, etc. you never have to create a bibliography yourself. By simply including, e.g., the command
in the document, you tell LaTeX to use the databases articles.bib, books.bib, and reports.bib to select the documents you referred to in your document and put them in a bibliography. Note that the databases must have the extension .bib.

Referring to other documents is done by one of the following commands: \cite{KEYNAME} or \nocite{KEYNAME}, where KEYNAME is the key or identification name you attached to the reference in the databases. The difference between \cite and \nocite is that \cite produces some output on the spot where the command is issued (e.g., the number of the document in the bibliography). The command \nocite produces no output and only includes the reference in the bibliography. Economists do not like to use numbers when making references but like to use the year of publication instead, and therefore often use the \nocite command, e.g.,
will produce the output Knuth (1984) and will display the book in the bibliography. Mathematicians like to use numbers for references and they use the \cite command. E.g., if you type Knuth\cite{KNUTH}, the text Knuth [10] will be produced and the book will be listed as the 10th entry of the bibliography.

The layout of the bibliography is defined by \bibliographystyle{BIBSTYLE}, where BIBSTYLE is the bibliography style file with the extension .bst. The standard bibliography style files are plain.bst, alpha.bst, abbrev.bst, and unsrt.bst, but many publishers have defined their own bibliography layout and their own .bst. 4TeX comes with a lot of .bst files. Most probably one of those will satisfy your requirements.

To produce a bibliography file you have to run LaTeX with your document (e.g., the file sample.tex), which produces one or more auxiliary files (files with the extension .aux). Compiling the file sample.tex will always produce the auxiliary file sample.aux but when other files are included these will also produce an auxiliary file. The auxiliary files contain the cross-referencing information, e.g., the references to mathematical formulas, sections etc. and also the reference to the \cite and \nocite commands and the arguments of the \bibliography and the \bibliographystyle commands.

After running LaTeX for the first time you run BibTeX, e.g.,

BibTeX will read the auxiliary files and will query the databases for the key or identification name of the \cite and \nocite commands. When the keys are found it will produce a file sample.bbl containing the TeX commands to produce a bibliography according to the specified style file.

The second time you run LaTeX with your sample.tex document the \bibliography command reads the sample.bbl file and produces a bibliography. The bibliography is created on the location where the \bibliography command is issued. This means that this command should be at the end of the document, although the \bibliography command can be issued anywhere after the \begin{document} command.1

A detailed discussion how to use BibTeX can be found in Lamport (1986), i.e. Section 4.3. and appendix B. We also refer to Patashnik (1988) for a discussion of how to make your own bibliography style. The following example illustrates how Knuth's TeXbook is entered in the BibTeX database:
   author={Knuth, D.E.},
   title={The {\TeX}{}book},
   address={Reading, Massachusetts}
There are many options and details to be aware of when building a bibliographic database. Appendix B of Lamport's reference manual explains how to do this, but there is a much simpler solution: BibDB, the interactive BibTeX bibliography database manager (see Section 7.1.2).

4TeX uses the big BibTeX version for 80386 CPUs and higher (bibtex32.exe). The BibTeX program can be found in the ?:\emtex\utils directory and the bibliography style files can be found in the directory ?:\emtex\inputs\bibtex. In the example given above, BibTeX will look for the file sample.aux and the .aux files of all the included files in the current directory. The bibliography style file is read from the current directory, or, if not found, in the directory specified by the environment variable BIBSTYDIR. The database is also read from the current directory, or from the directory specified by TEXBIB (set in texuser.<os>) if the file was not found.

We will end this section with an example of a document that is set up to produce a bibliography. Note that 4TeX has a BibTeX utility for maintaining and running BibTeX (see Section 4.3).
 ...           % put here your macros and definitions
 ...           % some text
 As explained by Knuth~(1984)\nocite{KNUTH} in his well-known book
 ...           % more text and references (\CITE and \NOCITE)
 % plain.bst is the style file for the bibliography layout
 % articles.bib, books.bib, and reports.bib are the bibliography
 % databases in which your references can be found.

7.1.2 BibDB 

BibDB is a program written by E. Doron for managing BibTeX databases. BibTeX is a good way of keeping a reference library, but managing it is a pain. Finding entries using criteria such as year or keywords, and so forth, is cumbersome, and entering data is fraught with errors. Both an MS-Dos version and an MS-Windows version are used in 4TeX.

With BibDB you can browse through the database, extract selected entries, add and edit entries in a convenient manner. The user-friendly interface shields you from many technical details that would otherwise often cause errors.

The programs can be found in the ?:\emtex\utils directory and ?:\emtex\utils\win. The syntax is:
[W]BIBDB [options] [bibfile1 [ . . .  bibfile8]]. Of course wbibdb is the MS-Windows version.

The BibTeX database name should be supplied without the .bib extension. If the bibliography file does not include a path, BibDB searches for the bibliography in the current directory and then in the directory specified by the environment variable TEXINPUT. When BibDB is run it will look for the bibdb.cfg configuration file. It will first look in the current directory, then in the ?:\emtex\utils directory and finally on the dos PATH.

For a detailed discussion how BibDB works we refer to Doron (1994). Although BibDB is very user-friendly you should know how BibTeX works, before you can work with BibDB properly.

[next] [front] [up]