Large accuracy improvements on toc-box

This fixes a lot of accuracy issues with the toc-box, especially around the top and bottom of the page. There are still a few issues around the bottom, but that will require further coding and testing that I will do later. This also adds much better accuracy after the page is resized.
Merge pull request #23 from seaside98/patch-1

Large accuracy improvements on toc-box - looks good!