Added latex stuff and test cases.