TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
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 '13 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}. – Marco Daniel May 11 '13 at 7:54

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

share|improve this answer
This works great, but how would you do it for \section*? – Paulius K. May 26 '13 at 21:10
@PauliusK. \section* doesn't go to the TOC by default. Just add \MakeUppercase in the manually added \addcontentsline. – egreg May 26 '13 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 '13 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 '13 at 21:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.