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}         
        \fancyhead[RO,RE]{Document title}
        \fancyfoot[CO, CE]{Page \thepage\ of \pageref{LastPage}}



\noindent \rule{\linewidth}{3pt}




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

\section{Second section}

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

  • 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}

you'll achieve your objective.

  • That's exactly it! Thank you so much, I knew it was quite simple :-) – Gabriel Mar 14 '13 at 20:50
  • 2
    @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
  • 1
    Hmmm you may have a point.. My idea was however to do it like the document found here: tobi.oetiker.ch/lshort/lshort.pdf. The author enumerates the "table of content"-pages with roman numerals too. In this way only the important pages are enumerated with arabic numerals, and only these pages count in the amount of total pages :-) – Gabriel Mar 14 '13 at 21:19
  • @Gabriel - You noticed correctly that Tobi Oetiker's "Short Guide" has different numbering styles for the front matter and the main matter of the document. However, that document doesn't use a "Page x of y" display method... – Mico Mar 14 '13 at 22:00
  • You're right, I'll check it out, thanks alot! :) – Gabriel Mar 14 '13 at 22:08

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.