在我的目录中,我需要在章节旁边添加一个章节词。
在哪里\thechapter
获取结果
\renewcommand*\@seccntformat[1]{ \csname the#1\endcsname.\enspace}
\def\numberline#1{\hb@xt@\@tempdima{#1.\hfil}}
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.0em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\mdseries
\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{.}\mkern \@dotsep
mu$}\hfill
\nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
%
\def\@makechapterhead#1{%
%\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\normalsize \bfseries \MakeUppercase{\@chapapp}\space \thechapter
\par\nobreak
\vskip\baselineskip
\fi
\interlinepenalty\@M
\LARGE \bfseries #1\par\nobreak
\vskip 40\p@
}}
%
\def\@makeschapterhead#1{%
%\vspace*{50\p@}%
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\LARGE \bfseries #1\par\nobreak
\vskip 40\p@
}}
%
答案1
正如评论中提到的,您可以在定义\@chapapp
之前添加;在下面的例子中,我使用了书籍文档类,但这将与使用的其他类一起使用:#1
\l@chapter
\documentclass{book}
\makeatletter
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.0em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
\@chapapp~#1\nobreak\mdseries% NEW
\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{.}\mkern \@dotsep
mu$}\hfill
\nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
\makeatother
\begin{document}
\tableofcontents
\chapter{Test Chapter One}
\chapter{Test Chapter Two}
\end{document}