1

I am facing a strange problem and hope it is a simple trick that I am missing. I am trying to use several custom fancypagestyle using fancyhdr to separate frontmatter,appendix and backmatter and main matter etc.

Now by default, the first page number is at the fancyfoot[c] for every chapter and other front and backmatter. Initially I have not changed the fancyfoot[].

But when for a particular chapter style say appendix style I try to format \thepage style using fancyfoot[CO,CE] and fancyhead[LE,RO] using {\bfseries \sffamily \thepage}, it happens such that excluding first page of each chapter remaining pages font change works fine as per my custom font. How to rectify this.

In short, I want to make the page numbering at the starting of each chapter as \bfseries \sffamily \thepage.

A MWE may be as follows

\documentclass{book}
\usepackage[english]{babel}
\usepackage{fancyhdr}
\usepackage{blindtext}

\fancypagestyle{mystyle}
  {
  \fancyhf{}
  \fancyhead{}
  \fancyfoot[CO,CE]{\large \bfseries \sffamily \thepage}
%The first page of each chapter not changing but other pages ok
  \renewcommand{\headrulewidth}{1pt}
  \renewcommand{\footrulewidth}{0pt}
  }
  \pagestyle{mystyle}

    \begin{document}

    \frontmatter
    \chapter{Preface}
     \Blindtext
      \Blindtext          
      \chapter{About this book}
       \Blindtext
        \Blindtext        

    \tableofcontents

    \mainmatter
    \chapter{My Style Chapter}
    \blindtext
     \Blindtext        
    \section{My style section}
    \Blindtext
     \Blindtext

    \appendix
    \chapter{Appendix My Style}
    \blindtext

    \section{My Appendix section}
    \Blindtext
     \Blindtext        

    \backmatter       

    \end{document}

closed as off-topic by Mensch, Raaja, Stefan Pinnow, siracusa, Sebastiano Mar 11 at 20:46

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – albert Aug 5 '18 at 8:34
  • @albert, I have now added an MWE where it shows that first page of every new chapter is default style but second page onwards it formats as customized – Deb bijan Aug 5 '18 at 8:45
  • Chapter pages uses page style plain by default. So you have to redefine this page style too. – esdd Aug 5 '18 at 9:22
  • 1
    @esdd, thanks, I have defined \fancypagestyle{plain}{...} for chapter page and it worked. Now format is ok. – Deb bijan Aug 5 '18 at 9:40
  • 4
    I'm voting to close this question as off-topic because it was solved in comments – Mensch Mar 11 at 17:31