For those who do not have tetex, or as in my case, are on a server where the host has disabled exec(), you can also use the mimetex version available in the download link that Treo provided.
You'll need the precompiled mimetex.cgi binary, which is not easy to come by, but I did find one, so I've provided a Linux version:
DOWNLOAD LINK.
If you need another version, go here:
http://moodle.org/download/mimetex/right-click on the file that you need, and save as mimetex.cgi .
Upload this file to your cgi-bin and CHMOD to 755.
Just like Treo's version:
Upload the mimetex folder inside your Sources folder. CHMOD the pictures folder to 777.
Edit mimetex.php to your server settings.
Try example.php . If it works, do the mod:
in Subs.php, after line 728 add:
include_once('Sources/mimetex/mimetex.php');
$message = mimetex($message);
You can see it in action here:
LINK