[Tex/LaTex] Capitalization and periods in LaTeX section headings

capitalizationsectioning

I’m fairly new to LaTeX but love it. I am putting together the backbone of my dissertation in Report class. I am bound to APA style for headings. Using the Titlesec package I’ve got the headings very close, and here is my question: The level 2 heading (section) has major words capitalized, bold font flush left. The third level (subsection) is only first word capitalized, indented, and ends with a period. Is it worth trying (or even possible) to format the sections in Titlesec to handle the capitalization and periods, or should I just type the headings in that way every time and not worry about it?
Thanks for your time

Best Answer

The following might work for you:

\documentclass{article}
\usepackage{ifmtarg}% http://ctan.org/pkg/ifmtarg
\let\oldsubsection\subsection% Keep "old" definition of \subsection
\makeatletter
\renewcommand{\subsection}[2][]{% First letter capatalized and end in period.
  \@ifmtarg{#1}%
    {\oldsubsection{\MakeUppercase #2.}}% \subsection[..]{...}
    {\oldsubsection[#1]{\MakeUppercase #2.}}% \subsection{...}
}
\makeatother
\begin{document}
\section{FIRST SECTION}%
\subsection{first subsection} Here is some dummy text.
\subsection{Second subsection} Here is some more dummy text.
\end{document}

The renewed \subsection command makes a choice depending on whether you supply a different (shorter) ToC entry or not. Regardless, \MakeUppercase converts the first character to uppercase, and appends a . at the end of the subsection title.

Subsection formatted with first letter capitalized and ending in period.

Note that the new \subsection definition will always append the subsection title with a period, regardless of whether you add one or not. However, the capitalization is less rigid, as you can see from my example.

Even though the example provided is typeset in the article documentclass, it would work similarly for the report documentclass.

Related Question