How to Reference in Latex – 7 Steps to Bibliography with BibTeX

How to Reference in Latex – 7 Steps to Bibliography with BibTeX

This post may contain affiliate links that allow us to earn a commission at no expense to you. Learn more

Want to learn how to Reference in Latex? Here are 7 Steps to Master Bibliography with BibTeX.

Adding references and citations to any document can be a time-consuming task. You may need to include a single reference multiple times and also ensure each one follows a consistent referencing style.

The good news is that LaTeX’s bibliography management tool BibTeX makes much of the work involved in reference management a breeze. This is because BibTeX bibliography entries are kept within a separate BibTeX database file that can be imported easily into your main document.

Some of the benefits of using BibTeX file for reference in LaTex include:

  • Having to type each reference only once
  • Achieving a consistent citation style throughout your document
  • Easily getting each item you cite to show up as a reference at the end of the document

In general, using bib file for referencing saves a lot of time. This makes it useful for researchers that need to cite or include a large number of references that are presented consistently in their document.

How to Add a Reference in LaTeX Bibliography Management

Adding a reference in a LaTex bibliography file, or bib file can seem intimidating at first. However, managing a bib file is a relatively simple and straightforward process once you understand the steps involved. We have broken down the procedure into 7 simple steps for this guide.

Step 1 – Begin Document – Making a LaTeX document

Begin document: Create an empty LaTeX document with “.tex” extension in your preferred LaTeX editor. This could be TeXstudio, ShareLaTeX, or Texmaker.

Step 2 – Creating a new reference bib file with “.bib” extension

Create a new empty file and rename it to “citation.bib”. 

The “bib” extension informs the LaTeX compiler that the bib file contains all the references for your document. Each of these files will be formatted in a particular style discussed in later steps.

Step 3 – Locating the paper to be cited in Google Scholar

The next step is to obtain your citation. Look for the paper you wish to cite in  Google Scholar. Once you have located the paper on Google Scholar’s search results, look for a set of inverted commas next to a star symbol. 

Step 4 – Obtaining the citation in BibTeX format for Reference in LaTex 

Select the inverted commas, and a window titled “cite” should appear. 

This Cite window will list a number of different citation styles such as MLA and APA. At the bottom of this window, there should be a set of hyperlinks for BibTeX, EndNote, RefMan, and RefWorks. Select BibTeX and your citation should appear in the following format:

@article{yaggi2006sleep,

  title={Sleep duration as a risk factor for the development of type 2 diabetes},

  author={Yaggi, H Klar and Araujo, Andre B and McKinlay, John B},

  journal={Diabetes care},

  volume={29},

  number={3},

  pages={657–661},

  year={2006},

  publisher={Am Diabetes Assoc}

}

You can also add a second citation by following the same steps for a second paper in Google Scholar.

@article{weitzman1982chronobiology,

  title={Chronobiology of aging: temperature, sleep-wake rhythms and entrainment},

  author={Weitzman, Elliot D and Moline, Margaret L and Czeisler, Charles A and Zimmerman, Janet C},

  journal={Neurobiology of aging},

  volume={3},

  number={4},

  pages={299–309},

  year={1982},

  publisher={Elsevier}

}

For these citations, “yaggi2006sleep” and “weitzman1982chronobiology” are referred to as the key of their respective papers. You can follow the above steps to add each reference you would like to cite in your document. Once this is complete, you can return to your main LaTeX file and cite your papers individually.

How to Call a Reference in LaTex Bibliography

Step 5 – Calling a LaTex Reference

Calling a reference in the LaTex bibliography is also quite straightforward. In a new line, you can type:

The references for the paper in our example are \cite{yaggi2006sleep} and \cite{weitzman1982chronobiology}.

Remember that the document keys are vital for citing each paper, so ensure you enter them correctly.

[Need example of what this looks like]

Step 6 – Managing and Creating Your Preferred LaTex Bibliography Styles

In the next line, you can choose your preferred bibliography style. For this example, we will be using IEEE referencing style. This is a numbered referencing bibliography style that uses citation numbers provided in square brackets in your document.

Type the following:

\bibliographystyle{ieeetr}

\bibliography{citation} 

You can also add references in the following bibtex styles by simply including the style code in place of ieeetr:

Plain

With this bibliography style, references are shown in alphabetical order and are labeled numerically. Use plain in the above code to add citations in this style.

Unsrt

References appear in order of citation and are labeled numerically. Use unsrt in the above code to add citations in this style.

Alpha

Same as plain, but the references are labeled by entry. Use alpha in the above code to add citations in this style.

Abbrv

Same as plain, but first names and journal names use abbreviations. Use abbrv in the above code to add citations in this style.

ACM

This style shows in-text citations as numbers enclosed in square brackets and separated with commas such as [1, 2]. Use acm in the above code to add citations in this style.

Step 7 – Compiling the Code for Reference in LaTex 

Next, compile and run your code. Your document will refresh a few times. You can then view the bibliography at the end of the LaTeX document. The references for our IEETR style example will show up as:

The references for this paper are [1] and [2]

[1] and [2] refer to the citations list at the end of the document.

For example:

Summary

The above steps are summarized as:

  1. Create an empty LaTeX document in the .tex extension.
  2. Create a new reference file in the .bib extension.
  3. Locate the paper, journal, or book to be cited in Google Scholar.
  4. Obtain the citation in BibTeX format
  5. Call the reference
  6. Select your citation style in LaTex.
  7. Compile the code in LaTex.

Additional Tips

As you can see, adding and calling references in LaTeX is a relatively straightforward process. Some tips to keep in mind when working with references in BibTeX and LaTeX include:

  • Running your .tex LaTeX file through LaTeX before running BibTeX as the latter program requires the auxiliary file produced by LaTeX.
  • Noting down the key for your paper, book, or journal properly as they will be vital for calling your reference in the bibliography.
  • Ensuring the code mentioned above is entered with the correct syntax to avoid any compilation errors in LaTex. 

Frequently Asked Questions

Q1: How do you reference equations in LaTeX?

You can reference equations in LaTeX by inserting a label in your equation with an “eqn:” prefix. A typical LaTeX equation resembles the following:
\begin{equation}
\label{eqn:somelabel}
e=mc^2
\end{equation}

Q2: What is Documentclass LaTeX?

The first line of code in a LaTeX document is referred to as the Documentclass declaration command. It resembles the following:
\documentclass[options]{class}
Documentclass informs LaTex about which layout standard to use. Some common document classes include:
article: For articles from scientific journals and presentations.
book: For books.
letter: For writing letters

Q3: How do you add references in LaTeX without citations?

If you wish to list references without citing them in the text body, you can add a single input using:
\nocite{keyname}
You can then mark any key within the .bib file by using:
\nocite{*}
Add this command for each entry in the bib data file or \nocite{key} for a single one that isn’t cited in the text.

Q4: How do you reference labels in LaTeX?

You can reference labels in LaTeX by placing a \label{key} command behind a sectioning command, chapter, or image. You should then assign a unique key to it. Following this, you can use \ref{key} and \pageref{key} commands to reference them.

Q5: How do you change the reference style in LaTeX?

You can change the reference style in LaTeX by altering the \bibliographystyle{ filename} line in your LaTeX document. Filename here should be replaced with your preferred reference style such as plain and ieeetr.

Q6: How do you cite all references in LaTeX?

You can cite all your sources by typing \citeall.

Q7: Where can you get more help with LaTex?

You can get more help with LaTeX by visiting https://en.wikibooks.org/wiki/LaTeX.

Further Reading

LaTex Tutorial

  1. 27 Pros and Cons of Using LaTex for Scientific Writing
  2. 6 easy steps to create your first Latex document examples
  3. How to add circuit diagrams in Latex
  4. How to change Latex font and font size
  5. How to create a Latex table of contents
  6. How to create footnotes in LaTeX and how to refer to them, using the builtin commands
  7. How to create Glossaries in LaTeX
  8. How to create plots in Latex – codes and examples
  9. How to create symbols in LaTeX – commands for Latex greek alphabet 
  10. How to create tables in LaTeX – rows, columns, pages and landscape tables
  11. How to drawing graphs in Latex – vector graphics with tikz
  12. How to highlight source code in LaTeX
  13. How to insert an image in LaTeX – Managing Latex figure and picture
  14. How to Itemize and Number List – Adding Latex Bullet Points
  15. How to make hyperlink in latex – Clickable links
  16. How to use Latex Packages with examples
  17. How to use LaTeX paragraphs and sections
  18. LaTeX Installation Guide – Easy to follow steps to install LaTex
  19. Learn to typeset and align Latex equations and math

Photo of author
Author
SJ Tsai
Chief Editor. Writer wrangler. Research guru. Three years at scijournal. Hails from a family with five PhDs. When not shaping content, creates art. Peek at the collection on Etsy. For thoughts and updates, hit up Twitter.

3 thoughts on “How to Reference in Latex – 7 Steps to Bibliography with BibTeX”

Leave a Comment