I have to reference lemmas and theorems I have created using amsthm, but I want the actual word (e.g"Lemma" or "Theorem") to show up whenever I reference them. \ref didn't do the trick, as that only gave me a number. After some googling I came across cleveref, which is supposed to solve it. Unfortunately, whenever I typeset my document, it gives me two question marks instead of the name of the environment I'm trying to reference (e.g. instead of getting "Lemma 7.3" I get "?? 7.3). Here's a MWE:
\documentclass[12pt]{article}
\usepackage{amsmath,amsthm}
\usepackage{cleveref}
\theoremstyle{definition}
\newtheorem{defn}{Definition}[section]
\theoremstyle{plain}
\newtheorem{thm}[defn]{Theorem}
\newtheorem{lemma}[defn]{Lemma}
\newtheorem{cor}[defn]{Corollary}
\crefname{lemma}{lemma}{lemma}
\Crefname{lemma}{Lemma}{Lemmas}
\begin{document}
\begin{lemma}[My lemma]\label{lemma1}
\end{lemma}
Hence, by \cref{lemma1}
\end{document}
Is there something I'm doing wrong here?
\begin{document}; when I include it everything works as expected – cmhughes Feb 10 '12 at 3:19\listfilesimmediately before your\begin{document}and post the output. Sounds like your distribution is not up to date – cmhughes Feb 10 '12 at 4:25