回忆录 - 仅在右侧页面设置标题规则

回忆录 - 仅在右侧页面设置标题规则

我正在使用 进行双面书写memoir。我修改了一个模板,将前页的内容仅放在右侧(正面)页面上。但是,这并不能确保背面页面完全空白 - 它们仍然显示页眉(章节/部分信息)、页眉和页脚(页码)。我使用单独的pagestyle前页很容易关闭了背面页眉和页脚。这使我能够在主内容中重新打开这些项目。

有人能帮我对标题规则做同样的事情吗?我希望它只出现在前言的右侧页面上,但出现在主内容的所有页面上*。下面的 MWE,第 ii 页和第 iv 页有一个标题规则 - 我如何只从这些页面中删除它?标题规则应该在前言之后返回到两个页面。

编辑:我实际的前言包括多页目录和图片列表。与前言的其余部分一样,这些部分的反面页面也应为空白,而正面页面则包含标题。

'* 除了部分或章节的第一页之外,尽管默认行为已经隐藏了主规则,所以这是可行的。

\documentclass[a4paper,11pt]{memoir}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Only print on odd pages, taken from:
% http://tex.stackexchange.com/questions/118170/table-of-content-only-on-right-side-pages
\usepackage{everyshi}
\makeatletter
\EveryShipout{\if@mainmatter\else\ifodd\c@page\null\pagebreak\fi\fi}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Set up a page style with no header or footer (page number) on left pages
% Not sure how to get left/right control of the header rule?
\makepagestyle{rightpagestyle} 
\makeoddfoot{rightpagestyle}{}{\thepage}{} 
\makeheadrule{rightpagestyle}{\textwidth}{\normalrulethickness} 
\makeoddhead{rightpagestyle}{}{}{\small\textsc{\rightmark}}
\pagestyle{rightpagestyle}


\begin{document}
\frontmatter
\chapter{This is a chapter}
First page text.
\newpage
Second page text.
\end{document}

输出

答案1

当您为前页制作页面样式时,不必担心反面页面。单独处理它们更容易。完全空白的页面比您最初要求的要容易得多 ;)。

我假设您至少需要两种不同的标题页样式:一种用于前页,一种用于正文。如果它们不需要不同,您可以进一步简化代码。

因此,要设置这两种样式,请使用如下方法:

\makepagestyle{frontps}
\makeoddfoot{frontps}{front odd left foot}{\thepage}{front odd right foot}
\makeevenfoot{frontps}{front even left foot}{\thepage}{front even right foot}
\makeoddhead{frontps}{front odd left head}{front odd centre head}{front odd right head}
\makeevenhead{frontps}{front even left head}{front even centre head}{front even right head}
\makeheadrule{frontps}{\textwidth}{\normalrulethickness}
\pagestyle{frontps}
\makepagestyle{mainps}
\makeoddfoot{mainps}{main odd left foot}{\thepage}{main odd right foot}
\makeevenfoot{mainps}{main even left foot}{\thepage}{main even right foot}
\makeoddhead{mainps}{main odd left head}{main odd centre head}{main odd right head}
\makeevenhead{mainps}{main even left head}{main even centre head}{main even right head}
\makeheadrule{mainps}{\textwidth}{\normalrulethickness}

请注意,我特意为和的正反面页面指定了页眉和页脚frontpsmainps实际上,我在前页的正反面页面上使用什么页眉和页脚并不重要,因为我们要确保它们永远不会显示。

线路

\EveryShipout{\if@mainmatter\else\ifodd\c@page\null\pagebreak\fi\fi}

基本上就是说,每次发送页面时,检查它是否在主内容中。如果是,则继续。如果不是,则做一些特殊的事情。特殊的事情是说,如果页面是奇数,则不放任何内容并开始一个新页面。

因此,我们需要做的就是将其更改为“...然后不放任何内容,清除此页面的页眉和页脚,然后开始新页面”。也就是说,我们只想添加\thispagestyle{empty}

\EveryShipout{\if@mainmatter\else\ifodd\c@page\thispagestyle{empty}\null\pagebreak\fi\fi}

这就足够了。

封面和正文的页面布局

\documentclass[a4paper,11pt]{memoir}
% Only print on odd pages, taken from:
% http://tex.stackexchange.com/questions/118170/table-of-content-only-on-right-side-pages
\usepackage{everyshi,kantlipsum}
\makeatletter
\EveryShipout{\if@mainmatter\else\ifodd\c@page\thispagestyle{empty}\null\pagebreak\fi\fi}
\makeatother

\makepagestyle{frontps}
\makeoddfoot{frontps}{front odd left foot}{\thepage}{front odd right foot}
\makeevenfoot{frontps}{front even left foot}{\thepage}{front even right foot}
\makeoddhead{frontps}{front odd left head}{front odd centre head}{front odd right head}
\makeevenhead{frontps}{front even left head}{front even centre head}{front even right head}
\makeheadrule{frontps}{\textwidth}{\normalrulethickness}
\pagestyle{frontps}
\makepagestyle{mainps}
\makeoddfoot{mainps}{main odd left foot}{\thepage}{main odd right foot}
\makeevenfoot{mainps}{main even left foot}{\thepage}{main even right foot}
\makeoddhead{mainps}{main odd left head}{main odd centre head}{main odd right head}
\makeevenhead{mainps}{main even left head}{main even centre head}{main even right head}
\makeheadrule{mainps}{\textwidth}{\normalrulethickness}


\begin{document}
\frontmatter
\tableofcontents
\kant[1-5]
\mainmatter\pagestyle{frontps}
\chapter{This is a chapter}
First page text.
\newpage
Second page text.
\kant[6-20]
\end{document}

相关内容