Sectioning in letter-type documents

Here's one possible solution, using the kernel command \@startsection (you chan find a description of this command in Where can I find help files or documentation for commands like \@startsection for LaTeX?) to redefine the \section command (the newlfm class offers a very basic \section command) and define the \subsection command to behave as those from article.cls. Basically, all you have to do is to define the counters and use \@startsection with appropriate settings. A simple example:

\documentclass[stdletter]{newlfm}

\newcounter{section}
\newcounter{subsection}[section]
\setcounter{secnumdepth}{3}
\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\Large\bfseries}}
\newcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\large\bfseries}}
\renewcommand \thesection{\@arabic\c@section}
\renewcommand\thesubsection{\thesection.\@arabic\c@subsection}

\makeatother

\begin{document}

\section{Test Section One}
\subsection{Test Subsection One One}
\subsection{Test Subsection One Two}
\section{Test Section Two}
\subsection{Test Subsection Two One}
\subsection{Test Subsection Two Two}

\end{document}

enter image description here

The previous solution doen't make provissions for a ToC, but this is also really simple: all one has to do is to define \tableofcontents using \@starttoc and define \l@section, \l@subsection to typeset the corresponding entries.


You have already accepted an answer, but I give you another option:

You can use scrlttr2 from the KOMAscript-bundle, and by by loading the letter class option file, section.lco, you will have sectioning commands. The appearance of the sections can be modified by standard komascript-commands. The .LCO also handles sections with star (\section*{Test}. section.lco gives you four levels of headings.

You can download section.lco from KOMAscript’s homepage. Put section.lco in your local-texmf, and remember to update the file database.

An MWE:

\documentclass[UKenglish]{scrlttr2}
\usepackage{babel,blindtext}
\usepackage[utf8]{inputenx}
\usepackage[T1]{fontenc}

\LoadLetterOption{sections}

\begin{document}
\begin{letter}{Name of Recipient \\ Address \\ of \\ Recipient}

\setkomavar{subject}{This is a strict formal letter}

\opening{}  % eg. Hello

\section{Section one}
\blindtext

\subsection{Subsection also}
\blindtext

\section{Section two}
\blindtext

\closing{Kind regards} %eg. Regards

\end{letter}
\end{document}