Updated: 06-13-2021
About me
Debian
LaTeX
LaTeX-Book
BiBTeX-Hints

Web browser
Science
Linuxinfo
Books
Groups
Copyright
Internal






Table of Contents

  1. Why BibTeX ?
  2. Setting up your environment
  3. Creating and maintaining the database
  4. Choosing the style
  5. Using BibTeX
  6. If you need several indices
  7. Publish your database !

Why BibTeX ?

Using BibTeX instead of inline citations has several advantages:

  • The exact citation has to be recorded only once, reducing possible errors
  • The layout of the bibliography as well as the citation can be easily changed
  • Citations can be easily shared (e.g., when you need all publications from another group member)
  • Documents can be more generic

Table of Contents

Setting up your environment

I assume you are using a Unix variant like, e.g., Linux, Tru64 oder AIX. I recommend that you create a special directory to store all BibTeX related data:

mkdir ~/texte/Bibdb

To use this directory it is convenient to define the following two environment variables and include them in your startup files, e.g., in .zprofile:

export BIBINPUTS=$HOME/texte/Bibdb
export BSTINPUTS=$HOME/texte/Bibdb

Now you can easily use BibTeX from any directory without worrying about the location of specific files.

Table of Contents

Creating and maintaining the database

The following steps guide you through the database creation. If you already have a database and want to update/add further entries, simply skip the first two steps

  1. The main advantage of BibTeX is that you only have to enter each reference once into a database. For later convenience, I would suggest that you create at least two databases:

    • Your own publications
    • Other publications you probably like to cite

    It might make sense if you are working on several fields to split up the second database into several, one for each field. Again, you can also simply create one database. You can download a sample database which already contains some useful abbreviations.

    Remember to put the database in the directory you created above, i.e., in ~/texte/Bibdb.

  2. Decide on a naming scheme. E.g., you can use the first author followed by the year, like Meyer:2000. This is absolutely arbitrary and you only have to ensure that each entry remains unique. It would be helpful if you came up with some scheme, so that the keys can be deduced as far as possible.
  3. Decide which kind of publication you want to enter. Select the one which fits your needs and enter it as shown but replace the dummy values with your own ones. Remember to separate authors by AND and do not use commas.
    • If you have an article, e.g., from Phys.Rev.Letters:
      @article{first:1998,
      author =  "A. First and B. Second and C. Third",
      title = "Paper about physics and BibTeX",
      journal = prl,
      year = {1998},
      volume = {81},
      number = {},
      pages = {1694},
      }
      
      If you have a preprint for this article and you want to record it as well, simply add
      notes = "Preprint: cond-mat/00012345",
      
    • If you have a preprint
      @article{One:1998,
      author = {D. One and E. Two and F. Three},
      title = "Using experimental features of BibTeX",
      journal = cond,
      volume = {9810093},
      year = {1998},
      number = {},
      pages = {},
      url = {http://xxx.uni-augsburg.de/abs/quant-ph/9810093},
      }
      
      note that the URL is optional but if you intend to publish your BibTeX on the web it will serve as hyperlink to the abstract on the preprint server.
    • If you have a Phd. Thesis:
      @phdthesis{Eins:1995,
      author="G. Eins",
      title="Theoretical and numerical estimations of BibTeX usage.",
      type = "Doktorarbeit",
      school= {Virtual University of Neverland, Nospace},
      year = {1995},
      }
      
    • If you have a book:
      @book{cullum:1985,
      author="J. K. Cullum and R. A. Willoughby",
      title="Lanczos Algorithms for large symmetric eigenvalue computations",
      year={1985},
      publisher="Birkh{\"a}user Boston",
      }
      
    • If you have something other, e.g., a private communication use the type misc and fill in all appropriate fields
      @misc{priv:1999,
      author = "Y.Alleswisser and Z.Schlaukopf",
      year = {1999}, 
      howpublished = "private communication",
      }
      
    Generally try to fill in as many fields as possible. A complete list of fields can be found in several books about advanced topics regarding Latex. Furthermore unknown fields are ignored, so you can add more information just by creating your own fields.
  4. As you can already see in some of the examples, you have to quote special characters carefully. In general you have to use curly braces around the expression you would normally use in plain LaTeX (without babel). So, e.g., {\"a} for ä and {\ss} for ß.

Table of Contents

Choosing the style

There are several styles available. If you want to publish it might be worthwhile to check if the magazine provides a style. Otherwise I would recommend using unsrt_new for German texts and unsrt_newen for English texts, which will create fairly standard citations with numbers. If you want a different layout check your favorite Latex-book.

Remember to put your style into the directory you created, i.e. ~/texte/Bibdb.

If you want to make small modifications of a given style (e.g., to change a string) I suggest copying the style to a new name and editing the new style, so

cp almost_good.bst very_good.bst
and edit very_good.bst to suit your needs. If you want to create your personal style (say, you want to have a special formatting or you want all strings in Esperanto or Catalan) then I suggest to use custom-bib. You can find it by searching for it on CTAN.

Table of Contents

Using BibTeX

Using BibTeX is quite easy. Simply add

\bibliographystyle{unsrt_newen}
\bibliography{mydb1,mydb2}

where you want the bibliography to appear in your document. Substitute mydb1 with your databases. You can list several databases or only one.

Now you cite as usual, e.g.,

as \cite{Eins:1995} showed, we need more 
documentation for efficient use ...

To create your document (the TeX file is called mydoc.tex) you would issue the following commands:

latex mydoc
bibtex mydoc
latex mydoc
latex mydoc

You need to run LaTeX twice after BibTeX to get all numbers right. Of course during editing you would only occasionally go through this cycle. Especially as long as your database and your citations haven't changed, you don't need to call BibTeX.

That's all.

Table of Contents

If you need several indices

Sometimes it might be necessary to include several bibliographies in one work. This can be accomplished using multibib.

Say you want to have one bibliography with your own work and one with other peoples work. I assume that your own citations should be prefixed with E while the others should have no prefix. Further I assume that your publications are stored in myname.bib while all other citations are stored in others.bib.

Unfortunately multibib does not directly support this, so we have to include a small workaround. In your heading enter

\usepackage[resetlabels]{multibib}
\makeatletter
\newcommand\biblabelprefix{}
\renewcommand\@biblabel[1]{[\biblabelprefix#1]}
\def\@bibitem#1{\item\if@filesw 
\immediate\write\@auxout{\string\bibcite{#1}
{\biblabelprefix\the\value{\@listctr}}}\fi\ignorespaces}
\makeatother
\newcites{my}{My Bibliography}
\newcites{rest}{Other Bibliography}

and in your document where you want your bibliography to appear you would enter

\renewcommand\biblabelprefix{E}
\bibliographystylemy{unsrt_new}
\bibliographymy{myname}

and at the place where you want the other bibliography to appear you would enter

\renewcommand\biblabelprefix{}
\bibliographystylerest{unsrt_new}
\bibliographyrest{others}

Citation works as usual except that you have two cite-commands, depending in which group of references the article is in:

In my work \citemy{Myname:1998} I showed that this is possible contrary
to other works \citerest{Author1:1990,Author2:1995} which claimed ...

Note that the usual commands are simply appended by the strings my and rest you chose in the heading of your document.

Not that you now have to call BibTeX with the two style files, i.e.,

bibtex my
bibtex rest

Of course, you can use more than two separate bibliographies this way.

Note: If you want to use hyperref as well, you have to first load hyperref before redefining the labels, i.e.,

\usepackage[resetlabels]{multibib}
\usepackage[...]{hyperref}

\makeatletter
...

Table of Contents

Publish your database !

There is one more advantage of using BibTeX: You can put you bib-File on the web and every colleague can simply get it to cite you right. If you keep this file up to date then you can simply tell your colleagues

Just get my bib-File from my homepage, you will find the work in it.

If you want your papers verbosely cited on the web (see this example), that's possible too. There are several tools available for this, but I currently recommend bibtex2html.

This enables you to also include hyperlinks, e.g., if you have a preprint in your bib-file, you would add a line similar to the following line

url = {http://xxx.uni-augsburg.de/abs/quant-ph/0011107},

where you substitute the real URL for the preprint. The online version will then have a link to your preprint. My example was created that way.

Table of Contents


© Dr. Helge Kreutzmann