Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to write a letter using LaTeX

📅 2010-Jan-23 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Occasionally, I need to write formal letters. For one such recent letter I decided to try LaTeX instead of Microsoft Word. I was surprised how easy it was to produce simple and elegant letters using LaTeX!

Here is a sample letter in PDF produced from a LaTeX file:

 
 

The above letter was produced from latex-letter.tex:

%-----------------------------------------------------------------------------%

% Letter class
\documentclass[a4paper, 10pt]{letter}

% Name of sender
\name{Joe Fox}

% Signature of sender
\signature{Joe Fox}

% Address of sender
\address
{
    Fox Books,\\
    Times Square, NYC.
}

%-----------------------------------------------------------------------------%

\begin{document}

% Name and address of receiver
\begin{letter}
{
    Kathleen Kelly,\\
    The Shop Around The Corner,\\
    Small Corner, NYC.
}

% Opening statement
\opening{Dear Kathleen,}

% Letter body

I am aware that you are pretty miffed at me for being the cause of the demise of your bookstore. You have to believe in me, that was not my intention at all.

I hope we can talk about this over coffee. How about we meet this Friday evening at the corner cafe? Let me know.

% Closing statement
\closing{Yours truly,}

\end{letter}
\end{document}
%-----------------------------------------------------------------------------%

Grab it and edit its contents to create your own letters.

Here is a dissection of the LaTeX commands to create a letter:

  1. Use the letter documentclass. It provides commands and formatting that are meant for letter writing.
\documentclass[a4paper, 10pt]{letter}
  1. Provide the name, signature and address of the sender.
\name{Joe Fox}
\signature{Joe Fox}
\address
{
  Fox Books,\\
  Times Square, NYC.
}
  1. Begin the letter, provide the name and address of the receiver.
\begin{document}
\begin{letter}
{
    Kathleen Kelly,\\
    The Shop Around The Corner,\\
    Small Corner, NYC.
}
  1. Provide an opening statement, the letter body and the closing statement.
\opening{Dear Kathleen,}
I am aware that you are pretty miffed at me and so on.
\closing{Yours truly,}
  1. End the letter. The name for the signature is automatically added.
\end{letter}
\end{document}

For more information, see the Wikibook on LaTeX Letters.