# A vertical alignment problem in tabu environment with X[m]

I learned tabu for a while and I can not solve a problem about vertical alignment with X[m]. Here is the minimal working example below.

\documentclass{article}
\usepackage[linegoal]{tabu}\tracingtabu=2

\begin{document}

\begin{tabu} to\linewidth{|X[-2.5,c,m]|X[c]|X[c]|} \tabucline-
This is a counterexample. This is a counterexample. This is a counterexample.
This is a counterexample. This is a counterexample. This is a counterexample.
& \texttt X & xyz \\ \tabucline-
\end{tabu}

\end{document}

I want to put the contents of the second and third column in vertical center, but if I set m in the second and third column at the preamble of tabu, i.e.,

\begin{tabu} to\linewidth{|X[-2.5,c]|X[c,m]|X[c,m]|}

the result is strange because the contents in the second and third column is not vertical center.

But if I set m in the first column, i.e.,

\begin{tabu} to\linewidth{|X[-2.5,c,m]|X[c]|X[c]|}

then the result that I want comes.

I want to know why and how to solve it.

-

## 1 Answer

m means the baseline for relative alignment is in the middle. It doesn't mean the cell content is in the middle. In table cells, t, b and m are similar to the alignment parameter t, b or default (middle) of \parbox.

So, with |X[-2.5,c]|X[c,m]|X[c,m]| you get vertically top,middle,middle aligned cells, relative to each other, not to the cell. Would the content in column 2 and 3 be in the middle of the cell, the first cell content's top would have to be in the middle, for alignment - causing much white space above.

In contrast, |X[-2.5,m]|X[c,m]|X[c,m]| gives you the middle alignment because all cells in the row have it.

\begin{tabu} to\linewidth{|X[-2.5,c,m]|X[c,m]|X[c,m]|}
\tabucline-
This is a counterexample. This is a counterexample.
This is a counterexample.
This is a counterexample. This is a counterexample.
This is a counterexample.
& \texttt X & xyz \\ \tabucline-
\end{tabu}

-
Thanks for your reply! – XIAO Lishun Aug 22 '11 at 2:55