To see the corresponding video for this blog post click here.
In the last post we looked at using images and tables in our thesis. In this post we are going to look at adding a bibliography to our thesis. To do this we are going to use the biblatex package. This involves creating a list of sources in a separate file called a bib file.
The Bib File
When we create this file we need to choose a name for it and save it as a ‘.bib’ file rather than a ‘.tex’ file.
Now every time we need to reference a source we can cite it in the text and then fill in the source details in the bib file. First we’ll look at filling in our ‘.bib’ file and then we’ll move on to discussing citations.
To add a new entry to our bib file we need to first tell biblatex what type of source we are referencing. We do this using an @ symbol followed immediately by the source type.
Then comes an opening curly bracket and a citation key of our choice followed by a comma. We then need to tell it all the details it wants for that particular type of source. We do this using a list of keywords each followed by an equals sign and the corresponding information in curly brackets. Items in the list are separated by commas. Each recognised source type has a list of required details which we must provide. But we’ll often want to give more details. For example, for an article entry we need to use the author, title, journaltitle and year or date keywords. For an online source we need to use the author or editor, title, year or date and url keywords, and finally for a book it’s the author, title and year or date keywords. Here’s an example of what they might look like filled in.
All of the information about the recognised source types and all the keywords you can use can be found in the biblatex documentation.
Now let’s return to the main tex file. To set it up for a bibliography we need to load up the biblatex package using the command. Also in the preamble we need to specify which bib files we want to use by calling the command and entering the file name in the curly brackets including the ‘.bib’ extension.
Now let’s look at citations. To cite a source in the text we use one of the biblatex citation commands. The simplest is the command which prints the citation without any brackets unless you are using the numeric or alphabetic styles. We’ll discuss styles a little later on. For example we may cite a source in the text like this:
Another one is the command which prints citations in parentheses except when using the numeric or alphabetic styles when it uses square brackets. There are more citation commands available to you which again can be found in the documentation.
The citation commands in biblatex also give us the option of adding a ‘prenote’ and ‘postnote’ in as arguments. A ‘prenote’ is a word or phrase like ‘see’ that is inserted at the start of the citation. A ‘postnote’ is text you want inserted at the end of the citation. To add these notes in you uses two sets of square brackets in the citation command. If you only open one set of square brackets it will assume the contents of the brackets is a postnote, so if you only want a prenote make sure you still open the second set of square brackets and then just leave them empty. Here are some examples:
Now to actually get the bibliography printed in our thesis we use the command at the end of the document. By default the bibliography and citations use the numeric style which looks like this:
To change the style we pass more arguments into the command in square brackets. For example this specifies the ‘alphabetic’ style.
Which looks like this:
And this is the ‘authoryear’ style.
Another thing we can change here is the way the bibliography is ordered. For example this sorts entries by year, name, title.
While this doesn’t sort them at all but displays them in the order they are cited.
More information about the numerous styles and sorting options available can be found in the documentation. This concludes our discussion on adding a bibliography. In the next post we’ll look at customising some of the opening pages.
Other posts in this series:
pt 1 - Basic Structure
pt 2 - Page Layout
pt 3 - Figures, Subfigures and Tables
pt 5 - Customising Your Title Page and Abstract
Posted by Josh Cassidy on 08 Aug 2013
First: Issues in text: how to cite properly.
Citations as words: Huge pet peeve: Using citations as words. van Leunen: “Brackets are not words. A bracketed number is just a pointer, not a word. Never, ever, use a bracketed number as if it were the name of an author or a work.” (p. 20). So instead of “A similar strategy is described in .”), use instead “A similar strategy is discussed by AuthorOne et al. ”. The way you can get this right in your head is considering a journal that does citations as superscripts (like the old Graphics Hardware style). It looks really stupid to say “A similar strategy is discussed by 15.” I don't like this particular style for citation, but it does make sure citations aren't used as words.
Citing with LaTeX: When writing citations in LaTeX, do them in this form:
The ~ means non-breaking space (which is what you want—you don't want a linebreak between the text and the citation).
Always alphabetize grouped citations so they appear in numerical order (instead of [8, 6, 10], arrange the citations so it looks like [6, 8, 10]). supposedly puts them in proper order for you automatically (!) and also changes [1,2,3,4,6] to [1–4,6] which is handy.
Shortcite: Use when appropriate. is used in sentences like “AuthorOne discusses this point further in her dissertation [AuthorOne 2002].” It looks silly to put AuthorOne's name twice. Instead, use , which makes the sentence “AuthorOne discusses this point further in her dissertation .” Of course this only makes sense if you are using a citation format that lists author name / year (like Siggraph or most dissertation formats).
I always use in my text even when my bib style doesn't support it, in which case I use the following fix in my LaTeX preamble (this defines if it's not already defined, otherwise it has no effect):
If you don't have this command, you'll see an error like:
Sorting your references: If at all possible, arrange your reference list in alphabetical order by author's last name. Going in cited order is much less useful to readers of your paper. The only reason I've heard that cited-order is useful is in a survey article where nearby (and presumably related) citations from the paper are next to each other in the bibliography. I don't find this argument particularly compelling.
Next: issues with bibliographies (your .bib file). Big picture: Don't trust the digital library to give you a perfect .bib file. Both ACM and IEEE (as well as many others) screw up bibliography entries in delightfully creative ways.
Names: Make the names in the bibliography match what is printed on the paper. If the paper has as the author, put that in your bibliography. If it has initials, use those. If it has crazy umlauts and accents, use those too. If it has initials, make sure they are separated by spaces: use rather than . The latter leads bibtex to believe the first name is with no middle name/initial. (And then if your bibstyle abbreviates first names, you'll just get the initial without the middle initial, since bibtex doesn't think you have a middle name.)
For hyphenated names with the second half uncapitalized (Wu-chun Feng, Wen-mei Hwu), put the hyphen and second half in brackets: , .
Capitalization in titles: Just like with authors, the capitalization on titles in your bibtex file should match what's on the paper. The bib style should enforce capitalization, not your bibliography—your bib should faithfully represent what's printed on the paper.
Also, make sure, in your BibTeX file, that you properly bracket words in titles that must be capitalized, like GPU or PDE, or proper names. Example (the “Loop” should always be capitalized since it's a last name):
You don't have to do this with venues (or anything else), just the title.
Resist the temptation to double-brace the entire title as a manner of course: . This guarantees your title will always be capitalized. But many bib styles downcase all titles, in which case your title will stick out like a sore thumb. Instead, just put your title in single-braces or quotes and let the bib style do the right thing.
(What is the right thing? In the US, publishers capitalize most words in titles [title case]; in the UK, publishers use the same capitalization rules as normal sentences [sentence case]. [Wikipedia link.] Markus Kuhn's thoughts on the subject are congruent with mine, that sentence case is preferable from an information-theoretic point of view, but in practice, authors should follow the conventions of their publication venue.)
If the title is in all-caps, I usually rewrite it in title case.
[ Capitalisation in BibTeX, from the TeX FAQ ]
Venues: Both ACM and IEEE screw up venue names in different ways. Here's how IEEE formatted a recent venue name in a recent paper of mine:
Never use the ACM or IEEE digital library's citations without fixing them. For some reason the First Society of Computing and the World's Largest Professional Association for the Advancement of Technology have zero interest in making their capitalization correct. For instance, the first paper I ever wrote, according to ACM, has the following title and booktitle:
when the paper has the major words in the title capitalized, and “workshop” and “hardware” should both be capitalized in the booktitle. I often review papers where citations have been taken directly from ACM with bizarre capitalization particularly in the booktitle. Fix these before you submit a paper.
Months: Include the month of publication in your bibliographies (simply for your own records: when you have two papers talking about a similar idea, one in January and one in November of the same year, maintaining the month lets you determine which came first).
Always use three-letter abbreviations without quotes for months. These are built into bibtex. They allow the bib style to actually know what month it is, so the bib style can enforce a consistent style across all citations (1/2012? Jan. 2012? January 2012? Januar 2012 [foreign language]?).
Digital libraries often get these wrong (IEEE uses ).
Pages: Always include pages if pages are available. Ranges of pages use the en-dash to separate them (that's two dashes): . Some non-printed proceedings only assign a paper number, so for those I typically see (and use) something like , where is the paper number and the paper has pages.
Also, if the bib source says that your paper starts on page 1, double-check it. Make sure that it doesn't list every paper in the conference/journal starting on page 1 (like the rocket scientists at IPDPS 2009 who decided it would be a good idea to assign neither page numbers nor paper IDs [example]). It's a little embarrassing when you cite two papers in your article and they both start on page 1 of the same conference. (Usually, you should figure out the paper number in the conference and use . If you can't make your page numbers unique, leave them out entirely.)
DOIs: DOIs uniquely identify a paper. Even if your style doesn't use them, you should record them in your bibtex file. Store them as the numbers only (DOIs have the format ; store the part after only). Bibliography tools seem to use this format predominantly.
URLs: If you're putting a URL into your bibliography, wrap it in (and put in your LaTeX preamble) so it wraps nicely. If you add a DOI with a tag, you don't need to add the DOI as as well.
Let's see where digital libraries get these things wrong! Corrections are in blue.
Problems with IEEE: Did not use the names that were printed on the paper; did not put accents on proper characters; did not separate first initial and middle initial with a space; venue title is strangely wrapped around with the comma; did not capitalize paper title as it was on the paper; did not use bibtex month abbreviations; did not use en-dash to separate out page numbers.
Problems with ACM: Did not capitalize paper title as it was on the paper; added a URL that's redundant with the DOI; did not store DOI as numbers only. Notable: On this paper, ACM got the venue capitalization correct!
Also see Dan Wallach's thoughts on the matter.
John Owens | Last updated .