2

I am using the APA document class. My document has some tables:

\documentclass[jou]{apa}
\usepackage{tabularx}
\title{This is the title}
\author{This is the author}
\begin{document}
    \maketitle

    This is some text so that you can see how wide each of the columns is in the document.

    \noindent\begin{tabularx}{\textwidth}{|X|X|}
        1 & 2 \\
    \end{tabularx}
\end{document}

When I compile this, the width is too wide and does not match the column width. I tried replacing \textwidth with \linewidth, but this did not work either.

  • How can I set the table to match the width of the columns in the APA document class?
David Carlisle
  • 757,742
Village
  • 13,603
  • 23
  • 116
  • 219
  • I get the correct width both with \textwidth and \columnwidth, which is what you should use when the document is in two column format. – egreg Jul 20 '12 at 09:30
  • With the code above, changed to \columnwidth, it compiles with a table which spans the two columns. – Village Jul 20 '12 at 09:35
  • The example document is in one column format. If you add twocolum to the document class options and use \columnwidth, the result is as expected. – egreg Jul 20 '12 at 09:37
  • I found that \maketitle sets the document to two column format. I tried adding \columnwidth and the document class option, but it still compiles with a table which does not fit the columns. – Village Jul 20 '12 at 09:46

1 Answers1

3

The APA class redefines \tabular in a way that thoroughly confuses tabularx.

Here's a workaround: in the apatabularx we restore the original meanings of \tabular and \endtabular.

\documentclass[jou]{apa}
\usepackage{tabularx,lipsum}
\title{This is the title}
\author{This is the author}

\makeatletter
\newenvironment{apatabularx}
  {\let\tabular\old@tabular\let\endtabular\orig@endtabular\tabularx}
  {\endtabularx}
\makeatother

\begin{document}
\maketitle

\lipsum[1-2]

\medskip

\noindent\begin{apatabularx}{\columnwidth}{|X|X|}
This is some text so that you can see how wide each of the columns is in the document.
&
This is some text so that you can see how wide each of the columns is in the document.
\\
\end{apatabularx}

\medskip

\lipsum[3-6]

\end{document}
David Carlisle
  • 757,742
egreg
  • 1,121,712