I read a lot of questions and answers about this matter, each doing a little of what I was looking for, but when I tried to merge them together, the whole world collapsed...
My goal is to build a revision table at the beginnig of my document. I found Generate automatic revision's numbering tabular that do it pretty nicely. The thing is that my compagny requires the revision to be "last first" order. So using the example, when I use
\AddRevision{2017-04-28}{Initial Release}{Miraino Hikari}
\AddRevision{2017-05-02}{Modification for something}{Jo Someone}
I got this result
Revisions:
0 2017-04-28 Initial Release Miraino Hikari
1 2017-05-02 Modification after some revision Jo Someone
but what I would like is
Revisions:
1 2017-05-02 Modification after some revision Jo Someone
0 2017-04-28 Initial Release Miraino Hikari
So I found a way to revert a list here: How to invert list used for a tikz foreach loop which work again really great when you have a normal list, but not so fine when you try to build a tabular. Then I found How do I use the ampersand (&) inside a foreach or conditional (or other group/environment) when building tables? that work similarly to the Revision numbering tabular example, but again, I can't see how to revert my list.
To do some tests, I tried to use all these example to try to generate the "First-Top" and "Last-Top" example. (Names changed to keep the original working)
\let\revlist\empty
\let\revlistI\empty
\newcommand\NewAddRevTable[1]{%
\ifx\revlist\empty
\xdef\revlist{#1}%
\xdef\revlistI{#1}%
\else
\xdef\revlist{\revlist,{#1}}%
\xdef\revlistI{{#1},\revlistI}%
\fi
}
\newcommand*\MyRevisionTable{
\begin{flushleft}
\textbf{\iflanguage{french}{Révisions :}{Revisions:}}\\
\end{flushleft}
\begin{table}[H]
\begin{tabularx}{\textwidth}{llXr}
\foreach\rev in \revlist {
\rev\\
}
\end{tabularx}
\end{table}
}
\newcounter{MyRevCounter}
\newcommand{\NewRevision}[3]{
\NewAddRevTable{\arabic{MyRevCounter} & #1 & #2 & #3}
\stepcounter{MyRevCounter}
}%
\NewRevision{2017-04-28}{Version initiale}{Miraino Hikari}
\NewRevision{2017-05-02}{Modification after some revision}{Jo Someone}
this code of course, doesn't work (except if I escape the & and that I remove the tabularx environment). But changing the revlist for revlistI do exactly what I was looking for (except it's not in a table)
and I suspect that the magic in the original revision code happen here
\newcommand\AddNewRevTableTokens[1]{\global\@myrevtabtoks\expandafter{\the\@myrevtabtoks#1}}
\newcommand\eAddNewRevTableTokens[1]{%
\protected@edef\NewRevTkTable{#1}%
\expandafter\AddNewRevTableTokens\expandafter{\NewRevTkTable}%
}
but for this I tried
\newcommand\AddNewRevTableTokens[1]{\global\@myrevtabtoks\expandafter{\the\@myrevtabtoks#1}}
\newcommand\eAddNewRevTableTokens[1]{%
\expandafter\AddNewRevTableTokens\expandafter{\NewRevTkTable}%
\protected@edef\NewRevTkTable{#1}%
}
which just don't care about any extra revision, and this
\newcommand\AddNewRevTableTokens[1]{\global\@myrevtabtoks\expandafter{#1\the\@myrevtabtoks}}
\newcommand\eAddNewRevTableTokens[1]{%
\protected@edef\NewRevTkTable{#1}%
\expandafter\AddNewRevTableTokens\expandafter{\NewRevTkTable}%
}
That just don't compile with an error that says
TeX capacity exceeded, sorry [input stack size=5000]. \MyRevisionTable
So I need help. Thanks in advance.



Not at all already works fine,
Only last works fine as well,
N to 0 is my pain.
But all of these must be generated by the same command if I don't want a puzzle each time someone generate from the class template
– Miraino Hikari May 03 '17 at 16:19