1

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?

  • 1
    biblatex needs in your case a run with biber instead bibtex. Did you run biber? – Kurt May 1 at 22:14
  • 1
    You have to run biber, for example, or bibtex if you don't really need biblatex. – Sigur May 1 at 22:15
  • 1
    backend=biber is the default. Other than that, did you run the normal cycle: pdflatex -> biber -> pdflatex (twice)? – Bernard May 1 at 22:20
  • 1
    Please tell us how do you compile? Do you use overleaf or have you installed an tex distribution on your computer? For a first test you can also try backend=bibtex but that is only to find out if bibtex is compiling, better is to use biber with biblatex ... – Kurt May 1 at 22:29
  • 1
    Well, just run them in the given order.The first run of LaTeX produces auxiliary files where biber will find the information it needs ro produce a .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. – Bernard May 1 at 22:32
2

The result you should be seeing, but consider the comments below your question which came after I started testing

enter image description here

This was obtained by running as a minimum

your first file is sample.bib . Your second file is main.tex

With main.tex open in your editor such as TeXworks run the following sequence Note in TeXworks these are called Typeset (Processing Tools)

 PdfLaTeX  
 Biber  
 PdfLaTeX 
 pdfLaTeX 

or from a command line starting in the folder where the tex file is located you can also run the MiKTeX commands in sequence.

 PdfLaTeX main  
 Biber main  
 PdfLaTeX main   
 PdfLaTeX main  
  • Thank you for your help. I'm sorry to bother you, but I don't understand what do you mean by "With main.tex open in an editor run PdfLaTeX Biber PdfLaTeX ". – Nenne May 2 at 14:19
  • 1
    many TeX systems especially on windows include a tex editor or a user downloads one so in those editors there are options to buil/run/compile the edited plain.tex file and also view the dvi/png/ps/pdf visual output so it depends on what apps you have already installed as to what may allow for easier generation of tex documents – KJO May 2 at 14:38
  • I understand from a recent answer you need to update your MiKTeX from an older installation A new version may include a newer copy of TeXworks but the need to run bibliography through a sequence of commands is the same so you can add your own new Typeset process to do the correct sequence for you once it is set-up correctly you then can select that option and just click the green button once to get the full run of all four commands – KJO May 2 at 18:21
  • When trying to run Biber, I get the following error on the console: INFO - This is Biber 2.7 INFO - Logfile is 'sample.blg' ERROR - Cannot find control file 'sample.bcf'! - did you pass the "backend=biber" option to BibLaTeX? INFO - ERRORS: 1. – Nenne May 3 at 7:27
  • Ok there are several bib options and they depend on the combination of the tex structure and the biblio structure in some cases bibtex is appropriate and in others biber. My answer should have worked inside texworks (with the combination given your mwe) using 1 run of pdfLaTeX followed by one run of biber followed by at least one more runs of pdfLaTeX If you change biblio file structure or add different packages to tex then compilation route/sequence may need to be changed. That then becomes a different question. IF tex is unstable not updated or minor errors in tex/bib you get biber warnings – KJO May 3 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.