Please see below for the description!
Asked
Active
Viewed 932 times
0
-
What did you try so far? The column headers can be achieved using a combination of multicolumn and multirow. Thead from the makecell package and the horizontal lines from the booktabs package might also come in handy. – leandriis Jan 24 '20 at 17:32
1 Answers
2
You'd need a very large text width for that.
Here's a proof of concept.
\documentclass{article}
\usepackage[a4paper,margin=2cm]{geometry}
\usepackage{siunitx,booktabs}
\usepackage{newtxtext,newtxmath}
\newcommand{\header}[1]{%
\begin{tabular}[t]{@{}c@{}}#1\end{tabular}%
}
\newcommand{\theader}[1]{\smash{\header{#1}}}
\begin{document}
\begin{table}
\setlength{\tabcolsep}{0pt}
\small
\caption{Sources of Growth Rate Differences (\%)\label{SGRD}}
\medskip
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}}
l
S[table-format=-1.1]
S[table-format=-1.2]
S[table-format=-1.2]
S[table-format=-1.2]
S[table-format=-1.2]
S[table-format=-1.2]
S[table-format=-1.2]
S[table-format=-1.2]
S[table-format=-1.2]
}
\multicolumn{9}{l}{\textbf{Period 2 vs.\ Period 1}}\\
\midrule[\heavyrulewidth]
\multicolumn{1}{c}{\theader{Period 2 vs. \\ Period 1}} &
{\theader{Difference \\ in Growth \\ Rate}} &
\multicolumn{3}{c}{\header{Due to Change in Elasticity \\ of Output with respect to}} &
\multicolumn{3}{c}{\header{Due to Change in \\ Growth Rate of}} &
{\theader{$dy/dx$ \\ oil}} &
{\theader{Local \\ Technical \\ Progress}} \\
\cmidrule{3-5} \cmidrule{6-8}
& & {\header{Tangible \\ Capital}} & {Labor} & {\header{Human \\ Capital}} &
{\header{Tangible \\ Capital}} & {Labor} & {\header{Human \\ Capital}} \\
\midrule
Canada & -1.4 & -0.22 & 0.18 & -0.08 & -0.36 & -0.21 & -0.14 & -0.31 & -0.24 \\
France & -3.1 & \\
W. Germany & -2.9 \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
With \header the cell can be split across rows, I use \theader for the same purpose, but the cells so built do not occupy vertical space due to \smash.
egreg
- 1,121,712
-
Is it possible to have the "smashed" headers aligned at the bottom baseline? If I change the alignment in the definition of
\headerto[b], the smashed header is still aligned at the top. – Sveinung Jan 24 '20 at 19:03 -
@Sveinung Why would you? They belong to the upper level. The alternative would be to vertically center them (which I dislike so much). – egreg Jan 24 '20 at 20:31
-
@Sveinung To be honest, I'd remove the leftmost header, because it's already at the top and abbreviate all other headers, adding a legend at the bottom. – egreg Jan 24 '20 at 22:05
-
Thank you! Is there a way to make this table sideways, and perhaps take the whole length of a horizontal page? – tiffj56 Jan 31 '20 at 16:56
-

