I am writing some lecture notes for a course on overleaf.
\documentclass[a4paper,11pt,openany]{book}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[colorlinks=true]{hyperref}
\theoremstyle{definition}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{example}[theorem]{Example}
\newtheorem*{notation}{Notation}
\newtheorem*{note}{Note}
\newtheorem*{solution}{Solution}
\def\bse{\begin{equation*}}
\def\ese{\end{equation*}}
\def\bp{\begin{proposition}}
\def\ep{\end{proposition}}
\def\bt{\begin{theorem}}
\def\et{\end{theorem}}
\begin{document}
%some text
\bt
\label{t:theorem_bla}
bla
\et
\bp
\label{p:deg}
Let $K\ss L$ be fields and let $\a \in L$ be algebraic over $K$. Then:
\bse
[K(\a):K]=\deg P_{min}(\a,K) \, .
\ese
\ep
%some more text
Hence, by \autoref{p:deg}, we have:
%even more text
\end{document}
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.
\autorefdetects the entity by the counter name in the anchor name of the reference. If different types of entities share the same counter, then\autorefcannot distinguish them. Packages likealiascntmight help to created different fake counters, which share the same counter, but make\autorefhappy because of the different counter names. Of course, the new counter names needs support by\<name>autorefname. – Heiko Oberdiek May 19 '16 at 17:15