# Page-numbering control with scrbook and fancyhdr

Have I missed an instruction for specifying where the document class scrbook places the page number on the first page of each chapter of a book?

In a book with multiple chapters, involving diverse and complex formatting, I am using scrbook, for its support of \multiplefootmarker. I am also using fancyhdr, in order to control header content.

With scrbook and fancyhdr coexisting, I have a problem getting page numbers to appear centered on the first page of each chapter. fancyhdr centers page numbers as desired after the first page of a chapter. But it seems that scrbook defaults to placing page numbers on the bottom right of each chapter's first page, and that seems to override fancyhdr's \fancyfoot command. A MWE follows (actual use of \multiplefootmarker isn't needed to illustrate the problem).

\documentclass[12pt]{scrbook} % needed for use of \multiplefootmarker (not shown)

% Fancy *headers* are only needed on pages after first of chapter.
\usepackage{fancyhdr}
\pagestyle{fancy}

% But page number should be centered at bottom of every page.
\fancyfoot[C]{\thepage}

% For MWE content
\usepackage{lipsum}

\title{Book Title}

\begin{document}
\maketitle
\chapter{Chapter Title}
\lipsum[1-12]
\chapter{Another Chapter Title}
\lipsum[1-12]
\end{document}


Edit: Following @Ulrike_Fisher's comment, I added a command

\newcommand\headrulecontrol{
\fancypagestyle{plain}{
}


and then modified each chapter to, for example:

  \chapter{Chapter Title}
\lipsum[1-12]


This works fine — page numbers are centered but there is no page-head rule on the first page of a chapter.

• \fancypagestyle{plain}{\fancyhf{}\cfoot{\thepage}} see the documentation of fancyhdr. Dec 7 '16 at 18:31
• Thank you. Indeed, fancyfoot doesn't seem to be needed at all in the presence of \fancypagestyle. But, interestingly, a horizontal line now appears at the top of the first page of each chapter. I see that I can eliminate it with \renewcommand{\headrulewidth}{0pt}, but do I then need to restore an explicit head rule after the first page? Dec 7 '16 at 18:42
• Oh, I see how to use \renewcommand for that a second time right after using fancyhf. Thanks again. Dec 7 '16 at 18:57

As @Ulrike mentioned you have to redefine the plain style in the preamble:

\fancypagestyle{plain}{
\fancyhf{}% remove all entries in header and footer
\fancyfoot[C]{\thepage}% centred page numbers in footer
}


Setting \headrulewidth to 0pt for page style plain affects only the headrule on plain pages.

Example:

\documentclass[12pt]{scrbook} % needed for use of \multiplefootmarker (not shown)

% Fancy *headers* are only needed on pages after first of chapter.
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}

% But page number should be centered at bottom of every page.
\fancyfoot[C]{\thepage}

\fancypagestyle{plain}{
\fancyhf{}
\fancyfoot[C]{\thepage}
}

\usepackage{lipsum}% For MWE content
\title{Book Title}

\begin{document}
\maketitle
\chapter{Chapter Title}
\lipsum[1-12]
\chapter{Another Chapter Title}
\lipsum[1-12]
\end{document}


Note that I have changed the header entries. On left pages (even page numbers) \leftmark is now used and on right pages (odd page numbers) \rightmark. So your \markboth commands can change the header entries. But the \chapter command sets marks too.

Maybe you want to use package scrlayer-scrpage which is part of the KOMA-Script bundle:

\documentclass[12pt]{scrbook} % needed for use of \multiplefootmarker (not shown)

\usepackage[
manualmark% because of your manual usage of \markboth
]{scrlayer-scrpage}
\clearpairofpagestyles
\cfoot*{\pagemark}

\usepackage{lipsum} %For MWE content

\title{Book Title}
\begin{document}
\maketitle
\chapter{Chapter Title}

But do you really want to set the marks manually? If \chapter and \section should set the marks automatically, change option manualmark to automark and remove your \markboth commands.