4

I have a tabu-table and my default row-style is and has to be p. But I want the head-row (Column 1 and Column 2 in the MWE) to be vertically centered. How can I achieve that?

MWE:

\documentclass{article}
\usepackage{array}
\usepackage{tabu}
\usepackage{blindtext}
\usepackage{ragged2e}
\tabulinesep =0.5em
\newcommand*{\mytext}{\RaggedRight This is some blindtext with words and letters.}

\begin{document}
\begin{tabu} to\textwidth{|X[1,l,p]|X[1,l,p]|X[1,l,p]|}% m is not allowed!!!
    \hline
    Column 1 & Column 2 & Long Long very long caption, more than one line \\
    \hline
    \mytext & \mytext & \mytext \\
    \mytext & \mytext & \mytext \\
    \mytext & \mytext & \mytext \\
    \hline
\end{tabu}
\end{document}

output

musicman
  • 3,559

1 Answers1

2

Since, for some reason, changing from p type columns to m type is not allowed, you can use \raisebox:

\documentclass{article}
\usepackage{array}
\usepackage{tabu}
\usepackage{blindtext}
\usepackage{ragged2e}
\tabulinesep =0.5em
\newcommand*{\mytext}{\RaggedRight This is some blindtext with words and letters.}

\begin{document}
\begin{tabu} to\textwidth{|X[1,l,p]|X[1,l,p]|X[1,l,p]|}
    \hline
    \raisebox{-\baselineskip}[0pt][0pt]{Column 1} 
      & \raisebox{-\baselineskip}[0pt][0pt]{Column 2} 
      & Long Long very long caption, more than one line \\
    \hline
    \mytext & \mytext & \mytext \\
    \mytext & \mytext & \mytext \\
    \mytext & \mytext & \mytext \\
    \hline
\end{tabu}
\end{document}

enter image description here

Gonzalo Medina
  • 505,128