Some small protex changes

Biggest difference is to have shared library at beginning of protex document
and the stand-alone code at the end; still need to figure out how to add new
chapters and get the headers on the right pages...