# retain space before \section heading in Memoir class at top of page

I am using xelatex and the Memoir class. By default, the empty vertical space before the section heading does not show after a pagebreak. How do I modify it if I want it to show instead, even if it is at the top of a new page? I can see in memoir.cls that there is a length named \beforesecskip and a \setbeforesecskip command, but I don't know enough to be able to figure about how to achieve the desired effect. Any help is appreciated.

\documentclass[11pt]{memoir}
\usepackage{showframe}
%%% Book Layout %%%
\setstocksize{7.5in}{5in}
\settrimmedsize{7.5in}{5in}{*}
\setlength{\trimtop}{0pt}
\setlength{\trimedge}{\stockwidth}
\settypeblocksize{6in}{4in}{*}
\setulmargins{0.5in}{*}{*}
\setlrmargins{0.5in}{*}{*}
\setmarginnotes{0pt}{0pt}{0pt}
\checkandfixthelayout
%%% Other Settings %%%
\raggedbottom

\long\def\sometext{Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.}

%%% Document Proper %%%
\begin{document}

\section*{Section 1}

\sometext

\section*{Section 2}

\sometext

\section*{Section 3}

\sometext

\section*{Section 4}

\sometext

\section*{Section 5}

\sometext

\section*{Section 6}

\sometext

\end{document}


As you can see. There is no vertical skip before section 1 and 4 since they are at the top of the page.

-
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  hpesoj626 Mar 22 '13 at 7:39
Should the amount of vertical whitespace inserted before the sectioning header -- observe, incidentally, that doing this goes against all rules of good typography; are you maybe attempting to reproduce the look of a document created by a word processing program? -- vary depending on how much vertical whitespace was left at the bottom of the preceding page? –  Mico Mar 22 '13 at 9:51
No, it shouldn't. And I would like it to be adjustable, if possible. The look I am trying to reproduce is that of an actual book. I fully understand this is not good typographic practice. Thanks for the comment. –  zzjing Mar 22 '13 at 11:05
\leavevmode doesn't print anything, but is enough to make latex believe it's not at the top of the page, so ... \leavevmode\section* would do the trick (to some approximation) –  wasteofspace Mar 22 '13 at 11:31

Here's one possibility, redefining some internal macros as defined in memoir.cls (I assumed this behavour was meant only for sections):

\documentclass[11pt]{memoir}
\usepackage{showframe}
%%% Book Layout %%%
\setstocksize{7.5in}{5in}
\settrimmedsize{7.5in}{5in}{*}
\setlength{\trimtop}{0pt}
\setlength{\trimedge}{\stockwidth}
\settypeblocksize{6in}{4in}{*}
\setulmargins{0.5in}{*}{*}
\setlrmargins{0.5in}{*}{*}
\setmarginnotes{0pt}{0pt}{0pt}
\checkandfixthelayout
%%% Other Settings %%%
\raggedbottom

\long\def\sometext{Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
sint occaecat cupidatat non proident, sunt in culpa qui officia
deserunt mollit anim id est laborum.}
\makeatletter
\newcommand{\@sectstartsection}[6]{%
\@nameuse{#1block}%
\ifraggedbottomsection\if@nobreak\else
\vskip\z@\@plus\bottomsectionskip
\penalty\z@
\vskip\z@\@plus -\bottomsectionskip
\fi\fi
\def\m@msecn@me{#1}%
\if@noskipsec \leavevmode \fi
\par
\@tempskipa #4\relax
\@afterindenttrue
\ifdim \@tempskipa <\z@
\@tempskipa -\@tempskipa \@afterindentfalse
\fi
\if@nobreak
\everypar{}%
\else
\fi
\@ifstar
{\@ssect{#3}{#4}{#5}{#6}}%
{\@trplargoom{\M@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
\renewcommand{\section}{%
\sechook%
\@sectstartsection{section}{1}%  level 1
\makeatother
%\setlength\beforesecskip{2cm}
%%% Document Proper %%%
\begin{document}

\section*{Section 1}

\sometext

\section*{Section 2}

\sometext

\section*{Section 3}

Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse.

\section*{Section 4}

\sometext

\section*{Section 5}

\sometext

\section*{Section 6}

\sometext

\end{document}


Right now I have to leave, but I'll add an explanation as soon as I can (the important modification was signaled in my example with %NEW: original...)

-
That did the trick. Thank you very much. –  zzjing Mar 22 '13 at 19:16