Table: cmidrule alignment problem












5














Please look at this table:



enter image description here



1) I don't understand why the line cmidrule(lr){2-3} does not go right above the start of "Advertisement".



2) I don't understand why the 69% is not aligned with the 3 values above.



Can someone please help me correct these two points?



This is my code (I include my full preamble in case it's because of a conflict between packages):



documentclass[12pt]{article}
usepackage{setspace,amsmath,graphicx,float}
usepackage[english]{babel}
usepackage[natbibapa]{apacite}
usepackage{boldline}
usepackage{array}
usepackage{ragged2e}
usepackage{url}
usepackage{fancyhdr}
usepackage{changepage}
usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
usepackage{newtxtext, newtxmath}
usepackage{eurosym}
usepackage{nameref}
usepackage[nottoc]{tocbibind}
usepackage[bottom]{footmisc}
edefrestoreparindent{parindent=theparindentrelax}
usepackage{parskip}
usepackage{enumitem}
usepackage{tabularx}
usepackage{threeparttable}
usepackage{color}
usepackage{tikz}
usetikzlibrary{arrows, arrows.meta, calc, positioning, quotes, shapes, patterns}
usepackage[margin=1cm]{caption}
captionsetup[figure]{skip=18pt}
usepackage[labelfont=bf]{caption}
usepackage{etoolbox}
usepackage{multirow}
usepackage{booktabs}
usepackage{amssymb}
usepackage{nccmath}

begin{document}
begin{table}[h]
caption[Gross profit ratio for Axel Springer and ProSiebenSat.1]{Gross profit ratio for Axel Springer and ProSiebenSat.1 per side.}
centering
begin{threeparttable}
begin{tabular*}{textwidth}{l@{extracolsep{fill}} c c c c}
toprule
& multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c}{ProSiebenSat.1} \
cmidrule(lr){2-3} cmidrule(lr){4-5}
& Advertisement & Circulation & Advertisement & Viewers \
midrule
Revenue (A) & 1,089 & 1,313 & 1834 & 0 \[1ex]
Variable costs (B) & 338 & 407 & 1265 & 0 \[1ex]
Gross profit (A - B) & 751 & 906 & 569 & 0 \[1ex]
Gross profit ratio (A - B) / A & 69% & 69% & 31% & - \
bottomrule
end{tabular*}
begin{tablenotes}
raggedright
item textit{Note}: Adapted from Axel Springer and ProSiebenSat.1's income statement in 2004. All numbers in million Euro.
end{tablenotes}
end{threeparttable}
end{table}

end{document}









share|improve this question


















  • 2




    You've asked LaTeX not to do those things. cmidrule with (lr) will not fill the entire column width; try removing the (lr). The column with 69% you've asked to be centered.
    – Hugh
    Mar 4 '17 at 15:22






  • 1




    Delete (lr) for full line and replace {l@{extracolsep{fill}} c c c c } with {l@{extracolsep{fill}} l l l l} or {l@{extracolsep{fill}} r r r r} for aligning.
    – Bobyandbob
    Mar 4 '17 at 15:38










  • Ohh, got it thank you! Just something else I don't understand: When I remove (lr) from the left group, and write instead (r), everything looks as I want. However, as you can see above, the right group has the (lr) in it and looks fine. Why is that?
    – Malganas
    Mar 4 '17 at 15:38








  • 1




    Because the width of column 2-3 (is bigger).
    – Bobyandbob
    Mar 4 '17 at 15:43
















5














Please look at this table:



enter image description here



1) I don't understand why the line cmidrule(lr){2-3} does not go right above the start of "Advertisement".



2) I don't understand why the 69% is not aligned with the 3 values above.



Can someone please help me correct these two points?



This is my code (I include my full preamble in case it's because of a conflict between packages):



documentclass[12pt]{article}
usepackage{setspace,amsmath,graphicx,float}
usepackage[english]{babel}
usepackage[natbibapa]{apacite}
usepackage{boldline}
usepackage{array}
usepackage{ragged2e}
usepackage{url}
usepackage{fancyhdr}
usepackage{changepage}
usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
usepackage{newtxtext, newtxmath}
usepackage{eurosym}
usepackage{nameref}
usepackage[nottoc]{tocbibind}
usepackage[bottom]{footmisc}
edefrestoreparindent{parindent=theparindentrelax}
usepackage{parskip}
usepackage{enumitem}
usepackage{tabularx}
usepackage{threeparttable}
usepackage{color}
usepackage{tikz}
usetikzlibrary{arrows, arrows.meta, calc, positioning, quotes, shapes, patterns}
usepackage[margin=1cm]{caption}
captionsetup[figure]{skip=18pt}
usepackage[labelfont=bf]{caption}
usepackage{etoolbox}
usepackage{multirow}
usepackage{booktabs}
usepackage{amssymb}
usepackage{nccmath}

begin{document}
begin{table}[h]
caption[Gross profit ratio for Axel Springer and ProSiebenSat.1]{Gross profit ratio for Axel Springer and ProSiebenSat.1 per side.}
centering
begin{threeparttable}
begin{tabular*}{textwidth}{l@{extracolsep{fill}} c c c c}
toprule
& multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c}{ProSiebenSat.1} \
cmidrule(lr){2-3} cmidrule(lr){4-5}
& Advertisement & Circulation & Advertisement & Viewers \
midrule
Revenue (A) & 1,089 & 1,313 & 1834 & 0 \[1ex]
Variable costs (B) & 338 & 407 & 1265 & 0 \[1ex]
Gross profit (A - B) & 751 & 906 & 569 & 0 \[1ex]
Gross profit ratio (A - B) / A & 69% & 69% & 31% & - \
bottomrule
end{tabular*}
begin{tablenotes}
raggedright
item textit{Note}: Adapted from Axel Springer and ProSiebenSat.1's income statement in 2004. All numbers in million Euro.
end{tablenotes}
end{threeparttable}
end{table}

end{document}









share|improve this question


















  • 2




    You've asked LaTeX not to do those things. cmidrule with (lr) will not fill the entire column width; try removing the (lr). The column with 69% you've asked to be centered.
    – Hugh
    Mar 4 '17 at 15:22






  • 1




    Delete (lr) for full line and replace {l@{extracolsep{fill}} c c c c } with {l@{extracolsep{fill}} l l l l} or {l@{extracolsep{fill}} r r r r} for aligning.
    – Bobyandbob
    Mar 4 '17 at 15:38










  • Ohh, got it thank you! Just something else I don't understand: When I remove (lr) from the left group, and write instead (r), everything looks as I want. However, as you can see above, the right group has the (lr) in it and looks fine. Why is that?
    – Malganas
    Mar 4 '17 at 15:38








  • 1




    Because the width of column 2-3 (is bigger).
    – Bobyandbob
    Mar 4 '17 at 15:43














5












5








5


1





Please look at this table:



enter image description here



1) I don't understand why the line cmidrule(lr){2-3} does not go right above the start of "Advertisement".



2) I don't understand why the 69% is not aligned with the 3 values above.



Can someone please help me correct these two points?



This is my code (I include my full preamble in case it's because of a conflict between packages):



documentclass[12pt]{article}
usepackage{setspace,amsmath,graphicx,float}
usepackage[english]{babel}
usepackage[natbibapa]{apacite}
usepackage{boldline}
usepackage{array}
usepackage{ragged2e}
usepackage{url}
usepackage{fancyhdr}
usepackage{changepage}
usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
usepackage{newtxtext, newtxmath}
usepackage{eurosym}
usepackage{nameref}
usepackage[nottoc]{tocbibind}
usepackage[bottom]{footmisc}
edefrestoreparindent{parindent=theparindentrelax}
usepackage{parskip}
usepackage{enumitem}
usepackage{tabularx}
usepackage{threeparttable}
usepackage{color}
usepackage{tikz}
usetikzlibrary{arrows, arrows.meta, calc, positioning, quotes, shapes, patterns}
usepackage[margin=1cm]{caption}
captionsetup[figure]{skip=18pt}
usepackage[labelfont=bf]{caption}
usepackage{etoolbox}
usepackage{multirow}
usepackage{booktabs}
usepackage{amssymb}
usepackage{nccmath}

begin{document}
begin{table}[h]
caption[Gross profit ratio for Axel Springer and ProSiebenSat.1]{Gross profit ratio for Axel Springer and ProSiebenSat.1 per side.}
centering
begin{threeparttable}
begin{tabular*}{textwidth}{l@{extracolsep{fill}} c c c c}
toprule
& multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c}{ProSiebenSat.1} \
cmidrule(lr){2-3} cmidrule(lr){4-5}
& Advertisement & Circulation & Advertisement & Viewers \
midrule
Revenue (A) & 1,089 & 1,313 & 1834 & 0 \[1ex]
Variable costs (B) & 338 & 407 & 1265 & 0 \[1ex]
Gross profit (A - B) & 751 & 906 & 569 & 0 \[1ex]
Gross profit ratio (A - B) / A & 69% & 69% & 31% & - \
bottomrule
end{tabular*}
begin{tablenotes}
raggedright
item textit{Note}: Adapted from Axel Springer and ProSiebenSat.1's income statement in 2004. All numbers in million Euro.
end{tablenotes}
end{threeparttable}
end{table}

end{document}









share|improve this question













Please look at this table:



enter image description here



1) I don't understand why the line cmidrule(lr){2-3} does not go right above the start of "Advertisement".



2) I don't understand why the 69% is not aligned with the 3 values above.



Can someone please help me correct these two points?



This is my code (I include my full preamble in case it's because of a conflict between packages):



documentclass[12pt]{article}
usepackage{setspace,amsmath,graphicx,float}
usepackage[english]{babel}
usepackage[natbibapa]{apacite}
usepackage{boldline}
usepackage{array}
usepackage{ragged2e}
usepackage{url}
usepackage{fancyhdr}
usepackage{changepage}
usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
usepackage{newtxtext, newtxmath}
usepackage{eurosym}
usepackage{nameref}
usepackage[nottoc]{tocbibind}
usepackage[bottom]{footmisc}
edefrestoreparindent{parindent=theparindentrelax}
usepackage{parskip}
usepackage{enumitem}
usepackage{tabularx}
usepackage{threeparttable}
usepackage{color}
usepackage{tikz}
usetikzlibrary{arrows, arrows.meta, calc, positioning, quotes, shapes, patterns}
usepackage[margin=1cm]{caption}
captionsetup[figure]{skip=18pt}
usepackage[labelfont=bf]{caption}
usepackage{etoolbox}
usepackage{multirow}
usepackage{booktabs}
usepackage{amssymb}
usepackage{nccmath}

begin{document}
begin{table}[h]
caption[Gross profit ratio for Axel Springer and ProSiebenSat.1]{Gross profit ratio for Axel Springer and ProSiebenSat.1 per side.}
centering
begin{threeparttable}
begin{tabular*}{textwidth}{l@{extracolsep{fill}} c c c c}
toprule
& multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c}{ProSiebenSat.1} \
cmidrule(lr){2-3} cmidrule(lr){4-5}
& Advertisement & Circulation & Advertisement & Viewers \
midrule
Revenue (A) & 1,089 & 1,313 & 1834 & 0 \[1ex]
Variable costs (B) & 338 & 407 & 1265 & 0 \[1ex]
Gross profit (A - B) & 751 & 906 & 569 & 0 \[1ex]
Gross profit ratio (A - B) / A & 69% & 69% & 31% & - \
bottomrule
end{tabular*}
begin{tablenotes}
raggedright
item textit{Note}: Adapted from Axel Springer and ProSiebenSat.1's income statement in 2004. All numbers in million Euro.
end{tablenotes}
end{threeparttable}
end{table}

end{document}






vertical-alignment booktabs






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 4 '17 at 15:18









Malganas

153112




153112








  • 2




    You've asked LaTeX not to do those things. cmidrule with (lr) will not fill the entire column width; try removing the (lr). The column with 69% you've asked to be centered.
    – Hugh
    Mar 4 '17 at 15:22






  • 1




    Delete (lr) for full line and replace {l@{extracolsep{fill}} c c c c } with {l@{extracolsep{fill}} l l l l} or {l@{extracolsep{fill}} r r r r} for aligning.
    – Bobyandbob
    Mar 4 '17 at 15:38










  • Ohh, got it thank you! Just something else I don't understand: When I remove (lr) from the left group, and write instead (r), everything looks as I want. However, as you can see above, the right group has the (lr) in it and looks fine. Why is that?
    – Malganas
    Mar 4 '17 at 15:38








  • 1




    Because the width of column 2-3 (is bigger).
    – Bobyandbob
    Mar 4 '17 at 15:43














  • 2




    You've asked LaTeX not to do those things. cmidrule with (lr) will not fill the entire column width; try removing the (lr). The column with 69% you've asked to be centered.
    – Hugh
    Mar 4 '17 at 15:22






  • 1




    Delete (lr) for full line and replace {l@{extracolsep{fill}} c c c c } with {l@{extracolsep{fill}} l l l l} or {l@{extracolsep{fill}} r r r r} for aligning.
    – Bobyandbob
    Mar 4 '17 at 15:38










  • Ohh, got it thank you! Just something else I don't understand: When I remove (lr) from the left group, and write instead (r), everything looks as I want. However, as you can see above, the right group has the (lr) in it and looks fine. Why is that?
    – Malganas
    Mar 4 '17 at 15:38








  • 1




    Because the width of column 2-3 (is bigger).
    – Bobyandbob
    Mar 4 '17 at 15:43








2




2




You've asked LaTeX not to do those things. cmidrule with (lr) will not fill the entire column width; try removing the (lr). The column with 69% you've asked to be centered.
– Hugh
Mar 4 '17 at 15:22




You've asked LaTeX not to do those things. cmidrule with (lr) will not fill the entire column width; try removing the (lr). The column with 69% you've asked to be centered.
– Hugh
Mar 4 '17 at 15:22




1




1




Delete (lr) for full line and replace {l@{extracolsep{fill}} c c c c } with {l@{extracolsep{fill}} l l l l} or {l@{extracolsep{fill}} r r r r} for aligning.
– Bobyandbob
Mar 4 '17 at 15:38




Delete (lr) for full line and replace {l@{extracolsep{fill}} c c c c } with {l@{extracolsep{fill}} l l l l} or {l@{extracolsep{fill}} r r r r} for aligning.
– Bobyandbob
Mar 4 '17 at 15:38












Ohh, got it thank you! Just something else I don't understand: When I remove (lr) from the left group, and write instead (r), everything looks as I want. However, as you can see above, the right group has the (lr) in it and looks fine. Why is that?
– Malganas
Mar 4 '17 at 15:38






Ohh, got it thank you! Just something else I don't understand: When I remove (lr) from the left group, and write instead (r), everything looks as I want. However, as you can see above, the right group has the (lr) in it and looks fine. Why is that?
– Malganas
Mar 4 '17 at 15:38






1




1




Because the width of column 2-3 (is bigger).
– Bobyandbob
Mar 4 '17 at 15:43




Because the width of column 2-3 (is bigger).
– Bobyandbob
Mar 4 '17 at 15:43










2 Answers
2






active

oldest

votes


















4














You're misplacing extracolsep{fill}:



documentclass[12pt]{article}
usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
usepackage{newtxtext, newtxmath}
usepackage{threeparttable}
usepackage{booktabs}

begin{document}

begin{table}[h]

caption[Gross profit ratio for Axel Springer and ProSiebenSat.1]
{Gross profit ratio for Axel Springer and ProSiebenSat.1 per side.}

begin{threeparttable}
begin{tabular*}{textwidth}{
@{extracolsep{fill}hspace{tabcolsep}}
l
c
c
c
c
@{hspace{tabcolsep}}
}
toprule
& multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c}{ProSiebenSat.1} \
cmidrule(lr){2-3} cmidrule(lr){4-5}
& Advertisement & Circulation & Advertisement & Viewers \
midrule
Revenue (A) & 1,089 & 1,313 & 1834 & 0 \
addlinespace
Variable costs (B) & 338 & 407 & 1265 & 0 \
addlinespace
Gross profit (A - B) & 751 & 906 & 569 & 0 \
addlinespace
Gross profit ratio (A - B) / A & 69% & 69% & 31% & -- \
bottomrule
end{tabular*}
begin{tablenotes}
raggedright
item textit{Note}: Adapted from Axel Springer and ProSiebenSat.1's income statement
in 2004. All numbers in million Euro.
end{tablenotes}
end{threeparttable}
end{table}

end{document}


(I changed the hyphen into an en-dash.)



enter image description here



Probably I'd omit the padding at the left and right. Here's the code just for the tabular; not that the second cmidrule should only be trimmed at the left and that the second multicolumn should have c@{}.



begin{tabular*}{textwidth}{
@{extracolsep{fill}}
l
c
c
c
c
@{}
}
toprule
& multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c@{}}{ProSiebenSat.1} \
cmidrule(lr){2-3} cmidrule(l){4-5}
& Advertisement & Circulation & Advertisement & Viewers \
midrule
Revenue (A) & 1,089 & 1,313 & 1834 & 0 \
addlinespace
Variable costs (B) & 338 & 407 & 1265 & 0 \
addlinespace
Gross profit (A - B) & 751 & 906 & 569 & 0 \
addlinespace
Gross profit ratio (A - B) / A & 69% & 69% & 31% & -- \
bottomrule
end{tabular*}


enter image description here






share|improve this answer





















  • Sorry for the delay, needed some time to see what you mean with "padding". Thank you, this worked!
    – Malganas
    Mar 4 '17 at 15:49



















0














When working with tabular* environments along with @{extracolsep{fill}} statements, I almost invariably find that it's best to set the length variable tabcolsep to 0pt. That way, LaTeX is given maximal freedom to find the optimal amount of intercolumn whitespace. A very nice side-effect of this approach is that it becomes unnecessary to apply any left- and/or right-hand trimming of lines drawn via cmidrule.



Another comment: To increase the readability of the table contents, it would be useful to align the numbers on their (implicit) decimal markers rather than center them. This observation is applied to the first three data columns of the code shown below.



enter image description here



documentclass[12pt]{article}
%% I've omitted all preamble instructions that aren't relevant for the example at hand.
usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
usepackage{newtxtext,newtxmath}
usepackage[margin=1cm,labelfont=bf]{caption}
captionsetup[figure]{skip=18pt}
usepackage{booktabs}
usepackage{siunitx}

begin{document}
begin{table}[h!]
sisetup{table-format=4.0,group-minimum-digits=4,group-separator={,}} % <-- new
setlengthtabcolsep{0pt} % <-- new

caption[Gross profit ratio for Axel Springer and ProSiebenSat.1]{%
Gross profit ratio for Axel Springer and ProSiebenSat.1 per side.}
%centering %% redundant
begin{tabular*}{textwidth}{@{extracolsep{fill}} lSSSc}
toprule
& multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c}{ProSiebenSat.1} \
cmidrule{2-3} cmidrule{4-5} % no trimming necessary
& {Advertisement} & {Circulation} & {Advertisement} & Viewers \
midrule
Revenue $(A)$ & 1089 & 1313 & 1834 & 0 \[1ex]
Variable costs $(B)$ & 338 & 407 & 1265 & 0 \[1ex]
Gross profit $(A - B)$ & 751 & 906 & 569 & 0 \[1ex]
Gross profit ratio $(A-B)/A$ &{69%}&{69%}&{31%}& {--}\
bottomrule
end{tabular*}

medskipraggedrightfootnotesize
textit{Note}: Adapted from Axel Springer and ProSiebenSat.1's
income statement in 2004. All numbers in million euro.
end{table}
end{document}




share





















    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%2f356853%2ftable-cmidrule-alignment-problem%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









    4














    You're misplacing extracolsep{fill}:



    documentclass[12pt]{article}
    usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
    usepackage{newtxtext, newtxmath}
    usepackage{threeparttable}
    usepackage{booktabs}

    begin{document}

    begin{table}[h]

    caption[Gross profit ratio for Axel Springer and ProSiebenSat.1]
    {Gross profit ratio for Axel Springer and ProSiebenSat.1 per side.}

    begin{threeparttable}
    begin{tabular*}{textwidth}{
    @{extracolsep{fill}hspace{tabcolsep}}
    l
    c
    c
    c
    c
    @{hspace{tabcolsep}}
    }
    toprule
    & multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c}{ProSiebenSat.1} \
    cmidrule(lr){2-3} cmidrule(lr){4-5}
    & Advertisement & Circulation & Advertisement & Viewers \
    midrule
    Revenue (A) & 1,089 & 1,313 & 1834 & 0 \
    addlinespace
    Variable costs (B) & 338 & 407 & 1265 & 0 \
    addlinespace
    Gross profit (A - B) & 751 & 906 & 569 & 0 \
    addlinespace
    Gross profit ratio (A - B) / A & 69% & 69% & 31% & -- \
    bottomrule
    end{tabular*}
    begin{tablenotes}
    raggedright
    item textit{Note}: Adapted from Axel Springer and ProSiebenSat.1's income statement
    in 2004. All numbers in million Euro.
    end{tablenotes}
    end{threeparttable}
    end{table}

    end{document}


    (I changed the hyphen into an en-dash.)



    enter image description here



    Probably I'd omit the padding at the left and right. Here's the code just for the tabular; not that the second cmidrule should only be trimmed at the left and that the second multicolumn should have c@{}.



    begin{tabular*}{textwidth}{
    @{extracolsep{fill}}
    l
    c
    c
    c
    c
    @{}
    }
    toprule
    & multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c@{}}{ProSiebenSat.1} \
    cmidrule(lr){2-3} cmidrule(l){4-5}
    & Advertisement & Circulation & Advertisement & Viewers \
    midrule
    Revenue (A) & 1,089 & 1,313 & 1834 & 0 \
    addlinespace
    Variable costs (B) & 338 & 407 & 1265 & 0 \
    addlinespace
    Gross profit (A - B) & 751 & 906 & 569 & 0 \
    addlinespace
    Gross profit ratio (A - B) / A & 69% & 69% & 31% & -- \
    bottomrule
    end{tabular*}


    enter image description here






    share|improve this answer





















    • Sorry for the delay, needed some time to see what you mean with "padding". Thank you, this worked!
      – Malganas
      Mar 4 '17 at 15:49
















    4














    You're misplacing extracolsep{fill}:



    documentclass[12pt]{article}
    usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
    usepackage{newtxtext, newtxmath}
    usepackage{threeparttable}
    usepackage{booktabs}

    begin{document}

    begin{table}[h]

    caption[Gross profit ratio for Axel Springer and ProSiebenSat.1]
    {Gross profit ratio for Axel Springer and ProSiebenSat.1 per side.}

    begin{threeparttable}
    begin{tabular*}{textwidth}{
    @{extracolsep{fill}hspace{tabcolsep}}
    l
    c
    c
    c
    c
    @{hspace{tabcolsep}}
    }
    toprule
    & multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c}{ProSiebenSat.1} \
    cmidrule(lr){2-3} cmidrule(lr){4-5}
    & Advertisement & Circulation & Advertisement & Viewers \
    midrule
    Revenue (A) & 1,089 & 1,313 & 1834 & 0 \
    addlinespace
    Variable costs (B) & 338 & 407 & 1265 & 0 \
    addlinespace
    Gross profit (A - B) & 751 & 906 & 569 & 0 \
    addlinespace
    Gross profit ratio (A - B) / A & 69% & 69% & 31% & -- \
    bottomrule
    end{tabular*}
    begin{tablenotes}
    raggedright
    item textit{Note}: Adapted from Axel Springer and ProSiebenSat.1's income statement
    in 2004. All numbers in million Euro.
    end{tablenotes}
    end{threeparttable}
    end{table}

    end{document}


    (I changed the hyphen into an en-dash.)



    enter image description here



    Probably I'd omit the padding at the left and right. Here's the code just for the tabular; not that the second cmidrule should only be trimmed at the left and that the second multicolumn should have c@{}.



    begin{tabular*}{textwidth}{
    @{extracolsep{fill}}
    l
    c
    c
    c
    c
    @{}
    }
    toprule
    & multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c@{}}{ProSiebenSat.1} \
    cmidrule(lr){2-3} cmidrule(l){4-5}
    & Advertisement & Circulation & Advertisement & Viewers \
    midrule
    Revenue (A) & 1,089 & 1,313 & 1834 & 0 \
    addlinespace
    Variable costs (B) & 338 & 407 & 1265 & 0 \
    addlinespace
    Gross profit (A - B) & 751 & 906 & 569 & 0 \
    addlinespace
    Gross profit ratio (A - B) / A & 69% & 69% & 31% & -- \
    bottomrule
    end{tabular*}


    enter image description here






    share|improve this answer





















    • Sorry for the delay, needed some time to see what you mean with "padding". Thank you, this worked!
      – Malganas
      Mar 4 '17 at 15:49














    4












    4








    4






    You're misplacing extracolsep{fill}:



    documentclass[12pt]{article}
    usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
    usepackage{newtxtext, newtxmath}
    usepackage{threeparttable}
    usepackage{booktabs}

    begin{document}

    begin{table}[h]

    caption[Gross profit ratio for Axel Springer and ProSiebenSat.1]
    {Gross profit ratio for Axel Springer and ProSiebenSat.1 per side.}

    begin{threeparttable}
    begin{tabular*}{textwidth}{
    @{extracolsep{fill}hspace{tabcolsep}}
    l
    c
    c
    c
    c
    @{hspace{tabcolsep}}
    }
    toprule
    & multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c}{ProSiebenSat.1} \
    cmidrule(lr){2-3} cmidrule(lr){4-5}
    & Advertisement & Circulation & Advertisement & Viewers \
    midrule
    Revenue (A) & 1,089 & 1,313 & 1834 & 0 \
    addlinespace
    Variable costs (B) & 338 & 407 & 1265 & 0 \
    addlinespace
    Gross profit (A - B) & 751 & 906 & 569 & 0 \
    addlinespace
    Gross profit ratio (A - B) / A & 69% & 69% & 31% & -- \
    bottomrule
    end{tabular*}
    begin{tablenotes}
    raggedright
    item textit{Note}: Adapted from Axel Springer and ProSiebenSat.1's income statement
    in 2004. All numbers in million Euro.
    end{tablenotes}
    end{threeparttable}
    end{table}

    end{document}


    (I changed the hyphen into an en-dash.)



    enter image description here



    Probably I'd omit the padding at the left and right. Here's the code just for the tabular; not that the second cmidrule should only be trimmed at the left and that the second multicolumn should have c@{}.



    begin{tabular*}{textwidth}{
    @{extracolsep{fill}}
    l
    c
    c
    c
    c
    @{}
    }
    toprule
    & multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c@{}}{ProSiebenSat.1} \
    cmidrule(lr){2-3} cmidrule(l){4-5}
    & Advertisement & Circulation & Advertisement & Viewers \
    midrule
    Revenue (A) & 1,089 & 1,313 & 1834 & 0 \
    addlinespace
    Variable costs (B) & 338 & 407 & 1265 & 0 \
    addlinespace
    Gross profit (A - B) & 751 & 906 & 569 & 0 \
    addlinespace
    Gross profit ratio (A - B) / A & 69% & 69% & 31% & -- \
    bottomrule
    end{tabular*}


    enter image description here






    share|improve this answer












    You're misplacing extracolsep{fill}:



    documentclass[12pt]{article}
    usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
    usepackage{newtxtext, newtxmath}
    usepackage{threeparttable}
    usepackage{booktabs}

    begin{document}

    begin{table}[h]

    caption[Gross profit ratio for Axel Springer and ProSiebenSat.1]
    {Gross profit ratio for Axel Springer and ProSiebenSat.1 per side.}

    begin{threeparttable}
    begin{tabular*}{textwidth}{
    @{extracolsep{fill}hspace{tabcolsep}}
    l
    c
    c
    c
    c
    @{hspace{tabcolsep}}
    }
    toprule
    & multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c}{ProSiebenSat.1} \
    cmidrule(lr){2-3} cmidrule(lr){4-5}
    & Advertisement & Circulation & Advertisement & Viewers \
    midrule
    Revenue (A) & 1,089 & 1,313 & 1834 & 0 \
    addlinespace
    Variable costs (B) & 338 & 407 & 1265 & 0 \
    addlinespace
    Gross profit (A - B) & 751 & 906 & 569 & 0 \
    addlinespace
    Gross profit ratio (A - B) / A & 69% & 69% & 31% & -- \
    bottomrule
    end{tabular*}
    begin{tablenotes}
    raggedright
    item textit{Note}: Adapted from Axel Springer and ProSiebenSat.1's income statement
    in 2004. All numbers in million Euro.
    end{tablenotes}
    end{threeparttable}
    end{table}

    end{document}


    (I changed the hyphen into an en-dash.)



    enter image description here



    Probably I'd omit the padding at the left and right. Here's the code just for the tabular; not that the second cmidrule should only be trimmed at the left and that the second multicolumn should have c@{}.



    begin{tabular*}{textwidth}{
    @{extracolsep{fill}}
    l
    c
    c
    c
    c
    @{}
    }
    toprule
    & multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c@{}}{ProSiebenSat.1} \
    cmidrule(lr){2-3} cmidrule(l){4-5}
    & Advertisement & Circulation & Advertisement & Viewers \
    midrule
    Revenue (A) & 1,089 & 1,313 & 1834 & 0 \
    addlinespace
    Variable costs (B) & 338 & 407 & 1265 & 0 \
    addlinespace
    Gross profit (A - B) & 751 & 906 & 569 & 0 \
    addlinespace
    Gross profit ratio (A - B) / A & 69% & 69% & 31% & -- \
    bottomrule
    end{tabular*}


    enter image description here







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 4 '17 at 15:39









    egreg

    708k8618823164




    708k8618823164












    • Sorry for the delay, needed some time to see what you mean with "padding". Thank you, this worked!
      – Malganas
      Mar 4 '17 at 15:49


















    • Sorry for the delay, needed some time to see what you mean with "padding". Thank you, this worked!
      – Malganas
      Mar 4 '17 at 15:49
















    Sorry for the delay, needed some time to see what you mean with "padding". Thank you, this worked!
    – Malganas
    Mar 4 '17 at 15:49




    Sorry for the delay, needed some time to see what you mean with "padding". Thank you, this worked!
    – Malganas
    Mar 4 '17 at 15:49











    0














    When working with tabular* environments along with @{extracolsep{fill}} statements, I almost invariably find that it's best to set the length variable tabcolsep to 0pt. That way, LaTeX is given maximal freedom to find the optimal amount of intercolumn whitespace. A very nice side-effect of this approach is that it becomes unnecessary to apply any left- and/or right-hand trimming of lines drawn via cmidrule.



    Another comment: To increase the readability of the table contents, it would be useful to align the numbers on their (implicit) decimal markers rather than center them. This observation is applied to the first three data columns of the code shown below.



    enter image description here



    documentclass[12pt]{article}
    %% I've omitted all preamble instructions that aren't relevant for the example at hand.
    usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
    usepackage{newtxtext,newtxmath}
    usepackage[margin=1cm,labelfont=bf]{caption}
    captionsetup[figure]{skip=18pt}
    usepackage{booktabs}
    usepackage{siunitx}

    begin{document}
    begin{table}[h!]
    sisetup{table-format=4.0,group-minimum-digits=4,group-separator={,}} % <-- new
    setlengthtabcolsep{0pt} % <-- new

    caption[Gross profit ratio for Axel Springer and ProSiebenSat.1]{%
    Gross profit ratio for Axel Springer and ProSiebenSat.1 per side.}
    %centering %% redundant
    begin{tabular*}{textwidth}{@{extracolsep{fill}} lSSSc}
    toprule
    & multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c}{ProSiebenSat.1} \
    cmidrule{2-3} cmidrule{4-5} % no trimming necessary
    & {Advertisement} & {Circulation} & {Advertisement} & Viewers \
    midrule
    Revenue $(A)$ & 1089 & 1313 & 1834 & 0 \[1ex]
    Variable costs $(B)$ & 338 & 407 & 1265 & 0 \[1ex]
    Gross profit $(A - B)$ & 751 & 906 & 569 & 0 \[1ex]
    Gross profit ratio $(A-B)/A$ &{69%}&{69%}&{31%}& {--}\
    bottomrule
    end{tabular*}

    medskipraggedrightfootnotesize
    textit{Note}: Adapted from Axel Springer and ProSiebenSat.1's
    income statement in 2004. All numbers in million euro.
    end{table}
    end{document}




    share


























      0














      When working with tabular* environments along with @{extracolsep{fill}} statements, I almost invariably find that it's best to set the length variable tabcolsep to 0pt. That way, LaTeX is given maximal freedom to find the optimal amount of intercolumn whitespace. A very nice side-effect of this approach is that it becomes unnecessary to apply any left- and/or right-hand trimming of lines drawn via cmidrule.



      Another comment: To increase the readability of the table contents, it would be useful to align the numbers on their (implicit) decimal markers rather than center them. This observation is applied to the first three data columns of the code shown below.



      enter image description here



      documentclass[12pt]{article}
      %% I've omitted all preamble instructions that aren't relevant for the example at hand.
      usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
      usepackage{newtxtext,newtxmath}
      usepackage[margin=1cm,labelfont=bf]{caption}
      captionsetup[figure]{skip=18pt}
      usepackage{booktabs}
      usepackage{siunitx}

      begin{document}
      begin{table}[h!]
      sisetup{table-format=4.0,group-minimum-digits=4,group-separator={,}} % <-- new
      setlengthtabcolsep{0pt} % <-- new

      caption[Gross profit ratio for Axel Springer and ProSiebenSat.1]{%
      Gross profit ratio for Axel Springer and ProSiebenSat.1 per side.}
      %centering %% redundant
      begin{tabular*}{textwidth}{@{extracolsep{fill}} lSSSc}
      toprule
      & multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c}{ProSiebenSat.1} \
      cmidrule{2-3} cmidrule{4-5} % no trimming necessary
      & {Advertisement} & {Circulation} & {Advertisement} & Viewers \
      midrule
      Revenue $(A)$ & 1089 & 1313 & 1834 & 0 \[1ex]
      Variable costs $(B)$ & 338 & 407 & 1265 & 0 \[1ex]
      Gross profit $(A - B)$ & 751 & 906 & 569 & 0 \[1ex]
      Gross profit ratio $(A-B)/A$ &{69%}&{69%}&{31%}& {--}\
      bottomrule
      end{tabular*}

      medskipraggedrightfootnotesize
      textit{Note}: Adapted from Axel Springer and ProSiebenSat.1's
      income statement in 2004. All numbers in million euro.
      end{table}
      end{document}




      share
























        0












        0








        0






        When working with tabular* environments along with @{extracolsep{fill}} statements, I almost invariably find that it's best to set the length variable tabcolsep to 0pt. That way, LaTeX is given maximal freedom to find the optimal amount of intercolumn whitespace. A very nice side-effect of this approach is that it becomes unnecessary to apply any left- and/or right-hand trimming of lines drawn via cmidrule.



        Another comment: To increase the readability of the table contents, it would be useful to align the numbers on their (implicit) decimal markers rather than center them. This observation is applied to the first three data columns of the code shown below.



        enter image description here



        documentclass[12pt]{article}
        %% I've omitted all preamble instructions that aren't relevant for the example at hand.
        usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
        usepackage{newtxtext,newtxmath}
        usepackage[margin=1cm,labelfont=bf]{caption}
        captionsetup[figure]{skip=18pt}
        usepackage{booktabs}
        usepackage{siunitx}

        begin{document}
        begin{table}[h!]
        sisetup{table-format=4.0,group-minimum-digits=4,group-separator={,}} % <-- new
        setlengthtabcolsep{0pt} % <-- new

        caption[Gross profit ratio for Axel Springer and ProSiebenSat.1]{%
        Gross profit ratio for Axel Springer and ProSiebenSat.1 per side.}
        %centering %% redundant
        begin{tabular*}{textwidth}{@{extracolsep{fill}} lSSSc}
        toprule
        & multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c}{ProSiebenSat.1} \
        cmidrule{2-3} cmidrule{4-5} % no trimming necessary
        & {Advertisement} & {Circulation} & {Advertisement} & Viewers \
        midrule
        Revenue $(A)$ & 1089 & 1313 & 1834 & 0 \[1ex]
        Variable costs $(B)$ & 338 & 407 & 1265 & 0 \[1ex]
        Gross profit $(A - B)$ & 751 & 906 & 569 & 0 \[1ex]
        Gross profit ratio $(A-B)/A$ &{69%}&{69%}&{31%}& {--}\
        bottomrule
        end{tabular*}

        medskipraggedrightfootnotesize
        textit{Note}: Adapted from Axel Springer and ProSiebenSat.1's
        income statement in 2004. All numbers in million euro.
        end{table}
        end{document}




        share












        When working with tabular* environments along with @{extracolsep{fill}} statements, I almost invariably find that it's best to set the length variable tabcolsep to 0pt. That way, LaTeX is given maximal freedom to find the optimal amount of intercolumn whitespace. A very nice side-effect of this approach is that it becomes unnecessary to apply any left- and/or right-hand trimming of lines drawn via cmidrule.



        Another comment: To increase the readability of the table contents, it would be useful to align the numbers on their (implicit) decimal markers rather than center them. This observation is applied to the first three data columns of the code shown below.



        enter image description here



        documentclass[12pt]{article}
        %% I've omitted all preamble instructions that aren't relevant for the example at hand.
        usepackage[left=3cm,top=3.5cm,right=2.5cm,bottom=2.5cm]{geometry}
        usepackage{newtxtext,newtxmath}
        usepackage[margin=1cm,labelfont=bf]{caption}
        captionsetup[figure]{skip=18pt}
        usepackage{booktabs}
        usepackage{siunitx}

        begin{document}
        begin{table}[h!]
        sisetup{table-format=4.0,group-minimum-digits=4,group-separator={,}} % <-- new
        setlengthtabcolsep{0pt} % <-- new

        caption[Gross profit ratio for Axel Springer and ProSiebenSat.1]{%
        Gross profit ratio for Axel Springer and ProSiebenSat.1 per side.}
        %centering %% redundant
        begin{tabular*}{textwidth}{@{extracolsep{fill}} lSSSc}
        toprule
        & multicolumn{2}{c}{Axel Springer} & multicolumn{2}{c}{ProSiebenSat.1} \
        cmidrule{2-3} cmidrule{4-5} % no trimming necessary
        & {Advertisement} & {Circulation} & {Advertisement} & Viewers \
        midrule
        Revenue $(A)$ & 1089 & 1313 & 1834 & 0 \[1ex]
        Variable costs $(B)$ & 338 & 407 & 1265 & 0 \[1ex]
        Gross profit $(A - B)$ & 751 & 906 & 569 & 0 \[1ex]
        Gross profit ratio $(A-B)/A$ &{69%}&{69%}&{31%}& {--}\
        bottomrule
        end{tabular*}

        medskipraggedrightfootnotesize
        textit{Note}: Adapted from Axel Springer and ProSiebenSat.1's
        income statement in 2004. All numbers in million euro.
        end{table}
        end{document}





        share











        share


        share










        answered 2 mins ago









        Mico

        273k30369756




        273k30369756






























            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%2f356853%2ftable-cmidrule-alignment-problem%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

            Entries order in /etc/network/interfaces

            新発田市

            Grub takes very long (several minutes) to open Menu (in Multi-Boot-System)