[texhax] alignment of parbox and fbox
Uwe Lück
uwe.lueck at web.de
Mon Sep 14 21:55:33 CEST 2009
At 21:56 08.09.09, Reinhard Kotucha wrote:
>BTW, a more general solution to your problem is to write your own macro.
>
> \newcommand{\myfbox}[1]{\fbox{\vphantom{pX}#1}}
>
>Note that in this example \vphantom contains two characters, one with
>a descender and one with an ascender. The size of descenders might be
>different for letters like p, g, j, y,... but you can put them all
>into the argument of \vphantom if you want to be sure.
However, an `X' (or `l', uppercase `i', "cap height") usually is not as
high as an `I' (lowercase `L', "ascender height"), see Wikipedia on
`Ascender (typography)':
http://en.wikipedia.org/wiki/Ascender_(typography)
It is not clear to me whether this means that Reinhard's proposal is wrong,
or that `h' etc. should be included in \vphantom ... an alternative:
It may be a rule of thumb (please correct me) that parentheses (`(', `)')
have maximum ascenders/descenders, and their depth and height sum to the
celebrated design size, i.e., they are as /deep+high/ as a \quad or em-dash
is /wide/. plain.tex and LaTeX use them for \mathstrut, which simply is
\vphantom( (maybe better \leavevmode\mathstrut(). However, in LaTeX is just
a remnant from plain.tex, only used in plain.tex's \matrix.
This means (i) \myfbox{(!?)} may be higher and deeper than \myfbox{!?} (ii)
you may need to adjust \fboxsep so 2\fboxsep+2\fboxrule don't exceed the
leading and disturb baseline distances if \fbox{#1\mathstrut} is used
inline ...
Phantoms or struts of this kind are nice inside \fbox to ensure that all
inline fboxes have same height and depth irrespective of content.
At 02:13 09.09.09, Pierre MacKay wrote:
>On 09/08/2009 12:56 PM, Reinhard Kotucha wrote:
>>BTW, a more general solution to your problem is to write your own macro.
>>
>> \newcommand{\myfbox}[1]{\fbox{\vphantom{pX}#1}}
>>
>That solution, has value as a way to make up for the lack of ascender
>height and descender height values in the basic TFM (you can easily add
>such values, on the model of the extra fontdimens in math fonts). Thus,
>you get a strut which is likely to be in the proportions of the font,
>which is not guaranteed by the plain.tex definition of \strut. Ideally,
>you can apply that ratio to the declared pointsize of the font, so that a
>strut ensures that the line containing it always covers the same vertical
>dimensions as the font. That way baseline skips don't give you nagging
>surprises.
\strut has height 0.7\baselineskip and depth 0.3\baselineskip, so it adds
the /leading/
http://en.wikipedia.org/wiki/Leading
to \mathstrut. It is used in tables/arrays (horizontal alignment) to get
usual distance of baselines, replacing the usual line spacing mechanism
described in TeXbook on p. 78ff.
Pierre MacKay continued:
>I end every footnote with such a proportioned strut.
This final strut is automatically appended by \footnote with LaTeX as well
as with plain.tex. It is not a typographical finesse, rather it is
indispensable to keep baselines of adjacent footnotes properly apart, due
to the usual primitive way footnotes for a column are constructed (the
mechanism of TeXbook p. 78 doesn't apply, similar situation as with
horizontal alignment). However, it may be considered typographical finesse
to modify \footnote so the final strut is extra deep to get an extra space
between footnotes, similar to positive \parskip. If you typeset long
footnotes (of possibly more than one paragraph) with positive \parskip,
this finesse becomes a must again.
Stop -- Uwe L..
More information about the texhax
mailing list