# Display of references in a math document

In a math article one usually writes for a theorem (or proposition or corollary) in latex:

\begin{theorem} \label{theorem1}
....

\end{theorem}


Now I can reference to this theorem in the article using \ref{theorem1}. For example I can say:

In \ref{theorem1} we saw that .....


In the article this will be displayed as (when the theorem has number (lets say) 1.6.)

In 1.6 we saw that ....


Question: How can I modify the command \ref{theorem1} so that instead of just "1.6" in the text we see "Theorem 1.6" instead ( Or Proposition or Corollary instead of theorem)?

So the output should be

    In Theorem 1.6 we saw that ....


Of course I can just write "Theorem" before the "\ref{theorem1}" but I wonder whether there is an automatic way to write the theorem (or propositon or corollary) before the number 1.6.

• Hey @Mare, does nameref{} work? Requires the package with the same name and also hyperref, if I remember correctly. – TVL Jan 17 at 11:37
• amsmath has nothing to do with theorem names. I'm assuming you meant amsthm, and have changed the tag accordingly. – barbara beeton Jan 17 at 16:22
• What’s wrong with typing “Theorem \ref{theorem1}” when you want the “Theorem” to appear? – Dave Jan 17 at 21:43

## 1 Answer

You have two main options:

• Load the hyperref package and use its \autoref macro instead of the basic \ref macro.

• Load the cleveref package and use its \cref macro (instead of \ref).

If you load both hyperref and cleveref, hyperref must be loaded first.

For a lot more information about packages that provide various cross-referencing abilities, please see the posting Cross-reference packages: which to use, which conflict?

A basic MWE (minimum working example):

\documentclass{article}  % pick a suitable document class
\usepackage{amsthm}      % or 'ntheorem'
\usepackage[colorlinks,allcolors=blue]{hyperref}
\usepackage[nameinlink,capitalize]{cleveref}
\newtheorem{theorem}{Theorem}

\begin{document}
\begin{theorem} \label{theorem1} \dots \end{theorem}

With \verb+\autoref+: \autoref{theorem1}

With \verb+\cref+: \cref{theorem1}
\end{document}