added latex support and other small changes