Write a letter in LaTeX (scrlttr2, letter)
Use the KOMA-Script class scrlttr2: \setkomavar stores the sender data, the recipient is the argument of the letter environment, and \opening and \closing enclose the text. The standard class letter works in a similar way with fewer settings.
A complete letter
fromname and fromaddress appear in the letterhead at the top and, in one small line, as return address above the recipient. The lines of the recipient are separated with \\. subject is printed in bold above the salutation, and the name under the closing is taken from fromname. Without date, the class prints the date of the run.
Complete document:
\documentclass[fontsize=11pt, parskip=half]{scrlttr2}
\usepackage[T1]{fontenc}
\setkomavar{fromname}{Anna Schmidt}
\setkomavar{fromaddress}{Example Street 12\\12345 Example City}
\setkomavar{subject}{Application for the position of test engineer}
\setkomavar{date}{12 May 2025}
\begin{document}
\begin{letter}{Ben Weber\\Example Ltd\\Sample Road 3\\54321 Sampletown}
\opening{Dear Mr Weber,}
I am applying for the position advertised on your website.
I look forward to hearing from you.
\closing{Yours sincerely,}
\end{letter}
\end{document}Phone, e-mail, reference line and enclosures
Phone and e-mail are printed only with the options fromphone=true and fromemail=true. fromalign=right moves the letterhead to the right, and foldmarks=false removes the fold marks at the left edge. yourref adds a reference line that also holds the date, and signature replaces the name under the closing. \ps, \encl and \cc follow after \closing.
Complete document:
\documentclass[fontsize=11pt, parskip=half, fromalign=right,
fromphone=true, fromemail=true, foldmarks=false]{scrlttr2}
\usepackage[T1]{fontenc}
\setkomavar{fromname}{Anna Schmidt}
\setkomavar{fromaddress}{Example Street 12\\12345 Example City}
\setkomavar{fromphone}{01234 567890}
\setkomavar{fromemail}{anna.schmidt@example.org}
\setkomavar{date}{12 May 2025}
\setkomavar{yourref}{AB-2025-17}
\setkomavar{subject}{Your offer of 5 May 2025}
\setkomavar{signature}{Anna Schmidt\\Test engineer}
\begin{document}
\begin{letter}{Ben Weber\\Example Ltd\\Sample Road 3\\54321 Sampletown}
\opening{Dear Mr Weber,}
Thank you for your offer. I accept it.
\closing{Yours sincerely,}
\ps PS: The signed form is enclosed.
\encl{Signed order form}
\cc{Mia Keller}
\end{letter}
\end{document}German letter following DIN 5008
\LoadLetterOption{DIN5008B} in the preamble loads the layout of DIN 5008, form B; DIN5008A is the form whose address field starts further up. In both layouts the sender data stands to the right of the address field and not at the top of the page. place is printed before the date. With \usepackage[ngerman]{babel}, the fixed words are German, for example "Anlage(n)" before the enclosures.
Complete document:
\documentclass[fontsize=11pt, parskip=half]{scrlttr2}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\LoadLetterOption{DIN5008B}
\setkomavar{fromname}{Anna Schmidt}
\setkomavar{fromaddress}{Beispielstraße 12\\12345 Beispielstadt}
\setkomavar{place}{Beispielstadt}
\setkomavar{date}{12. Mai 2025}
\setkomavar{subject}{Kündigung meines Vertrags Nr. 4711}
\begin{document}
\begin{letter}{Beispiel GmbH\\Herrn Ben Weber\\Musterweg 3\\54321 Musterstadt}
\opening{Sehr geehrter Herr Weber,}
hiermit kündige ich den Vertrag zum 30. Juni 2025.
Bitte bestätigen Sie mir die Kündigung schriftlich.
\closing{Mit freundlichen Grüßen}
\encl{Kopie des Vertrags}
\end{letter}
\end{document}With the standard class letter
The standard class takes the sender from \address and the name under the closing from \signature. It has no command for a subject line and none for phone or e-mail.
Complete document:
\documentclass[11pt, a4paper]{letter}
\address{Anna Schmidt\\Example Street 12\\12345 Example City}
\signature{Anna Schmidt}
\date{12 May 2025}
\begin{document}
\begin{letter}{Ben Weber\\Example Ltd\\Sample Road 3\\54321 Sampletown}
\opening{Dear Mr Weber,}
Thank you for your offer. I accept it.
\closing{Yours sincerely,}
\encl{Signed order form}
\end{letter}
\end{document}Pitfalls
- Without
\opening,scrlttr2prints neither the letterhead nor the address field. Keep the command even when there is no salutation:\opening{}. - Many older examples load the layout as a class option,
\documentclass[DIN5008B]{scrlttr2}. The class then warns that this way is deprecated and names\LoadLetterOption{DIN5008B}as the replacement. scrlttr2indents paragraphs and puts no space between them. The class optionparskip=halfseparates them with half a line of space instead, as in the examples above.
Compiled with pdfLaTeX from TeX Live 2023.
Related pages
- How-to Write a CV in LaTeX
- How-to Space between paragraphs in LaTeX
- How-to Umlauts and accents in LaTeX
- Package
babel - Package
fontenc