Biblatex Bibliography Style Invalid Security

To see our video based on this blog post click here.

For years LaTeX users have been using BibTeX along with multiple additional packages such as natbib to write bibliographies. However now there’s a new option, biblatex. It’s designed to give you many more options to easily configure your bibliographies/citations. Conveniently existing ‘.bib’ files are unlikely to need much altering to work with biblatex.

Unfortunately there isn’t much useful information available online other than the extensive documentation which you can access here. But in case you don’t fancy trawling through all of its 253 pages, here are a few things to get you started.

Basic Commands and Styles

Firstly the commands you use in the tex file to add a bibliography into the document are quite different. In the pre-amble you need to use the following code:

The first command just loads up the biblatex package. The second is used to specify which bib files you want to use. You simply enter the file name in the curly brackets including the ‘.bib’ extension. Then in the body of the document instead of using a command to construct the bibliography, you use the command. When using BibTeX you specify the bibliography style by using the command. In biblatex we no longer use this command, instead we specify style options by passing more arguments into the command. To do this we enter ‘style=’ followed by a style name into square brackets immediately before the curly brackets. For example:

Alternatively if you want to declare one style for the citations and a different style for the bibliography, you use the words ‘citestyle’ and ‘bibstyle’. Here’s an example:

Before moving on I will quickly show you what some of these styles look like for both the citations and the actual bibliography entry. However you can see pages 61-65 of the documentation for a full list of styles.

The numeric style:

The alphabetic style:

The reading style:

The authoryear style:

Another argument you can give the command is the sorting option. For example:

This would use the author-year style and then sort the bibliography entries by year, name, title. Here’s a list of some of the different sorting options available:

nty - Sorts entries by name, title, year.

nyt - Sorts entries by name, year, title.

nyvt - Sorts entries by name, year, volume, title.

anyt - Sorts entries by alphabetic label, name, year, title.

anyvt - Sorts entries by alphabetic label, name, year, volume, title.

ynt - Sorts entries by year, name, title.

ydnt - Sorts entries by year (descending order), name, title.

none - No sorting. Entries appear in the order they appear in the text.

If you don’t specify an order the default is nty.

Citation Commands

The citation commands have also been overhauled in biblatex. These more intelligent commands give you 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. Here’s an example:

In this example we’ve already loaded the alphabetic style and ‘latexcompanion’ is just the citation key. This is what the citation would look like in the text:

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 it empty.

There are also a number of different citation commands available for you to use. Here are some of the standard ones:

- the most basic one. Prints without any brackets except when using the alphabetic or numeric style when it uses square brackets.

- prints citations in parentheses except when using the alphabetic or numeric style when it uses square brackets.

- puts the citation in a footnote.

Subdividing Bibliographies

One of the nice things about biblatex is that you can subdivide bibliographies according to source type. Here’s an example of subdividing by source type:

In this example we are subdividing the bibliography into two sections, one for sources that are books and one for sources that aren’t. Here’s an example output:

Another way you can subdivide bibliographies is using a keyword filter. To do this you need to add a ‘keywords’ field into the entries in your bib file. E.g.

Here’s an example of how you’d then subdivide by keyword:

And the corresponding output:

It looks like one day soon BibTeX will be nothing but a piece of LaTeX history! I hope this has been helpful in getting you started with biblatex.

Posted by Josh Cassidy on 31 Jul 2013

I have a latex document and wanted to add references using bibtex. I created a file and saved it with the extension .bib. In the latex file I use \usepackage{biblatex} and then \bibliographystyle{style} \bibliography{PHcite} When I compile I get this error:

./Physics IA.tex:153: Package biblatex Error: '\bibliographystyle' invalid. See the biblatex package documentation for explanation. Type H for immediate help. ...

l.153 \bibliographystyle{style}


./Physics IA.tex:154: LaTeX Error: Can be used only in preamble.

See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ...

l.154 \bibliography {PHcite}


asked Jan 30 at 10:19


Leave a Reply

Your email address will not be published. Required fields are marked *