Simplify if conditions
Add tests for the subcaption package
Fix some problems with formatting the documentation