BibTeX

bibtex-mode, contained in bibtex.el file, is a major mode for editing and validating BibTeX `.bib’ files. It is part of GnuEmacs, and is included in XEmacs. Current bibtex.el maintainer is Roland Winkler.

BibTeX `.bib’ files contain bibliographical information. Below is an example of one entry in such `.bib’ BibTeX database file:

    @Article{Aamport:1986a,
       author  = "L[eslie] A. Aamport",
       title   = "The Gnats and Gnus Document Preparation System",
       journal = "{G-Animal's} Journal",
       year    = "1986",
       volume  = "41",
       pages   = "73",
    }

Here's a patch to bibtex-autokey that implements a key format commonly used on CEUR-WS (e.g. see http://ceur-ws.org/Vol-1032/CSP2013.bib). It uses crossref instead of year: eg Alexiev:TPDL2012 instead of Alexiev:2012

Besides bibliographical information `.bib’ files might contain definition of shortcuts used in bibliographical entries via @STRING definition, comments via @COMMENT, and code to include at the beginning of created `.bbl’ bibliography file (see below) via @PREAMBLE command.

bibtex(1) program (command) creates a printable bibliography (`.bbl’) file from references in a `.aux’ file, generally written by TeX or LaTeX. References are generated by \cite and \nocite commands or their equivalents. The `.bbl’ file is then incorporated on a subsequent TeX or LaTeX run. The basic bibliographic information comes from `.bib’ files (specified in \bibliography command) and a BibTeX style (`.bst’) file (specified in \bibliographystyle command) controls the precise contents of the `.bbl’ file.

RefTeX helps with inserting citations from `.bib’ BibTeX database file in TeX or LaTeX document. Typing `C-c [' (‘reftex-citation’) will let you specify a regular expression to search in current BibTeX database files or thebibliography environment. The selected article is referenced as \cite{key} (or equivalent).

There is Lisp:bst-mode.el for editing `.bst’ BibTeX style files. BibTeX style files are written in BAFLL (BibTeX Anonymous Forth-Like Language). You can create your own `.bst’ files using custom-bib LaTeX package, answering questions about how bibliographical entries should be formatted.

There is also a BibTeX database manager for Emacs, Ebib, which can be used as an alternative to editing `.bib’ files directly.

Another alternative for working with BibTeX files is Nelson Beebe’s bibtools.el. This is an add-on to the standard bibtex-mode with many helper functions, which are useful when maintaining a set of `.bib’ files. To use it, you will also need the files bibtex-keys.el bibtex-misc.el, bibtex-mods.el, clsc.el, clsc20.el, isbn.el, ltxaccnt.el from the same site. One of the many possible uses of this package is to find and eliminate duplicate entries (this is often necessary after you have merged the results from several bibliographic searches of online databases).

bibtex.el doen’t contain a good means to handle keywords. So, Bastien Guerry wrote this wonderful Lisp:bibtex-utils.el add-on when I was asking how people handle bibtex keywords on the help.gnu.emacs list. The function bibtex-make-field-keywords scans the extent keywords in a bib file and allows the user to enter keywords with auto-completion. bibtex-select-entries starts a RegExp? search for all entries containing a certain keyword.

If your keywords are actually multi-word phrases, they may be split over two lines. bibtex-utils.el can be modified to account for this with the following replacement version of bibtex-collect-keywords-values. This version is noticeably slower (approx. 1 second delay for me):

    (defun bibtex-collect-keywords-values (&optional regexp)
      "Collect values in keywords fields of all BibTeX entries.
    Maybe restrict the values to those matching REGEXP. Modified from
    original by TWS to remove newlines/multiple spaces within keyword
    entries. This slows down invocation slightly, but makes more
    sensible keywords."
      (interactive)
      (save-excursion
        (goto-char (point-min))
        (let (keywords kstring)
          (while (re-search-forward "^\\s-*keywords.*{\\([^}]+\\)}" nil t)
    	(setq kstring (replace-regexp-in-string "[ \t\n]+" " " (match-string 1)))
    	(mapc
    	 (lambda (v) 
    	   (if regexp (if (string-match regexp v) 
    			  (add-to-list 'keywords v t))
    	     (add-to-list 'keywords v t)))
              (split-string kstring ",[ \n]*\\|{\\|}" t)))
          keywords)))

Hannes Mehnert developed a bibtex-kindle add-on, which adds a custom field with the path to a pdf - to which title and author metadata is added - and uses keywords and journal/booktitle to create collections


One of the replacements for BibTeX is Bibulus. It is written in Perl, and uses XML format for storing bibliographics database entries. – http://www.nongnu.org/bibulus/

Another project which uses XML as database format is BibTeXML. It uses Python and XSLT. – http://bibtexml.sourceforge.net/


CategoryModes CategoryTex