# How to center vertically content of the table?

I have this table:

\usepackage{array}
\newcolumntype{x}[1]{>{\centering\arraybackslash\hspace{0pt}}p{#1}}

\begin{table}[ht]\footnotesize
\centering
\begin{tabular*}{0.95\textwidth }{@{\extracolsep{\fill}}|llllllllllllllll|x{0.15\textwidth}|}
\hline
\multicolumn{16}{|c|}{Small text} & Long text \\ \hline
1 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 16 & 19 & 20 & 21 & 22 & 23 & 0.9636149 \\ \hline
\end{tabular*}
\caption{Caption}
\label{tab:Example}
\end{table}


How to center "Small text"?

-
I can't compile your example. What table-extending packages are you using? –  Matthew Leingang Nov 7 '10 at 19:38
Sorry, I haven't included my custom column definition. Now it should compile. –  pixel Nov 7 '10 at 19:45
Works for me, sort of. With the standard article class the lines don't extend all the way across, because the table is too wide for the \textwidth. If I do \usepackage[letterpaper]{geometry} which shortens the margins a bit, the lines extend all the way across. Either way, though, "small text" is centered across the first 16 columns. Can you post a picture of what you're seeing? –  Matthew Leingang Nov 7 '10 at 19:54
@Matthew: I think the important word here is vertical. Think of ”long text” as something that has multiple lines. Then “small text” is aligned at the top. –  Caramdir Nov 7 '10 at 20:20
Ah. I might have realized that if "long text" had actually been long text. :) –  Matthew Leingang Nov 7 '10 at 21:21

Change the p to m in your definition of the x column type:

\newcolumntype{x}[1]{>{\centering\arraybackslash\hspace{0pt}}m{#1}}


Full example:

\documentclass{article}
\usepackage{array}
\newcolumntype{x}[1]{>{\centering\arraybackslash\hspace{0pt}}m{#1}}
\begin{document}

\begin{table}[ht]\footnotesize
\centering
\begin{tabular*}{0.95\textwidth }{@{\extracolsep{\fill}}|llllllllllllllll|x{0.15\textwidth}|}
\hline
\multicolumn{16}{|c|}{Small text} & Long long long long long text \\ \hline
1 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 16 & 19 & 20 & 21 & 22 & 23 & 0.9636149 \\ \hline
\end{tabular*}
\caption{Caption}
\label{tab:Example}
\end{table}
\end{document}

-