[Tex/LaTex] How to edit header of one page of book class

fancyhdrheader-footer

I use the book document class and make the headers with fancyhdr:

\documentclass[12pt, a4paper, reqno, oneside]{book}

\usepackage{amsmath,amsxtra,amssymb,latexsym, amscd,amsthm}
\usepackage{fancyhdr}

\lhead{gggggggggggggggggggg }

\rhead{\parbox{0.58\linewidth}{\begin{center}\small{\leftmark}\end{center}}}

\rfoot{\thepage}

\renewcommand{\headrulewidth}{0.2pt}

\renewcommand{\footrulewidth}{0.2pt}
\makeatletter

\let\ps@plain\ps@fancy

\makeatother

\begin{document}

\end{document}

Now I want to change right header on one page, can you help me ??

I tried to use : \thispagestyle{empty} to delete the header on one page.

Best Answer

I'll do with the assumption that you don't want the header in the chapter starting page:

\documentclass[12pt, a4paper, reqno,oneside]{book}

\usepackage{amsmath,amsxtra,amssymb,latexsym, amscd,amsthm}
\usepackage{fancyhdr}
\usepackage{lipsum} % just for the example

\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{gggggggggggggggggggg}
\fancyhead[R]{\makebox[0.58\linewidth]{\small\leftmark}}
\fancyfoot[R]{\thepage}
\renewcommand{\headrulewidth}{0.2pt}
\renewcommand{\footrulewidth}{0.2pt}

\fancypagestyle{plain}{%
  \fancyhf{}%
  \fancyfoot[R]{\thepage}%
  \renewcommand{\headrulewidth}{0pt}%
  \renewcommand{\footrulewidth}{0.2pt}%
}


\setlength{\headheight}{14.5pt} % as recommended by fancyhdr

\begin{document}

\chapter{Title}
\lipsum[1-20]

\end{document}

There's no need for a \parbox, unless your titles are unusually long. However I'd set them flush right. If you really need a \parbox, don't use \begin{center}...\end{center} in it, but

\parbox{<length>}{\centering <contents>}

and don't forget to look at the warnings by fancyhdr to know the correct value to assign to \headheight.

If you need to change the page style for other pages, define a specific style:

\fancypagestyle{peculiar}{% use whatever name you please
  \fancyhf{}% clear all the headers and footers
  % now define the contents of the various fields
  \fancyfoot[R]{\thepage}%
  %...
  \renewcommand{\headrulewidth}{0pt}% rule at the top
  \renewcommand{\footrulewidth}{0.2pt}% rule at the bottom
}

and issue \thispagestyle{peculiar} where you need it. By redefining the plain page style you have a different style on the chapter starting pages.