19

Does anybody know of a good way to write simple paper letters in LaTeX, so that the formatting shows the receiver's address in the right place, to show it in the window of those C5 envelopes with an "address window" (see picture)?

envelope

Those envelopes follow some kind of standard here in Sweden, I would like to use them since my handwriting is not that good looking.

The question is how I get a box with the receiver's address in the upper right corner on the first page?


Update: I think the letter should conform to SS 34321 (Swedish Standard).

Note: This question is "moved" over from SuperUser where I did not find a working answer (https://superuser.com/questions/58404/latex-letter-with-adress-field-in-the-right-place-for-a-c5-envelope-with-window)


Update:

I created a basic example using the scrlttr2 and it's close enough for now, I have printed and the address show up in the right place.

This is how my example looks like:

Second try

And this is the LaTeX code I used to create that version:

\documentclass[fontsize=11pt,a4paper]{scrlttr2}

\usepackage[english]{babel}
\usepackage[english]{isodate}

% font and input setup
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{datetime}
\renewcommand{\dateseparator}{-}
\newcommand{\todayiso}{\the\year \dateseparator \twodigit\month \dateseparator \twodigit\day}

\setkomavar{date}{\todayiso}
\setkomavar{signature}{Johan Simonsson}

\let\raggedsignature=\raggedright

\makeatletter
\@setplength{toaddrvpos}{30mm}
\@setplength{toaddrhpos}{130mm}

% The space to sign my name
\@setplength{sigbeforevskip}{10mm}
\makeatother


\setkomavar{subject}{Long fortune example}

\begin{document} 
\begin{letter}{Pelle Gustavsson \\ Bergsgatan 17 lgh1115 \\ 123 45 Malmö \\ Sweden}
\opening{Dear Pelle Gustavsson}

The camel died quite suddenly on the second day, and Selena fretted
sullenly and, buffing her already impeccable nails -- not for the first
time since the journey began -- pondered snidely if this would dissolve
into a vignette of minor inconveniences like all the other holidays spent
with Basil.
\\   --- Winning sentence, 1983 Bulwer-Lytton bad fiction contest.
\\\\   Gratitude and treachery are merely the two extremities of the same procession.
You have seen all of it that is worth staying for when the band and the gaudy officials
have gone by.
\\   --- Mark Twain, "Pudd'nhead Wilson's Calendar"

%\baselineskip

\closing{Best regards}
\end{letter}
\end{document}

4 Answers 4

14

My choice would be the document class scrlttr2. It can be customized in many ways.

A very quick way to get the address field to the right is using the document class option SN:

\documentclass[a4paper,SN]{scrlttr2}

This option decides that the file SN.lco has to be used which sets the address to the right side. If you look into this file, which is located in the same folder like the scrlttr2 class, you would see the used lenghts. They are set by the command \@setplength. Those lengths are called pseudolengths, they are described in the KOMA-Script manual. Have a look at Figure 6.1.: Schematic of the pseudo-lengths for a letter. It's a drawing visualing the lenghts. Here are useful for instance toaddrhpos, toaddrvpos, toaddrwidth and toaddrheight, toaddrindent and toaddrindent. You could adjust those lengths in your preamble according to your needs.

It may be done linke this, in your preamble:

\makeatletter
\@setplength{toaddrvpos}{40mm}
\@setplength{toaddrhpos}{110mm}
\makeatother

You could vary these values until they fit well, or calculate it from the paper size and the other dimensions.

2
  • That seems nice, the goal is to make sure the receivers address is at the upper right corner (4cm from the top, and ends 4cm from the right).
    – Johan
    Aug 15, 2010 at 17:37
  • I will add example code for adjusting.
    – Stefan Kottwitz
    Aug 15, 2010 at 17:54
7

A package similar to scrlttr2 is the isodoc class. This class specifically aims at NEN 1029 compliance. According to the documentation, in that case, setting up the right window goes like this:

\documentclass{isodoc}
\setupdocument {
    rightaddress,        % leftaddress is the default
    addresscenter=60mm,  % vertical center of the envelope window 
    addresswidth=110mm,   % width of the address window

}
1
4

For anybody looking after a quick example using scrlttr2. To get the window of the envelope right, make sure you select the correct paper size and one of: DIN, DINmtext, SNleft, SN or NF.

\documentclass[a4paper,DIN]{scrlttr2}
\usepackage[english]{babel}
\KOMAoptions{fromphone=on,fromemail=true,backaddress=false}
\setkomavar{fromname}{Sender Name}
\setkomavar{signature}{Sender Name}
\setkomavar{fromaddress}{Sender Address\\ Some City, Some Country}
\setkomavar{fromemail}{[email protected]}
\setkomavar{fromphone}{55550000}
\setkomavar{subject}{Subject of the letter}
\begin{document}
\begin{letter}{%
Recipient Name \\
Their Address \\
Some City, Some Country
}

\opening{Dear Recipient,}

This is an example letter

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

Check out scrlttr2 from koma-scripts.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .