正如标题所示。摘要后面的标题如下:
CHAPTER 0. ABSTRACT
如何从前言标题中删除不必要的章节编号?
\documentclass{book}
\usepackage{fancyhdr}
\begin{document}
\frontmatter
\pagestyle{fancy}
\chapter{Abstract}
Why does it say ``Chapter 0.'' on the next page?
\tableofcontents
\mainmatter
\chapter{First}
\end{document}
答案1
该fancyhdr
包默认提供了\chaptermark
何时report.cls
生效的定义\pagestyle{headings}
。
该类book
反而检查了\if@mainmatter
:
\def\ps@headings{%
\let\@oddfoot\@empty\let\@evenfoot\@empty
\def\@evenhead{\thepage\hfil\slshape\leftmark}%
\def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
\let\@mkboth\markboth
\def\chaptermark##1{%
\markboth {\MakeUppercase{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\@chapapp\ \thechapter. \ %
\fi
\fi
##1}}{}}%
\def\sectionmark##1{%
\markright {\MakeUppercase{%
\ifnum \c@secnumdepth >\z@
\thesection. \ %
\fi
##1}}}}
因此,你应该用正确的定义补充你的代码。还有一个小问题,目录的页面将有二标题中的“CONTENTS”,因为\tableofcontents
使用\@mkboth
;您可以通过重新定义来修复它。
\documentclass{book}
\usepackage{fancyhdr}
\begin{document}
\pagestyle{fancy}
\makeatletter
\renewcommand\chaptermark[1]{%
\markboth{\MakeUppercase{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\@chapapp\ \thechapter. \ %
\fi
\fi
#1}}{}%
}
\renewcommand\@mkboth[2]{\markboth{#1}{}}
\makeatother
\frontmatter
\chapter{Abstract}
Why does it say ``Chapter 0.'' on the next page?
\tableofcontents
\mainmatter
\chapter{First}
\end{document}