1

I had to replace some tabularx-tables by xltabular-tables, because some tables got too long to fit on one page.

Unfortunately the xltabular introduced additional vertical space before and after each table and I have no idea how to get rid of it.

The following minimal examples show the problem.

Example (tabularx):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\begin{document}

A tabularx:

\begin{tabularx}{\textwidth}{|X|X|}
\hline
lorem & ipsum \\
\hline
lorem & ipsum \\
\hline
\end{tabularx}

Done.

\end{document}

which compiles to:

enter image description here

And with xltabular - Note the vertical space before and after the table. (I don't mind the indentation in this example, but it's still questionable too):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{xltabular}
\begin{document}

An xltabular:

\begin{xltabular}{\textwidth}{|X|X|}
\hline
lorem & ipsum \\
\hline
lorem & ipsum \\
\hline
\end{xltabular}

Done.

\end{document}

which compiles to:

enter image description here

Thanks for any help on this.

1 Answer 1

1

tabularx is an inline element so has no vertical spacing at all. Any vertical space is provided by the surrounding paragraph's settings. Your first example is showing a paragraph with a default zero \parskip and then a table that is \textwidth wide, indented by \parindent so sticking in to the right margin:

Overfull \hbox (15.0pt too wide) in paragraph at lines 14--15

The second example uses longtable so has \LTpre and \LTpost spaces before and after which you can set with \setlength.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .