Bibliography management with bibtex
LaTeX supports bibliographies out of the box, either embedding the references in your document or storing them in an external file. This article explains how to manage bibliography with the thebibliography
environment and the BibTeX system.
Note: If you are starting from scratch it's recommended to use biblatex since that package provides localization in several languages, it's actively developed and makes bibliography management easier and more flexible.
Introduction
Standard bibliography commands in LaTeX have a similar syntax to that of lists and items.
\begin{thebibliography}{9}
\bibitem{latexcompanion}
Michel Goossens, Frank Mittelbach, and Alexander Samarin.
\textit{The \LaTeX\ Companion}.
Addison-Wesley, Reading, Massachusetts, 1993.
\bibitem{einstein}
Albert Einstein.
\textit{Zur Elektrodynamik bewegter K{\"o}rper}. (German)
[\textit{On the electrodynamics of moving bodies}].
Annalen der Physik, 322(10):891–921, 1905.
\bibitem{knuthwebsite}
Knuth: Computers and Typesetting,
\\\texttt{http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html}
\end{thebibliography}
The environment thebibliography
produces a list of references; such list will be titled "References" in a article document class, and "Bibliography" in book and report document classes. A parameter inside braces, 9
in the example, indicates the number of entries to be added; this parameter can not be greater than 99.
To create a bibliography entry the command \bibitem
is used. A parameter inside braces is set to label this entry and can later be used as identifier for this reference. After the closing brace the text with the name of the author, the book title, publisher and so on is entered.
Overleaf provides several templates with pre-defined styles to manage bibliography. See this link
Embedded system
The example presented in the introduction only contains list of references, the next example shows how to cite the entries of that list within the document.
\begin{document}
\section{First section}
This document is an example of \texttt{thebibliography} environment using
in bibliography management. Three items are cited: \textit{The \LaTeX\ Companion}
book \cite{latexcompanion}, the Einstein journal paper \cite{einstein}, and the
Donald Knuth's website \cite{knuthwebsite}. The \LaTeX\ related items are
\cite{latexcompanion,knuthwebsite}.
\medskip
\begin{thebibliography}{9}
\bibitem{latexcompanion}
Michel Goossens, Frank Mittelbach, and Alexander Samarin.
\textit{The \LaTeX\ Companion}.
Addison-Wesley, Reading, Massachusetts, 1993.
\bibitem{einstein}
Albert Einstein.
\textit{Zur Elektrodynamik bewegter K{\"o}rper}. (German)
[\textit{On the electrodynamics of moving bodies}].
Annalen der Physik, 322(10):891–921, 1905.
\bibitem{knuthwebsite}
Knuth: Computers and Typesetting,
\\\texttt{http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html}
\end{thebibliography}
\end{document}
The command \cite
insert the number corresponding to the bibliography entry whose label is passed inside braces. For example, the output of \cite{einstein}
is [2].
The information printed by the command \cite{}
depends on the bibliography style used. See Bibtex bibliography styles.
Bibliography management with Bibtex
BibTeX is a widely used bibliography management tool in LaTeX, with BibTeX the bibliography entries are kept in a separate file and then imported into the main document.
Once the external bibliography file is imported, the command \cite
is used just as in the introductory example.
Ths document is an example of BibTeX using in bibliography management. Three items
are cited: \textit{The \LaTeX\ Companion} book \cite{latexcompanion}, the Einstein
journal paper \cite{einstein}, and the Donald Knuth's website \cite{knuthwebsite}.
The \LaTeX\ related items are \cite{latexcompanion,knuthwebsite}.
\medskip
\bibliographystyle{unsrt}
\bibliography{sample}
This uses the following commands:
\bibliography{sample}
- Imports the BibTeX file "sample.bib" to display the bibliography. To import several .bib files just write them comma-separated inside the braces, the file extension is not necessary.
\bibliographystyle{unsrt}
- Sets the bibliography style to be used in this document. The information displayed depends on the bibliography style used, even if the entry contains information about the date, author, title, publisher, and abstract, the style used might only print the title and the author. See Bibtex bibliography styles which contains examples of the default bibliography styles in LaTeX.
\cite{einstein}
- This will print a number of text, depending on the bibliography style, to reference the bibliography entry whose label is passed to the command. In this case, the label
einstein
produces [2].
When the main document is compiled, a .bbl file is generated from the .bib file. This is simply a .tex file reorganising the information in the .bib file in a thebibliography
environment, as above. On ShareLaTeX the .bbl file is stored in the cache, and you can download it from the list of other logs and files.
Note: Unicode characters are not supported on BibTeX. Also, if there are too many bibliography entries (+100) it may not work properly. See the further reading section for links to other bibliography management tools.
Open an example of the bibtex package in Overleaf
The bibliography file
Bibliographic references are usually kept in a bibliography file whose extension is .bib, this file consists of a list of records and fields. Each bibliography record holds relevant information for a single entry.
@article{einstein,
author = "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004"
}
@book{latexcompanion,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The \LaTeX\ Companion",
year = "1993",
publisher = "Addison-Wesley",
address = "Reading, Massachusetts"
}
@misc{knuthwebsite,
author = "Donald Knuth",
title = "Knuth: Computers and Typesetting",
url = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html"
}
This file contains records in a special format, for instance, the first bibliographic reference is defined by:
@article{...}
- This is the first line of a record entry,
@article
denotes the entry type and tells BibTeX that the information stored here is about an article. Besides the entry types shown in the example (article
,book
andmisc
) there are a lot more, see the reference guide.
einstein
- The label
einstein
is assigned to this entry, is an identifier that can be used to refer this article within the document.
author = "Albert Einstein",
- This is the first field in the bibliography entry, indicates that the author of this article is Albert Einstein. Several comma-separated fields can be added using the same syntax
key = value
, for instance: title, pages, year, URL, etc. See the reference guide for a list of possible fields.
The information in this file can later be used within a LaTeX document to include these references, as shown in the next subsection.
Open an example of the bibtex package in Overleaf
Adding the bibliography in the table of contents
There are two ways of including the bibliography in the table of contents, either manually adding it or using the package tocbibind (recommended).
To add it manually just insert the next line right before the command \begin{thebibliography}
or \bibliography
\addcontentsline{toc}{chapter}{Bibliography}
for books and reports or
\addcontentsline{toc}{section}{References}
for articles. If you're also using the hyperref
package, it is advisable to add \phantomsection
before these \addcontentsline
calls, so that hyperlinks will target the correct page. If you prefer to use tocbibind see the next example.
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[nottoc]{tocbibind}
\begin{document}
\tableofcontents
\section{First Section}
This document ...
\bibliographystyle{unsrt}
\bibliography{sample}
\end{document}
Adding the line
\usepackage[nottoc]{tocbibind}
to the preamble will print the "References" or "Bibliography" in the table of contents, depending on the document type. Be careful, it will also add other elements like the Index, Glossary and list of Listings to the table of contents. For more information see [the tocbibind package documentation].
Open an example of the bibtex package in Overleaf
Reference guide
Standard entry types
article
- Article from a magazine or journal
book
- A published book
booklet
- A work that is printed but have no publisher or sponsoring institution
conference
- An article in a conference proceedings
inbook
- A part of a book (section, chapter and so on)
incollection
- A part of a book having its own title
inproceedings
- An article in a conference proceedings
manual
- Technical documentation
masterthesis
- A Master's thesis
misc
- Something that doesn't fit in any other type
phdthesis
- A PhD thesis
proceedings
- The same as
conference
techreport
- Report published by an institution
unpublished
- Document not formally published, with author and title
Most common fields used in BibTeX
address | annote | author |
booktitle | chapter | crossref |
edition | editor | institution |
journal | key | month |
note | number | organization |
pages | publisher | school |
series | title | type |
volume | year | URL |
ISBN | ISSN | LCCN |
abstract | keywords | price |
copyright | language | contents |
Further reading
For more information see:
- Creating and Managing Bibliographies with BibTeX on Overleaf
- Bibtex bibliography styles
- Bibliography management with natbib
- Bibliography management with biblatex
- BibTeX documentation at CTAN web site
- tocbind package documentation
- Table of contents
- Management in a large project
- Multi-file LaTeX projects
Overleaf guides
- Creating a document in Overleaf
- Uploading a project
- Copying a project
- Creating a project from a template
- Including images in Overleaf
- Exporting your work from Overleaf
- Working offline in Overleaf
- Using Track Changes in Overleaf
- Using bibliographies in Overleaf
- Sharing your work with others
- Debugging Compilation timeout errors
- How-to guides
LaTeX Basics
- Creating your first LaTeX document
- Choosing a LaTeX Compiler
- Paragraphs and new lines
- Bold, italics and underlining
- Lists
- Errors
Mathematics
- Mathematical expressions
- Subscripts and superscripts
- Brackets and Parentheses
- Fractions and Binomials
- Aligning Equations
- Operators
- Spacing in math mode
- Integrals, sums and limits
- Display style in math mode
- List of Greek letters and math symbols
- Mathematical fonts
Figures and tables
- Inserting Images
- Tables
- Positioning Images and Tables
- Lists of Tables and Figures
- Drawing Diagrams Directly in LaTeX
- TikZ package
References and Citations
- Bibliography management in LaTeX
- Bibliography management with biblatex
- Biblatex bibliography styles
- Biblatex citation styles
- Bibliography management with natbib
- Natbib bibliography styles
- Natbib citation styles
- Bibliography management with bibtex
- Bibtex bibliography styles
Languages
- Multilingual typesetting on Overleaf using polyglossia and fontspec
- International language support
- Quotations and quotation marks
- Arabic
- Chinese
- French
- German
- Greek
- Italian
- Japanese
- Korean
- Portuguese
- Russian
- Spanish
Document structure
- Sections and chapters
- Table of contents
- Cross referencing sections and equations
- Indices
- Glossaries
- Nomenclatures
- Management in a large project
- Multi-file LaTeX projects
- Hyperlinks
Formatting
- Lengths in LaTeX
- Headers and footers
- Page numbering
- Paragraph formatting
- Line breaks and blank spaces
- Text alignment
- Page size and margins
- Single sided and double sided documents
- Multiple columns
- Counters
- Code listing
- Code Highlighting with minted
- Using colours in LaTeX
- Footnotes
- Margin notes
Fonts
Presentations
Commands
Field specific
- Theorems and proofs
- Chemistry formulae
- Feynman diagrams
- Molecular orbital diagrams
- Chess notation
- Knitting patterns
- CircuiTikz package
- Pgfplots package
- Typing exams in LaTeX
- Knitr
- Attribute Value Matrices
Class files
- Understanding packages and class files
- List of packages and class files
- Writing your own package
- Writing your own class
- Tips