I have some theorems in a paper whose proofs I want to move to an
appendix.
The problem with this is that I need the repeated statement of the
theorem in the appendix to have the same number as that in the main
text.
Ie. Theorem 1 in main text. Theorem 1 (with proof) in appendix.
I don't see how to easily do that. Any suggestions? Thanks.
Faheem.
Search this group for the thread "Restating Theorems"
>The problem with this is that I need the repeated statement of the
>theorem in the appendix to have the same number as that in the main
>text.
Well, if those are your requirements, I don't know exactly how to help
you, short the possibility of defining a command for the theorem
statement, which doesn't sound like a particularly elegant solution,
and I'm positive that someone will come up with a better one.
However, what I've seen is the statement of a theorem in the text and
its proof in a separate sectional unit, which is IMHO a good idea if
the proof does not really "fit" a proof environment. This way, there
should be no serious problem, e.g.:
\subsection{Proof of theorem~\ref{th:foo}}
Michele
--
>It's because the universe was programmed in C++.
No, no, it was programmed in Forth. See Genesis 1:12:
"And the earth brought Forth ..."
- Robert Israel in sci.math, thread "Why numbers?"
> I have some theorems in a paper whose proofs I want to move to an
> appendix.
>
> The problem with this is that I need the repeated statement of the
> theorem in the appendix to have the same number as that in the main
> text.
Here's what I do:
\subsection{Proof of Theorem~\ref{...}}
\begin{quote}\it
... restatement of theorem ...
\end{quote}
\begin{proof}
... proof of theorem ...
\end{proof}
Bob T.
...
> I have some theorems in a paper whose proofs I want to move to an
> appendix.
>
> The problem with this is that I need the repeated statement of the
> theorem in the appendix to have the same number as that in the main
> text.
...
J.S. Milne already gave a pointer to the newsthread "Restating Theorems"
which took place here at comp.text.tex only a few weeks ago.
I was one of the people who contributed to the discussion. Back then some
code was elaborated. But there was still some (minor) problem left:
In case that the code was used in comjunction with the hyperref-package
while compiling under pdfeLaTeX instead of eLaTeX, each "restating" of
a theorem would cause some warning in the log-file.
Meanwhile I found out that the warnings were due to "\refstepcounter",
a LaTeX2e-kernel-macro which gets redefined by the hyperref-package.
I decided to create a package "theomac" where the "warnings-issue"
seems to be resolved.
You can find the manual/explanation etc within the .sty-file itself.
I placed these things right behind the "\endinput"-command which
is the last part of the coding-section and also the point where
LaTeX stops reading when importing a file or a package.
Sincerely
Ulrich
=====<start of theomac.sty>=====
% This is file `theomac.sty',
%
% The usage is explained after coding-stuff, right after
% "\endinput". This way you don't need all these percent-chars
% all the time...
%
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{amsmath}
\ProvidesPackage{theomac}
[2006/07/29 v1.00beta1 Define macros from theorems.]
%
% Find out how to catch the arguments - there are the following
% possibilities:
% - \newtheorem{env_name}[numbered_like]{caption}
% - \newtheorem{env_name}{caption}[within]
% - \newtheorem{env_name}{caption}
%
\newcommand*\newtheoremWithMacro[1]{%
\@ifnextchar[%
{\newtheoremwithmacrooptbrace{#1}}%
{\newtheoremwithmacrobraceopt{#1}}%
}%
\newcommand*\newtheoremwithmacrobraceopt[2]{%
\@ifnextchar[%
{\newtheoremwithmacrolastopt{#1}{#2}}%
{\newtheoremwithmacronolastopt{#1}{#2}}%
}%
%
% Depending on the order of the arguments, one of the following
% three macros is called for defining the theorem <foo> and
% afterwards calling "\@newtheoremWithMacro{<foo>}" for trans-
% forming that environment into one that catches up an additional
% optional argument for defining a macro which can henceforth be
% used for restating that theorem:
%
\@ifdefinable\newtheoremwithmacrooptbrace{%
\gdef\newtheoremwithmacrooptbrace#1[#2]#3{%
\newtheorem{#1}[#2]{#3}\@newtheoremWithMacro{#1}%
}%
}%
\@ifdefinable\newtheoremwithmacrolastopt{%
\gdef\newtheoremwithmacrolastopt#1#2[#3]{%
\newtheorem{#1}{#2}[#3]\@newtheoremWithMacro{#1}%
}%
}%
\@ifdefinable\newtheoremwithmacronolastopt{%
\gdef\newtheoremwithmacronolastopt#1#2{%
\newtheorem{#1}{#2}\@newtheoremWithMacro{#1}%
}%
}%
%
%"\@newtheoremWithMacro{<foo>}" "transforms" the theorem-environ-
% ment "<foo>" into one that catches up an additional optional
% argument for defining a macro which can henceforth be used for
% restating that theorem:
%
\newcommand\@newtheoremWithMacro[1]{%
% First "copy" the theorem-environment "<foo>" to the environ-
% ment "<foo>theorem":
\expandafter\@ifdefinable\csname #1theorem\endcsname{%
\expandafter\global
\expandafter\let
\csname #1theorem\expandafter\endcsname
\csname #1\endcsname
}%
\@ifundefined{end#1theorem}{%
\expandafter\global
\expandafter\let
\csname end#1theorem\expandafter\endcsname
\csname end#1\endcsname
}%
{%
\edef\reserved@a{%
\expandafter\expandafter
\expandafter\@gobble
\expandafter\string
\csname end#1theorem\endcsname
}%
\@notdefinable
}%
%
% Then define the macro "\@<foo>" to catch the first optional
% argument into the macro \@tempa and to start collecting the
% "body" of the environment into the token-register "\toks@"
% whereby a call to the former "<foo>"-theorem-environment
% which was saved in/copied to "<foo>theorem" must precede
% everything in order to make sure that a theorem is formed
% when later the token-register is "flushed":
%
\expandafter\@ifdefinable\csname @#1\endcsname{%
\expandafter\gdef\csname @#1\endcsname[##1]{%
\def\@tempa{##1}%
\collect@body\toks@{#1theorem}%
}%
}%
%
% Afterwards redefine the internal starter-macro of the
% "<foo>"-theorem-environment (and thus that environment it-
% self) to call the "\@<foo>"-macro and hereby supply an empty
% optional argument if no optional argument is provided:
%
\expandafter\gdef\csname #1\endcsname{%
\@ifnextchar[%
{\@tempswatrue\csname @#1\endcsname}%
{\@tempswafalse\csname @#1\endcsname[]}%
}%
% Redefine the internal-ending-macro of the "<foo>"-theorem-
% environment so that to the content of the token-register
% both the leading token "\begin" [Within the \collect@body-
% part there was inserted "{#1theorem}" -- Together this yields
% "\begin{#1theorem}" ] and a trailing phrase "\end{#1theorem}"
% get added. Afterwards flush the register once in order to
% print the theorem...
%
\expandafter\gdef\csname end#1\endcsname{%
\toks@\expandafter{%
\expandafter\begin
\the\toks@\end{#1theorem}}%
\the\toks@
% In case there was no optional argument, we have
% "\@tempswafalse".
% In case "\@tempa" is empty, the optional argument for
% defining the macro is empty. In both cases we don't need to
% define a "theorem-printing"-macro. Otherwise we have to.
% Then within "\@tempa" the name of that macro is stored so
% that "\@tempa" needs to be expanded once before defining
% can take place. The environment itself is within the
% token-register.
% All we have to do is making sure that
% - we always get the same value for the counter
% - the counter does not get stepped
% - label has no effect (otherwise: multiply defined
% references-errors!!!!!)
% whenever the theorem is restated:
\ifx\@tempa\@empty\@tempswafalse\fi
\if@tempswa
{%
\expandafter\edef
\csname the#1\endcsname{%
\csname the#1\endcsname
}%
\expandafter\@ifdefinable\@tempa{%
\expandafter\expandafter
\expandafter \gdef
\expandafter\@tempa
\expandafter{%
\expandafter\bgroup
\expandafter\def
\csname the#1%
\expandafter\expandafter
\expandafter \endcsname
\expandafter\expandafter
\expandafter {%
\csname the#1%
\expandafter\endcsname
\expandafter}%
\expandafter\let
\expandafter\label
\expandafter\@gobble
\expandafter\let
\expandafter\refstepcounter
\expandafter\@gobble
\the\toks@
\egroup
}%
}%
}%
\fi
}%
}%
\endinput
%
Usage etc:
==========
legal stuff
-----------
theomac.sty - Copyright (C) 2006 by Ulrich Diez
(ulric...@alumni.uni-tuebingen.de)
theomac may be distributed and/or modified under the conditions
of the LaTeX Project Public Licence (LPPL), either version 1.3
of this license or (at your option) any later version. (The
latest version of this license is in:
http://www.latex-project.org/lppl.txt
and version 1.3 or later is part of all distributions of LaTeX
version 1999/12/01 or later.)
The author and Current Maintainer of this work is Ulrich Diez.
This work has the LPPL maintenance status 'maintained'.
Usage of theomac.sty is at your own risk.
There is no warranty - neither for the documentation nor for any
other part of theomac.sty. If something breaks, you usually may
keep the pieces.
What is it? / Acknowledgment / Intro:
-------------------------------------
The file theomac.sty is a package for LaTeX2e. It came into being
as a result of internet-discussion that took place at
comp.text.tex (usenet).
Subject: Restating Theorems
Initial posting in July 8 2006 by Louis Theran
(ID: 1152428341.7...@p79g2000cwp.googlegroups.com)
Special thanks to Ulrich M. Schwarz, Louis Theran and Michael for
their comments and for reporting problems and thus providing
important contributions to the making of this package.
The introducing-phrase in Louis Theran's initial posting:
...
> In longer papers, I like to state results in an early section
> and then restate them before the proof later on.
...
Usually you define theorem-like-environments by means of the
"\newtheorem"-macro.
theomac.sty provides a macro "\newtheoremWithMacro" which is
similar to "\newtheorem" but which creates environments which
also allow specifying an additional optional-argument which is
to hold the name of a newly to be defined control-sequence.
Internally these environments fork:
If optional argument is not supplied or supplied empty:
Simply create the theorem-text and hereby internally use an
environment defined in terms of "\newtheorem".
If optional argument is supplied a macro-name:
Additionally define a macro to spit out the theorem-text. (For
getting the environment-text into a defining-control-sequence's
argument, amsmath.sty's "\collect@body"-macro is used. I tried
to take care so that referencing-labels won't get defined more
than once and counters will be balanced correctly.)
If you wish to repeat/restate the theorem, you can do so by
simply calling that macro given in the optional argument when
stating it the first time.
"\newtheoremWithMacro" has the same syntax as "\newtheorem".
Difference is:
\newtheorem{foo}...
creates theorem-environment with syntax
\begin{foo} ... \end{foo}
________________________
\newtheoremWithMacro{foo}...
creates theorem(-like)-environment with syntax
\begin{foo}[\macro] ... \end{foo}
If you supply the optional-argument "\macro", you can later
repeat/restate your theorem-statement by calling "\macro".
"\macro" will be defined in terms of "\global".
If "\macro" is already defined, an error is raised.
Usage
-----
Possible syntax-patterns for "\newtheorem" are:
\newtheorem{env_name}[numbered_like]{caption}
\newtheorem{env_name}{caption}[within]
\newtheorem{env_name}{caption}
Possible syntax-patterns for "\newtheoremWithMacro"are the same:
\newtheoremWithMacro{env_name}[numbered_like]{caption}
\newtheoremWithMacro{env_name}{caption}[within]
\newtheoremWithMacro{env_name}{caption}
Syntax-patterns for a theorem "foo" defined in terms of
"\newtheorem" are:
\begin{foo}
This is my theorem
\end{foo}
\begin{foo}[Galois]
This is my theorem
\end{foo}
Syntax-patterns for a theorem "bar" defined in terms of
"\newtheoremWithMacro" are:
\begin{bar}
This is my theorem
\end{bar]
\begin{bar}[]
This is my theorem
\end{bar}
(But this is obsolete and yields the same as above!)
\begin{bar}[][Galois]
This is my theorem
\end{bar}
\begin{bar}[\macro][Galois]
This is my theorem
\end{bar}
\begin{bar}[\macro]
This is my theorem
\end{bar}
The last two variants also define "\macro" to restate the
theorem.
Restrictions
------------
A noteworthy restriction is:
"Verbatim" is broken within the body of environments that are
defined in terms of "\newtheoremWithMacro".
This is because amslatex' "\collect@body" will read ahead and
tokenize the whole stuff before catcode-changes of verbatim-
environment get into effect.
E.g., the following code does work as expected...
\newtheorem{foo}...
...
\begin{foo}
\begin{verbatim}
\TeX is funny.
\end{verbatim}
\end{foo}
...while this one does not:
\newtheoremWithMacro{bar}...
...
\begin{bar}
\begin{verbatim}
\TeX is funny.
\end{verbatim}
\end{bar}
Usage-Example:
--------------
\documentclass{article}
\usepackage{theomac}
\usepackage{hyperref}
\newtheoremWithMacro{Mytheorem}{My Theorem}[section]
\begin{document}
\section{test}
\begin{Mytheorem}[\firsttheorem][Not Galois]%
This is my first theorem.
\label{firsttheoremsfirstocurrence}%
\end{Mytheorem}
Let's restate the first theorem: \firsttheorem
\begin{Mytheorem}[][Not Galois]
This is my second theorem.
\end{Mytheorem}
\begin{Mytheorem}
This is my third theorem.
\end{Mytheorem}
Let's restate the first theorem: \firsttheorem
\newpage
\section{test}
\begin{Mytheorem}
This is my fourth theorem.
\end{Mytheorem}
Let's restate the first theorem: \firsttheorem
\begin{Mytheorem}
This is my fifth theorem.
\end{Mytheorem}
This is page-reference to the page where my first theorem
occurred the first time: \pageref{firsttheoremsfirstocurrence}%
This is reference to the number of my first theorem---the
hyperlink goes to the place where the theorem was stated
the first time: \ref{firsttheoremsfirstocurrence}%
\end{document}
%
%% End of file `theomac.sty'.
=====<end of theomac.sty>=====
At some point I defined a method for re-using a previously used
equation number:
% ----------- Reuse equation number from labeled equation --------
\newcounter{saveeqn}%
\newcommand{\reseteqn}{\setcounter{equation}{\value{saveeqn}}%
\renewcommand{\theequation}{\thechapter.\arabic{equation}}}%
\newcommand{\oldeqn}[1]{\setcounter{saveeqn}{\value{equation}}%
\renewcommand{\theequation}{\mbox{\ref{#1}}} }%
%% This lets me reuse an equation number from a labeled equation.
%% Say \oldeqn{label} before the equation environment.
%% Say \reseteqn afterward to return to default numbering.
% -----------------------------------------------------------------
I guess that there is probably a command \thetheorem that handles
the theorem number in numbered theorems. And also a counter called
"theorem".
So I would suggest modifying the above technique with appropriately
chosen names, and trying that for your theorems. You would also have
to define a modified theorem environment, perhaps something like
\newenvironment{theorem*}[1]{\begin{sloppypar}\noindent
{\bfseries Theorem: #1}
\vspace{-12pt}\begin{quote}\itshape} {\end{quote} \end{sloppypar}}
To use it,
1. label the theorem in the chapter, \label{Thm:your_label}
2. in the Appendix, say \oldthm{Thm:your_label} before
\begin{theorem*}
3. after \end{theorem*} say \resetthm
I haven't tested this, but if my guesses as to the names of the
counter and the command are correct, you should be able to make
it work.
--
Julian V. Noble
Professor Emeritus of Physics
University of Virginia
This is fantastic. Thanks!
^L
Sincerely
Ulrich