I have been wondering this for years, and never really had so much trouble that I couldn't bear not to know, but now I think I'll just ask and see if anyone knows.

It is common practice to label one's theorems, corollaries, remarks, etc, and then later type "as per Theorem \ref{theoremname}...", but what I want to know is if I can label my theorem so that I can just type "as per \ref{whatever}", and the reference tag will automatically use "Theorem 6.1" or whatever.

My reason is that I just upgraded a remark to a corollary, and even though the remark is labelled, I now have to find the references to that remark and change them from "Remark \ref{tag}" to "Corollary \ref{tag}". Not a terribly recurring inconvenience, but just one of those things I'd like to know.

  • 1
    Welcome to TeX.SX! You may have a look on our starter guide. About your question: you should have a look at the cleveref package.
    – jub0bs
    May 15, 2013 at 13:57
  • 1
    \thref of the package ntheorem provides exactly that feature. In addition to that, it works better with the hyperref package because the "Theorem 6.1" becomes clickable instead of just "6.1".
    – papabravo
    May 15, 2013 at 14:16
  • One may also hack fancyref, I've used that sucessfully for a few books. It depends on label prefixing though, instead of looking at the context of the \label. IMO a package like cleveref mess with a bit too much for my taste.
    – daleif
    May 15, 2013 at 14:41

2 Answers 2


I use the fncylab package for this, which allows you to associate a macro expansion with every counter so that \ref{<label>} produces something more than just the value of the counter to which <label> corresponds. For example,

\labelformat{theorem}{Theorem #1}

does exactly what you want. I also tend to do \labelformat{equation}{(#1)} so that I don't have to bother with \eqref and, as a bonus, when used with hyperref, the entire (<number>) is hyperlinked rather than just the number.


The cleveref really helps to address this issue.

Instead of writing

We see in Theorem \ref{thm:bigimportantthm}

you simply use

We see in \cref{thm:bigimportantthm}

In your preamble, you tell the package how you want it to behave- in this example, you might write

% each of the following has two versions
%   \crefname{environmentname}{singular}{plural}, to be used mid-sentence
%   \Crefname{environmentname}{singular}{plural}, to be used at the beginning of a sentence

You can easily get it working with the hyperref and varioref as detailed in Difference between ref, varioref and cleveref. Decision for a thesis

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.