1

I am using the apa6 class. My document has some instances of threeparttable. I can not manage to use \columnwidth to define the tables to match the column-width of my two column article.

I have read here that the APA class redefines \tabular which seems to be the reason for this problem.

Unfortunately I can not transfer the answer to my case of a threeparttable.

I am using another answer to define fix widths for centered columns. But the problem also occurs when I use p{...\columnwidth}.

In the figure environment everything is alright.

The help of a more experienced LaTeX user would be highly appreciated!

My document:

\documentclass[jou, keeplastbox]{apa6}

\usepackage[american]{babel}
\usepackage{csquotes}

%TODO: ensure table width == columnwidth
\usepackage[para]{threeparttable}

\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\title{Title}
\shorttitle{Short Title}
\author{Susurration}
\affiliation{Void}

\abstract{This demonstration paper uses the \textsf{apa6} \LaTeX\
    class to format the document in compliance with the 6th Edition of
    the American Psychological Assocation's \textit{Publication Manual.}
    The references are managed using \textsf{biblatex}.}
\keywords{APA style, demonstration}

\begin{document}
\maketitle

% this looks good but the defintion of widths is not very handy
% furthermore these width definitions seem to be sensitive to table content
\begin{table}[h]
    \begin{threeparttable}
        \caption{Looks good but width definitions are bad}
        \label{tab:stimuli_domain}
        \begin{tabular}{C{0.15\columnwidth}C{0.15\columnwidth}C{0.25\columnwidth}C{0.25\columnwidth}}
            \toprule
            \multicolumn{2}{c}{Cues}        & \multicolumn{2}{c}{Stimuli} \\
            Number\tabfnm{a}    & Validity  & A & B \\
            \midrule
            1       & 0.8       & 1         & 0 \\
            2       & 0.6       & 0         & 0 \\
            3       & 0.75      & 1         & 1 \\
            \midrule
        \end{tabular}
        \begin{tablenotes}[para,flushleft]
            {\small
                \textit{Note.}  Column 3 and Column 4 represent stimuli by assigning binary variables as given in equation \ref{eq:feature_def}.
            }
        \end{tablenotes}
    \end{threeparttable}
\end{table}

% I would like to have this code to make span the table the whole column
\begin{table}[h]
    \begin{threeparttable}
        \caption{Looks bad but should look nice}
        \label{tab:stimuli_domain_}
        \begin{tabular}{C{0.2\columnwidth}C{0.2\columnwidth}C{0.4\columnwidth}C{0.4\columnwidth}}
            \toprule
            \multicolumn{2}{c}{Cues}        & \multicolumn{2}{c}{Stimuli} \\
            Number\tabfnm{a}    & Validity  & A & B \\
            \midrule
            1       & 0.8       & 1         & 0 \\
            2       & 0.6       & 0         & 0 \\
            3       & 0.75      & 1         & 1 \\
            \midrule
        \end{tabular}
        \begin{tablenotes}[para,flushleft]
            {\small
                \textit{Note.}  Column 3 and Column 4 represent stimuli by assigning binary variables as given in equation \ref{eq:feature_def}.
            }
        \end{tablenotes}
    \end{threeparttable}
\end{table}

\end{document}
2

A possible solution is to use the tabularx package.

\documentclass[jou, keeplastbox]{apa6}

\usepackage[american]{babel}
\usepackage{csquotes}

%TODO: ensure table width == columnwidth
\usepackage[para]{threeparttable}
\usepackage{tabularx}
\usepackage{lipsum}

\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\title{Title}
\shorttitle{Short Title}
\author{Susurration}
\affiliation{Void}

\abstract{This demonstration paper uses the \textsf{apa6} \LaTeX\
    class to format the document in compliance with the 6th Edition of
    the American Psychological Assocation's \textit{Publication Manual.}
    The references are managed using \textsf{biblatex}.}
\keywords{APA style, demonstration}

\begin{document}
\maketitle

% this looks good but the defintion of widths is not very handy
% furthermore these width definitions seem to be sensitive to table content
\begin{table}[h]
    \begin{threeparttable}
        \caption{tabularx environment solves the problem}
        \label{tab:stimuli_domain}
        \begin{tabularx}{\columnwidth}{p{0.2\columnwidth}p{0.2\columnwidth}p{0.3\columnwidth}p{0.3\columnwidth}}
            \toprule
            \multicolumn{2}{c}{Cues}        & \multicolumn{2}{c}{Stimuli} \\
            Number\tabfnm{a}    & Validity  & A & B \\
            \midrule
            1       & 0.8       & 1         & 0 \\
            2       & 0.6       & 0         & 0 \\
            3       & 0.75      & 1         & 1 \\
            \midrule
        \end{tabularx}
        \begin{tablenotes}[para,flushleft]
            {\small
                \textit{Note.}  Column 3 and Column 4 represent stimuli by assigning binary variables as given in equation \ref{eq:feature_def}.
            }
        \end{tablenotes}
    \end{threeparttable}
\end{table}

\lipsum[1-2]

% I would like to have this code to make span the table the whole column
\begin{table}[h]
    \begin{threeparttable}
        \caption{tabularx environment solves the problem}
        \label{tab:stimuli_domain_}
        \begin{tabularx}{\columnwidth}{p{0.2\columnwidth}p{0.2\columnwidth}p{0.3\columnwidth}p{0.3\columnwidth}}
            \toprule
            \multicolumn{2}{c}{Cues}        & \multicolumn{2}{c}{Stimuli} \\
            Number\tabfnm{a}    & Validity  & A & B \\
            \midrule
            1       & 0.8       & 1         & 0 \\
            2       & 0.6       & 0         & 0 \\
            3       & 0.75      & 1         & 1 \\
            \midrule
        \end{tabularx}
        \begin{tablenotes}[para,flushleft]
            {\small
                \textit{Note.}  Column 3 and Column 4 represent stimuli by assigning binary variables as given in equation \ref{eq:feature_def}.
            }
        \end{tablenotes}
    \end{threeparttable}
\end{table}

\lipsum

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.