## Thursday, 27 December 2007

### Bibliography in LaTex: JabRef

Problem: bibliographical list of cites in LaTeX being grown and became on the thither side of fifty sources. Sorting and storing of bibliographical list in scientific papers is evident.
Solve: there is cross platform system for bibliography base - JabRef.

During creation of vast scientific works, problems with bibliography in LaTeX frequently arises. In the base level of LaTeX study, users applies direct links to literature in the TEX-file:

\begin{thebibliography}{99}

\bibitem{catheydowskinewparadigm} W.T. Cathey and E.R. Dowski, New paradigm for imaging systems'', Appl. Opt. 41, pp. 6080-6092, 2002.
This means literally "add section References at the end of table of contents, and enumerate links (bibitem) as they follows in bibliography list". And that is where shoe pinches for LaTeX-beginners - in the text links will have been enumerated as they are in list of references but not in the order of citing.

Besides that, where will be a big problems when you want to include part of bibliography items in another document. Which of them are useful, and in what order? To prevent such kind of problems, BiBTeX was invented.

Bibliography databases
This is a simple text file, where all you bibliography sources are listed. Such file can be used by LaTeX to produce bbl-file with only that literature sources, which were cited in document.
Every time you compiling you LaTeX document, BiBTeX searches citations in base and substitutes them into bbl-file. Obtained bbl-file is used as "thebibliography" list - but it created automatically.

Hence, you don't need to fight with bibliography in LaTeX - just add literature to you BiBTeX base using fancy GUI program. Created bibliography base can be used with many document, and benefits are:
1. if there are any errors in literature item, it can be corrected in the BibTeX base only - and all documents, which are using this base, will be corrected automatically after next recompilation;
2. links appears in desirable order and numbered automatically;
3. you can search literature in base to find out bibtex key to substitute in \cite{};
4. one BiBTeX base can be used in loads of documents;
5. import \ export in different formats is possible.
Thus, you ought to make an effort to use BiBTeX - using you bib-base, it is possible to simply type \cite{source} and don't pay attention on which order cited literature appears in document. Simple and easy.

How it works
To start working with BiBTeX, it is necessary to install any program to work with BiBTeX, create new bib-base and full it with literature sources which you have. If you wrote early at the end of document:
\begin{thebibliography}{99}
hence, now you must point to bib-base like that (don't write .bib extension!):
\bibliography{path/to/bibliography/file}
e.g.,
\bibliography{biblio/my}
and, apart from other, choose bibliography style which you want to use - often unsorted list is used (i.e., in order of mentioning in text):
\bibliographystyle{unsrt}
This string must be pasted in header of LaTeX document, after \usepackage but before \begin{document}.

Here we exploiting possibilities of our OS, which alleviates our life: use symlinks. For example, we have two documents in different directories, but they using the same bib-base. How can it be used in either documents? Easily:just make symbolic link to directory with bib-base file and copy this symlink in desirable directories. This can be done in any UNIX systems.

So, if we have bibliography base file my.bib placed in ~/docs/matlab/docus/topics/biblio/ we need to point in LaTeX document to it \bibliography{biblio/my} and make symlink on directory:
ln -s ~/docs/matlab/docus/topics/biblio/ biblio
and copy symlink in desirable directories. That's all, you LaTeX documents will work with bib-base.

Installation
For described miracles to be working, installation of bibtex-viewer program is required. Let's use crossplatform software JabRef, Java-written and GPL-licensed.

Hence, we need to download from Internet  j2re*.deb (for example, jpre1.4_1.4.2.03-1_i386.deb), jabref*_all.deb (I have jabref_2.0.1-1_all.deb) and take first DVD-disk with Debian.

Firstly, installing  java-common :
#apt-get install java-common
Then installing Java-machine (correct file name if you have another version of Java):
#dpkg -i jpre1.4_1.4.2.03-1_i386.deb
Several questions may be asked during installation process, such as licence agreement. Then install JabRef - as separate package, if it isn't in distribution:
#dpkg -i jabref_2.0.1-1_all.deb
That's it: now add  JabRef to menu of you favourite window manager and run:
jabref
Don't forget to correct your LaTeX documents and point LaTeX to use BibTeX base:
\bibliography{path/to/bib-file/base}
and work as usual - citing literature and don't boring, BibTeX will do this job instead of us. At the end of document references will be typesetted by all rules.