I am writing some lecture notes for a course on overleaf.





%some text


Let $K\ss L$ be fields and let $\a \in L$ be algebraic over $K$. Then:
[K(\a):K]=\deg P_{min}(\a,K) \, .

%some more text

Hence, by \autoref{p:deg}, we have:

%even more text


I just recently found out about the \autoref command provided by the hyperref package. Quite pleased with it, it worked fine showing the correct label for my custom theorem environments (lemmas, prepositions, etc.). However, I realised that at some point all the labels appeared as "Theorem" instead. I don't recall making any changes to the preamble in that short amount of time. Also, I have read this question: How to get correct autoref for theorems However, I didn't have \<name>autorefname in the preamble before and it worked... I have tried to compile it on my MiKTeX and I get the same output, so this doesn't seem to be related to Overleaf.

  • 1
    \autoref detects the entity by the counter name in the anchor name of the reference. If different types of entities share the same counter, then \autoref cannot distinguish them. Packages like aliascnt might help to created different fake counters, which share the same counter, but make \autoref happy because of the different counter names. Of course, the new counter names needs support by \<name>autorefname. May 19, 2016 at 17:15
  • 1
    Please strip down the example on overleaf and post it here. Code on external sites might vanish at some time. May 19, 2016 at 17:17

1 Answer 1


The problem arises because the theorem, corollary, definition, lemma, and proposition environments all share the same counter.

The quickest solution I can think of is to (a) add the instruction


after loading the hyperref package and (b) replace all instances of \autoref with \cref.

Aside: I can't help but remark that your document suffers from a gross overuse of \left and \right to autosize the "fence symbols" (parentheses, brackets, etc.). In many cases I've looked at, omitting the \left and \right instructions would definitely be the (typographically) correct thing to do.

  • Thank you for your answer, and thanks for the remark as well. May I just ask for clarification, do you think I should remove (most of) the \left \right instructions? Is there a good reference that you can suggest about mathematical typography?
    – Dem K.
    May 19, 2016 at 18:01
  • 1
    @DemK. - I'd say you only time you need the non-default size of the fences in the document you've posted is when you're encasing a \sum... statement in parentheses in a display-math environment. In these cases, I'd use \biggl( and \biggr), as \left( and \right) would give you parentheses that are too large, typographically speaking. For an excellent introduction to mathematical typography using the TeX system, I can heartily recommend chapters 16 to 19 of The TeXbook by Don Knuth.
    – Mico
    May 19, 2016 at 18:13
  • Thank you very much for your tips and the recommendation.
    – Dem K.
    May 19, 2016 at 18:35
  • 1
    @DemK. - Do also replace all instances of _{min} with _{\min}, don't redefine \det, \diag, \gcd, and under no circumstance redefine \rm. (It's a good thing you don't actually use \rm in your document...)
    – Mico
    May 19, 2016 at 18:37

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.