\documentclass{article}%cannot be minimal
\usepackage{longtable}
\usepackage{ifthen, xspace}
\newcounter{xyz}
\setcounter{xyz}{1}
\def\and{&\xspace}
\begin{document}
\begin{longtable}{|*2{c|}}\hline
\whiledo{\value{xyz}<6}%
{\thexyz \and something\stepcounter{xyz} \\\hline}
\end{longtable}
\end{document}
Tables Loops – How to Get Rid of Excessive Rules
loopstables
Best Answer
This also removes the last two vertical lines:
It's funny that these lines appear if I take
\\\hline
out of this\ifthenelse
, similar if I put\end{longtable}
after that (even with%
before the line break). And, actually, I don't like ending an environment within a loop construction.