W3cubDocs

/LaTeX

\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’.

© 2007–2018 Karl Berry
Public Domain Software
http://latexref.xyz/_005csettowidth.html