# Gap between double-spaced paragraphs with table

I have the code for a table between two blocks of texts (of multiple paragraphs). When the text is single-spaced, there is no problem; however, when I doublespace the text using setspace and singlespace the table, a longer gap is evident between the paragraphs where the code for the table is in the .tex file (the table is printed on the following page):

\documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage{setspace}

\begin{document}
\begin{doublespace}
\lipsum[1-2]

\begin{singlespace}
\begin{table}[t]
\begin{center}
\begin{tabular}{|c|c|}
Left        & Right\\
Hello       & Goodbye\\
\end{tabular}
\end{center}
\end{table}
\end{singlespace}

\lipsum[1-2]

\end{doublespace}
\end{document}


Below you can see the longer (slightly, though noticeable) gap preceding the "Lorem ipsum..." paragraph, which is where the code for the table is:

• That is some stretch filling the page, so all pages end at the same place. You can try \raggedbottom. Random unwanted space between paragraphs – Johannes_B Oct 22 '14 at 14:30
• The singlespace environment itself places some whitespace. Put the invironment inside the table. – Johannes_B Oct 22 '14 at 14:36

The environment singlespace adds some whitespace. As does table and center.

I suggest doing this:

\documentclass[12pt]{article}
\usepackage{lipsum}
\usepackage{setspace}

\begin{document}
\begin{doublespace}
\section{}
\lipsum[1-2]

\begin{table}[t]
\singlespacing
\centering
\begin{tabular}{|c|c|}
Left        & Right\\
Hello       & Goodbye\\
\end{tabular}
\end{table}

\lipsum[1-2]

\end{doublespace}
\end{document}

• Replacing singlespace with singlespacing seems to have done the trick without raggedbottom. – Jeremy L. Wells Oct 22 '14 at 14:46
• Jap, \raggedbottom was a leftover to realize that this isn't the cause. You can remove it. – Johannes_B Oct 22 '14 at 14:47