fix for pdf generation

functions that documented possible raised exceptions caused
latex too deeply nested errors.
fixed a lot of formatting issues.
Merge pull request #88 from AndrewAnnex/fixed_pdf_docs

fix for pdf generation