added tex documents and fixed some tests