adapt columns in multicolumn











up vote
2
down vote

favorite












I would like to change the first column into three columns, such that I can write three numbers in each row instead of only one. Everything else should stay the same.



documentclass{article} 
usepackage{tabularx}
usepackage{caption}
usepackage{showframe}

newcommand{thead}[1]{begin{tabular}[t]{c}#1end{tabular}}

begin{document}
begin{table}
centering
renewcommand{tabularxcolumn}[1]{>{centeringarraybackslash}p{#1}}
begin{tabularx}{textwidth}{|c|*4{X|}}
hline
& multicolumn{2}{c|}{thead{here a longer text is written}}
& multicolumn{2}{c|}{thead{here also a longer text is written}} \
cline{2-5}
thead{A\number} & left & right & left & right \
hline
1 & X & X & X & X\
2 & X & X & X & X\
3 & X & X & X & X\
4 & X & X & X & X\
hline
end{tabularx}
end{table}
end{document}









share|improve this question







New contributor




user4309 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    Three numbers stacked? If so, what should the alignment be with respect to the other X-columns? If they should be horizontally spread instead, do you require alignment across the rows? Do you have any restrictions/requirements in terms of the input? Perhaps you can provide an image of the expected output you're after.
    – Werner
    Nov 15 at 19:21















up vote
2
down vote

favorite












I would like to change the first column into three columns, such that I can write three numbers in each row instead of only one. Everything else should stay the same.



documentclass{article} 
usepackage{tabularx}
usepackage{caption}
usepackage{showframe}

newcommand{thead}[1]{begin{tabular}[t]{c}#1end{tabular}}

begin{document}
begin{table}
centering
renewcommand{tabularxcolumn}[1]{>{centeringarraybackslash}p{#1}}
begin{tabularx}{textwidth}{|c|*4{X|}}
hline
& multicolumn{2}{c|}{thead{here a longer text is written}}
& multicolumn{2}{c|}{thead{here also a longer text is written}} \
cline{2-5}
thead{A\number} & left & right & left & right \
hline
1 & X & X & X & X\
2 & X & X & X & X\
3 & X & X & X & X\
4 & X & X & X & X\
hline
end{tabularx}
end{table}
end{document}









share|improve this question







New contributor




user4309 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    Three numbers stacked? If so, what should the alignment be with respect to the other X-columns? If they should be horizontally spread instead, do you require alignment across the rows? Do you have any restrictions/requirements in terms of the input? Perhaps you can provide an image of the expected output you're after.
    – Werner
    Nov 15 at 19:21













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I would like to change the first column into three columns, such that I can write three numbers in each row instead of only one. Everything else should stay the same.



documentclass{article} 
usepackage{tabularx}
usepackage{caption}
usepackage{showframe}

newcommand{thead}[1]{begin{tabular}[t]{c}#1end{tabular}}

begin{document}
begin{table}
centering
renewcommand{tabularxcolumn}[1]{>{centeringarraybackslash}p{#1}}
begin{tabularx}{textwidth}{|c|*4{X|}}
hline
& multicolumn{2}{c|}{thead{here a longer text is written}}
& multicolumn{2}{c|}{thead{here also a longer text is written}} \
cline{2-5}
thead{A\number} & left & right & left & right \
hline
1 & X & X & X & X\
2 & X & X & X & X\
3 & X & X & X & X\
4 & X & X & X & X\
hline
end{tabularx}
end{table}
end{document}









share|improve this question







New contributor




user4309 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I would like to change the first column into three columns, such that I can write three numbers in each row instead of only one. Everything else should stay the same.



documentclass{article} 
usepackage{tabularx}
usepackage{caption}
usepackage{showframe}

newcommand{thead}[1]{begin{tabular}[t]{c}#1end{tabular}}

begin{document}
begin{table}
centering
renewcommand{tabularxcolumn}[1]{>{centeringarraybackslash}p{#1}}
begin{tabularx}{textwidth}{|c|*4{X|}}
hline
& multicolumn{2}{c|}{thead{here a longer text is written}}
& multicolumn{2}{c|}{thead{here also a longer text is written}} \
cline{2-5}
thead{A\number} & left & right & left & right \
hline
1 & X & X & X & X\
2 & X & X & X & X\
3 & X & X & X & X\
4 & X & X & X & X\
hline
end{tabularx}
end{table}
end{document}






tables tabularx multicolumn






share|improve this question







New contributor




user4309 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




user4309 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




user4309 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 15 at 18:15









user4309

132




132




New contributor




user4309 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user4309 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user4309 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1




    Three numbers stacked? If so, what should the alignment be with respect to the other X-columns? If they should be horizontally spread instead, do you require alignment across the rows? Do you have any restrictions/requirements in terms of the input? Perhaps you can provide an image of the expected output you're after.
    – Werner
    Nov 15 at 19:21














  • 1




    Three numbers stacked? If so, what should the alignment be with respect to the other X-columns? If they should be horizontally spread instead, do you require alignment across the rows? Do you have any restrictions/requirements in terms of the input? Perhaps you can provide an image of the expected output you're after.
    – Werner
    Nov 15 at 19:21








1




1




Three numbers stacked? If so, what should the alignment be with respect to the other X-columns? If they should be horizontally spread instead, do you require alignment across the rows? Do you have any restrictions/requirements in terms of the input? Perhaps you can provide an image of the expected output you're after.
– Werner
Nov 15 at 19:21




Three numbers stacked? If so, what should the alignment be with respect to the other X-columns? If they should be horizontally spread instead, do you require alignment across the rows? Do you have any restrictions/requirements in terms of the input? Perhaps you can provide an image of the expected output you're after.
– Werner
Nov 15 at 19:21










1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










enter image description here



documentclass{article} 
usepackage{tabularx}
usepackage{caption}
usepackage{showframe}

newcommand{thead}[1]{begin{tabular}[t]{c}#1end{tabular}}

begin{document}
begin{table}
centering
renewcommand{tabularxcolumn}[1]{>{centeringarraybackslash}p{#1}}
begin{tabularx}{textwidth}{|*{3}{c|}*{4}{X|}}
hline
multicolumn{3}{|c|}{}
&multicolumn{2}{c|}{thead{here a longer text\ is written}}
& multicolumn{2}{c|}{thead{here also a longer\ text is written}}
\
cline{4-7}
multicolumn{3}{|c|}{thead{3\numbers}} &
left & right & left & right \
hline
1&11&21 & X & X & X & X\
2&12&22 & X & X & X & X\
3&13&23 & X & X & X & X\
4&14&24 & X & X & X & X\
hline
end{tabularx}
end{table}
end{document}





share|improve this answer





















    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
    });


    }
    });






    user4309 is a new contributor. Be nice, and check out our Code of Conduct.










     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460180%2fadapt-columns-in-multicolumn%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    enter image description here



    documentclass{article} 
    usepackage{tabularx}
    usepackage{caption}
    usepackage{showframe}

    newcommand{thead}[1]{begin{tabular}[t]{c}#1end{tabular}}

    begin{document}
    begin{table}
    centering
    renewcommand{tabularxcolumn}[1]{>{centeringarraybackslash}p{#1}}
    begin{tabularx}{textwidth}{|*{3}{c|}*{4}{X|}}
    hline
    multicolumn{3}{|c|}{}
    &multicolumn{2}{c|}{thead{here a longer text\ is written}}
    & multicolumn{2}{c|}{thead{here also a longer\ text is written}}
    \
    cline{4-7}
    multicolumn{3}{|c|}{thead{3\numbers}} &
    left & right & left & right \
    hline
    1&11&21 & X & X & X & X\
    2&12&22 & X & X & X & X\
    3&13&23 & X & X & X & X\
    4&14&24 & X & X & X & X\
    hline
    end{tabularx}
    end{table}
    end{document}





    share|improve this answer

























      up vote
      1
      down vote



      accepted










      enter image description here



      documentclass{article} 
      usepackage{tabularx}
      usepackage{caption}
      usepackage{showframe}

      newcommand{thead}[1]{begin{tabular}[t]{c}#1end{tabular}}

      begin{document}
      begin{table}
      centering
      renewcommand{tabularxcolumn}[1]{>{centeringarraybackslash}p{#1}}
      begin{tabularx}{textwidth}{|*{3}{c|}*{4}{X|}}
      hline
      multicolumn{3}{|c|}{}
      &multicolumn{2}{c|}{thead{here a longer text\ is written}}
      & multicolumn{2}{c|}{thead{here also a longer\ text is written}}
      \
      cline{4-7}
      multicolumn{3}{|c|}{thead{3\numbers}} &
      left & right & left & right \
      hline
      1&11&21 & X & X & X & X\
      2&12&22 & X & X & X & X\
      3&13&23 & X & X & X & X\
      4&14&24 & X & X & X & X\
      hline
      end{tabularx}
      end{table}
      end{document}





      share|improve this answer























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        enter image description here



        documentclass{article} 
        usepackage{tabularx}
        usepackage{caption}
        usepackage{showframe}

        newcommand{thead}[1]{begin{tabular}[t]{c}#1end{tabular}}

        begin{document}
        begin{table}
        centering
        renewcommand{tabularxcolumn}[1]{>{centeringarraybackslash}p{#1}}
        begin{tabularx}{textwidth}{|*{3}{c|}*{4}{X|}}
        hline
        multicolumn{3}{|c|}{}
        &multicolumn{2}{c|}{thead{here a longer text\ is written}}
        & multicolumn{2}{c|}{thead{here also a longer\ text is written}}
        \
        cline{4-7}
        multicolumn{3}{|c|}{thead{3\numbers}} &
        left & right & left & right \
        hline
        1&11&21 & X & X & X & X\
        2&12&22 & X & X & X & X\
        3&13&23 & X & X & X & X\
        4&14&24 & X & X & X & X\
        hline
        end{tabularx}
        end{table}
        end{document}





        share|improve this answer












        enter image description here



        documentclass{article} 
        usepackage{tabularx}
        usepackage{caption}
        usepackage{showframe}

        newcommand{thead}[1]{begin{tabular}[t]{c}#1end{tabular}}

        begin{document}
        begin{table}
        centering
        renewcommand{tabularxcolumn}[1]{>{centeringarraybackslash}p{#1}}
        begin{tabularx}{textwidth}{|*{3}{c|}*{4}{X|}}
        hline
        multicolumn{3}{|c|}{}
        &multicolumn{2}{c|}{thead{here a longer text\ is written}}
        & multicolumn{2}{c|}{thead{here also a longer\ text is written}}
        \
        cline{4-7}
        multicolumn{3}{|c|}{thead{3\numbers}} &
        left & right & left & right \
        hline
        1&11&21 & X & X & X & X\
        2&12&22 & X & X & X & X\
        3&13&23 & X & X & X & X\
        4&14&24 & X & X & X & X\
        hline
        end{tabularx}
        end{table}
        end{document}






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 15 at 20:44









        David Carlisle

        477k3811061841




        477k3811061841






















            user4309 is a new contributor. Be nice, and check out our Code of Conduct.










             

            draft saved


            draft discarded


















            user4309 is a new contributor. Be nice, and check out our Code of Conduct.













            user4309 is a new contributor. Be nice, and check out our Code of Conduct.












            user4309 is a new contributor. Be nice, and check out our Code of Conduct.















             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460180%2fadapt-columns-in-multicolumn%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?

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

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents