Output TOC and tree in sorted order