Here's my problem: I'm writing some mathematics lecture notes. I needed some different theorem types, such as propositions, lemmas, plus observations, examples and definitions whose numbering depends on theorems. Plus, I'm Italian, and wanted custom output labels for those. So I declared them as follows (found that solution probably here on StackExchange, even if I can't find the question right now).



However, right now, I get some problems with their numbering when using both the hyperref and cleveref packages. I want to use those to refer to a Proposition or such made somewhere before, such that I can be automatically redirected to where it is written by clicking on it, but with the link label automatically presenting the theorem type (Lemma, Osservazione and such), and eventually changing automatically if I decide to rename Lemma to, say, Short Theorem. I made a short example:





\label{foo}Proposition here

As stated in \hyperref[foo]{ \cref*{foo}}


Even if I replace \cref with \ref here, not actually using cleveref, I get the error anyway, so it depends just on the packages declaration.

The error I get is the following:

! LaTeX Error: No counter 'l' defined

If I replace "lemma" with "observation" I get the same error with counter 'o', and so on. Practically, it sees the first letter of the name of the theorem type I have declared as the counter, or something similar. Has anyone got any clue on how to get rid of this conflict?

  • cleveref is one of the few packages that must be loaded after hyperref. – jub0bs Jan 30 '14 at 16:04
  • Hell... that was quick. Thanks a lot for your answer, works like a charm! Feel kinda stupid because the problem was such a little thing though. Shows I'm a LaTeX newbie, the next time some strange, complex and articulated package incompatibility like this occurs, first thing I'm gonna do will be inverting their declaration order. Guess you need to slam your head on the wall personally to learn. Thanks a lot again! – Jeffrey Lebowski Jan 30 '14 at 16:04
  • Don't beat yourself up. The source of the error may not have been obvious to you because, in most cases, hyperref should be loaded last. And welcome to TeX.SX! – jub0bs Jan 30 '14 at 16:10