Archive for the ‘Programming’ Category

Simple way of keeping track of bibtex-sources

Sample referencesIt’s always been a painfull task, trying to fill in all the bibtex-fields when adding a new source to your LaTeX-document. www.CiteULike.org simplifies this by allowing you to search the scientific publications in its database and exporting as bibtex.

That search engine can be a real time saver when trying to find your sources in BibTex-format. They also offer registred members a library of their own which they can export very easily. This has changed the way I work when writing reports. As soon as I want to cite some paper, a quick search for it on CiteULike adds it to my library. The entire library can then be exported as a bibtex-document which is perfect. What is not so good is that they add a lot of extra information.

But, that’s why I have a python-script  which downloads my current library, filters out unwanted fields in the bibtex-file and saves as a file. For each LaTeX-document I write, I always point the bibliography to the same file and voilá.

updateReferences.py (Adjust the three variables in the beginning to your environment and needs).

The next step would be to automatically call this updateReferences-script when bibtex is run…

CiteULike example

Matlab and Ubuntu 10.04

Matlab 2009bWhen I started Matlab 2009b on my new install of Ubuntu Lucid Lynx (10.04) I had the problem that some keys weren’t working. Most notably, the [] didn’t work which is quite bad when writing Matlab-code. Also, the terminal outputs this message:

Warning: X does not support locale en_HK.utf8

The problem is that the locale is set to utf8 (small caps) while Matlab requires UTF-8. By specifying the locale before we start Matlab we solve the problem.

Remove the symbolic link to matlab in /usr/local/bin/matlab with

sudo rm /usr/local/bin/matlab

and create a script in its place:

sudo gedit /usr/local/bin/matlab:

and paste this as it’s content:

#!/bin/bash
# Start Matlab with the right encoding
echo “Starting Matlab with en_HK.UTF-8 coding”
LC_CTYPE=”en_HK.UTF-8″ /usr/local/Matlab2009b/bin/matlab

where you change en_HK to something that seems appropriate and is part of the list produced by locale -a. My Matlab is installed in /usr/local/Matlab2009b/.