2

Possible Duplicate:
How to cross-reference theorems with “Theorem”?

I have had this doubt for quite a long time but I am unable to work out a way. This problem concerns referring back to definitions, equations, theorems, lemmas in a mathematical write-up of any sort:

Please consider the following code:

 \documentclass{amsart}
 \usepackage{amsthm}

 \newtheorem{defn}{Definition}
 \newtheorem{thm}{Theorem}
 \begin{document}
 This is an example. 

 \begin{defn} \label{ring}
 A commutative ring $R$ with unity is an abelian group with a binary operation  $\cdot $
(frequently referred to as multiplication) which is associative, commutative and has an identity. 
 \end{defn}


\begin{thm} \label{0pro}
$0_R \cdot r = 0_R$ for all $r \in R$
\end{thm}

The proof of Theorem \ref{0pro} follows from definition \ref{ring}. 

 \end{document}

In referring back to a theorem, one has to say Theorem \ref{0pro}. My doubt is that it must be possible to automise this: as in every instance of a reference to a theorem must come automatically as Theorem <blah> instead of having to manually type this in.

Example: \ref{0pro} must print Theorem 1 and similar goes for others.

Is there a hack or a work around?

6
  • Use \nameref of hyperref or \cref of cleveref package for this purpose. – bodo Jul 21 '12 at 9:46
  • 1
    D'oh! Didn't search through the site properly. Voting to close. – kan Jul 21 '12 at 9:51
  • Add \usepackage{cleveref} to your preamble after loading amsthm, but before issuing \newtheorem. In the text body, use \cref instead of \ref. – lockstep Jul 21 '12 at 9:52
  • @lockstep Thank you. But, is this not compatible with hyperref just in case someone wanted to use those hyperlinks in the .pdf document? – kan Jul 21 '12 at 9:57
  • 1
    cleveref is one of the packages that must be loaded after hyperref. – lockstep Jul 21 '12 at 9:57

Browse other questions tagged or ask your own question.