Rob MacLeod
BibTex is a program that reads entries from a database of citations based on the output of LATEX and then makes a bibliography file that LATEX can insert into the document. There is lots to say about BibTex (and some good manuals that do it well) but here are some essentials I have found useful and not covered in the books. (There is a lot to say and learn about LATEX too).
Finding the material for a BibTex database is a chapter of its own, covered at least briefly at http://www.sci.utah.edu/~macleod/litbase
For those of us in the SCI Institute, there is a repository of bibtex files If you are not part of SCI and want to get access, please email me at ( macleod@sci.utah.edu
Quick Links:
There are a suggestions when using BibTex:
The default location for the Bibtex files for a document are in the same directory as that document. A slightly better solution is to have a directory that holds all your Bibtex files and then hard-wire the commands in LateX to find those files.
A better way (the best way?) is to store all your Bibtex files in one place in your computer, ideally managed through a system like Subversion, and then to tell the Bibtex program where to look. How this works depends on the operating system and the Bibtex application, of course, but here are some typical examples. I found a lot of this information at this web site by Julien Dutant .
# Set up the TeX environmentals TEXINPUTS=.:${HOME}/tex/latex: export TEXINPUTS BIBINPUTS=.:${HOME}/litbase/bibtex: export BIBINPUTSThis bit of code also sets the TEXINPUTS environment variable, which is also helpful when one has some style files that are stored in a common directory and need to be available to all LaTeX files. ${HOME} is a built in variable that is set to be a user's home directory so this bit of code sets my LaTeX directory to ~macleod/tex/latex and my Bibtex directory to ~macleod/litbase/bibtex.
~/Library/texmf/bibtex/bibor subfolders of this directory.
Of course, this directory is not directly visible in the modern
versions of Mac OSX and the Finder, thus protecting users from all this
tedious detail? To access the ~/Library directory, either use a
terminal or use the "Go" command in the Finder but hold down the
the option key to see this directory in the list. Here is what
the result should look like:
Once visible, you can maneuver to the texmf/ directory and then add the necessary bibtex/bib directories and store bibtex files there.
I like to keep things in the same (visible) place for all programs that use bibtex so I have created a link between this standard location and the place TexShop wants to see things. This is a Terminal command so use with the usual care:
cd ~/Library/tex/bibtex ln -s ~/litbase/bibtex bibYou should then see something like the following (again from a terminal window):
ls -l bib -> /Users/macleod/litbase/bibtexA above, this assumes my bibtex files are all in my
~/libtase/bibtexdirectory.
--include-directory="F:\my bibliography folder"
NIH requires public disclosure of journal articles supported by NIH funding and all such articles receive a code called the PMCID as part of the PubMed system. As an NIH funded researcher, you MUST include this code every time you cite such a reference, especially in progress reports, proposals, and biosketches.
To support this code in BibTeX, I have created a slightly modified version of one of the most common BibTeX style files (.bst), which is available here.
To use this new style file,
\bibliography{strings,biglit,crj,rtw,jgs,md,cdh,dhb,jaw,crb,sci} \bibliographystyle{nihunsrt}
To edit a BibTex file, you can use any editor but emacs has lots of great support for this process. The ones I like are Nelson Beebe's emacs tools found at www.math.utah.edu/pub/emacs/, in particular bibtools and bibtex-support.
Here is what my .emacs contains to access these:
;;; Add bibtex mode unconditionally; it is already bound to text-mode ;;; and we can do better than that. (delq (assoc "\\.bib$" auto-mode-alist) auto-mode-alist) (setq auto-mode-alist (cons (cons "\\.bib$" 'bibtex-mode) auto-mode-alist)) (autoload 'bibtex-mode "~/emacs/lisp/bibtex/bibtex" ;(autoload 'bibtex-mode "bibtex" "Enter BibTeX mode for bibliography editing." t nil) (setq bibtex-mode-hook '(lambda () (setq comment-end "") (setq comment-start "%% ") (setq comment-start-skip "%+ *") (setq bibtex-include-OPTcrossref nil) (setq bibtex-include-OPTkey nil) (setq bibtex-include-OPTannote nil) (setq bibtex-include-robnote t) (load "~/emacs/lisp/bibtex/bibtex-support") (load "~/emacs/lisp/bibtex/bibtools") ))
Note that these commands assume a subdirectory called emacs/lisp in which the require lisp code (.el or .elc files) is available.
There are some other fun software tools that can make life easier with BibTex. Most are in the public domain in one form or another and I have included links where I had them--if the links fail, use Google and please let me know (macleod@sci.utah.edu).
The free (with 300 MB storage) literature database program Zotero has support for Bibtex output. We are just (in 2023) coverting to Zotero so will learn a lot more soon!
EndNote is not really a program that works on BibTex files but it does manage citations well and it has some support for BibTex that can make it useful. It is likely the most widely used program og its type in science but seems like it might be losing ground to Zotero.
See endnote.html for more details on how to convert between Endnote and BibTex.
The goal of bibclean is to clean up syntax and layout errors in BibTex
files so that all entries have a nice, clean look that is consistent. The
program will also reveal some errors in the file, which can be very
helpful! To get bibclean, surf on over to
www.math.utah.edu/pub/bibclean/
and thank Nelson Beebe for making this available.
Here are some direct links that might be helpful
One of the many arguments to bibclean essential for SCI databases, if only because it is the convention we had adopted:
bibclean -no-fix-nameswhich I actually alias to bibclean so that I don't forget!
BibDesk is a Mac OSX program to edit and manage your bibliography. It will keep track of both the bibliographic information and the associated files or web links for you. Read more at bibdesk.sourceforge.net/.
JabRef is a new cross platform, open source program to edit and manage your bibliography. It performs searches and downloads articles (assuming they are open access) and seems to have a lot of customlization options. It claims to integrate well with many LaTeX systems/editors, including eXstudio, LyX, Kile, LatexEditor, Emacs, Vim, and WinEdt.
This is truly amazing! There is a website called hubmed.org that will convert from Word document text that you copy to the web page into Bibtex files! It actually works.
This program is some sort of search engine interface to Pubmed and it manages to parse the text and propose matches for each entry in the bibliography. I am really impressed with this tool!
There is a simple way to test a BibTex file for completeness using LATEX and the bibtex commands from your own computer. Testing is a good plan, especially if you do it after editing the file and not when you are in a hurry and have to build a document using the file.
To test a BibTex file, make a LaTeX file, call it testbib.tex with the following contents:
\documentclass[]{article} \begin{document} Some text. \nocite{*} \bibliography{sci} \bibliographystyle{unsrt} \end{document}where ``sci'' is the name of the BibTex file to test.
Then run
latex testbib bibtex testbiband the output will list all the errors or warnings resulting from trying to parse the file sci.bib. Some of the output will be warnings that you can ignore but other errors can be fatal the next time you use the file.