[Tex/LaTex] Overfull hbox in table of contents

table of contentswarnings

First of all, I've seen the answers which are recommending fiddling with \pnumwidth and \tocmarg — changing these are only shifting the problem elsewhere within the toc, lof and lot.

How can I get no overfull hboxes in the toc, lof and lot (e.g. allow it to be sloppy and underfill)? I've also seen tocloft package but wish to avoid, as it causes problems with page headers.

\documentclass[a4paper, 12pt]{report}
\usepackage[a4paper,left=4cm,right=2.5cm,top=3.5cm,bottom=3cm]{geometry}

\begin{document}
\begin{titlepage}
\centering
\today
\end{titlepage}
\tableofcontents
\chapter{Chapter title}
\section{Section title}
\subsection{Subsection containing extremely lengthy heading obnoxiously} % toc overrun by this title, words picked deliberately to exhibit the flaw
\end{document}

Best Answer

You could use the optional argument of the sectioning commands:

\subsection[shorter title]{longer title}

In this way LaTeX will show the longer title in the main document, using the shorter version for headings and toc entries.