Skip to Main Content

Getting Started with LaTeX

LaTeX is a typesetting program useful for mathematical and scientific writings or publications. This guide provides an overview of how to get started with LaTeX, as well as resources and exercise to help new users of the program.

Introduction

Since LaTeX is often used to create academic works that will cite many different sources it is important to know how to create a bibliography in LaTeX.  With a little practice and the help of a citation management creating LaTeX bibliographies can be very easy. 

It is strongly recommend that you use a citation management tool, not only to help create LaTeX bibliographies, but to help organize and track articles, books, and other documents throughout your academic career.  For more information about citation management tools take a look at the Citation Management Guide.

Important note: When creating a bibliography you will need to compile the document twice in order to create properly formatted references.

Creating a Bibliography

There are two parts to creating a bibliography in a LaTeX document.  

Part one is the creation of a separate .bib file.

This file contains all of the citation information (i.e. title, author, publication date, publisher, etc... ), as will as, a bibID for each citation.  It is strongly recommended to use a citation management tool to create your .bib files.  Those tools will greatly speed up the process and help keep the file organized, generate automatic bibIDs (which can be edited if desired), and auto fill all relevant data fields which will prevent typos or bugs within the file.  Below is an example of the .bib format for four different common references if you choose to entire them yourself.  Note that not all fields are required and any unused field should be deleted.  The bibID is what is used in the main LaTeX document to create in-line references as well as completed bibliographies.  When creating the final bibliography LaTeX will only include citations that were referenced in the document, so its ok to have unused citations in your .bib file.

Article Book Online Resource Conference Proceeding
@article{bibID,
    author = {author},
    title = {title},
    journaltitle = {journaltitle},
    date = {date},
    OPTtranslator = {translator},
    OPTannotator = {annotator},
    OPTcommentator = {commentator},
    OPTsubtitle = {subtitle},
    OPTtitleaddon = {titleaddon},
    OPTeditor = {editor},
    OPTeditora = {editora},
    OPTeditorb = {editorb},
    OPTeditorc = {editorc},
    OPTjournalsubtitle = {journalsubtitle},
    OPTissuetitle = {issuetitle},
    OPTissuesubtitle = {issuesubtitle},
    OPTlanguage = {language},
    OPToriglanguage = {origlanguage},
    OPTseries = {series},
    OPTvolume = {volume},
    OPTnumber = {number},
    OPTeid = {eid},
    OPTissue = {issue},
    OPTmonth = {month},
    OPTpages = {pages},
    OPTversion = {version},
    OPTnote = {note},
    OPTissn = {issn},
    OPTaddendum = {addendum},
    OPTpubstate = {pubstate},
    OPTdoi = {doi},
    OPTeprint = {eprint},
    OPTeprintclass = {eprintclass},
    OPTeprinttype = {eprinttype},
    OPTurl = {url},
    OPTurldate = {urldate},
}
@book{bibID,
    author = {author},
    title = {title},
    date = {date},
    OPTeditor = {editor},
    OPTeditora = {editora},
    OPTeditorb = {editorb},
    OPTeditorc = {editorc},
    OPTtranslator = {translator},
    OPTannotator = {annotator},
    OPTcommentator = {commentator},
    OPTintroduction = {introduction},
    OPTforeword = {foreword},
    OPTafterword = {afterword},
    OPTsubtitle = {subtitle},
    OPTtitleaddon = {titleaddon},
    OPTmaintitle = {maintitle},
    OPTmainsubtitle = {mainsubtitle},
    OPTmaintitleaddon = {maintitleaddon},
    OPTlanguage = {language},
    OPToriglanguage = {origlanguage},
    OPTvolume = {volume},
    OPTpart = {part},
    OPTedition = {edition},
    OPTvolumes = {volumes},
    OPTseries = {series},
    OPTnumber = {number},
    OPTnote = {note},
    OPTpublisher = {publisher},
    OPTlocation = {location},
    OPTisbn = {isbn},
    OPTchapter = {chapter},
    OPTpages = {pages},
    OPTpagetotal = {pagetotal},
    OPTaddendum = {addendum},
    OPTpubstate = {pubstate},
    OPTdoi = {doi},
    OPTeprint = {eprint},
    OPTeprintclass = {eprintclass},
    OPTeprinttype = {eprinttype},
    OPTurl = {url},
    OPTurldate = {urldate},
}
@online{bibID,
    ALTauthor = {author},
    ALTeditor = {editor},
    title = {title},
    date = {date},
    url = {url},
    OPTsubtitle = {subtitle},
    OPTtitleaddon = {titleaddon},
    OPTlanguage = {language},
    OPTversion = {version},
    OPTnote = {note},
    OPTorganization = {organization},
    OPTdate = {date},
    OPTmonth = {month},
    OPTyear = {year},
    OPTaddendum = {addendum},
    OPTpubstate = {pubstate},
    OPTurldate = {urldate},
}
@proceedings{bibID,
    editor = {editor},
    title = {title},
    date = {date},
    OPTsubtitle = {subtitle},
    OPTtitleaddon = {titleaddon},
    OPTmaintitle = {maintitle},
    OPTmainsubtitle = {mainsubtitle},
    OPTmaintitleaddon = {maintitleaddon},
    OPTeventtitle = {eventtitle},
    OPTeventdate = {eventdate},
    OPTvenue = {venue},
    OPTlanguage = {language},
    OPTvolume = {volume},
    OPTpart = {part},
    OPTvolumes = {volumes},
    OPTseries = {series},
    OPTnumber = {number},
    OPTnote = {note},
    OPTorganization = {organization},
    OPTpublisher = {publisher},
    OPTlocation = {location},
    OPTmonth = {month},
    OPTisbn = {isbn},
    OPTchapter = {chapter},
    OPTpages = {pages},
    OPTpagetotal = {pagetotal},
    OPTaddendum = {addendum},
    OPTpubstate = {pubstate},
    OPTdoi = {doi},
    OPTeprint = {eprint},
    OPTeprintclass = {eprintclass},
    OPTeprinttype = {eprinttype},
    OPTurl = {url},
    OPTurldate = {urldate},
}

Part two is integrating the information from the.bib file into your main LaTeX document.  

The three ways for doing so are using BibTex, BibTex with natbib, or BibLaTeX.  The hyperlinks will take you to explanation of each method from sharelatex.com.  Both BibTex with natbib and BibLaTeX have the advantage of optional arguments because they require a \usepackage[]{} command.  These optional arguments can be used to fine tune how references appear throughout the document and the formatting of the bibliography.  Below is a table that highlights some of the important difference for each method.  

  BibTex BibTex with natbib BibLaTeX

Packages 

Needed

None natbib biblatex

In document

command 

for citation

\cite{bibID} \cite{bibID} \cite{bibID}

Bibliography

styles

Use command (place in body):

\biblographystyle{stylename}

Common Stylenames:

abbrv    
acm
alpha
apalike    
ieeetr    
plain    
siam    
unsrt

Use command (place in preamble): 

\biblographystyle{stylename}

Common Stylenames:

dinat
humannat    
plainnat    
abbrvnat    
unsrtnat    
rusnat    
ksfh_nat

Optional Argument

of \usepackage:

\usepackage[
style=stylename,
]{biblatex}

Common Stylenames:

numeric    
alphabetic    
authoryear    
authortitle    
verbose    
reading    
draft    

Print bibliography

command

\bibliography{bibfilename}

DO NOT INCLUDE .bib

\bibliography{bibfilename}

DO NOT INCLUDE .bib

\printbibliography