[Tex/LaTex] 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:




\date{16 February 2012}

\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}

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?

Best Answer

You could redefine the letter command like this:

  \height=\ht0 \advance\height by \dp0%

It places the address in a vbox, calculates its height, sets the height of the address field and finally calculates the resulting refvpos as a sum of toaddrvpos+toaddrheight+2baselineskip.

Hope it helps.