4

Consider the following table example, the text in the second row is wrapped.

\documentclass[a4paper]{article}

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{tabu}
\usepackage{booktabs}

\usepackage{array}
\setlength{\extrarowheight}{5pt}

\begin{document}

  \begin{tabu} to \linewidth {X[.5,c] X[1,l] X[1,l] X[2,l]}
    \toprule
    \rowfont{\bfseries}
    Row & Head 1                   & Head 2 & Head 3 \\\hline
    1.  & short text               & ? & ? \\\hline
    2.  & long long long long text & ? & ? \\\hline
    3.  & short text               & ? & ? \\\hline
    4.  & short text               & ? & ? \\
    \bottomrule
  \end{tabu}

\end{document}

It renders like:

enter image description here

Why is there so little space between the text in the second row and the rule below it?

How can I fix it?

What comes to my mind is to use \\[1ex] instead of \\, is there a better solution?

5

It's a known deficiency of tabu; it adds a \strut at the beginning but not at the end of possibly multiline cells. Compare the outputs (I added a g in the short texts for better comparison).

\documentclass[a4paper]{article}

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{tabu}
\usepackage{booktabs}

\usepackage{array}
\setlength{\extrarowheight}{5pt}

\begin{document}

\noindent
  \begin{tabu} to \linewidth {X[.5,c] X[1,l] X[1,l] X[2,l]}
    \toprule
    \rowfont{\bfseries}
    Row & Head 1                   & Head 2 & Head 3 \\\hline
    1.  & gshort text               & ? & ? \\\hline
    2.  & long long long long text & ? & ? \\\hline
    3.  & gshort text               & ? & ? \\\hline
    4.  & gshort text               & ? & ? \\
    \bottomrule
  \end{tabu}

\bigskip

\noindent
  \begin{tabu} to \linewidth {X[.5,c] X[1,l]<{\strut} X[1,l] X[2,l]}
    \toprule
    \rowfont{\bfseries}
    Row & Head 1                   & Head 2 & Head 3 \\\hline
    1.  & gshort text               & ? & ? \\\hline
    2.  & long long long long text & ? & ? \\\hline
    3.  & gshort text               & ? & ? \\\hline
    4.  & gshort text               & ? & ? \\
    \bottomrule
  \end{tabu}

\end{document}

enter image description here

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.