# Using biber with gedit + rubber

I've been having a lot of problems trying to switch to biblatex with biber from bibtex, and after a few problems solved I'm at loss. The situation now:

• biblatex works when not using biber as a backend
• biber is installed (When I run biber --version I get biber version: 0.9.8)
• When running rubber (via the gedit latex plugin) on a document with biber as backend, nothing happens. I get no error, the document is continuously compiling but never finishes.

Here's a MWE:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber]{biblatex}
\usepackage{geometry}

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


I'm running Fedora 16 and Gnome 3. Does anyone know what I'm doing wrong?

-
It seems like you should try running biber from the command line on a real file (e.g., biber myfile.bcf) and see what kind of messages biber gives you (it is quite verbose). Also it looks like it has changed since version 0.9.6, but I need to add the .bib extension to my bibliography files (I'm guessing the optional argument takes now care of that, however). – jon Feb 28 '12 at 19:17
Yes, I'll try that. I already tried to run it on my bibliography biber bibliography.bib but that gave me a concerned error about me not having run it through biblatex first. So I'm not quite sure in which order to run commands with biber and biblatex (and was kinda hoping rubber would do it for me). Would you reccomend me to upgrade the bibliography to .bfc which I assume is the biblatex form? – Jóhann Feb 28 '12 at 19:50
PLK's answer should solve your problems. – jon Feb 28 '12 at 21:09

Couple of things:

1. You don't need to add the [datatype=bibtex] option to \addbibresource - that's the default
2. You need the full filename e.g. \addbibresource{bibliography.bib}. The optional arguments don't help with this.
3. Biber is not run on the .bib file, it's run on the .bcf file which is produced when you use the backend=biber option to biblatex. You can call biber on this file with or without the .bcf file extension.
-
I imagine there must be some issue with the gedit LaTeX plugin and biber, but with this answer I least successfully compiled the document on emacs with AUCTeX. Thanks :) – Jóhann Feb 28 '12 at 21:17

Disclaimer: This answer might be considered a hack, so there's no garantee to work for every document. :)

egreg and I were talking in the TeX, LaTeX and Friends chat room about the possibility of extending rubber to use biber. This answer is only possible because of his insight. Grazie mille, egreg. :)

First of all, note that rubber does not seem to be maintained anymore. The latest stable version - which is 1.1 - was released in 2006. IMHO the development version is far from usable.

rubber can be extended through modules. Plain and simple, a rubber module is a Python script following certain rules. Unfortunately, those modules are quite "rare" to find.

I wrote a post in our community blog about rubber. There's a nice usage of a module. For example, rubber offers no XeLaTeX support out of the box, but thankfully Wouter Bolsterlee provided an elegant solution by writing a module for it.

That said, I'll document the process I did just for completeness sake.

rubber has a rules/latex directory where you can find other modules. I'm also on Fedora 16, the location of this directory is:

/usr/lib/python2.7/site-packages/rubber/rules/latex


My approach here is to use a similar module and adjust it to our purpose. If we list rules/latex, we find a bibtex.py file there which is registered in the __init__.py - it means rubber assumes bibtex by default.

What I did was copying bibtex.py to a new file biber.py. Since both programs seem to work similarly, I assume it's only a matter of replacing one by the other. Again, I had no time to inspect the file, so it's far from being stable or bullet proof! Besides, biber might have some other particularities which are not covered in this approach.

I opened biber.py - which is an exact copy of bibtex.py and searched for occurrences of bibtex, replacing it by biber, including messages and the system call. I kept the function names intact - but nothing that a proper refactoring can solve.

OK, now I have the module. Now I need a test document. I've never used biber before, so I had to rely on the following MWE from How to use biber:

\documentclass[]{article}

\usepackage[autostyle]{csquotes}

\usepackage[
backend=biber,
style=authoryear-icomp,
sortlocale=de_DE,
natbib=true,
url=false,
doi=true,
eprint=false
]{biblatex}

\usepackage[]{hyperref}
\hypersetup{
}

\begin{document}
Lorem ipsum dolor sit amet~\citep{kastenholz}.
At vero eos et accusam et justo duo dolores et ea rebum~\citet{sigfridsson}.
\printbibliography
\end{document}


Now, in my terminal, I navigated to my test directory with both document.tex and mybib.bib. I called the following command:

\$ rubber --module=biber document


It's also possible to add a rubber directive in the top of the .tex file in order to call this module:

% rubber: module biber
\documentclass[]{article}
...


The output:

I checked the resulting document.pdf and all references were correctly displayed.

This dirty hack would require more tests, but so far it seems to work. :)

-
I think latexmk is generally the most used automatic wrapper now and it certainly supports biber. It comes with TeXLive too I think. – PLK Feb 29 '12 at 10:39
@PLK: Indeed. :) I'd say latexmk is the natural choice. rubber is a nice tool (I really like it), but the lack of support for new engines/packages is something that worries me. Writing new modules seems to be feasible, but I don't think it's a trivial task for the casual user. :( – Paulo Cereda Feb 29 '12 at 10:55
Haha, brilliant. This actually worked. But I hadn't realised rubber was such an outdated package. I guess I'll have a look at latexmk then, see how I like it. Thanks for the hack ;). – Jóhann Feb 29 '12 at 16:08
There is something very weird happening: rubber only calls the module if I call with the --pdf option, and it has to be before the module option, i.e., rubber --pdf --module=biber document works, but rubber --module=biber --pdf document dosen't. Otherwise your hack is just fine. – Mateus Araújo Nov 9 '12 at 14:40
@MateusAraújo: It's been a while since I wrote this, but I suspect that the bibtex rule in which I based my hack might require the --pdf format - I'm not sure though. :) And about the arguments order, I guess I have a better explanation: if I recall correctly, there's a note somewhere in the rubber manual which states that the arguments order matters, so that would explain why the module isn't called (maybe because --pdf is set later on, and the module depends on this condition). I'll take a look. :) – Paulo Cereda Nov 9 '12 at 14:47

It is possible to define rubber rules in the main tex file so that when the file is compiled and auxiliary files are produced/changed the biber command is triggered.

I have this in the top of my main.tex file:

% rubber: watch main.acn
% rubber: onchange main.acn 'makeglossaries main'

% rubber: watch main.bcf
% rubber: onchange main.bcf 'biber main'


The first two lines are related with glossaries package (which I use to produce acronyms) and the second two lines are the ones necessary to call biber instead of the regular bibtex.

Do not forget that the backend=biber option is required in biblatex for this to work.

\usepackage[backend=biber]{biblatex}


I hope this is useful!

-