I need to gather things that will be presented at the end of the document, as shown bellow
\documentclass{article}
\usepackage{collect}
\definecollection{somethings}
\newcommand{\collectthing}[1]{
There is a #1 here!
\begin{collect}{somethings}{}{}{}{}
\noindent #1 collected in section \arabic{section}
\end{collect}
}
\begin{document}
\section{Section A}
\collectthing{ThingA}
\section{Section B}
\collectthing{ThingB}
\section*{Things collected}
\includecollection{somethings}
\end{document}
However, since the command \collectthing
is expanded only when I call the command \includecollection
, all sections are shown with the same value they share when they are expanded, as it can see in the result bellow
How do I fix it, so it shows the proper section number at the end?