1

A few weeks ago I aksed for Insert chapters into letter document but now I need to add paragraphs and subparagraphs into letter document. The previous answer says that I need to copy those commands from book.cls or report.cls, but when I tried to reply the action the user did to import Chapter commands into the document, I saw that it was not a simply copy and paste, but certain lines of code have been accurately selected, and others omitted. So I ask for your help again.

Here my preamble

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

So, similar to the last answer, you will need to pull in the lines appropriate to paragraph and subparagraph. These use some different things to make the headings, including different ways of spacing and indenting the sections. I've annotated a few things in the MWE below. See also this great answer for more about how the \@startsection command works so you can change some of these parameters yourself.

I have not included your previous solution (adding chapters) for clarity of this solution. The two can co-exist very nicely.

The MWE now becomes:

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


\usepackage{blindtext} % Just for demo

%<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\makeatletter
%%% Add paragraphs and subparagraphs
\newcounter {paragraph}
\newcounter {subparagraph}[paragraph]
\newcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                    {3.25ex \@plus1ex \@minus.2ex}%
                                    {-1em}%
                                    {\normalfont\normalsize\bfseries}}
%% The subparagraph indents by \parindent, which is set to 72.12128pt or roughly an inch
%% Redefine it in the letter body (after \opening) if you would like it smaller
\newcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
                                       {3.25ex \@plus1ex \@minus .2ex}%
                                       {-1em}%
                                      {\normalfont\normalsize\bfseries}}
\makeatother
%<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

\begin{document}

\begin{letter}[John Doe]{
Prof.~John \textsc{Doe}\\
Department of Electrical Engineering\\
Stanford University\\
Stanford, CA~94305 (U.S.A.)
}[
This is the optional subject of the letter.
]
\opening{Dear Prof.~Doe,}

% Change the paragraph indent here if desired
\setlength\parindent{1cm}

\blindtext

\paragraph{This is a paragraph} \blindtext

\subparagraph{This is a subparagraph} \blindtext

\closing{Sincerely,}
\end{letter}
\end{document}

This presents (in part):

letter

1

I too refer you to the answer I gave to a previous similar question: use the articoletteracdp documentclass, that comes with \sections and \paragraphs already defined.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.