# (Book) Page number at new chapter is centered, but it shouldn't be

I have the following problem:

\documentclass[a4paper]{book}

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{fancyhdr}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{dsfont}
\usepackage{tikz}
\usepackage{braket}
\usepackage[figurename=Fig., font={footnotesize}]{caption}
\usepackage{float}
\usepackage{placeins}
\usepackage{epstopdf}
\usepackage[a4paper,left=40mm, right=40mm ,top=35mm,bottom=35mm]{geometry}
\usepackage{subfig}
\usepackage{tabularx}
\epstopdfsetup{outdir=./}
\usepackage{tikz-feynman, contour}
\usepackage[toc,title]{appendix}
\usepackage[nottoc]{tocbibind}
\usepackage[parfill]{parskip}
\usepackage{mathtools}
\usepackage[square, numbers, comma, sort&compress]{natbib}
\captionsetup[figure]{labelfont=bf}
\usepackage{hyperref}

\makeatletter
\makeatother

\renewcommand\vec{\boldsymbol}
\pagestyle{fancy}
\fancyhf{}
\fancyfoot[RO,LE]{\thepage}

\renewcommand{\footrulewidth}{0.4pt}
\usepackage{chngcntr}
\counterwithout{figure}{chapter}


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.

• this is not a complete minimum working example (to be honest, it is not even minimum :) ). It just your preamble. please put a complete mwe, in order for us to see the problem – Yorgos Aug 17 '16 at 21:25
• Comment aside: needless to load amsmath if you load mathtools. – Bernard Aug 17 '16 at 21:35
• @Yorgos Yeah, I know that, the thing is: What if I loaded a package, that did not work well with another one? That's why I listed the WHOLE stuff at the beginning in case I had 2 packages, that shut each other down and caused this problem I was in. – Zyrax Aug 17 '16 at 22:16

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:

\fancypagestyle{plain}{%
\fancyhf{}% clears all header and footer fields

• Add the option openany to the document class. The default is openright. – Bernard Aug 17 '16 at 22:22
• Adding \markboth{chapter title}{} right after \chapter*{chapter title} should do the trick. – Bernard Aug 17 '16 at 23:41