Uneven column widths when using a long multi-column header Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar ManaraTable column widths disproportionate due to multicolumn cell being too longltablex - Multi-column problemMulti-column problemTable with multi columnDifferent column widths when using multicolumn in tabular enviromentMulti-column problem with booktabs packageTables: adjust column widthsHow does multicolumn allocate column widths?Multi column TableChange placement of multi-column headerMulti-header column alignment with booktabs

Are these square matrices always diagonalisable?

Why did Israel vote against lifting the American embargo on Cuba?

What is the term for extremely loose Latin word order?

Did war bonds have better investment alternatives during WWII?

How to keep bees out of canned beverages?

What is /etc/mtab in Linux?

What do you call an IPA symbol that lacks a name (e.g. ɲ)?

What is a good proxy for government quality?

France's Public Holidays' Puzzle

Will I lose my paid in full property

Has a Nobel Peace laureate ever been accused of war crimes?

When I export an AI 300x60 art board it saves with bigger dimensions

How did Elite on the NES work?

Determinant of a matrix with 2 equal rows

Why does the Cisco show run command not show the full version, while the show version command does?

What happened to Viserion in Season 7?

TV series episode where humans nuke aliens before decrypting their message that states they come in peace

Page Layouts : 1 column , 2 columns-left , 2 columns-right , 3 column

How would it unbalance gameplay to rule that Weapon Master allows for picking a fighting style?

Is it OK if I do not take the receipt in Germany?

"Working on a knee"

What does the black goddess statue do and what is it?

Is it accepted to use working hours to read general interest books?

Does every subgroup of an abelian group have to be abelian?



Uneven column widths when using a long multi-column header



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraTable column widths disproportionate due to multicolumn cell being too longltablex - Multi-column problemMulti-column problemTable with multi columnDifferent column widths when using multicolumn in tabular enviromentMulti-column problem with booktabs packageTables: adjust column widthsHow does multicolumn allocate column widths?Multi column TableChange placement of multi-column headerMulti-header column alignment with booktabs










3















I have the following MWE, but I have a problem with the alignment of the last column (under the multicolumn)



documentclassreport
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackagebooktabs
usepackagecalc
usepackagearray
usepackagecolor
%
begindocument
%
% table 1
% evenly alined
begintable[htbp]
centering
begintabularccccc
toprule
& & multicolumn3cReduced component sizes\
%cmidrule(r)3-5
cmidrule3-5
% multicolumn2cInternal 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
endtabular
captionInformation on component level degrees of freedom
labeltab:information-overview-academic-model
endtable
%
% table 2
% not evenly alined
begintable[htbp]
centering
begintabularccccc
toprule
& & multicolumn3cReduced component matrix sizes textcolorredtest text added\
%cmidrule(r)3-5
cmidrule3-5
% multicolumn2cInternal 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
endtabular
captionInformation on component level degrees of freedom
labeltab:information-overview-academic-model
endtable
%
enddocument


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
    2 days ago






  • 1





    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
    2 days ago












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

    – Umut Tabak
    2 days ago















3















I have the following MWE, but I have a problem with the alignment of the last column (under the multicolumn)



documentclassreport
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackagebooktabs
usepackagecalc
usepackagearray
usepackagecolor
%
begindocument
%
% table 1
% evenly alined
begintable[htbp]
centering
begintabularccccc
toprule
& & multicolumn3cReduced component sizes\
%cmidrule(r)3-5
cmidrule3-5
% multicolumn2cInternal 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
endtabular
captionInformation on component level degrees of freedom
labeltab:information-overview-academic-model
endtable
%
% table 2
% not evenly alined
begintable[htbp]
centering
begintabularccccc
toprule
& & multicolumn3cReduced component matrix sizes textcolorredtest text added\
%cmidrule(r)3-5
cmidrule3-5
% multicolumn2cInternal 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
endtabular
captionInformation on component level degrees of freedom
labeltab:information-overview-academic-model
endtable
%
enddocument


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
    2 days ago






  • 1





    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
    2 days ago












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

    – Umut Tabak
    2 days ago













3












3








3


0






I have the following MWE, but I have a problem with the alignment of the last column (under the multicolumn)



documentclassreport
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackagebooktabs
usepackagecalc
usepackagearray
usepackagecolor
%
begindocument
%
% table 1
% evenly alined
begintable[htbp]
centering
begintabularccccc
toprule
& & multicolumn3cReduced component sizes\
%cmidrule(r)3-5
cmidrule3-5
% multicolumn2cInternal 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
endtabular
captionInformation on component level degrees of freedom
labeltab:information-overview-academic-model
endtable
%
% table 2
% not evenly alined
begintable[htbp]
centering
begintabularccccc
toprule
& & multicolumn3cReduced component matrix sizes textcolorredtest text added\
%cmidrule(r)3-5
cmidrule3-5
% multicolumn2cInternal 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
endtabular
captionInformation on component level degrees of freedom
labeltab:information-overview-academic-model
endtable
%
enddocument


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, but I have a problem with the alignment of the last column (under the multicolumn)



documentclassreport
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackagebooktabs
usepackagecalc
usepackagearray
usepackagecolor
%
begindocument
%
% table 1
% evenly alined
begintable[htbp]
centering
begintabularccccc
toprule
& & multicolumn3cReduced component sizes\
%cmidrule(r)3-5
cmidrule3-5
% multicolumn2cInternal 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
endtabular
captionInformation on component level degrees of freedom
labeltab:information-overview-academic-model
endtable
%
% table 2
% not evenly alined
begintable[htbp]
centering
begintabularccccc
toprule
& & multicolumn3cReduced component matrix sizes textcolorredtest text added\
%cmidrule(r)3-5
cmidrule3-5
% multicolumn2cInternal 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
endtabular
captionInformation on component level degrees of freedom
labeltab:information-overview-academic-model
endtable
%
enddocument


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 2 days ago









Mico

288k32394781




288k32394781










asked 2 days ago









Umut TabakUmut Tabak

2571213




2571213












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

    – leandriis
    2 days ago






  • 1





    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
    2 days ago












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

    – Umut Tabak
    2 days ago

















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

    – leandriis
    2 days ago






  • 1





    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
    2 days ago












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

    – Umut Tabak
    2 days ago
















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

– leandriis
2 days ago





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

– leandriis
2 days ago




1




1





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
2 days 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
2 days ago














Thanks egreg, I just learned it this morning ;)

– Umut Tabak
2 days ago





Thanks egreg, I just learned it this morning ;)

– Umut Tabak
2 days ago










2 Answers
2






active

oldest

votes


















7














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.



documentclassreport
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackagebooktabs
usepackagecalc
usepackagearray
usepackagecolor
usepackagemakecell
usepackagetabularx
newcolumntypeC>centeringarraybackslashX
begindocument
%
% table 1
% evenly alined
begintable[htbp]
centering
begintabularccccc
toprule
& & multicolumn3cReduced component sizes\
%cmidrule(r)3-5
cmidrule3-5
% multicolumn2cInternal 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
endtabular
captionInformation on component level degrees of freedom
labeltab:information-overview-academic-model
endtable
%
begintable[htbp]
centering
begintabularccccc
toprule
& & multicolumn3cmakecellReduced component\ matrix sizes\ textcolorredtest text added\
%cmidrule(r)3-5
cmidrule3-5
% multicolumn2cInternal 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
endtabular
captionWith textbackslashtextttmakecell
labeltab:information-overview-academic-modelbis
endtable
begintable[htbp]
centering
begintabularxlinewidthccCCC
toprule
& & multicolumn3cReduced component matrix sizes textcolorredtest text added\
%cmidrule(r)3-5
cmidrule3-5
% multicolumn2cInternal 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
endtabularx
captionWith texttttabularx
labeltab:information-overview-academic-modelter
endtable
enddocument


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
    2 days 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
    2 days ago


















3














Just for the sake of variety, here's a solution which (a) calculates the natural widths of columns 3, 4, and 5 and (b) uses the combined widths of the three columns (plus the intercolumn whitespace amount) to typeset the long header string in a way that allows for automatic line-breaking.



This approach keeps the tabular material nice and compact; this is generally considered to be a good thing.



enter image description here



Observe that I would place the headers "Component" and "Full size" at the top rather than at the bottom of the header material.



documentclassreport
usepackage[T1]fontenc
usepackage[utf8]inputenc
usepackagexcolor,booktabs,array,ragged2e
%% Create a new column type:
newcolumntypeC[1]>Centeringarraybackslashp#1

begindocument

begintable[htbp]
centering
begintabularccccc
toprule
& & multicolumn3cReduced component sizes\
cmidrule3-5
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
endtabular
captionOP's original layout
labeltab:a
endtable


%% perform a few length calculations
newlengthmylen
newlengthmylena
newlengthmylenb
settowidthmylena$m=4$
settowidthmylenb$m=12$
setlengthmylendimexpr2mylena+mylenb+4tabcolseprelax

begintable[htbp]
centering
begintabular@ccccc@
toprule
Component & Full size &
multicolumn3Cmylen@Reduced component matrix sizes textcolorredtest text added\
cmidrule(l)3-5
& & $m=4$ & $m=8$ & $m=12$\
midrule
1 & 257 & 24 & 28 & 32 \
2 & 420 & 47 & 51 & 55 \
3 & 177 & 24 & 28 & 32 \
bottomrule
endtabular
captionAutomatic line-breaking in cols 3 to 5
labeltab:b
endtable

enddocument





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',
    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-widths-when-using-a-long-multi-column-header%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









    7














    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.



    documentclassreport
    usepackage[T1]fontenc
    usepackage[utf8]inputenc
    usepackagebooktabs
    usepackagecalc
    usepackagearray
    usepackagecolor
    usepackagemakecell
    usepackagetabularx
    newcolumntypeC>centeringarraybackslashX
    begindocument
    %
    % table 1
    % evenly alined
    begintable[htbp]
    centering
    begintabularccccc
    toprule
    & & multicolumn3cReduced component sizes\
    %cmidrule(r)3-5
    cmidrule3-5
    % multicolumn2cInternal 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
    endtabular
    captionInformation on component level degrees of freedom
    labeltab:information-overview-academic-model
    endtable
    %
    begintable[htbp]
    centering
    begintabularccccc
    toprule
    & & multicolumn3cmakecellReduced component\ matrix sizes\ textcolorredtest text added\
    %cmidrule(r)3-5
    cmidrule3-5
    % multicolumn2cInternal 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
    endtabular
    captionWith textbackslashtextttmakecell
    labeltab:information-overview-academic-modelbis
    endtable
    begintable[htbp]
    centering
    begintabularxlinewidthccCCC
    toprule
    & & multicolumn3cReduced component matrix sizes textcolorredtest text added\
    %cmidrule(r)3-5
    cmidrule3-5
    % multicolumn2cInternal 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
    endtabularx
    captionWith texttttabularx
    labeltab:information-overview-academic-modelter
    endtable
    enddocument


    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
      2 days 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
      2 days ago















    7














    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.



    documentclassreport
    usepackage[T1]fontenc
    usepackage[utf8]inputenc
    usepackagebooktabs
    usepackagecalc
    usepackagearray
    usepackagecolor
    usepackagemakecell
    usepackagetabularx
    newcolumntypeC>centeringarraybackslashX
    begindocument
    %
    % table 1
    % evenly alined
    begintable[htbp]
    centering
    begintabularccccc
    toprule
    & & multicolumn3cReduced component sizes\
    %cmidrule(r)3-5
    cmidrule3-5
    % multicolumn2cInternal 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
    endtabular
    captionInformation on component level degrees of freedom
    labeltab:information-overview-academic-model
    endtable
    %
    begintable[htbp]
    centering
    begintabularccccc
    toprule
    & & multicolumn3cmakecellReduced component\ matrix sizes\ textcolorredtest text added\
    %cmidrule(r)3-5
    cmidrule3-5
    % multicolumn2cInternal 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
    endtabular
    captionWith textbackslashtextttmakecell
    labeltab:information-overview-academic-modelbis
    endtable
    begintable[htbp]
    centering
    begintabularxlinewidthccCCC
    toprule
    & & multicolumn3cReduced component matrix sizes textcolorredtest text added\
    %cmidrule(r)3-5
    cmidrule3-5
    % multicolumn2cInternal 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
    endtabularx
    captionWith texttttabularx
    labeltab:information-overview-academic-modelter
    endtable
    enddocument


    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
      2 days 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
      2 days ago













    7












    7








    7







    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.



    documentclassreport
    usepackage[T1]fontenc
    usepackage[utf8]inputenc
    usepackagebooktabs
    usepackagecalc
    usepackagearray
    usepackagecolor
    usepackagemakecell
    usepackagetabularx
    newcolumntypeC>centeringarraybackslashX
    begindocument
    %
    % table 1
    % evenly alined
    begintable[htbp]
    centering
    begintabularccccc
    toprule
    & & multicolumn3cReduced component sizes\
    %cmidrule(r)3-5
    cmidrule3-5
    % multicolumn2cInternal 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
    endtabular
    captionInformation on component level degrees of freedom
    labeltab:information-overview-academic-model
    endtable
    %
    begintable[htbp]
    centering
    begintabularccccc
    toprule
    & & multicolumn3cmakecellReduced component\ matrix sizes\ textcolorredtest text added\
    %cmidrule(r)3-5
    cmidrule3-5
    % multicolumn2cInternal 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
    endtabular
    captionWith textbackslashtextttmakecell
    labeltab:information-overview-academic-modelbis
    endtable
    begintable[htbp]
    centering
    begintabularxlinewidthccCCC
    toprule
    & & multicolumn3cReduced component matrix sizes textcolorredtest text added\
    %cmidrule(r)3-5
    cmidrule3-5
    % multicolumn2cInternal 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
    endtabularx
    captionWith texttttabularx
    labeltab:information-overview-academic-modelter
    endtable
    enddocument


    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.



    documentclassreport
    usepackage[T1]fontenc
    usepackage[utf8]inputenc
    usepackagebooktabs
    usepackagecalc
    usepackagearray
    usepackagecolor
    usepackagemakecell
    usepackagetabularx
    newcolumntypeC>centeringarraybackslashX
    begindocument
    %
    % table 1
    % evenly alined
    begintable[htbp]
    centering
    begintabularccccc
    toprule
    & & multicolumn3cReduced component sizes\
    %cmidrule(r)3-5
    cmidrule3-5
    % multicolumn2cInternal 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
    endtabular
    captionInformation on component level degrees of freedom
    labeltab:information-overview-academic-model
    endtable
    %
    begintable[htbp]
    centering
    begintabularccccc
    toprule
    & & multicolumn3cmakecellReduced component\ matrix sizes\ textcolorredtest text added\
    %cmidrule(r)3-5
    cmidrule3-5
    % multicolumn2cInternal 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
    endtabular
    captionWith textbackslashtextttmakecell
    labeltab:information-overview-academic-modelbis
    endtable
    begintable[htbp]
    centering
    begintabularxlinewidthccCCC
    toprule
    & & multicolumn3cReduced component matrix sizes textcolorredtest text added\
    %cmidrule(r)3-5
    cmidrule3-5
    % multicolumn2cInternal 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
    endtabularx
    captionWith texttttabularx
    labeltab:information-overview-academic-modelter
    endtable
    enddocument


    enter image description here







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 2 days ago









    Bernard

    177k779211




    177k779211










    answered 2 days ago









    CarLaTeXCarLaTeX

    35.6k555153




    35.6k555153












    • 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
      2 days 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
      2 days 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
      2 days 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
      2 days 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
    2 days 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
    2 days 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
    2 days ago





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

    – CarLaTeX
    2 days ago











    3














    Just for the sake of variety, here's a solution which (a) calculates the natural widths of columns 3, 4, and 5 and (b) uses the combined widths of the three columns (plus the intercolumn whitespace amount) to typeset the long header string in a way that allows for automatic line-breaking.



    This approach keeps the tabular material nice and compact; this is generally considered to be a good thing.



    enter image description here



    Observe that I would place the headers "Component" and "Full size" at the top rather than at the bottom of the header material.



    documentclassreport
    usepackage[T1]fontenc
    usepackage[utf8]inputenc
    usepackagexcolor,booktabs,array,ragged2e
    %% Create a new column type:
    newcolumntypeC[1]>Centeringarraybackslashp#1

    begindocument

    begintable[htbp]
    centering
    begintabularccccc
    toprule
    & & multicolumn3cReduced component sizes\
    cmidrule3-5
    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
    endtabular
    captionOP's original layout
    labeltab:a
    endtable


    %% perform a few length calculations
    newlengthmylen
    newlengthmylena
    newlengthmylenb
    settowidthmylena$m=4$
    settowidthmylenb$m=12$
    setlengthmylendimexpr2mylena+mylenb+4tabcolseprelax

    begintable[htbp]
    centering
    begintabular@ccccc@
    toprule
    Component & Full size &
    multicolumn3Cmylen@Reduced component matrix sizes textcolorredtest text added\
    cmidrule(l)3-5
    & & $m=4$ & $m=8$ & $m=12$\
    midrule
    1 & 257 & 24 & 28 & 32 \
    2 & 420 & 47 & 51 & 55 \
    3 & 177 & 24 & 28 & 32 \
    bottomrule
    endtabular
    captionAutomatic line-breaking in cols 3 to 5
    labeltab:b
    endtable

    enddocument





    share|improve this answer



























      3














      Just for the sake of variety, here's a solution which (a) calculates the natural widths of columns 3, 4, and 5 and (b) uses the combined widths of the three columns (plus the intercolumn whitespace amount) to typeset the long header string in a way that allows for automatic line-breaking.



      This approach keeps the tabular material nice and compact; this is generally considered to be a good thing.



      enter image description here



      Observe that I would place the headers "Component" and "Full size" at the top rather than at the bottom of the header material.



      documentclassreport
      usepackage[T1]fontenc
      usepackage[utf8]inputenc
      usepackagexcolor,booktabs,array,ragged2e
      %% Create a new column type:
      newcolumntypeC[1]>Centeringarraybackslashp#1

      begindocument

      begintable[htbp]
      centering
      begintabularccccc
      toprule
      & & multicolumn3cReduced component sizes\
      cmidrule3-5
      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
      endtabular
      captionOP's original layout
      labeltab:a
      endtable


      %% perform a few length calculations
      newlengthmylen
      newlengthmylena
      newlengthmylenb
      settowidthmylena$m=4$
      settowidthmylenb$m=12$
      setlengthmylendimexpr2mylena+mylenb+4tabcolseprelax

      begintable[htbp]
      centering
      begintabular@ccccc@
      toprule
      Component & Full size &
      multicolumn3Cmylen@Reduced component matrix sizes textcolorredtest text added\
      cmidrule(l)3-5
      & & $m=4$ & $m=8$ & $m=12$\
      midrule
      1 & 257 & 24 & 28 & 32 \
      2 & 420 & 47 & 51 & 55 \
      3 & 177 & 24 & 28 & 32 \
      bottomrule
      endtabular
      captionAutomatic line-breaking in cols 3 to 5
      labeltab:b
      endtable

      enddocument





      share|improve this answer

























        3












        3








        3







        Just for the sake of variety, here's a solution which (a) calculates the natural widths of columns 3, 4, and 5 and (b) uses the combined widths of the three columns (plus the intercolumn whitespace amount) to typeset the long header string in a way that allows for automatic line-breaking.



        This approach keeps the tabular material nice and compact; this is generally considered to be a good thing.



        enter image description here



        Observe that I would place the headers "Component" and "Full size" at the top rather than at the bottom of the header material.



        documentclassreport
        usepackage[T1]fontenc
        usepackage[utf8]inputenc
        usepackagexcolor,booktabs,array,ragged2e
        %% Create a new column type:
        newcolumntypeC[1]>Centeringarraybackslashp#1

        begindocument

        begintable[htbp]
        centering
        begintabularccccc
        toprule
        & & multicolumn3cReduced component sizes\
        cmidrule3-5
        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
        endtabular
        captionOP's original layout
        labeltab:a
        endtable


        %% perform a few length calculations
        newlengthmylen
        newlengthmylena
        newlengthmylenb
        settowidthmylena$m=4$
        settowidthmylenb$m=12$
        setlengthmylendimexpr2mylena+mylenb+4tabcolseprelax

        begintable[htbp]
        centering
        begintabular@ccccc@
        toprule
        Component & Full size &
        multicolumn3Cmylen@Reduced component matrix sizes textcolorredtest text added\
        cmidrule(l)3-5
        & & $m=4$ & $m=8$ & $m=12$\
        midrule
        1 & 257 & 24 & 28 & 32 \
        2 & 420 & 47 & 51 & 55 \
        3 & 177 & 24 & 28 & 32 \
        bottomrule
        endtabular
        captionAutomatic line-breaking in cols 3 to 5
        labeltab:b
        endtable

        enddocument





        share|improve this answer













        Just for the sake of variety, here's a solution which (a) calculates the natural widths of columns 3, 4, and 5 and (b) uses the combined widths of the three columns (plus the intercolumn whitespace amount) to typeset the long header string in a way that allows for automatic line-breaking.



        This approach keeps the tabular material nice and compact; this is generally considered to be a good thing.



        enter image description here



        Observe that I would place the headers "Component" and "Full size" at the top rather than at the bottom of the header material.



        documentclassreport
        usepackage[T1]fontenc
        usepackage[utf8]inputenc
        usepackagexcolor,booktabs,array,ragged2e
        %% Create a new column type:
        newcolumntypeC[1]>Centeringarraybackslashp#1

        begindocument

        begintable[htbp]
        centering
        begintabularccccc
        toprule
        & & multicolumn3cReduced component sizes\
        cmidrule3-5
        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
        endtabular
        captionOP's original layout
        labeltab:a
        endtable


        %% perform a few length calculations
        newlengthmylen
        newlengthmylena
        newlengthmylenb
        settowidthmylena$m=4$
        settowidthmylenb$m=12$
        setlengthmylendimexpr2mylena+mylenb+4tabcolseprelax

        begintable[htbp]
        centering
        begintabular@ccccc@
        toprule
        Component & Full size &
        multicolumn3Cmylen@Reduced component matrix sizes textcolorredtest text added\
        cmidrule(l)3-5
        & & $m=4$ & $m=8$ & $m=12$\
        midrule
        1 & 257 & 24 & 28 & 32 \
        2 & 420 & 47 & 51 & 55 \
        3 & 177 & 24 & 28 & 32 \
        bottomrule
        endtabular
        captionAutomatic line-breaking in cols 3 to 5
        labeltab:b
        endtable

        enddocument






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 days ago









        MicoMico

        288k32394781




        288k32394781



























            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-widths-when-using-a-long-multi-column-header%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

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

            Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?