Skip to Main Content

BibTeX for LaTeX

This guide provides a brief overview of managing references in LaTeX using BibTeX. Follow the instructions to integrate BibTeX into your LaTeX documents, allowing you to cite sources and generate bibliographies.

Citing and referencing with BibTeX

Why use BibTeX?

  • Once stored in a BibTeX file, a reference can be re-used in future documents
  • You may choose to maintain one master .bib file or seperate .bib files for different projects
  • Many databases and reference management software (Zotero, EndNote, RefWorks) allow the automatic export of reference details as BibTeX files (in some cases, bulk export of multiple references is possible)

Basic structure of a BibTeX file

A BibTeX file (.bib) is a plain text file containing a list of entries, each representing a different reference. Individual entry begins with an entry type (such as @article, @book, @inproceedings, etc.), followed by a unique key and other fields like author, title, year, etc.

Common entry types:

  • @article - Journal articles

  • @book - Books

  • @inproceedings- Conference papers

  • @misc - Websites or other materials

Example .bib file entry


@article{goel_using_2017,
    title = {Using {AI} to teach {AI}: lessons from an online {AI} class},
    volume = {38},
    number = {2},
    urldate = {2023-11-28},
    journal = {Ai Magazine},
    author = {Goel, Ashok K. and Joyner, David A.},
    year = {2017},
    pages = {48--59},    
    url = {https://ojs.aaai.org/aimagazine/aimagazine/article/2732},
}

 

An example of a .bib file entry

 

 

 

 

 

 

 

 

 

 

 

Preparing your BibTeX file

When generating your BibTeX file, whether exporting from a database, journal website, or reference manager, you may encounter formatting issues that cause LaTeX compilation errors or incorrect reference output.

  • Special LaTeX characters: characters like %, $ and & included in your .bib file can cause errors during LaTeX compilation. Use your LaTeX editor to find and replace these, e.g. replace & with \&, replace % with \%

  • Unnecessary fields: imported entries often include unnecessary fields (e.g. notes, abstract) that can clutter your references and unintentionally appear in your reference list (particularly the notes field). Solutions:

    • Remove or comment out unnecessary fields in your .bib file (add a percentage sign "%" in front of the field to change it into a comment).

    • In RefWorks, use the bulk edit feature to clear specific fields before exporting.

    • In Zotero, untick the notes field option when generating the BibTeX file.

  • Retaining capitalisation: some bibliographic styles strip out capitalisation in fields such as the title. This can be problematic if the title contains acronyms. To fix this issue, edit the BibTeX file and enclose the specific text in curly brackets e.g. title={Study of incompressible {MHD} flow in a circular pipe}.