目錄中的水平框已滿

目錄中的水平框已滿

首先,我看到了建議擺弄\pnumwidth和的答案\tocmarg——改變這些只會將問題轉移到目錄、lof 和許多其他地方。

我怎麼能在toc、lof和lot中得到沒有過滿的hbox(例如允許它草率和填充不足)?我也見過tocloftpackage 但希望避免,因為它會導致頁面標題出現問題。

\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}

答案1

您可以使用切片命令的可選參數:

\subsection[shorter title]{longer title}

這樣,LaTeX 將在主文檔中顯示較長的標題,而使用較短的標題和目錄條目。

相關內容