autoref on newtheorem

As long as the lemma and definition environments are defined after the hyperref and cleveref packages are loaded, using \cref in lieu of \autoref should give you what you want.

enter image description here

\documentclass{report} % or 'book'?
\usepackage{ntheorem}  % or 'amsthm'?
\usepackage[colorlinks]{hyperref}
\usepackage[capitalize,nameinlink,noabbrev]{cleveref} % to emulate \autoref style

\newtheorem{lemma}{Lemma}[chapter]
\newcommand{\lemmaautorefname}{Lemma}
\newtheorem{definition}[lemma]{Definition}
\newcommand{\definitionautorefname}{Definition}

\setcounter{chapter}{1} % just for this example

\begin{document}
\begin{lemma}
\label{lemma_foo}
  Some lemma
\end{lemma}
\autoref{lemma_foo}  (correct) and \cref{lemma_foo} (correct) \dots

\begin{definition}
\label{definition_bar}
  A definition
\end{definition}
\autoref{definition_bar} (incorrect) and \cref{definition_bar} (correct) \dots

\end{document}

Tags:

Environments