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.

\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.

  • 1
    \titleformat{\subsection} [block]{\large\bfseries\filcenter}{}{0em}{\MakeUppercase} should do the trick. What's the \vspace{0pt} for?
    – Bernard
    Nov 4 '17 at 13:31
  • Thanks @Bernard I'll try this tonight and see how it goes. The \vspace{0pt} was there as I took this code from another post on here. I wasn't as experienced in LaTeX so just copied it verbatim. I'll see what happens when I remove it.
    – C. de Haer
    Nov 7 '17 at 2:29
  • Thanks @bernard works well - needed a little tweaking, but its exactly what I want!
    – C. de Haer
    Nov 8 '17 at 11:02
  • @Bernard do you want to add an answer?
    – Johannes_B
    Mar 10 '18 at 9:50

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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