cftXpresnum 与标题重叠

cftXpresnum 与标题重叠

根据tocloft包文档,我们应该能够使用\renewcommand{\cftsecpresnum}{something}在目录中的章节编号前插入一些文本(例如,应该适用于表格列表、图形列表和自定义列表\newlistof)。

但是,当我使用该命令时,我想在目录中的节标题条目之前插入的内容与节标题文本重叠。请参阅 MWE。我是不是漏掉了什么?我没有立即看到解决这个问题的答案,特别是关于该\cftsecpresnum命令tocloft是否有效。按照下面的方法,我必须使用它\cftsecindent作为一种解决方法,但包文档中没有提到这一点,不确定这是否是意图。

提前致谢!

\documentclass{report}

\usepackage{tocloft}
\renewcommand{\cftsecpresnum}{Something }

\begin{document}

\tableofcontents

\section{what}
  Bananas

\section{is the deal}
  Apples

\end{document}

在此处输入图片描述

答案1

如果,您必须增加该值\cftsecnumwidth。这是一个解决方案,使用calc

\documentclass{report}
\usepackage{calc}
\usepackage{tocloft}
\renewcommand{\cftsecpresnum}{Something }
\setlength{\cftsecnumwidth}{\widthof{Something\hspace{2.5em}}}
\setlength{\cftsecindent}{0pt}
\begin{document}

\tableofcontents

\section{what}
  Bananas

\section{is the deal}
  Apples

\end{document} 

在此处输入图片描述

相关内容