What I'm trying to do sounds quite simple:
\begin{thm}
Theorem 1 text.
\end{thm}
...
\begin{thm}
Theorem 2 text.
\end{thm}
...
\RepeaAllThms
This should display the theorems as it usually does, but then \RepeaAllThms should redisplay them all in one place.
I thought I'd make an environment that increases some counter, creates a name depending on it (say, thmA, thmB,...), use it as a restatable name, and collect all of those for \RepeaAllThms. For some reason, I cannot get it to work. Here is my MNWE (minimal NOT working example), with theorems actually being called "recommendations":
\documentclass[a4paper]{article}
\usepackage{thmtools}
\usepackage{thm-restate}
\usepackage{etoolbox}
\makeatletter
\def\recommend@tions{}
\newcounter{recommend@cnt}
\declaretheorem[name=Recommendation,numberwithin=section]{thmrecommend}
\newenvironment{recommendation}{%
\stepcounter{recommend@cnt}%
\edef\rcmdname{recommend\Alph{recommend@cnt}}%
\restatable{thmrecommend}{\rcmdname}%
}{\endrestatable%
%\xappto\recommend@tions{recommend\Alph{recommend@cnt}}%
recommend\Alph{recommend@cnt}%
%\csname recommend\Alph{recommend@cnt}* \endcsname%
\recommendA*
}
\newcommand{\allrecommendations}{\recommend@tions}
\makeatother
\begin{document}
\section{Originals}
Some text.
\begin{recommendation}
This is the first recommendation.
\end{recommendation}
Some text.
\begin{recommendation}
This is the second recommendation.
\end{recommendation}
Some text.
\section{All together}
%\allrecommendations
%\recommendA*
%\recommendB*
\end{document}
I have added \recommendA* at the end of my environment to check that it works, and it is always redefined as the last theorem. Uncommenting \recommendA* or \recommendB* causes errors that I do not understand.
Any idea how to do this? It doesn't have to be with restatable. Any approach letting me automatically repeat the contents of the theorems would be OK.


