# How to disable 'totpages' anchor link created by 'hyperref'?

I've been searching like hell for this, trying to hack the totpages and/or the hyperref packages but to no avail...

The totpages package automatically creates link on every reference to the total number of pages in a document. I'm doing my CV with the europecv package and this places a Page X / TOTAL on the footer of every page and the totpages package automatically creates a link (if hyperref is also being used) on TOTAL always linking to the last page. This seems a bit pointless to me.

So far I've "disabled" this by setting the border color to white, the link still works, there's just no visual indication that it's a link. But this is not acceptable because this does not allow me to have visual indications on internal links I manually create.

I also tried \usepackage[anchorpages=false]{hyperref}, it seems to be the option to disable such linking, but it doesn't work.

Any other solution?

-

One needs to patch an internal command of europecv.cls. Put the following in your preamble

\usepackage{etoolbox}
\makeatletter
\patchcmd{\ecv@totpages}{\ref}{\ref*}{}{}
\makeatother

Alternatively, just rewrite the definition of the command using \ref* instead of \ref:

\makeatletter
\def\ecv@totpages{~/~\ref*{TotPages}}
\makeatother
-
I knew something like this was possible, I should have posted the question sooner. I tried to do it myself but I still consider myself a mediocre LaTeX user. – Ricardo Amaral Sep 5 '12 at 21:08
@RicardoAmaral Don't worry: we all learn from this site. Surely I've learnt a lot. – egreg Sep 5 '12 at 21:16
It works for \pageref*{LastPage}, too! – cfr Apr 22 '14 at 17:15

Just use \ref*{TotPages} instead of \ref{TotPages}. Package hyperref adds a star form for \ref for references without hyperlinks.

-
I can't do that as simple as that. I never use {TotPages} directly, that's handled by the europecv package. – Ricardo Amaral Sep 5 '12 at 19:46