[texhax] Q: centering with known width

Uwe Lück uwe.lueck at web.de
Mon Mar 12 12:49:41 CET 2007

At 17:37 08.03.07, D. R. Evans wrote:

>how do I center a column in a table when that
>column has a known, fixed width?
>
>For example, I have:
>
>\begin{tabular}{| c | p{0.15\textwidth} |}
>\hline
>Name & Downstream per-device limit (Mbps) \\
>\hline
>etc.
>
>How do I get the second label (and all the other entries in that
>column) to be centered?

At 18:04 08.03.07, Martin Heller wrote:

>Load the array package and define a new column type.

I am strongly biased towards trying very hard to avoid
with tables in recent months. Thought many days,
learnt a lot, and it still works, without the array package.
So concerning the posting:

"p" is not the only way to get a fixed column width
as possible). Another way is (e.g.):

\begin{tabular}{| c | c |}
\hline
Name & \makebox[.15\textwidth]{\hfill Downstream per-device limit
(Mbps)\hfill} \\
\hline
etc.

It suffices to use that \makebox in one single row of the table.

HTH -- Uwe.