TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using white colored font on black page and somehow I am losing my page numbers. I suppose the page number is still in black color. So How do we set the color of page number? And while on the topic, how about color of page runners etc.

share|improve this question
up vote 9 down vote accepted

You can add all the colour information into your page style using fancyhdr.

In the following MWE, I've defined mypagestyle to set the page number in red (using \textcolor{red}{\thepage}) and modified the header rule macro \headrule:

enter image description here

\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{fancyhdr}% http://ctan.org/pkg/fancyhdr
  \fancyhf{}% Clear header/footer
  \fancyfoot[C]{\textcolor{red}{\thepage}}% Page # in middle/centre of footer
  \renewcommand{\headrulewidth}{.4pt}% .4pt header rule
    \color{red}\hrule\@height\headrulewidth\@width\headwidth \vskip-\headrulewidth}}
  \renewcommand{\footrulewidth}{0pt}% No footer rule
%  \def\footrule{{\if@fancyplain\let\footrulewidth\plainfootrulewidth\fi
%    \vskip-\footruleskip\vskip-\footrulewidth
%    \hrule\@width\headwidth\@height\footrulewidth\vskip\footruleskip}}

The same would hold if you're interested in having a coloured footer rule. I've included the \footrule definition in comment, for completeness.

share|improve this answer
Thanks. How does the running title (short title) get to be treated? – Maesumi Jul 12 '12 at 22:22
@Maesumi: In the standard document class (like article), you could use \fancyhead[R]{\leftmark} to place \leftmark (sectional heading) in the Right header. – Werner Jul 12 '12 at 22:30
@Werner In my applied case, this answer seem to only solve the problem for some page-numberings, it seems (i.e. in \documentclass{book}, not in \documentclass{report}). It only works for those which are not shifted to the top of the page (sorry for not being able to use a technical term which demonstrates deeper understanding); it does e.g. not work for page numbers at the first page of a \part{...}. – Vincent Verheyen Apr 20 at 4:42
@VincentVerheyen: That's true since book and report issue \thispagestyle{plain} on first pages for their \chapters. This is a common scenario, and you'll have to (re)define the plain page style to cover those cases. – Werner Apr 20 at 22:34

If all you need to achieve is to change the color of the page numerals on a page, and if you can get by with using LaTeX's "plain" page style, the following MWE will show you how to do it.

\usepackage{lipsum,xcolor,etoolbox} % lipsum for filler text
\makeatletter % change only the display of \thepage, but not \thepage itself:
\pagestyle{plain} % after changing a pagestyle command, it's necessary to invoke it explicitly

In addition to the "plain" page style, the standard LaTeX document classes also provide the "headings" and "myheadings" page styles. If you're using one of these page styles and wish to reset the color of the page numerals, you should insert the following code in your document's preamble (in addition to loading the etoolbox and xcolor packages, of course):

% patch the "plain" page style
% patch the "headings" page style
% patch the "myheadings" page style

Then, be sure to issue either \pagestyle{plain}, \pagestyle{headings}, or \pagestyle{myheadings} after \begin{document}.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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