TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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 hyperref together with lastpage. My problem is that \pageref{LastPage} gets the same color as the links identified with hyperref. I want it to be just the ordinary color (e.g. black)

Allow me to adapt the chosen answer to my previous question about lastpage:




\cfoot{\thepage\ of \pageref{LastPage}}





I tried \usepackage{color} and then modifying the \cfoot... line to \cfoot{\thepage\ of \color{black}\pageref{LastPage}}, but to no avail.

share|improve this question
up vote 22 down vote accepted

Use \pageref* as described in the hyperref manual.

share|improve this answer
(I made the assumption that you also do not want the page number of the last page to be a link.) – Willie Wong Oct 26 '10 at 15:25

In case you do want the page number of the last page to be a link, you nearly got it: \usepackage{color} (or xcolor) and

\cfoot{\thepage\ of {\hypersetup{linkcolor=black}\pageref{LastPage}}}

instead of

\cfoot{\thepage\ of \color{black}\pageref{LastPage}}

The additional brackets around the link to be coloured differently ensure that the colour change is local to this group, i.e. following links will be coloured Maroon (or whatsoever was chosen before) again.

Additionally you need to change \href{mailto:my_email@email.com}{my_email@email.com} to \href{mailto:my_email@email.com}{my\_email@email.com} and Maroon needs to be defined as colour.

share|improve this answer
This does not work. – Jed May 23 '12 at 20:30
@Jed: Yes, there seem to have been introduced some changes in the recent version of hyperref. Also _ must be changed into \_ and Maroon is no longer recognized. Thanks for pointing this out! I updated my answer. – Stephen May 31 '12 at 15:10

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.