将 tabu/tabularx 和 threeparttable 与 apa6 结合使用

将 tabu/tabularx 和 threeparttable 与 apa6 结合使用

我正在尝试使用之前发布的解决方案这里它结合了tabu和,threeparttable以便根据拉伸表格列\textwidth。但是,当我将文章类更改为apa6较早的解决方案时,就会出现错误。

\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}

错误如下:

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

我的问题:如何在包含表格注释时扩展表格apa6?也就是说,我不受tabuthreeparttable类的约束,但对我来说这似乎是最简单的。


正如作为替代方案所建议的那样,当与和tabularx一起使用时它也会产生编译错误(但仅使用类时不会产生)。threeparttableapa6article

\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}

生成:

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

答案1

使用˙apa6require 在序言中使用\shorttitle{Some title}。如果不需要,只需添加\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}

在此处输入图片描述

相关内容