# [NTG-context] character width

Taco Hoekwater taco at elvenkind.com
Tue Oct 24 14:55:09 CEST 2006


Steffen Wolfrum wrote:
> Hi,
>
> for fine-adjusting I need to have a variable horizontal space
> sometimes the width of "999" sometimes of "1", for example.
> Is there a command that reads the width of a character so it can be
> used in some kind of horizontal space?

There is a \fontcharwd primitive to measure the width of a single
character is a specific font:

\hskip \the\fontcharwd \font 1

but it may be easier to put the number(s) in a box and measure the
width of that:

\setbox\scratchbox=\hbox{999}%
\hskip \the\wd \scratchbox

Greetings, Taco
`