[texhax] Theorem numbering

Stefan Witzel stwitzel at googlemail.com
Wed Jun 2 12:08:24 CEST 2010


Hi,

I'm using the amsthm-Package and number my theorem within sections, i.e.

\newtheorem{thm}{Theorem}[section]

Now I would like to quote a theorem from the end of the paper in the
introduction with its original number (which is 9.1 in my case).
Of course I could do so by manually setting the counters:

\setcounter{section}{9}
\setcounter{thm}{0}
\begin{thm}
...
\end{thm}
\setcounter{section}{1}
\setcounter{thm}{0}

but this destroys the idea of automatic numbering, because if my
theorem becomes Theorem 9.2 because it is preceded by Lemma 9.1, it
has the wrong number in the introduction.
When I once had the problem of quoting a theorem *after* it had been
stated, I used the following makros the save and recover the counters:

\newcounter{position_counter}
\newcounter{go_on_counter}
\newcommand{\remember}[1]{\setcounter{position_counter}{\value{#1}}}
\newcommand{\recall}[1]{\setcounter{go_on_counter}{\value{#1}}\setcounter{#1}{\value{position_counter}}\addtocounter{#1}{-1}}
\newcommand{\goon}[1]{\setcounter{#1}{\value{go_on_counter}}}

\begin{thm}
...
\end{thm}
\remember{thm}

...

\recall{thm}
\begin{thm}
...
\end{thm}
\goon{thm}

But how can I can obtain the number before the actual statement (using
the \label)? I imagine there should exist solutions to this, but I did
not find them on the web (and I don't know enough about
makro-programming, to extract the necessary information from the
\label-data myself). Many thanks in advance!

Best regards,
Stefan


More information about the texhax mailing list