# [OS X TeX] LaTeX question

Roberto Avanzi roberto.avanzi at gmail.com
Tue Jun 17 11:39:19 EDT 2008

Hi all.

I have following question which is more or less OT because it is not
TeX-on-OS-X-related.  I would like to "dump" a _copy_ of some text -
in particular numbered environments - to an external file, which I
can later include in my LaTeX source, but it must be an expanded
version of the text.

The idea is that at the end of some course notes I have a list of all
theorems in their original form, with the corresponding original
numberings. I.e., if there is a theorem in the main body given by

\begin{theorem}
The sum of $1$ and $2$ is given by
$$\label{eq:three} 3 \enspace.$$
\end{theorem}

and typeset as

Theorem 2.1. The sum of 1 and 2 is given by
3.                   (5)

I would like the same text to be dumped to an auxiliary file so that
I can include it at the end of the course notes. So I would again the
same text at the end of the book.

Of course, If I have this mechanism, I can also decide to expand the
body of the theorem separately by redefining the environment, and
thus I could output

Theorem 2.1 on page 715.  The sum of 1 and 2
is given by
3.                   (5)

Does anybody know how to do it?

best
Roberto