Tag Archives: Bibtex

bib2tex: Converting bibtex to bibitems

A friend asked me today to help him convert a bibtex-file to a \LaTeX bibliography (\bibitem{}), since the journal he submits his paper to doesn’t accept bibtex-files (*.bib). So what we were trying to do is to convert a set of bibtex-references of the following form (from cell):

@article{bartel2009,
	Author = {Bartel, David P. },
	Date = {2009/01/23},
	Journal = {Cell},
	Month = {01},
	Number = {2},
	Pages = {215--233},
	Title = {Micro{RNA}s: Target Recognition and Regulatory Functions},
	Volume = {136},
	Year = {2009}}

to a format that \LaTeX understands, e.g.:

\bibitem[Bartel(2009)]{bartel2009}
David~P. Bartel.
\newblock Micro{RNA}s: Target recognition and regulatory functions.
\newblock \emph{Cell}, 136\penalty0 (2):\penalty0 215--233, 01 2009.

There is an easy way of converting references by making use of the bibtex-command. It does exactly what we needed in the background. Typesetting the document once (latex) and generating the references with the bibtex-command will create a metafile called “document.bbl”, containing all the referenced bibitems in \LaTeX-format.

tom@texblog:~$ latex document
tom@texblog:~$ bibtex document

Finally, just copy and paste the content of the *.bbl file into the \LaTeX document, overwriting \bibliography{<document>}.

Note: The bibitem above was created using:

\usepackage[numbers, square, comma, sort&compress]{natbib}

Source: fundamentalthinking.


How to use Bibtex as a reference library for Latex

Having all your references in a BibTeX-file (*.bib) is more convenient for reusage than typing or copy the whole list of references everytime you are writing a new book, report or article. Therefore, it is worth to learn how to use BibTeX from the beginning, it will save you a lot of time…

BibTeX offers a whole list of entry fields, entry types and different bibliography styles.
Entry fields (standard):

  • address: Publisher’s address (usually just the city, but can be the full address for lesser-known publishers)
  • annote: An annotation for annotated bibliography styles (not typical)
  • author: The name(s) of the author(s) (in the case of more than one author, separated by and)
  • booktitle: The title of the book, if only part of it is being cited
  • chapter: The chapter number
  • crossref: The key of the cross-referenced entry
  • edition: The edition of a book, long form (such as “first” or “second”)
  • editor: The name(s) of the editor(s)
  • eprint: A specification of an electronic publication, often a preprint or a technical report
  • howpublished: How it was published, if the publishing method is nonstandard
  • institution: The institution that was involved in the publishing, but not necessarily the publisher
  • journal: The journal or magazine the work was published in
  • key: A hidden field used for specifying or overriding the alphabetical order of entries (when the “author” and “editor” fields are missing). Note that this is very different from the key (mentioned just after this list) that is used to cite or cross-reference the entry.
  • month: The month of publication (or, if unpublished, the month of creation)
  • note: Miscellaneous extra information
  • number: The “number” of a journal, magazine, or tech-report, if applicable. (Most publications have a “volume”, but no “number” field.)
  • organization: The conference sponsor
  • pages: Page numbers, separated either by commas or double-hyphens
  • publisher: The publisher’s name
  • school: The school where the thesis was written
  • series: The series of books the book was published in (e.g. “The Hardy Boys”)
  • title: The title of the work
  • type: The type of tech-report, for example, “Research Note”
  • url: The WWW address
  • volume: The volume of a journal or multi-volume book
  • year: The year of publication (or, if unpublished, the year of creation)

Entry fields (non-standard):

  • affiliation: The authors affiliation.
  • abstract: An abstract of the work.
  • contents: A Table of Contents
  • copyright: Copyright information.
  • ISBN: The International Standard Book Number.
  • ISSN: The International Standard Serial Number. Used to identify a journal.
  • keywords: Key words used for searching or possibly for annotation.
  • language: The language the document is in.
  • location: A location associated with the entry, such as the city in which a conference took place.
  • LCCN: The Library of Congress Call Number.
  • mrnumber: The Mathematical Reviews number.

In addition, each entry contains a key that is used to cite or cross-reference the entry. This key is the first item in a BibTeX entry, and is not part of any field.

Entry types:

  • @article

An article from a journal or magazine.
Required fields: author, title, journal, year
Optional fields: volume, number, pages, month, note, key

  • @book

A book with an explicit publisher.
Required fields: author/editor, title, publisher, year
Optional fields: volume, series, address, edition, month, note, key

  • @booklet

A work that is printed and bound, but without a named publisher or sponsoring institution.
Required fields: title
Optional fields: author, howpublished, address, month, year, note, key

  • @conference

The same as inproceedings, included for Scribe (markup language) compatibility.
Required fields: author, title, booktitle, year
Optional fields: editor, pages, organization, publisher, address, month, note, key

  • @inbook

A part of a book, which may be a chapter (or section or whatever) and/or a range of pages.
Required fields: author/editor, title, chapter/pages, publisher, year
Optional fields: volume, series, address, edition, month, note, key

  • @incollection

A part of a book having its own title.
Required fields: author, title, booktitle, year
Optional fields: editor, pages, organization, publisher, address, month, note, key

  • @inproceedings

An article in a conference proceedings.
Required fields: author, title, booktitle, year
Optional fields: editor, pages, organization, publisher, address, month, note, key

  • @manual

Technical documentation.
Required fields: title
Optional fields: author, organization, address, edition, month, year, note, key

  • @mastersthesis

A Master’s thesis.
Required fields: author, title, school, year
Optional fields: address, month, note, key

  • @misc

For use when nothing else fits.
Required fields: none
Optional fields: author, title, howpublished, month, year, note, key

  • @phdthesis

A Ph.D. thesis.
Required fields: author, title, school, year
Optional fields: address, month, note, key

  • @proceedings

The proceedings of a conference.
Required fields: title, year
Optional fields: editor, publisher, organization, address, month, note, key

  • @techreport

A report published by a school or other institution, usually numbered within a series.
Required fields: author, title, institution, year
Optional fields: type, number, address, month, note, key

  • @unpublished

A document having an author and title, but not formally published.
Required fields: author, title, note
Optional fields: month, year, key

[Source: http://en.wikipedia.org/wiki/BibTeX]

Example bibliography entry in bib-file:

@article{zhou2005ada,
title = {Adaptive Successive Erosion-based Cell Image Segmentation for p53 Immunohistochemistry in Bladder Inverted Papilloma.},
author={Zhou, H. and Mao, K.},
journal={Conf Proc IEEE Eng Med Biol Soc},
volume={6},
year={2005},
}

Cross-referencing:

It is possible to cross-reference different entries by using the crossreference field, e.g. crossref = {zhou2005ada},

Usage in Latex:

Using your BibTeX-file in Latex is done by specifying a style: \bibliographystyle{style} as well as the bib-file \bibliography{filename1, filename2} (without the bib-extension, just the name). The most commonly used styles are: plain, acm, ieeetr, alpha, abbrv, siam.

Many other styles are available, see here for an extensive list.

PDF generation:

Generating your PDF is a bit of a hassle, as you have to run Latex several times, you need to run the following series of commands:

  1. latex input-file : complains about undefined citations
  2. bibtex input-file : generates a bbl-file
  3. latex input-file : complains about undefined citations
  4. latex input-file

You will have to repeat the procedure every time you add or remove citations, as they will imply changes in the bbl-file.

Note:

  • If you have been using Endnotes so far and want to switch to LaTeX/BibTeX, you won’t need to retype you whole references-database again. It is possible to create a BibTeX-references file from your library in Endnotes.
  • Always look for bibtex-entries on the web. You can sometimes find them in article libraries or on the web page of the authors. They are complete and will save you a lot of time searching and typing the data.

Mulitple reference citation

Recently, I was wondering how to cite multiple references at once, e.g. [1, 5, 9] or even [1-3, 6, 8]. It took me quite some time to find a solution on the web, which is one of the reasons I am posting this article here.

The solution is astonishingly easy. If you want to cite multiple references within the same brackets, you just need to separate the labels with a comma. In addition, cite will automatically check if your labels are part of an ordered list and reduce the list by replacing all the “in-betweens” with a hyphen.


Follow

Get every new post delivered to your Inbox.

Join 316 other followers