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
tabu
instead oftabularx
? By the way, there's no reason for either, if you just want two columns whose widths sum up to.4\textwidth
.tabu
seemed to be the correct choice. I have no preference whatsoever (other than using theapa6
class).tabu
is almost never the correct choice; I might be biased.\textwidth
(or some proportion of it) without additional packages. I am happy to be proven otherwise. And also happy for solutions involvingtabularx
.\begin{tabular}{p{\dimexpr.2\textwidth-2\tabcolsep}p{\dimexpr.2\textwidth-2\tabcolsep}}
would do.