Is there a TeX command that returns the width of a given text as length value, so that I can use the result directly as a length argument of another command?
I mean, I would like to have a command \getWidth{my text}
and want to use the result directly as the first argument of \parbox
:
\parbox{\getWidth{my text}}{my foo\\bar text}
Best Answer
Use the
calc
package (\usepackage{calc}
):