3

I am writing an extensive letter document, and I would like to put a summary and a few chapters inside it. Is it possible to do that? Here my preamble:

\documentclass[boldsubject,italicsignature,smartindent]{letteracdp}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{layaureo}
\usepackage{lipsum}
cmhughes
  • 100,947

2 Answers2

4

Since letteracdp doesn't define \chapter, you can copy the required definitions from either book.cls or report.cls almost verbatim. So, add the following to your preamble:

\makeatletter
\newcounter{chapter}
\newcommand\chaptername{Chapter}
\newcommand\@chapapp{\chaptername}
\let\chaptermark\@gobble% Or define it otherwise
\newcommand\chapter{\clearpage
                    \thispagestyle{plain}%
                    \global\@topnum\z@
                    \@afterindentfalse
                    \secdef\@chapter\@schapter}
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{toc}{chapter}%
                                   {\protect\numberline{\thechapter}#1}%
                    \else
                      \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}%
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}
\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\def\@schapter#1{\if@twocolumn
                   \@topnewpage[\@makeschapterhead{#1}]%
                 \else
                   \@makeschapterhead{#1}%
                   \@afterheading
                 \fi}
\def\@makeschapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \vskip 40\p@
  }}
\makeatother

If you want \sections (and others) as well, one can extract the appropriate content from the above classes.


Here is a complete minimal example:

enter image description here

\documentclass{letteracdp}% ftp://tug.org/texlive/Contents/live/texmf-dist/tex/latex/cdpbundl/letteracdp.cls
\usepackage{lipsum}% http://ctan.org/pkg/lipsum

\makeatletter
\newcounter{chapter}
\newcommand\chaptername{Chapter}
\newcommand\@chapapp{\chaptername}
\let\chaptermark\@gobble% Or define it otherwise
\newcommand\chapter{\clearpage
                    \thispagestyle{plain}%
                    \global\@topnum\z@
                    \@afterindentfalse
                    \secdef\@chapter\@schapter}
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{toc}{chapter}%
                                   {\protect\numberline{\thechapter}#1}%
                    \else
                      \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}%
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}
\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
    \fi
    \interlinepenalty\@M
    \Huge \bfseries #1\par\nobreak
    \vskip 40\p@
  }}
\def\@schapter#1{\if@twocolumn
                   \@topnewpage[\@makeschapterhead{#1}]%
                 \else
                   \@makeschapterhead{#1}%
                   \@afterheading
                 \fi}
\def\@makeschapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  #1\par\nobreak
    \vskip 40\p@
  }}
\makeatother

\begin{document}

\lipsum[1]

\chapter{A chapter}

\lipsum[2]
\end{document} 
Werner
  • 603,163
1

The C.D.P. Bundle, of which the letteracdp document class is just one of the components (albeit the main one), also provides the articoletteracdp document class, that allows you to use some of the sectioning commands, namely \section and \paragraph. Here is a minimal example:

\documentclass
    [twoside,boldsubject,italicsignature,shortindent]
    {articoletteracdp}
\usepackage[T1]{fontenc}
% The following is just to demonstrate that bookmarks also work correctly:
\usepackage[bookmarksnumbered]{hyperref}

\address{
    Gustavo \textsc{Mezzetti}\\
    L.S.U. <<A.~di~Savoia Duca d'Aosta>>\\
    Via del Santo, 57\\
    I--35123\quad Padova\quad Italy
}
\signature{Gustavo}
\place{Padova}



\begin{document}

\begin{letter}
    [Chiunque sia interessato]
    {A chiunque sia interessato\\(\emph{To whom it may concern})}
    [Comandi di sezionamento.\\(\emph{Sectioning commands.})]

\opening{Cari tutti (\emph{dear all}),}

il resto di questa lettera \`{e} scritto solo in inglese.  The rest of this 
letter is written only in English.  Directly after the \verb|\opening| command 
you normally place a short preamble that does not logically belong to any 
section, like this.



\tableofcontents
\listoffigures
% \listoftables also works



\section{The first section}
\label{S:First}

This is the first section.

\begin{figure}[htbp]
    \centering
    Put figure contents here.
    \caption{A figure}
    \label{fig:?}
\end{figure}

This is a reference to fig.~\ref{fig:?}.



\section{The second section}
\label{S:Second}

This section also contains paragraphs, the first one of which is 
Paragraph~\ref{P:Foo}.

\paragraph{A nifty paragraph}
\label{P:Foo}
Notice that the period at the end of the paragraph title is inserted
automatically (but see Paragraph~\ref{P:Bar}).

\paragraph{Does this always happen?}
\label{P:Bar}
No, not always: if you already supply a punctuation mark at the end of title,
another one isn't inserted.

This paragraph still belongs to Section~\ref{S:Second}, of course.



\epilogue
The \verb|\epilogue| command introduces some text that does not belong 
logically to the last section; it is best to use it even if you have no such 
text, just before \verb|\closing|.

\closing*{Best regards.}

\end{letter}

\end{document}

Here is the result:

Sectioning example

When I wrote the bundle, I deemed sections and paragraphs were enough for letters: I would never ever expect that anybody wanted to include a book-style chapter heading in a letter! Bear in mind that a document class has a specific document layout associated with it, which you should not upset. The sectioning commands provided by the articoletteracdp document class are crafted to fit nicely with the general design of the letteracdp class.

GuM
  • 21,558