我想在目录中的章节号前添加“章节”一词。我搜索了解决方案,但回答最多的问题是当我们使用 tocloft 包时,我没有使用过。使用 tocbibind 包时我可以给出这个词吗?
答案1
困难的部分是正确地获得悬挂缩进。
\documentclass{report}
\makeatletter
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\settowidth{\@tempdimb}{\normalsize\bfseries \chaptername~}%
\advance\leftskip by \@tempdimb
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@tempdima
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
\chaptername~#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
\makeatother
\begin{document}
\tableofcontents
\chapter{A very very very very very very very very very very very very very very very very very very long title}
\end{document}