# Calculate parskip based on number of lines in an address

Very new to LaTeX. Using the letter class, I need to line up the start of some text at a particular vertical position on the page - the first fold line on a letterpaper so the text is all inside the a z-fold.

I've managed to accomplish this by using the following which works well if address has 3 lines, however, if the address has only 2 lines I want to skip one extra paragraph to get the next bit of text in the right place. Basically I need some sort of command equivalent to 'make the address and the vertical space after equivalent to 5 lines'. Being new I'm not sure of what terms to search on.

% the opening
\makeatletter
\renewcommand{\opening}[1]{\thispagestyle{firstpage}%
\xphvmn
\@letterdate\par
\@ourfile\par
\vspace{2\parskip}% <-- if toaddress has 3 lines, this should be 2, if 2 lines then skip equivalent of 3 lines (to make up for the one less line)
\ifthenelse{\equal{\@subject}{}}{}{\@subject\par}
\xphvmn
\vspace{2\parskip}%
}
\makeatother

• Welcome to TeX.SX! Why don't you use a minipage with fixed height (see tex.stackexchange.com/questions/56891/…)? – TeXnician Oct 8 '17 at 20:29
• thank you @TeXnician - I had looked at minipage earlier but missed that they could handle a fixed height. This works much better and gives me some flexibility on a range of address sizes. I'll toy with the 2.0in till it's exactly the right amount. – AMG Oct 8 '17 at 23:33
• Why don't you use 3\baselineskip? And if it was an answer, you should put it as such (a question with an edited-in answer is kind of out-of-concept). – TeXnician Oct 9 '17 at 6:11

Thanks TeXnician. Ended up with:

% the opening
\makeatletter
\renewcommand{\opening}[1]{\thispagestyle{firstpage}%
\xphvmn
\@letterdate\par
\@ourfile\\
\begin{minipage}[c][2.0in]{\textwidth}