Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question

migrated from stackoverflow.com Aug 28 '11 at 12:08

This question came from our site for professional and enthusiast programmers.

    
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Nov 30 '11 at 6:37
add comment

1 Answer 1

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.