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}
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}
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}
xparse to intercept and manipulate the arguments passed to \section - inserting \MakeUppercase.
– Werner
Nov 06 '16 at 05:08
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.
\@seccntformat) command, as explained in the TeX FAQ. The first example is actually exactly what you want to do.
– MBR
Mar 05 '21 at 11:00
If you're using hyperref, \MakeUppercase will break some ToC hyperrefs. You can use latex3 features as an alternative to \MakeUppercase, you'll just need to redefine \section. MWE:
\documentclass{article}
\usepackage{xparse}
\usepackage{hyperref}
\ExplSyntaxOn
\let\oldsection\section
\RenewDocumentCommand{\section}{ s o m }{ % Capitalize section headings
% \text_uppercase will replace \tl_upper_case in later l3token version
\tl_set:Nx\section_upper{\cs_if_exist:NTF{\text_uppercase:n}
{\text_uppercase:n{#3}}{\tl_upper_case:n{#3}}}
\IfBooleanTF{#1}
{\oldsection*{\section_upper}}
{\IfNoValueTF{#2}
{\oldsection{\section_upper}}
{\oldsection[#2]{\section_upper}}}}
\ExplSyntaxOff
\makeatletter
% Always capitalize section headings in ToC (tex.stackexchange.com/a/156917)
\let@oldcontentsline\contentsline
\def\contentsline#1#2{%
\expandafter\ifx\csname l@#1\endcsname\l@section
\expandafter@firstoftwo
\else
\expandafter@secondoftwo
\fi
{@oldcontentsline{#1}{\MakeUppercase{#2}}}%
{@oldcontentsline{#1}{#2}}%
}
\makeatother
\begin{document}
\tableofcontents
\section{this should be in upper case}
It is!
\end{document}
This Should Be In Title Case.orTHIS SHOULD …? Related: Capitalising first letter of each word in section headings using book class – Qrrbrbirlbel Aug 23 '13 at 02:37