When I use \tableofcontents
I get all my contents in a single page except for a line that goes on the other page, how can I make all in the same page?
[Tex/LaTex] How to fit the table of contents into a single page
page-breakingspacingtable of contents
Best Answer
Add the following code line in the main text immediately before the chapter/section entry that starts a new ToC page:
This will enlarge the first ToC page by the value of
\baselineskip
(i.e. one line), which should make the last ToC entry fit on this page.EDIT: For top-level-entries (e.g. chapters in books) that add some vertical space before their respective ToC entry, a larger value (say,
2\baselineskip
) may be needed.EDIT 2: I have no satisfying answer why the page number is still positioned the way it is, but a workaround. Ignore my first answer and instead add the following to your preamble:
This will reduce the vertical space between chapter ToC entries from 1.0em to 0.8em, which hopefully is enough to make your ToC fit on one page.
EDIT 3: And here's a "satisfying" answer for the observed behaviour of my first solution -- quoting from source2e: