# [texhax] Q: centering with known width [+ variant: numbers]

Uwe Lück uwe.lueck at web.de
Mon Mar 12 22:18:38 CET 2007

At 15:30 12.03.07, Martin Heller wrote:
>Uwe Lück skrev:
> > "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.
>
>This does not work as intended. You can use a \parbox, but I
>
>\documentclass{article}
>
>\begin{document}
>
>% Not working
>\begin{tabular}{| c | c |}
>     \hline
>     Name & \makebox[.15\textwidth]{%
>              \hfill
>              Downstream per-device limit (Mbps)\hfill}\\
>     \hline
>\end{tabular}
>
>% Working
>\begin{tabular}{| c | c |}
>     \hline
>     Name & \parbox{.15\textwidth}{%
>              \centering
>              Downstream per-device limit (Mbps)}\\
>     \hline
>\end{tabular}
>
>\end{document}

whether "Downstream" etc. fits into a .15\textwidth line.
I had tested my proposal with a short entry.
So I misunderstood the intention.

Concerning avoidance of extra packages: This is a mixture
of sports, philosophy, and psychology. The psychological
part is that I started using LaTeX with a small TeX version
and struggled hard with "TeX capacity exceeded".
I also find it somewhat annoying to load hundreds of
macro definitions of which I need only half a dozen.
(Therefore, I have used the autoload version of LaTeX
-- I still do for tests or small passages on my
Atari emulator TOSbox.)

There is indeed a practical aspect for me somewhat
connected with the former:  If I need a certain function
and try to find a package for it, I must study documentations.
The more versatile the package is, the more difficult is it
for me to find the relevant passages in the documentation.
Moreover, the more versatile a package is, the more their
authors tend to explain single functions so briefly that
I cannot see from the explanations whether the package
does what I want. By contrast, I know what my own macros
do (or should do, admittedly, or will do as soon I have
debugged them).

Another thing of (back to) the example we have here: I wonder
whether D. R. Evans wants to have a column of (in general)
multi-line entries. A typical task rather is that you have a column
of amounts -- maybe with aligning decimal points! -- with a
multi-line column title. In that case, neither the "p" column
nor a new column type do. Indeed, what I have worked hard of
recent months is a centered text title (usually even single-lined)
for a column of both one- or two-digit numbers that are aligned
to the right. It should look as if both the title and the two-digit
numbers were centered in one column, while the single-digit
numbers seem to be in one (en-wide) column together with the
the second digits of the two-digit numbers. (Cf. TeXbook p. 247.
-- I am working on astronomical tables by Nicolaus Copernicus.
Even the printers of earlier editions of such tables seem not
to have had a clear idea of how to deal with this situation.
I try to stick to LaTeX in order not to trouble other collaborators
too much.) ... OK, don't be afraid, I am stopping here instead
of discussing my approaches ...

Cheers,

Uwe.