# Repeat entire table

Is there a method to repeat an entire table? I've defined a custom table format using xparse and I have potentially ~50 of these custom tables. I would like to create an appendix of the tables, including all content. I don't want to duplicate the content as it's changing frequently

EDIT: One solution is to use a separate file and include it multiple times. This is not a great solution as some of my "tables" are really only 2-3 rows long, and I have a large number of them anyway (e.g. ~50 separate include files would be much harder to work with than the current inline tables)

What about using filecontents package? This method essentially creates separate file but is much easier to handle. Check the example:

\documentclass{article}
\usepackage{filecontents}

\begin{document}
\begin{filecontents}{mytable.tex}
\begin{center}
\begin{tabular}{l*{6}{c}r}
Team              & P & W & D & L & F  & A & Pts \\
\hline
Manchester United & 6 & 4 & 0 & 2 & 10 & 5 & 12  \\
Celtic            & 6 & 3 & 0 & 3 &  8 & 9 &  9  \\
Benfica           & 6 & 2 & 1 & 3 &  7 & 8 &  7  \\
FC Copenhagen     & 6 & 2 & 1 & 3 &  5 & 8 &  7  \\
\end{tabular}
\end{center}
\end{filecontents}

\input{mytable.tex}

\input{mytable.tex}

\input{mytable.tex}

\input{mytable.tex}

\end{document}


and its result:

Of course, you can combine this package with other ones, such as ltxtable, to enhance the result, as suggested by the package document.

Tabular example taken from LaTeX wikibook.

• This looks perfect!! I have to wait until I'm home to try it out – Hamy Jul 30 '13 at 16:14

You can use the collect package; define a collection using \definecollection{<name>} and then wrap your tables using the collect* environment; then simply include your collection in the appendix using \includecollection{<name>}; a little example:

\documentclass{article}
\usepackage{booktabs}
\usepackage{collect}

\definecollection{mytables}

\begin{document}

\section{Test section}

\begin{collect*}{mytables}{}{\par\bigskip}{}{}
\noindent\begin{tabular}{*{3}{l}}
\toprule
\midrule
column1a & column2a & column 3a \\
column1b & column2b & column 3b \\
column1c & column2c & column 3c \\
\bottomrule
\end{tabular}
\end{collect*}

\begin{collect*}{mytables}{}{\par\bigskip}{}{}
\noindent\begin{tabular}{*{2}{l}}
\toprule
\midrule
column1a & column2a \\
column1b & column2b \\
column1c & column2c \\
column1d & column2d \\
\bottomrule
\end{tabular}
\end{collect*}

\section{Appendix}
\includecollection{mytables}

\end{document}