[Tex/LaTex] How to remove top and bottom whitespace of longtable

longtablespacingtables

I am using longtable instead of tabular environment and noticed that it puts some additional whitespace at the top and at the bottom of the table. Is there some way to remove it (something less hacky than \vskip -\baselineskip before the table)?

Small piece of code for illustration:

\documentclass[12pt]{book}
\usepackage{longtable}

\begin{document}

Linelineline

\begin{longtable}{l l} cell1 & cell2 \end{longtable}

Linelineline

\begin{tabular}{l l} cell1 & cell2 \end{tabular}

Linelineline

\end{document}

And that's what I am getting:

tables

Common tabular environment does not have any additional margins, but longtable does.

Best Answer

To remove the whitespace before and after a longtable, you may change the lengths \LTpre and \LTpost:

\setlength{\LTpre}{0pt}
\setlength{\LTpost}{0pt}

Their default value is \bigskipamount.

Related Question