[Tex/LaTex] Header setting under \usepackage{fancyhdr} \pagestyle{fancy}

header-footer

enter image description here

enter image description here

In both the odd and even pages…"headrules"…means the horizontal line is not covering the full width of written texts as it is clearly visible from the uploaded images. The code of the chapter document which i have used is as follows:

\documentclass[12pt,twoside,a4paper]{book}
\usepackage[a4paper]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead {}
\fancyhead [ER]{\footnotesize \sc Chernoff Distance for Conditionally Specified Models}
\fancyhead [OL] {\footnotesize\sc\rightmark}
\fancyhead [RO,LE] {\thepage}
\fancyfoot {}
\renewcommand{\headrulewidth}{0.4pt}
\usepackage{amsfonts}
\usepackage{latexsym,amsmath}
\usepackage{amssymb,array}
\usepackage{amssymb}
\parindent 0.0 cm
\makeatletter \oddsidemargin 0in \evensidemargin 0in \textwidth
16cm \RequirePackage[dvips]{graphicx} \textheight 20cm
\setlength\textheight{8.8in} \setlength\textwidth{6.25in}
\setlength\topmargin{0.0in}
\newtheorem{t1}{Theorem}[section]
\newtheorem{p1}{Proposition}[section]
\newtheorem{l1}{Lemma}[section]
\newtheorem{c1}{Corollary}[section]
\newtheorem{d1}{Definition}[section]
\newtheorem{r1}{Remark}[section]
\newtheorem{co}{Counterexample}[section]
\newtheorem{ex}{Example}[section]
\renewcommand{\baselinestretch}{1.2}
\numberwithin{equation}{section}
%\newcounter{equation}[section]
\renewcommand{\theequation}{\thesection.\arabic{equation}}

I need help to solve the issue. Kindly help in your spare time…if the answer is known.

Best Answer

use it this way:

\documentclass[12pt,twoside]{book}
\usepackage[a4paper,rmargin=0in, lmargin=0in, 
   textwidth=16cm,textheight=20cm]{geometry}
\usepackage{graphicx}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead {}
\fancyhead [ER]{\footnotesize \sc Chernoff Distance for Conditionally Specified Models}
\fancyhead [OL] {\footnotesize\sc\rightmark}
\fancyhead [RO,LE] {\thepage}
\fancyfoot {}
\renewcommand{\headrulewidth}{0.4pt}
\usepackage{amsfonts}
\usepackage{latexsym,amsmath}
\usepackage{amssymb,array}
\parindent=0cm
\newtheorem{t1}{Theorem}[section]
[...]

then fancyhdr knows the exact page margins. Look into the documentation of geometry how pages can be defined. Margins of 0mm doesn't really make sense.