I want to create a table with different summary statistics. However, the table is too wide for the page, and therefore not the whole table is displayed. This is because of column headers which are quite long and I try to automatically split the column headers to multiple rows so that the whole table gets displayed within the page.
This would be an example:
\documentclass[a4paper,12pt]{article}
\usepackage{booktabs}
\usepackage{threeparttable}
\usepackage{multirow}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\begin{threeparttable}
\caption{Title of table}
\label{Label}
\begin{tabular}{lrrrr}
\toprule
& Long column header 1 & Long column header 2 & Long column header 3 & Long column header 4 \\
\midrule
2013 & 0.00 & 0.00 & 0.00 & 0.00 \\
2014 & 0.00 & 0.00 & 0.00 & 0.00 \\
2015 & 0.00 & 0.00 & 0.00 & 0.00 \\
2016 & 0.00 & 0.00 & 0.00 & 0.00 \\
\bottomrule
\end{tabular}
\begin{tablenotes}[para, flushleft]
\small
Description of table
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
Is there a simple and efficient way to split the long column header into two or three sub rows so that the whole table gets displayed on the page within the text width?
Thanks a lot for your suggestion!
Best Answer
You may easily achieve your formatting objective by replacing the four instances of the
r
column type -- which, as you have (re)discovered, doesn't allow automatic line breaking -- with a centered version of thep
column type and choosing the widths of the four data columns suitably, say,2.5cm
.