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?
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
EDIT: For top-level-entries (e.g. chapters in books) that add some vertical space before their respective ToC entry, a larger value (say,
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:
You could try making your table of contents in a slightly smaller font:
Or if some of your contents entries have long names and break onto a second line, you could give them a shorter optional name that appears in the contents:
There is also the option to try and make your contents be two columned. Several packages do this (e.g. biblatex's documentation is like this) but I can't remember how to do this.
Yet another way to forcibly make ToC fit into one page is to put
right after the
It's maybe not elegant, but something will have to give, and this is one more option. The advantage is that you don't reduce the vertical space between the text and the footer, which is in most cases smaller (thus less flexible for changing) than the space between the title and the first entry. Hope it helps!