0

I'm using hyperref and cleveref packages for to create link in my document. However, when I use \cpageref to reference a page, the link created drives me to a wrong page.

In the following MWE, the labeled paragraph is on page 3. The \cpageref is on page 6. When I click the link, it drives me to the page 1. Any help?

\documentclass[12pt,a4paper]{article}
\usepackage{blindtext}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage[%
noabbrev,
nameinlink,
sort
]{cleveref}

\begin{document}
\Blindtext\par%
%
\Blindtext\par%
%
\label{Here}\textbf{Referenced paragraph}\par%<- is on page 3
%
\Blindtext\par%
%
\Blindtext Page of the referenced paragraph \cpageref{Here}%<- Drives me to page 1
\end{document}%
  • 3
    A \label in LaTeX usually attaches to the last counter that was stepped up with a special command so that \label can see it (this happens for example in \section, in numbered theorems, in figure and table, ...). In your example no such counters are stepped up and so the \label has nothing to latch on to. You could try \phantomsection\label{Here}, but depending on your actual use case there might be more elegant methods like a theorem environment or \hypertarget+\hyperlink (cf. tex.stackexchange.com/q/63895/35864). – moewe Feb 13 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.