[texhax] raiseboxing \hrulefill in multicolumn{}
Barbara Beeton
bnb at ams.org
Mon Aug 23 15:15:36 CEST 2004
I've got a large table with a lot of column-spanning (\multicolumn)
entries. I want to make it clear when a short-ish entry spans several
columns by ruling a centred horizontal line either side of the centred
entry.
The code:
... & \multicolumn{4}{c}{\hrulefill Something \hrulefill} & ...
does this quite well, the only problem is that the rule is sitting on
the baseline. I'd like the rule to be centred, say at half the
x-height. The problem is that no amount of \raisebox{}ing seems to help
here as all the box commands want a definite width, not a rubber one! On
the other hand, the basic TeX commands don't seem to play nicely with
rubber lengths.
I'm using tabularx so I don't know the exact column-widths, and it's
clear that tex can do the maths, it's just the rule is a few points too
low.
in plain tex, you can use a rule with a negative depth
to raise it. for a rule of thickness 1pt, 2.5pt above
the baseline:
\vrule height 3.5pt depth-2.5pt width.1fil
this is a \vrule because in a table cell, you're in
horizontal mode. i'm not positive that .1fil will do
what you want in a tabular situation, but it's worth
a try.
the equivalent in latex would be
\rule[2.5pt]{.1fil}{1pt}
where 2.5pt = "lift" above baseline, 1pt = height of rule
itself, and .1fil = width -- and i really *don't* know
whether "fil" can be used in this situation; you hint
that it may not, but \rule's follow different rules than
boxes. all else about the latex \rule is covered in the
excellent book by kopka & daly.
-- bb
More information about the texhax
mailing list