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.



Long table with many columns










share|improve this question


























    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.



    Long table with many columns










    share|improve this question
























      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.



      Long table with many columns










      share|improve this question













      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







      tables line-breaking columns automation






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 28 '17 at 22:31









      L Mascolo

      676




      676






















          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.



          enter image description here



          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}





          share|improve this answer




























            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).






            share|improve this answer























            • 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








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "85"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            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

























            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.



            enter image description here



            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}





            share|improve this answer

























              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.



              enter image description here



              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}





              share|improve this answer























                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.



                enter image description here



                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}





                share|improve this answer












                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



                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}






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Oct 26 at 21:19









                Mico

                270k30367754




                270k30367754






















                    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).






                    share|improve this answer























                    • 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















                    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).






                    share|improve this answer























                    • 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













                    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).






                    share|improve this answer














                    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).







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    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


















                    • 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


















                    draft saved

                    draft discarded




















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    How to change which sound is reproduced for terminal bell?

                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                    Can I use Tabulator js library in my java Spring + Thymeleaf project?