答案1
您应该为不同的组件定义页面样式。在下面的示例中,我(重新)定义了plain
- 用于每个第一页\chapter
- 为完全空白。此外,frontmatter
和被定义为在相应的格式(和)mainmatter
中设置页码。\roman
\arabic
\documentclass[oneside]{book}
\usepackage{fancyhdr,lipsum}
\fancypagestyle{plain}{%
\fancyhf{}% Clear header/footer
\renewcommand{\headrulewidth}{0pt}% Remove header rule
\renewcommand{\footrulewidth}{0pt}% Remove footer rule
}
\fancypagestyle{frontmatter}{%
\pagestyle{plain}% Just like plain page style
\fancyfoot[C]{\roman{page}}% Roman page number in footer centre
}
\fancypagestyle{mainmatter}{%
\pagestyle{plain}% Just like plain page style
\fancyhead[R]{\arabic{page}}% Arabic page number in header right
}
\let\oldfrontmatter\frontmatter
\renewcommand{\frontmatter}{
\oldfrontmatter
\pagestyle{frontmatter}
}
\let\oldmainmatter\mainmatter
\renewcommand{\mainmatter}{
\oldmainmatter
\pagestyle{mainmatter}
}
\begin{document}
\frontmatter
\title{A title}
\author{An author}
\maketitle
\cleardoublepage
\sloppy\lipsum[1-20] % Some front matter content
\mainmatter
\chapter{First chapter} % Start of main matter content
\sloppy\lipsum[1-50]
\end{document}