我正在使用 memoir 类来排版带有歌词的磁带封面。我希望章节标题非常简单,只是在上方和下方有一行跳行。但似乎每个章节标题上方都添加了更多垂直空间(见图)。
这个空间从何而来,我如何控制它?
% !tex program = pdflatex
\documentclass[oneside,11pt]{memoir}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{alltt}
%% section style
\setsecheadstyle{\raggedright\textsc}
\setbeforesecskip{-1ex}
\setaftersecskip{1ex}
\begin{document}
\setbeforesecskip{0pt} % Tried this, but it doesn't affect the space.
\section*{1. THE FIRST}
\begin{alltt}\normalfont
Unreal City,
Under the brown fog of a winter dawn,
[...] (From The Waste Land by T. S. Eliot)
\end{alltt}
\section*{2. THE FIRST AGAIN}
\begin{alltt}\normalfont
Unreal City,
Under the brown fog of a winter dawn,
[...] (From The Waste Land by T. S. Eliot)
\end{alltt}
\end{document}
编辑:
添加:
\usepackage{etoolbox}
和
\AtBeginEnvironment{alltt}{\setlength{\topsep}{0pt}}
确实减少了空间,看起来不错,但后来我意识到节标题和下面的 alltt 环境下的空间比上面的空间大(我在图中标记了)。这似乎与 alltt 环境有关,因为如果第一个段落是常规段落,则空间与节标题上方的空间相同!
答案1
像这样吗?
\documentclass[oneside,11pt]{memoir}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{alltt}
\makeatletter
\makeheadstyles{mysecs}{%
\renewcommand\thesection{\arabic{section}}%
\setsecnumformat{\csname the##1\endcsname.\quad}%
\setbeforesecskip{-1\onelineskip \@minus .01\onelineskip}%
\setaftersecskip{1\onelineskip \@minus .01\onelineskip}%
\setsecheadstyle{\normalfont\raggedright\MakeUppercase}%
}
\makeatother
\headstyles{mysecs}
\begin{document}
\section{The First}
This is the start of the section
\begin{alltt}\normalfont
Unreal City,
Under the brown fog of a winter dawn,
[...] (From The Waste Land by T. S. Eliot)
\end{alltt}
Final text
\section{The First Again}
This is a section start
\begin{alltt}\normalfont
Unreal City,
Under the brown fog of a winter dawn,
[...] (From The Waste Land by T. S. Eliot)
\end{alltt}
\end{document}
请注意,这可能会增加您遇到的错误分页符的数量,因为它会大大减少垂直间距的可拉伸量,从而降低 LaTeX 找到良好断点的能力。
请注意,剩余的垂直间距与分段无关:alltt
环境在开始和结束时添加垂直空间。这与 Memoir 无关。