MegaScript for compiling latex automatically