# Automatic Capitalization of sectioning headings?

Is there anyway to make LaTeX automatically capitalize sectioning headings?

That is, I would like this to generate a capitalized headline:

\documentclass{article}
\begin{document}
\section{This should be in title case.}
But it isn't.
\end{document}


Another solution, using any additional package, it to modify the \section, \subsection etc. macros. It can be done fairly easily with the following

\makeatletter
\renewcommand{\section}{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus .2ex}%
{\normalfont\Large\scshape\bfseries}}

\renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\large\scshape\bfseries}}

\renewcommand{\subsubsection}{\@startsection{subsubsection}{2}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\normalsize\scshape\bfseries}}
\makeatother


The title of the section, subection and subsubsection will then be in small caps.

• I don't think this is a particularly good solution as you'd have to change the hardcoded dimensions almost any time you're using a different document class/document layout. – user10274 Aug 23 '13 at 13:19
• In fact, this is the proper way to do it, since it doesn't require packages not part of the standard distribution. Thanks again. – vy32 Aug 23 '13 at 15:25

sectsty provides easy hooks into sectional units. \MakeUppercase turns the title into UPPERCASE, while \titlecap (from titlecaps) turns it into Title Case.

\documentclass{article}
\usepackage{sectsty}% http://ctan.org/pkg/sectsty
\usepackage{titlecaps}% http://ctan.org/pkg/titlecaps
\begin{document}
\tableofcontents
\sectionfont{\MakeUppercase}
\section{This should be in upper case}
It is!
\sectionfont{\titlecap}
\section{This should be in title case}
It is!
\end{document}

• How to make the title in the table of content print with the same style as in the body? – Mr. Ree Nov 4 '16 at 12:21
• @Mr.Ree: I don't understand... can you elaborate (or ask a new question)? – Werner Nov 4 '16 at 14:26
• @Werner For example, the section title "This should be in upper case" in the table of content is different from "THIS SHOULD BE IN UPPER CASE" in the body. How to make both of them be uppercase? Thanks. – Mr. Ree Nov 5 '16 at 9:21
• @Mr.Ree: Consider this paste. It uses xparse to intercept and manipulate the arguments passed to \section - inserting \MakeUppercase. – Werner Nov 6 '16 at 5:08
• but "In" should not be capitalized ? isn't it ? – Julien Narboux Jul 21 '17 at 7:53