remove trailing \, TOC, and page breaks