# tabular with "centered" and "flushright" entries

I need to typeset a tabular with the following requirement:

• the head of a tabular should be center in the column

• the entries should be flushright and (more or less) center in the the column

like in the following example

|   -head of a column-   |
--------------------------
|           120          |
|         42001          |


I can do this by making each entry of the same width (say with \phantom) and then centering the column, but as a tabular are fairly large it's a lot of tedious work.

I'm aware of the existance of dcolumn package (and answer given here https://tex.stackexchange.com/a/73702/7313), however I don't know how to use it together with array package and features it provides (\newcolumntype mostly)

Is there any wiser way to do this?

• dcolumn is defined via the array package \newcolumntype feature. May 17 '13 at 22:06

\documentclass{article}

\usepackage{dcolumn}

\newcolumntype{C}{>{\centering}p{1cm}}
\newcolumntype{E}{D{.}{.}{5.0}}

\begin{document}

\begin{tabular}{C E}

• @pml you set it by the values in the D colunm D{.}{.}{10}{5} makes it wide enough for 10 digits to the left of a . and 5 digits to the right. It doesn't matter if there are any entries like that it is just a space specification really. May 17 '13 at 22:47