I want to modify my table of contents so that all letters in it become capital letters. How can I achieve this without changing anything else about the layout? My font does not have small caps, so I cannot simply use

{\scshape \tableofcontents}


Also, I found the following snippet, but it only changes sections:

\usepackage{textcase, etoolbox}
\makeatletter
\patchcmd{\l@section}{#1}{\MakeTextUppercase{#1}}{}{}
\makeatother

• {\sc\tableofcontents} almost works for me (except for chapter titles, but maybe those are redefined somehow by my style) Mar 4, 2020 at 13:40
• @Ansa211 That would probably have worked if I had a font that had small caps. I'll update my question. Thanks! Mar 4, 2020 at 13:55

For an article you can use tocloft and etoolbox for uppercase your sections, subsections and subsubsections. With book environment, you need to substitute section->chapter and cftsecfont->cftchapfont.

\documentclass{article}
\usepackage{tocloft}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\l@section}
{\cftsecfont #1}
{\cftsecfont {#1}}
{}
{}
\makeatother
\renewcommand\cftsecfont{\bf\MakeUppercase}

\makeatletter
\patchcmd{\l@subsection}
{\cftsubsecfont #1}
{\cftsubsecfont {#1}}
{}
{}
\makeatother
\renewcommand\cftsubsecfont{\small\MakeUppercase}

\makeatletter
\patchcmd{\l@subsubsection}
{\cftsubsubsecfont #1}
{\cftsubsubsecfont {#1}}
{}
{}
\makeatother
\renewcommand\cftsubsubsecfont{\small\MakeUppercase}

\begin{document}

\tableofcontents

\section{First one}
\section{Second one}
\subsection{Subsection}
\subsubsection{Subsubsection}

\end{document}


Also, you can use \section[UPPERCASED TEXT]{Normal text} and the same thing with \subsection[]{} and \subsubsection[]{}.

Hope it works! Have a nice day!

• Thanks! This does work for sections, but subsections and subsubsection are still written as normal. Also, it does change the look of the table of contents in some ways (for example, sections are bolded by default but this removes this). Mar 4, 2020 at 14:22
• I updated the answer. Hope it works as you want! Mar 4, 2020 at 14:29
• It did! I have accepted it now. Thanks again! Mar 4, 2020 at 18:31
• Great! Have a nice day @Speldosa Mar 4, 2020 at 20:24