How can I insert \MakeUppercase inside the table of contents for sections and subsection?

  • 1
    Are you using tocloft? Also, what \documentclass are you using? Your redefinition of \l@section doesn't really help much since it doesn't provide any context.
    – Werner
    May 11, 2013 at 5:58
  • Welcome to TeX.SX! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. May 11, 2013 at 7:54

1 Answer 1


This is a fairly general approach for changing the appearance of the entries in the table of contents.

The patch with \xpatchcmd* is just a way for avoiding copying the definition from latex.ltx and modifying it. The two places where #7 appears in \addtocontents are replaced by \@nameuse{format#1}{#7} so we can define \formatsection and so on to do what we want to the title in the TOC.


%%% Patching the kernel \@sect command

%%% for sections and subsections we want uppercase

%%% the other titles are left unchanged

%%% the following is necessary only if hyperref is used





\section{This is a section}

\subsection{This is a subsection}

\subsubsection{This is a subsubsection}


enter image description here

  • This works great, but how would you do it for \section*?
    – Paulius K.
    May 26, 2013 at 21:10
  • @PauliusK. \section* doesn't go to the TOC by default. Just add \MakeUppercase in the manually added \addcontentsline.
    – egreg
    May 26, 2013 at 21:15
  • Well this is embarassing... Nevertheless, your answer is the cleanest sollution I've found for uppercasing sections in ToC. Doing it is way too difficult in LaTeX.
    – Paulius K.
    May 26, 2013 at 21:26
  • @PauliusK. Maybe classes such as KOMA-Script ones (scrartcl, scrreprt or scrbook) or memoir provide "native" methods (although I'm not sure). Titles in all capitals are heavy and, in my opinion, should be avoided.
    – egreg
    May 26, 2013 at 21:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .