# [texhax] Column specifier question

Tue Oct 16 16:05:30 CEST 2007

E. Krishnan :

> On Mon, 15 Oct 2007, Yiqing Jin (Denny) wrote:
>
>> I need to give the columns some certain widths while at the
>> same time requiring the text to be centre aligned. I have tried the
>> \begin{tabular}{c c c c c}, and also the \begin{tabular}{... p{24mm}
>> ...} commands, but how can I get them to work at the same time?
>
> Does this help?
>
>
>   \usepackage{array}
>
>     \begin{tabular}{>{\centering}p{24mm}
>                     >{\centering}p{24mm}
>                     >{\centering}p{24mm}}
>       a   & b   & c\tabularnewline
>       def & ghi & jkl\tabularnewline
>     \end{tabular}
>

isn't

\usepackage{array}

\begin{tabular}{>{\centering}p{24mm}
>{\centering}p{24mm}
>{\centering\arraybackslash}p{24mm}}
a   & b   & c\\
def & ghi & jkl\\
\end{tabular}

easier to work with? THen one does not have to use special commands to
change rows. \arraybackslash is only needed in the last column and only if
one has done something that changes \\ (such as \centering).

/daleif