[Tex/LaTex] Use of tabu/tabularx and threeparttable with apa6

apa6tabutabularxthreeparttable

I am trying to use an earlier solution posted here which combines the tabu and threeparttable to stretch table columns according to \textwidth. However, as soon as I change the article class to apa6 the earlier solution produces errors.

\documentclass[a4paper,floatsintext,man,donotrepeattitle]{apa6}
\usepackage{booktabs}
\usepackage{threeparttable,tabu}

\usepackage{xpatch}
\makeatletter
\chardef\TPT@@@asteriskcatcode=\catcode`*
\catcode`*=11
\xpatchcmd{\threeparttable}
{\TPT@hookin{tabular}}
{\TPT@hookin{tabular}\TPT@hookin{tabu}}
{}{}
\catcode`*=\TPT@@@asteriskcatcode
\makeatother

\begin{document}
\centering
\begin{threeparttable}
    \begin{tabu} to .4\textwidth {XX}
        a & b   \\\toprule
        0 & 1   \\\bottomrule
    \end{tabu}
    \begin{tablenotes}
        \footnotesize
        \item[*] This is a long table note text, long enough to exceed the table's width.
    \end{tablenotes}
\end{threeparttable}

\end{document}

The errors are:

Extra }, or forgotten \endgroup. \end{tabu}
Undefined control sequence. \end{document}

My question: How to stretch a tables with apa6 when also including tablenotes? That is, I am not bound to the tabu or threeparttable class, but it seems easiest to me.


As tabularx was suggested as an alternative, it also produces a compilation error when used together with threeparttable and apa6 (but again not when using only the article class).

\documentclass[a4paper,floatsintext,man,donotrepeattitle]{apa6}
%\documentclass{article}
\usepackage{booktabs}
\usepackage{tabularx,threeparttable}

\begin{document}

\begin{threeparttable}
    \begin{tabularx}{\textwidth} {XX}
        \toprule
        a & b   \\\midrule
        0 & 1   \\\bottomrule
    \end{tabularx}
    \begin{tablenotes}
        \footnotesize
        \item[*] This is a long table note text, long enough to exceed the table's width.
    \end{tablenotes}
\end{threeparttable}

\end{document}

produces:

Undefined control sequence. \end{document}
Underfull \hbox (badness 10000) in alignment

Best Answer

Using ˙apa6 require to use \shorttitle{Some title} in preamble. If you not need it, than it is suffice to add \shorttitle{}:

\documentclass[a4paper,floatsintext,man,donotrepeattitle]{apa6}
\usepackage{booktabs,tabularx,threeparttable}
\shorttitle{}% short title, can be empty but not deleted

\usepackage{lipsum}% only for test purpose

\begin{document}
\lipsum[1]

\begin{center}
\begin{threeparttable}
    \begin{tabularx}{.4\textwidth}{XX}
                    \toprule
        a & b   \\  \midrule
        0 & 1   \\  \bottomrule
    \end{tabularx}
    \begin{tablenotes}
        \footnotesize
        \item[*] This is a long table note text, long enough to exceed the table's width.
    \end{tablenotes}
\end{center}
\end{threeparttable}

\end{document}

enter image description here

Related Question