[Tex/LaTex] cleveref, hyperref and algorithm2e package produce wrong hyperlink (though correct page reference)

algorithm2ecleverefcross-referencinghyperreflinks

I'm using the packages as stated above in their latest version (also oberdiek-package is up-to-date).

The following code produces the wrong pdf-link to a float environment (refers to the same page as the reference, not to the referred algorithm), although the pageref command reflects the correct page.

 [...] depends upon \cref{alg:algorithm2} which is on page
 \pageref{alg:algorithm2}.

produces

referring to algorithm 2

Best Answer

After almost 3 hours of error analysis I ended up with a solution that worked with my setup - and may also be a hint to help others and solve similar problems.

I included hyperref as the very first package and as a consequence all links were set correctly.


@Werner: your help is appreciated - thank you. That was actually what I did. It was not obvious to me, how hyperref constructs its links (and it still is :-). I just was wondering, if there's some way to look under the hood - some log-file or any other mechanism that could speed up the investigation.