Thursday, August 4, 2011

LaTeX tables in APA format

Though LaTeX can produce nice-looking tables, the process can be time consuming and frustrating, especially if you want to use APA format rules. Some tips & tricks, and an example are provided below.

Some usefull commands

\hline: creates a horizontal line, which you can use within a table
\thickline: creates a thicker horizontal line, which you can use to separate the caption from the table
\cmidrule{}: can be used to create a midline, spanning only a subset of the columns
\multicolumn{}: can be used to let a cell span multiple columns
\multirow{}: can be used to let a cell span multiple rows

\label{}: should be used at the end of the table, I prefer to use it just before \end{table}

Tips and remarks

When using \multirow{}, add extra rows to fit in the text (i.e., if you use a \multirow command spanning three rows, add two extra rows by typing \\ \\, or some text will be left out, or printed over the text in the rows, following the multirow).

Smaller typeface for tables: If you've got a huge table, letting it span multiple pages is difficult (i.e., I can't get it to work with the APA document class). Instead, using \small or \tiny makes the typeface smaller, so maybe it'll make your table fit on one page.

Rotate tables: To rotate the table, you can use the rotating package: type \usepackage{rotating} in the preamble, and use \begin{sidewaystable} and \end{sidewaystable} instead of \begin{table} and \end{table}. This will affect the order of the tables, however, making the sideways tables come first. By declaring \DeclareDelayedFloatFlavor{sidewaystable}{table} somewhere after the start of the document, this will be fixed. Please note that the table will not end up sideways in the DVI file, but it will in postscript or pdf files.


\documentclass[nobf,man,longtable]{apa} % turns it into an APA manuscript

\usepackage{ctable} % needed for \cmidrule{}
\usepackage{multirow} % needed for \multirow{}

\caption{Table in APA Format}
Column 1 & \multicolumn{3}{c}{Column 2} \\
& Column 2a & Column 2b & Column2c \\
a & 1 & .67 & 5 \\
b & 2 & .32 & 2 \\
c & 3 & .01 & 4 \\
\multicolumn{4}{l}{\multirow{2}{90mm}{Note: This text is spanning 4 columns and 2 rows, and it is left justified.}} \\


No comments:

Post a Comment