在页面顶部的 Memoir 类中保留 \section 标题前的空间

在页面顶部的 Memoir 类中保留 \section 标题前的空间

我正在使用 xelatex 和 Memoir 类。默认情况下,节标题前的空白垂直空间不会显示在 之后pagebreak。如果我想让它显示,我该如何修改它,即使它位于新页面的顶部?我可以看到其中memoir.cls有一个名为的长度\beforesecskip和一个\setbeforesecskip命令,但我不知道如何实现所需的效果。任何帮助都值得感激。

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

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

如您所见。第 1 和第 4 部分之前没有垂直跳跃,因为它们位于页面顶部。

答案1

有一种可能性是,重新定义 memoir.cls 中定义的一些内部宏(我认为这种行为仅适​​用于部分):

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

\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
    \addpenalty\@secpenalty\vspace*{\@tempskipa}% NEW: original with \addvspace
    \addvspace{-\parskip}% <--- added 2011/03/02
  \fi
  \@ifstar
    {\@ssect{#3}{#4}{#5}{#6}}%
    {\@trplargoom{\M@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
\renewcommand{\section}{%
  \sechook%
  \@sectstartsection{section}{1}%  level 1
      {\secindent}%            heading indent
      {\beforesecskip}%        skip before the heading
      {\aftersecskip}%         skip after the heading
      {\normalfont\secheadstyle}} % font
\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}

在此处输入图片描述

现在我必须离开了,但我会尽快添加解释(重要的修改已在我的示例中标出%NEW: original...

相关内容