[texhax] Theorem numbering

Uwe Lueck uwe.lueck at web.de
Tue Sep 14 16:10:41 CEST 2010

hh-brasil at bol.com.br, 14.09.2010 14:06:30:
> If I remember right, the counters start at zero as defined.
> I might be necessary you have to find the introduction of your counter in your style file
> and redefine it there. Even it should be possible to introduce a further counter or
> to change the counter's name, but this is not advised to newbies.
>
> \newcounter{thm}[section]
>
> This defines that at each new section the counter thm will be set to 0.

I had forgotten to add that "Theorem numbering" was quite wrong a name for the subject. The issue is "re-using" a theorem by text and by number. I mainly addressed the text, Barbara addressed the number. This works easily without modifying counters.

Cheers,

Uwe.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   1. Re: Theorem numbering (Uwe Lueck)
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Mon, 13 Sep 2010 21:57:11 +0200 (CEST)
>From: Uwe Lueck
>To: switzel at mathematik.tu-darmstadt.de, Barbara Beeton
>Cc: texhax at tug.org
>Subject: Re: [texhax] Theorem numbering
>Message-ID:
>Content-Type: text/plain; charset=UTF-8
>
>This may be one of the rather serious contributions of mine:
>
>Barbara Beeton , 04.06.2010 15:34:59:
>> stefan witzel asks for the ability to
>> "re-use" a theorem with the same number
>> as the original.
>[...]
>> re-using the theorem text is
>> left as an exercise for the reader.
>
>Actually doing the exercise:
>
>I thought of the extract' package (ctan.org/pkg/extract) or some
>verbatimwrite' (ctan.org/pkg/moreverb,
>quite a few packages have similar functions)?difficult
>to learn?more easy instead (although not tested, sorry):
>Type theorem body code in an extra file, say, thm-outs.tex.
>To typeset the theorem at its "proper" place, type
>
>\begin{thm}\label{thm:outs}
>  \input{thm-outs}
>\end{thm}
>
>Barbara?s xrefthm is enlightening,
>yet I would prefer the following generalization
>(in the document preamble?once I desired to have this!
>e.g.: Thm. 2* an ?analogue? of Thm. 2 for a different setting):
>
>\newenvironment*{var-id-thm}[1]{%
>  \def\thethmid{#1}%
>  \begin{the-var-id-thm}%
>}{%
>  \end{the-var-id-thm}%
>}
>\newtheorem*{the-var-id-thm}{Theorem \thethmid}
>
>To be used like this:
>
>\begin{var-id-thm}{\ref{thm:outs}}
>  \input{thm-outs}
>\end{var-id-thm}
>
>I prepared the previous as HTML (looks finer) at
>
>    http://www.webdesign-bu.de/uwe_lueck/texhax.htm#reuse-thm
>
>(you may find an older version with some mistakes).
>
>Cheers,
>
>    Uwe.
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>[OP:]
>>    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}
>>    ₢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:
>>
>>    [...]
>>
>>    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!
>>
>>the test file attached below uses \label
>>to identify the theorem number, and also
>>allows for multiple "re-used" theorem
>>numbers.  re-using the theorem text is
>>left as an exercise for the reader.
>>						-- bb
>>
>>			--------------------
>>
>>\documentclass{article}
>>\usepackage{amsthm}
>>
>>\newtheorem{thm}{Theorem}[section]
>>\newenvironment{xrefthm}[1]{%
>>  \def\thexref{\ref{#1}}
>>  \begin{thexrefthm}
>>}{%
>>  \end{thexrefthm}
>>}
>>\newtheorem*{thexrefthm}{Theorem \thexref}
>>
>>\begin{document}
>>
>>\section{Introduction}
>>In this section we have two theorems.
>>
>>\begin{thm}
>>The first is an ordinary theorem.
>>\end{thm}
>>
>>\begin{xrefthm}{laterthm}
>>The other is a duplicate of a theorem in a later
>>section, with its original number.
>>\end{xrefthm}
>>
>>\section{Next}
>>Here we have a different forward referenced'' theorem.
>>
>>\begin{xrefthm}{another}
>>This theorem also has a number from a later section.
>>\end{xrefthm}
>>
>>\setcounter{section}{8}
>>\section{Ninth}
>>
>>In this section we have three theorems.
>>
>>\begin{thm}
>>The first is an ordinary theorem.
>>\end{thm}
>>
>>\begin{thm}\label{laterthm}
>>But this one will be referenced earlier in the
>>paper with the theorem number from here.
>>\end{thm}
>>
>>\begin{thm}\label{another}
>>And this one will also be referenced earlier
>>with its own number.
>>\end{thm}
>>
>>\end{document}