# [Tex/LaTex] Setting up APA-Tables – three problems

apa-styletables

Below, you see a table. The blue boxes display my "problem areas". Setting up tables is pretty difficult for me so far…

Uper left box:
I want to indent Group A/ Group B compared to Overall Group; propably using several stages (like Sex –> Female –> Group A/ Group B)

Lower left box:
I fail to create a legend for my table.

Upper right box:
I want to vertically center those variables like shown there, because the scores are referring to both lines.

This is my attempt, using booktabs and siunitx. I can't typeset table entries midway with respect to a pair of rows; I believe that, in this case, the values of p and t should be aligned with the group entry.

\documentclass[draft]{article}
\usepackage{amsmath,siunitx,booktabs,caption}

\newcommand{\IE}[1][1]{% indent entry
\hspace{#1em}\ignorespaces
}

\begin{document}

\begin{table}[htp]
\centering
\addtolength{\tabcolsep}{3pt} % some more room between columns

\caption{Group Example}

\begin{tabular}{
l
S[table-format=2.0]
S[table-format=2.1]
S[table-format=1.1]
S[table-format=-1.2]
S[table-format=.2,table-comparator=true]
}
\toprule
Variable & {$n$} & {$M$} & {$\mathit{SD}$} & {$t$} & {$p$} \\
\midrule
Overall group  &    &      &     & -3.43 & <0.01 \\
\IE Group A    & 20 & 10.3 & 4.3 \\
\IE Group B    & 30 & 14.3 & 1.4 \\
Sex \\
\IE Female     &    &      &     & -3.43 & <0.01 \\
\IE[2] Group A & 10 & 10.3 & 4.3 \\
\IE[2] Group B & 15 & 14.3 & 1.4 \\
\IE Male       &    &      &     & -3.43 & <0.01 \\
\IE[2] Group A & 10 & 10.3 & 4.3 \\
\IE[2] Group B & 15 & 14.3 & 1.4 \\
\midrule[\heavyrulewidth]
\multicolumn{6}{l}{$M=\text{mean}$, $\mathit{SD}=\text{standard deviation}$}
\end{tabular}

\end{table}

\end{document}