2

This question already has an answer here:

I have some troubles with spacing before and after tabular boxes. When my table have only one row, everything is okay.

\documentclass{article}
\usepackage{setspace}

\begin{document}
\doublespacing
Some text.

\begin{tabular}{|l|}
\hline
Some text.\\
\hline
\end{tabular}

Some text.
\end{document}

One row

But when I add new row, spacing before and after table disappears!

\begin{tabular}{|l|}
\hline
Some text.\\ \hline
Some text.\\
\hline
\end{tabular}

Two rows

What should I do to fix this?

marked as duplicate by Sverre, Schweinebacke, Henri Menke, clemens, TeXnician Apr 26 '17 at 10:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • usually such a table is inside center or flushleft environments, which would add some space – David Carlisle Apr 25 '17 at 21:59
  • 1
    \doublespace is the culprit here which leaves enough space when there's a single row in the tabular. With multiple rows (2+), the tabular still acts like a singular item (like a character) on the line it's put, but it's taller than the expected line height, and is therefore just squeezed in... leaving no vertical space above/below. – Werner Apr 25 '17 at 22:01
  • So, what should I do to add the same amount of space, as in first example? center and flushleft environments add to much space. – noxwell Apr 25 '17 at 23:19
1

If you don't like flushleft or center, you could use \vspace:

\documentclass{article}
\usepackage{setspace}

\begin{document}
    \doublespacing
    \noindent I think the best solution is with \texttt{flushleft} (or \texttt{center}) environment:

    \begin{flushleft}
        \begin{tabular}{|l|}
            \hline
            Some text.\\
            \hline
            Some text.\\
            \hline
        \end{tabular}
    \end{flushleft}
    Some text.

    \noindent However, you could use \textbackslash\texttt{vspace*} and set any spacing you want:\vspace*{.1\baselineskip}

    \noindent
    \begin{tabular}{|l|}
        \hline
        Some text.\\
        \hline
        Some text.\\
        \hline
    \end{tabular}\vspace*{.2\baselineskip}  

    \noindent Some text.
\end{document}

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.