[Tex/LaTex] Vertical centred alignment of text in table cell

tablesvertical alignment

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

Best Answer

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}}
Related Question