I know that there are many questions very similar to mine on this forum, but I still do not understand how my mistake can be fixed. Since I'm a novice with Latex and I wanted to create a bibliography for my document, I followed this step-by-step article by Overleaf about the use of biblatex. My problem is probably the creation of the file .bib: can I just open a new empty file Latex, write a code such as
@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{dirac,
title = {The Principles of Quantum Mechanics},
author = {Paul Adrien Maurice Dirac},
isbn = {9780198520115},
series = {International series of monographs on physics},
year = {1981},
publisher = {Clarendon Press},
keywords = {physics}
}
@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"
}
@inbook{knuth-fa,
author = "Donald E. Knuth",
title = "Fundamental Algorithms",
publisher = "Addison-Wesley",
year = "1973",
chapter = "1.2",
keywords = "knuth,programming"
}
...
and save the file as a .bib document? After that, I tried to import my .bib file, which I called "sample", as follows:
\documentclass[12pt,a4paper]{article}
\usepackage[english]{babel}
\usepackage{biblatex}
\addbibresource{sample.bib}
\begin{document}
The Einstein's journal paper \cite{einstein} and the Dirac's
book \cite{dirac} are physics related items.
\printbibliography
\end{document}
The problem is that the .bib external file does not seem to be imported correctly. Indeed, when running the code Latex does not generate any bibliography, since the label {einstein}
doesn't get associated to any number. How could I fix that? I'm sure that the way I created the .bib file is wrong, but apparently Latex does not point out the error. If I try to enter an undefined .bib file, such as \addbibresource{blabla.bib}
, the output I get is exactly the same. What happened?
biblatex
needs in your case a run withbiber
insteadbibtex
. Did you run biber?biber
, for example, orbibtex
if you don't really needbiblatex
.backend=biber
is the default. Other than that, did you run the normal cycle:pdflatex -> biber -> pdflatex (twice)
?backend=bibtex
but that is only to find out ifbibtex
is compiling, better is to usebiber
withbiblatex
....bbl
file, that will be used in the second and third runs of LaTeX. Biber will produce a .log file (extension.bld
) that you may look at to see if everything was OK.