3

Consider this example:

\documentclass{report}
%% \clubpenalty=10000                                                                                                                                                                                       
%% \widowpenalty=10000                                                                                                                                                                                      

\begin{document}
\tableofcontents

\chapter{Introduction}

\chapter{Background}

\chapter{Setup}

\chapter{Methodology}

\chapter{Data}

\chapter{Statistical Selection}

\chapter{Uncertainties}

\chapter{Results}

\section{Results of methodology 1}

\section{Results of methodology 2}

\section{Results of methodology 3}

\section{Results of methodology 4}

\section{Results of methodology 5}

\section{Resuts of methodology 6}

\section{Results of methodology 7}

\section{Results of methodology 8}

\section{Results of methodology 9}

\section{Results of methodology 10}

\section{Results of methodology 11}

\section{Results of methodology 12}

\section{Results of methodology 13}

\section{Results of methodology 14}

\section{Resullts of methodology 15}

\chapter{Conclusions}

\chapter{Appendix}

\chapter{Bibliography}

\end{document}

The TOC continues to next page with only one line:

enter image description here

There is no improvement also after I uncomment the lines:

%% \clubpenalty=10000                                                                                                                                                                                       
%% \widowpenalty=10000

which I tried according to How do I prevent widow/orphan lines?

How to make TOC either more sparse so that page 2 has more lines or more compact so that TOC is not continued to page 2?

  • Technically it is not an widow or orphan since every entry is a separate paragraph. – John Kormylo Apr 16 '19 at 15:55
  • 2
    That's Murphy's law in all its glory! ;-) Don't worry about this until the document is finished. At that point, just after \begin{document} add \addtocontents{toc}{\protect\enlargethispage*{\baselineskip}} and rerun LaTeX a couple of times. You might need 2\baselineskip or even -2\baselineskip depending on how many lines actually end up in the second page. – egreg Apr 16 '19 at 16:24
2

You should worry about these details only when the document is finished and is in its really-really-no-more-changes-to-the-text status.

At that point, you may realize that your “Bibliography” line is no longer alone in the second page. But it could, or there might be two lines.

Moving one line to the first page is easy: add \addtocontents{toc}{\protect\enlargethispage*{\baselineskip}} to your document:

\documentclass{report}

\begin{document}

\addtocontents{toc}{\protect\enlargethispage*{\baselineskip}}

\tableofcontents

\chapter{Introduction}

\chapter{Background}

\chapter{Setup}

\chapter{Methodology}

\chapter{Data}

\chapter{Statistical Selection}

\chapter{Uncertainties}

\chapter{Results}

\section{Results of methodology 1}

\section{Results of methodology 2}

\section{Results of methodology 3}

\section{Results of methodology 4}

\section{Results of methodology 5}

\section{Resuts of methodology 6}

\section{Results of methodology 7}

\newpage

\section{Results of methodology 8}

\section{Results of methodology 9}

\section{Results of methodology 10}

\section{Results of methodology 11}

\section{Results of methodology 12}

\section{Results of methodology 13}

\section{Results of methodology 14}

\section{Resullts of methodology 15}

\chapter{Conclusions}

\chapter{Appendix}

\chapter{Bibliography}

\end{document}

and after a couple of LaTeX runs you'll obtain the desired output

enter image description here

If instead the second page of the table of contents turns out to have two or three lines, it may be impossible to squeeze them in the first page, but you can shorten the first page so as to move a couple of lines more in the second page, with

\addtocontents{toc}{\protect\enlargethispage{-3\baselineskip}

or with a different factor, depending on what you actually have at the bottom of the first page.

But, I insist, do this only when the document is in its final state, really no more changes to the text.

| improve this answer | |
2

You can use package tocloft to get the space after the heading of your TOC a little bit smaller.

\usepackage{tocloft} % <================================================
\addtolength{\cftaftertoctitleskip}{-\baselineskip} % <=================

Then the TOC can be placed completly on one page as the following code shows (package showframe is only used to visualize the typing area and margins):

\documentclass{report}

\usepackage{showframe} % <==============================================
\usepackage{tocloft} % <================================================
\addtolength{\cftaftertoctitleskip}{-\baselineskip} % <=================
%% \clubpenalty=10000 
%% \widowpenalty=10000


\begin{document}

%\enlargethispage{2\baselineskip} % 
\tableofcontents

\chapter{Introduction}

\chapter{Background}

\chapter{Setup}

\chapter{Methodology}

\chapter{Data}

\chapter{Statistical Selection}

\chapter{Uncertainties}

\chapter{Results}

\section{Results of methodology 1}

\section{Results of methodology 2}

\section{Results of methodology 3}

\section{Results of methodology 4}

\section{Results of methodology 5}

\section{Resuts of methodology 6}

\section{Results of methodology 7}

\section{Results of methodology 8}

\section{Results of methodology 9}

\section{Results of methodology 10}

\section{Results of methodology 11}

\section{Results of methodology 12}

\section{Results of methodology 13}

\section{Results of methodology 14}

\section{Resullts of methodology 15}

\chapter{Conclusions}

\chapter{Appendix}

\chapter{Bibliography}

\end{document} 

and gives the result:

resulting toc

| improve this answer | |
  • I experience this error when compiling: (/usr/local/texlive/2018/texmf-dist/tex/latex/tocloft/tocloft.sty ! LaTeX Error: Command \c@lofdepth already defined. Or name \end... illegal, see p.192 of the manual. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.614 \newcounter{lofdepth} \setcounter{lofdepth}{1} – Viesturs Apr 16 '19 at 7:54
  • The interference is cause by \usepackage{subfig} . I manage to patch the problem by moving \usepackage{subfig} after your insertion. – Viesturs Apr 16 '19 at 8:05
  • It also appears \clearpage must precede and follow \tableofcontents when preceded by \chapter*{abstract} and followed by \listoffigures – Viesturs Apr 16 '19 at 8:17
1

Just add this change in \baselinestretch around \tableofcontents

\begin{document} 
\renewcommand{\baselinestretch}{0.95}\normalsize 
\tableofcontents 
\renewcommand{\baselinestretch}{1.075}\normalsize

d

| improve this answer | |
1

The \l@chapter for report class uses \vskip 1.0em \@plus\p@ between entries. I just added some shrinking glue.

\documentclass{report}
\makeatletter
\renewcommand*\l@chapter[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \vskip 1.0em \@plus\p@ \@minus\p@
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil
      \nobreak\hb@xt@\@pnumwidth{\hss #2%
                                 \kern-\p@\kern\p@}\par
      \penalty\@highpenalty
    \endgroup
  \fi}
\makeatother

\begin{document}
\tableofcontents

\chapter{Introduction}

\chapter{Background}

\chapter{Setup}

\chapter{Methodology}

\chapter{Data}

\chapter{Statistical Selection}

\chapter{Uncertainties}

\chapter{Results}

\section{Results of methodology 1}

\section{Results of methodology 2}

\section{Results of methodology 3}

\section{Results of methodology 4}

\section{Results of methodology 5}

\section{Resuts of methodology 6}

\section{Results of methodology 7}

\section{Results of methodology 8}

\section{Results of methodology 9}

\section{Results of methodology 10}

\section{Results of methodology 11}

\section{Results of methodology 12}

\section{Results of methodology 13}

\section{Results of methodology 14}

\section{Resullts of methodology 15}

\chapter{Conclusions}

\chapter{Appendix}

\chapter{Bibliography}

\end{document}

One can simplify this edit using the etoolbox package.

\usepackage{etoolbox}
\makeatletter
\patchcmd{\l@chapter}{1.0em \@plus\p@}{1.0em \@plus\p@ \@minus\p@}{}{}
\makeatother
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.