How to put the page numbers in the center at top of each page in report class ?

NEW: TikZ book now 40% off at Amazon.com for a short time.
Code: Select all
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\chead{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
we need to see the modifications you made. Please post the preamble of your document with your particular settings (in the sense of a minimal working example).QwareeqMathematics wrote:...
But , It gives center for some pages only, and some numbers come over the words in the document.
In some previous post I move the chapter for the top. So, the number wasn't at the top of page . I need it to be on the top for all document...
Code: Select all
\documentclass[11pt,a4paper]{report}
\usepackage[pdftex]{graphicx}
\usepackage{amssymb,latexsym,amsmath,mathrsfs,fullpage,array,ifsym,color}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\contentsname}{List of Contents}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\chead{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\makeatletter
\def\@makechapterhead#1{%
\vspace*{-30\p@}% default: 50pt
{\parindent \z@ \centering \normalfont% default: \raggedright
\ifnum \c@secnumdepth >\m@ne
\huge\bfseries\sc \@chapapp\space \thechapter
\par\nobreak
\vskip 0\p@% default: 20\p@
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 20\p@
}}
\def\@makeschapterhead#1{%
\vspace*{-30\p@}% default: 50pt
{\parindent \z@ \centering% default: \raggedright
\normalfont
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 20\p@
}}
\makeatother
\newtheorem{definition}{Def\mbox{}\mbox{}inition}[chapter]
\newtheorem{example}[definition]{Example}
\newtheorem{theorem}[definition]{Theorem}
\setlength{\parskip}{3ex}
\begin{document}
\pagenumbering{roman}
% FRONT Matter
\pagenumbering{arabic}
Body Text
\end{document}
To prevent a warning, you will also have to addQwareeqMathematics wrote:I read the file and as I understand I should put this code :
Code: Select all
\usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} \chead{\thepage} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt}
Code: Select all
\setlength{\headheight}{14pt}
To solve this, add...
But , It gives center for some pages only...
Code: Select all
\let\ps@plain\ps@fancy
I did some tests but I wasn't able to reproduce this situation. Can you please provide some code that clearly shows the odd behaviour mentioned?...and some numbers come over the words in the document...
Code: Select all
\usepackage{amssymb,latexsym,amsmath,mathrsfs,fullpage,array,ifsym,color}
Code: Select all
\usepackage[margin=1in]{geometry}
Code: Select all
\renewcommand{\headheight}{14pt}
Code: Select all
\setlength{\headheight}{14pt}
NEW: TikZ book now 40% off at Amazon.com for a short time.