Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.


I have to make a cover template for a document. At the end of the page, I have to add the revision number with other useful info like this example:

    Revision 0 & 06-11-2014 & Initial Release & John Smith \\
    Revision 1 & 06-12-2014 & Changed something & Joe Blow \\


In the TEX document, the user would have to add their revision like this:

\AddRevision{06-11-2014}{Initial Release}{John Smith}
\AddRevision{06-12-2014}{Changed something}{Joe Blow}

When generating the PDF, this should automatically generate the tabular above. Note that the revision's number is automatically increase by 1 at each AddRevision.

What I have tried

I'm not familiar with Latex macros, so this is what I have for the moment. I just don't know if I'm close to the solution or if I'm doing totally wrong. Here's the code in my CLS file:

\def\AddRev#1,#2,#3{\RevDate{#1}, \RevDesc{#2}, \RevAuthor{#3} \stepCounter{RowCounter}}

    \forloop{i}{0}{\value{i} < \value{RowCounter}}
        Revision \arabic{i} & \RevDate & \RevDesc & \RevAuthor \\

   % some stuff


Is my objective possible ? If yes, What am I doing wrong ? What's the best and clean solution ? Any suggestions are welcome.

Thanks a lot for your help.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Here is one way:

enter image description here


I would recommend you put everything prior to the first \AddRevision in a separate package and have the users add the revisions before \begin{document}.




%% http://tex.stackexchange.com/questions/175568/build-tabular-content-via-foreach
    %%% assignments to \@tabtoks must be global, because they are done in \foreach
    %%% variable should always be operated on always locally or always globally

    \eAddTableTokens{Revision \arabic{RowCounter} & #1 & #2 & #3 \\}%

   % some stuff



\AddRevision{06-11-2014}{Initial Release}{John Smith}
\AddRevision{06-12-2014}{Changed something}{Joe Blow}


     main document here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.