Thursday, 26 January 2017

TeXStudio, Mendeley, biblatex and biber backend problems with undefined citations

I had a problem with citation in TeXstudio when I was trying to cite an entry from Mendeley, where the \cite{citationkey} command was showing an error that the month field was incorrect. I was using biblatex as this allowed me to have the citations in the format that I wanted, but I had to use the bibtex backend, as using the biber backend gave me a lot of errors.

Some googling showed that biber is more accepting of different date formats, and that bibtex wasn't able to process the dates as exported from Mendeley.

The command I had used to select the biber backend was as follows:

\usepackage[style=authoryear,backend=biber,bibencoding=ascii,date=year]{biblatex}

However this didn't work and all of my citations gave the following message:


LaTeX Warning: Citationref:[citeationkey]' on page 1 undefined on [filename] line 21.`

The problem here ended up being the version of the biber executeable installted by MiKTeX. Firstly, I updated MiKTeX by using the following link:

Start > All Programs > MiKTeX > Update (Admin)

I had to run this a few times, as the first run would only allow me to remove obsolete packages, and not install or update anything else. Once I had ran this a couple of times, I then also ran the non admin version.

Now doing Build & View in TeXstudio was giving errors about packages being missing, so I used the MiKTeX Package Manager to install the missing packages. This is located in

Start > All Programs > MiKTeX > Package Manager (Admin)

Here, I tried installing the package that was marked as missing, but there were always more packages. So instead, I sorted by the "Installed on" field, by clicking the name of the column, and then selected all of the entries that had an empty field (i.e. had not been installed). Then I right clicked and did "Install" and then waited.

Once completed, I was still having problems in TeXstudio. The warning looked like the following:

WARN - Warning: Found biblatex control file version 2.6, expected version 2.5

So I downloaded the file for the newest version of biber from Source Forge. The repository is here: https://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/ and the link to the 32 bit binary for windows is here: https://sourceforge.net/projects/biblatex-biber/files/biblatex-biber/current/binaries/Windows/biber-MSWIN32.zip/download

I downloaded this and placed it in the MiKTeX binary directory which is located here:

C:\Program Files (x86)\MiKTeX 2.9\miktex\bin

(Note that I had tried just replacing the biber.exe file with the newer version, however on it's own this hadn't worked).

Also note that it is important to delete all of the .aux files from your file that you are working from. In my case I deleted all of the files except for the .tex file.

The last thing to do if you haven't already done so, is to update the TeXstudio settings for building the document. Firstly, go to the "Bibliography" menu item, and at the bottom select Type: Biblatex.

Then go into Options > Configure TeXstudio...

Select "Build", and in the "Meta Commands" panel, find the "Default Bibliograpyh Tool" entry, click the drop down arrow and set it to "txk:///biber".

Now you should be good to go!