\midchapskip 回忆录章节样式中的间距

\midchapskip 回忆录章节样式中的间距

我正在使用回忆录类创建自定义章节样式。它的定义如下:

\makechapterstyle{balloon}{%
    \renewcommand{\chapterheadstart}{\vspace*{\beforechapskip}}
    \renewcommand{\printchaptername}{\begin{center} \chapnamefont \chaptername}
    \renewcommand{\chapternamenum}{\space}
    \renewcommand{\printchapternum}{\chapnumfont \thechapter \end{center}}
    \renewcommand{\afterchapternum}{\par\vskip \midchapskip }
    \renewcommand{\printchaptertitle}[1]{\chaptitlefont %
        \begin{center}%
            \MakeUppercase{##1}%
        \end{center}}
    \renewcommand{\afterchaptertitle}{\par\vskip \afterchapskip}%

    \renewcommand{\chapnamefont}{\normalfont\Large}
    \renewcommand{\chapnumfont}{\normalfont\Large}
    \renewcommand{\chaptitlefont}{\normalfont\scriptsize}%

    \setlength{\beforechapskip}{-25pt}
    \setlength{\midchapskip}{10pt} % <-- Value in question.
    \setlength{\afterchapskip}{7pt}
}
\chapterstyle{balloon}
......
\chapter{The End of a much-applauded Speech -- The Presentation of Dr. Samuel Ferguson -- Excelsior -- Full-length Portrait of the Doctor -- A Fatalist convinced -- A Dinner at the Travellers’ Club -- Several Toasts for the Occasion}

我意识到其中的一些声明\makechapterstyle是多余的,当我完成样式工作后它们将被删除。

我面临的问题是,更改的值\midchapskip会对标题的格式产生不一致的影响。此值应控制章节文本(例如“第 1 章”)和章节标题(例如“备受赞誉的演讲结束...”)之间的间距。

负值\midchapskip对间距完全没有影响,正值则有零星影响。例如,\midchapskip设置为 20pt 和 10pt 时,实际间距有 10pt 的差异,但设置为 10pt 和 0pt 时,实际间距没有差异。这是为什么?如何精确调整此间距?

TL;DR:为什么我的章节风格没有\midchapskip达到预期的效果?

答案1

center您在重新定义\printchaptertitle---时使用了环境\centering,而改用了。因此,拼写错误更少

\renewcommand{\printchaptertitle}[1]{\chaptitlefont%
  {\centering \MakeUppercase{##1} \par}}

下面显示了将 更改为\printchaptertitle与 一起的结果\setlength{\midchapskip}{-75pt},因此\midchapskip负值确实会产生影响,就像任何其他值一样。

在此处输入图片描述

\begin{center}也许有人可以解释与的间距差异\centering

编辑

Here's an MWE with four different `\midchapskip` values to show their effects.

% balloonprob.tex  SE 598175
\documentclass[openany]{memoir}
\usepackage{lipsum}

\makechapterstyle{balloon}{%
    \renewcommand{\chapterheadstart}{\vspace*{\beforechapskip}}
    \renewcommand{\printchaptername}{\begin{center} \chapnamefont \chaptername}
    \renewcommand{\chapternamenum}{\space}
    \renewcommand{\printchapternum}{\chapnumfont \thechapter \end{center}}
    \renewcommand{\afterchapternum}{\par\vskip \midchapskip }
    \renewcommand{\afterchapternum}{\par\nobreak\vskip \midchapskip }
    \renewcommand{\printchaptertitle}[1]{\chaptitlefont %
%        \begin{center}%
%            \MakeUppercase{##1}%
%        \end{center}}
    {\centering
      \MakeUppercase{##1} \par}}
    \renewcommand{\afterchaptertitle}{\par\vskip \afterchapskip}%

    \renewcommand{\chapnamefont}{\normalfont\Large}
    \renewcommand{\chapnumfont}{\normalfont\Large}
    \renewcommand{\chaptitlefont}{\normalfont\scriptsize}%

    \setlength{\beforechapskip}{-25pt}
    \setlength{\midchapskip}{20pt} % <-- The default
    \setlength{\midchapskip}{10pt} % <-- Value in question.
    \setlength{\midchapskip}{5pt} % <-- Value in question.
%    \setlength{\midchapskip}{50pt} % <-- Value in question.
    \setlength{\midchapskip}{0pt} % <-- Value in question.
    \setlength{\midchapskip}{-75pt} % <-- Value in question.
    \setlength{\afterchapskip}{7pt}
}
\chapterstyle{balloon}

\begin{document}

\mainmatter

\chapter{The End of a much-applauded Speech -- The Presentation of Dr. 
Samuel Ferguson -- Excelsior -- Full-length Portrait of the Doctor -- 
A Fatalist convinced -- A Dinner at the Travellers’ Club -- 
Several Toasts for the Occasion}

%\lipsum[1]
\setlength{\midchapskip}{-10pt}
\chapter{The End of a much-applauded Speech -- The Presentation of Dr. 
Samuel Ferguson -- Excelsior -- Full-length Portrait of the Doctor -- 
A Fatalist convinced -- A Dinner at the Travellers’ Club -- 
Several Toasts for the Occasion}

\setlength{\midchapskip}{0pt}
\chapter{The End of a much-applauded Speech -- The Presentation of Dr. 
Samuel Ferguson -- Excelsior -- Full-length Portrait of the Doctor -- 
A Fatalist convinced -- A Dinner at the Travellers’ Club -- 
Several Toasts for the Occasion}

\setlength{\midchapskip}{10pt}
\chapter{The End of a much-applauded Speech -- The Presentation of Dr. 
Samuel Ferguson -- Excelsior -- Full-length Portrait of the Doctor -- 
A Fatalist convinced -- A Dinner at the Travellers’ Club -- 
Several Toasts for the Occasion}


\end{document}

相关内容