[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} |}
>Name & Downstream per-device limit (Mbps) \\
>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
loading another package. In particular, I have done so
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
with "simple" LaTeX (loading packages as pasimoniously
as possible). Another way is (e.g.):

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

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

HTH -- Uwe. 

More information about the texhax mailing list