\settowidth (LaTeX2e unofficial reference manual (November 2018))

Previous: \settoheight, Up: Lengths [Contents][Index]

### 14.6 `\settowidth`

Synopsis:

    \settowidth{len}{text}

Set the length len to the width of the box that LaTeX gets on typesetting the text argument. The length name len must begin with a backslash, `\`.

This measures the width of the lowercase ASCII alphabet.

    \newlength{\alphabetwidth}
    \settowidth{\alphabetwidth}{abcdefghijklmnopqrstuvwxyz}
    \the\alphabetwidth

If no such length len has been set aside, if for example you mistype the above as `\settowidth{\aplhabetwidth}{abc...}`, then you get something like ‘`Undefined control sequence. <argument> \aplhabetwidth`’. If you leave the backslash out of len, as in `\settoheight{alphabetwidth}{...}` then you get something like ‘`Missing number, treated as zero. <to be read again> \setbox`’.

Unofficial LaTeX2e reference manual