Fix numerous doxygen markup problems.

Doxygen got bent all out of shape in various places because formulas were opened
but not closed, and a number of other markup problems as well.