Take the 2-minute tour ×
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.

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}
        \fancyhead[LO,LE]{Author}
        \fancyhead[RO,RE]{Document title}
        \fancyfoot[CO, CE]{Page \thepage\ of \pageref{LastPage}}
\usepackage{hyperref}
\hypersetup{
    linktoc=section,
    colorlinks=true
}


\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}
share|improve this question
    
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
add comment

1 Answer

up vote 4 down vote accepted

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.

share|improve this answer
    
That's exactly it! Thank you so much, I knew it was quite simple :-) –  Gabriel Mar 14 '13 at 20:50
    
@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
    
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
add comment

Your Answer

 
discard

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.