I need to put a symbol over some text, I want to use \hspace{#1}
where #1
is the width of the #1
text used.
For example, write \mycommand{p}{b}
and the result to be shown like the b
over the p
, just like the symbol \th
, but allowing me to write more than one letter.
For example, \mycommand{text1}{\LaTeX}
, placing the word \LaTex
over the word text
\hspace
is not what you need. Probably there are better ways.\settowidth{\mylen}{Some text}
is what you want (see here). The command as given sets\mylen
to the width of the 'Some text'.