How to write the chapter titles in Upper Case in the table of contents ?
-
Some more information is needed. What document class are you using?– egregApr 21, 2013 at 22:50
-
book document class– MuhammadApr 21, 2013 at 22:50
-
Using uppercase only seems a bad decision. Do you mean a combination of uppercase and small caps? (Small caps substituted for lowercase.)– user10274Apr 22, 2013 at 7:17
1 Answer
The only change is \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}
-
2
-
1@egreg You are right. Redefining the whole definition is for educational purposes. Apr 21, 2013 at 23:12
-
-
@Muhammad Strange:
\uppercase
? Are you using LaTeX2.09? Apr 21, 2013 at 23:22 -
1Your current solution only works for chapters in
\mainmatter
, but not for those in\frontmatter
or\backmatter
. You need to add\MakeUppercase
also in the\else
branch. Apr 21, 2013 at 23:45