Skip to Main Content
library logo banner

Referencing in Overleaf: Getting started

A guide to referencing in the LaTeX-based Overleaf system.

Getting started

Creating a bibliography file

In Overleaf, select ‘New file’ from the File menu, or use the ‘New file’ button (a document with a plus sign) at the top of the file tree. In the dialogue box that appears, change the file name to one that ends in ‘.bib’, for example ‘bibliography.bib’, then select ‘Create’ to create the file.

"Add files" dialogue box, with "bibliography.bib" as the file name to create.

You will use this file to collect information about the works you reference in your document.

Choosing a referencing system

There are two main referencing systems you can use in your Overleaf project.

  • BibLaTeX is a modern package with a powerful set of features. It can cope with a wide variety of resource types and languages, it is easy to customise, and you should be able to switch styles without changing your bibliography file. When using BibLaTeX, your bibliography will normally be processed by a program called Biber.
  • BibTeX is the traditional program used with LaTeX for referencing. It supports fewer resource types, doesn't handle special characters very well, and it is hard to customise styles; you may also need to change your bibliography file if you switch styles. On the other hand, journals that accept LaTeX submissions usually want you to use BibTeX rather than BibLaTeX.

They work in very similar ways, so you can switch between them if you need to, but it does require some effort.

Choosing a referencing style

Overleaf comes loaded with most of the BibLaTeX styles on CTAN. To use a style not already included, or a newer version of an included style, upload the style's files to your project; there will be normally be at least a BBX file and CBX file, but there may also be a DBX file and several LBX files.

While not essential, we recommend you load babel and csquotes before loading biblatex:

\usepackage[british]{babel}
\usepackage{csquotes}

To select a style, pass it as an option to the biblatex package. You can select the bibliography and citation styles separately using the bibstyle and citestyle options, or set them both at once with the style option. For example, to use a style that follows the IEEE guidelines, you would load biblatex in your preamble as follows:

\usepackage[style=ieee]{biblatex}

Adding your bibliography file

You need to tell Biblatex where to find your bibliography data. In your preamble, write the \addbibresource command following by the full name of your bibliography file in curly braces. For example, if you've saved information about your references in bibliography.bib, you would write the following:

\addbibresource{bibliography.bib}

You can add several files in this way, if you find it convenient to split the information into different files.

Printing the reference list

At the point where you want the reference list to appear, write the following command:

\printbibliography

This will automatically add a section or chapter heading for you. If you need to modify this heading, consult the BibLaTeX manual for details as some changes are easier than others to achieve. For example, if you just need to change the heading text to ‘Works cited’, you can do this by passing an option to the \printbibliography command:

\printbibliography[title={Works cited}]

Using Harvard (Bath) Style

The Harvard (Bath) style is included in Overleaf, so you can use it directly. If the version in Overleaf is too old, you can download the latest release of biblatex-bath from GitHub, extract the BBX, CBX, DBX and LBX files, and upload them to your project.

If you cite several sources at once, BibLaTeX can automatically sort them in your text. The Harvard (Bath) style has this facility switched on, but for it to work properly, you need to use a few more commands. If your bibliography file is bibliography.bib, you would write this in your preamble:

\usepackage[style=bath,sorting=ynt]{biblatex}
\assignrefcontextentries[]{*}
\addbibresource{bibliography.bib}

That will make sure your citations are sorted according to year, then author, then title.

Then, where you want to print your reference list, write the following:

\newrefcontext[sorting=nyt]
\printbibliography

That will make sure your references are sorted according to author, then year, then title.

Choosing a referencing style

Overleaf comes loaded with most of the BibTeX styles on CTAN. To use a style not already included, or a newer version of an included style, upload the corresponding BST file to your project.

Some styles are designed to be used with BibTeX alone, while others are designed to be used with a support package. Most packages of this kind only support one style, but there is one called natbib that supports many different styles. Check the documentation of your chosen style to see if you need to load a support package in your preamble.

To select the style, give the name of the BST file (without the ‘.bst’ extension) in curly braces after the \bibliographystyle command. For example, to use the ieeetr.bst style, you would write the following:

\bibliographystyle{ieeetr}

You can include this command anywhere in your document. If your style requires a support package, we recommend putting the command in your preamble, just after loading the package. Otherwise, another good place is just before you print your reference list.

Using Harvard (Bath) Style

The Harvard (Bath) style is included in Overleaf, so you can use it directly. If the version in Overleaf is too old, you can download the latest release of bath-bst from GitHub, extract the BST file you want, and upload it to your project.

The style is designed to work with natbib, so to format your citations properly you need to add the following lines in your preamble:

\usepackage{natbib}
\setcitestyle{yysep={;}}
\setlength{\bibhang}{0pt}

If you will be including long URLs in your references, you will need either the url or hyperref package so the URLs can break across lines:

\usepackage{url}

There are two versions of the style, bath and bathx. We recommend using bathx (‘Bath extended’) as it automates more of the Harvard (Bath) style for you. As usual, you can specify the style anywhere in the document:

\bibliographystyle{bathx}

Printing the reference list

At the point where you want the reference list to appear, write the \bibliography command followed by the name of your bibliography file in curly braces. You don't need to include the .bib extension. For example, if you've saved information about your references in bibliography.bib, you would write the following:

\bibliography{bibliography}

This will automatically add a section or chapter heading for you. If you need to modify this heading, the best way to do it will depend on the document class and packages you are using. For example, if you are using the article document class and need the heading to say ‘Works cited’, you can normally do this by renewing the \refname command:

\renewcommand{\refname}{Works cited}