Multicolumn (Tables) trouble












2














I am trying to get my table working for last couple of days. But I couldnt fix the problem. The way I want my table to look like is below (figure 1).



enter image description here



With my following code



begin{table}[p]
begin{tabular}{ccccccccc}
hline
Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
feedstock & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} \ hline
Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 4 & multicolumn{2}{c}{1} & multicolumn{2}{c}{2} & multicolumn{2}{c}{3} & multicolumn{2}{c}{4} \ hline
multicolumn{9}{l}{Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah} \ hline
end{tabular} end{table}


I am getting (figure 2):
enter image description here



I tried using tabularx and defined the size of each column. It worked until I added last long row (which is a merged form of all 9 columns). Also the the header "B" and last coulmn (figure 1) is going out of the page in figure 2.



It would be nice if someone can help me. Also, detailed explanation of the solution would be appreciated.



Thanks in advance.










share|improve this question




















  • 2




    By using the l column type for the super-long word, you’ve disabled automatic line-breaking. Even if you chose a different column type, i.e., a column type that allows line breaking, how is LaTeX even supposed to decide how and where to insert line breaks in the super-long word?
    – Mico
    yesterday












  • Thanks, @Mico for your replay. I changed now a long word with a bunch of "Blah Blah"s (so latex should know where to break the line) and also changed column type from l to c. However, the problem isn't solved. Definitely, I am doing something wrong.
    – pukumarathe
    yesterday






  • 2




    The c, l, and r column types do no allow line breaking.
    – Mico
    yesterday






  • 2




    we need to know your page layout and desired width of table. ...
    – Zarko
    yesterday
















2














I am trying to get my table working for last couple of days. But I couldnt fix the problem. The way I want my table to look like is below (figure 1).



enter image description here



With my following code



begin{table}[p]
begin{tabular}{ccccccccc}
hline
Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
feedstock & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} \ hline
Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 4 & multicolumn{2}{c}{1} & multicolumn{2}{c}{2} & multicolumn{2}{c}{3} & multicolumn{2}{c}{4} \ hline
multicolumn{9}{l}{Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah} \ hline
end{tabular} end{table}


I am getting (figure 2):
enter image description here



I tried using tabularx and defined the size of each column. It worked until I added last long row (which is a merged form of all 9 columns). Also the the header "B" and last coulmn (figure 1) is going out of the page in figure 2.



It would be nice if someone can help me. Also, detailed explanation of the solution would be appreciated.



Thanks in advance.










share|improve this question




















  • 2




    By using the l column type for the super-long word, you’ve disabled automatic line-breaking. Even if you chose a different column type, i.e., a column type that allows line breaking, how is LaTeX even supposed to decide how and where to insert line breaks in the super-long word?
    – Mico
    yesterday












  • Thanks, @Mico for your replay. I changed now a long word with a bunch of "Blah Blah"s (so latex should know where to break the line) and also changed column type from l to c. However, the problem isn't solved. Definitely, I am doing something wrong.
    – pukumarathe
    yesterday






  • 2




    The c, l, and r column types do no allow line breaking.
    – Mico
    yesterday






  • 2




    we need to know your page layout and desired width of table. ...
    – Zarko
    yesterday














2












2








2


0





I am trying to get my table working for last couple of days. But I couldnt fix the problem. The way I want my table to look like is below (figure 1).



enter image description here



With my following code



begin{table}[p]
begin{tabular}{ccccccccc}
hline
Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
feedstock & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} \ hline
Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 4 & multicolumn{2}{c}{1} & multicolumn{2}{c}{2} & multicolumn{2}{c}{3} & multicolumn{2}{c}{4} \ hline
multicolumn{9}{l}{Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah} \ hline
end{tabular} end{table}


I am getting (figure 2):
enter image description here



I tried using tabularx and defined the size of each column. It worked until I added last long row (which is a merged form of all 9 columns). Also the the header "B" and last coulmn (figure 1) is going out of the page in figure 2.



It would be nice if someone can help me. Also, detailed explanation of the solution would be appreciated.



Thanks in advance.










share|improve this question















I am trying to get my table working for last couple of days. But I couldnt fix the problem. The way I want my table to look like is below (figure 1).



enter image description here



With my following code



begin{table}[p]
begin{tabular}{ccccccccc}
hline
Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
feedstock & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} \ hline
Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 4 & multicolumn{2}{c}{1} & multicolumn{2}{c}{2} & multicolumn{2}{c}{3} & multicolumn{2}{c}{4} \ hline
multicolumn{9}{l}{Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah} \ hline
end{tabular} end{table}


I am getting (figure 2):
enter image description here



I tried using tabularx and defined the size of each column. It worked until I added last long row (which is a merged form of all 9 columns). Also the the header "B" and last coulmn (figure 1) is going out of the page in figure 2.



It would be nice if someone can help me. Also, detailed explanation of the solution would be appreciated.



Thanks in advance.







tables tabularx wrap






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday









Mico

274k30371757




274k30371757










asked yesterday









pukumarathe

526




526








  • 2




    By using the l column type for the super-long word, you’ve disabled automatic line-breaking. Even if you chose a different column type, i.e., a column type that allows line breaking, how is LaTeX even supposed to decide how and where to insert line breaks in the super-long word?
    – Mico
    yesterday












  • Thanks, @Mico for your replay. I changed now a long word with a bunch of "Blah Blah"s (so latex should know where to break the line) and also changed column type from l to c. However, the problem isn't solved. Definitely, I am doing something wrong.
    – pukumarathe
    yesterday






  • 2




    The c, l, and r column types do no allow line breaking.
    – Mico
    yesterday






  • 2




    we need to know your page layout and desired width of table. ...
    – Zarko
    yesterday














  • 2




    By using the l column type for the super-long word, you’ve disabled automatic line-breaking. Even if you chose a different column type, i.e., a column type that allows line breaking, how is LaTeX even supposed to decide how and where to insert line breaks in the super-long word?
    – Mico
    yesterday












  • Thanks, @Mico for your replay. I changed now a long word with a bunch of "Blah Blah"s (so latex should know where to break the line) and also changed column type from l to c. However, the problem isn't solved. Definitely, I am doing something wrong.
    – pukumarathe
    yesterday






  • 2




    The c, l, and r column types do no allow line breaking.
    – Mico
    yesterday






  • 2




    we need to know your page layout and desired width of table. ...
    – Zarko
    yesterday








2




2




By using the l column type for the super-long word, you’ve disabled automatic line-breaking. Even if you chose a different column type, i.e., a column type that allows line breaking, how is LaTeX even supposed to decide how and where to insert line breaks in the super-long word?
– Mico
yesterday






By using the l column type for the super-long word, you’ve disabled automatic line-breaking. Even if you chose a different column type, i.e., a column type that allows line breaking, how is LaTeX even supposed to decide how and where to insert line breaks in the super-long word?
– Mico
yesterday














Thanks, @Mico for your replay. I changed now a long word with a bunch of "Blah Blah"s (so latex should know where to break the line) and also changed column type from l to c. However, the problem isn't solved. Definitely, I am doing something wrong.
– pukumarathe
yesterday




Thanks, @Mico for your replay. I changed now a long word with a bunch of "Blah Blah"s (so latex should know where to break the line) and also changed column type from l to c. However, the problem isn't solved. Definitely, I am doing something wrong.
– pukumarathe
yesterday




2




2




The c, l, and r column types do no allow line breaking.
– Mico
yesterday




The c, l, and r column types do no allow line breaking.
– Mico
yesterday




2




2




we need to know your page layout and desired width of table. ...
– Zarko
yesterday




we need to know your page layout and desired width of table. ...
– Zarko
yesterday










3 Answers
3






active

oldest

votes


















5














As far as I can tell, the "Blah Blah ..." material is only indirectly related to the preceding, table-like material. Is the "Blah Blah" material maybe some kind of legend? If this guess is correct, you'd be better off not placing it inside the tabular environment. Instead, I suggest you load the threeparttable package and place the legend in a tablenotes environment, which (thanks to the behind-the-scenes work of the threeparttable environment) will automatically be as wide as the preceding tabular environment.



In case you're curious about the name threeparttable of the package: It can handle three types of elements: The table caption (which is absent in the case of your code), the tabular-like material, and the tablenotes material. The package works, though, even if there is no caption.



enter image description here



documentclass{article}
usepackage[flushleft]{threeparttable}
begin{document}
begin{table}
centering
begin{threeparttable}
begin{tabular}{@{} l *{8}{c} @{}}
hline
Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
feedstock & multicolumn{2}{c}{C} & multicolumn{2}{c}{B}
& multicolumn{2}{c}{C} & multicolumn{2}{c}{B} \
hline
Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 4 & multicolumn{2}{c}{1} & multicolumn{2}{c}{2}
& multicolumn{2}{c}{3} & multicolumn{2}{c}{4} \
hline
end{tabular}

smallskip
begin{tablenotes}
itemNotes: Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
end{tablenotes}
end{threeparttable}
end{table}
end{document}





share|improve this answer























  • Thanks a lot @Mico ! I really liked this arrangement of having tablenotes. It precisely solved my problem. :)
    – pukumarathe
    yesterday





















4














since you tag your question with tabularx i suggest to use this package. beside it more nice result you will obtain by use of the booktabs package for horizontal rules:



documentclass{article}
usepackage{booktabs, tabularx}
newcolumntype{C}{>{centeringarraybackslash}X}
newcommandmcc[1]{multicolumn{2}{c}{#1}}

%---------------- show page layout. don't use in a real document!
usepackage{showframe}
renewcommandShowFrameLinethickness{0.15pt}
renewcommand*ShowFrameColor{color{red}}
%---------------------------------------------------------------%

begin{document}
begin{table}[p]
begin{tabularx}{linewidth}{@{} c *{8}{C} @{}}
toprule
Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
cmidrule(lr){2-5}cmidrule(l){6-9}
AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
cmidrule(lr){2-3}cmidrule(lr){4-5}
cmidrule(lr){6-7}cmidrule(lr){8-9}
feedstock & mcc{C} & mcc{B} & mcc{C} & mcc{B} \
midrule
Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
Par 4 & mcc{1} & mcc{2} & mcc{3} & mcc{4} \
midrule
multicolumn{9}{@{} p{linewidth} @{}}{Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah} \
bottomrule
end{tabularx}
end{table}
end{document}


enter image description here



(red lines indicate text border)






share|improve this answer































    1














    You can add width argument to your columns, like multicolumn{9}{p{linewidth}}. Perhaps multicolumn{9}{p{.7linewidth}} will do even better. Addding this to your example produces the following outputhttps://imgur.com/WcNyPXb



    Here is the complete code of mwe



    documentclass{article}
    begin{document}
    begin{table}[p]
    begin{tabular}{ccccccccc}
    hline
    Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
    AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
    feedstock & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} \ hline
    Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 4 & multicolumn{2}{c}{1} & multicolumn{2}{c}{2} & multicolumn{2}{c}{3} & multicolumn{2}{c}{4} \ hline
    multicolumn{9}{p{linewidth}}{Blah Blah Blah Blah Blah Blah Blah Blah Blah
    Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah} \ hline
    end{tabular} end{table}
    end{document}





    share|improve this answer










    New contributor




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














    • 1




      Your solution has the (presumably unintended) side-effect of making the final column very wide indeed in case the combined width of the 9 columns is less than linewidth. Can you think of a way of avoiding this issue?
      – Mico
      yesterday











    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',
    autoActivateHeartbeat: false,
    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%2f468732%2fmulticolumn-tables-trouble%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    5














    As far as I can tell, the "Blah Blah ..." material is only indirectly related to the preceding, table-like material. Is the "Blah Blah" material maybe some kind of legend? If this guess is correct, you'd be better off not placing it inside the tabular environment. Instead, I suggest you load the threeparttable package and place the legend in a tablenotes environment, which (thanks to the behind-the-scenes work of the threeparttable environment) will automatically be as wide as the preceding tabular environment.



    In case you're curious about the name threeparttable of the package: It can handle three types of elements: The table caption (which is absent in the case of your code), the tabular-like material, and the tablenotes material. The package works, though, even if there is no caption.



    enter image description here



    documentclass{article}
    usepackage[flushleft]{threeparttable}
    begin{document}
    begin{table}
    centering
    begin{threeparttable}
    begin{tabular}{@{} l *{8}{c} @{}}
    hline
    Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
    AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
    feedstock & multicolumn{2}{c}{C} & multicolumn{2}{c}{B}
    & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} \
    hline
    Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 4 & multicolumn{2}{c}{1} & multicolumn{2}{c}{2}
    & multicolumn{2}{c}{3} & multicolumn{2}{c}{4} \
    hline
    end{tabular}

    smallskip
    begin{tablenotes}
    itemNotes: Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
    end{tablenotes}
    end{threeparttable}
    end{table}
    end{document}





    share|improve this answer























    • Thanks a lot @Mico ! I really liked this arrangement of having tablenotes. It precisely solved my problem. :)
      – pukumarathe
      yesterday


















    5














    As far as I can tell, the "Blah Blah ..." material is only indirectly related to the preceding, table-like material. Is the "Blah Blah" material maybe some kind of legend? If this guess is correct, you'd be better off not placing it inside the tabular environment. Instead, I suggest you load the threeparttable package and place the legend in a tablenotes environment, which (thanks to the behind-the-scenes work of the threeparttable environment) will automatically be as wide as the preceding tabular environment.



    In case you're curious about the name threeparttable of the package: It can handle three types of elements: The table caption (which is absent in the case of your code), the tabular-like material, and the tablenotes material. The package works, though, even if there is no caption.



    enter image description here



    documentclass{article}
    usepackage[flushleft]{threeparttable}
    begin{document}
    begin{table}
    centering
    begin{threeparttable}
    begin{tabular}{@{} l *{8}{c} @{}}
    hline
    Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
    AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
    feedstock & multicolumn{2}{c}{C} & multicolumn{2}{c}{B}
    & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} \
    hline
    Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 4 & multicolumn{2}{c}{1} & multicolumn{2}{c}{2}
    & multicolumn{2}{c}{3} & multicolumn{2}{c}{4} \
    hline
    end{tabular}

    smallskip
    begin{tablenotes}
    itemNotes: Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
    end{tablenotes}
    end{threeparttable}
    end{table}
    end{document}





    share|improve this answer























    • Thanks a lot @Mico ! I really liked this arrangement of having tablenotes. It precisely solved my problem. :)
      – pukumarathe
      yesterday
















    5












    5








    5






    As far as I can tell, the "Blah Blah ..." material is only indirectly related to the preceding, table-like material. Is the "Blah Blah" material maybe some kind of legend? If this guess is correct, you'd be better off not placing it inside the tabular environment. Instead, I suggest you load the threeparttable package and place the legend in a tablenotes environment, which (thanks to the behind-the-scenes work of the threeparttable environment) will automatically be as wide as the preceding tabular environment.



    In case you're curious about the name threeparttable of the package: It can handle three types of elements: The table caption (which is absent in the case of your code), the tabular-like material, and the tablenotes material. The package works, though, even if there is no caption.



    enter image description here



    documentclass{article}
    usepackage[flushleft]{threeparttable}
    begin{document}
    begin{table}
    centering
    begin{threeparttable}
    begin{tabular}{@{} l *{8}{c} @{}}
    hline
    Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
    AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
    feedstock & multicolumn{2}{c}{C} & multicolumn{2}{c}{B}
    & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} \
    hline
    Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 4 & multicolumn{2}{c}{1} & multicolumn{2}{c}{2}
    & multicolumn{2}{c}{3} & multicolumn{2}{c}{4} \
    hline
    end{tabular}

    smallskip
    begin{tablenotes}
    itemNotes: Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
    end{tablenotes}
    end{threeparttable}
    end{table}
    end{document}





    share|improve this answer














    As far as I can tell, the "Blah Blah ..." material is only indirectly related to the preceding, table-like material. Is the "Blah Blah" material maybe some kind of legend? If this guess is correct, you'd be better off not placing it inside the tabular environment. Instead, I suggest you load the threeparttable package and place the legend in a tablenotes environment, which (thanks to the behind-the-scenes work of the threeparttable environment) will automatically be as wide as the preceding tabular environment.



    In case you're curious about the name threeparttable of the package: It can handle three types of elements: The table caption (which is absent in the case of your code), the tabular-like material, and the tablenotes material. The package works, though, even if there is no caption.



    enter image description here



    documentclass{article}
    usepackage[flushleft]{threeparttable}
    begin{document}
    begin{table}
    centering
    begin{threeparttable}
    begin{tabular}{@{} l *{8}{c} @{}}
    hline
    Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
    AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
    feedstock & multicolumn{2}{c}{C} & multicolumn{2}{c}{B}
    & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} \
    hline
    Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 4 & multicolumn{2}{c}{1} & multicolumn{2}{c}{2}
    & multicolumn{2}{c}{3} & multicolumn{2}{c}{4} \
    hline
    end{tabular}

    smallskip
    begin{tablenotes}
    itemNotes: Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
    end{tablenotes}
    end{threeparttable}
    end{table}
    end{document}






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited yesterday

























    answered yesterday









    Mico

    274k30371757




    274k30371757












    • Thanks a lot @Mico ! I really liked this arrangement of having tablenotes. It precisely solved my problem. :)
      – pukumarathe
      yesterday




















    • Thanks a lot @Mico ! I really liked this arrangement of having tablenotes. It precisely solved my problem. :)
      – pukumarathe
      yesterday


















    Thanks a lot @Mico ! I really liked this arrangement of having tablenotes. It precisely solved my problem. :)
    – pukumarathe
    yesterday






    Thanks a lot @Mico ! I really liked this arrangement of having tablenotes. It precisely solved my problem. :)
    – pukumarathe
    yesterday













    4














    since you tag your question with tabularx i suggest to use this package. beside it more nice result you will obtain by use of the booktabs package for horizontal rules:



    documentclass{article}
    usepackage{booktabs, tabularx}
    newcolumntype{C}{>{centeringarraybackslash}X}
    newcommandmcc[1]{multicolumn{2}{c}{#1}}

    %---------------- show page layout. don't use in a real document!
    usepackage{showframe}
    renewcommandShowFrameLinethickness{0.15pt}
    renewcommand*ShowFrameColor{color{red}}
    %---------------------------------------------------------------%

    begin{document}
    begin{table}[p]
    begin{tabularx}{linewidth}{@{} c *{8}{C} @{}}
    toprule
    Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
    cmidrule(lr){2-5}cmidrule(l){6-9}
    AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
    cmidrule(lr){2-3}cmidrule(lr){4-5}
    cmidrule(lr){6-7}cmidrule(lr){8-9}
    feedstock & mcc{C} & mcc{B} & mcc{C} & mcc{B} \
    midrule
    Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
    Par 4 & mcc{1} & mcc{2} & mcc{3} & mcc{4} \
    midrule
    multicolumn{9}{@{} p{linewidth} @{}}{Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah} \
    bottomrule
    end{tabularx}
    end{table}
    end{document}


    enter image description here



    (red lines indicate text border)






    share|improve this answer




























      4














      since you tag your question with tabularx i suggest to use this package. beside it more nice result you will obtain by use of the booktabs package for horizontal rules:



      documentclass{article}
      usepackage{booktabs, tabularx}
      newcolumntype{C}{>{centeringarraybackslash}X}
      newcommandmcc[1]{multicolumn{2}{c}{#1}}

      %---------------- show page layout. don't use in a real document!
      usepackage{showframe}
      renewcommandShowFrameLinethickness{0.15pt}
      renewcommand*ShowFrameColor{color{red}}
      %---------------------------------------------------------------%

      begin{document}
      begin{table}[p]
      begin{tabularx}{linewidth}{@{} c *{8}{C} @{}}
      toprule
      Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
      cmidrule(lr){2-5}cmidrule(l){6-9}
      AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
      cmidrule(lr){2-3}cmidrule(lr){4-5}
      cmidrule(lr){6-7}cmidrule(lr){8-9}
      feedstock & mcc{C} & mcc{B} & mcc{C} & mcc{B} \
      midrule
      Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
      Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
      Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
      Par 4 & mcc{1} & mcc{2} & mcc{3} & mcc{4} \
      midrule
      multicolumn{9}{@{} p{linewidth} @{}}{Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah} \
      bottomrule
      end{tabularx}
      end{table}
      end{document}


      enter image description here



      (red lines indicate text border)






      share|improve this answer


























        4












        4








        4






        since you tag your question with tabularx i suggest to use this package. beside it more nice result you will obtain by use of the booktabs package for horizontal rules:



        documentclass{article}
        usepackage{booktabs, tabularx}
        newcolumntype{C}{>{centeringarraybackslash}X}
        newcommandmcc[1]{multicolumn{2}{c}{#1}}

        %---------------- show page layout. don't use in a real document!
        usepackage{showframe}
        renewcommandShowFrameLinethickness{0.15pt}
        renewcommand*ShowFrameColor{color{red}}
        %---------------------------------------------------------------%

        begin{document}
        begin{table}[p]
        begin{tabularx}{linewidth}{@{} c *{8}{C} @{}}
        toprule
        Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
        cmidrule(lr){2-5}cmidrule(l){6-9}
        AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
        cmidrule(lr){2-3}cmidrule(lr){4-5}
        cmidrule(lr){6-7}cmidrule(lr){8-9}
        feedstock & mcc{C} & mcc{B} & mcc{C} & mcc{B} \
        midrule
        Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
        Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
        Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
        Par 4 & mcc{1} & mcc{2} & mcc{3} & mcc{4} \
        midrule
        multicolumn{9}{@{} p{linewidth} @{}}{Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah} \
        bottomrule
        end{tabularx}
        end{table}
        end{document}


        enter image description here



        (red lines indicate text border)






        share|improve this answer














        since you tag your question with tabularx i suggest to use this package. beside it more nice result you will obtain by use of the booktabs package for horizontal rules:



        documentclass{article}
        usepackage{booktabs, tabularx}
        newcolumntype{C}{>{centeringarraybackslash}X}
        newcommandmcc[1]{multicolumn{2}{c}{#1}}

        %---------------- show page layout. don't use in a real document!
        usepackage{showframe}
        renewcommandShowFrameLinethickness{0.15pt}
        renewcommand*ShowFrameColor{color{red}}
        %---------------------------------------------------------------%

        begin{document}
        begin{table}[p]
        begin{tabularx}{linewidth}{@{} c *{8}{C} @{}}
        toprule
        Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
        cmidrule(lr){2-5}cmidrule(l){6-9}
        AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
        cmidrule(lr){2-3}cmidrule(lr){4-5}
        cmidrule(lr){6-7}cmidrule(lr){8-9}
        feedstock & mcc{C} & mcc{B} & mcc{C} & mcc{B} \
        midrule
        Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
        Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
        Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
        Par 4 & mcc{1} & mcc{2} & mcc{3} & mcc{4} \
        midrule
        multicolumn{9}{@{} p{linewidth} @{}}{Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah} \
        bottomrule
        end{tabularx}
        end{table}
        end{document}


        enter image description here



        (red lines indicate text border)







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited yesterday

























        answered yesterday









        Zarko

        121k865158




        121k865158























            1














            You can add width argument to your columns, like multicolumn{9}{p{linewidth}}. Perhaps multicolumn{9}{p{.7linewidth}} will do even better. Addding this to your example produces the following outputhttps://imgur.com/WcNyPXb



            Here is the complete code of mwe



            documentclass{article}
            begin{document}
            begin{table}[p]
            begin{tabular}{ccccccccc}
            hline
            Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
            AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
            feedstock & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} \ hline
            Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
            Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
            Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
            Par 4 & multicolumn{2}{c}{1} & multicolumn{2}{c}{2} & multicolumn{2}{c}{3} & multicolumn{2}{c}{4} \ hline
            multicolumn{9}{p{linewidth}}{Blah Blah Blah Blah Blah Blah Blah Blah Blah
            Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah} \ hline
            end{tabular} end{table}
            end{document}





            share|improve this answer










            New contributor




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














            • 1




              Your solution has the (presumably unintended) side-effect of making the final column very wide indeed in case the combined width of the 9 columns is less than linewidth. Can you think of a way of avoiding this issue?
              – Mico
              yesterday
















            1














            You can add width argument to your columns, like multicolumn{9}{p{linewidth}}. Perhaps multicolumn{9}{p{.7linewidth}} will do even better. Addding this to your example produces the following outputhttps://imgur.com/WcNyPXb



            Here is the complete code of mwe



            documentclass{article}
            begin{document}
            begin{table}[p]
            begin{tabular}{ccccccccc}
            hline
            Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
            AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
            feedstock & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} \ hline
            Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
            Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
            Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
            Par 4 & multicolumn{2}{c}{1} & multicolumn{2}{c}{2} & multicolumn{2}{c}{3} & multicolumn{2}{c}{4} \ hline
            multicolumn{9}{p{linewidth}}{Blah Blah Blah Blah Blah Blah Blah Blah Blah
            Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah} \ hline
            end{tabular} end{table}
            end{document}





            share|improve this answer










            New contributor




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














            • 1




              Your solution has the (presumably unintended) side-effect of making the final column very wide indeed in case the combined width of the 9 columns is less than linewidth. Can you think of a way of avoiding this issue?
              – Mico
              yesterday














            1












            1








            1






            You can add width argument to your columns, like multicolumn{9}{p{linewidth}}. Perhaps multicolumn{9}{p{.7linewidth}} will do even better. Addding this to your example produces the following outputhttps://imgur.com/WcNyPXb



            Here is the complete code of mwe



            documentclass{article}
            begin{document}
            begin{table}[p]
            begin{tabular}{ccccccccc}
            hline
            Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
            AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
            feedstock & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} \ hline
            Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
            Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
            Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
            Par 4 & multicolumn{2}{c}{1} & multicolumn{2}{c}{2} & multicolumn{2}{c}{3} & multicolumn{2}{c}{4} \ hline
            multicolumn{9}{p{linewidth}}{Blah Blah Blah Blah Blah Blah Blah Blah Blah
            Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah} \ hline
            end{tabular} end{table}
            end{document}





            share|improve this answer










            New contributor




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









            You can add width argument to your columns, like multicolumn{9}{p{linewidth}}. Perhaps multicolumn{9}{p{.7linewidth}} will do even better. Addding this to your example produces the following outputhttps://imgur.com/WcNyPXb



            Here is the complete code of mwe



            documentclass{article}
            begin{document}
            begin{table}[p]
            begin{tabular}{ccccccccc}
            hline
            Compound & multicolumn{4}{c}{A} & multicolumn{4}{c}{B} \
            AT & #1 & #2 & #1 & #2 & #1 & #2 & #1 & #2 \
            feedstock & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} & multicolumn{2}{c}{C} & multicolumn{2}{c}{B} \ hline
            Par 1 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
            Par 2 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
            Par 3 & 1 & 1 & 2 & 2 & 3 & 3 & 4 & 4 \
            Par 4 & multicolumn{2}{c}{1} & multicolumn{2}{c}{2} & multicolumn{2}{c}{3} & multicolumn{2}{c}{4} \ hline
            multicolumn{9}{p{linewidth}}{Blah Blah Blah Blah Blah Blah Blah Blah Blah
            Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah} \ hline
            end{tabular} end{table}
            end{document}






            share|improve this answer










            New contributor




            Nikita Skybytskyi 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 answer



            share|improve this answer








            edited yesterday





















            New contributor




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









            answered yesterday









            Nikita Skybytskyi

            487




            487




            New contributor




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





            New contributor





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






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








            • 1




              Your solution has the (presumably unintended) side-effect of making the final column very wide indeed in case the combined width of the 9 columns is less than linewidth. Can you think of a way of avoiding this issue?
              – Mico
              yesterday














            • 1




              Your solution has the (presumably unintended) side-effect of making the final column very wide indeed in case the combined width of the 9 columns is less than linewidth. Can you think of a way of avoiding this issue?
              – Mico
              yesterday








            1




            1




            Your solution has the (presumably unintended) side-effect of making the final column very wide indeed in case the combined width of the 9 columns is less than linewidth. Can you think of a way of avoiding this issue?
            – Mico
            yesterday




            Your solution has the (presumably unintended) side-effect of making the final column very wide indeed in case the combined width of the 9 columns is less than linewidth. Can you think of a way of avoiding this issue?
            – Mico
            yesterday


















            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%2f468732%2fmulticolumn-tables-trouble%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 make a Squid Proxy server?

            Is this a new Fibonacci Identity?

            Touch on Surface Book