[texhax] alignment of parbox and fbox

Pierre MacKay pierre.mackay at comcast.net
Wed Sep 9 02:13:37 CEST 2009

On 09/08/2009 12:56 PM, Reinhard Kotucha wrote:
> On 8 September 2009 bill lam wrote:
>   >  Thanks to Lars, hh, Uwe for help.  I can get a perfect alignment now.
>   >
>   >  I learn latex by reading the book 'A Guide to Latex' by Kopka and Daly
>   >  (the 1993 edition),  There are no \vphantom or \strut mentioned in that
>   >  book.  I guess that are new commands introduced later.
> Does it describe LaTeX 2e already?  If not, it's worthwhile to
> consider to buy a newer book.  If it mentions \documentstyle instead
> of \documentclass, it still describes LaTeX 2.09.  I'm wondering
> because LaTeX 2e was released in 1994.
> 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.
> Regards,
>    Reinhard
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.  I end every footnote with such a proportioned strut.

Pierre MacKay

More information about the texhax mailing list