Possible Duplicate:
How to get more complete references
Is there a way to recognize cross-reference types automatically in LaTeX? For example, see the code below
\begin{lemma}\label{triangle}%
\[
a^{2}=b^{2}+c^{2}\text{.}%
\]
\end{lemma}
\begin{theorem}
\bigskip From \ref{triangle}, we have
\[
E=mc^{2}\text{.}%
\]
\end{theorem}
As you see, when I reference the lemma in the theorem, the LaTeX only displays the number of the lemma in the compiled pdf file. In fact, I hope LaTeX can recognize reference types. For e.g., when I reference a lemma, then LaTeX displays automatically both lemma and its number (such as lemma 2.1, not just the number 2.1 of this lemma) in the compiled pdf file; when I reference a theorem, then LaTeX automatically displays both theorem and its number (such as theorem 3.7, not just the number 3.7 of this theorem ) in the compiled pdf file.
