# How to doublespace a table using setspace?

I have used setspace with \spacing{1.9} to meet publisher specifications of "3 lines per inch or 12 lines per 10 cm", but it does not affect tables, although the publisher has requested that the spacing be applied to tables.

How can I apply this spacing to tables?

Here is an example:

\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{setspace}
\begin{document}
\begin{spacing}{1.9}
\lipsum[1]
\begin{table}[ht]
\begin{tabular}{rlll}
\hline
& col1 & col2 & col3 \\
\hline
50 & 19 & 7 & 26 \\
100 & 10 & 20 & 29 \\
150 & 1 & 7 & 2 \\
200 & 0 & 0 & 10 \\
\hline
\end{tabular}
\end{table}
\end{spacing}
\end{document}


-

The setspace package restores the normal \baselinestretch inside floats (and footnotes); you can override this decision by redefining \@xfloat:

\documentclass{article}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{lipsum}

\newcommand\Factor{1.9}

\makeatletter
\def\@xfloat#1[#2]{\ifhmode \@bsphack\@floatpenalty -\@Mii\else
\@floatpenalty-\@Miii\fi\def\@captype{#1}\ifinner
\@parmoderr\@floatpenalty\z@
\else\@next\@currbox\@freelist{\@tempcnta\csname ftype@#1\endcsname
\@tfor \@tempa :=#2\do
}\global\count\@currbox\@tempcnta}\@fltovf\fi
\global\setbox\@currbox\vbox\bgroup
\def\baselinestretch{\Factor}\@normalsize
\boxmaxdepth\z@
\hsize\columnwidth \@parboxrestore}
\makeatother

\begin{document}
\begin{spacing}{\Factor}
\lipsum[1]
\begin{table}[ht]
\begin{tabular}{rlll}
\hline
& col1 & col2 & col3 \\
\hline
50 & 19 & 7 & 26 \\
100 & 10 & 20 & 29 \\
150 & 1 & 7 & 2 \\
200 & 0 & 0 & 10 \\
\hline
\end{tabular}
\end{table}
\end{spacing}
\end{document}


A shorter (and safer) possibility is to use the etoolbox package and its \AtBeginEnvironment command to add \doublespacing to the tabular environment:

\documentclass{article}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{etoolbox}
\usepackage{lipsum}

\AtBeginEnvironment{tabular}{\doublespacing}

\begin{document}
\begin{spacing}{1.9}
\lipsum[1]
\begin{table}[ht]
\begin{tabular}{rlll}
\hline
& col1 & col2 & col3 \\
\hline
50 & 19 & 7 & 26 \\
100 & 10 & 20 & 29 \\
150 & 1 & 7 & 2 \\
200 & 0 & 0 & 10 \\
\hline
\end{tabular}
\end{table}
\end{spacing}
\end{document}

-
This doesn't seem to work with sidewaystable from the "rotating" package. I get ! Extra }, or forgotten \endgroup. \color@endbox ->\egroup. An example is here Any thoughts? –  David Aug 6 '12 at 14:35
@David I suggest you to open a follow-up question. –  Gonzalo Medina Aug 6 '12 at 14:36
Thanks, the followup, with the linked example from my previous comment, is here: tex.stackexchange.com/q/66070/1783 –  David Aug 6 '12 at 14:40
@David I've updated my answer; this new approach (with etoolbox) prevents the issue with sidewaystable. –  Gonzalo Medina Aug 6 '12 at 15:50