Monday 19 April 2010

Academic Earth

I've recently been brushing up on my game theory and computer science and I came across a website called Academic Earth which I thought deserved some free publicity.

You can watch, completely free of charge, lectures from MIT, Stanford, Berkeley, Harvard, Princeton, and Yale on a wide range of subjects. In my currently limited experience, the quality is generally high - I've been enjoying Benjamin Polak's course on game theory and Julie Zelenski's course on programming abstractions - although as in "real life", some lecturers are better than others. Hopefully the ratings system will help you steer clear of those - and don't worry, they have humanities courses as well!

Thursday 1 April 2010

(La)TeX to PNG

I've had a bit of a U-turn since my previous blog post on the subject of MathML. As my brother kindly pointed out, the best (in terms of compatibility at least) solution for displaying complicated mathematical equations in a web browser is simply to use images.

The reason I had previously rejected this approach is the added complexity involved in producing these image files. But after weighing up the advantages and finding myself with some free time in which to install Cygwin, this problem has now largely been mitigated.

For the interested, here are the technical details. You're going to need some kind of TeX installation. If you're a Windows user, I'd recommend using Cygwin and installing the various tetex packages. You'll also need ImageMagick to handle the image file conversion.
  1. Write your equation in TeX format in the following template:

  2. \documentclass{article}
    \pagestyle{empty}
    \begin{document}
    % equation goes here: $$  $$
    \end{document}

  3. Lets assume you've saved your TeX file as eqn.tex. Next compile the TeX to DVI using texi2dvi:

    texi2dvi eqn.tex

  4. Then convert the DVI file to encapsulated PS format:

    dvips -E eqn.dvi

  5. Finally convert the PS file to a PNG (or other image format) using Image Magick:

    convert -density 200x200 eqn.ps eqn.png
Credit due to Micahel Mazack's website for pointing me in the right direction. As usual, if you run into any difficulties feel free to leave a comment. And here's an example of the kind of results we get: