# [texhax] setting counters to output of a \ref command

David Romano romanod at math.grinnell.edu
Thu Feb 15 16:26:54 CET 2007

Thank you, Uwe -- The package you suggested should do the trick.  My
intention *was* to "preview" a theorem which would be stated "officially"
in a later section of the paper, and I think I may need the cannonball
after all: My worry is that the journal I submit the paper to may have
a very local implementation of the theorem environment, and so even if I
try to mimic the appearance of the official theorem, it may end up looking
different in the published article.

Best,
David

On Mon, 12 Feb 2007, Uwe Lück wrote:

> At 17:52 08.02.07, David Romano wrote:
>> I'd like to have a particular theorem appear twice in a paper,
>> and I'd like its appearance to be identical in both,
>> the numbering in particular, without having to set the
>> section and theorem counters by hand.
>>
>> Is there a way of getting a hold of the numbers generated by the \ref
>> command so I can use them to set the relevant counters and duplicate the
>> appearance of the theorem?  I've tried several sources of LaTeX
>> documentation and just can't seem to find a way to do this; the only
>> related piece of information I found was that one can "transport" the
>> current value of a counter with \value{counter}, but here I'm interested
>> in transporting a value that is not current.
>
> For a "general" part of your question, I guess that Heiko Oberdiek's
> refcount package from
>
>    CTAN:/macros/latex/contrib/oberdiek/
>
> is what you are looking for.
>
> Considering merely the single problem that you (David Romano)
> posted, however, I guess that my previous advice would be
> "shooting cannon balls at sparrows", "as (about) we Germans say"
> (i.e., the effort is very much more than what actually is needed).
> My suggestion:
>
> 1. Put some \label{thm:glorious} into the first environment
>    that generates your "glorious" theorem.
>
> 2. For repeating your "glorious" theorem, just type
>    (and change what doesn't fit your design):
>
>      \begin{trivlist}
>        \item[\bfseries Theorem \ref{thm:glorious}]
>        \slshape %% ... or \itshape ...
>        <Repeat text body of your "glorious" theorem>
>      \end{trivlist}
>
> [-- This finishes the kernel of my suggestion;
> the following remarks rather address "TeX philosophers".]
>
> I find the present query interesting because I myself
> like a style used in (philosophical/...) theory of
> measurement where the most interesting results
> are stated in a first part of a section;
> while proofs follow in a kind of appendix (of the section).
> With this idea however, I hadn't just /repeated/
> such theorems. Rather, I introduced some technical terms
> and used them for restating the main results in a hopefully
> more transparent wording.
>
> HTH -- Uwe.
>
> At 23:19 08.02.07, Philip G. Ratcliffe wrote:
>> The following is adapted from a suggestion in the FAQ for lists, it should
>> be possible to do something similar for theorems.
>>
>> \documentclass{article}
>> \begin{document}
>> \noindent Here's a list:
>> \begin{enumerate}
>>   \item A
>>   \item B
>>   \newcounter{it:last-scalar-rule}%
>>   \setcounter{it:last-scalar-rule}{\value{enumi}}%
>>   \item C
>> \end{enumerate}
>> And here's a repetition:
>> \begin{enumerate}
>>   \setcounter{enumi}{\value{it:last-scalar-rule}}