Bibliography management in LaTeX
To construct bibliography for your Latex document, there are several packages that could be deployed and used. Biblatex is one powerful package that can helps you.
Bibliography file (.bibtex or .bib)
To initiate a bibliorgraphy in Latex, you must first create a .bibtex file. A .bibtex file is a text file that contains the citation that you want to cite in your document. You can also use any text editor, such as sublime, atom, or TexMaker to make your own Bibtex file. In this example, we're going to use a .bibtex file by downloading a citation from google scholar.
-
Come to google scholar and search for Einstein paper: Can quantum-mechanical description of physical reality be considered complete?
-
Click on the link, you see the export citation button. Click on that button, you will see Export Article to BibTex. In general, this is how you look for BibTex citation for any research paper. Google Scholar is your friend.
-
Download the file as bibtex to the same folder of your latex file. The file will have the name:PhysRev.47.777.bibtexKeep the file name consistent with the file name that you are importing to your latex file.
Another way to do this is to download the cite directly from google scholar.
-
You can press the double quote below the link from google scholar:
-
When you click the double quote, google scholar will show you several citing styleswith the citing file format at the bottom.
Introduction and the basics
To make biblatex work, you're required to include these 4 commands:
-
Import biblatex package
\usepackage{biblatex}
-
Imports the bibtex data file PhysRev.47.777.bib, this file is the one that includes information about each referenced book, article, etc.
\addbibresource{PhysRev.47.777.bib}
-
This command inserts a reference within the document, [1] in this case, that corresponds to an element in the bibliography, "einstein" is a keyword corresponding to an entry in sample.bib.
\cite{PhysRev.47.777}
-
Prints the list of cited references, the default title is "References" for the article document class and "Bibliography" for books and reports.
\printbibliography
As you compile, there will be a Reference section in the bottom of your page. We will explore further option to customize your Bibliography.
This is the input of your latex file
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{biblatex}
\addbibresource{PhysRev.47.777.bib}
\begin{document}
\section{First section}
Let's cite! Einstein's journal paper
\cite{PhysRev.47.777}
\printbibliography
\end{document}
And this is the out put:
CODE
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{biblatex}
\addbibresource{PhysRev.47.777.bib}
\begin{document}
\section{First section}
Let's cite! Einstein's journal paper
\cite{PhysRev.47.777}
\printbibliography
\end{document}
Customization
Bibtex citing can be easily customized through a few command. In this section, we will add some more source into our Bibtex file, and we will let Biblatex handle sorting and citing.This command will change the title of the bibliography from "References" to which ever title you put there.
\printbibliography[title={Whole bibliography}]
Here are a few more commands that could be very useful:
\printbibliography[type=article,title={Articles only}]
\printbibliography[type=book,title={Books only}]
\printbibliography[keyword={physics},title={Physics-related only}]
\printbibliography[keyword={latex},title={\LaTeX-related only}]
Only prints entries whose type is "article", and sets the title "Articles only" for this section. The same syntax works for any other entry type.
\printbibliography[type=article,title={Articles only}]
\printbibliography[keyword={physics},title={Physics-related only}]
Filters bibliography entries that include the word "physics" in any of the fields. Sets the title "Physics-related only" for said section.
For this part, we have an example to demonstrate some of this customization.
-
You need to add to your bib file this following lines, making you bib files complete and full of example:
@article{PhysRev.47.777,
title = {Can Quantum-Mechanical Description of Physical Reality Be Considered Complete?},
author = {Einstein, A. and Podolsky, B. and Rosen, N.},
journal = {Phys. Rev.},
volume = {47},
issue = {10},
pages = {777--780},
numpages = {0},
year = {1935},
month = {May},
publisher = {American Physical Society},
doi = {10.1103/PhysRev.47.777},
url = {https://link.aps.org/doi/10.1103/PhysRev.47.777}
}
@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",
keywords = "physics"
}
@book{tetlock2016superforecasting,
title={Superforecasting: The art and science of prediction},
author={Tetlock, Philip E and Gardner, Dan},
year={2016},
publisher={Random House}
}
@book{fine2009economics,
title={From economics imperialism to freakonomics: The shifting boundaries between economics and other social sciences},
author={Fine, Ben and Milonakis, Dimitris},
year={2009},
publisher={Routledge}
}
@online{knuthwebsite,
author = "Donald Knuth",
title = "Knuth: Computers and Typesetting",
url = "http://www-cs-faculty.stanford.edu/~uno/abcde.html",
addendum = "(accessed: 01.09.2016)",
keywords = "latex,knuth"
}
@book{manber1989introduction,
title={Introduction to algorithms: a creative approach},
author={Manber, Udi},
volume={4},
year={1989},
publisher={Addison-Wesley Reading, MA}
}
@article{lecun2015deep,
title={Deep learning},
author={LeCun, Yann and Bengio, Yoshua and Hinton, Geoffrey},
journal={nature},
volume={521},
number={7553},
pages={436},
year={2015},
publisher={Nature Publishing Group}
}
-
Put this piece of Latex code into your example file for demonstration:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{biblatex}
\addbibresource{PhysRev.47.777.bibtex}
\begin{document}
\section{First section}
Let's cite! Einstein's journal paper \cite{PhysRev.47.777}\\
Let's cite more journal paper from Einstein \cite{einstein}\\
Let's cite from my 2 most favorite book: Freakonomics \cite{fine2009economics} and Superforcasting \cite{tetlock2016superforecasting}\\
Some few more citation to make to table more interesting:\\
Deep Learning \cite{lecun2015deep}\\
Introduction to Algorithm \cite{manber1989introduction}\\
\printbibliography[type=article,title={Articles only}]
\printbibliography[type=book,title={Books only}]
\end{document}
-
The expected output should be:
CODE
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{biblatex}
\addbibresource{PhysRev.47.777.bib}
\begin{document}
\section{First section}
Let's cite! Einstein's journal paper \cite{PhysRev.47.777}\\
Let's cite more journal paper from Einstein \cite{einstein}\\
Let's cite from my 2 most favorite book: Freakonomics \cite{fine2009economics} and Superforcasting \cite{tetlock2016superforecasting}\\
Some few more citation to make to table more interesting:\\
Deep Learning \cite{lecun2015deep}\\
Introduction to Algorithm \cite{manber1989introduction}\\
\printbibliography[type=article,title={Articles only}]
\printbibliography[type=book,title={Books only}]
\end{document}
Adding Bibliography to the table of contents
In \printbibliography you need to add heading option into the command. You can make your heading into bibintoc or subbibintoc, as bibintoc is the option for the main section and subbibintoc is the subsection of the bibliorgraphy
\printbibliography[heading=bibintoc,title={Whole bibliography}]
\printbibliography[heading=subbibintoc,type=article,title={Articles only}]