How to have tables automatically create new lines (with header) if they have lots of columns?
up vote
1
down vote
favorite
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.
tables line-breaking columns automation
add a comment |
up vote
1
down vote
favorite
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.
tables line-breaking columns automation
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
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.
tables line-breaking columns automation
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.
tables line-breaking columns automation
tables line-breaking columns automation
asked Dec 28 '17 at 22:31
L Mascolo
676
676
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
I believe your table would become a lot more readable if you transposed it and employed a longtable
environment to typeset it.
documentclass{article}
usepackage{booktabs,siunitx,longtable}
usepackage[scr=zapfc]{mathalfa}
begin{document}
begin{longtable}{@{}
S[table-format=4.0]
S[table-format=4.0]S[table-format=3.2]
S[table-format=4.0]S[table-format=2.2] @{} }
toprule
& 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{kilogrampermetercubed}]}
& {[$10^9,si{pascal}$]}
& {[si{kilogrampermetercubed}]}
& {[$10^9,si{pascal}$]}\
midrule
endhead
bottomrule
endfoot
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 \
end{longtable}
end{document}
add a comment |
up vote
1
down vote
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
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
I believe your table would become a lot more readable if you transposed it and employed a longtable
environment to typeset it.
documentclass{article}
usepackage{booktabs,siunitx,longtable}
usepackage[scr=zapfc]{mathalfa}
begin{document}
begin{longtable}{@{}
S[table-format=4.0]
S[table-format=4.0]S[table-format=3.2]
S[table-format=4.0]S[table-format=2.2] @{} }
toprule
& 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{kilogrampermetercubed}]}
& {[$10^9,si{pascal}$]}
& {[si{kilogrampermetercubed}]}
& {[$10^9,si{pascal}$]}\
midrule
endhead
bottomrule
endfoot
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 \
end{longtable}
end{document}
add a comment |
up vote
2
down vote
I believe your table would become a lot more readable if you transposed it and employed a longtable
environment to typeset it.
documentclass{article}
usepackage{booktabs,siunitx,longtable}
usepackage[scr=zapfc]{mathalfa}
begin{document}
begin{longtable}{@{}
S[table-format=4.0]
S[table-format=4.0]S[table-format=3.2]
S[table-format=4.0]S[table-format=2.2] @{} }
toprule
& 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{kilogrampermetercubed}]}
& {[$10^9,si{pascal}$]}
& {[si{kilogrampermetercubed}]}
& {[$10^9,si{pascal}$]}\
midrule
endhead
bottomrule
endfoot
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 \
end{longtable}
end{document}
add a comment |
up vote
2
down vote
up vote
2
down vote
I believe your table would become a lot more readable if you transposed it and employed a longtable
environment to typeset it.
documentclass{article}
usepackage{booktabs,siunitx,longtable}
usepackage[scr=zapfc]{mathalfa}
begin{document}
begin{longtable}{@{}
S[table-format=4.0]
S[table-format=4.0]S[table-format=3.2]
S[table-format=4.0]S[table-format=2.2] @{} }
toprule
& 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{kilogrampermetercubed}]}
& {[$10^9,si{pascal}$]}
& {[si{kilogrampermetercubed}]}
& {[$10^9,si{pascal}$]}\
midrule
endhead
bottomrule
endfoot
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 \
end{longtable}
end{document}
I believe your table would become a lot more readable if you transposed it and employed a longtable
environment to typeset it.
documentclass{article}
usepackage{booktabs,siunitx,longtable}
usepackage[scr=zapfc]{mathalfa}
begin{document}
begin{longtable}{@{}
S[table-format=4.0]
S[table-format=4.0]S[table-format=3.2]
S[table-format=4.0]S[table-format=2.2] @{} }
toprule
& 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{kilogrampermetercubed}]}
& {[$10^9,si{pascal}$]}
& {[si{kilogrampermetercubed}]}
& {[$10^9,si{pascal}$]}\
midrule
endhead
bottomrule
endfoot
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 \
end{longtable}
end{document}
answered Oct 26 at 21:19
Mico
270k30367754
270k30367754
add a comment |
add a comment |
up vote
1
down vote
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
add a comment |
up vote
1
down vote
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
add a comment |
up vote
1
down vote
up vote
1
down vote
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).
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).
edited Dec 29 '17 at 5:02
answered Dec 29 '17 at 0:05
Kris
257
257
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
add a comment |
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
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
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
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f407976%2fhow-to-have-tables-automatically-create-new-lines-with-header-if-they-have-lot%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown