# [texhax] Problem with orphaned heading when defining TOC layout for \part wth \usepackage{titletoc}

Niall Mansfield texhax at uit.co.uk
Wed Sep 26 15:46:13 CEST 2007

I am redefining the layout for the TOC entry for \part{}
using the titletoc package.  Code below works almost OK, but
it can give an orphan "part" line at the end of a TOC page
(shown below).

How do I fix this?

More generally, how do I "see whether there is XYZ amount
of space left on this page, and if not, start another page now"?

Thanks,
Niall

=========================================================

My definition is:

\titlecontents{part}[0pt]
{\contentspush{\thecontentslabel\ }}
{}
{\hfill\contentspage}

============ example of problem output ================
...