17

I am looking for the most basic example code for using biblatex.

Consider the following bib entries (copied from the answer for this question)

\begin{filecontents}{\jobname.bib}
@book{Labov1972,
    Address = {Philadelphia},
    Author = {William Labov},
    Publisher = {University of Pennsylvania Press},
    Title = {Sociolinguistic Patterns},
    Year = {1972}}

@book{Chomsky1957,
    Address = {The Hague},
    Author = {Noam Chomsky},
    Publisher = {Mouton},
    Title = {Syntactic Structures},
    Year = {1957}}
\end{filecontents}

and this code

\documentclass[a4paper,11pt]{article}
\usepackage[style=numeric,backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
As first example citation here is \cite{Chomsky1957}. 
Here is another example citation \cite{Labov1972}
\printbibliography
\end{document}

How should I load biblatex (what should I change in the above code) in order to get numeric citation style that would look like: [1] (a number in a square brackets).

How different (what exactly to change) in order to get author-year style that would look like Labov (1972).

For some reason the list does not print. It is not the main issue here. However, here is an arbitrary option to list the entries (copied from the same answer above).

What are the additional minimal required commands to print it?

enter image description here

Different111222
  • 445
  • 1
  • 5
  • 10

1 Answers1

33

Bibliography and citation formatting is complicated, and that's why the biblatex package, which has thought through the issues extremely thoroughly, is also complicated. As end users, we tend to think of simple cases without realizing that making the simple case more general is not always simple.

For this reason, especially if you are a beginner, (and even if you're not) you should try to adapt to some of the standard styles offered by the biblatex package itself, or use one of the many excellent user contributed styles that implement most of the major schemes. This is especially true if you have any flexibility in your choice of styles (i.e., you are not bound to a very particular style by a specific journal, for example.)

For a list of available styles see the biblatex section of:

For author/year citations, the apa style for biblatex is an excellent implementation of the APA style.

Citation styles and bibliography styles

There are two main formatting considerations for any citation system: the formatting of the citations themselves in the text, and the formatting of the bibliography items in the bibliography. The biblatex package treats both of these separately, although there are obviously dependencies between the two. In this answer I will discuss only author/year and numeric schemes, which are common in the natural and social sciences. Footnote style citations as used in the humanities are quite different, and pose their own set of problems (although biblatex is also designed to deal with them.)

Citation commands

There are three basic citation commands in biblatex plus some automatic ones. All of the citation commands allow two optional arguments: a prenote and a postnote.

  1. \cite standard citation
  2. \parencite standard citation in parentheses
  3. \footcite like \cite but puts the citation in a footnote.

There are many variants of these commands. See §3.7 of the biblatex manual for more details.

Among the more useful special cite commands are:

  1. \textcite is like \cite but puts the label text (like the year in an author/year system) in parentheses.
  2. \autocite is designed for (almost) seamlessly transitioning between \parencite and \footcite, for example, and provides a higher level markup that can be mapped to either command.

Author/Year Style

\begin{filecontents}{\jobname.bib}
@book{Labov1972,
    Address = {Philadelphia},
    Author = {William Labov},
    Publisher = {University of Pennsylvania Press},
    Title = {Sociolinguistic Patterns},
    Year = {1972}}

@book{Chomsky1957, Address = {The Hague}, Author = {Noam Chomsky}, Publisher = {Mouton}, Title = {Syntactic Structures}, Year = {1957}} } \end{filecontents}

\documentclass{article} \usepackage[style=authoryear]{biblatex} \addbibresource{\jobname.bib} \begin{document} Some famous linguists wrote a couple of books \autocite{Labov1972,Chomsky1957}. \printbibliography \end{document}

enter image description here

Numeric style

\documentclass{article}
\usepackage[style=numeric]{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
Some famous linguists wrote a couple of books \autocite{Labov1972,Chomsky1957}.
\printbibliography
\end{document}

enter image description here

Author/year citations with numeric bibliography

\documentclass{article}
\usepackage[citestyle=authoryear,bibstyle=numeric]{biblatex}
\addbibresource{\jobname.bib}
\begin{document}
Some famous linguists wrote a couple of books \autocite{Labov1972,Chomsky1957}.
\printbibliography
\end{document}

output of code

Compiling documents that use biblatex

As with other bibliography packages, compiling documents with biblatex requires a multi-step process. First you compile your document using your regular TeX engine (pdflatex, xelatex, or lualatex) and then you run a separate program biber which processes the bibliography. For example, if you are compiling any of the of the MWEs shown above, using the filename test.tex, then the full compilation command chain would be the following. (Replace pdflatex with xelatex or lualatex as needed.)

pdflatex test.tex
biber test
pdflatex test.tex
pdflatex test.tex

where biber test is short-hand for biber test.bcf.

Since most people use IDEs to process their source documents, it's helpful to know how to set up your editor to use biber instead of bibtex. See this question for details on that.

Do I have to use biber? Why can't I use bibtex?

Although it's possible with some biblatex styles to use bibtex to process the bibliography by passing the [backend=bibtex] option to the package, most modern styles depend on the use of biber so you should generally not use bibtex to process documents that use biblatex.

Alan Munn
  • 218,180
  • As it does not appear in the code, where did the 'Some famous linguist wrote a couple of books' came from ? BTW, using my system it does not print the list of references at all. – Different111222 Nov 02 '13 at 20:19
  • @Different111222 Fixed. – Alan Munn Nov 02 '13 at 20:20
  • How to I change the code so the citation would appear like: Lavov (1972) (I'll deal with the multiple citation later). Also, the citation appear in bold. How do I get rid or that? – Different111222 Nov 02 '13 at 20:24
  • @Different111222 Exchanging \autocite{Labov1972} for \textcite{Labov1972} should cause the citation to appear in Labov (1972) format. – SnoringFrog Nov 02 '13 at 20:39
  • @snoringfrog - it changes to Labov1972. How can I put the 1972 in parentheses so it would look like Labov (1972)? – Different111222 Nov 02 '13 at 21:18
  • @alan-munn - I do not see you called apa anywhere in the code. Maybe this is the answer - going to something else than apa, if it is implemented at all or that it is the default. – Different111222 Nov 02 '13 at 22:02
  • @Different111222 The apa style is documented in the biblatex-apa documentation. Using it is a bit more complicated than just adding style=apa. Read that documentation if you want APA style. I highly recommend that package. – Alan Munn Nov 02 '13 at 22:08
  • @Different111222 I achieved that output with this code: https://www.writelatex.com/read/bjqcrygcprwh

    My major change was specifying backend=bibtex as a biblatex argument.

    – SnoringFrog Nov 03 '13 at 02:17
  • 1
    @SnoringFrog Actually the change that mattered is \textcite. Changing the backend is not relevant. I forgot about that in my comment (which I've deleted; thanks for pursuing this.) I don't recommend changing the backend to bibtex generally. Most of the advanced features of biblatex require biber. – Alan Munn Nov 03 '13 at 02:23
  • @AlanMunn Edited: It appears that this must have been an issue with writelatex.com's implemenation. For some reason, creating the document there requires backend=bibtex for the output the asker wanted; I failed to notice the warning thrown when backend=biber is used, which is what threw me off. Thanks for the clarification. – SnoringFrog Nov 03 '13 at 02:30
  • 1
    Maybe you could add a short paragraph about the backend(s) and how to compile such a document, cf. https://tex.stackexchange.com/q/443969/35864 where the OP wasn't aware of Biber – moewe Jul 31 '18 at 09:15
  • @moewe Yes, that probably would have saved me two annoying hours. Just a brief mentioning, that biber is actually a standalone program that runs separately from pdflatex and is not something that's automagically invoked. Hence: If \jobname is test: pdflatex test.tex; biber test; pdflatex test.tex; pdflatex test.tex, where biber test is short-hand for biber test.bcf. – Suuuehgi Jun 01 '22 at 17:00