1

In a tabu table, if I have long enough text in a cell, a linebreak is automatically inserted. This is fine with me and what I want. However the last line of text in that cell is basically bottom aligned with the next \hline, i.e. there is no padding.

Is this expected behavior or a bug? How can I fix it?

Sample code:

\documentclass{scrartcl}
\usepackage{tabu}
\begin{document}
\begin{tabu} to \textwidth {|X|X|X|X|}
    \hline
       Column 1&Column 2&Column 3&Column 4\\
    \hline
       some text&some long text some long text some long text some long text &some text&some text\\
    \hline
       some text&no problem here&some text&some text\\
    \hline
\end{tabu}
\end{document}
5
  • 1
    For horizontal lines with improved spacing, you might consider using the \toprule, \midrule and \bottomrule commands from the booktabs package. Please keep in mind, that these rules are incompatible with vertical lines.
    – leandriis
    Jun 13, 2018 at 11:30
  • I like the booktabs package. Is it compatible with fixed with tables and automatically adjusted cell width (like in the example) and automatic linebreaks? Jun 13, 2018 at 11:33
  • 1
    Yes, you can use the booktabs package in combination with the table you showed in your question. Simply load the package, replace the \hline commands by the rules I listed in my previous comment and remove all vertical lines.
    – leandriis
    Jun 13, 2018 at 11:36
  • Can booktabs do something like \cline{} , i.e. horizontal lines over certain columns only? Jun 13, 2018 at 11:44
  • 1
    Yes, it can. The command is \cmidrule{1-2} for a line over the first and second column.
    – leandriis
    Jun 13, 2018 at 11:45

1 Answer 1

2

like this?

enter image description here

somewhere before tabu table add \tabulinesep=<amount>:

\documentclass{scrartcl}
\usepackage{tabu}
\begin{document}

\tabulinesep = 3pt % <--- added
\begin{tabu} to \textwidth {|X|X|X|X|}
    \hline
       Column 1&Column 2&Column 3&Column 4\\
    \hline
       some text&some long text some long text some long text some long text &some text&some text\\
    \hline
       some text&no problem here&some text&some text\\
    \hline
\end{tabu}
\end{document}

You must log in to answer this question.

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