当新章节从同一页开始时,页眉会丢失

当新章节从同一页开始时,页眉会丢失

为了节省页数(我们的书有页数上限),我希望(1)在上一章结束后立即开始新一章(即在同一页),此外(2)在同一行打印章节号和章节标题。经过搜索并得到这里人们的大力支持,我发现这些设置中的第一个是由代码实现的

\makeatletter
\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{}{}{}
\makeatother

而第二个由下面的代码实现(还定义了一些其他的东西)

\chapterstyle{default}
\renewcommand{\chaptitlefont}{\normalfont\Large\bfseries}
\renewcommand*{\chapnamefont}{\chaptitlefont}
\renewcommand*{\chapnumfont}{\chaptitlefont}
\renewcommand{\printchaptername}{\chaptitlefont\chaptername}
\renewcommand{\printchapternum}{\thechapter:}
\renewcommand{\afterchapternum}{\hspace{1em}}

在最后一步中,我使用代码添加了附录(实际上是章节)(根据我找到的说明)

\input{AppendixAVol1}
\begingroup\let\clearpage\relax\input{AppendixBVol1}\endgroup
\begingroup\let\clearpage\relax\input{AppendixCVol1}\endgroup
\begingroup\let\clearpage\relax\input{AppendixDVol1}\endgroup
\begingroup\let\clearpage\relax\input{AppendixEVol1}\endgroup
\begingroup\let\clearpage\relax\input{AppendixGVol1}\endgroup

结果非常好,符合我们的要求。奇数页和偶数页的页眉定义为(我使用回忆录类)

\makeevenhead{mystyle}{{\large{\color{evenPageColor}{\textbf{\thepage}}}}$\ \ \ \ $     \color{evenTextColor}{\large\textsection$\,$\lastrightmark}}{}{}
\makeoddhead{mystyle}{}{}{\large \color{oddTextColor}{\leftmark} $\ \ \ \ $ {\large{\textbf {\color{oddPageColor}{\thepage}}}}}

(其中 mystyle 是用户定义的样式),并且打印正确。但是在新章节开始的页面中,在上一章的末尾(在同一页中,正如我所描述的)和仅有的到这些页面,根本不打印标题,就像我定义 \pagestyle{empty} 时的情况一样。我认为这是因为在回忆录类中,每章的第一页根本没有页眉,我想这里也是这种情况,即使第一页也是前几章的最后一页。我找到了可以在章节第一页打印页眉的说明,但它们不起作用。有什么建议可以解决这个问题吗?

答案1

不必要的复杂:只需使用article回忆录选项:

平均能量损失

\documentclass[article,a5paper]{memoir}
\usepackage{lipsum}
\makepagestyle{foo}
\makeheadrule{foo}{\textwidth}{\normalrulethickness}
\makeoddhead{foo}{A}{B}{C}
\makeevenhead{foo}{D}{E}{F}
\makeoddfoot{foo}{G}{H}{I}
\makeevenfoot{foo}{J}{K}{L}
\pagestyle{foo}
\begin{document}
\chapter{foo} \lipsum[1-3]
\chapter{foo} \lipsum[1-3]
\chapter{foo} \lipsum[1-3]
\chapter{foo} \lipsum[1-3]
\end{document}

请注意,标题上方的页眉意义不大。至少在第一页,考虑更改样式以省略页眉(例如\chapter{foo}\thispagestyle{plain})。

相关内容