I'm trying to produce a manuscript for submission. I have tables that are fairly long and need to be single spaced. The apa6
class is double-spacing the entire document including the tables. I need double-spaced body text and single-spaced tables. My previous version of the document, before I tried apa6
, invoked the endfloat
package and the spacing was what I needed. As an aside, the apa6
manual suggests tables can be either single or double spaced. Can I request this format from the class?
2 Answers
apa6
does not a provide a float-specific spacing as a document class option (see section 3.1 Class Options of the apa6
documentation, p 2). However, it loads the etoolbox
package by default which provides \AtBeginEnvironment{<env>}{<stuff>}
that hooks into and adds <stuff>
at \begin{<env>}
. So, you can use
\usepackage{setspace}% http://ctan.org/pkg/setspace
\AtBeginEnvironment{tabular}{\singlespacing}% Single spacing in tabular environment
Although it is not necessary to load use the setspace
interface for \singlespacing
in this case, it is just for convenience. If you're not allowed to use setspace
, you could also just use
\makeatletter
\AtBeginEnvironment{tabular}{%
\def\baselinestretch{1}\@currsize}%
\makeatother
Here is a minimal example using the former setspace
adjustment:
\documentclass[man,floatsintext]{apa6}% http://ctan.org/pkg/apa6
\shorttitle{Some title}% Dummy title
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{setspace}% http://ctan.org/pkg/setspace
% Already loaded by the apa6 documentclass...
% \usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\AtBeginEnvironment{tabular}{\singlespacing}% Single spacing in tabular environment
\begin{document}
\lipsum[1]
\begin{table}[ht]
\begin{tabular}{ccccccc}
\toprule
One & Two & Three & Four & Five & Six & Seven \\
\midrule
100 & 200 & 300 & 400 & 500 & 600 & 700 \\
100 & 200 & 300 & 400 & 500 & 600 & 700 \\
100 & 200 & 300 & 400 & 500 & 600 & 700 \\
100 & 200 & 300 & 400 & 500 & 600 & 700 \\
100 & 200 & 300 & 400 & 500 & 600 & 700 \\
\bottomrule
\end{tabular}
\caption{This is a table.}
\end{table}
\end{document}
lipsum
was merely used to create dummy text Lorem Ipsum style.
-
Thanks a lot. I tried the SETSPACE command but got an error: ! Undefined control sequence.\@begin@tabular@hook ->\singlespacing \begin{tabular}. The second solution worked fine. I'm not yet very familiar with Latex programming, but I hope to learn. I deduce that your code is altering the Table class within the document. Does @currsize refer to an argument to the table class? --- Just curious. Thanks for the suggestions.– Bob PFeb 16, 2012 at 17:43
-
@BobP: You should include the
setspace
package (via\usepackage{setspace}
) for you to be able to use\singlespacing
). The\@currsize
macro is something that sets the current font size. If you look atsetspace.sty
, you'll see that I extracted the equivalent of\singlespacing
from that file as a replacement. If this solved your problem, consider up-voting and/or accepting (see How do you accept an answer?).– Werner ♦Feb 16, 2012 at 17:48 -
I didn't realize that setspace was independent of etoolbox. Thanks a lot for the help.– Bob PFeb 16, 2012 at 19:02
I don't know the apa6 class and its options, but you can do it manually with the following code. I suggest to create an environment which creates the table and formats the font, spacing and so on. These changes effects only the environment/table and switched back after leaving the environment.
\documentclass{apa6}
\usepackage{longtable}
\usepackage{lipsum}
\usepackage{setspace}
\newenvironment{myTable}%
{%
\footnotesize
\singlespace
\setlength\tabcolsep{1.5ex}
% other formating stuff
\begin{longtable}{p{5cm}p{5cm}p{5cm}}
Column 1 &Column 2 &Column 3\\
\hline
}%
{%
\end{longtable}
}%
\doublespace
\begin{document}
\lipsum[1]
\begin{myTable}
\lipsum[1]&\lipsum[1]&\lipsum[1]\\
\end{myTable}
\lipsum[1]
\end{document}
-
The
apa6
documentation specifically mentions not loadinglongtable
explicitly, but rather as a class option using\documentclass[longtable]{apa6}
.– Werner ♦Feb 16, 2012 at 3:27
lipsum
package, other members of the community will be able to copy, paste and experiment with your code.