\documentclass{article}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{makecell}
\newcommand{\blank}{--}
\begin{document}
\begin{table}[h]
\renewcommand{\arraystretch}{1.2}
\footnotesize\setlength{\tabcolsep}{1pt}
\begin{tabular}{llcccccc}
& & \thead{\bfseries Sessualità} & \thead{\bfseries Temperamento} & \thead{\bfseries Valori} & \thead{\bfseries Comportamento} & \thead{\bfseries Comunicazione \\\bfseries prosociale} & \thead{\bfseries Comunicazione\\ \bfseries non verbale} \\
\midrule
% ROW 1%
\multirow{2}*{\bfseries Sessualità} & Pearson's $r$ & \blank & $\textbf{-0.329$^{***}$}$ & $0.131$ & $\textbf{-0.145$^*$}$ & $0.055$ & $-0.064$\\
& $p$-value & \blank & $<.001$ & $0.070$ & $0.044$ & $0.449$ & $0.378$ \\
% ROW 2%
\multirow{2}*{\bfseries Temperamento} & Pearson's $r$ & & \blank & $-0.094$ & $0.012$ & $-0.063$ & $0.125$\\
& $p$-value & & \blank & $0.189$ & $0.870$ & $0.377$ & $0.082$\\
% ROW 3%
\multirow{2}*{\bfseries Valori} & Pearson's $r$ & & & \blank & $0.035$ & $0.048$ & $0.090$ \\
& $p$-value & & & \blank & $0.624$ & $0.504$ & $0.208$ \\
% ROW 4%
\multirow{2}*{\bfseries Comportamento} & Pearson's $r$ & & & & \blank & $0.094$ & $-0.125$ \\
& $p$-value & & & & \blank & $0.189$ & $0.080$ \\
% ROW 5%
\multirow{2}*{\makecell{\bfseries Comunicazione\\ \bfseries prosociale}} & Pearson's $r$ & & & & & \blank & $0.069$\\
& $p$-value & & & & & \blank & $0.334$\\
% ROW 6%
\multirow{2}*{\makecell{\bfseries Comunicazione\\ \bfseries non verbale}} & Pearson's $r$ & & & & & & \blank \\
& $p$-value & & & & & & \blank \\
\bottomrule
\multicolumn{8}{l}{$^* p<.05, ^{**} p<0.1, ^{***}p<.001$}
\end{tabular}
\caption{Correlazioni tra i fattori}
\label{table:correlazione}
\end{table}
\end{document}
I can't size properly the columns' width so that the table fits to the page. What's the best way to fix it?
Also, apart from the number of columns, the two headers Comunicazione prosociale
and Comunicazione non verbale
seem too wide. I used makecell
to break them. Though, the second lines prosociale
and non verbale
are not even left-aligned ...
Are there any other coding mistake? This table is really driving me crazy ...
siunitx
package to have alignment to the decimal places?