Is it possible make the section names globally title case?
As mentioned by Werner in his comment, Steven Segletes's titlecaps
package provides a macro called \titlecap
that capitalises every word of its argument. Simply use that macro in the last mandatory argument of \titleformat
from the titlesec
package to typeset the heading of interest in title case.
Edit: as Gonzalo Medina remarks, no need for the explicit
package option.
\documentclass{article}
\usepackage{titlesec}
\usepackage{titlecaps}
\titleformat{\section}
{\normalfont\bfseries\Large}
{\thesection}
{1em}
{\titlecap} % <---- leave empty to get the default heading (in article)
\titleformat{\subsection}
{\normalfont\bfseries\large}
{\thesubsection}
{1em}
{\titlecap} % <---- leave empty to get the default heading (in article)
\begin{document}
\section{this should be title case}
\subsection{this should also be title case}
\end{document}
Here is a simple way with sectsty
:
\documentclass{article}
\usepackage{sectsty}
\usepackage{titlecaps}
\allsectionsfont{\titlecap}
\begin{document}
\section{This should be title case}
\subsection{This should also be title case}
\end{document}
This will make all sectional headings in title caps. If you want this for only section fonts, use
\sectionfont{\titlecap}
You can use the titlesec
and titlecaps
packages and use the formatting command:
\titleformat{\section}[hang]{\Large\bfseries}{\thesection}{\titlecap}
The 1st argument after [hang] describes the global formatting of label + section title; the second argument describes commands specific to the labal and the third argument is for commands specific to the section title.
The titlecap
command (suggested by @Werner) makes uppercase the first letter of the relevant words of a text. This supposes that rules are specified to determine which words have to be capitalised and which don't. This is done by default for English, and there is a \Addlcwords
command to add words to the list of words that must be in lowercase. However, it cannot work for languages like French that have less simple rules for capitalising titles,, depending on the structure of a sentence, and not only on a list of words
If you want a small caps title, with uppercase first letter, you can load titlesec with the explicit
option, and replace \titlecap with \textsc{\titlecap{#1}}
.