This is, in a way, a follow-up-question to New table-environment, spaces and enclosing { } in a new environment, which has already been answered conveniently by @egreg.
Please compile this MWE to see and follow the problem:
\documentclass[a4paper, 11pt]{scrbook}
\usepackage{blindtext}
\usepackage[cm]{fullpage}
\usepackage{tabu, longtable, booktabs}
\usepackage{caption}
\newenvironment{texttab}[1]%
{\setlength{\topsep}{\baselineskip}%
\begin{center} \tabulinesep=0.6ex%
\begin{tabu} to 0.9\textwidth {#1} \toprule \rowfont{\bfseries}}
{\end{tabu}%
\end{center}}
\newenvironment{tabspaces}[1]%
{\setlength{\topsep}{\baselineskip}%
\begin{center} \tabulinesep=0.6ex%
\begin{longtabu} to 0.9\textwidth {#1} \toprule \rowfont{\bfseries}}
{\end{longtabu}%
\end{center}}
\newenvironment{texttab*}[1]%
{\setlength{\topsep}{\baselineskip}%
\LTpre=0pt%
\LTpost=0pt%
\begin{center} \tabulinesep=0.6ex%
\begin{longtabu} to 0.9\textwidth {#1} \toprule \rowfont{\bfseries}}
{\end{longtabu}%
\end{center}}
\begin{document}
\section{TEST}
\blindtext
%
\begin{texttab}{X[l,2] X[l,2] X[l,3]}
Test1 & Test2 & Test3 works fine \\ \midrule
Test1 & Test2 & Test3 works fine \\
Test1 & Test2 & Test3 works fine \\ \bottomrule
\end{texttab}%
%
\blindtext
%
\begin{tabspaces}{X[l,2] X[l,2] X[l,3]}
Test1 & Test2 & Test3 \\ \midrule
Test1 & Test2 & Test3 \\
Test1 & Test2 & Test3 \\ \bottomrule
\end{tabspaces}%
%
\blindtext
%
\begin{texttab*}{X[l,2] X[l,2] X[l,3]}
Test1 & Test2 & Test3 \\ \midrule
Test1 & Test2 & Test3 \\
Test1 & Test2 & Test3 \\ \bottomrule
\end{texttab*}%
%
\blindtext
\end{document}
I created three new environments: texttab
, tabspaces
and texttab*
.
They implement tabu
s (not to be embedded in floating bodies) in the text.
As a result of the question mentioned before I made two environments for either normal tabu
s (texttab
) or longtabu
s (texttab*
). tabspaces
is just for demonstration-use.
Now, if you take a look at the tabspaces
-environment (second table in the example), you see it produces way too much vertical space above and below the environment.
I tried to use the commands \LTpre=0pt
and \LTpost=0pt
(provided by the longtable
-package) in the texttab*
-environment - you see, there's still way too much space below!
Where does it come from and how do I get rid of it?
Note: \tabulinesep=0.6ex
seems to affect those spaces! Nevertheless, removing it doesn't change the fact that the vertical spaces still differ from the ones in my (satisfying) texttab
-environment.