Uneven column alignment with booktabs: multicolumn and cmidrule












3















I have the following MWE to test the booktabs package but I have a problem with the alignment of the last column(under the multicolumn)



documentclass{report}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{booktabs}
usepackage{calc}
usepackage{array}
usepackage{color}
%
begin{document}
%
% table 1
% evenly alined
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{Reduced component sizes}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{Information on component level degrees of freedom}
label{tab:information-overview-academic-model}
end{table}
%
% table 2
% not evenly alined
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{Reduced component matrix sizes textcolor{red}{test text added}}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{Information on component level degrees of freedom}
label{tab:information-overview-academic-model}
end{table}
%
end{document}


The result I am getting is that the columns under the multicolumns are not evenly separated. And when I increase the width of the text argument to multicolumn command it becomes even worse, first example seems to be fine but with the second there is definitely a problem. Here is the output of the above code:



alignment problem



Any ideas are appreciated to solve this issue.
Many thanks in advance.










share|improve this question

























  • Closely related: Table column widths disproportionate due to multicolumn cell being too long

    – leandriis
    1 hour ago











  • booktabs and cmidrule are not involved. This is a known feature of TeX's alignments: when columns are spanned, the excess always go to the last spanned column. Overlong header text should be avoided.

    – egreg
    12 mins ago













  • Thanks egreg, I just learned it this morning ;)

    – Umut Tabak
    10 mins ago
















3















I have the following MWE to test the booktabs package but I have a problem with the alignment of the last column(under the multicolumn)



documentclass{report}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{booktabs}
usepackage{calc}
usepackage{array}
usepackage{color}
%
begin{document}
%
% table 1
% evenly alined
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{Reduced component sizes}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{Information on component level degrees of freedom}
label{tab:information-overview-academic-model}
end{table}
%
% table 2
% not evenly alined
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{Reduced component matrix sizes textcolor{red}{test text added}}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{Information on component level degrees of freedom}
label{tab:information-overview-academic-model}
end{table}
%
end{document}


The result I am getting is that the columns under the multicolumns are not evenly separated. And when I increase the width of the text argument to multicolumn command it becomes even worse, first example seems to be fine but with the second there is definitely a problem. Here is the output of the above code:



alignment problem



Any ideas are appreciated to solve this issue.
Many thanks in advance.










share|improve this question

























  • Closely related: Table column widths disproportionate due to multicolumn cell being too long

    – leandriis
    1 hour ago











  • booktabs and cmidrule are not involved. This is a known feature of TeX's alignments: when columns are spanned, the excess always go to the last spanned column. Overlong header text should be avoided.

    – egreg
    12 mins ago













  • Thanks egreg, I just learned it this morning ;)

    – Umut Tabak
    10 mins ago














3












3








3


0






I have the following MWE to test the booktabs package but I have a problem with the alignment of the last column(under the multicolumn)



documentclass{report}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{booktabs}
usepackage{calc}
usepackage{array}
usepackage{color}
%
begin{document}
%
% table 1
% evenly alined
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{Reduced component sizes}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{Information on component level degrees of freedom}
label{tab:information-overview-academic-model}
end{table}
%
% table 2
% not evenly alined
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{Reduced component matrix sizes textcolor{red}{test text added}}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{Information on component level degrees of freedom}
label{tab:information-overview-academic-model}
end{table}
%
end{document}


The result I am getting is that the columns under the multicolumns are not evenly separated. And when I increase the width of the text argument to multicolumn command it becomes even worse, first example seems to be fine but with the second there is definitely a problem. Here is the output of the above code:



alignment problem



Any ideas are appreciated to solve this issue.
Many thanks in advance.










share|improve this question
















I have the following MWE to test the booktabs package but I have a problem with the alignment of the last column(under the multicolumn)



documentclass{report}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{booktabs}
usepackage{calc}
usepackage{array}
usepackage{color}
%
begin{document}
%
% table 1
% evenly alined
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{Reduced component sizes}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{Information on component level degrees of freedom}
label{tab:information-overview-academic-model}
end{table}
%
% table 2
% not evenly alined
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{Reduced component matrix sizes textcolor{red}{test text added}}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{Information on component level degrees of freedom}
label{tab:information-overview-academic-model}
end{table}
%
end{document}


The result I am getting is that the columns under the multicolumns are not evenly separated. And when I increase the width of the text argument to multicolumn command it becomes even worse, first example seems to be fine but with the second there is definitely a problem. Here is the output of the above code:



alignment problem



Any ideas are appreciated to solve this issue.
Many thanks in advance.







tables horizontal-alignment multicolumn booktabs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 28 mins ago









leandriis

11.4k1733




11.4k1733










asked 1 hour ago









Umut TabakUmut Tabak

2571213




2571213













  • Closely related: Table column widths disproportionate due to multicolumn cell being too long

    – leandriis
    1 hour ago











  • booktabs and cmidrule are not involved. This is a known feature of TeX's alignments: when columns are spanned, the excess always go to the last spanned column. Overlong header text should be avoided.

    – egreg
    12 mins ago













  • Thanks egreg, I just learned it this morning ;)

    – Umut Tabak
    10 mins ago



















  • Closely related: Table column widths disproportionate due to multicolumn cell being too long

    – leandriis
    1 hour ago











  • booktabs and cmidrule are not involved. This is a known feature of TeX's alignments: when columns are spanned, the excess always go to the last spanned column. Overlong header text should be avoided.

    – egreg
    12 mins ago













  • Thanks egreg, I just learned it this morning ;)

    – Umut Tabak
    10 mins ago

















Closely related: Table column widths disproportionate due to multicolumn cell being too long

– leandriis
1 hour ago





Closely related: Table column widths disproportionate due to multicolumn cell being too long

– leandriis
1 hour ago













booktabs and cmidrule are not involved. This is a known feature of TeX's alignments: when columns are spanned, the excess always go to the last spanned column. Overlong header text should be avoided.

– egreg
12 mins ago







booktabs and cmidrule are not involved. This is a known feature of TeX's alignments: when columns are spanned, the excess always go to the last spanned column. Overlong header text should be avoided.

– egreg
12 mins ago















Thanks egreg, I just learned it this morning ;)

– Umut Tabak
10 mins ago





Thanks egreg, I just learned it this morning ;)

– Umut Tabak
10 mins ago










1 Answer
1






active

oldest

votes


















5














I suggest two kinds of solutions.



The first one with makecell which puts the multicolumn header on many lines; the second one with tabularx which equally distributes the spaces among the last 3 columns, leaving the header in one line.



documentclass{report}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{booktabs}
usepackage{calc}
usepackage{array}
usepackage{color}
usepackage{makecell}
usepackage{tabularx}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
%
% table 1
% evenly alined
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{Reduced component sizes}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{Information on component level degrees of freedom}
label{tab:information-overview-academic-model}
end{table}
%
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{makecell{Reduced component\ matrix sizes\ textcolor{red}{test text added}}}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{With textbackslashtexttt{makecell}}
label{tab:information-overview-academic-modelbis}
end{table}
begin{table}[htbp]
centering
begin{tabularx}{linewidth}{ccCCC}
toprule
& & multicolumn{3}{c}{Reduced component matrix sizes textcolor{red}{test text added}}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabularx}
caption{With texttt{tabularx}}
label{tab:information-overview-academic-modelter}
end{table}
end{document}


enter image description here






share|improve this answer


























  • Thanks, without reading the documentation for makecell, I tried to use makecell with one line without the linebreaks as you suggested and then the problem still persists. I guess it is better to use tabularx for this one.

    – Umut Tabak
    11 mins ago








  • 1





    @UmutTabak makecell is created to divide lines. If you don't add \ within a makecell it makes no sense to use it.

    – CarLaTeX
    5 mins ago












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%2f485870%2funeven-column-alignment-with-booktabs-multicolumn-and-cmidrule%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









5














I suggest two kinds of solutions.



The first one with makecell which puts the multicolumn header on many lines; the second one with tabularx which equally distributes the spaces among the last 3 columns, leaving the header in one line.



documentclass{report}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{booktabs}
usepackage{calc}
usepackage{array}
usepackage{color}
usepackage{makecell}
usepackage{tabularx}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
%
% table 1
% evenly alined
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{Reduced component sizes}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{Information on component level degrees of freedom}
label{tab:information-overview-academic-model}
end{table}
%
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{makecell{Reduced component\ matrix sizes\ textcolor{red}{test text added}}}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{With textbackslashtexttt{makecell}}
label{tab:information-overview-academic-modelbis}
end{table}
begin{table}[htbp]
centering
begin{tabularx}{linewidth}{ccCCC}
toprule
& & multicolumn{3}{c}{Reduced component matrix sizes textcolor{red}{test text added}}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabularx}
caption{With texttt{tabularx}}
label{tab:information-overview-academic-modelter}
end{table}
end{document}


enter image description here






share|improve this answer


























  • Thanks, without reading the documentation for makecell, I tried to use makecell with one line without the linebreaks as you suggested and then the problem still persists. I guess it is better to use tabularx for this one.

    – Umut Tabak
    11 mins ago








  • 1





    @UmutTabak makecell is created to divide lines. If you don't add \ within a makecell it makes no sense to use it.

    – CarLaTeX
    5 mins ago
















5














I suggest two kinds of solutions.



The first one with makecell which puts the multicolumn header on many lines; the second one with tabularx which equally distributes the spaces among the last 3 columns, leaving the header in one line.



documentclass{report}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{booktabs}
usepackage{calc}
usepackage{array}
usepackage{color}
usepackage{makecell}
usepackage{tabularx}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
%
% table 1
% evenly alined
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{Reduced component sizes}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{Information on component level degrees of freedom}
label{tab:information-overview-academic-model}
end{table}
%
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{makecell{Reduced component\ matrix sizes\ textcolor{red}{test text added}}}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{With textbackslashtexttt{makecell}}
label{tab:information-overview-academic-modelbis}
end{table}
begin{table}[htbp]
centering
begin{tabularx}{linewidth}{ccCCC}
toprule
& & multicolumn{3}{c}{Reduced component matrix sizes textcolor{red}{test text added}}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabularx}
caption{With texttt{tabularx}}
label{tab:information-overview-academic-modelter}
end{table}
end{document}


enter image description here






share|improve this answer


























  • Thanks, without reading the documentation for makecell, I tried to use makecell with one line without the linebreaks as you suggested and then the problem still persists. I guess it is better to use tabularx for this one.

    – Umut Tabak
    11 mins ago








  • 1





    @UmutTabak makecell is created to divide lines. If you don't add \ within a makecell it makes no sense to use it.

    – CarLaTeX
    5 mins ago














5












5








5







I suggest two kinds of solutions.



The first one with makecell which puts the multicolumn header on many lines; the second one with tabularx which equally distributes the spaces among the last 3 columns, leaving the header in one line.



documentclass{report}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{booktabs}
usepackage{calc}
usepackage{array}
usepackage{color}
usepackage{makecell}
usepackage{tabularx}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
%
% table 1
% evenly alined
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{Reduced component sizes}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{Information on component level degrees of freedom}
label{tab:information-overview-academic-model}
end{table}
%
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{makecell{Reduced component\ matrix sizes\ textcolor{red}{test text added}}}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{With textbackslashtexttt{makecell}}
label{tab:information-overview-academic-modelbis}
end{table}
begin{table}[htbp]
centering
begin{tabularx}{linewidth}{ccCCC}
toprule
& & multicolumn{3}{c}{Reduced component matrix sizes textcolor{red}{test text added}}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabularx}
caption{With texttt{tabularx}}
label{tab:information-overview-academic-modelter}
end{table}
end{document}


enter image description here






share|improve this answer















I suggest two kinds of solutions.



The first one with makecell which puts the multicolumn header on many lines; the second one with tabularx which equally distributes the spaces among the last 3 columns, leaving the header in one line.



documentclass{report}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{booktabs}
usepackage{calc}
usepackage{array}
usepackage{color}
usepackage{makecell}
usepackage{tabularx}
newcolumntype{C}{>{centeringarraybackslash}X}
begin{document}
%
% table 1
% evenly alined
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{Reduced component sizes}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{Information on component level degrees of freedom}
label{tab:information-overview-academic-model}
end{table}
%
begin{table}[htbp]
centering
begin{tabular}{ccccc}
toprule
& & multicolumn{3}{c}{makecell{Reduced component\ matrix sizes\ textcolor{red}{test text added}}}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabular}
caption{With textbackslashtexttt{makecell}}
label{tab:information-overview-academic-modelbis}
end{table}
begin{table}[htbp]
centering
begin{tabularx}{linewidth}{ccCCC}
toprule
& & multicolumn{3}{c}{Reduced component matrix sizes textcolor{red}{test text added}}\
%cmidrule(r){3-5}
cmidrule{3-5}
% multicolumn{2}{c}{Internal mode count, $m$} &10&20&30&10&20&30\
%midrule
Component & Full size & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
end{tabularx}
caption{With texttt{tabularx}}
label{tab:information-overview-academic-modelter}
end{table}
end{document}


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 44 mins ago









Bernard

177k778210




177k778210










answered 1 hour ago









CarLaTeXCarLaTeX

35.1k554146




35.1k554146













  • Thanks, without reading the documentation for makecell, I tried to use makecell with one line without the linebreaks as you suggested and then the problem still persists. I guess it is better to use tabularx for this one.

    – Umut Tabak
    11 mins ago








  • 1





    @UmutTabak makecell is created to divide lines. If you don't add \ within a makecell it makes no sense to use it.

    – CarLaTeX
    5 mins ago



















  • Thanks, without reading the documentation for makecell, I tried to use makecell with one line without the linebreaks as you suggested and then the problem still persists. I guess it is better to use tabularx for this one.

    – Umut Tabak
    11 mins ago








  • 1





    @UmutTabak makecell is created to divide lines. If you don't add \ within a makecell it makes no sense to use it.

    – CarLaTeX
    5 mins ago

















Thanks, without reading the documentation for makecell, I tried to use makecell with one line without the linebreaks as you suggested and then the problem still persists. I guess it is better to use tabularx for this one.

– Umut Tabak
11 mins ago







Thanks, without reading the documentation for makecell, I tried to use makecell with one line without the linebreaks as you suggested and then the problem still persists. I guess it is better to use tabularx for this one.

– Umut Tabak
11 mins ago






1




1





@UmutTabak makecell is created to divide lines. If you don't add \ within a makecell it makes no sense to use it.

– CarLaTeX
5 mins ago





@UmutTabak makecell is created to divide lines. If you don't add \ within a makecell it makes no sense to use it.

– CarLaTeX
5 mins ago


















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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f485870%2funeven-column-alignment-with-booktabs-multicolumn-and-cmidrule%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

90s novel: wood nymph (similar to an otik) who becomes a scientist

Joseph Stallaert

De Doelen