5

Suppose I am writing a novel using the book class, in which a correspondence from the hero to the heroine needs to be embeded, like this:

Dear Marie,

I miss you very much, I'll come home in a week.

Yours,

Joseph

How can this be done?

jub0bs
  • 58,916
qed
  • 708
  • 5
    Can you be more specific in your question? It's nice to know how you write a letter. But what is your problem? – Dave Apr 27 '13 at 09:42
  • Hi CravingSpirit and welcome to TeX.sx. In its current form, your question might not receive many answers. Please take a look at the How to Ask-page and try to improve your question according to the guidance found there. This may require you to show some effort on your part in terms of attempting a solution. If you have questions about what to do or if you don't quite understand what this means, please ask for clarification using the add comment function. – jub0bs Apr 27 '13 at 09:50
  • 2
    Welcome to TeX.sx! If you're trying to typeset a letter, you can use, for instance, the letter class (see here) or the more advanced scrlettr class. – jub0bs Apr 27 '13 at 09:51
  • 2
    If your question is literally about inserting a letter into a document then Change document class per page is a duplicate and shows you how to do this. But in the context of writing a novel, I don't think this is what you want, so perhaps your question is simply about how best to create a letter environment within the novel that sets the letter text off from the rest of the novel. Is that your question? – Alan Munn Apr 27 '13 at 13:11

3 Answers3

7

For some letter that easy, you can also stick to the quote environment as a base:

\documentclass{article}
%xetex specific ---- replace by any other font setting command depending on your engine
\usepackage{fontspec}
\newfontfamily{\letterfont}{Comic Sans MS}

\usepackage{lipsum}
\usepackage{environ}
\NewEnviron{letter}{%
\begin{quote}
\fbox{%
\begin{minipage}{\linewidth}
\setlength{\parskip}{\baselineskip}
\letterfont
\BODY
\end{minipage}
}
\end{quote}
}

\begin{document}
\lipsum[1-2]
\begin{letter}
Dear Marie,

I miss you very much, I'll come home in a week.

Yours,

Joseph
\end{letter}
\lipsum[3-4]


\end{document}

enter image description here

PS: I used XeLaTeX and the fontspec package for font setting. But you can replace my definition of \letterfont with any other font setting command, that you can use with your engine.

Toscho
  • 4,713
4

You can write your letter with, for example, the letter class :

\documentclass{letter}
\signature{Your name}
\address{Street \\ City \\ Country}
\begin{document}
\begin{letter}{Company name \\ Street\\ City\\ Country}
\opening{Dear Sir or Madam:}
\dots
\closing{Yours Faithfully,}
\ps{P.S. Here goes your ps.}
\encl{Enclosures.}
\end{letter}
\end{document}

(example from texblog.org)

and then include the pdf outpout in your main document using the pdfpages package :

\documentclass{article}

\usepackage{pdfpages}

\begin{document}

\includepdf[pages=-,
            pagecommand=\thispagestyle{fancy}
            %if you want to have headers and footers in the included pdf pages
]{my_lettre.pdf}

\end{document}
jub0bs
  • 58,916
Namrod
  • 106
2

Assuming you are using pdfTeX, there's a decently easy (although roundabout) way of doing this using \includegraphics and pdfcrop (standard with at least TeX Live)

\documentclass{letter}

\begin{document}
\signature{Joseph}

\begin{letter}{}

\opening{Dear Marie,}
I miss you very much, I'll come home in a week.
\closing{Yours,}
\end{letter}
\end{document}

and then pdfcrop letter.pdf, which produces letter-crop.pdf which you can include thusly

\documentclass{book}
\usepackage{graphicx,mwe}

\begin{document}
\lipsum[1]

\begin{center}
  \includegraphics[width=.9\textwidth]{letter-crop}
\end{center}

\lipsum[2]
\end{document}

for the output

output

Sean Allred
  • 27,421