Skip to Main Content

LaTeX for Publications: Creating a Bibliography with BibTex

BibTex: Getting Started with 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.

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 a link. You can then cite any resource listed in the linked file. 

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.

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 = "{T}he {A}rt of {C}omputer {P}rogamming {V}olume {I}: {F}undamental {A}lgorithms",

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,
  title = "Winnie-the-Pooh",
  year = "1931",
  publisher = "McClelland \& Stewart",
  address = "Toronto"
}
Staff LADR