目录中的多行未编号章节

目录中的多行未编号章节

我不需要在目录中列出章节、节等的数字。但有些名称太长,所以它们是多行的。

它们的下一行比第一行稍微靠右。并且空白处的宽度与第一行上的数字相同。如何从第二行和下一行中删除该缩进?

\documentclass[a4paper]{book}

\begin{document}
\tableofcontents

\chapter*{Very very very very very very very very very very very very very very very very very very long title}
\addcontentsline{toc}{chapter}{Very very very very very very very very very very very very very very very very very very long title}

\end{document}

答案1

有以下几种可能性:

  • 用于\protect\numberline{}应用章节的常规缩进
  • \cftchapnumwidth通过临时将 设置为 来删除空间0pt(将其写入ToC),稍后再恢复。
  • \hfill very very

\documentclass[a4paper]{book}

\usepackage{tocloft}

\newlength{\standardchapnumwidth}

\AtBeginDocument{\setlength{\standardchapnumwidth}{\cftchapnumwidth}}
\begin{document}
\tableofcontents

\renewcommand{\cftchapnumwidth}{0pt}

% With indentation:

    \chapter*{Very very very very very very very very very very very very very very very very very very long title}
\addcontentsline{toc}{chapter}{\protect\numberline{}Very very very very very very very very very very very very very very very very very very long title}

\chapter*{Very very very very very very very very very very very very very very very very very very long title}
\addcontentsline{toc}{chapter}{\hfill Very very very very very very very very very very very very very very very very very very long title}



\addtocontents{toc}{\setlength{\protect\cftchapnumwidth}{0pt}}
\chapter*{Very very very very very very very very very very very very very very very very very very long title}
\addcontentsline{toc}{chapter}{Very very very very very very very very very very very very very very very very very very long title}


\addtocontents{toc}{\setlength{\protect\cftchapnumwidth}{\standardchapnumwidth}}
\chapter{Very very very very very very very very very very very very very very very very very very long title}

\end{document}

在此处输入图片描述

相关内容