I need to write a task assignment (a paragraph ordered by enumerate) and attach a solution (possibly using hyperref technique). That's clear. But now I want the task solution to be placed at the end of the document in PDF but next to the assignment in the code.
What would be the best option to do so?
Example:
\begin{document}
\section{Tasks}
\begin{enumerate}
\item \label{Newton} How many apples fell on Newton's head?
%Here should be a code: How the hell should I know?
\item \label{Archimedes} How loud screamed Archimedes "Heureka"?
%Here should be a code: How the hell should I know?
\end{enumerate}
\section{Solutions}
%Here should be an automatically created list of previously commented content.
\end{document}
\inputat the appropriate point. Knuth did so for the answers to the exercises in The TeXbook, which are written immediately after the exercises they refer to in the source code, but are printed all together at the end of the book. – GuM Feb 15 '17 at 23:16collectpackage mentioned in How to collect text for later usage in appendix? – ebosi Feb 16 '17 at 11:11