# Is there an “endproof” package?

You may be familiar with the endfloat package, which moves all figures and tables to the end of your document.

Is there a similar package for achieving that kind of results with proof environments (as defined in the amsthm package)? For instance, the following chunk:

Theorem 1: some wonderful statement.

Proof: some astonishing proof.

would appear (when the package is used) in the text as:

Theorem 1: some wonderful statement.

Proof: see page P.

and then page P would contain something like:

Proof of Theorem 1 page XXX: some astonishing proof.

-
Have a look at thrmappendix. I'm not sure it does exactly what you want, I believe it's pretty close though. – Roelof Spijker Nov 18 '11 at 9:21
@wh1t3: indeed, thrmappendix comes quite close. Thanks! – Anthony Labarre Dec 16 '11 at 7:27

## 1 Answer

You can try with the code shown in this answer but changing the definition of \proofatend with

\long\def\proofatend#1\endproofatend{%
\proof See page \pageref{pr\pat@label}.\endproof
\edef\next{\noexpand\begin{proof}[Proof of \pat@label]\noexpand\label{pr\pat@label}}%
\toks\numexpr\prooftoks+\value{proofcount}\relax=\expandafter{\next#1\end{proof}}
\stepcounter{proofcount}}


This will put Proof. See page nnn. after the statement.

If you prefer to write proofs in environment form, then load also the environ package and write, instead of the definition of \proofatend before the following:

\NewEnviron{proofatend}
{\proof See page \pageref{pr\pat@label}.\endproof
\edef\next{\noexpand\begin{proof}[Proof of \pat@label]\noexpand\label{pr\pat@label}}%
\toks@=\expandafter{\next}%
\global\toks\numexpr\prooftoks+\value{proofcount}\relax=
\expandafter{\the\expandafter\toks@\BODY\end{proof}}%
\stepcounter{proofcount}}


Then you may write your proofs as

\begin{lem}\label{addition}
$1+1=2$
\end{lem}
\begin{proofatend}
It's quite clear.

Here's a paragraph break.
\end{proofatend}

-
Can I ask a silly question: why (in your original answer) do you use tokens, instead of writing to/reading from a file? – Steve D Nov 18 '11 at 11:33
@SteveD Reading to a file is sometimes a pain; while it was necessary in the olden days, now we have huge memory and plenty of token registers to play with. – egreg Nov 18 '11 at 11:43