Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
1  
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

2 Answers 2

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}}
share|improve this answer

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}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.