3

I have a following problem: I need to create a multipage document, containing single table on each page. The table is same for all pages, pages differ from each other by page number only. To make the generation of the document easier, I tried to define a table and then "multiply" it with \tikz \foreach directive:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\tikz{ \foreach \x in {1,2,3}{
\begin{tabular}{||c|c|c|c|c||}
Username & Sample & Filename & Sequence & Comments \\ \hline
 & & & & \\
 & & & & \\
\end{tabular}
}}
\end{document}

However, in this case there is no tet in table and loop doesn't work at all, if \newpage is used after the table. Why does the \foreach fails to work, or may be there is more proper way making such document?

4

Please always post complete documents, not fragments.

You had only put a word space between each table so they come side by side, you want at least \par or perhaps a forced page break. Also you don't want the \tikz command as that wraps the construct in a box and prevents page breaks.

\documentclass{article}

\usepackage{tikz}

\begin{document}

\foreach \x in {1,2,3}{
\begin{tabular}{||c|c|c|c|c||}
Username & Sample & Filename & Sequence & Comments \\ \hline
 & & & & \\
 & & & & \\
\end{tabular}
\par\newpage
}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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