0

so I'm trying to get to grips with the biblatex package and so far I can't get a citation or my bibliography to print properly onto PDF. Here's my .bib file:

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"
}
...

And here's my .tex file:

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

%\usepackage{csquotes}% Recommended
%\usepackage[style=authoryear-ibid,backend=biber]{biblatex}
\usepackage{comment}

\usepackage[backend=biber,style=authoryear,sorting=ynt]{biblatex}
\addbibresource{ref.bib}
%\usepackage{natbib}
\usepackage{bibentry}


\title{Bibliography management: \texttt{biblatex} package}
\author{\LaTeX}
\date{ }

\begin{document}

\maketitle

\section{First section}

\begin{enumerate}
    \item A citation command in parentheses: \parencite{einstein}.
    \item A citation command for use in the flow of text: As \textcite{Smith:2013jd} said \dots
    \item A citation command which automatically switches style depending on location and the option setting in the package declaration (see line 12 in the LaTeX source code). In this case, it produces a citation in parentheses: \autocite{Other:2014ab}.
\end{enumerate}

\medskip

\nocite{*}
\printbibliography
\end{document}

And the result it produces:

enter image description here

  • Are you running pdflatex -> biblatex -> pdflatex -> pdflatex ? – Teepeemm Sep 24 '19 at 13:16
  • You need to run LaTeX, Biber, LaTeX, LaTeX (where 'LaTeX' is your favourite LaTeX flavour: pdfLaTeX, XeLaTeX, LuaLaTeX, ...), see tex.stackexchange.com/q/63852/35864 for a thorough explanation. See tex.stackexchange.com/q/154751/35864 for help with getting your editor to run Biber for you. – moewe Sep 24 '19 at 15:34
  • You should also remove the bibentry package (\usepackage{bibentry}) since biblatex has its own facilities to produce full citations (\fullcite). And it is probably just a copy-and-paste error, but in your .bib file the entry einstein is missing the @ in @article at the beginning. Furthermore, the posted .bib file does not include the entries Smith:2013jd and Other:2014ab, so if those contain grave errors, we can't see that. – moewe Sep 24 '19 at 15:36
  • Any news here? Did you manage to get the example document to produce a bibliography? If not, what did you try and how exactly did things go wrong for you? – moewe Sep 28 '19 at 13:02
0

The code itself is not the problem. But after you run pdflatex <yourfile> you need to call the BibLaTeX backend. In this case it is Biber: biber <yourfile>. Then, you need to run pdflatex <yourfile> again until the output no longer recommends to run it again.

The biblatex package even writes that in its output on the first pdflatex call:

Package biblatex Warning: Please (re)run Biber on the file:
(biblatex)                yourfile
(biblatex)                and rerun LaTeX afterwards.
| improve this answer | |
  • Thank you for your reply. I'm not sure how to configure that in texstudio. Is it within the options heading? – H98 Sep 24 '19 at 13:27
  • 1
    @H98: I was not aware of you using Texstudio (tip: you should have mentioned that in the question). Maybe the answers to this question help: tex.stackexchange.com/questions/102803/… – Franz Zieris Sep 24 '19 at 13:38

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