I'm trying to create a table dynamically by adding rows to it.
The idea is that the table has to be used/created before the rows are appended using a macro. I modified the method described here In order to use an auxiliary file so I can use the append macro after the table is created.
The code I have so far is the following:
\documentclass[12pt]{article}
\usepackage[table]{xcolor}
\usepackage[english]{babel}
\usepackage{booktabs,tabularx}
\def\tmprevisionrows{}
\def\revisionrows{}
\makeatletter
\def\appendrevision#1{\g@addto@macro\tmprevisionrows{ #1}}
\newcommand\addrevision[4]{%
\appendrevision{#1 & #2 & #3 & #4 \[10pt]}
}
\makeatother
\newcommand{\revisions}{
\begin{center}
\setlength{\extrarowheight}{10pt}
\begin{tabularx}{\textwidth}{| X | X | X | X |}
\hline
VERSION & MODIFICATION & DATE & AUTHOR \[10pt]
\hline
\revisionrows
\hline
\end{tabularx}
\end{center}
}
\begin{document}
\makeatletter
@starttoc{xyz}
\makeatother
\revisions
% Notice that we are appending after using the \revisions macro
\addrevision{0.1}{Document Creation}{01/01/2020}{Author Name}
\addrevision{0.2}{Document Modified}{02/01/2020}{Author Name}
\addtocontents{xyz}{\gdef\protect\revisionrows{\tmprevisionrows}}
\end{document}
The result is the following (As you can see no \hline on the table is added):
When I try to add an \hline anywhere I get a compilation error. How I can add an \hline (or alternative) to every row appended using my macro?

