[Tex/LaTex] No Chapter #num in the header with fancyhdr

fancyhdrheader-footer

I'm using fancyhdr and I want to have the header with chapters name without number opposite to section name. I've tried a lot of configurations, but none works with in this case.

How could be fixed?

ps: This short document has a different style in the Chapter page, but in the real document this is fixed.

\documentclass[11pt,a4paper,twoside,titlepage,openany]{book}
\usepackage{lipsum}
\usepackage[T1]{fontenc}
\usepackage{amsfonts}
\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage[italian]{babel}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage{sectsty}

\usepackage{geometry}
\geometry{
    left=35mm,
    right=30mm,
    top=27mm,
    bottom=30mm
}

\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\renewcommand\headrulewidth{0.4pt}
\renewcommand\footrulewidth{0.4pt}

\fancyhead[LE,RO]{\rightmark}
\fancyhead[LO,RE]{\chaptermark}

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}

\fancyfoot[LE,RO]{\thepage} % Left side on Even pages; Right side on Odd pages

\begin{document}
\chapter{Chapter Intro}
\lipsum
\chapter{Chapter with subsections}
\section{section foo}
\lipsum
\subsection{subsection bar}
\lipsum
\end{document}

Best Answer

With

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}

each chapter sets the left mark to the chapter name. So you have to use

\fancyhead[LO,RE]{\leftmark}

to get the desired result.

enter image description here

Code:

\documentclass[11pt,a4paper,twoside,titlepage,openany]{book}
\usepackage{lipsum}% only for dummy text

\usepackage{geometry}
\geometry{
    left=35mm,
    right=30mm,
    top=27mm,
    bottom=30mm,
    headheight=13.6pt% <- added as suggest by fancyhdr
}

\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhf{}
\renewcommand\headrulewidth{0.4pt}
\renewcommand\footrulewidth{0.4pt}

\fancyhead[LE,RO]{\rightmark}
\fancyhead[LO,RE]{\leftmark}% <- changed

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}

\fancyfoot[LE,RO]{\thepage}

\begin{document}
\chapter{Chapter Intro}
\lipsum
\chapter{Chapter with subsections}
\section{section foo}
\lipsum
\subsection{subsection bar}
\lipsum
\end{document}

If there are some starred chapters which should get a header entry too, use \markboth manually. Example:

\chapter*{Introduction}\markboth{Introduction}{}

Of course you can define a macro to do that.