Documentation

restores (some of) the book-writing script, and fixes several comments and whitespaces to make the LaTeX-based rendering more readable.