# Vertical centred alignment of text in table cell

I would like to know how to put vertical centered text inside a table cell.

The problem with m column type is that i'm actually using tabularx to auto detect the width of the columns

\newcolumntype{Y}{>{\small\centering\arraybackslash}X}
\begin{tabularx}{\textwidth}{YYY}
& Lorem ipsum \newline Lorem ipsum dolor sit amet, consectetur adipisicing & Lorem ipsum \newline Lorem ipsum dolor sit amet, consectetur adipisicing \\
Lorem ipsum Lorem ipsum dolor sit amet, consectetur adipisicing & A & B \\
Lorem ipsum Lorem ipsum dolor sit amet, consectetur adipisicing & C & D \\
\end{tabularx}


I would like to vertical centering in the boxes the A, B, C, D text

-
Providing an example of what you have done or image of what you are looking for helps everyone understand your question a bit better. – azetina Apr 16 '12 at 19:35

The tabularx documentation gives an explicit example of using an m column with small text

 \renewcommand{\tabularxcolumn}[1]{>{\small}m{#1}}


Your column definition already adds \small so you just need to make X use m instead of p so

\renewcommand{\tabularxcolumn}[1]{m{#1}}

-

Instead of using tabularx, you could use the features provided by the tabu package:

\documentclass{article}
\usepackage{tabu}

\begin{document}

\everyrow{\rowfont{\small}}
\noindent\begin{tabu} to\linewidth{X[c,m]X[c,m]X[c,m]}
& Lorem ipsum\par Lorem ipsum dolor sit amet, consectetur adipisicing & Lorem ipsum \par Lorem ipsum dolor sit amet, consectetur adipisicing \\
Lorem ipsum Lorem ipsum dolor sit amet, consectetur adipisicing & A & B \\
Lorem ipsum Lorem ipsum dolor sit amet, consectetur adipisicing & C & D \\
\end{tabu}

\end{document}


-