0

When creating a tabu with two rows, I get more vertical spacing after the environment than when I create a tabu with only one row.

In the document below, the first tabu has two lines, and there is a small space between the end of the table and the rule below it. In the second tabu, I only have one line, and there is a larger space below it.

\documentclass{article}
\usepackage{geometry}
\usepackage{tabu}

\geometry{a4paper} 

\begin{document}
\begin{tabu} to \textwidth {X X}%
    These are words & in the first line \\%
    These are more words & in the second line%
\end{tabu}\par%
\rule{\textwidth}{0.4pt}\par%
%
%
\vspace{2em}\par%
%
%
\begin{tabu} to \textwidth {X X}%
    These are words & in the first line%
\end{tabu}\par%
\rule{\textwidth}{0.4pt}\par%
%
\end{document}

typeset output of above document, displaying inconsistency in spacing after a tabu environment

I've been quite careful (I think) with whitespace around the tabu, and I see no difference in the two tables aside from the different number of lines.

I know that I could fix this by adding a \vspace{0.5em} or similar right after the tabu with the small spacing, but I am using the tables in a custom command and I would like to avoid a hard-coded solution like this if possible.

This problem also comes up if I substitute a tabular for the tabu. Adding \tabulinesep=Xem fixes (or appears to fix) the problem for large X (>1em), but I need small spacings (ideally, ~0em).

Any ideas?

0

Too big for a comment ...

Discovered phenomena is not related only to tabu, but it can be observable at all table environments. For example, at tabularx too:

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{tabularx}
\setlength\parindent{0pt}

\begin{document}
\begin{tabularx}{\textwidth}{X X}%
\hline
    These are words & in the first line \\%
    These are more words & in the second line\\
\hline%
\end{tabularx}\par%
\rule{\textwidth}{0.4pt}\par%

%
\vspace{2em}
%
\begin{tabularx}{\textwidth}{X X}%
\hline
    These are words & in the first line\\
\hline%
\end{tabularx}\par%
\rule{\textwidth}{0.4pt}\par%
%
\end{document}

which gives:

enter image description here

This is caused by some strange interaction between tables and \rule. If you replace \rule with text:

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage{tabularx}
\setlength\parindent{0pt}

\usepackage{lipsum}

\begin{document}
\begin{tabularx}{\textwidth}{X X}%
\hline
    These are words & in the first line \\%
    These are more words & in the second line\\
\hline%
\end{tabularx}\par%
\lipsum[66]

\vspace{2em}
%
\begin{tabularx}{\textwidth}{X X}%
\hline
    These are words & in the first line\\
\hline%
\end{tabularx}\par%
\lipsum[66]
\end{document}

than result is as expected:

enter image description here

| improve this answer | |
  • it is not strange. It is simply due to the fact that the second tabular has a rather large depth. – Ulrike Fischer Nov 21 '19 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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