# Double line spacing, except in tables

Extending the question Double line spacing (as I'm new round here I don't seem to be able to comment), I'd like to use double spacing too. Except in tables, where I'd like to be able to leave that at single spacing, or specify a separate line spacing.

But I have a constraint: my LaTeX is being generated from MultiMarkdown via Pandoc, and so I don't get much control over the code. I do get to insert header code before the \begin{document}, so these lines do take effect:

\usepackage{setspace}
\doublespacing


Is there a way of setting tables to be single spaced in the header?

If it matters, I believe the table package used in the generated source is longtable.

The start of environment longtable can be redefined to add \singlespacing:

\documentclass{article}

\usepackage{lipsum}
\usepackage{longtable}

\usepackage{setspace}
\doublespacing
\usepackage{etoolbox}
\preto\longtable{\par\singlespacing}

\begin{document}
\lipsum[2]
\begin{longtable}{lp{10cm}}
1&a\tabularnewline
2&b\tabularnewline
3&\lipsum[2]
\end{longtable}
\end{document}