[Tex/LaTex] (Book) Page number at new chapter is centered, but it shouldn’t be


I have the following problem:


\usepackage[figurename=Fig., font={footnotesize}]{caption}
\usepackage[a4paper,left=40mm, right=40mm ,top=35mm,bottom=35mm]{geometry}
\usepackage{tikz-feynman, contour}
\usepackage[square, numbers, comma, sort&compress]{natbib} 




This is everything I have before I start the document. The problem I have now, is: every time I start a new chapter, the page number appears at the bottom of the page in the center, but the way I set it up (and want it to be) is that it should appear either left or right (depending on even/odd page number). I cannot find the error. Before, this was not a book, but an article and there it worked the way I wanted it. Now I changed it to book and left the rest the way it was before. Everything else works fine, its just the starting page of each chapter.

I hope my information is sufficient for you to find the error.

In addition, it would be nice, if I could keep my footer even if a new chapter starts on this page (the header can vanish as it usually does with new chapters).

Edit: Now that is weird. I thought the commands would line up beneath each other, but they don't. Really sorry for that, gonna see if I can fix it up.

Best Answer

The problem comes from the fact that, in the book class, the first page of a chapter uses the plain style. The solution consists in redefining the plain style with fancyhdr. Here is a code, adapted from the documentation:

\fancyhf{}% clears all header and footer fields