I have a situation where using \cref from package cleveref to reference a theorem seems to create a hyperlink to the wrong page. The link points to the page where the theorem was supposed to be typeset, before latex decides to fill that page with other floats. That page directly precedes the one where the theorem finally ends up at.

I have tried some ideas from

wrong page with pageref if using thmtools

but none worked. It seems that the target of the link is created before the position where the theorem is typeset is fixed.

Any way one can work around this?


I experimented with moving the \begin{figure} ... \end{figure} commands after the theorem.

The theorem now gets typeset at the top of some page, but the link goes to the bottom of the page immediately preceding that.

I then inserted a \clearpage right before the theorem, and it fixes the problem.

However, this solution does not scale well, obviously. Any ideas?

  • 1
    Could you provide us with a minimal example, where the suggested answers don't work? – Teepeemm Mar 25 '18 at 0:32
  • 1
    \clearpage and \cleardoublepage commands would not only start a new page, but also would instruct LaTeX to print queued tables and figures. Hence, you may use this command before referencing a float. But with this approach, you may need to move contents around so that you will not wind up with a page with too much of empty space – Al-Motasem Aldaoudeyeh Mar 25 '18 at 0:36
  • 1
    Does changing the order in which cleverref and hyperref are loaded matter? – John Kormylo Mar 25 '18 at 14:51
  • ! Package cleveref Error: cleveref must be loaded after hyperref!. – dow Mar 25 '18 at 22:45

Browse other questions tagged or ask your own question.