3

I am trying to get running the example of Sharelatex. Though the output PDF I \printbibliography just won't do its job. I do get 3 errors as well, but I am unable to figure out how to solve this problem.

I use Ubuntu 15.10 amd64, TeXstudio 2.9.4, Texlive 1.2 (texliveonfly --version), XeTeX 3.14159265-2.6-0.99992 (xetex --version), BibTeX 0.99d (bibtex --version).

My files are text.tex and sample.bib and are listed below, as is my expected output and my real output.

How would I get the bibliography running?

text.tex:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{biblatex}
\addbibresource{sample.bib}

\begin{document}
    Let's cite! The Einstein's journal paper \cite{einstein} and the Dirac's
    book \cite{dirac} are physics related items. 

    \printbibliography

\end{document}

sample.bib:

@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",
    keywords  = "latex,knuth"
}

@inbook{knuth-fa,
    author = "Donald E. Knuth",
    title = "Fundamental Algorithms",
    publisher = "Addison-Wesley",
    year = "1973",
    chapter = "1.2",
    keywords  = "knuth,programming"
}

expected output:

enter image description here

real output:

enter image description here

EDIT 1:

If I run bibtex directly through TexStudio, I get the following error:

This is BibTeX, Version 0.99d (TeX Live 2015/Debian)
The top-level auxiliary file: test.aux
I found no \citation commands---while reading file test.aux
I found no \bibdata command---while reading file test.aux
I found no \bibstyle command---while reading file test.aux
(There were 3 error messages)
Socrates
  • 423
  • Are you compiling this on your own machine? You need to compile it with latex, then biber (or bibtex), and then latex again. – Adam Liter Nov 27 '15 at 16:55
  • 1
    With your set-up (specifically \usepackage{biblatex}) you need to run Biber and not BibTeX. See Biblatex with Biber: Configuring my editor to avoid undefined citations and Question mark instead of citation number. – moewe Nov 27 '15 at 17:04
  • What are the errors you get? – moewe Nov 27 '15 at 17:04
  • @moewe Already tried to use biber, but same result. I created EDIT 1 and posted the error when creating the bibliography. As everything should work fine, I assume that there is some software I still have to install in my Ubuntu 15.10 system. I tried out just to install everything Ubuntu has to offer in Texlive (basically sudo apt-get install texlive*), but this didn't change the outcome. – Socrates Nov 27 '15 at 17:35
  • 1
    I'm not sure which version of TeXLive Ubuntu 15.10 ships. The error message suggests though that you are running BibTeX and not Biber. – moewe Nov 27 '15 at 17:56
  • Alright, I got it now. Had to install biber with sudo apt-get install biber as it wasn't on the system. Now everything works well as expected. Bibtex still doesn't work, but it's alright as long as there is another solution for it. Biber will do. Thanks a lot for the help! Very appreciated! – Socrates Nov 27 '15 at 22:20
  • BibTeX does not work in your example because the default value for the backend option is backend=biber (you can see that in the .log file). If you want to use BibTeX you need to ask for it specifically with backend=bibtex. (In order to be able to compile everything, you probably need to delete the temporary files after this change.) But since Biber offers superior features, working with Biber is the way forward. – moewe Nov 28 '15 at 07:37

2 Answers2

1

You need to: - Compile with pdflatex or xelatex - Run bibtex or biber - Recompile with pdflatex or xelatex.

Your code works fine for me when these instructions are followed.

Ross
  • 5,656
  • 2
  • 14
  • 38
  • I tried out latex, pdflatex, xelatex, and lualatex. All have the same outcome. When running bibtex directly, I get an error. I posted it above in EDIT 1. – Socrates Nov 27 '15 at 17:37
1

It seems like you don't have all the required packages for biblatex to run. You need to

  1. Install texlive-bibtex-extra, texlive-latex-extra and biber packages for ubuntu by opening a terminal with Ctrl+Alt+T, then entering the following:

    sudo apt-get install texlive-bibtex-extra texlive-latex-extra biber
    
  2. Hit enter and yes to installation questions

  3. To avoid getting warning messages you should specify biber as the backend for biblatex in your .tex file with \usepackage[backend=biber]{biblatex}. So your file sample.bib can be left the same as what you posted, but your test.tex file should look like:

test.tex

    \documentclass{article}
    \usepackage[utf8]{inputenc}
    \usepackage[english]{babel}

    \usepackage[backend=biber]{biblatex}
    \addbibresource{sample.bib}

    \begin{document}
        Let's cite! The Einstein's journal paper \cite{einstein} and the Dirac's book \cite{dirac} are physics related items. 

    \printbibliography

    \end{document}
  1. Before compiling, make sure that BibLaTeX is selected by going to the Bibliography menu, then at the bottom there should be Type:BibTeX or Type:BibLaTeX, make sure it is BibLaTeX
  2. Finally, select options menu, then configure TeXstudio then on the left, click on Build and make sure Default Bibliography Tool is set to Biber as in the below screenshot:

TeXstudio Build settings for Biblatex

Shearn
  • 36
  • With a recent version of biblatex one doesn't need to specify backend=biber to get Biber as back-end, it is the standard (you will get a warning, though). – moewe Nov 27 '15 at 17:58