# How to set scrlttr2 refvpos automatically based on address length

I am creating an letter options (lco) file that I will use for multiple letters. The scrlttr2 class is designed for a fixed placement of the address field, and places the date at a fixed position from the top of the page (refvpos). I would like to change this so that refvpos is automatically adjusted based on the height of the address. This example results in the date and opening of the letter colliding with the address:

\documentclass[paper=letter]{scrlttr2}
\usepackage[american]{babel}
\areaset{6.5in}{9in}

\KOMAoptions{parskip=full,refline=dateleft,fromalign=right}

\makeatletter
\@setplength{refvpos}{1.5in}
\makeatother

\date{16 February 2012}

\begin{document}
\begin{letter}{Dr.~Leo Lion\\Fordstan University\\Room 50\\1600 Pennsylvania Ave\\Somewhere\\United States of America}
\opening{Dear Sir,}
This is a test.
\closing{Sincerely yours}
\end{letter}
\end{document}


Can I fix this so that the date will always be one \baselineskip after the address, regardless of whether the address is two lines or ten?

-
You would have to calculate the height before starting the letter. And the height of the address field is preset, too. –  ejoerns Feb 17 '12 at 1:52
I wouldn't mind doing something like \newcommand{\address}{Dr.~Leo Lion...}... \begin{letter}{\address}. If I do that, is there a way to calculate the height of address? –  Michael Hoffman Feb 17 '12 at 2:17

You could redefine the letter command like this:

\let\oldletter\letter
\renewcommand\letter[1]{%
\newdimen\height%
\setbox0=\vbox{#1}%