# command/enviroment that writes argument in predefined extra section

I am working on a script and I would like to put some proofs in an extra section. But, for editing, I would like to place the proof right after the proposition. So, I would like some kind of command that sends the input in a predefined section (For example: appends the input to the end of the section)

I have in mind something like this:

This code

\section{section}
Hello
\sendtoOtherSection{World}

\section{other section}
Nothing here


produces:

1 section

Hello

2 other section

Nothing here

World

Like the title of this question says, I don't care if \sendtoOtherSection is a command or environment. It is not very important in which order the shifted text appears.

-
Will the "other section" always be after the "section"? (Because well, moving some data forward is much easier than backward.) –  tohecz Mar 20 '12 at 22:04
Have a look at a-theorem-and-its-proof-in-different-places/45332#45332 and see it helps- on first glance, I think it's a duplicate, if not, please say so –  cmhughes Mar 20 '12 at 22:16
@cmhughes Thank you. This was quite helpful. So my question is a duplicate but I think the given answer is new (Peter Grill). –  bitt.j Mar 21 '12 at 18:10

Since you want to just move the text forward, you could adapt the answer from How keep a running list of strings and then process them one at a time to keep building up these sections that need to appear later. Then when you want them to appear you just make a call to \OtherSection, and the code accumulated is typeset there:

\documentclass{article}

\def\OtherSection{}
\makeatletter
\newcommand{\sendtoOtherSection}[1]{%
}
\makeatother

\begin{document}
\section{Section One}
\par\noindent
Hello. Hello.
\sendtoOtherSection{Is there anybody out there?}

\section{Section Two}
Goodbye Cruel World.
\sendtoOtherSection{I'm leaving you today.}

\section{Other Section}
\OtherSection
\end{document}

-