\savebox

\sbox{cmd}[text] \savebox{cmd}[width][pos]{text}

These commands typeset text in a box just as for \mbox or \makebox. However, instead of printing the resulting box, they save it in bin cmd, which must have been declared with \newsavebox.