3

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{}
\rhead{\thepage/\pageref{LastPage}}
\renewcommand{\headrulewidth}{0pt}

\usepackage{makeidx}
\makeindex

\begin{document}

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

\printindex

\end{document}
4

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{}
\rhead{\thepage/\pageref{LastPage}}
\renewcommand{\headrulewidth}{0pt}

% 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}
4

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{}
\rhead{\thepage/\pageref{LastPage}}
\renewcommand{\headrulewidth}{0pt}}

This basically sets the same options for the "plain" page style.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.