Can I introduce a special environment which will reappear at the end?
Minimal changes from my answer at Collect the input of all \TODO commands used in the document at the end. I called the stuff "cross-refs" only because that was a tag in your question. You can call it whatever you want.
MACRO VERSION See later for environment version.
\documentclass{article}
\usepackage{ifthen}
\newcounter{crossrefindex}
\setcounter{crossrefindex}{0}
\newcommand\CROSSREF[1]{%
\addtocounter{crossrefindex}{1}%
\expandafter\def\csname crossref\roman{crossrefindex}\endcsname{#1}%
#1%
}
\newcounter{index}
\newcommand\showCROSSREFs{%
\vspace{5ex}%
\rule{10ex}{.5ex}CROSS-REF LIST\rule{10ex}{.5ex}\\%
\setcounter{index}{0}%
\whiledo{\value{index} < \value{crossrefindex}}{%
\addtocounter{index}{1}%
\arabic{index}): \csname crossref\roman{index}\endcsname\\%
}%
}
\begin{document}
I start hear \CROSSREF{Fix this bug} and do some work.
Then I do thiis \CROSSREF{Get spelling fixed, too} which I have to get back
to
and then I am done
\showCROSSREFs
\end{document}
ENVIRONMENT VERSION
Unfortunately, this eats spaces after the environment, and so one must add an explicit {}
after the environment if one wants to preserve it.
\documentclass{article}
\usepackage{ifthen,environ,etoolbox}
\newcounter{crossrefindex}
\setcounter{crossrefindex}{0}
\makeatletter
\NewEnviron{CROSSREF}{%
\addtocounter{crossrefindex}{1}%
\expandafter\xdef\csname crossref\romannumeral\value{crossrefindex}\endcsname{%
\expandonce{\BODY}}%
\BODY%
}
\makeatother
\newcounter{index}
\newcommand\showCROSSREFs{%
\vspace{5ex}%
\rule{10ex}{.5ex}CROSS-REF LIST\rule{10ex}{.5ex}\\%
\setcounter{index}{0}%
\whiledo{\value{index} < \value{crossrefindex}}{%
\addtocounter{index}{1}%
\arabic{index}): \csname crossref\romannumeral\value{index}\endcsname\\%
}%
}
\begin{document}
I start hear \begin{CROSSREF}Fix this bug\end{CROSSREF}{} and do some work.
Then I do thiis \begin{CROSSREF}Get spelling fixed, too\end{CROSSREF}{} which I have to get back
to
and then I am done
\showCROSSREFs
\end{document}
Several variations are possible, but here's a start.
\documentclass{article}
\usepackage{environ}
\usepackage{lipsum} % just for the example
\newcounter{repeatatend}
\makeatletter
\def\repeat@at@end{} % initialize
\NewEnviron{important}{%
\par
\medskip
\BODY\par
\medskip
\refstepcounter{repeatatend}%
\label{repeatatend@\romannumeral\value{repeatatend}}%
\xdef\repeat@at@end{%
\unexpanded\expandafter{\repeat@at@end}%
\unexpanded{\noindent(p.~\pageref}{repeatatend@\romannumeral\value{repeatatend}}) %
\unexpanded\expandafter{\BODY\par}%
}%
}
\AtEndDocument{\section*{Important}\repeat@at@end}
\begin{document}
Here I state something very important
\begin{important}
\textbf{Lorem Ipsum Principle.} Blah blah blah.
\end{important}
\lipsum % to get to another page
Then another important thing
\begin{important}
Ducks can fly.
\end{important}
which is something to take into account.
And then I am done.
\end{document}
Here's the relevant part at page 1
Here's what happens at the end