如何在目录中以大写形式书写章节标题?
答案1
唯一的变化是\MakeUppercase
。
\documentclass{book}
\begin{document}
\makeatletter
\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
\thispagestyle{plain}%
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\thechapter}\MakeUppercase{#1}}%
\else
\addcontentsline{toc}{chapter}{\MakeUppercase{#1}}%
\fi
\else
\addcontentsline{toc}{chapter}{\MakeUppercase{#1}}%
\fi
\chaptermark{#1}%
\addtocontents{lof}{\protect\addvspace{10\p@}}%
\addtocontents{lot}{\protect\addvspace{10\p@}}%
\if@twocolumn
\@topnewpage[\@makechapterhead{#2}]%
\else
\@makechapterhead{#2}%
\@afterheading
\fi}
\makeatother
\tableofcontents
\chapter{First}
Blah, blah.
\chapter{Second}
Blah, blah.
\end{document}