Using BibTeX

BibTeX operates with LaTeX to generate bibliographies in a TeX environment. There are a few things you should know about how BibTeX works before you start to build a bibliography to complement your beautiful LaTeX document. I can help with this with short paragraphs about what you need, and where I can't help, the rest of the internet can!  


Here are the titles of the four short information sections I think are relevant for building bibliographies in TeX documents using the natbib package (don't worry about the jargon here, I'll explain later). These topics may sound scary and foreboding! But never fear, you have me, a complete amateur, helping you. 


1. Building .bib files  


2. Files you'll need: .bst, .bib, .tex 


3. How to make the files talk to each other 


4. Citing in your LaTeX document 


***NOTE*** all of these have tl;dr sections for when you want the information but don't care about the explanation of why things are the way they are and/or want to avoid my writing style as much as possible (not offended)



Probably the first thing we should discuss is what a bib file is and what's even in there, right? A .bib file is essentially a document with a list of citations in it. ‚Äč Sometimes this is called a *~*~BibTeX library~*~*


 Here's what a typical citation looks like for a scientific article, but in BibTeX-speak: 


  author = {Allen, Cerisse E. and Zwaan, Bas J. and Brakefield, Paul  M.},
  title = {Evolution of Sexual Dimorphism in the Lepidoptera},
  journal = {Annual Review of Entomology},
  year = {2011},
  volume = {56},
  pages = {445--464},
  number = {1},
  month = {Jan}




***You will NEVER have to manually generate your own citations in BibTeX*** and if you actually ever do I'll eat my hat. We will get to the details of this later, but just trust me. Not the hat-eating, the auto-citing stuff! doy!


Right now, I'm gonna break down the anatomy of this "Allen11" entry for you just real quick 


Anatomy of the above BibTeX entry 


This capslock at thing at the beginning is telling the software the type of citation it's working with. Each citation entry type requires different information. Other citation types include "@INBOOK" for book chapters or "@Manual" for things like R packages etc. A full list of citation entry types can be found here



This is the citekey and it is SUPER IMPORTANT. It can be anything you want, and some softwares generate citekeys for you automatically. The citekey is the thing in your .tex document you will use to call this particular citation. Biggest note here: Citekeys must be unique!!! 


How to use the citekey is in Info Thingy Number 4. 


author = {Allen, Cerisse E. and Zwaan, Bas J. and Brakefield, Paul M.},

"author=" is saying "hey, TeX, this is the author field of the entry". The stuff in the curly brackets is saying that the author field should be filled with {this particular information}. Here, {this particular information} is the author names.


One thing to note about the author field is that names are listed as "Lastname, Firstname Initial AND Lastname, Firstname Initial AND Lastname, Firstname Initial" etc. 



The rest of this citation entry is pretty much "doy" status so I will not keep going (like, year={year published}, doy).


To generalize: The structure of entering the information you want into a bibtex entry (lol not that you'll ever need to but you should know this anyway) is a pretty simple formula:


field = {relevant information}


Finally, the fields you need to include in your tex citation are dictated by the entry type you're working with.  A full list of fields recognized by BibTeX can be found here.


Small anal retentive note: please do not forget the curly brackets or the commas.

Commas separate field types and curly brackets say where the information to use begins and ends.

Also: be sure that your bracket is closed at the end of your citation!





Basic Structure of a bibTeX citation



field1 = {information1},

field2 = {information2},

field3 = {information3},

field4 = {information4}



also, click here and here




***as promised***


Let's real quick talk about how to avoid manually creating a .bib file. What you'll need to do is export a BibTeX library using your citation manager.


You can export citations as .bib files pretty simply with these softwares--I've linked instructions for doing so where I could find them.  






Papers 2


I can personally speak to Papers *3*, which I think is great and super easy to use! But a cursory Google search indicates there are mostly only haters of the Papers x BibTeX relationship. We can talk about how to generate citekeys, BibTeX records, and BibTeX libraries in Papers 3 if you want.  


The final option you have if want to generate a .bib file is JabRef, which is a special case because its native language is TeX.


JabRef is free! and specifically designed to generate BibTeX libraries. It's super easy to use (basically: drag and drop your papers in, fill out info + add citekeys) and generates .bib files just as well as the other citation management softwares. Schwing!  



Okay, I would say that most of us are familiar with calling external file A for use in some way in document B, but let's review!


The easiest way to get documents A and B to talk to each other is to make them live in the same place. It's baaaasically the same principle as locking people who aren't talking to each other in a room until they DO talk to each other. This is the same when you're compiling a TeX document: make sure your .bib file (file you're calling) and .tex file (file you're writing) are located in the same working directory--AKA in the same folder. There's also another file that will have to be in there, the .bst file, which tells the software how to take the information from the .bib file and put it into the .tex file.


Note: The TeXshop software itself does *not* need to be in your working directory. It can just live on its own in any neigborhood because it is the overlord that talks to ALL tex documents and makes them do what it says. Spooky!



The files you will absolutely need to have in the same folder as your .tex file to get a bibliography going: 


I. DOT BIB (.bib): A file full of the references you want to ... reference.. in your document, formatted as in Info Thingy Number 1


II.  DOT TEX (.tex): The document that you're writing stuff into


III. DOT BST (.bst): A file telling LaTeX how to format your citations.


***xxxtra bOnUs*** Here is a super useful list of a bunch of different .bst files for a bunch of different EEB-related journals! You can download it as a .zip file



So, actually MAKING files talk to each other is not as easy as just sticking them in the same room together even though I may have painted it that way in Info Thingy Number Two. oop! In essence, what you need to do is make sure your files are properly named, you have the right packages in your preamble, and the command structure at the end of the .tex file is in order. 


Step 1:  Make sure your .bib and .tex document have the SAME EXACT NAME 


For example, if my .tex document is "aubrie_human_or_alien_a_review_of_the_facts.tex", then all of my citations for that manuscript (honestly sounds like a great read) will be in a dot bib document entitled "aubrie_human_or_alien_a_review_of_the_facts.bib" 


Step 2: Include a bibliography package in your preamble. The only one I use is called natbib, but I'm not going to tell you why because we would have to get into a bunch of different garbage about TeX environments and none of us want that (for now). In the preamble, the line of code will look like this




Step 3: Cite appropriately in your .tex document. There's a whole section on this coming up in Info Thingy Number 4! 


Step 4: After you've written all of the text you want to write for your manuscript, you need to call your bibliography in the .tex file. There is a particular order and syntax to this. Using my alien example:







Here, you see that I've told the program to start a new page using a \clearpage command.


Then, I told it the name of the .bib file my references for this manuscript are in using the \bibliography command. Notice the name of the bibliography without the '.bib' in the curly brackets.The software will know what you're talking about. 


Lastly, I used the \bibliographystyle command to call the .bst instructions. Remember, the .bst file is to format the citations just how you like them. In this case, I'm using a file called 'ecology.bst' to format my citations for submission to Ecology. Note that again, there is no '.bst' in the curly brackets for this command.



Step 1: .tex and .bib need the same name

Step 2: see Info Thingy 4

Step 3: syntax at the end is









Wow, look at how far we've come! So, by now, you should be ready to *actually* cite things in your tex document. Let's check out what we need to accomplish THE ULTimATE CitED DocuMenT


Okay, so let's just take a dummy example. In my "aubrie_human_or_alien_a_review_of_the_facts" document, I'll probably want to introduce the piece by talking about how humanoid reptilian aliens don't actually exist: 


Despite a growing body of literature suggesting the existence of an extraterrestiral reptilian elite holding powerful positions through time and space, the factual evidence for the reptilian hypothesis is scarce. 


I am going to foucs on citing the "growing body of literature" part of this sentence using these two citations: 


author = {Robertson, David G},
title = {{UFOs, Conspiracy Theories and the New Age}},
publisher = {Bloomsbury Publishing},
year = {2016},
series = {Millennial Conspiracism},
month = feb


author = {Icke, David},
title = {{The Biggest Secret}},
publisher = {AppLife},
year = {2014},
series = {The Book That Will Change the World (Updated Second Edition)},
month = jul


In my .tex document, this is how I would write my sentence with citations:  


Despite a growing body of literature suggesting the existence of an extraterrestiral reptilian elite holding powerful positions through time and space~\cite{Icke: 2014wa, Robertson:2016:vn}, the factual evidence for the Reptilian hypothesis is scarce. 


NOW, here's what's important about this "\cite{}" command when using natbib. It makes the citations look like this in the output: 


Despite a growing body of literature suggesting the existence of a Reptilian elite holding powerful positions through time and space Icke (2014), Robertson (2016), the factual evidence for the Reptilian hypothesis is scarce. 


Which is yucky looking! and doesn't make any sense with the sentence structure. What you gotta do is use...**drumroll please**


The right \cite command! There's a whole bunch that you can use to make your citations look like whatever you want them to look like in the output. Check the table out here on the wiki page (in the natbib section).


Basically, there's a whole bunch of different cite commands like \citet{} or \citep{} or \citealt{} that all do different things to the citation you're working with. 


SO, here's what the input would look like with the RIGHT cite command: 


Despite a growing body of literature suggesting the existence of an extraterrestiral reptilian elite holding powerful positions through time and space~\citep{Robertson:2016:vn, Icke: 2014wa}, the factual evidence for the Reptilian hypothesis is scarce. 


And the output: 


Despite a growing body of literature suggesting the existence of an extraterrestiral reptilian elite holding powerful positions through time and space (Icke, 2014; Robertson, 2016), the factual evidence for the Reptilian hypothesis is scarce. 




Cornell University

Department of Ecology and Evolutionary Biology

Created with

  • Twitter - Grey Circle
  • Instagram - Grey Circle