# Hyperref marks lastpage as a reference

I am using the hyperref package, lastpage package and fancyhdr package. My problem is, that the number showing the amount of total pages (in the footer) is red and works like a link to the front page. I do not want it to be neither red or work as a link, though I want to link to the sections in my table of contents (which works perfectly). Please help! :-)

\documentclass[11pt, a4paper, oneside]{article}
\usepackage{lastpage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot[CO, CE]{Page \thepage\ of \pageref{LastPage}}
\usepackage{hyperref}
\hypersetup{
}

\begin{document}

\thispagestyle{empty}

\vspace*{3cm}
\noindent \rule{\linewidth}{3pt}
\vspace{0.2cm}
\begin{center}\textbf{\Huge{Title}}\end{center}
\vspace{0.5cm}
\rule{\linewidth}{3pt}

\vspace{3cm}

\newpage

\pagenumbering{roman}
\tableofcontents
\newpage
\pagenumbering{arabic}

\section{First section} \label{sec:1}

\section{Second section}

This is a reference to \nameref{sec:1}.

\end{document}

• Welcome to TeX.SE! Please post a MWE (minimum working example) to show what you've done so far. In particular, it would be useful if you showed how you've made use of the commands of the fancyhdr package to affect the page number display – Mico Mar 14 '13 at 20:07
• Sorry, forgot that! :-) -- Think i posted the code wrong too.. :/ – Gabriel Mar 14 '13 at 20:23

The hyperref package provides the variant commands \ref* and \pageref* in case one needs to avoid the creation of a hyperlink while creating a cross-reference.

Thus, if you write

\fancyfoot[CO, CE]{Page \thepage\ of \pageref*{LastPage}


• @Gabriel - I'm glad you found this answer useful. Do note that that there's something odd about the Table of Contents page being numbered "Page i of 1". You may want to look into what the pagesLTS package can do for you to keep track of the total number of pages of a piece, be they numbered in roman or arabic. Or, consider moving the \pagestyle{fancy} directive after the \pagenumbering{arabic} statement. – Mico Mar 14 '13 at 20:55