2

Possible Duplicate:
How do I repeat a theorem number?

I want to set up a simple macro that would do the following: It would be very similar to \label{XX}, (say, \relabel{XX}) only instead of setting the environment/equation/section/etc. to a new number, it will set the counter for that location to \ref{XX}, which already appears previously in the .tex file. It should set the counter to XX according to the current environment setcounter settings. If possible, when leaving the environment, it should restore the counter back.

Is that possible? Does such a macro/command already exist? The closest I could find is setcounter, but that requires stating the type of counter and I am also not sure how to specify a value which is a reference previously in the text.

klew
  • 999
  • \label doesn't set any counters so it's very hard to understand what you're trying to do here. Can you give an example of the document input you'd like to be able to write and an example of the output you're trying to get? – Will Robertson Oct 19 '10 at 02:53
  • For example, I have the following in the .tex file: \begin{lemma} lemma statement \label{lemma1} \end{lemma} \begin{proof} proof in appendix\end{proof} more text of the rest of the appear \appendix \section*{Appendix A} \begin{lemma} restatement of the lemma - want the number appearing next to it to be identical to the one appear up there. \end{lemma} – klew Oct 19 '10 at 03:09
  • Is this a duplicate of this question? – Lev Bishop Oct 19 '10 at 03:19
  • it does seem to be a duplicate. are such hacky solutions the only way to do it?! I would expect to have some ability to define a \smartlabel{xxx} macro that would use the same numbering for xxx if it already exists in \ref{} and otherwise get a new index. – klew Oct 19 '10 at 03:24
  • okay. I think I understand... \label does not set the counter, just sets a name for it in the .tex file. Fair enough. But still... all the methods described in the other answers are extremely ad-hoc. I am very surprised by that. – klew Oct 19 '10 at 03:31
  • This answer seems the best: http://tex.stackexchange.com/questions/422/how-do-i-repeat-a-theorem-number/2502#2502 – Will Robertson Oct 19 '10 at 03:32
  • Uh, it does seem to be the most elegant solution. Alas, it does not work. I get: – klew Oct 19 '10 at 03:52

0 Answers0