Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?
share|improve this question
    
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 9:30
    
With the code above, changed to \columnwidth, it compiles with a table which spans the two columns. –  Village Jul 20 '12 at 9: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 9: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 9:46

1 Answer 1

up vote 3 down vote accepted

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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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