In order to optimize the width of some columns so that the table fits the text, I used \shortstack
. Now, however, I am not satisfied with the look of the header (cf. picture). The header text in the columns in which I used \shortstack
is now too close to the top hline. Furthermore, the headers where I didn't use \shortstack
are not aligned to the top \hline
, which they should. Is there a way to rectify this while using \shortstack
or are there better solutions to adress the width of the columns?
\documentclass[12pt]{report}
\usepackage{tabulary}
\usepackage[maxfloats=30,morefloats=12]{morefloats}
\usepackage{booktabs}
\usepackage{float,lscape}
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{bigstrut}
\begin{document}
\begin{table}[htbp]
\centering
\caption{ETV 1830 - 1930}
\tiny
\begin{tabular}{rrrrrrrrr}
\hline
\multicolumn{1}{c}{\textbf{Year}} & \multicolumn{1}{c}{\textbf{Organizations}} & \multicolumn{1}{c}{\textbf{Associations}} & \multicolumn{1}{c}{\textbf{\shortstack{Paying\\ members}}} & \multicolumn{1}{c}{\textbf{in \% of total}} & \multicolumn{1}{c}{\textbf{\shortstack{Non-paying\\ members}}} & \multicolumn{1}{c}{\textbf{in \% of total}} & \multicolumn{1}{c}{\textbf{\shortstack{Total\\ members}}} & \multicolumn{1}{c}{\textbf{\shortstack{Active\\ members}}} \bigstrut\\
\hline
1830 & - & 2 & - & - & - & - & - & - \bigstrut[t]\\
31-40 & - & 7 & - & - & - & - & - & - \\
\hline
\end{tabular}%
\label{tab:addlabel}%
\end{table}%
\end{document}
Best Answer
In an effort to achieve your desired result with minimum changes to your original code, I added one line and changed another. I first added the line
\usepackage[usestackEOL]{stackengine}
to have access to the\addstackgap
macro. Then, I modified your header row of thetabular
, so that one of the cramped stacks was enclosed in an\addstackgap
, such as\multicolumn{1}{c}{\addstackgap{\textbf{\shortstack{Paying\\ members}}}}
. This applies a 3pt vertical buffer around the object.Furthermore, if you desired the header row top-aligned, you can change every instance of
\shortstack
to\Shortunderstack
(note the capital leading "S"), to obtain: