[NTG-context] Dropped caps, \startlines\stoplines, and indentation question

Taco Hoekwater taco at elvenkind.com
Sun Jan 29 18:59:05 CET 2006


Adrian Drury wrote:
> Is there a way to calculate the width of some number of characters (or a 
> string of characters) to use as a dimension parameter? For example, a 
> macro that returns the width in points of 5 space characters in the 
> current font? I figured hardcoding the width of a space as a percentage 
> of an em might work, but would probably not be consistent across fonts. 
> Is that true, or is it really that simple?

That would break now and then. Here is how you get the natural
size of a space:

   \setbox0=\hbox{ }

now \wd0 (the WiDth of box 0) is the 'natural' width of a space.
But note that this is not 100% accurate in normal typesetting,
because TeX adjusts spaces when needed for justification.
Anyway, after this \setbox command,

    5\wd0

is the width of five spaces, etc.

Chees, taco


More information about the ntg-context mailing list