我在回忆录类的 southall chapterstyle 中看到编号和章节标题未垂直对齐。如何修复?
答案1
该southall
样式使用两个minipage
顶部对齐的 s 来排版章节号和章节标题,因此章节号将与标题的第一行(上)垂直对齐,如下面的简单示例所示:
\documentclass{memoir}
\chapterstyle{southall}
\begin{document}
\chapter{Test Chapter with a Long Title Spanning Several Lines, just to Illustrate the Vertical Alignment}
\end{document}
如果要更改此默认对齐方式,则需要更改主题的对齐方式miniboxes
;主题的原始定义southall
类似于
\makechapterstyle{southall}{%
\setlength{\afterchapskip}{5\baselineskip}
\setlength{\beforechapskip}{36pt}
\setlength{\midchapskip}{\textwidth}
\addtolength{\midchapskip}{-\beforechapskip}
\renewcommand*{\chapterheadstart}{\vspace*{2\baselineskip}}
\renewcommand*{\chaptitlefont}{\huge\rmfamily\raggedright}
\renewcommand*{\chapnumfont}{\chaptitlefont}
\renewcommand*{\printchaptername}{}
\renewcommand*{\chapternamenum}{}
\renewcommand*{\afterchapternum}{}
\renewcommand*{\printchapternum}{%
\begin{minipage}[t][\baselineskip][b]{\beforechapskip}
{\vspace{0pt}\chapnumfont%%%\figureversion{lining}
\thechapter}
\end{minipage}}
\renewcommand*{\printchaptertitle}[1]{%
\hfill\begin{minipage}[t]{\midchapskip}
{\vspace{0pt}\chaptitlefont ##1\par}\end{minipage}}
\renewcommand*{\afterchaptertitle}{%
\par\vspace{\baselineskip}%
\hrulefill \par\nobreak\noindent \vskip\afterchapskip}}
你需要更改的行是
\begin{minipage}[t][\baselineskip][b]{\beforechapskip}
和
\begin{minipage}[t]{\midchapskip}
例如,为了使章节号与标题的最后一行(下面)垂直对齐,您需要使用b
说明符:
\begin{minipage}[b]{\beforechapskip}
和
\begin{minipage}[b]{\midchapskip}
这是一个完整的例子:
\documentclass{memoir}
\makechapterstyle{mysouthall}{%
\setlength{\afterchapskip}{5\baselineskip}
\setlength{\beforechapskip}{36pt}
\setlength{\midchapskip}{\textwidth}
\addtolength{\midchapskip}{-\beforechapskip}
\renewcommand*{\chapterheadstart}{\vspace*{2\baselineskip}}
\renewcommand*{\chaptitlefont}{\huge\rmfamily\raggedright}
\renewcommand*{\chapnumfont}{\chaptitlefont}
\renewcommand*{\printchaptername}{}
\renewcommand*{\chapternamenum}{}
\renewcommand*{\afterchapternum}{}
\renewcommand*{\printchapternum}{%
\begin{minipage}[b]{\beforechapskip}
{\vspace{0pt}\chapnumfont%%%\figureversion{lining}
\thechapter}
\end{minipage}}
\renewcommand*{\printchaptertitle}[1]{%
\hfill\begin{minipage}[b]{\midchapskip}
{\vspace{0pt}\chaptitlefont ##1\par}\end{minipage}}
\renewcommand*{\afterchaptertitle}{%
\par\vspace{\baselineskip}%
\hrulefill \par\nobreak\noindent \vskip\afterchapskip}}
\chapterstyle{mysouthall}
\begin{document}
\chapter{Test Chapter with a Long Title Spanning Several Lines, just to Illustrate the Vertical Alignment}
\end{document}
现在对齐是在底部:
将两个 s 的对齐说明符更改b
为,将导致章节号相对于标题垂直对齐于中心。c
minipage