[Tex/LaTex] the plain TeX equivalent of \settowidth


The \settowidth command, which sets a width equal to the width of some text, is described at Get width of a given text as length and How to set the width of the label of a description to the width of a string of text in ConTeXt?. What is the plain TeX equivalent of this command?

Best Answer

There is none other than doing the same thing by copying the LaTeX definition:

\def\settodepth {\@settodim\dp}
\def\settowidth {\@settodim\wd}

Now \settowidth\mylen{xyz} would become


so transformed into


and the trick is done, assuming you already allocated

Related Question