Restructure documentation and improve contents tables (backport)

Presently, the new RTD contents list in the sidebar is more or less unusable:

https://www.dropbox.com/s/bl36v087cza6r7v/Screenshot%202014-07-14%2014.48.21.png (image)

The new version looks like:

https://www.dropbox.com/s/soiv9iq4vss1v9k/Screenshot%202014-07-14%2014.49.50.png

The expanded table of contents still appears in the main index page.

conf.py has also been updated to use the new RTD theme locally, if the user has it installed; if not
it will use the built-in theme as usual.

Also includes miscellaneous minor corrections - typos and whitespace.