2

I'm using a two-sided openright report template for my thesis and I am trying to only remove the page header from the auto-generated empty pages (due to the even/odd page number interaction) and keep the page numbering. I have tried to include the emptypage package but to no avail, as it also removes the page numbering at the start of a new chapter. Down below is the code generating the page header and page numbering.

% Header and footer settings (Select TWOSIDE or ONESIDE layout below)
\usepackage{fancyhdr}                               
\pagestyle{fancy}  
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\space#1}{}} 


% Select one-sided (1) or two-sided (2) page numbering
\def\layout{2}  % Choose 1 for one-sided or 2 for two-sided layout
% Conditional expression based on the layout choice
\ifnum\layout=2 % Two-sided
    \fancyhf{}                                  
    \fancyhead[LE,RO]{\nouppercase{ \leftmark}}
    \fancyfoot[LE,RO]{\thepage}
    \fancypagestyle{plain}{         % Redefine the plain page style
    \fancyhf{}
    \renewcommand{\headrulewidth}{0pt}} 
    \fancyfoot[LE,RO]{\thepage}
\else           % One-sided     
    \fancyhf{}                  
    \fancyhead[C]{\nouppercase{ \leftmark}}
    \fancyfoot[C]{\thepage}
\fi

How should I proceed?

2

You have to include \fancyfoot[LE,RO]{\thepage} in the argument for fancy page style plain, if the page number should appear on chapter pages.

If the blank pages should use page style plain, you can load package scrextend with option cleardoublepage=plain:

\documentclass[twoside,openright]{report}

\usepackage[cleardoublepage=plain]{scrextend}

% Header and footer settings (Select TWOSIDE or ONESIDE layout below)
\usepackage{fancyhdr}                               
\pagestyle{fancy}  
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\space#1}{}} 


% Select one-sided (1) or two-sided (2) page numbering
\def\layout{2}  % Choose 1 for one-sided or 2 for two-sided layout
% Conditional expression based on the layout choice
\ifnum\layout=2 % Two-sided
    \fancyhf{}                                  
    \fancyhead[LE,RO]{\nouppercase{ \leftmark}}
    \fancyfoot[LE,RO]{\thepage}
    \fancypagestyle{plain}{         % Redefine the plain page style
      \fancyhf{}
      \renewcommand{\headrulewidth}{0pt}
      \fancyfoot[LE,RO]{\thepage}
    }
\else           % One-sided     
    \fancyhf{}                  
    \fancyhead[C]{\nouppercase{ \leftmark}}
    \fancyfoot[C]{\thepage}
\fi

\usepackage{blindtext}% only for dummy text

\begin{document}
\tableofcontents
\Blinddocument
\Blinddocument
\end{document}

enter image description here

  • Now it works as intended, thank you so much! – Jonathan W Mar 13 '18 at 10:25

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.