2

I am using the fancyhdr package where from what I understand the default is no header on the chapter pages, but I still have the header displaying the section name on all my chapter pages. I would like to still have the footer with the page number, but not the header.

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\sectionmark}[1]{\markboth{#1}{}} % set the \leftmark
\fancyhf{}
\fancyhead{}
\fancyhead[RO, LE]{\leftmark} % 1. sectionname
\fancyfoot[C]{\thepage}
\fancypagestyle{plain}{
\renewcommand{\headrulewidth}{0pt}
}
1
  • 1
    Wellcome to SE! Please prowide minimal working example, a short document, which we can compile and exhibits your problem.
    – Zarko
    Feb 3, 2016 at 14:08

1 Answer 1

2

Since \chapter uses \thispagestyle{plain}, the \fancypagestyle{plain} redefinition must disable the \fancyhead[RO,LE]{...} from fancy style, i.e. say \fancyhead{} in \fancypagestyle{plain}{...}.

\documentclass{book}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\sectionmark}[1]{\markboth{#1}{}} % set the \leftmark
\fancyhf{}
\fancyhead{}
\fancyhead[RO, LE]{\leftmark} % 1. sectionname
\fancyfoot[C]{\thepage}
\fancypagestyle{plain}{%
\fancyhead{}%
\renewcommand{\headrulewidth}{0pt}
}

\usepackage{blindtext}
\begin{document}


\chapter{First}
\section{First section}
\blindtext[10]
\chapter{Second}

\section{First section in 2nd chapter}
\blindtext[10]


\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .