# LaTeX letter with address field in the right place for a “C5 envelope with window”

Does anybody know of a good way to write simple paper letters in LaTeX, so that the formatting shows the receivers address on the right place so I will show in the window of those C5 envelops with a "address window" (see picture)?

Those envelope follows some kind of standard here in Sweden, I would like too use them since my handwriting is not that good looking.

The question is how I get a box with the receivers 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 (http://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:

And then the tex code I used to create this 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

% 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 begain -- 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}

-

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.

\makeatletter
\makeatother


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

-
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 '10 at 17:37
I will add example code for adjusting. –  Stefan Kottwitz Aug 15 '10 at 17:54
Thanks, I'm getting really close with your help :) –  Johan Aug 15 '10 at 19:53

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 {
addresscenter=60mm,  % vertical center of the envelope window

}

-

Check out scrlttr2 from koma-scripts.

-

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}
\setkomavar{fromname}{Sender Name}
\setkomavar{signature}{Sender Name}
\setkomavar{fromemail}{sender@example.com}
\setkomavar{fromphone}{55550000}
\setkomavar{subject}{Subject of the letter}
\begin{document}
\begin{letter}{%
Recipient Name \\