Skip to Main Content

Math Majors’ Seminar

Suggestions for researching the literature in mathematics.

LaTeX and BibTeX

LaTeX (pronounced "lay-tech") is a "document preparation system".  It is used often in mathematics and computer science and is especially adept at handling the presentation of complex mathematical equations.

BibTeX (pronounced "bib-tech") is an extension of LaTeX that allows you to manage cited references in a LaTeX system.  

To use BibTeX, you need additional elements in your LaTeX project, including:

  • .bib file that includes records for all of your citations. The .tex file refers to the .bib file to get information for in-line citations and the list of references.
  • Each record in the .bib file is identified by the type of source followed by a unique name.
    • For example, @article{Jones2015 is a journal article and will be formatted accordingly, @book{Smith2015 is a book, etc.
  • Within the .tex file, use the command \cite to indicate in-line citations. The \cite references records in the .bib file by the unique names.
    • The above examples would be cited with \cite{Jones2015} and \cite{Smith2015}
  • The .sty file (referenced in the .tex file by \usepackage) includes options for formatting in-line citations. Search the .sty file for \citationstyle to find the available citation styles. In the example below, harvard.sty includes citation styles called agsm and dcu.
  • Towards the end of the .tex file, use the command \bibliographystyle to indicate the style for the bibliography or works cited.
  • Then use the command \bibliography to reference the .bib file containing your citations.

You can find examples of these elements in the template file linked in the next box below.

Note: the basic \cite{record_name} command produces a default in-line citation according to the style, usually an author-date reference. For other varieties of in-line citations, such as using just the date (because the author's name is mentioned in the sentence), listing one or more authors, or including several citations at the end of a sentence, see this tip sheet.

Citation Activity

Set up a LaTeX template with BibTeX features:

1) Download the file bibtex.zip linked above. Save it to the desktop for easy access.

2) Sign in to Overleaf.

3) Upload template files:

     a) Click the arrow icon button just to the right of the New Project button.

     b) Select Upload Zip.

     c) Click and drag bibtex.zip from the desktop to the upload box.

     d) Now you have a project with three files: a .sty (style) file, a .tex file (your main text), and a .bib file (your list of references)

5) Make it yours:

     a) Select template.tex. Go to Line 10. Replace Your Paper with a title.

     b) Go to Line 12. Replace You with your name.

Add a record:

6) Find a citation to use:

     a) Go to Google Scholar.

     b) Search for an article or a topic. Example: "data analysis" and "social networking" and sports.

     c) Identify an article you can use.

7) Copy the record in BibTeX format:

     a) Click on the article's Cite link. Select BibTeX. A BibTeX record will appear on-screen.

     b) Select and copy the entire record.

8) Add the record to the project:

     a) Click back to project in Overleaf. Select the references.bib file. Scroll to the end.

     b) Paste the record into the .bib file.

     c) Note the publication type (after the @ symbol) and the name of the record (after the first {).

     d) Edit the name if necessary to make it unique and consistent.

Cite it:

9) Select the template.tex file. Add a new sentence into the body of the text.

10) At the end of the sentence, type \cite{ then begin to type the name of the new record you just added. Overleaf should auto-complete the name for you. Select the appropriate auto-complete selection.

And you're done! Wait until the document refreshes a few times. A reference for a new citation should appear in the References list.

Details

Important details in the .tex file:

An example of a record in the .bib file: