[Tex/LaTex] Add space before and after tabular environment

spacingtables

The tabular environment does not add any vertical space before or after it. This looks odd, in my view. What is the "correct" or "best" way to add some space? Also, why is there more space after the tabular environment than before it, as seen in the example below?

\documentclass{article}
\begin{document}
\noindent Here is a line with some text in it.

\begin{tabular}{*4{l}}
    Worg & Worg & Worg & Worg\\
    Worg & Worg & Worg & Worg\\
\end{tabular}

\noindent Here is another line with some text in it.
\end{document}

enter image description here

Best Answer

EDITED to provide two alternate approaches.

The verbatimbox package has a service routine \addvbuffer, in which the optional argument is one or two lengths (symmetric space or above/below space) to add around the contents:

\documentclass{article}
\usepackage{verbatimbox}
\begin{document}
\noindent Here is a line with some text in it.

\addvbuffer[12pt 8pt]{\begin{tabular}{*4{l}}
    Worg & Worg & Worg & Worg\\
    Worg & Worg & Worg & Worg\\
\end{tabular}}

\noindent Here is another line with some text in it.
\end{document}

enter image description here

If there are two lengths in the optional argument, they must be space separated. Thus, a valid optional argument involving two actual lengths would be, for example,

\addvbuffer[{2\baselineskip} \baselineskip]{...}  

The braces around the first length allow the following space to be expressed, which would otherwise be gobbled by the parser.

Note that with \addvbuffer, lengths can be negative (with some provisos).


If the gap will be limited to vertically symmetric [positive] additions, then the \addstackgap macro of the stackengine package will also suffice. In the MWE below, I also added a \strut to the end of the prior paragraph.

\documentclass{article}
\usepackage{stackengine}
\begin{document}
\noindent Here is a line with some text in it.\strut

\addstackgap[5pt]{\begin{tabular}{*4{l}}
    Worg & Worg & Worg & Worg\\
    Worg & Worg & Worg & Worg\\
\end{tabular}}

\noindent Here is another line with some text in it.
\end{document}

enter image description here