# Alignment of headers in thesis

I am writing a thesis. But it turned out to be of the wrong format. Following is the format (wrong one):

I want the following format, where header on odd page must be right side and header on the even page must be on the left side (in the following format):

P.S. Following is the TeX code that I used.

\usepackage{fancyhdr}
\pagestyle{fancy}                       % Sets fancy header and footer
\fancyfoot{}                            % Delete current footer settings
\renewcommand{\chaptermark}[1]{         % Lower Case Chapter marker style
\markboth{\chaptername\ \thechapter.\ #1}{}} %
\renewcommand{\sectionmark}[1]{         % Lower case Section marker style
\markright{\thesection.\ #1}}         %

\fancyhead[LE,RO]{\bfseries}            % Page number (boldface) in left on even
% pages and right on odd pages
\fancyhead[RE]{\sl\nouppercase\leftmark}% Chapter in the right on even pages
\fancyhead[LO]{\sl\nouppercase\rightmark}% Section in the left on odd pages

\cfoot{\thepage}
\makeatletter
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else%
\hbox{}%
\newpage%
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\parskip 7.5pt
\makeatother \clearpage{\pagestyle{plain}\cleardoublepage}

• Have you tried \fancyhead[RO]{\sl\nouppercase\leftmark}\fancyhead[LE]{\sl\nouppercase\rightmark} instead of \fancyhead[RE]{\sl\nouppercase\leftmark}\fancyhead[LO]{\sl\nouppercase\rightmark}? – gernot Nov 5 '19 at 14:12
• Use LE instead of RE and RO instead of LO. R=right, L=left, E=even, O=odd. – leandriis Nov 5 '19 at 14:12
• @gernotsaysReinstateMonica yeah I tried this but it is showing two headers on the same page – monalisa Nov 5 '19 at 18:27

To mark the left side of even pages (LE) and the right side on odd pages (RO), one has to set the header for these two locations:

\fancyhead[LE]{\sl\nouppercase\leftmark}


By default, all sides are marked, so one has to set locations that are supposed to remain empty, here the right side on even pages (RE) and the left one on odd pages (LO) explicitly to empty:

\fancyhead[RE,LO]{}


Here is a sample document:

\documentclass{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}