在目录中的章节条目前添加“章节”会导致许多冲突

在目录中的章节条目前添加“章节”会导致许多冲突

我正在尝试在目录中的章节号前添加“章节”。

我使用的代码是

\makeatletter
\patchcmd\@chapter
  {\numberline {\thechapter }}
  {\@chapapp~ \numberline {\thechapter }}
  {}{}
\makeatother

但是,它与文件中的其他部分存在许多冲突.cls。例如,

\usepackage{calc}
\newcommand{\t@cfill}{\cleaders\hbox{$\m@th \mkern\@dotsep mu . \mkern\@dotsep mu$}\hfill}
\newcommand{\abbrl@bel}[1]{\makebox[\labelwidth][l]{\textbf{#1}\ \t@cfill}}
\newenvironment{mclistof}[2]{%
   \chapter*{#1}%
   \addcontentsline{toc}{chapter}{#1}
   \begin{list}{}%
   {\renewcommand{\makelabel}{\abbrl@bel}%
    \setlength{\labelwidth}{#2}%
    \setlength{\leftmargin}{\labelwidth+\labelsep}%
    \setlength{\itemsep}{0pt}%
    \markboth{#1}{#1}%
   }}
   {\end{list}\mtcaddchapter}
\newenvironment{alwayssingle}{%
       \@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
       \else\newpage\fi}
       {\if@restonecol\twocolumn\else\newpage\fi}
\newcommand{\@acknowledgementstitle}{Acknowledgements}

\newenvironment{acknowledgements}{
\cleardoublepage
\begin{alwayssingle}
% \setsinglecolumn
\chapter*{Acknowledgements}
\thispagestyle{plain}
\pagestyle{plain}
}
{\end{alwayssingle}}

平均能量损失

\documentclass[12pt]{book}
\usepackage{etoolbox}

\makeatletter
\patchcmd\@chapter
  {\numberline {\thechapter }}
  {\@chapapp~ \numberline {\thechapter }}
  {}{}
\makeatother


\usepackage{calc}
\newcommand{\t@cfill}{\cleaders\hbox{$\m@th \mkern\@dotsep mu . \mkern\@dotsep mu$}\hfill}
\newcommand{\abbrl@bel}[1]{\makebox[\labelwidth][l]{\textbf{#1}\ \t@cfill}}
\newenvironment{mclistof}[2]{%
   \chapter*{#1}%
   \addcontentsline{toc}{chapter}{#1}
   \begin{list}{}%
   {\renewcommand{\makelabel}{\abbrl@bel}%
    \setlength{\labelwidth}{#2}%
    \setlength{\leftmargin}{\labelwidth+\labelsep}%
    \setlength{\itemsep}{0pt}%
    \markboth{#1}{#1}%
   }}
   {\end{list}\mtcaddchapter}

\newenvironment{alwayssingle}{%
       \@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
       \else\newpage\fi}
       {\if@restonecol\twocolumn\else\newpage\fi}

\newcommand{\@acknowledgementstitle}{Acknowledgements}

\newenvironment{acknowledgements}{
\cleardoublepage
\begin{alwayssingle}
% \setsinglecolumn
\chapter*{Acknowledgements}
\thispagestyle{plain}
\pagestyle{plain}
}
{\end{alwayssingle}}


\usepackage{blindtext}% Dummy text for the example
\begin{document}
\tableofcontents
\blinddocument
\end{document}

答案1

附带tocloft包装:

\usepackage{tocloft}
\renewcommand{\cftchappresnum}{Chapter } % put Chapter before the number
% Now make extra space for the word
\newlength{\mylen} % a "scratch" length, choose any name you like
\settowidth{\mylen}{\bfseries\cftchappresnum\cftchapaftersnum} % extra space
\addtolength{\cftchapnumwidth}{\mylen} % add the extra space

更多详细信息请参阅软件包文档 ( > texdoc tocloft)。

相关内容