Wednesday, 6 June 2007

References in LaTeX using bibtex

If you use LaTeX often you will soon find that you should keep track of references with bibtex rather than specifying them time and time again in a bibliography-environment in each document separately. Here's a short intro on working with bibtex.

Somewhere in the beginning of your text document, you tell LaTeX which style to use for the references, e.g.


You can just cite papers and books with "\cite" as you do now. However, at the end of the document, you write


instead of the whole thebibliography environment you use now. That's all.

Now, use "latex mytext" on your file twice, next run "bibtex mytext" and finally twice more "latex mytext". You don't have to do this every time - just when you have used new citations in your text, you need to run
"bibtex" again. (Explanation: bibtex actually generates the thebibliography environment for you, including all references you actually use. See the file mytext.bbl for the generated file.)

I've enclosed a small example, see test.tex:



% The following command changes the way your list of
% references will look, as well as how the citations in
% the text will look. Unquote "apalike" to get similar references as
% in my PhD thesis.


Here is a reference to the first entry in my bibliography file

If you would like to refer to a theorem or page in a reference,
use something like \cite[p.~100]{RANA9804} or \cite[Th.~4]{RANA9804}.

If you use the \verb=cite=-package, lists of references will be
put in a nicer form, such as \cite{RANA9804,RWTH152,NAVW}.



Here's the bibtex file martijn.bib:

% Sample bibtex file

author = "Martijn J. H. Anthonissen and Bas van 't Hof and Arnold A. Reusken",
title = {A finite volume scheme for solving elliptic boundary
value problems on composite grids},
month = feb,
year = 1998,
institution = {Eindhoven University of Technology},
address = {Eindhoven},
number = {RANA 98-04}

author = "Martijn Anthonissen and Bas van 't Hof and Arnold Reusken",
title = {A Finite Volume Scheme for Solving Elliptic Boundary
Value Problems on Composite Grids},
month = feb,
year = 1998,
institution = {Institut f\"ur Geometrie und Praktisch Mathematik, RWTH Aachen},
address = {Aachen},
number = {Bericht Nr.~152}

author = "M. J. H. Anthonissen and B. van 't Hof and A. A. Reusken",
title = {An Iterative Finite Volume Discretization Method for Solving Elliptic Boundary
Value Problems on Locally Refined Grids},
journal = {Nieuw Archief voor Wiskunde},
volume = 17,
pages = {111--123},
year = 1999

No comments: