# Generate table with dynamic number of columns

Is it possible to create a table with with a dynamic number of columns that depend on some given width, e.g., \textwidth? For example, given a fixed-width table t with size(t) <= 0.5\textwidth that has three columns and looks as follows,

A & B & C \\
D & E & F \\
G & H & I \\
J & K & L \\


I am asking if it is possible to translate it dynamically into something like:

A & B & C  &  G & H & I \\
D & E & F  &  J & K & L \\

-
That seems awfully confusing to the reader. – You May 11 '11 at 9:29

eplain has something that's somewhat similar to what you want.

\input eplain

\makecolumns 12/6:
A
B
C
D
E
F
G
H
I
J
K
L
It's not quite what you want.
\bye


memoir has something similar.

\documentclass{memoir}
\begin{document}
\autorows{c}{6}{l}{
A, B, C, D, E, F, G, H, I, J, K, L%
}
\end{document}


-
Thanks, the memoir package offers the right tools to solve this issue. – Matthias Vallentin May 11 '11 at 23:11