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'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

share|improve this question
1  
Is \label{alg:algorithm2} after the \caption command in your algorithm? –  Werner Dec 1 '11 at 20:12
2  
Also make sure to load cleveref after hyperref –  cmhughes Dec 1 '11 at 20:17
    
Yes. Every algorithm is defined like the following snipplet shows: \begin{algorithm} \caption{CaptionOfTheAlgorithm} \label{alg:algorithm2} [...] @cmhughes: cleveref loaded after hyperref, done. –  Eric Dec 1 '11 at 20:20
1  
Could you create a MWE that demonstrates this? –  cmhughes Dec 1 '11 at 20:23
2  
@Eric: Without an MWE it is virtually impossible to assess what the problem is. I would suggest sequentially removing document elements from your source code until the problem disappears. This way you can selectively focus in on the problem and try to eliminate it. This could be removing actual main document/typeset content, to removing preamble content while still maintaining a consistent/compilable document. Some more considerations: What PDF viewer are you using? Have you tested it in other viewers? Do you reset the page numbers in your document (or have a \front-, \mainmatter setup)? –  Werner Dec 2 '11 at 8:00
show 3 more comments

1 Answer

up vote 3 down vote accepted

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.

share|improve this answer
3  
In tex.stackexchange.com/a/1868/586 it is mentioned that algorithm is one of the exceptions to the rule "load hyperref last", perhaps the same is true for algorithm2e. –  Torbjørn T. Dec 2 '11 at 10:09
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.