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}
  • 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 '18 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? – user1583209 Jun 13 '18 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 '18 at 11:36
  • Can booktabs do something like \cline{} , i.e. horizontal lines over certain columns only? – user1583209 Jun 13 '18 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 '18 at 11:45
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}

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.