[Dev-luatex] dimension helper

Taco Hoekwater taco at elvenkind.com
Sat Feb 20 17:40:01 CET 2010


David Kastrup wrote:
> 
> No, it isn't.  It is a matter of multiplication, division and
> truncation.
> 
> It is a little-know fact that 2.54cm are 72.2698pt in TeX, 1in is
> 72.26999pt, and both are different from 72.27pt, while 254cm and 100in
> perfectly well are 7227.0pt.
> 
> So no, you can't substitute a unit in TeX with a constant.  Units are
> _fractions_ of sp, and applying a "multiplier" to them does not work
> like one would think.

Valid points. I don't see much use in a generic converter, but

  tex.sp "string"

is a quick and simple extension.

Although I do fear that dimen_to_number (in ltexlib.c) will need
un-fixing to be totally compatible with TeX82: I am using strtod()
and the documented conversion ratios there instead of the actual
code from Knuth.

Best wishes,
Taco






More information about the dev-luatex mailing list