2

I am writing my thesis using reportdocumentclass. I want to have current chapter title as 1. Chapter Name on right side of the even page header and section title on left side of the odd page header. I also want to have these headers as smaller cases. Below is my MWE which does not work as I want. On both pages it prints only section names. Can someone tell me what is the problem?

\documentclass[12pt, a4paper, twoside]{report}

\usepackage{fancyhdr}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\fancyhead[RE]{\chaptermark}
\fancyhead[LO]{\sectionmark}
\renewcommand{\headrulewidth}{1pt}

\begin{document}
\pagestyle{fancy}
\include{Chapter}
.
.
.
\end{document}

I also referred this question which did not help. Chapter title on even header and section title in odd header

2
  • The title of the question is in contradiction with the body of the question. Which is right?
    – Bernard
    Commented Aug 28, 2016 at 18:32
  • Sorry, the body part is right
    – Ruchi
    Commented Aug 28, 2016 at 18:34

2 Answers 2

1

Insert a \pagestyle{fancy} before the redefinition of \chaptermark and \sectionmark. The \chaptermark in your code sets a left mark and cleans the right mark. The \sectionmark sets a new right mark. So you can use

\documentclass[12pt, a4paper, twoside]{report}

\setlength\headheight{15pt}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\fancyhead{}% remove default header entries
\fancyhead[RE]{\leftmark}
\fancyhead[LO]{\rightmark}
\renewcommand{\headrulewidth}{1pt}

\usepackage{lipsum}% dummy text
\begin{document}
\chapter{Chapter}
\section{Section}
\lipsum
\lipsum
\end{document}

enter image description here

0
1

In my opinion, it's simpler to obtain what you want with titleps instead of fancyhdr. If I've well understood you would have small caps in header instead of regular capital letters:

\documentclass[12pt, a4paper, twoside]{report}
\usepackage{lipsum}}
\usepackage{titleps}
\newpagestyle{mine}{%
\headrule
\setheadrule{1pt}
\sethead[][][\scshape\thechapter. ~\chaptertitle]{\scshape\thesection. ~\sectiontitle}{}{}
\setfoot{}{\thepage}{}
}%
\pagestyle{mine}
\begin{document}%

\chapter{A First Chapter}
\section{Some section}
\lipsum[1-10]

\chapter{A Second Chapter}
\section{Another section}
\lipsum[11-20]

\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 .