# Page number on Index page

I define the style of page numbering using fancy package, however, on Index page number is set in the center of footer. How to get the number in right place or remove it at all from Index page (at least...)?

\documentclass[]{article}

\usepackage{lastpage}

\usepackage{fancyhdr}
\pagestyle{fancy}

\fancyhf{}

\usepackage{makeidx}
\makeindex

\begin{document}

\section{A} \index{A}
\newpage
\section{B} \index{B}

\printindex

\end{document}


You have to redefine the plain pagestyle. If you want to keep it also, you might try something like this. @Ruedi was the first, but this didn't really fit in the comments...

\documentclass[]{article}

\usepackage{lastpage}

\usepackage{fancyhdr}
\pagestyle{fancy}

\fancyhf{}

% BACKUP PLAIN STYLE
\makeatletter
\let\ps@plainorig\ps@plain
\makeatother

\usepackage{makeidx}
\makeindex

\begin{document}

\section{A} \index{A}
\newpage
\section{B} \index{B}

% CHANGE PLAIN STYLE
\makeatletter
\let\ps@plain\ps@fancy
\makeatother

\printindex

% REVERT PLAIN STYLE
\makeatletter
\let\ps@plain\ps@plainorig
\makeatother

\end{document}


The answer can be found in Section 7 of the fancyhdr manual:

Some Latex commands, like \chapter, use the \thispagestyle command to automatically switch to the plain page style, thus ignoring the page style currently in effect. To customize even such pages you must redefine the plain pagestyle

You can add the following code to your preamble to replicate the page style for the other pages:

\fancypagestyle{plain}{%
\fancyhf{}