How to write the chapter titles in Upper Case in the table of contents ?
Asked
Active
Viewed 3,440 times
2
-
Some more information is needed. What document class are you using? – egreg Apr 21 '13 at 22:50
-
book document class – Muhammad Apr 21 '13 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.) – Apr 22 '13 at 07:17
1 Answers
6
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}

Przemysław Scherwentke
- 37,268
-
2
-
1@egreg You are right. Redefining the whole definition is for educational purposes. – Przemysław Scherwentke Apr 21 '13 at 23:12
-
-
@Muhammad Strange:
\uppercase? Are you using LaTeX2.09? – Przemysław Scherwentke Apr 21 '13 at 23:22 -
1Your current solution only works for chapters in
\mainmatter, but not for those in\frontmatteror\backmatter. You need to add\MakeUppercasealso in the\elsebranch. – Gonzalo Medina Apr 21 '13 at 23:45 -
@GonzaloMedina Thank you! (Yes, I know: we do not use "thank you". Higly complicated!) Corrected. – Przemysław Scherwentke Apr 21 '13 at 23:50