I was wondering how to instruct latex to automatically break a table after x columns and create a new line with the same header but with subsequent rows. I attach a picture to make it clearer (I did that manually, I was wondering if that is possible automatically).

First question, sorry for any mistake/not precise content.

Long table with many columns


I believe your table would become a lot more readable if you transposed it and employed a longtable environment to typeset it.

enter image description here

       S[table-format=4.0]S[table-format=2.2] @{} }

 & \multicolumn{2}{c}{\textsc{Cu}}
 & \multicolumn{2}{c@{}}{\textsc{Al}}\\
\cmidrule(lr){2-3} \cmidrule(l){4-5}
{Temperature} & {$\varrho$} & {$\mathscr{E}$}
              & {$\varrho$} & {$\mathscr{E}$}\\
{[\si{\kelvin}]}  & {[\si{\kilo\gram\per\meter\cubed}]}
                  & {[$10^9\,\si{\pascal}$]}
                  & {[\si{\kilo\gram\per\meter\cubed}]}
                  & {[$10^9\,\si{\pascal}$]}\\


   0 & 9028 & 137.0 & & 76.6 \\
  10 & 9028 & 137.0 & & 76.59\\
{$\vdots$} & {$\vdots$} & {$\vdots$} & & {$\vdots$}\\
 750 & 8718 & 98.30 & & 39.49 \\
{$\vdots$} & {$\vdots$} & {$\vdots$} \\
1250 & 8444 & 61.86 \\  

I might suggest looking at your "rows" as "vertical columns" in 90deg rotated table with text rotated upright. Maybe using this perspective, you could define an environment that takes your new vertical columns and number "x" (as you described in your question) as parameters. The environment would then have a counter that resets when reaching x and would place a new table each time. Your "header row(s)" would be element (multicol) with your other two "rows". And table name above each table.

I'm pretty new to latex but I'm sure someone could code this approach for you (or come up with a much better solution).

  • To be honest I would do this in C++ or any language you are familiar with. Generate latex from a csv file (even let your code do the math and round with correct significant figures if you like). I think that would be the most readable solution (and easy to add/change tables later). – Kris Dec 29 '17 at 5:16

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.