1

So far I have the page numbering in header for all pages (which is fine as wanted) except for the page where chapter begins - they are left empty without page numbering.

I would like to get the page number in footer for pages where chapter begins. Is that possible ?

So far I got this which work pretty well for page numbering in headers however the page numbering are missing for chapter pages:

\pagestyle{fancy}                       % Sets fancy header and footer
\fancyfoot{}                            % Delete current footer settings


\fancyhf{}

\fancyhead[LE,RO]{\bfseries\thepage}    % Page number (boldface) in left on even
% pages and right on odd pages
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\thechapter.\ #1}}{}}

\fancyhead[RE]{\bfseries\nouppercase{\leftmark}}      % Chapter in the right on even pages
\fancyhead[LO]{\bfseries\nouppercase{\rightmark}\chaptermark}     % Section in the left on odd pages

\fancypagestyle{plain}{
\fancyhf{}
  \fancyhead{}
  \fancyfoot{}
    \renewcommand{\headrulewidth}{0pt}
}

enter image description here

enter image description here

enter image description here

2
  • 1
    Where you redefine the plain page style, you wrote \fancyfoot{}, which makes the footer empty, since it's the plain style which is uused on chapters first pages in standard classes. Use fancyfoot[C]{\thepage} instead.
    – Bernard
    Aug 13 '19 at 10:44
  • easy way to do it - thanks a lot Aug 13 '19 at 10:51
1

Assuming you are using a standard class (there is no MWE in the question), you can remove the definition of fancypagestyle plain. Then the default plain style provided by the standard class is used on chapter pages. And this default plain style seems to be the desired style.

Example:

\documentclass{book}
\usepackage{blindtext}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\thechapter.\ #1}}{}}
\fancyhf{}
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[RE]{\bfseries\nouppercase{\leftmark}}
\fancyhead[LO]{\bfseries\nouppercase{\rightmark}}
\begin{document}
\blinddocument
\end{document}

Result:

enter image description here

1
  • thanks a lot brow Aug 14 '19 at 9:27
1

You can add this code in your preamble:

\let\oldchapter\chapter
\makeatletter
\def\chapter{%
\@ifstar{\@Starred}{\@nonStarred}%
}
\def\@Starred{%
\@ifnextchar[%
{\GenericWarning{}{Warning: A starred section can not have parameters. I am going to ignore them!}\@StarredWith}%
{\@StarredWithout}%
}      
\def\@StarredWith[#1]#2{%
\oldchapter*{#2}%
\thispagestyle{plain}
}
\def\@StarredWithout#1{
\oldchapter*{#1}%
\thispagestyle{plain}
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\oldchapter[#1]{#2}%
\thispagestyle{plain}
}
\def\@nonStarredWithout#1{%
\oldchapter{#1}%
\thispagestyle{plain}
}
\makeatother

This will change the default behavior of the chapter (that includes a pagestyle{empty} command)

2
  • I had not seen the comment of @Bernard ... and depends on the documentclass if the pagestyle would be plain or empty ... But this code is supposed to fix the issue anyway.
    – koleygr
    Aug 13 '19 at 10:46
  • I simply added the code, but the page numbering was still empty on chapter pages - I appreciate your help, I have fixed it Aug 13 '19 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.