I use the memoir class and the \checkandfixthelayout command to calculate the \textheight so that an integral number of lines will fit. This works very well:

But now I want to add a few section headings. Unfortunately, the height of my section headings destroys the nice relationship between \textheight and the height of normal lines, causing stretching between paragraphs (I use \flushbottom):

The solution seems obvious; I only need to ensure that the height of my section headings + any preceding and following space is also an integral number of normal lines high. This seems simple in theory, but in practice I’m not able to figure out how to calculate the various parameters to achieve this.
I want the section headings to be about twice the size of normal text (i.e., about 22 points). Then adding, for example, 1.5 lines of preceding space and .5 lines of following space should do the trick (or perhaps 2 + 1 lines, since the preceding space may disappear when a section heading appears at the top of a page). But I’ve tried both redefining \huge and setting \setbeforesecskip and \setaftersecskip to ‘sensible’ values, i.e., based on \onelineskip or \baselineskip, and it still doesn’t work. I have to manually select precise point sizes by trial and error, which isn’t a very reliable method, and causes much work if I decide to change some values later.
So, is it possible to get the headings to automatically be an integral number of lines high (based on some input values, such as the required font size)? Note that I’m using \setSingleSpace to increase the leading, which may also complicate things (the values of \baselineskip and \onelineskip are not identical).
Here’s an example document, used to create the above images (and yes, I do realise that widows and orphans, or section headings at the bottom of pages, may cause stretching even if the headings are an integral number of lines high – ignore this for now):
\documentclass[a4paper,11pt,twoside]{memoir}
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\usepackage[osf,sc]{mathpazo}
\setSingleSpace{1.05}
\SingleSpacing
\setulmarginsandblock{1.8cm}{2.8cm}{*}
\checkandfixthelayout[nearest]
\setsecheadstyle{\mdseries\huge\itshape}
\usepackage{lipsum}
\begin{document}
\section*{Hello}
\noindent\lipsum[1]\par\lipsum*[2-7]
\end{document}
\parskipshould be set to 14.28pt not 14.28pt plus 1 pt. This you must do for all parameters. See the grid.sty at ctan. There is also quite a bit of info there for what you trying to achieve and the difficulties. – yannisl Nov 27 '11 at 07:39