TransWikia.com

Table of content with long entry across two pages

TeX - LaTeX Asked by TheDon on April 3, 2021

In my thesis, I have a section with a very long name, which must appear in its entirety in the table of content.

The title consists of three lines and, unfortunately, it is split in two different pages. Is there any way to fix this by putting the whole section title in the second page?

Thanks!

2 Answers

You can adopt this answer given by Karl. In case if you want the section to stay in the current page as a whole, you may use

addtocontents{toc}{protectenlargethispage{baselineskip}} % here

Change baselineskip suitably.

Code: (adopted from linked answer):

documentclass[12pt]{book}

begin{document}

tableofcontents

chapter{Chapter}
section{Section}
section{Section}
chapter{Chapter}
section{Section}
subsection{Subsection}
subsection{Subsection}
section{Section}
subsection{Subsection}
subsection{Subsection}
chapter{Chapter}
section{Section}
section{Section}
chapter{Chapter}
section{Section}
subsection{Subsection}
subsection{Subsection}
section{Section}
subsection{Subsection}
subsection{Subsection}
chapter{Chapter}
section{Section}
%addtocontents{toc}{protectpagebreak[4]} % here
addtocontents{toc}{protectenlargethispage{baselineskip}} % here
section{Section that has some long lines Section that has some long lines Section that has some long lines Section that has some long lines Section that has some long lines}
subsection{Subsection}
subsection{Subsection}
subsection{Subsection}

end{document}

enter image description here

Correct answer by user11232 on April 3, 2021

If the documentclass is a standard class you can switch to a counterpart KOMA-Script class. These classes prevent splitting of entries in lists like the table of contents automatically. The document classes article, report, and book can be replaced by scrartcl, scrreprt, and scrbook, respectively.

(Because KOMA-Script uses styles for the headings that differ from the styles in the standard classes, it is advisable to load the class with the headings=standardclasses option if the old familiar appearance is desired.)

Answered by fliomu on April 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP