3

I have a two column table that is rather "thin" on the page and leaves a lot of blank space. I wish to grow it sideways by limiting the maximum number of rows it produces.

Let us say I have a 12x2 table. I want to reduce the height of this table and end up with a maximum number of rows limited to 6. That should produce a 6x4 table, with columns 1 & 2 for the first six entries in the original table, and columns 3 & 4 for entires 7-12. The "data type" in columns 1 & 3 is the same. Ditto for columns 2 & 4.

For instance:

Num1 & 1\\
Num2 & 2\\
Num3 & 3\\
Num4 & 4\\
Num5 & 5\\
Num6 & 6\\
Num7 & 7\\
Num8 & 8\\
Num9 & 9\\
Num10 & 10\\
Num11 & 11\\
Num12 & 12\\

Becomes (in terms of markdown):

Num1 | 1 || Num7  | 7
Num2 | 2 || Num8  | 8
Num3 | 3 || Num9  | 9
Num4 | 4 || Num10 | 10
Num5 | 5 || Num11 | 11
Num6 | 6 || Num12 | 12

How would one do it? I have not found any table environment that does this out of the box. So, we need a \newenvironment or something like that.

Extensions - what if I want to limit the number of rows to 4? Then I should have a 4x6 table with three sets of columns instead of 2 above.

user2751530
  • 1,102

1 Answers1

1

Depending on how much manual intervention you are allowing yourself, this could suffice: just insert the newly defined \breaktable wherever you want a column break.

\documentclass{article}
\def\breaktable{\end{tabular} \begin{tabular}{|c|c|}}
\begin{document}
\centering
\begin{tabular}{|c|c|}
Num1 & 1\\
Num2 & 2\\
Num3 & 3\\
Num4 & 4\\
Num5 & 5\\
Num6 & 6\\
\breaktable
Num7 & 7\\
Num8 & 8\\
Num9 & 9\\
Num10 & 10\\
Num11 & 11\\
Num12 & 12\\
\end{tabular}

\bigskip
\begin{tabular}{|c|c|}
Num1 & 1\\
Num2 & 2\\
Num3 & 3\\
Num4 & 4\\
\breaktable
Num5 & 5\\
Num6 & 6\\
Num7 & 7\\
Num8 & 8\\
\breaktable
Num9 & 9\\
Num10 & 10\\
Num11 & 11\\
Num12 & 12\\
\end{tabular}
\end{document}

enter image description here