[Tex/LaTex] All Caps for Section name, but not when in Contents

sectioningtable of contentstitlesec

I have multiple subsections in my document, where I have used All Caps (I will add that I have typed this as All Caps and not used a command). Obviously, when I generate a table of contents the subsection names are all in All Caps too.

Is there a way to make the subsection headers in All Caps, but when they are used in the contents they are not?

To complicate matters some subsection titles include both All Caps text, followed by text which is not in All Caps. I can't use a subsubsection for these as the two lots of text belong together.

\usepackage{titlesec}
\titleformat{\section} {\Large\bfseries\center}{}{0em}{\hrule height 0.4pt\vspace{2pt}}[\hrule height 0.4pt] \titlespacing*{\section} {0pt}{0pt}{10pt}

\titleformat{\subsection} {\large\bfseries\center}{}{0em}{\vspace{0pt}} \titlespacing*{\subsection} {0pt}{0pt}{0pt}

\titleformat{\subsubsection} {\normalsize\bfseries\center}{}{0em}{\vspace{0pt}} \titlespacing*{\subsubsection}  {0pt}{0pt}{0pt}

This is my code for the sections, subsections and subsubsections, so I am happy to include a command in there to make the subsections All Caps if that works.

Best Answer

Using this code for, say, subsections:

\titleformat{\subsection} [block]{\large\bfseries\filcenter}{}{0em}{\MakeUppercase}

and similarly for the other levels produces what you want: the subsection title is uppercase, but what is used in the table of contents and in headers/footers is as you typed it.