Skip to Main Content

LaTeX for Publications: Creating a Bibliography with BibTeX

BibTeX:Create a BibTeX File in Overleaf

BibTeX allows you to create a bibliography as a separate file. It also gives you greater control over the bibliography. It's really not much more difficult than a bibliography contained within your document. A full explanation of BibTeX can be found online in the LaTeX wikibook. Another good resource is the article by Claus O. Wilke: "How to not mess up your bibliographies with Bibtex."

BibTex files can be used with LaTeX documents, whether created with Overleaf or with some other editor. Using BibTex gives you increased control over how your bibliography will look. You can also use citation features of databases to produce the BibTex entries for you to simply copy/paste into your bibliography.
 
  1. Overleaf: New File icon
    At the top of the left side, click the New File icon.


     
  2. Type the filename for your BibTex file
    The Add Files window should open. Type the filename of your bibliography. Make sure it ends with the .bib file extension—in this example, the file is myrefs.bib.
     
  3. Click Create.
     
  4. You're now ready to start adding citations to your BibTeX file.

Link a BibTeX File to a Document

To use a BibTeX file with a LaTeX document, you need to add the natbib package, as well as a link. You can then cite any resource listed in the linked file, and it will appear in your list of references.
\usepackage{natbib} % Supports citation styles in BibTeX.
At the bottom of your LaTeX document, just above the \end{document} command, Insert the following
 \bibliographystyle{apalike} 
 \bibliography{myrefs} % To link the BibTeX file myrefs.bib
To cite a resource in the linked BibTeX file, we use the \cite command:
 JavaScript is a client-side language \cite{Sather21}...
The \cite command uses the writer-defined cite key which is at the top of each BibTeX entry. The cite key can be anything you want to use to identify each item in the file. The cite key is often the primary author's surname, followed by two digits to identify the publication year. Some use the first two names, followed by the date, to avoid confusion with common names or authors who may publish more than one article in a year:
 Logic errors can be much more difficult to find and correct
 in debugging than syntax errors
 \cite{WuSmith23}...
Note: Only those items from the BibTeX file which are cited in the LaTeX document will be included in the references list.

Creating a Bibliography File in BibTeX

A BibTeX file is a list of item descriptions. Here's an entry for an article: Each entry contains some important elements:

  • The entry begins with the entry type. There are many, to cover a variety of publications you may cite. They include: article, bookinproceeding (conference), manual, phdthesis, unpublished, as well as misc, and many more. An excellent, concise list of entries and field types in BibTeX has been posted by Andrew Roberts. It's only two pages and should be part of every BibTeX user's personal documentation.
  • A set of curly braces — { } — contain the rest of the citation.
  • The first thing in the brackets is the user-created cite key. This is generally the author's last name and a two digits for the year of publication. If you prefer, you can use any system that works for you.
  • Each element (field) of the BibTeX citation—except for the last one—ends in a comma.
  • The contents of the fields are shown her in double quotes. You could also use curly braces — { } — but the quotes generally make for a citation that's easier to read. The curly braces denote the beginning and end of the citation, and they can also be used to force capitalization of characters, such as:
    title = "Simple {J}ava{S}cript programming for web designers",

Here a two sample citations in BibTeX:

@article{klaren17,
  author = "Alexandra C. Klarén",
  title = "Won’t You Be My Neighbor?",
  year = "2017",
  journal = "Communication Quarterly",
  volume = "65",
  number = "1",
  pages = "60--79"
}

@book{milne31,
  author = "Milne, A. A.",
  title = "Winnie-the-Pooh",
  year = "1931",
  publisher = "McClelland \& Stewart",
}

Note: Best practice is to remove any "empty" fields or fields that are not used by your chosen style guide. For example, if using APA style—which does not include a place of publication for book references—you should remove the address field from any @book entries.

Citing BibTeX References in Your Document

Citing an article, book or other reference from a linked BibTeX file is easy in LaTeX, using the \cite command and the unique cite_key that you assigned to each item in your bibliography. It's similar to citing a reference in a basic bibliography, but with one important difference:
When using citations in a linked BibTeX file, only those cited within the text of the LaTeX document will appear in the list of References.
First-time programmers can face challengers when learning computer logic \cite{thompson25}.
It's also possible to refer to a specific page in a citation, by adding the argument in the following example:
The BASIC programming language was created at Dartmouth College in 1964 \cite[p.~36]{french75}.
The above commands would appear like this in the document:
First-time programmers can face challengers when learning computer logic [Thompson, 2025].

The BASIC programming language was created at Dartmouth College in 1964 [French, 1975, p. 36].
Staff LADR