About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Latest news 2024-09-23: new blog post "Tales for Our Times: Raising Funds and Awareness for St Martins Housing Trust".


3.1 Writing a Letter Using the letter Class

This section describes how to use the basic letter class. As with all the base LaTeX classes, the paper size defaults to the US letter size, but this can be changed via the class options. For example, for A4 paper you can use the a4paper option:

\documentclass[a4paper]{letter}

or you can use the geometry package [110]:

\documentclass{letter}
\usepackage[a4paper]{geometry}

A document using the letter class may have one or more letter environments that contain the text of the letter:

\begin{letter}{recipient's address}
body
\end{letter}

Within ⟨body⟩, you can use:

\opening{salutation text}

for the letter greeting, and

\closing{closing text}

for the closing text (such as “Yours Sincerely”). After \closing you can also use:

\pspostscript text

for any postscripts (note that ⟨postscript text⟩ isn't an argument and you need to supply your own “PS” tag at the start of it)

\cc{text}

to indicate a list of people to be cc'd, and

\encl{text}

to specify a list of any enclosures.

Example 12. Writing a Simple Letter (letter class)

Here is a simple letter:

\documentclass[12pt]{letter}

\usepackage[a4paper]{geometry}
\usepackage[british]{babel}

\begin{document}

\begin{letter}{Mrs Mabel Canary\\24 The Street\\
Some Village\\Some Town\\Noshire\\AB1 2YZ}

  \opening{Dear Mrs Canary}

  This is an imaginary letter.

  This is the second paragraph of the letter.

  \closing{Yours sincerely}

  \ps PS: this is a postscript.

  \encl{Photocopy of something interesting\\
   Photocopy of something rather dull}

  \cc{Prof Important Person\\Dr Bor Ing}
\end{letter}

\end{document}

(I've used the babel package [7] with the british option to ensure that the date is displayed using the British format rather than the default US format.)

Figure 3.1: A Simple Letter Using the letter Class
 
25th February 2014

Mrs Mabel Canary
24 The Street
Some Village
Some Town
Noshire
AB1 2YZ

Dear Mrs Canary

This is an imaginary letter.

This is the second paragraph of the letter.

Yours sincerely

PS: this is a postscript.

encl: Photocopy of something interesting
  Photocopy of something rather dull

cc: Prof Important Person
  Dr Bor Ing
End of Image.

The resulting document is shown in Figure 3.1. You can download or view this example.

You can add information about the sender as well. This typically goes in the preamble. The sender's name is specified using:

\name{text}

Additionally, you can specify the sender's name as it should appear after the closing text (supplied by \closing):

\signature{text}

The sender's address is specified using:

\address{text}

You may use \\ within ⟨text⟩ to separate the lines of the address. The sender's telephone number is specified using:

\telephone{text}

Additional location information for the sender is specified using:

\location{text}

By default, the location and telephone number information is placed on the footer of the first page if no sender address has been specified. If you want to specify the sender address as well, you need to use

\thispagestyle{firstpage}

after \opening.

The letter class is very old and doesn't provide a means for specifying modern communication methods such as email, mobile phone numbers or web addresses.

Exercise 7. Writing a Letter (letter class)

Modify Example 12 to include sender details.

For the More Adventurous

Recall from §2.8 Fetching Data From a Given Row that you can fetch a single row of data from a database. Use one of the commands described in that section to fetch the recipient's details from the sample people.csv file or the people SQL table rather than explicitly typing them into the document. You can download or view a solution.


This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-07-4).

© 2015 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs