[Tex/LaTex] Table: \cmidrule alignment problem when working with tabular* environments

booktabstables

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} 
\edef\restoreparindent{\parindent=\the\parindent\relax}
\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} 

Best 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

Related Question