隐藏某一章节的页眉

隐藏某一章节的页眉

memoir文档中,如何隐藏某一特定章节中每一页的页眉?

然而,我不想\pagestyle{empty}按照建议使用这个答案,因为我希望该章节中的页面格式与文档中的其他页面完全相同(包括有页脚等)——只是没有页眉。

这是我当前的文档:

\documentclass{memoir}

\usepackage{etoolbox}
\usepackage{lipsum}

% Headers and Footers

\nouppercaseheads

\makepagestyle{mystyle} 
\setlength{\headwidth}{\dimexpr\textwidth+\marginparsep+\marginparwidth\relax}
\makerunningwidth{mystyle}{\headwidth}

\makeevenhead{mystyle}{\itshape\leftmark}{}{}
\makeoddhead{mystyle}{}{}{\itshape\leftmark}
\makeevenfoot{mystyle}{\thepage}{}{}
\makeoddfoot{mystyle}{}{}{\thepage}
\makepsmarks{mystyle}{\createmark{chapter}{left}{}{}{}}

\makeatletter
\makepsmarks{mystyle}{\createmark{chapter}{left}{shownumber}{\@chapapp\ }{:\ }}
\makeatother

\makepagestyle{plain}
\makerunningwidth{plain}{\headwidth}
\makeevenfoot{plain}{\thepage}{}{}
\makeoddfoot{plain}{}{}{\thepage}

\pagestyle{mystyle}

\makeatletter
\aliaspagestyle{title}{empty} % suppress the page number after \maketitle
\let\origps@chapter\ps@chapter
\preto\frontmatter{\let\ps@chapter\ps@empty\pagestyle{empty}}
\preto\mainmatter{%
  \cleardoublepage
  \let\ps@chapter\origps@chapter\pagestyle{mystyle}}
\makeatother

\begin{document}

\chapter{First Chapter}

\lipsum[1-10]

\chapter{Second Chapter}

I want to suppress the header for every page in this chapter.

\lipsum[1-10]

\end{document}

答案1

\pagestyle{plain}在 之后立即添加\chapter{Second Chapter}。您无需添加,\thispagestyle{plain}因为 默认情况下会自动完成\chapter。(您确实在示例中修改了 的行为\frontmatter,但切换回 的默认章节页面样式\mainmatter。)

相关内容