I solved this problem for myself a few years ago without knowing about the theoremref
or ntheorem
packages, but those in themselves do not do what you want anyway.
The problems that I had with the standard setup were the following:
You have to give each theorem type a different environment, which has both a "begin" and "end" tag containing the name of the theorem. If you want to make a change, you have to change two words not near each other.
You have to write \label
every time.
You have to remember the name of the theorem type whenever you use \ref
. This is the problem which theoremref
also solves, though I think they do it in a slightly different way than I did.
The hyperlink produced by ref
(when using hyperref
) only encompasses the number and not the name ("Theorem 2", etc.), which is a small target but to change it is awkward.
I dealt with 1 and 2 by overwriting the theorem
environment with one that has the syntax
\begin{theorem}{theorem type}{name of label} ... \end{theorem}
thus solving the locality problem for the theorem type and also allowing me to omit \label
. For 3, I used the fncylab
package to do the work that theoremref
does (note that at the time, there was a bug in amsthm
which makes this impossible without some work. It may be fixed now). This also takes care of 4, since now the word "Theorem" is part of the text produced by \ref
, which is all wrapped in a hyperlink without my needing to do anything.
I like this solution very much. I write things like
\begin{theorem}{lem}{little lemma} This is a small lemma. \end{theorem}
It follows from \ref{little lemma} that we have
\begin{theorem*}{thm} The main result. \end{theorem*}
You can guess the effect of a theorem*
environment, of course. You can see the .sty file on my website if you are interested.
Later: I just found out about the thmtools
package. Man, that thing is awesome. I wish I had known about it. It does everything above (and more) and uses a keyval syntax for setting parameters, which is far better than having multiple arguments. Read p. 8 of its manual to see my hack done right. (It's not quite the same: it doesn't address point 1. However, I can imagine writing a wrapper environment taking a key "type" that would duplicate the above example.)
big-list
and cw. (but cw can’t be undone)\label
for each theorem.\label{thm:z_lemma}
or some such, but then I realized you can use spaces in the label. Now I'll write\label{zorn's lemma}
or even something crazy like\label{bounded chains imply maximal elements}
(which, if I were Zorn, I probably would have used in the original paper). Then I can be sure (on checking) that I have referenced the right theorem.