Sign up ×
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.

Possible Duplicate:
Copy table row n times

The code below is intended to produce a table with 3 columns and 3 rows (one heading and two empty rows) but it can be seen that it doesn't work.


  \def\emptyrow{ & & \\ \hline}
    A & B & C \\
    %% the following 2 lines create 2 empty rows
    %% \emptyrow
    %% \emptyrow
    %% the following loop doesn't work
    \loop\relax\ifnum\rows<#1 \emptyrow\advance\rows by1\repeat


produces enter image description here instead of enter image description here

Why does it not work?

share|improve this question

marked as duplicate by Ryan Reich, Werner, barbara beeton, Thorsten, Guido Dec 31 '12 at 17:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

You can't start a \loop in a cell and end it in another, because table cells form groups. There are other examples in the site: 1; 2 – egreg Dec 31 '12 at 15:31

1 Answer 1

While egreg's comment applies, you can make your automation idea work via pgfplotstable package. Here is a simple example


create on use/new1/.style={},
create on use/new2/.style={},
create on use/new3/.style={}
string type,
columns/new1/.style={column name=A},
columns/new2/.style={column name=B},
columns/new3/.style={column name=C,column type/.add={}{|}},
before row=\hline,
every last row/.style={after row=\hline},
column type/.add={|}{}%



enter image description here

share|improve this answer

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